From 9eb7f721e6d25fb18ed39215060a2b0c0914c00a Mon Sep 17 00:00:00 2001 From: Michael Standen Date: Tue, 6 May 2025 11:47:53 +1200 Subject: [PATCH] Update sales contracts --- README.md | 4 +- .../token_library/ERC1155SaleFactory.ts | 316 ++++++++------ .../token_library/ERC721SaleFactory.ts | 389 ++++++++++-------- 3 files changed, 406 insertions(+), 303 deletions(-) diff --git a/README.md b/README.md index f79c529..5002a7c 100644 --- a/README.md +++ b/README.md @@ -148,8 +148,8 @@ The following is a list of contracts that are deployed by this script. | ERC20ItemsFactory | 0x1063cBEe6b3Cd69B49f1B922A0D402f484b39855 | | ERC721ItemsFactory | 0x29BCF1043Ca4B2c95aB28082143587896D39D22D | | ERC1155ItemsFactory | 0x7364fDEFe24385B2b3869504383c94cF083AcbD6 | -| ERC721SaleFactory | 0x4c4192D5b43B723eDbfce2434fA7b98402034513 | -| ERC1155SaleFactory | 0x64f1019bDC2F79688c5885Bc2bc4B57f7e88547c | +| ERC721SaleFactory | 0xc412172a99e657609f5f7D4b9Bea37684B8eEE4E | +| ERC1155SaleFactory | 0x87Aed5A2eAd1d1528EddCd30790441828e21B614 | | ERC721SoulboundFactory | 0x2fBFF6fd3C978ab1bBd21b878262c5289a14b6c1 | | ERC1155SoulboundFactory | 0xaB069C041FaCAB8f4D747D91EEda5705b5caAB76 | | ERC1155PackFactory | 0x305197A57961CB16Df8D7F829Baf6aaF4bfD0d48 | diff --git a/scripts/factories/token_library/ERC1155SaleFactory.ts b/scripts/factories/token_library/ERC1155SaleFactory.ts index 9a31586..a3be027 100644 --- a/scripts/factories/token_library/ERC1155SaleFactory.ts +++ b/scripts/factories/token_library/ERC1155SaleFactory.ts @@ -1,7 +1,7 @@ import { ContractFactory, type ethers } from 'ethers' import type { VerificationRequest } from 'scripts/types' -// https://github.com/0xsequence/contracts-library/blob/f097647f0bf6ff4667f27ab13abfa1f6827e8452/src/tokens/ERC1155/utility/sale/ERC1155SaleFactory.sol +// https://github.com/0xsequence/contracts-library/blob/ead1baf34270c76260d01cfc130bb7cc9d57518e/src/tokens/ERC1155/utility/sale/ERC1155SaleFactory.sol const abi = [ { @@ -16,41 +16,39 @@ const abi = [ type: 'constructor' }, { + anonymous: false, inputs: [ { + indexed: false, internalType: 'address', name: 'proxyAddr', - type: 'address', - indexed: false + type: 'address' } ], - type: 'event', name: 'ERC1155SaleDeployed', - anonymous: false + type: 'event' }, { + anonymous: false, inputs: [ { + indexed: true, internalType: 'address', name: 'previousOwner', - type: 'address', - indexed: true + type: 'address' }, { + indexed: true, internalType: 'address', name: 'newOwner', - type: 'address', - indexed: true + type: 'address' } ], - type: 'event', name: 'OwnershipTransferred', - anonymous: false + type: 'event' }, { inputs: [], - stateMutability: 'view', - type: 'function', name: 'beacon', outputs: [ { @@ -58,7 +56,9 @@ const abi = [ name: '', type: 'address' } - ] + ], + stateMutability: 'view', + type: 'function' }, { inputs: [ @@ -72,12 +72,22 @@ const abi = [ name: 'tokenOwner', type: 'address' }, - { internalType: 'address', name: 'items', type: 'address' } + { + internalType: 'address', + name: 'items', + type: 'address' + } ], - stateMutability: 'nonpayable', - type: 'function', name: 'deploy', - outputs: [{ internalType: 'address', name: 'proxyAddr', type: 'address' }] + outputs: [ + { + internalType: 'address', + name: 'proxyAddr', + type: 'address' + } + ], + stateMutability: 'nonpayable', + type: 'function' }, { inputs: [ @@ -91,31 +101,55 @@ const abi = [ name: 'tokenOwner', type: 'address' }, - { internalType: 'address', name: 'items', type: 'address' } + { + internalType: 'address', + name: 'items', + type: 'address' + } ], - stateMutability: 'view', - type: 'function', name: 'determineAddress', - outputs: [{ internalType: 'address', name: 'proxyAddr', type: 'address' }] + outputs: [ + { + internalType: 'address', + name: 'proxyAddr', + type: 'address' + } + ], + stateMutability: 'view', + type: 'function' }, { inputs: [], - stateMutability: 'view', - type: 'function', name: 'owner', - outputs: [{ internalType: 'address', name: '', type: 'address' }] + outputs: [ + { + internalType: 'address', + name: '', + type: 'address' + } + ], + stateMutability: 'view', + type: 'function' }, { inputs: [], + name: 'renounceOwnership', + outputs: [], stateMutability: 'nonpayable', - type: 'function', - name: 'renounceOwnership' + type: 'function' }, { - inputs: [{ internalType: 'address', name: 'newOwner', type: 'address' }], + inputs: [ + { + internalType: 'address', + name: 'newOwner', + type: 'address' + } + ], + name: 'transferOwnership', + outputs: [], stateMutability: 'nonpayable', - type: 'function', - name: 'transferOwnership' + type: 'function' }, { inputs: [ @@ -125,9 +159,10 @@ const abi = [ type: 'address' } ], + name: 'upgradeBeacon', + outputs: [], stateMutability: 'nonpayable', - type: 'function', - name: 'upgradeBeacon' + type: 'function' } ] @@ -135,7 +170,7 @@ export class ERC1155SaleFactory extends ContractFactory { constructor(signer?: ethers.Signer) { super( abi, - '0x608034610121576001600160401b0390601f61500538819003918201601f191683019291908484118385101761010b57816020928492604096875283398101031261012157516001600160a01b0380821682036101215761005f33610126565b825193612c3394858101958187108388111761010b576123d2823980600096039086f0908115610101578451916105ee808401928311848410176100ed5791848492602094611de4853916815203019085f080156100e0576100d39394501660018060a01b03196001541617600155610126565b51611c76908161016e8239f35b50505051903d90823e3d90fd5b634e487b7160e01b88526041600452602488fd5b84513d87823e3d90fd5b634e487b7160e01b600052604160045260246000fd5b600080fd5b600080546001600160a01b039283166001600160a01b03198216811783559216907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09080a356fe6040608081526004908136101561001557600080fd5b600091823560e01c80631bce45831461079057806359659e901461073d578063715018a6146106a05780638da5cb5b1461064b578063d9181cd3146102ee578063e657f693146101aa5763f2fde38b1461006e57600080fd5b346101a65760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126101a6576100a561084f565b906100ae6108bd565b73ffffffffffffffffffffffffffffffffffffffff809216928315610123575050600054827fffffffffffffffffffffffff0000000000000000000000000000000000000000821617600055167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0600080a380f35b90602060849251917f08c379a0000000000000000000000000000000000000000000000000000000008352820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152fd5b8280fd5b8284346102eb5760607ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126102eb57506101e461084f565b906101ed610877565b916055600b6101fa61089a565b845173ffffffffffffffffffffffffffffffffffffffff968716602080830191825292909716604080830191909152815290957fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe09161025a60608261099b565b519020906102ab86519161026d8361097f565b6000835273ffffffffffffffffffffffffffffffffffffffff9661029f8860015416948a519586938d850198896109ff565b0390810183528261099b565b5190206111eb85516102bf8883018261099b565b81815287810191610a5683395190209085519186830152868201523081520160ff815320915191168152f35b80fd5b5090346101a65760607ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126101a65761032761084f565b92610330610877565b61033861089a565b908351946020968787018761037586868490602090939293604083019473ffffffffffffffffffffffffffffffffffffffff809216845216910152565b03976103a77fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0998a810183528261099b565b5190208651916103b68361097f565b6000835273ffffffffffffffffffffffffffffffffffffffff91816103f98c6103ed878d88600154169051958694850197886109ff565b038c810183528261099b565b5190206111eb895161040d8d83018261099b565b8181528c810191610a5683398051156105f057518492918af516988915610594578260015416938a3b156105905791608491601f8a95946104988f8e51998a9889977fcf7a1d77000000000000000000000000000000000000000000000000000000008952168c880152602487015260606044870152825192839182606489015288880191016109dc565b01168101030181838b5af1801561058657908591610572575b5050853b1561056e5784517f485cc95500000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff928316918101918252929091166020820152829082908190604001038183885af1801561056457610550575b50507f346f0211197dd599e2e2a8c828f6e7dc39e8a49171ce0a728428e8b778c61eea838251848152a151908152f35b61055a829161093c565b6102eb5780610520565b83513d84823e3d90fd5b8380fd5b61057b9061093c565b61056e5783386104b1565b86513d87823e3d90fd5b8880fd5b6064858c8b51917f08c379a0000000000000000000000000000000000000000000000000000000008352820152601960248201527f437265617465323a204661696c6564206f6e206465706c6f79000000000000006044820152fd5b6064878e808e51927f08c379a000000000000000000000000000000000000000000000000000000000845283015260248201527f437265617465323a2062797465636f6465206c656e677468206973207a65726f6044820152fd5b50503461069c57817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261069c5773ffffffffffffffffffffffffffffffffffffffff60209254169051908152f35b5080fd5b83346102eb57807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126102eb576106d76108bd565b600073ffffffffffffffffffffffffffffffffffffffff81547fffffffffffffffffffffffff000000000000000000000000000000000000000081168355167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08280a380f35b50503461069c57817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261069c5760209073ffffffffffffffffffffffffffffffffffffffff600154169051908152f35b5090346101a65760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126101a657826107ca61084f565b6107d26108bd565b73ffffffffffffffffffffffffffffffffffffffff90816001541690813b1561056e5783602492865197889586947f3659cfe600000000000000000000000000000000000000000000000000000000865216908401525af1908115610846575061083a575080f35b6108439061093c565b80f35b513d84823e3d90fd5b6004359073ffffffffffffffffffffffffffffffffffffffff8216820361087257565b600080fd5b6024359073ffffffffffffffffffffffffffffffffffffffff8216820361087257565b6044359073ffffffffffffffffffffffffffffffffffffffff8216820361087257565b73ffffffffffffffffffffffffffffffffffffffff6000541633036108de57565b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602060248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152fd5b67ffffffffffffffff811161095057604052565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6020810190811067ffffffffffffffff82111761095057604052565b90601f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0910116810190811067ffffffffffffffff82111761095057604052565b60005b8381106109ef5750506000910152565b81810151838201526020016109df565b9190926048949383527fffffffffffffffffffffffffffffffffffffffff000000000000000000000000809260601b16602084015260601b166034820152610a5082518093602086850191016109dc565b01019056fe60808060405234610016576111cf908161001c8239f35b600080fdfe604060808152366103825773ffffffffffffffffffffffffffffffffffffffff807fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035416158015610b94576000917fcf7a1d77000000000000000000000000000000000000000000000000000000007fffffffff00000000000000000000000000000000000000000000000000000000843516146100c057600484517ff92ee8a9000000000000000000000000000000000000000000000000000000008152fd5b6100c8611192565b60049136831161037e5760607ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261037e578235916101088361067f565b602435926101158461067f565b60443567ffffffffffffffff811161037a57610135839136908801610789565b941692156103525761014791166107e3565b803b156102cf578451907f5c60da1b000000000000000000000000000000000000000000000000000000009384835260209687848381865afa9384156102a657889461019d9189916102b2575b503b1515610926565b7fa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d5080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff85161790555194827f1cf3b03a6cf19fa2baba4df148e9dcabedea7f8a5c07840e207e5c089be95d3e8880a28451158015906102ab575b610242575b8361023c6107d0565b80519101f35b8592839182525afa9182156102a65761026a9392610277575b506102646109b1565b91610a21565b5038808083818080610233565b610298919250843d861161029f575b610290818361070e565b810190610902565b903861025b565b503d610286565b61091a565b508661022e565b6102c99150863d881161029f57610290818361070e565b38610194565b60848360208751917f08c379a0000000000000000000000000000000000000000000000000000000008352820152602560248201527f455243313936373a206e657720626561636f6e206973206e6f74206120636f6e60448201527f74726163740000000000000000000000000000000000000000000000000000006064820152fd5b8487517ff92ee8a9000000000000000000000000000000000000000000000000000000008152fd5b8680fd5b8380fd5b73ffffffffffffffffffffffffffffffffffffffff807fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035416158015610b94576000907fcf7a1d77000000000000000000000000000000000000000000000000000000007fffffffff00000000000000000000000000000000000000000000000000000000833516146104395760046040517ff92ee8a9000000000000000000000000000000000000000000000000000000008152fd5b610441611192565b60049236841161067b5760607ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261067b5783356104808161067f565b6024359161048d8361067f565b60443567ffffffffffffffff8111610677576104ad829136908901610789565b9316931561064e576104bf91166107e3565b813b156105ca576040517f5c60da1b000000000000000000000000000000000000000000000000000000009283825260209586838281855afa9283156102a65787936105149188916105b357503b1515610926565b7fa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d5080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff841617905560405194827f1cf3b03a6cf19fa2baba4df148e9dcabedea7f8a5c07840e207e5c089be95d3e8880a28451158015906102ab57610242578361023c6107d0565b6102c99150853d871161029f57610290818361070e565b6084846020604051917f08c379a0000000000000000000000000000000000000000000000000000000008352820152602560248201527f455243313936373a206e657720626561636f6e206973206e6f74206120636f6e60448201527f74726163740000000000000000000000000000000000000000000000000000006064820152fd5b856040517ff92ee8a9000000000000000000000000000000000000000000000000000000008152fd5b8580fd5b8280fd5b73ffffffffffffffffffffffffffffffffffffffff81160361069d57565b600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6020810190811067ffffffffffffffff8211176106ed57604052565b6106a2565b6040810190811067ffffffffffffffff8211176106ed57604052565b90601f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0910116810190811067ffffffffffffffff8211176106ed57604052565b67ffffffffffffffff81116106ed57601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01660200190565b81601f8201121561069d578035906107a08261074f565b926107ae604051948561070e565b8284526020838301011161069d57816000926020809301838601378301015290565b604051906107dd826106d1565b60008252565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61039081547f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f604080519373ffffffffffffffffffffffffffffffffffffffff9081851686521693846020820152a1811561087e577fffffffffffffffffffffffff000000000000000000000000000000000000000016179055565b60846040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152fd5b9081602091031261069d57516109178161067f565b90565b6040513d6000823e3d90fd5b1561092d57565b60846040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603060248201527f455243313936373a20626561636f6e20696d706c656d656e746174696f6e206960448201527f73206e6f74206120636f6e7472616374000000000000000000000000000000006064820152fd5b604051906060820182811067ffffffffffffffff8211176106ed57604052602782527f206661696c6564000000000000000000000000000000000000000000000000006040837f416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c60208201520152565b6000806109179493602081519101845af43d15610a60573d91610a438361074f565b92610a51604051948561070e565b83523d6000602085013e610acd565b606091610acd565b15610a6f57565b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152fd5b91929015610aed5750815115610ae1575090565b610917903b1515610a68565b825190915015610b005750805190602001fd5b604051907f08c379a000000000000000000000000000000000000000000000000000000000825281602080600483015282519283602484015260005b848110610b7d575050507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f836000604480968601015201168101030190fd5b818101830151868201604401528593508201610b3c565b610bee610bd57fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035473ffffffffffffffffffffffffffffffffffffffff1690565b73ffffffffffffffffffffffffffffffffffffffff1690565b3303610d14576000357fffffffff00000000000000000000000000000000000000000000000000000000167f3659cfe6000000000000000000000000000000000000000000000000000000008103610c515750610c49610f0f565b602081519101f35b7f4f1ef286000000000000000000000000000000000000000000000000000000008103610c865750610c81611083565b610c49565b7f8f283970000000000000000000000000000000000000000000000000000000008103610cb65750610c81610ec5565b7ff851a440000000000000000000000000000000000000000000000000000000008103610ce65750610c81610dfd565b7f5c60da1b0000000000000000000000000000000000000000000000000000000003610d1457610c81610e53565b610d1c610d3b565b6000808092368280378136915af43d82803e15610d37573d90f35b3d90fd5b73ffffffffffffffffffffffffffffffffffffffff807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc541680610df8575060206004917fa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d505416604051928380927f5c60da1b0000000000000000000000000000000000000000000000000000000082525afa9081156102a657600091610de0575090565b610917915060203d811161029f57610290818361070e565b905090565b610e05611192565b73ffffffffffffffffffffffffffffffffffffffff7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103541660405190602082015260208152610917816106f2565b610e5b611192565b610e63610d3b565b73ffffffffffffffffffffffffffffffffffffffff6040519116602082015260208152610917816106f2565b7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc602091011261069d576004356109178161067f565b610ecd611192565b3660041161069d57610efc73ffffffffffffffffffffffffffffffffffffffff610ef636610e8f565b166107e3565b604051610f08816106d1565b6000815290565b610f17611192565b3660041161069d5773ffffffffffffffffffffffffffffffffffffffff610f3d36610e8f565b1660405190610f4b826106d1565b60008252803b15610fff577f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc817fffffffffffffffffffffffff0000000000000000000000000000000000000000825416179055807fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b600080a2815115801590610ff7575b610fe3575b5050604051610f08816106d1565b610fef916102646109b1565b503880610fd5565b506000610fd0565b60846040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201527f6f74206120636f6e7472616374000000000000000000000000000000000000006064820152fd5b3660041161069d5760407ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261069d576004356110c18161067f565b60243567ffffffffffffffff811161069d576110f673ffffffffffffffffffffffffffffffffffffffff913690600401610789565b9116803b15610fff577f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc817fffffffffffffffffffffffff0000000000000000000000000000000000000000825416179055807fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b600080a281511580159061118a57610fe3575050604051610f08816106d1565b506001610fd0565b3461069d5756fea264697066735822122043b19ddbf8b158c7b89e1cb0ede6eab8cd9c86ef2e863af97cab3041b065284164736f6c63430008130033a26469706673582212204ee4546b07f207803db4e631f4d5071abef8be94814153a0bf4c46091210bdfd64736f6c6343000813003360803461011a57601f6105ee38819003918201601f19168301916001600160401b0383118484101761011f5780849260209460405283398101031261011a57516001600160a01b03808216919082820361011a576000549160018060a01b0319923384821617600055604051923391167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0600080a33b156100b2575060015416176001556040516104b890816101368239f35b62461bcd60e51b815260206004820152603360248201527f5570677261646561626c65426561636f6e3a20696d706c656d656e746174696f60448201527f6e206973206e6f74206120636f6e7472616374000000000000000000000000006064820152608490fd5b600080fd5b634e487b7160e01b600052604160045260246000fdfe6080604052600436101561001257600080fd5b6000803560e01c80633659cfe6146102ce5780635c60da1b1461027c578063715018a6146101e05780638da5cb5b1461018f5763f2fde38b1461005457600080fd5b3461018c5760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261018c5760043573ffffffffffffffffffffffffffffffffffffffff808216809203610188576100ad610403565b8115610104578254827fffffffffffffffffffffffff00000000000000000000000000000000000000008216178455167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08380a380f35b60846040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152fd5b8280fd5b80fd5b503461018c57807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261018c5773ffffffffffffffffffffffffffffffffffffffff6020915416604051908152f35b503461018c57807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261018c57610217610403565b8073ffffffffffffffffffffffffffffffffffffffff81547fffffffffffffffffffffffff000000000000000000000000000000000000000081168355167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08280a380f35b503461018c57807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261018c57602073ffffffffffffffffffffffffffffffffffffffff60015416604051908152f35b503461018c5760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261018c5760043573ffffffffffffffffffffffffffffffffffffffff81169081810361018857610328610403565b3b1561037f57807fffffffffffffffffffffffff000000000000000000000000000000000000000060015416176001557fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b8280a280f35b60846040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603360248201527f5570677261646561626c65426561636f6e3a20696d706c656d656e746174696f60448201527f6e206973206e6f74206120636f6e7472616374000000000000000000000000006064820152fd5b73ffffffffffffffffffffffffffffffffffffffff60005416330361042457565b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602060248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152fdfea2646970667358221220c5471b22132cd15b928c4c1e3eecf6a636721aed3c412c5d6ea7e25407ed048464736f6c634300081300336080806040523461001657612c17908161001c8239f35b600080fdfe61010080604052600436101561001457600080fd5b600080608052803560e01c91826301ffc9a714611927575081630869678c146118f0578163119cd50c1461187e578163248a9ca31461184f5781632f2ff15d1461174d5781633013ce291461171757816336568abe1461165157816344004cc1146115b05781634782f77914611544578163485cc9551461121b5781634f651ccd146110d957816360e606f6146104675781636a326ab1146104015781639010d07c146103ac57816391d1485414610355578163975596001461020f578163a217fddf146101f1578163bad436611461017c57508063ca15c8731461014e5763d547741f1461010257600080fd5b3461014857604060031936011261014857610142600435610121611a33565b90806080515261013d6001604060805180602052200154612083565b612224565b60805180f35b60805180fd5b3461014857602060031936011261014857600435608051526001602052602060406080512054604051908152f35b346101485760806003193601126101485760243567ffffffffffffffff8111610148576101ad903690600401611c09565b6044929192359173ffffffffffffffffffffffffffffffffffffffff831683036101ee5760206101e4606435858588600435612a9f565b6040519015158152f35b80fd5b3461014857608051806003193601126101ee57602090604051908152f35b346101485760a06003193601126101485760043590602435916044359167ffffffffffffffff908184168094036101ee5750610249611a7e565b9260843591610256611f0d565b841690808210801561034b575b610321577f8fd3ac39fbb3d5e9c906dd9ec439dc6e584b8fa3ce02d5b67d589b22b22152a99560a09584608060405161029b81611a95565b88815284602082015285604082015286606082015201528560055581600655827fffffffffffffffffffffffffffffffff000000000000000000000000000000006fffffffffffffffff00000000000000006007549360401b1692161717600755836008556040519485526020850152604084015260608301526080820152a160805180f35b60046040517f85d4a748000000000000000000000000000000000000000000000000000000008152fd5b5042821115610263565b346101485760406003193601126101485760ff6040602092610375611a33565b6004356080515273ffffffffffffffffffffffffffffffffffffffff83608051808852209116825284522054166040519015158152f35b3461014857604060031936011261014857600435608051526001602052602073ffffffffffffffffffffffffffffffffffffffff6103f16024356040608051206124db565b9190546040519260031b1c168152f35b346101485760206003193601126101485773ffffffffffffffffffffffffffffffffffffffff61042f611a5b565b610437611f0d565b167fffffffffffffffffffffffff0000000000000000000000000000000000000000600454161760045560805180f35b60e06003193601126101485761047b611a5b565b60243567ffffffffffffffff81116101485761049b903690600401611b71565b60443567ffffffffffffffff8111610148576104bb903690600401611b71565b916064359167ffffffffffffffff831161014857366023840112156101485782600401356104e881611bcf565b936104f66040519586611b18565b818552366024838301011161014857602482910160208601376020608051918501015273ffffffffffffffffffffffffffffffffffffffff60843516608435036101485767ffffffffffffffff60c435116101485761055d9391933660c435600401611c09565b9060c052926080519283928496610572612782565b60a0526105a067ffffffffffffffff604060a05101511667ffffffffffffffff606060a05101511690612a4c565b60805160e08190529094905b835160e05110156107e3576105c360e0518561273a565b51968760e051151591826107d8575b50506107ae57866105e560e0518761273a565b5191816080515260096020526105ff6040608051206127c5565b61062667ffffffffffffffff60408301511667ffffffffffffffff60608401511690612a4c565b1561069e5750508661066d57506106569061065060019961064a8360a051516122d7565b90612319565b9a612319565b9661066260e05161270d565b60e0529896986105ac565b602490604051907f035acf500000000000000000000000000000000000000000000000000000000082526004820152fd5b9099916080820151908c826106c4575b505050829161064a6106569461065093516122d7565b816106d491339060c05186612a9f565b1561072b575060808051339052600260209081528151604080822094909152929052512080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660011790558161064a8c6106ae565b8c604051927f265c66a80000000000000000000000000000000000000000000000000000000084526004840152608060248401528060848401527f07ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff811161014857829060051b60a4928160c0518585013733604484015260648301528101030190fd5b60046040517f340bc4c9000000000000000000000000000000000000000000000000000000008152fd5b10159050878c6105d2565b84888a8693610e80575b5073ffffffffffffffffffffffffffffffffffffffff600454168073ffffffffffffffffffffffffffffffffffffffff6084351603610e42575060a435818110610dec575060843573ffffffffffffffffffffffffffffffffffffffff16610d3757803403610ce057505b73ffffffffffffffffffffffffffffffffffffffff60035460081c1660805190835182905b808210610b0d5750506006549081151580610a7f575b6109b75750505073ffffffffffffffffffffffffffffffffffffffff60035460081c1690813b15610148576109229461094961093473ffffffffffffffffffffffffffffffffffffffff93604051988997889687967fb48ab8b600000000000000000000000000000000000000000000000000000000885216600487015260806024870152608486019061274e565b9060031985830301604486015261274e565b600319838203016064840152608051966121e1565b0391608051905af180156109aa576109615760805180f35b67ffffffffffffffff81116109795760405280610142565b7f4e487b71000000000000000000000000000000000000000000000000000000006080515260416004526024608051fd5b6040513d608051823e3d90fd5b906020600492604051938480927f18160ddd000000000000000000000000000000000000000000000000000000008252608051905af19182156109aa5760805192610a49575b50610a45906040519384937fa9227830000000000000000000000000000000000000000000000000000000008552600485016040919493926060820195825260208201520152565b0390fd5b9091506020813d602011610a77575b81610a6560209383611b18565b81010312610148575190610a456109fd565b3d9150610a58565b506040517f18160ddd000000000000000000000000000000000000000000000000000000008152602081600481608051865af180156109aa5784849160805190610ad5575b610acf929350612319565b11610893565b5050506020813d602011610b05575b81610af160209383611b18565b810103126101485751829081908590610ac4565b3d9150610ae4565b9092610b19848761273a565b516080515260096020526001604060805120015480151580610c3f575b610b5f5750610b53610b5991610b4c868861273a565b5190612319565b9361270d565b9061087d565b8385876020610b6e838c61273a565b516024604051809681937f2693ebf20000000000000000000000000000000000000000000000000000000083526004830152608051905af19283156109aa5760805193610c09575b50610a4591610bc49161273a565b51926040519384937fa9227830000000000000000000000000000000000000000000000000000000008552600485016040919493926060820195825260208201520152565b9092506020813d602011610c37575b81610c2560209383611b18565b81010312610148575191610a45610bb6565b3d9150610c18565b50610c4a858861273a565b51604051907f2693ebf20000000000000000000000000000000000000000000000000000000082526004820152602081602481608051895af180156109aa57829160805191610ca9575b50610ca390610b4c888a61273a565b11610b36565b9150506020813d602011610cd8575b81610cc560209383611b18565b8101031261014857518190610ca3610c94565b3d9150610cb8565b6040517f1eabcfbe00000000000000000000000000000000000000000000000000000000815260843573ffffffffffffffffffffffffffffffffffffffff1660048201526024810191909152346044820152606490fd5b3415610d7d5760646040517f1eabcfbe00000000000000000000000000000000000000000000000000000000815260805160048201526080516024820152346044820152fd5b610de790604051907f23b872dd000000000000000000000000000000000000000000000000000000006020830152336024830152306044830152606482015260648152610dc981611a95565b73ffffffffffffffffffffffffffffffffffffffff6084351661280d565b610858565b6040517f1eabcfbe00000000000000000000000000000000000000000000000000000000815260843573ffffffffffffffffffffffffffffffffffffffff16600482015260248101929092526044820152606490fd5b606491604051917f1eabcfbe000000000000000000000000000000000000000000000000000000008352600483015260248201526080516044820152fd5b608060a05101519081610e94575b506107ed565b336080515260026020526080518260408220915260205260ff60406080512054161580610fb1575b15610f0f5750336080515260026020526080519060408220915260205260406080512060017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff008254161790558580610e8e565b604051917f265c66a80000000000000000000000000000000000000000000000000000000083526004830152608060248301528060848301527f07ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8111610148578160a49160051b8060c051848401373360448301527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff60648301528101030190fd5b509491959260409491945160208101907fffffffffffffffffffffffffffffffffffffffff0000000000000000000000003360601b1682527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff60348201526034815261101c81611ae0565b5190209661102987611b59565b97611037604051998a611b18565b87895260208901368960051b60c05101116101485760c051905b8960051b60c0510182106110c957505095608051965b89518810156110b75761107a888b61273a565b51608051818310156110a55750906080515260205261109f6040608051205b9761270d565b96611067565b5260205261109f604060805120611099565b90939650839194979295985014610ebc565b8135815260209182019101611051565b346101485760c0600319360112610148576024356044356004356110fb611a7e565b60843567ffffffffffffffff93848216809203610148578460a4359361111f611f0d565b16908183108015611211575b610321577f8ced76aee4b96a1e218e7903610fc7d648023d9075677163a5b31396cb280f969660c09660036040519161116383611a95565b83835260208301908582526040840190878252606085019089825260808601938b85528c60805152600960205260406080512096518755516001870155600286019251167fffffffffffffffffffffffffffffffff000000000000000000000000000000006fffffffffffffffff00000000000000008454935160401b1692161717905551910155604051958652602086015260408501526060840152608083015260a0820152a160805180f35b504283111561112b565b3461014857604060031936011261014857611234611a5b565b61123c611a33565b6003549060ff821661151a5774ffffffffffffffffffffffffffffffffffffffff007fffffffffffffffffffffff0000000000000000000000000000000000000000ff9160081b1691161760035560805180526113a260805160209281845273ffffffffffffffffffffffffffffffffffffffff604083209116809252835260805160ff604082205416156114ac575b506080518052600183818095526112e8836040608051206124f3565b507f4c02318d8c3aadc98ccf18aebbf3126f651e0c3f6a1de5ff8edcf6724a2ad5c280608051526080518083528460408220915282528060805160ff6040822054161561143f575b505060805152818152611348836040608051206124f3565b507f5d8e12c39142ff96d79d04d15d1ba1269e4fe57bb9d26f43523628b34ba108ec80608051526080518083528460408220915282528060805160ff604082205416156113d2575b505060805152526040608051206124f3565b507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00600354161760035560805180f35b5260805180835284604082209152825260805160408120847fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0082541617905584827f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d339380a48087611390565b5260805180835284604082209152825260805160408120847fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0082541617905584827f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d339380a48087611330565b80526080518084528160408220915283526080516040812060017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff008254161790558133917f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d8180a4836112cc565b60046040517ff92ee8a9000000000000000000000000000000000000000000000000000000008152fd5b346101485760406003193601126101485761155d611a5b565b611565611c3a565b60805180808093602435905af161157a612950565b50156115865760805180f35b60046040517f750b219c000000000000000000000000000000000000000000000000000000008152fd5b34610148576060600319360112610148576115c9611a5b565b6115d1611a33565b6115d9611c3a565b604051907fa9059cbb00000000000000000000000000000000000000000000000000000000602083015273ffffffffffffffffffffffffffffffffffffffff8091166024830152604435604483015260448252608082019282841067ffffffffffffffff85111761097957610142936040521661280d565b346101485760406003193601126101485761166a611a33565b3373ffffffffffffffffffffffffffffffffffffffff8216036116935761014290600435612224565b60846040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201527f20726f6c657320666f722073656c6600000000000000000000000000000000006064820152fd5b3461014857608051806003193601126101ee57602073ffffffffffffffffffffffffffffffffffffffff60045416604051908152f35b34610148576040600319360112610148576117db600435600161176e611a33565b9180608051526080519061178c836040602094808652200154612083565b80608051526080519384835273ffffffffffffffffffffffffffffffffffffffff60408620911680955282528060805160ff604082205416156117e257505060805152526040608051206124f3565b5060805180f35b5260805180835284604082209152825260805160408120847fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0082541617905584827f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d339380a48086611390565b346101485760206003193601126101485760043560805152602060016040608051808452200154604051908152f35b3461014857608051806003193601126101ee57611899612a74565b506118ec6118a5612782565b6040519182918291909160808060a0830194805184526020810151602085015267ffffffffffffffff80604083015116604086015260608201511660608501520151910152565b0390f35b3461014857602060031936011261014857611909612a74565b506004356080515260096020526118ec6118a56040608051206127c5565b34611a2f576020600319360112611a2f576004357fffffffff000000000000000000000000000000000000000000000000000000008116809103611a2b5760209250807f49007a5f000000000000000000000000000000000000000000000000000000001490811561199b575b5015158152f35b7f5a05180f000000000000000000000000000000000000000000000000000000008114915081156119ce575b5083611994565b7f7965db0b00000000000000000000000000000000000000000000000000000000811491508115611a01575b50836119c7565b7f01ffc9a700000000000000000000000000000000000000000000000000000000915014836119fa565b8280fd5b5080fd5b6024359073ffffffffffffffffffffffffffffffffffffffff82168203611a5657565b600080fd5b6004359073ffffffffffffffffffffffffffffffffffffffff82168203611a5657565b6064359067ffffffffffffffff82168203611a5657565b60a0810190811067ffffffffffffffff821117611ab157604052565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6060810190811067ffffffffffffffff821117611ab157604052565b6080810190811067ffffffffffffffff821117611ab157604052565b90601f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0910116810190811067ffffffffffffffff821117611ab157604052565b67ffffffffffffffff8111611ab15760051b60200190565b81601f82011215611a5657803591611b8883611b59565b92611b966040519485611b18565b808452602092838086019260051b820101928311611a56578301905b828210611bc0575050505090565b81358152908301908301611bb2565b67ffffffffffffffff8111611ab157601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01660200190565b9181601f84011215611a565782359167ffffffffffffffff8311611a56576020808501948460051b010111611a5657565b3360009081527f20be27040b8e00df40bca0df34743417f3574a156386188f7d7f14369e5ee82b602090815260408083205490927f5d8e12c39142ff96d79d04d15d1ba1269e4fe57bb9d26f43523628b34ba108ec9160ff1615611c9e5750505050565b611ca733612366565b91845190611cb482611afc565b60428252848201926060368537825115611ee05760308453825190600191821015611ee05790607860218501536041915b818311611e1557505050611db9576048610a45938693611d8393611d7498519889937f416363657373436f6e74726f6c3a206163636f756e74200000000000000000008a860152611d3f815180928c6037890191016121be565b8401917f206973206d697373696e6720726f6c65200000000000000000000000000000006037840152518093868401906121be565b01036028810187520185611b18565b519283927f08c379a0000000000000000000000000000000000000000000000000000000008452600484015260248301906121e1565b6064848651907f08c379a000000000000000000000000000000000000000000000000000000000825280600483015260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152fd5b909192600f81166010811015611eb3577f3031323334353637383961626364656600000000000000000000000000000000901a611e528587612326565b5360041c928015611e86577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff019190611ce5565b6024827f4e487b710000000000000000000000000000000000000000000000000000000081526011600452fd5b6024837f4e487b710000000000000000000000000000000000000000000000000000000081526032600452fd5b807f4e487b7100000000000000000000000000000000000000000000000000000000602492526032600452fd5b3360009081527f6058ee1f1c102e8ac9ef0c4319964e42c1ab00dfba021f8302fd0802656934ac602090815260408083205490927f4c02318d8c3aadc98ccf18aebbf3126f651e0c3f6a1de5ff8edcf6724a2ad5c29160ff1615611f715750505050565b611f7a33612366565b91845190611f8782611afc565b60428252848201926060368537825115611ee05760308453825190600191821015611ee05790607860218501536041915b81831161201257505050611db9576048610a45938693611d8393611d7498519889937f416363657373436f6e74726f6c3a206163636f756e74200000000000000000008a860152611d3f815180928c6037890191016121be565b909192600f81166010811015611eb3577f3031323334353637383961626364656600000000000000000000000000000000901a61204f8587612326565b5360041c928015611e86577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff019190611fb8565b600090808252602090828252604092838120338252835260ff8482205416156120ac5750505050565b6120b533612366565b918451906120c282611afc565b60428252848201926060368537825115611ee05760308453825190600191821015611ee05790607860218501536041915b81831161214d57505050611db9576048610a45938693611d8393611d7498519889937f416363657373436f6e74726f6c3a206163636f756e74200000000000000000008a860152611d3f815180928c6037890191016121be565b909192600f81166010811015611eb3577f3031323334353637383961626364656600000000000000000000000000000000901a61218a8587612326565b5360041c928015611e86577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0191906120f3565b60005b8381106121d15750506000910152565b81810151838201526020016121c1565b907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f60209361221d815180928187528780880191016121be565b0116010190565b90604061226f926000908082528160205273ffffffffffffffffffffffffffffffffffffffff83832094169384835260205260ff8383205416612272575b81526001602052206125b4565b50565b808252816020528282208483526020528282207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0081541690553384827ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b8580a4612262565b818102929181159184041417156122ea57565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b919082018092116122ea57565b908151811015612337570160200190565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6040519061237382611ae0565b602a82526020820160403682378251156123375760309053815160019081101561233757607860218401536029905b8082116124105750506123b25790565b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602060248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152fd5b9091600f811660108110156124ad577f3031323334353637383961626364656600000000000000000000000000000000901a61244c8486612326565b5360041c91801561247f577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff01906123a2565b602460007f4e487b710000000000000000000000000000000000000000000000000000000081526011600452fd5b602460007f4e487b710000000000000000000000000000000000000000000000000000000081526032600452fd5b80548210156123375760005260206000200190600090565b919060018301600090828252806020526040822054156000146125ae5784549468010000000000000000861015612581578361257161253c886001604098999a018555846124db565b81939154907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff9060031b92831b921b19161790565b9055549382526020522055600190565b6024837f4e487b710000000000000000000000000000000000000000000000000000000081526041600452fd5b50925050565b90600182019060009281845282602052604084205490811515600014612706577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff918281018181116126d9578254908482019182116126ac57808203612677575b5050508054801561264a5782019161262d83836124db565b909182549160031b1b191690555582526020526040812055600190565b6024867f4e487b710000000000000000000000000000000000000000000000000000000081526031600452fd5b61269761268761253c93866124db565b90549060031b1c928392866124db565b90558652846020526040862055388080612615565b6024887f4e487b710000000000000000000000000000000000000000000000000000000081526011600452fd5b6024877f4e487b710000000000000000000000000000000000000000000000000000000081526011600452fd5b5050505090565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff81146122ea5760010190565b80518210156123375760209160051b010190565b90815180825260208080930193019160005b82811061276e575050505090565b835185529381019392810192600101612760565b6040519061278f82611a95565b816005548152600654602082015260075467ffffffffffffffff90818116604084015260401c1660608201526080600854910152565b906040516127d281611a95565b6080600382948054845260018101546020850152600281015467ffffffffffffffff90818116604087015260401c1660608501520154910152565b73ffffffffffffffffffffffffffffffffffffffff1690604051604081019080821067ffffffffffffffff831117611ab15761288d916040526020938482527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564858301526000808587829751910182855af1612887612950565b91612980565b80519182159184831561292c575b5050509050156128a85750565b608490604051907f08c379a00000000000000000000000000000000000000000000000000000000082526004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152fd5b919381809450010312611a2f578201519081151582036101ee57508038808461289b565b3d1561297b573d9061296182611bcf565b9161296f6040519384611b18565b82523d6000602084013e565b606090565b919290156129fb5750815115612994575090565b3b1561299d5790565b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152fd5b825190915015612a0e5750805190602001fd5b610a45906040519182917f08c379a00000000000000000000000000000000000000000000000000000000083526020600484015260248301906121e1565b908015918215612a6a575b508115612a62575090565b905042101590565b4210915038612a57565b60405190612a8182611a95565b60006080838281528260208201528260408201528260608201520152565b91929060009073ffffffffffffffffffffffffffffffffffffffff8316825260209060028252604093848420868552835260ff8585205416159788612aea575b505050505050505090565b909192939597508496989451907fffffffffffffffffffffffffffffffffffffffff0000000000000000000000008583019360601b168352603482015260348152612b3481611ae0565b51902090612b4188611b59565b97612b4e8751998a611b18565b8089528389019060051b820191368311612bdd578490915b838310612bcd57505050509183925b8751841015612bb857612b88848961273a565b519081811015612ba85785528252612ba28585209361270d565b92612b75565b9085528252612ba2858520610b53565b94509550505050143880808080808080612adf565b8235815291810191859101612b66565b8680fdfea2646970667358221220036789f230adce122f8986ce878d7f455cb45c2b5a3b66278304adee742ba3ee64736f6c63430008130033', + '0x608034610121576001600160401b0390601f6151e238819003918201601f191683019291908484118385101761010b57816020928492604096875283398101031261012157516001600160a01b0380821682036101215761005f33610126565b825193612e1094858101958187108388111761010b576123d2823980600096039086f0908115610101578451916105ee808401928311848410176100ed5791848492602094611de4853916815203019085f080156100e0576100d39394501660018060a01b03196001541617600155610126565b51611c76908161016e8239f35b50505051903d90823e3d90fd5b634e487b7160e01b88526041600452602488fd5b84513d87823e3d90fd5b634e487b7160e01b600052604160045260246000fd5b600080fd5b600080546001600160a01b039283166001600160a01b03198216811783559216907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09080a356fe6040608081526004908136101561001557600080fd5b600091823560e01c80631bce45831461079057806359659e901461073d578063715018a6146106a05780638da5cb5b1461064b578063d9181cd3146102ee578063e657f693146101aa5763f2fde38b1461006e57600080fd5b346101a65760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126101a6576100a561084f565b906100ae6108bd565b73ffffffffffffffffffffffffffffffffffffffff809216928315610123575050600054827fffffffffffffffffffffffff0000000000000000000000000000000000000000821617600055167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0600080a380f35b90602060849251917f08c379a0000000000000000000000000000000000000000000000000000000008352820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152fd5b8280fd5b8284346102eb5760607ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126102eb57506101e461084f565b906101ed610877565b916055600b6101fa61089a565b845173ffffffffffffffffffffffffffffffffffffffff968716602080830191825292909716604080830191909152815290957fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe09161025a60608261099b565b519020906102ab86519161026d8361097f565b6000835273ffffffffffffffffffffffffffffffffffffffff9661029f8860015416948a519586938d850198896109ff565b0390810183528261099b565b5190206111eb85516102bf8883018261099b565b81815287810191610a5683395190209085519186830152868201523081520160ff815320915191168152f35b80fd5b5090346101a65760607ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126101a65761032761084f565b92610330610877565b61033861089a565b908351946020968787018761037586868490602090939293604083019473ffffffffffffffffffffffffffffffffffffffff809216845216910152565b03976103a77fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0998a810183528261099b565b5190208651916103b68361097f565b6000835273ffffffffffffffffffffffffffffffffffffffff91816103f98c6103ed878d88600154169051958694850197886109ff565b038c810183528261099b565b5190206111eb895161040d8d83018261099b565b8181528c810191610a5683398051156105f057518492918af516988915610594578260015416938a3b156105905791608491601f8a95946104988f8e51998a9889977fcf7a1d77000000000000000000000000000000000000000000000000000000008952168c880152602487015260606044870152825192839182606489015288880191016109dc565b01168101030181838b5af1801561058657908591610572575b5050853b1561056e5784517f485cc95500000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff928316918101918252929091166020820152829082908190604001038183885af1801561056457610550575b50507f346f0211197dd599e2e2a8c828f6e7dc39e8a49171ce0a728428e8b778c61eea838251848152a151908152f35b61055a829161093c565b6102eb5780610520565b83513d84823e3d90fd5b8380fd5b61057b9061093c565b61056e5783386104b1565b86513d87823e3d90fd5b8880fd5b6064858c8b51917f08c379a0000000000000000000000000000000000000000000000000000000008352820152601960248201527f437265617465323a204661696c6564206f6e206465706c6f79000000000000006044820152fd5b6064878e808e51927f08c379a000000000000000000000000000000000000000000000000000000000845283015260248201527f437265617465323a2062797465636f6465206c656e677468206973207a65726f6044820152fd5b50503461069c57817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261069c5773ffffffffffffffffffffffffffffffffffffffff60209254169051908152f35b5080fd5b83346102eb57807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126102eb576106d76108bd565b600073ffffffffffffffffffffffffffffffffffffffff81547fffffffffffffffffffffffff000000000000000000000000000000000000000081168355167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08280a380f35b50503461069c57817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261069c5760209073ffffffffffffffffffffffffffffffffffffffff600154169051908152f35b5090346101a65760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126101a657826107ca61084f565b6107d26108bd565b73ffffffffffffffffffffffffffffffffffffffff90816001541690813b1561056e5783602492865197889586947f3659cfe600000000000000000000000000000000000000000000000000000000865216908401525af1908115610846575061083a575080f35b6108439061093c565b80f35b513d84823e3d90fd5b6004359073ffffffffffffffffffffffffffffffffffffffff8216820361087257565b600080fd5b6024359073ffffffffffffffffffffffffffffffffffffffff8216820361087257565b6044359073ffffffffffffffffffffffffffffffffffffffff8216820361087257565b73ffffffffffffffffffffffffffffffffffffffff6000541633036108de57565b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602060248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152fd5b67ffffffffffffffff811161095057604052565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6020810190811067ffffffffffffffff82111761095057604052565b90601f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0910116810190811067ffffffffffffffff82111761095057604052565b60005b8381106109ef5750506000910152565b81810151838201526020016109df565b9190926048949383527fffffffffffffffffffffffffffffffffffffffff000000000000000000000000809260601b16602084015260601b166034820152610a5082518093602086850191016109dc565b01019056fe60808060405234610016576111cf908161001c8239f35b600080fdfe604060808152366103825773ffffffffffffffffffffffffffffffffffffffff807fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035416158015610b94576000917fcf7a1d77000000000000000000000000000000000000000000000000000000007fffffffff00000000000000000000000000000000000000000000000000000000843516146100c057600484517ff92ee8a9000000000000000000000000000000000000000000000000000000008152fd5b6100c8611192565b60049136831161037e5760607ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261037e578235916101088361067f565b602435926101158461067f565b60443567ffffffffffffffff811161037a57610135839136908801610789565b941692156103525761014791166107e3565b803b156102cf578451907f5c60da1b000000000000000000000000000000000000000000000000000000009384835260209687848381865afa9384156102a657889461019d9189916102b2575b503b1515610926565b7fa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d5080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff85161790555194827f1cf3b03a6cf19fa2baba4df148e9dcabedea7f8a5c07840e207e5c089be95d3e8880a28451158015906102ab575b610242575b8361023c6107d0565b80519101f35b8592839182525afa9182156102a65761026a9392610277575b506102646109b1565b91610a21565b5038808083818080610233565b610298919250843d861161029f575b610290818361070e565b810190610902565b903861025b565b503d610286565b61091a565b508661022e565b6102c99150863d881161029f57610290818361070e565b38610194565b60848360208751917f08c379a0000000000000000000000000000000000000000000000000000000008352820152602560248201527f455243313936373a206e657720626561636f6e206973206e6f74206120636f6e60448201527f74726163740000000000000000000000000000000000000000000000000000006064820152fd5b8487517ff92ee8a9000000000000000000000000000000000000000000000000000000008152fd5b8680fd5b8380fd5b73ffffffffffffffffffffffffffffffffffffffff807fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035416158015610b94576000907fcf7a1d77000000000000000000000000000000000000000000000000000000007fffffffff00000000000000000000000000000000000000000000000000000000833516146104395760046040517ff92ee8a9000000000000000000000000000000000000000000000000000000008152fd5b610441611192565b60049236841161067b5760607ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261067b5783356104808161067f565b6024359161048d8361067f565b60443567ffffffffffffffff8111610677576104ad829136908901610789565b9316931561064e576104bf91166107e3565b813b156105ca576040517f5c60da1b000000000000000000000000000000000000000000000000000000009283825260209586838281855afa9283156102a65787936105149188916105b357503b1515610926565b7fa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d5080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff841617905560405194827f1cf3b03a6cf19fa2baba4df148e9dcabedea7f8a5c07840e207e5c089be95d3e8880a28451158015906102ab57610242578361023c6107d0565b6102c99150853d871161029f57610290818361070e565b6084846020604051917f08c379a0000000000000000000000000000000000000000000000000000000008352820152602560248201527f455243313936373a206e657720626561636f6e206973206e6f74206120636f6e60448201527f74726163740000000000000000000000000000000000000000000000000000006064820152fd5b856040517ff92ee8a9000000000000000000000000000000000000000000000000000000008152fd5b8580fd5b8280fd5b73ffffffffffffffffffffffffffffffffffffffff81160361069d57565b600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6020810190811067ffffffffffffffff8211176106ed57604052565b6106a2565b6040810190811067ffffffffffffffff8211176106ed57604052565b90601f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0910116810190811067ffffffffffffffff8211176106ed57604052565b67ffffffffffffffff81116106ed57601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01660200190565b81601f8201121561069d578035906107a08261074f565b926107ae604051948561070e565b8284526020838301011161069d57816000926020809301838601378301015290565b604051906107dd826106d1565b60008252565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61039081547f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f604080519373ffffffffffffffffffffffffffffffffffffffff9081851686521693846020820152a1811561087e577fffffffffffffffffffffffff000000000000000000000000000000000000000016179055565b60846040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152fd5b9081602091031261069d57516109178161067f565b90565b6040513d6000823e3d90fd5b1561092d57565b60846040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603060248201527f455243313936373a20626561636f6e20696d706c656d656e746174696f6e206960448201527f73206e6f74206120636f6e7472616374000000000000000000000000000000006064820152fd5b604051906060820182811067ffffffffffffffff8211176106ed57604052602782527f206661696c6564000000000000000000000000000000000000000000000000006040837f416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c60208201520152565b6000806109179493602081519101845af43d15610a60573d91610a438361074f565b92610a51604051948561070e565b83523d6000602085013e610acd565b606091610acd565b15610a6f57565b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152fd5b91929015610aed5750815115610ae1575090565b610917903b1515610a68565b825190915015610b005750805190602001fd5b604051907f08c379a000000000000000000000000000000000000000000000000000000000825281602080600483015282519283602484015260005b848110610b7d575050507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f836000604480968601015201168101030190fd5b818101830151868201604401528593508201610b3c565b610bee610bd57fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035473ffffffffffffffffffffffffffffffffffffffff1690565b73ffffffffffffffffffffffffffffffffffffffff1690565b3303610d14576000357fffffffff00000000000000000000000000000000000000000000000000000000167f3659cfe6000000000000000000000000000000000000000000000000000000008103610c515750610c49610f0f565b602081519101f35b7f4f1ef286000000000000000000000000000000000000000000000000000000008103610c865750610c81611083565b610c49565b7f8f283970000000000000000000000000000000000000000000000000000000008103610cb65750610c81610ec5565b7ff851a440000000000000000000000000000000000000000000000000000000008103610ce65750610c81610dfd565b7f5c60da1b0000000000000000000000000000000000000000000000000000000003610d1457610c81610e53565b610d1c610d3b565b6000808092368280378136915af43d82803e15610d37573d90f35b3d90fd5b73ffffffffffffffffffffffffffffffffffffffff807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc541680610df8575060206004917fa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d505416604051928380927f5c60da1b0000000000000000000000000000000000000000000000000000000082525afa9081156102a657600091610de0575090565b610917915060203d811161029f57610290818361070e565b905090565b610e05611192565b73ffffffffffffffffffffffffffffffffffffffff7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103541660405190602082015260208152610917816106f2565b610e5b611192565b610e63610d3b565b73ffffffffffffffffffffffffffffffffffffffff6040519116602082015260208152610917816106f2565b7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc602091011261069d576004356109178161067f565b610ecd611192565b3660041161069d57610efc73ffffffffffffffffffffffffffffffffffffffff610ef636610e8f565b166107e3565b604051610f08816106d1565b6000815290565b610f17611192565b3660041161069d5773ffffffffffffffffffffffffffffffffffffffff610f3d36610e8f565b1660405190610f4b826106d1565b60008252803b15610fff577f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc817fffffffffffffffffffffffff0000000000000000000000000000000000000000825416179055807fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b600080a2815115801590610ff7575b610fe3575b5050604051610f08816106d1565b610fef916102646109b1565b503880610fd5565b506000610fd0565b60846040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201527f6f74206120636f6e7472616374000000000000000000000000000000000000006064820152fd5b3660041161069d5760407ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261069d576004356110c18161067f565b60243567ffffffffffffffff811161069d576110f673ffffffffffffffffffffffffffffffffffffffff913690600401610789565b9116803b15610fff577f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc817fffffffffffffffffffffffff0000000000000000000000000000000000000000825416179055807fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b600080a281511580159061118a57610fe3575050604051610f08816106d1565b506001610fd0565b3461069d5756fea2646970667358221220a592f27f25373407ca73911ddc0bbaa6ea0e0d6dfcce18bb6b5765f70d2e1a1764736f6c63430008130033a2646970667358221220750b580ab50be9a563009fab121d94828bd509465c7814afa56801dc227c357c64736f6c6343000813003360803461011a57601f6105ee38819003918201601f19168301916001600160401b0383118484101761011f5780849260209460405283398101031261011a57516001600160a01b03808216919082820361011a576000549160018060a01b0319923384821617600055604051923391167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0600080a33b156100b2575060015416176001556040516104b890816101368239f35b62461bcd60e51b815260206004820152603360248201527f5570677261646561626c65426561636f6e3a20696d706c656d656e746174696f60448201527f6e206973206e6f74206120636f6e7472616374000000000000000000000000006064820152608490fd5b600080fd5b634e487b7160e01b600052604160045260246000fdfe6080604052600436101561001257600080fd5b6000803560e01c80633659cfe6146102ce5780635c60da1b1461027c578063715018a6146101e05780638da5cb5b1461018f5763f2fde38b1461005457600080fd5b3461018c5760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261018c5760043573ffffffffffffffffffffffffffffffffffffffff808216809203610188576100ad610403565b8115610104578254827fffffffffffffffffffffffff00000000000000000000000000000000000000008216178455167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08380a380f35b60846040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152fd5b8280fd5b80fd5b503461018c57807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261018c5773ffffffffffffffffffffffffffffffffffffffff6020915416604051908152f35b503461018c57807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261018c57610217610403565b8073ffffffffffffffffffffffffffffffffffffffff81547fffffffffffffffffffffffff000000000000000000000000000000000000000081168355167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08280a380f35b503461018c57807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261018c57602073ffffffffffffffffffffffffffffffffffffffff60015416604051908152f35b503461018c5760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261018c5760043573ffffffffffffffffffffffffffffffffffffffff81169081810361018857610328610403565b3b1561037f57807fffffffffffffffffffffffff000000000000000000000000000000000000000060015416176001557fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b8280a280f35b60846040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603360248201527f5570677261646561626c65426561636f6e3a20696d706c656d656e746174696f60448201527f6e206973206e6f74206120636f6e7472616374000000000000000000000000006064820152fd5b73ffffffffffffffffffffffffffffffffffffffff60005416330361042457565b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602060248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152fdfea2646970667358221220ff9f63e676c96c753988d58c9eed378dc3ae25dde2df2114b6217eba7bb9455964736f6c634300081300336080806040523461001657612df4908161001c8239f35b600080fdfe61010080604052600436101561001457600080fd5b600080608052803560e01c91826301ffc9a714611b04575081630869678c14611ace578163119cd50c14611a65578163248a9ca314611a365781632f2ff15d146119345781633013ce29146118fe57816336568abe1461183857816344004cc1146117975781634782f7791461172b578163485cc955146114025781634f651ccd146112c057816360e606f6146105de5781636a326ab1146105785781639010d07c1461052357816391d14854146104cc5781639755960014610386578163a217fddf14610368578163bad43661146102f357508063ca15c873146102c5578063d547741f1461027f5763ff81434e1461010d57600080fd5b34610279576020806003193601126102795760043567ffffffffffffffff81116102795761013f903690600401611de6565b61014b81939293611d36565b926101596040519485611cf5565b8184527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe061018683611d36565b01836080515b828110610263575050506080515b82811061022257838560405190828201838352815180915283604084019201936080515b8281106101cb5784840385f35b9091928260a0826102136001948a5160808091805184526020810151602085015267ffffffffffffffff80604083015116604086015260608201511660608501520151910152565b019601910194929190946101be565b8061025e9160051b83013560805152600985526102436040608051206129a2565b61024d8288612917565b526102588187612917565b506128ea565b61019a565b61026b612c51565b82828901015201849061018c565b60805180fd5b34610279576040600319360112610279576102bf60043561029e611c10565b9080608051526102ba6001604060805180602052200154612260565b612401565b60805180f35b3461027957602060031936011261027957600435608051526001602052602060406080512054604051908152f35b346102795760806003193601126102795760243567ffffffffffffffff811161027957610324903690600401611de6565b6044929192359173ffffffffffffffffffffffffffffffffffffffff8316830361036557602061035b606435858588600435612c7c565b6040519015158152f35b80fd5b34610279576080518060031936011261036557602090604051908152f35b346102795760a06003193601126102795760043590602435916044359167ffffffffffffffff9081841680940361036557506103c0611c5b565b92608435916103cd6120ea565b84169080821080156104c2575b610498577f8fd3ac39fbb3d5e9c906dd9ec439dc6e584b8fa3ce02d5b67d589b22b22152a99560a09584608060405161041281611c72565b88815284602082015285604082015286606082015201528560055581600655827fffffffffffffffffffffffffffffffff000000000000000000000000000000006fffffffffffffffff00000000000000006007549360401b1692161717600755836008556040519485526020850152604084015260608301526080820152a160805180f35b60046040517f85d4a748000000000000000000000000000000000000000000000000000000008152fd5b50428211156103da565b346102795760406003193601126102795760ff60406020926104ec611c10565b6004356080515273ffffffffffffffffffffffffffffffffffffffff83608051808852209116825284522054166040519015158152f35b3461027957604060031936011261027957600435608051526001602052602073ffffffffffffffffffffffffffffffffffffffff6105686024356040608051206126b8565b9190546040519260031b1c168152f35b346102795760206003193601126102795773ffffffffffffffffffffffffffffffffffffffff6105a6611c38565b6105ae6120ea565b167fffffffffffffffffffffffff0000000000000000000000000000000000000000600454161760045560805180f35b60e0600319360112610279576105f2611c38565b60243567ffffffffffffffff811161027957610612903690600401611d4e565b60443567ffffffffffffffff811161027957610632903690600401611d4e565b916064359167ffffffffffffffff8311610279573660238401121561027957826004013561065f81611dac565b9361066d6040519586611cf5565b818552366024838301011161027957602482910160208601376020608051918501015273ffffffffffffffffffffffffffffffffffffffff60843516608435036102795767ffffffffffffffff60c43511610279576106d49391933660c435600401611de6565b9060c0529260805192839284966106e961295f565b60a05261071767ffffffffffffffff604060a05101511667ffffffffffffffff606060a05101511690612c29565b60805160e08190529094905b835160e051101561095a5761073a60e05185612917565b51968760e0511515918261094f575b5050610925578661075c60e05187612917565b5191816080515260096020526107766040608051206129a2565b61079d67ffffffffffffffff60408301511667ffffffffffffffff60608401511690612c29565b15610815575050866107e457506107cd906107c76001996107c18360a051516124b4565b906124f6565b9a6124f6565b966107d960e0516128ea565b60e052989698610723565b602490604051907f035acf500000000000000000000000000000000000000000000000000000000082526004820152fd5b9099916080820151908c8261083b575b50505082916107c16107cd946107c793516124b4565b8161084b91339060c05186612c7c565b156108a2575060808051339052600260209081528151604080822094909152929052512080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001179055816107c18c610825565b8c604051927f265c66a80000000000000000000000000000000000000000000000000000000084526004840152608060248401528060848401527f07ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff811161027957829060051b60a4928160c0518585013733604484015260648301528101030190fd5b60046040517f340bc4c9000000000000000000000000000000000000000000000000000000008152fd5b10159050878c610749565b888891949394611067575b5073ffffffffffffffffffffffffffffffffffffffff600454168073ffffffffffffffffffffffffffffffffffffffff6084351603611029575060a435818110610fd3575060843573ffffffffffffffffffffffffffffffffffffffff16610f1e57803403610ec757505b73ffffffffffffffffffffffffffffffffffffffff60035460081c1660805190835182905b808210610cf45750506006549081151580610c66575b610b9e5750505073ffffffffffffffffffffffffffffffffffffffff60035460081c1690813b156102795760405180927fb48ab8b600000000000000000000000000000000000000000000000000000000825273ffffffffffffffffffffffffffffffffffffffff86166004830152608060248301528180610abd610aa8610a96608484018a61292b565b6003198482030160448501528b61292b565b600319838203016064840152608051966123be565b0391608051905af18015610b9157610b40575b7f23519238b590c499a2abcf44a33b5f431ac6ca51c22fad26bc2c3d08b97eaa2173ffffffffffffffffffffffffffffffffffffffff84610b3787610b298760405195869516855260606020860152606085019061292b565b90838203604085015261292b565b0390a160805180f35b919067ffffffffffffffff8311610b605760409290925290610b37610ad0565b7f4e487b71000000000000000000000000000000000000000000000000000000006080515260416004526024608051fd5b6040513d608051823e3d90fd5b906020600492604051938480927f18160ddd000000000000000000000000000000000000000000000000000000008252608051905af1918215610b915760805192610c30575b50610c2c906040519384937fa9227830000000000000000000000000000000000000000000000000000000008552600485016040919493926060820195825260208201520152565b0390fd5b9091506020813d602011610c5e575b81610c4c60209383611cf5565b81010312610279575190610c2c610be4565b3d9150610c3f565b506040517f18160ddd000000000000000000000000000000000000000000000000000000008152602081600481608051865af18015610b915784849160805190610cbc575b610cb69293506124f6565b11610a0b565b5050506020813d602011610cec575b81610cd860209383611cf5565b810103126102795751829081908590610cab565b3d9150610ccb565b9092610d008487612917565b516080515260096020526001604060805120015480151580610e26575b610d465750610d3a610d4091610d33868b612917565b51906124f6565b936128ea565b906109f5565b83858a6020610d55838c612917565b516024604051809681937f2693ebf20000000000000000000000000000000000000000000000000000000083526004830152608051905af1928315610b915760805193610df0575b50610c2c91610dab91612917565b51926040519384937fa9227830000000000000000000000000000000000000000000000000000000008552600485016040919493926060820195825260208201520152565b9092506020813d602011610e1e575b81610e0c60209383611cf5565b81010312610279575191610c2c610d9d565b3d9150610dff565b50610e318588612917565b51604051907f2693ebf20000000000000000000000000000000000000000000000000000000082526004820152602081602481608051895af18015610b9157829160805191610e90575b50610e8a90610d33888d612917565b11610d1d565b9150506020813d602011610ebf575b81610eac60209383611cf5565b8101031261027957518190610e8a610e7b565b3d9150610e9f565b6040517f1eabcfbe00000000000000000000000000000000000000000000000000000000815260843573ffffffffffffffffffffffffffffffffffffffff1660048201526024810191909152346044820152606490fd5b3415610f645760646040517f1eabcfbe00000000000000000000000000000000000000000000000000000000815260805160048201526080516024820152346044820152fd5b610fce90604051907f23b872dd000000000000000000000000000000000000000000000000000000006020830152336024830152306044830152606482015260648152610fb081611c72565b73ffffffffffffffffffffffffffffffffffffffff608435166129ea565b6109d0565b6040517f1eabcfbe00000000000000000000000000000000000000000000000000000000815260843573ffffffffffffffffffffffffffffffffffffffff16600482015260248101929092526044820152606490fd5b606491604051917f1eabcfbe000000000000000000000000000000000000000000000000000000008352600483015260248201526080516044820152fd5b608060a0510151908161107b575b50610965565b336080515260026020526080518260408220915260205260ff60406080512054161580611198575b156110f65750336080515260026020526080519060408220915260205260406080512060017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff008254161790558580611075565b604051917f265c66a80000000000000000000000000000000000000000000000000000000083526004830152608060248301528060848301527f07ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8111610279578160a49160051b8060c051848401373360448301527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff60648301528101030190fd5b509491959260409491945160208101907fffffffffffffffffffffffffffffffffffffffff0000000000000000000000003360601b1682527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff60348201526034815261120381611cbd565b5190209661121087611d36565b9761121e604051998a611cf5565b87895260208901368960051b60c05101116102795760c051905b8960051b60c0510182106112b057505095608051965b895188101561129e57611261888b612917565b516080518183101561128c575090608051526020526112866040608051205b976128ea565b9661124e565b52602052611286604060805120611280565b909396508391949792959850146110a3565b8135815260209182019101611238565b346102795760c0600319360112610279576024356044356004356112e2611c5b565b60843567ffffffffffffffff93848216809203610279578460a435936113066120ea565b169081831080156113f8575b610498577f8ced76aee4b96a1e218e7903610fc7d648023d9075677163a5b31396cb280f969660c09660036040519161134a83611c72565b83835260208301908582526040840190878252606085019089825260808601938b85528c60805152600960205260406080512096518755516001870155600286019251167fffffffffffffffffffffffffffffffff000000000000000000000000000000006fffffffffffffffff00000000000000008454935160401b1692161717905551910155604051958652602086015260408501526060840152608083015260a0820152a160805180f35b5042831115611312565b346102795760406003193601126102795761141b611c38565b611423611c10565b6003549060ff82166117015774ffffffffffffffffffffffffffffffffffffffff007fffffffffffffffffffffff0000000000000000000000000000000000000000ff9160081b16911617600355608051805261158960805160209281845273ffffffffffffffffffffffffffffffffffffffff604083209116809252835260805160ff60408220541615611693575b506080518052600183818095526114cf836040608051206126d0565b507f4c02318d8c3aadc98ccf18aebbf3126f651e0c3f6a1de5ff8edcf6724a2ad5c280608051526080518083528460408220915282528060805160ff60408220541615611626575b50506080515281815261152f836040608051206126d0565b507f5d8e12c39142ff96d79d04d15d1ba1269e4fe57bb9d26f43523628b34ba108ec80608051526080518083528460408220915282528060805160ff604082205416156115b9575b505060805152526040608051206126d0565b507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00600354161760035560805180f35b5260805180835284604082209152825260805160408120847fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0082541617905584827f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d339380a48087611577565b5260805180835284604082209152825260805160408120847fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0082541617905584827f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d339380a48087611517565b80526080518084528160408220915283526080516040812060017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff008254161790558133917f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d8180a4836114b3565b60046040517ff92ee8a9000000000000000000000000000000000000000000000000000000008152fd5b3461027957604060031936011261027957611744611c38565b61174c611e17565b60805180808093602435905af1611761612b2d565b501561176d5760805180f35b60046040517f750b219c000000000000000000000000000000000000000000000000000000008152fd5b34610279576060600319360112610279576117b0611c38565b6117b8611c10565b6117c0611e17565b604051907fa9059cbb00000000000000000000000000000000000000000000000000000000602083015273ffffffffffffffffffffffffffffffffffffffff8091166024830152604435604483015260448252608082019282841067ffffffffffffffff851117610b60576102bf93604052166129ea565b3461027957604060031936011261027957611851611c10565b3373ffffffffffffffffffffffffffffffffffffffff82160361187a576102bf90600435612401565b60846040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201527f20726f6c657320666f722073656c6600000000000000000000000000000000006064820152fd5b34610279576080518060031936011261036557602073ffffffffffffffffffffffffffffffffffffffff60045416604051908152f35b34610279576040600319360112610279576119c26004356001611955611c10565b91806080515260805190611973836040602094808652200154612260565b80608051526080519384835273ffffffffffffffffffffffffffffffffffffffff60408620911680955282528060805160ff604082205416156119c957505060805152526040608051206126d0565b5060805180f35b5260805180835284604082209152825260805160408120847fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0082541617905584827f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d339380a48086611577565b346102795760206003193601126102795760043560805152602060016040608051808452200154604051908152f35b34610279576080518060031936011261036557611a80612c51565b5060a0611a8b61295f565b611acc604051809260808091805184526020810151602085015267ffffffffffffffff80604083015116604086015260608201511660608501520151910152565bf35b3461027957602060031936011261027957611ae7612c51565b5060043560805152600960205260a0611a8b6040608051206129a2565b34611c0c576020600319360112611c0c576004357fffffffff000000000000000000000000000000000000000000000000000000008116809103611c085760209250807fb68139110000000000000000000000000000000000000000000000000000000014908115611b78575b5015158152f35b7f5a05180f00000000000000000000000000000000000000000000000000000000811491508115611bab575b5083611b71565b7f7965db0b00000000000000000000000000000000000000000000000000000000811491508115611bde575b5083611ba4565b7f01ffc9a70000000000000000000000000000000000000000000000000000000091501483611bd7565b8280fd5b5080fd5b6024359073ffffffffffffffffffffffffffffffffffffffff82168203611c3357565b600080fd5b6004359073ffffffffffffffffffffffffffffffffffffffff82168203611c3357565b6064359067ffffffffffffffff82168203611c3357565b60a0810190811067ffffffffffffffff821117611c8e57604052565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6060810190811067ffffffffffffffff821117611c8e57604052565b6080810190811067ffffffffffffffff821117611c8e57604052565b90601f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0910116810190811067ffffffffffffffff821117611c8e57604052565b67ffffffffffffffff8111611c8e5760051b60200190565b81601f82011215611c3357803591611d6583611d36565b92611d736040519485611cf5565b808452602092838086019260051b820101928311611c33578301905b828210611d9d575050505090565b81358152908301908301611d8f565b67ffffffffffffffff8111611c8e57601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01660200190565b9181601f84011215611c335782359167ffffffffffffffff8311611c33576020808501948460051b010111611c3357565b3360009081527f20be27040b8e00df40bca0df34743417f3574a156386188f7d7f14369e5ee82b602090815260408083205490927f5d8e12c39142ff96d79d04d15d1ba1269e4fe57bb9d26f43523628b34ba108ec9160ff1615611e7b5750505050565b611e8433612543565b91845190611e9182611cd9565b604282528482019260603685378251156120bd57603084538251906001918210156120bd5790607860218501536041915b818311611ff257505050611f96576048610c2c938693611f6093611f5198519889937f416363657373436f6e74726f6c3a206163636f756e74200000000000000000008a860152611f1c815180928c60378901910161239b565b8401917f206973206d697373696e6720726f6c652000000000000000000000000000000060378401525180938684019061239b565b01036028810187520185611cf5565b519283927f08c379a0000000000000000000000000000000000000000000000000000000008452600484015260248301906123be565b6064848651907f08c379a000000000000000000000000000000000000000000000000000000000825280600483015260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152fd5b909192600f81166010811015612090577f3031323334353637383961626364656600000000000000000000000000000000901a61202f8587612503565b5360041c928015612063577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff019190611ec2565b6024827f4e487b710000000000000000000000000000000000000000000000000000000081526011600452fd5b6024837f4e487b710000000000000000000000000000000000000000000000000000000081526032600452fd5b807f4e487b7100000000000000000000000000000000000000000000000000000000602492526032600452fd5b3360009081527f6058ee1f1c102e8ac9ef0c4319964e42c1ab00dfba021f8302fd0802656934ac602090815260408083205490927f4c02318d8c3aadc98ccf18aebbf3126f651e0c3f6a1de5ff8edcf6724a2ad5c29160ff161561214e5750505050565b61215733612543565b9184519061216482611cd9565b604282528482019260603685378251156120bd57603084538251906001918210156120bd5790607860218501536041915b8183116121ef57505050611f96576048610c2c938693611f6093611f5198519889937f416363657373436f6e74726f6c3a206163636f756e74200000000000000000008a860152611f1c815180928c60378901910161239b565b909192600f81166010811015612090577f3031323334353637383961626364656600000000000000000000000000000000901a61222c8587612503565b5360041c928015612063577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff019190612195565b600090808252602090828252604092838120338252835260ff8482205416156122895750505050565b61229233612543565b9184519061229f82611cd9565b604282528482019260603685378251156120bd57603084538251906001918210156120bd5790607860218501536041915b81831161232a57505050611f96576048610c2c938693611f6093611f5198519889937f416363657373436f6e74726f6c3a206163636f756e74200000000000000000008a860152611f1c815180928c60378901910161239b565b909192600f81166010811015612090577f3031323334353637383961626364656600000000000000000000000000000000901a6123678587612503565b5360041c928015612063577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0191906122d0565b60005b8381106123ae5750506000910152565b818101518382015260200161239e565b907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f6020936123fa8151809281875287808801910161239b565b0116010190565b90604061244c926000908082528160205273ffffffffffffffffffffffffffffffffffffffff83832094169384835260205260ff838320541661244f575b8152600160205220612791565b50565b808252816020528282208483526020528282207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0081541690553384827ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b8580a461243f565b818102929181159184041417156124c757565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b919082018092116124c757565b908151811015612514570160200190565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6040519061255082611cbd565b602a82526020820160403682378251156125145760309053815160019081101561251457607860218401536029905b8082116125ed57505061258f5790565b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602060248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152fd5b9091600f8116601081101561268a577f3031323334353637383961626364656600000000000000000000000000000000901a6126298486612503565b5360041c91801561265c577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff019061257f565b602460007f4e487b710000000000000000000000000000000000000000000000000000000081526011600452fd5b602460007f4e487b710000000000000000000000000000000000000000000000000000000081526032600452fd5b80548210156125145760005260206000200190600090565b9190600183016000908282528060205260408220541560001461278b578454946801000000000000000086101561275e578361274e612719886001604098999a018555846126b8565b81939154907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff9060031b92831b921b19161790565b9055549382526020522055600190565b6024837f4e487b710000000000000000000000000000000000000000000000000000000081526041600452fd5b50925050565b906001820190600092818452826020526040842054908115156000146128e3577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff918281018181116128b65782549084820191821161288957808203612854575b505050805480156128275782019161280a83836126b8565b909182549160031b1b191690555582526020526040812055600190565b6024867f4e487b710000000000000000000000000000000000000000000000000000000081526031600452fd5b61287461286461271993866126b8565b90549060031b1c928392866126b8565b905586528460205260408620553880806127f2565b6024887f4e487b710000000000000000000000000000000000000000000000000000000081526011600452fd5b6024877f4e487b710000000000000000000000000000000000000000000000000000000081526011600452fd5b5050505090565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff81146124c75760010190565b80518210156125145760209160051b010190565b90815180825260208080930193019160005b82811061294b575050505090565b83518552938101939281019260010161293d565b6040519061296c82611c72565b816005548152600654602082015260075467ffffffffffffffff90818116604084015260401c1660608201526080600854910152565b906040516129af81611c72565b6080600382948054845260018101546020850152600281015467ffffffffffffffff90818116604087015260401c1660608501520154910152565b73ffffffffffffffffffffffffffffffffffffffff1690604051604081019080821067ffffffffffffffff831117611c8e57612a6a916040526020938482527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564858301526000808587829751910182855af1612a64612b2d565b91612b5d565b805191821591848315612b09575b505050905015612a855750565b608490604051907f08c379a00000000000000000000000000000000000000000000000000000000082526004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152fd5b919381809450010312611c0c57820151908115158203610365575080388084612a78565b3d15612b58573d90612b3e82611dac565b91612b4c6040519384611cf5565b82523d6000602084013e565b606090565b91929015612bd85750815115612b71575090565b3b15612b7a5790565b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152fd5b825190915015612beb5750805190602001fd5b610c2c906040519182917f08c379a00000000000000000000000000000000000000000000000000000000083526020600484015260248301906123be565b908015918215612c47575b508115612c3f575090565b905042101590565b4210915038612c34565b60405190612c5e82611c72565b60006080838281528260208201528260408201528260608201520152565b91929060009073ffffffffffffffffffffffffffffffffffffffff8316825260209060028252604093848420868552835260ff8585205416159788612cc7575b505050505050505090565b909192939597508496989451907fffffffffffffffffffffffffffffffffffffffff0000000000000000000000008583019360601b168352603482015260348152612d1181611cbd565b51902090612d1e88611d36565b97612d2b8751998a611cf5565b8089528389019060051b820191368311612dba578490915b838310612daa57505050509183925b8751841015612d9557612d658489612917565b519081811015612d855785528252612d7f858520936128ea565b92612d52565b9085528252612d7f858520610d3a565b94509550505050143880808080808080612cbc565b8235815291810191859101612d43565b8680fdfea26469706673582212200a591dabab21666a145625c692eb6f5cafc0541b094fe259adf424b56c4209e764736f6c63430008130033', signer ) } @@ -148,215 +183,222 @@ export const ERC1155SALEFACTORY_VERIFICATION: Omit 0). If so, it MUST call `onERC1155Received` on `_to` and revert if the return amount is not `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))`\r\n * @param _from Source address\r\n * @param _to Target address\r\n * @param _id ID of the token type\r\n * @param _amount Transfered amount\r\n * @param _data Additional data with no specified format, sent in call to `_to`\r\n */\r\n function safeTransferFrom(address _from, address _to, uint256 _id, uint256 _amount, bytes calldata _data) external;\r\n\r\n /**\r\n * @notice Send multiple types of Tokens from the _from address to the _to address (with safety call)\r\n * @dev MUST emit TransferBatch event on success\r\n * Caller must be approved to manage the _from account\'s tokens (see isApprovedForAll)\r\n * MUST throw if `_to` is the zero address\r\n * MUST throw if length of `_ids` is not the same as length of `_amounts`\r\n * MUST throw if any of the balance of sender for token `_ids` is lower than the respective `_amounts` sent\r\n * MUST throw on any other error\r\n * When transfer is complete, this function MUST check if `_to` is a smart contract (code size > 0). If so, it MUST call `onERC1155BatchReceived` on `_to` and revert if the return amount is not `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))`\r\n * Transfers and events MUST occur in the array order they were submitted (_ids[0] before _ids[1], etc)\r\n * @param _from Source addresses\r\n * @param _to Target addresses\r\n * @param _ids IDs of each token type\r\n * @param _amounts Transfer amounts per token type\r\n * @param _data Additional data with no specified format, sent in call to `_to`\r\n */\r\n function safeBatchTransferFrom(address _from, address _to, uint256[] calldata _ids, uint256[] calldata _amounts, bytes calldata _data) external;\r\n\r\n /**\r\n * @notice Get the balance of an account\'s Tokens\r\n * @param _owner The address of the token holder\r\n * @param _id ID of the Token\r\n * @return The _owner\'s balance of the Token type requested\r\n */\r\n function balanceOf(address _owner, uint256 _id) external view returns (uint256);\r\n\r\n /**\r\n * @notice Get the balance of multiple account/token pairs\r\n * @param _owners The addresses of the token holders\r\n * @param _ids ID of the Tokens\r\n * @return The _owner\'s balance of the Token types requested (i.e. balance for each (owner, id) pair)\r\n */\r\n function balanceOfBatch(address[] calldata _owners, uint256[] calldata _ids) external view returns (uint256[] memory);\r\n\r\n /**\r\n * @notice Enable or disable approval for a third party ("operator") to manage all of caller\'s tokens\r\n * @dev MUST emit the ApprovalForAll event on success\r\n * @param _operator Address to add to the set of authorized operators\r\n * @param _approved True if the operator is approved, false to revoke approval\r\n */\r\n function setApprovalForAll(address _operator, bool _approved) external;\r\n\r\n /**\r\n * @notice Queries the approval status of an operator for a given owner\r\n * @param _owner The owner of the Tokens\r\n * @param _operator Address of authorized operator\r\n * @return isOperator True if the operator is approved, false if not\r\n */\r\n function isApprovedForAll(address _owner, address _operator) external view returns (bool isOperator);\r\n}\r\n' + '// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8.19;\n\nimport { SequenceProxyFactory } from "@0xsequence/contracts-library/proxies/SequenceProxyFactory.sol";\nimport { ERC1155Sale } from "@0xsequence/contracts-library/tokens/ERC1155/utility/sale/ERC1155Sale.sol";\nimport {\n IERC1155SaleFactory,\n IERC1155SaleFactoryFunctions\n} from "@0xsequence/contracts-library/tokens/ERC1155/utility/sale/IERC1155SaleFactory.sol";\n\n/**\n * Deployer of ERC-1155 Sale proxies.\n */\ncontract ERC1155SaleFactory is IERC1155SaleFactory, SequenceProxyFactory {\n\n /**\n * Creates an ERC-1155 Sale Factory.\n * @param factoryOwner The owner of the ERC-1155 Sale Factory\n */\n constructor(\n address factoryOwner\n ) {\n ERC1155Sale impl = new ERC1155Sale();\n SequenceProxyFactory._initialize(address(impl), factoryOwner);\n }\n\n /// @inheritdoc IERC1155SaleFactoryFunctions\n function deploy(address proxyOwner, address tokenOwner, address items) external returns (address proxyAddr) {\n bytes32 salt = keccak256(abi.encode(tokenOwner, items));\n proxyAddr = _createProxy(salt, proxyOwner, "");\n ERC1155Sale(proxyAddr).initialize(tokenOwner, items);\n emit ERC1155SaleDeployed(proxyAddr);\n return proxyAddr;\n }\n\n /// @inheritdoc IERC1155SaleFactoryFunctions\n function determineAddress(\n address proxyOwner,\n address tokenOwner,\n address items\n ) external view returns (address proxyAddr) {\n bytes32 salt = keccak256(abi.encode(tokenOwner, items));\n return _computeProxyAddress(salt, proxyOwner, "");\n }\n\n}\n' }, - 'lib/0xsequence/erc-1155/src/contracts/interfaces/IERC1155TokenReceiver.sol': { + 'src/proxies/SequenceProxyFactory.sol': { content: - '// SPDX-License-Identifier: Apache-2.0\r\npragma solidity ^0.8.0;\r\n\r\n/**\r\n * @dev ERC-1155 interface for accepting safe transfers.\r\n */\r\ninterface IERC1155TokenReceiver {\r\n\r\n /**\r\n * @notice Handle the receipt of a single ERC1155 token type\r\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\r\n * This function MAY throw to revert and reject the transfer\r\n * Return of other amount than the magic value MUST result in the transaction being reverted\r\n * Note: The token contract address is always the message sender\r\n * @param _operator The address which called the `safeTransferFrom` function\r\n * @param _from The address which previously owned the token\r\n * @param _id The id of the token being transferred\r\n * @param _amount The amount of tokens being transferred\r\n * @param _data Additional data with no specified format\r\n * @return `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))`\r\n */\r\n function onERC1155Received(address _operator, address _from, uint256 _id, uint256 _amount, bytes calldata _data) external returns(bytes4);\r\n\r\n /**\r\n * @notice Handle the receipt of multiple ERC1155 token types\r\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\r\n * This function MAY throw to revert and reject the transfer\r\n * Return of other amount than the magic value WILL result in the transaction being reverted\r\n * Note: The token contract address is always the message sender\r\n * @param _operator The address which called the `safeBatchTransferFrom` function\r\n * @param _from The address which previously owned the token\r\n * @param _ids An array containing ids of each token being transferred\r\n * @param _amounts An array containing amounts of each token being transferred\r\n * @param _data Additional data with no specified format\r\n * @return `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))`\r\n */\r\n function onERC1155BatchReceived(address _operator, address _from, uint256[] calldata _ids, uint256[] calldata _amounts, bytes calldata _data) external returns(bytes4);\r\n}\r\n' + '// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8.19;\n\nimport {\n ITransparentUpgradeableBeaconProxy,\n TransparentUpgradeableBeaconProxy\n} from "./TransparentUpgradeableBeaconProxy.sol";\n\nimport { Ownable } from "@openzeppelin/contracts/access/Ownable.sol";\nimport { UpgradeableBeacon } from "@openzeppelin/contracts/proxy/beacon/UpgradeableBeacon.sol";\nimport { Create2 } from "@openzeppelin/contracts/utils/Create2.sol";\n\n/**\n * An proxy factory that deploys upgradeable beacon proxies.\n * @dev The factory owner is able to upgrade the beacon implementation.\n * @dev Proxy deployers are able to override the beacon reference with their own.\n */\nabstract contract SequenceProxyFactory is Ownable {\n\n UpgradeableBeacon public beacon;\n\n /**\n * Initialize a Sequence Proxy Factory.\n * @param implementation The initial beacon implementation.\n * @param factoryOwner The owner of the factory.\n */\n function _initialize(address implementation, address factoryOwner) internal {\n beacon = new UpgradeableBeacon(implementation);\n Ownable._transferOwnership(factoryOwner);\n }\n\n /**\n * Deploys and initializes a new proxy instance.\n * @param _salt The deployment salt.\n * @param _proxyOwner The owner of the proxy.\n * @param _data The initialization data.\n * @return proxyAddress The address of the deployed proxy.\n */\n function _createProxy(\n bytes32 _salt,\n address _proxyOwner,\n bytes memory _data\n ) internal returns (address proxyAddress) {\n bytes32 saltedHash = keccak256(abi.encodePacked(_salt, _proxyOwner, address(beacon), _data));\n bytes memory bytecode = type(TransparentUpgradeableBeaconProxy).creationCode;\n\n proxyAddress = Create2.deploy(0, saltedHash, bytecode);\n ITransparentUpgradeableBeaconProxy(payable(proxyAddress)).initialize(_proxyOwner, address(beacon), _data);\n }\n\n /**\n * Computes the address of a proxy instance.\n * @param _salt The deployment salt.\n * @param _proxyOwner The owner of the proxy.\n * @return proxy The expected address of the deployed proxy.\n */\n function _computeProxyAddress(\n bytes32 _salt,\n address _proxyOwner,\n bytes memory _data\n ) internal view returns (address) {\n bytes32 saltedHash = keccak256(abi.encodePacked(_salt, _proxyOwner, address(beacon), _data));\n bytes32 bytecodeHash = keccak256(type(TransparentUpgradeableBeaconProxy).creationCode);\n\n return Create2.computeAddress(saltedHash, bytecodeHash);\n }\n\n /**\n * Upgrades the beacon implementation.\n * @param implementation The new beacon implementation.\n */\n function upgradeBeacon(\n address implementation\n ) public onlyOwner {\n beacon.upgradeTo(implementation);\n }\n\n}\n' }, - 'lib/0xsequence/erc-1155/src/contracts/interfaces/IERC165.sol': { + 'src/tokens/ERC1155/utility/sale/ERC1155Sale.sol': { content: - '// SPDX-License-Identifier: Apache-2.0\r\npragma solidity ^0.8.0;\r\n\r\n\r\n/**\r\n * @title ERC165\r\n * @dev https://github.com/ethereum/EIPs/blob/master/EIPS/eip-165.md\r\n */\r\ninterface IERC165 {\r\n\r\n /**\r\n * @notice Query if a contract implements an interface\r\n * @dev Interface identification is specified in ERC-165. This function\r\n * uses less than 30,000 gas\r\n * @param _interfaceId The interface identifier, as specified in ERC-165\r\n */\r\n function supportsInterface(bytes4 _interfaceId)\r\n external\r\n view\r\n returns (bool);\r\n}\r\n' + '// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8.19;\n\nimport { ERC1155Supply } from "@0xsequence/contracts-library/tokens/ERC1155/extensions/supply/ERC1155Supply.sol";\nimport {\n IERC1155Sale,\n IERC1155SaleFunctions\n} from "@0xsequence/contracts-library/tokens/ERC1155/utility/sale/IERC1155Sale.sol";\n\nimport { MerkleProofSingleUse } from "@0xsequence/contracts-library/tokens/common/MerkleProofSingleUse.sol";\nimport {\n AccessControlEnumerable,\n IERC20,\n SafeERC20,\n WithdrawControlled\n} from "@0xsequence/contracts-library/tokens/common/WithdrawControlled.sol";\n\nimport { IERC1155SupplyFunctions } from\n "@0xsequence/contracts-library/tokens/ERC1155/extensions/supply/IERC1155Supply.sol";\nimport { IERC1155ItemsFunctions } from "@0xsequence/contracts-library/tokens/ERC1155/presets/items/IERC1155Items.sol";\nimport { IERC1155 } from "@0xsequence/erc-1155/contracts/interfaces/IERC1155.sol";\n\ncontract ERC1155Sale is IERC1155Sale, WithdrawControlled, MerkleProofSingleUse {\n\n bytes32 internal constant MINT_ADMIN_ROLE = keccak256("MINT_ADMIN_ROLE");\n\n bool private _initialized;\n address private _items;\n\n // ERC20 token address for payment. address(0) indicated payment in ETH.\n address private _paymentToken;\n\n SaleDetails private _globalSaleDetails;\n mapping(uint256 => SaleDetails) private _tokenSaleDetails;\n\n /**\n * Initialize the contract.\n * @param owner Owner address\n * @param items The ERC-1155 Items contract address\n * @dev This should be called immediately after deployment.\n */\n function initialize(address owner, address items) public virtual {\n if (_initialized) {\n revert InvalidInitialization();\n }\n\n _items = items;\n\n _grantRole(DEFAULT_ADMIN_ROLE, owner);\n _grantRole(MINT_ADMIN_ROLE, owner);\n _grantRole(WITHDRAW_ROLE, owner);\n\n _initialized = true;\n }\n\n /**\n * Checks if the current block.timestamp is out of the give timestamp range.\n * @param _startTime Earliest acceptable timestamp (inclusive).\n * @param _endTime Latest acceptable timestamp (exclusive).\n * @dev A zero endTime value is always considered out of bounds.\n */\n function _blockTimeOutOfBounds(uint256 _startTime, uint256 _endTime) private view returns (bool) {\n // 0 end time indicates inactive sale.\n return _endTime == 0 || block.timestamp < _startTime || block.timestamp >= _endTime; // solhint-disable-line not-rely-on-time\n }\n\n /**\n * Checks the sale is active and takes payment.\n * @param _tokenIds Token IDs to mint.\n * @param _amounts Amounts of tokens to mint.\n * @param _expectedPaymentToken ERC20 token address to accept payment in. address(0) indicates ETH.\n * @param _maxTotal Maximum amount of payment tokens.\n * @param _proof Merkle proof for allowlist minting.\n */\n function _payForActiveMint(\n uint256[] memory _tokenIds,\n uint256[] memory _amounts,\n address _expectedPaymentToken,\n uint256 _maxTotal,\n bytes32[] calldata _proof\n ) private {\n uint256 lastTokenId;\n uint256 totalCost;\n uint256 totalAmount;\n\n SaleDetails memory gSaleDetails = _globalSaleDetails;\n bool globalSaleInactive = _blockTimeOutOfBounds(gSaleDetails.startTime, gSaleDetails.endTime);\n bool globalMerkleCheckRequired = false;\n for (uint256 i; i < _tokenIds.length; i++) {\n uint256 tokenId = _tokenIds[i];\n // Test tokenIds ordering\n if (i != 0 && lastTokenId >= tokenId) {\n revert InvalidTokenIds();\n }\n lastTokenId = tokenId;\n\n uint256 amount = _amounts[i];\n\n // Active sale test\n SaleDetails memory saleDetails = _tokenSaleDetails[tokenId];\n bool tokenSaleInactive = _blockTimeOutOfBounds(saleDetails.startTime, saleDetails.endTime);\n if (tokenSaleInactive) {\n // Prefer token sale\n if (globalSaleInactive) {\n // Both sales inactive\n revert SaleInactive(tokenId);\n }\n // Use global sale details\n globalMerkleCheckRequired = true;\n totalCost += gSaleDetails.cost * amount;\n } else {\n // Use token sale details\n requireMerkleProof(saleDetails.merkleRoot, _proof, msg.sender, bytes32(tokenId));\n totalCost += saleDetails.cost * amount;\n }\n totalAmount += amount;\n }\n\n if (globalMerkleCheckRequired) {\n // Check it once outside the loop only when required\n requireMerkleProof(gSaleDetails.merkleRoot, _proof, msg.sender, bytes32(type(uint256).max));\n }\n\n if (_expectedPaymentToken != _paymentToken) {\n // Caller expected different payment token\n revert InsufficientPayment(_paymentToken, totalCost, 0);\n }\n if (_maxTotal < totalCost) {\n // Caller expected to pay less\n revert InsufficientPayment(_expectedPaymentToken, totalCost, _maxTotal);\n }\n if (_expectedPaymentToken == address(0)) {\n // Paid in ETH\n if (msg.value != totalCost) {\n // We expect exact value match\n revert InsufficientPayment(_expectedPaymentToken, totalCost, msg.value);\n }\n } else if (msg.value > 0) {\n // Paid in ERC20, but sent ETH\n revert InsufficientPayment(address(0), 0, msg.value);\n } else {\n // Paid in ERC20\n SafeERC20.safeTransferFrom(IERC20(_expectedPaymentToken), msg.sender, address(this), totalCost);\n }\n }\n\n //\n // Minting\n //\n\n /**\n * Mint tokens.\n * @param to Address to mint tokens to.\n * @param tokenIds Token IDs to mint.\n * @param amounts Amounts of tokens to mint.\n * @param data Data to pass if receiver is contract.\n * @param expectedPaymentToken ERC20 token address to accept payment in. address(0) indicates ETH.\n * @param maxTotal Maximum amount of payment tokens.\n * @param proof Merkle proof for allowlist minting.\n * @notice Sale must be active for all tokens.\n * @dev tokenIds must be sorted ascending without duplicates.\n * @dev An empty proof is supplied when no proof is required.\n */\n function mint(\n address to,\n uint256[] memory tokenIds,\n uint256[] memory amounts,\n bytes memory data,\n address expectedPaymentToken,\n uint256 maxTotal,\n bytes32[] calldata proof\n ) public payable {\n _payForActiveMint(tokenIds, amounts, expectedPaymentToken, maxTotal, proof);\n\n IERC1155SupplyFunctions items = IERC1155SupplyFunctions(_items);\n uint256 totalAmount = 0;\n uint256 nMint = tokenIds.length;\n for (uint256 i = 0; i < nMint; i++) {\n // Update storage balance\n uint256 tokenSupplyCap = _tokenSaleDetails[tokenIds[i]].supplyCap;\n if (tokenSupplyCap > 0 && items.tokenSupply(tokenIds[i]) + amounts[i] > tokenSupplyCap) {\n revert InsufficientSupply(items.tokenSupply(tokenIds[i]), amounts[i], tokenSupplyCap);\n }\n totalAmount += amounts[i];\n }\n uint256 totalSupplyCap = _globalSaleDetails.supplyCap;\n if (totalSupplyCap > 0 && items.totalSupply() + totalAmount > totalSupplyCap) {\n revert InsufficientSupply(items.totalSupply(), totalAmount, totalSupplyCap);\n }\n\n IERC1155ItemsFunctions(_items).batchMint(to, tokenIds, amounts, data);\n emit ItemsMinted(to, tokenIds, amounts);\n }\n\n //\n // Admin\n //\n\n /**\n * Set the payment token.\n * @param paymentTokenAddr The ERC20 token address to accept payment in. address(0) indicates ETH.\n * @dev This should be set before the sale starts.\n */\n function setPaymentToken(\n address paymentTokenAddr\n ) public onlyRole(MINT_ADMIN_ROLE) {\n _paymentToken = paymentTokenAddr;\n }\n\n /**\n * Set the global sale details.\n * @param cost The amount of payment tokens to accept for each token minted.\n * @param supplyCap The maximum number of tokens that can be minted.\n * @param startTime The start time of the sale. Tokens cannot be minted before this time.\n * @param endTime The end time of the sale. Tokens cannot be minted after this time.\n * @param merkleRoot The merkle root for allowlist minting.\n * @dev A zero end time indicates an inactive sale.\n * @notice The payment token is set globally.\n */\n function setGlobalSaleDetails(\n uint256 cost,\n uint256 supplyCap,\n uint64 startTime,\n uint64 endTime,\n bytes32 merkleRoot\n ) public onlyRole(MINT_ADMIN_ROLE) {\n // solhint-disable-next-line not-rely-on-time\n if (endTime < startTime || endTime <= block.timestamp) {\n revert InvalidSaleDetails();\n }\n _globalSaleDetails = SaleDetails(cost, supplyCap, startTime, endTime, merkleRoot);\n emit GlobalSaleDetailsUpdated(cost, supplyCap, startTime, endTime, merkleRoot);\n }\n\n /**\n * Set the sale details for an individual token.\n * @param tokenId The token ID to set the sale details for.\n * @param cost The amount of payment tokens to accept for each token minted.\n * @param supplyCap The maximum number of tokens that can be minted.\n * @param startTime The start time of the sale. Tokens cannot be minted before this time.\n * @param endTime The end time of the sale. Tokens cannot be minted after this time.\n * @param merkleRoot The merkle root for allowlist minting.\n * @dev A zero end time indicates an inactive sale.\n * @notice The payment token is set globally.\n */\n function setTokenSaleDetails(\n uint256 tokenId,\n uint256 cost,\n uint256 supplyCap,\n uint64 startTime,\n uint64 endTime,\n bytes32 merkleRoot\n ) public onlyRole(MINT_ADMIN_ROLE) {\n // solhint-disable-next-line not-rely-on-time\n if (endTime < startTime || endTime <= block.timestamp) {\n revert InvalidSaleDetails();\n }\n _tokenSaleDetails[tokenId] = SaleDetails(cost, supplyCap, startTime, endTime, merkleRoot);\n emit TokenSaleDetailsUpdated(tokenId, cost, supplyCap, startTime, endTime, merkleRoot);\n }\n\n //\n // Views\n //\n\n /**\n * Get global sales details.\n * @return Sale details.\n * @notice Global sales details apply to all tokens.\n * @notice Global sales details are overriden when token sale is active.\n */\n function globalSaleDetails() external view returns (SaleDetails memory) {\n return _globalSaleDetails;\n }\n\n /**\n * Get token sale details.\n * @param tokenId Token ID to get sale details for.\n * @return Sale details.\n * @notice Token sale details override global sale details.\n */\n function tokenSaleDetails(\n uint256 tokenId\n ) external view returns (SaleDetails memory) {\n return _tokenSaleDetails[tokenId];\n }\n\n /**\n * Get sale details for multiple tokens.\n * @param tokenIds Array of token IDs to retrieve sale details for.\n * @return Array of sale details corresponding to each token ID.\n * @notice Each token\'s sale details override the global sale details if set.\n */\n function tokenSaleDetailsBatch(\n uint256[] calldata tokenIds\n ) external view returns (SaleDetails[] memory) {\n SaleDetails[] memory details = new SaleDetails[](tokenIds.length);\n for (uint256 i = 0; i < tokenIds.length; i++) {\n details[i] = _tokenSaleDetails[tokenIds[i]];\n }\n return details;\n }\n\n /**\n * Get payment token.\n * @return Payment token address.\n * @notice address(0) indicates payment in ETH.\n */\n function paymentToken() external view returns (address) {\n return _paymentToken;\n }\n\n /**\n * Check interface support.\n * @param interfaceId Interface id\n * @return True if supported\n */\n function supportsInterface(\n bytes4 interfaceId\n ) public view virtual override(AccessControlEnumerable) returns (bool) {\n return type(IERC1155SaleFunctions).interfaceId == interfaceId || super.supportsInterface(interfaceId);\n }\n\n}\n' }, - 'lib/0xsequence/erc-1155/src/contracts/tokens/ERC1155/ERC1155.sol': { + 'src/tokens/ERC1155/utility/sale/IERC1155SaleFactory.sol': { content: - '// SPDX-License-Identifier: Apache-2.0\r\npragma solidity ^0.8.0;\r\n\r\nimport "../../interfaces/IERC1155TokenReceiver.sol";\r\nimport "../../interfaces/IERC1155.sol";\r\nimport "../../utils/Address.sol";\r\nimport "../../utils/ERC165.sol";\r\n\r\n/**\r\n * @dev Implementation of Multi-Token Standard contract\r\n */\r\ncontract ERC1155 is IERC1155, ERC165 {\r\n using Address for address;\r\n\r\n /***********************************|\r\n | Variables and Events |\r\n |__________________________________*/\r\n\r\n // onReceive function signatures\r\n bytes4 constant internal ERC1155_RECEIVED_VALUE = 0xf23a6e61;\r\n bytes4 constant internal ERC1155_BATCH_RECEIVED_VALUE = 0xbc197c81;\r\n\r\n // Objects balances\r\n mapping (address => mapping(uint256 => uint256)) internal balances;\r\n\r\n // Operator Functions\r\n mapping (address => mapping(address => bool)) internal operators;\r\n\r\n\r\n /***********************************|\r\n | Public Transfer Functions |\r\n |__________________________________*/\r\n\r\n /**\r\n * @notice Transfers amount amount of an _id from the _from address to the _to address specified\r\n * @param _from Source address\r\n * @param _to Target address\r\n * @param _id ID of the token type\r\n * @param _amount Transfered amount\r\n * @param _data Additional data with no specified format, sent in call to `_to`\r\n */\r\n function safeTransferFrom(address _from, address _to, uint256 _id, uint256 _amount, bytes memory _data)\r\n public virtual override\r\n {\r\n require((msg.sender == _from) || isApprovedForAll(_from, msg.sender), "ERC1155#safeTransferFrom: INVALID_OPERATOR");\r\n require(_to != address(0),"ERC1155#safeTransferFrom: INVALID_RECIPIENT");\r\n\r\n _safeTransferFrom(_from, _to, _id, _amount);\r\n _callonERC1155Received(_from, _to, _id, _amount, gasleft(), _data);\r\n }\r\n\r\n /**\r\n * @notice Send multiple types of Tokens from the _from address to the _to address (with safety call)\r\n * @param _from Source addresses\r\n * @param _to Target addresses\r\n * @param _ids IDs of each token type\r\n * @param _amounts Transfer amounts per token type\r\n * @param _data Additional data with no specified format, sent in call to `_to`\r\n */\r\n function safeBatchTransferFrom(address _from, address _to, uint256[] memory _ids, uint256[] memory _amounts, bytes memory _data)\r\n public virtual override\r\n {\r\n // Requirements\r\n require((msg.sender == _from) || isApprovedForAll(_from, msg.sender), "ERC1155#safeBatchTransferFrom: INVALID_OPERATOR");\r\n require(_to != address(0), "ERC1155#safeBatchTransferFrom: INVALID_RECIPIENT");\r\n\r\n _safeBatchTransferFrom(_from, _to, _ids, _amounts);\r\n _callonERC1155BatchReceived(_from, _to, _ids, _amounts, gasleft(), _data);\r\n }\r\n\r\n\r\n /***********************************|\r\n | Internal Transfer Functions |\r\n |__________________________________*/\r\n\r\n /**\r\n * @notice Transfers amount amount of an _id from the _from address to the _to address specified\r\n * @param _from Source address\r\n * @param _to Target address\r\n * @param _id ID of the token type\r\n * @param _amount Transfered amount\r\n */\r\n function _safeTransferFrom(address _from, address _to, uint256 _id, uint256 _amount)\r\n internal virtual\r\n {\r\n // Update balances\r\n balances[_from][_id] -= _amount;\r\n balances[_to][_id] += _amount;\r\n\r\n // Emit event\r\n emit TransferSingle(msg.sender, _from, _to, _id, _amount);\r\n }\r\n\r\n /**\r\n * @notice Verifies if receiver is contract and if so, calls (_to).onERC1155Received(...)\r\n */\r\n function _callonERC1155Received(address _from, address _to, uint256 _id, uint256 _amount, uint256 _gasLimit, bytes memory _data)\r\n internal virtual\r\n {\r\n // Check if recipient is contract\r\n if (_to.isContract()) {\r\n bytes4 retval = IERC1155TokenReceiver(_to).onERC1155Received{gas: _gasLimit}(msg.sender, _from, _id, _amount, _data);\r\n require(retval == ERC1155_RECEIVED_VALUE, "ERC1155#_callonERC1155Received: INVALID_ON_RECEIVE_MESSAGE");\r\n }\r\n }\r\n\r\n /**\r\n * @notice Send multiple types of Tokens from the _from address to the _to address (with safety call)\r\n * @param _from Source addresses\r\n * @param _to Target addresses\r\n * @param _ids IDs of each token type\r\n * @param _amounts Transfer amounts per token type\r\n */\r\n function _safeBatchTransferFrom(address _from, address _to, uint256[] memory _ids, uint256[] memory _amounts)\r\n internal virtual\r\n {\r\n require(_ids.length == _amounts.length, "ERC1155#_safeBatchTransferFrom: INVALID_ARRAYS_LENGTH");\r\n\r\n // Number of transfer to execute\r\n uint256 nTransfer = _ids.length;\r\n\r\n // Executing all transfers\r\n for (uint256 i = 0; i < nTransfer; i++) {\r\n // Update storage balance of previous bin\r\n balances[_from][_ids[i]] -= _amounts[i];\r\n balances[_to][_ids[i]] += _amounts[i];\r\n }\r\n\r\n // Emit event\r\n emit TransferBatch(msg.sender, _from, _to, _ids, _amounts);\r\n }\r\n\r\n /**\r\n * @notice Verifies if receiver is contract and if so, calls (_to).onERC1155BatchReceived(...)\r\n */\r\n function _callonERC1155BatchReceived(address _from, address _to, uint256[] memory _ids, uint256[] memory _amounts, uint256 _gasLimit, bytes memory _data)\r\n internal virtual\r\n {\r\n // Pass data if recipient is contract\r\n if (_to.isContract()) {\r\n bytes4 retval = IERC1155TokenReceiver(_to).onERC1155BatchReceived{gas: _gasLimit}(msg.sender, _from, _ids, _amounts, _data);\r\n require(retval == ERC1155_BATCH_RECEIVED_VALUE, "ERC1155#_callonERC1155BatchReceived: INVALID_ON_RECEIVE_MESSAGE");\r\n }\r\n }\r\n\r\n\r\n /***********************************|\r\n | Operator Functions |\r\n |__________________________________*/\r\n\r\n /**\r\n * @notice Enable or disable approval for a third party ("operator") to manage all of caller\'s tokens\r\n * @param _operator Address to add to the set of authorized operators\r\n * @param _approved True if the operator is approved, false to revoke approval\r\n */\r\n function setApprovalForAll(address _operator, bool _approved)\r\n external virtual override\r\n {\r\n // Update operator status\r\n operators[msg.sender][_operator] = _approved;\r\n emit ApprovalForAll(msg.sender, _operator, _approved);\r\n }\r\n\r\n /**\r\n * @notice Queries the approval status of an operator for a given owner\r\n * @param _owner The owner of the Tokens\r\n * @param _operator Address of authorized operator\r\n * @return isOperator True if the operator is approved, false if not\r\n */\r\n function isApprovedForAll(address _owner, address _operator)\r\n public view virtual override returns (bool isOperator)\r\n {\r\n return operators[_owner][_operator];\r\n }\r\n\r\n\r\n /***********************************|\r\n | Balance Functions |\r\n |__________________________________*/\r\n\r\n /**\r\n * @notice Get the balance of an account\'s Tokens\r\n * @param _owner The address of the token holder\r\n * @param _id ID of the Token\r\n * @return The _owner\'s balance of the Token type requested\r\n */\r\n function balanceOf(address _owner, uint256 _id)\r\n public view virtual override returns (uint256)\r\n {\r\n return balances[_owner][_id];\r\n }\r\n\r\n /**\r\n * @notice Get the balance of multiple account/token pairs\r\n * @param _owners The addresses of the token holders\r\n * @param _ids ID of the Tokens\r\n * @return The _owner\'s balance of the Token types requested (i.e. balance for each (owner, id) pair)\r\n */\r\n function balanceOfBatch(address[] memory _owners, uint256[] memory _ids)\r\n public view virtual override returns (uint256[] memory)\r\n {\r\n require(_owners.length == _ids.length, "ERC1155#balanceOfBatch: INVALID_ARRAY_LENGTH");\r\n\r\n // Variables\r\n uint256[] memory batchBalances = new uint256[](_owners.length);\r\n\r\n // Iterate over each owner and token ID\r\n for (uint256 i = 0; i < _owners.length; i++) {\r\n batchBalances[i] = balances[_owners[i]][_ids[i]];\r\n }\r\n\r\n return batchBalances;\r\n }\r\n\r\n\r\n /***********************************|\r\n | ERC165 Functions |\r\n |__________________________________*/\r\n\r\n /**\r\n * @notice Query if a contract implements an interface\r\n * @param _interfaceID The interface identifier, as specified in ERC-165\r\n * @return `true` if the contract implements `_interfaceID` and\r\n */\r\n function supportsInterface(bytes4 _interfaceID) public view virtual override(ERC165, IERC165) returns (bool) {\r\n if (_interfaceID == type(IERC1155).interfaceId) {\r\n return true;\r\n }\r\n return super.supportsInterface(_interfaceID);\r\n }\r\n}\r\n' + '// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8.19;\n\ninterface IERC1155SaleFactoryFunctions {\n\n /**\n * Creates an ERC-1155 Sale proxy contract\n * @param proxyOwner The owner of the ERC-1155 Sale proxy\n * @param tokenOwner The owner of the ERC-1155 Sale implementation\n * @param items The ERC-1155 Items contract address\n * @return proxyAddr The address of the ERC-1155 Sale Proxy\n * @notice The deployed contract must be granted the MINTER_ROLE on the ERC-1155 Items contract.\n */\n function deploy(address proxyOwner, address tokenOwner, address items) external returns (address proxyAddr);\n\n /**\n * Computes the address of a proxy instance.\n * @param proxyOwner The owner of the ERC-1155 Sale proxy\n * @param tokenOwner The owner of the ERC-1155 Sale implementation\n * @param items The ERC-1155 Items contract address\n * @return proxyAddr The address of the ERC-1155 Sale Proxy\n */\n function determineAddress(\n address proxyOwner,\n address tokenOwner,\n address items\n ) external returns (address proxyAddr);\n\n}\n\ninterface IERC1155SaleFactorySignals {\n\n /**\n * Event emitted when a new ERC-1155 Sale proxy contract is deployed.\n * @param proxyAddr The address of the deployed proxy.\n */\n event ERC1155SaleDeployed(address proxyAddr);\n\n}\n\ninterface IERC1155SaleFactory is IERC1155SaleFactoryFunctions, IERC1155SaleFactorySignals { }\n' }, - 'lib/0xsequence/erc-1155/src/contracts/utils/Address.sol': { + 'src/proxies/TransparentUpgradeableBeaconProxy.sol': { content: - 'pragma solidity ^0.8.0;\r\n\r\n/**\r\n * Utility library of inline functions on addresses\r\n */\r\nlibrary Address {\r\n\r\n // Default hash for EOA accounts returned by extcodehash\r\n bytes32 constant internal ACCOUNT_HASH = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;\r\n\r\n /**\r\n * Returns whether the target address is a contract\r\n * @dev This function will return false if invoked during the constructor of a contract.\r\n * @param _address address of the account to check\r\n * @return Whether the target address is a contract\r\n */\r\n function isContract(address _address) internal view returns (bool) {\r\n bytes32 codehash;\r\n\r\n // Currently there is no better way to check if there is a contract in an address\r\n // than to check the size of the code at that address or if it has a non-zero code hash or account hash\r\n assembly { codehash := extcodehash(_address) }\r\n return (codehash != 0x0 && codehash != ACCOUNT_HASH);\r\n }\r\n}\r\n' + '// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8.19;\n\nimport { BeaconProxy, Proxy } from "./openzeppelin/BeaconProxy.sol";\nimport { ERC1967Proxy, TransparentUpgradeableProxy } from "./openzeppelin/TransparentUpgradeableProxy.sol";\n\ninterface ITransparentUpgradeableBeaconProxy {\n\n function initialize(address admin, address beacon, bytes memory data) external;\n\n}\n\nerror InvalidInitialization();\n\n/**\n * @dev As the underlying proxy implementation (TransparentUpgradeableProxy) allows the admin to call the implementation,\n * care must be taken to avoid proxy selector collisions. Implementation selectors must not conflict with the proxy selectors.\n * See https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector clashing].\n * The proxy selectors are:\n * - 0xcf7a1d77: initialize\n * - 0x3659cfe6: upgradeTo (from TransparentUpgradeableProxy)\n * - 0x4f1ef286: upgradeToAndCall (from TransparentUpgradeableProxy)\n * - 0x8f283970: changeAdmin (from TransparentUpgradeableProxy)\n * - 0xf851a440: admin (from TransparentUpgradeableProxy)\n * - 0x5c60da1b: implementation (from TransparentUpgradeableProxy)\n */\ncontract TransparentUpgradeableBeaconProxy is TransparentUpgradeableProxy, BeaconProxy {\n\n /**\n * Decode the initialization data from the msg.data and call the initialize function.\n */\n function _dispatchInitialize() private returns (bytes memory) {\n _requireZeroValue();\n\n (address admin, address beacon, bytes memory data) = abi.decode(msg.data[4:], (address, address, bytes));\n initialize(admin, beacon, data);\n\n return "";\n }\n\n function initialize(address admin, address beacon, bytes memory data) internal {\n if (_admin() != address(0)) {\n // Redundant call. This function can only be called when the admin is not set.\n revert InvalidInitialization();\n }\n _changeAdmin(admin);\n _upgradeBeaconToAndCall(beacon, data, false);\n }\n\n /**\n * @dev If the admin is not set, the fallback function is used to initialize the proxy.\n * @dev If the admin is set, the fallback function is used to delegatecall the implementation.\n */\n function _fallback() internal override(TransparentUpgradeableProxy, Proxy) {\n if (_getAdmin() == address(0)) {\n bytes memory ret;\n bytes4 selector = msg.sig;\n if (selector == ITransparentUpgradeableBeaconProxy.initialize.selector) {\n ret = _dispatchInitialize();\n // solhint-disable-next-line no-inline-assembly\n assembly {\n return(add(ret, 0x20), mload(ret))\n }\n }\n // When the admin is not set, the fallback function is used to initialize the proxy.\n revert InvalidInitialization();\n }\n TransparentUpgradeableProxy._fallback();\n }\n\n /**\n * Returns the current implementation address.\n * @dev This is the implementation address set by the admin, or the beacon implementation.\n */\n function _implementation() internal view override(ERC1967Proxy, BeaconProxy) returns (address) {\n address implementation = ERC1967Proxy._implementation();\n if (implementation != address(0)) {\n return implementation;\n }\n return BeaconProxy._implementation();\n }\n\n}\n' }, - 'lib/0xsequence/erc-1155/src/contracts/utils/ERC165.sol': { + 'lib/openzeppelin/contracts/access/Ownable.sol': { content: - 'pragma solidity ^0.8.0;\r\nimport "../interfaces/IERC165.sol";\r\n\r\nabstract contract ERC165 is IERC165 {\r\n /**\r\n * @notice Query if a contract implements an interface\r\n * @param _interfaceID The interface identifier, as specified in ERC-165\r\n * @return `true` if the contract implements `_interfaceID`\r\n */\r\n function supportsInterface(bytes4 _interfaceID) public view virtual override returns (bool) {\r\n return _interfaceID == this.supportsInterface.selector;\r\n }\r\n}\r\n' + '// 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' }, - 'lib/openzeppelin/contracts/access/AccessControl.sol': { + 'lib/openzeppelin/contracts/proxy/beacon/UpgradeableBeacon.sol': { content: - '// SPDX-License-Identifier: MIT\r\n// OpenZeppelin Contracts (last updated v4.9.0) (access/AccessControl.sol)\r\n\r\npragma solidity ^0.8.0;\r\n\r\nimport "./IAccessControl.sol";\r\nimport "../utils/Context.sol";\r\nimport "../utils/Strings.sol";\r\nimport "../utils/introspection/ERC165.sol";\r\n\r\n/**\r\n * @dev Contract module that allows children to implement role-based access\r\n * control mechanisms. This is a lightweight version that doesn\'t allow enumerating role\r\n * members except through off-chain means by accessing the contract event logs. Some\r\n * applications may benefit from on-chain enumerability, for those cases see\r\n * {AccessControlEnumerable}.\r\n *\r\n * Roles are referred to by their `bytes32` identifier. These should be exposed\r\n * in the external API and be unique. The best way to achieve this is by\r\n * using `public constant` hash digests:\r\n *\r\n * ```solidity\r\n * bytes32 public constant MY_ROLE = keccak256("MY_ROLE");\r\n * ```\r\n *\r\n * Roles can be used to represent a set of permissions. To restrict access to a\r\n * function call, use {hasRole}:\r\n *\r\n * ```solidity\r\n * function foo() public {\r\n * require(hasRole(MY_ROLE, msg.sender));\r\n * ...\r\n * }\r\n * ```\r\n *\r\n * Roles can be granted and revoked dynamically via the {grantRole} and\r\n * {revokeRole} functions. Each role has an associated admin role, and only\r\n * accounts that have a role\'s admin role can call {grantRole} and {revokeRole}.\r\n *\r\n * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means\r\n * that only accounts with this role will be able to grant or revoke other\r\n * roles. More complex role relationships can be created by using\r\n * {_setRoleAdmin}.\r\n *\r\n * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to\r\n * grant and revoke this role. Extra precautions should be taken to secure\r\n * accounts that have been granted it. We recommend using {AccessControlDefaultAdminRules}\r\n * to enforce additional security measures for this role.\r\n */\r\nabstract contract AccessControl is Context, IAccessControl, ERC165 {\r\n struct RoleData {\r\n mapping(address => bool) members;\r\n bytes32 adminRole;\r\n }\r\n\r\n mapping(bytes32 => RoleData) private _roles;\r\n\r\n bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;\r\n\r\n /**\r\n * @dev Modifier that checks that an account has a specific role. Reverts\r\n * with a standardized message including the required role.\r\n *\r\n * The format of the revert reason is given by the following regular expression:\r\n *\r\n * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/\r\n *\r\n * _Available since v4.1._\r\n */\r\n modifier onlyRole(bytes32 role) {\r\n _checkRole(role);\r\n _;\r\n }\r\n\r\n /**\r\n * @dev See {IERC165-supportsInterface}.\r\n */\r\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\r\n return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId);\r\n }\r\n\r\n /**\r\n * @dev Returns `true` if `account` has been granted `role`.\r\n */\r\n function hasRole(bytes32 role, address account) public view virtual override returns (bool) {\r\n return _roles[role].members[account];\r\n }\r\n\r\n /**\r\n * @dev Revert with a standard message if `_msgSender()` is missing `role`.\r\n * Overriding this function changes the behavior of the {onlyRole} modifier.\r\n *\r\n * Format of the revert message is described in {_checkRole}.\r\n *\r\n * _Available since v4.6._\r\n */\r\n function _checkRole(bytes32 role) internal view virtual {\r\n _checkRole(role, _msgSender());\r\n }\r\n\r\n /**\r\n * @dev Revert with a standard message if `account` is missing `role`.\r\n *\r\n * The format of the revert reason is given by the following regular expression:\r\n *\r\n * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/\r\n */\r\n function _checkRole(bytes32 role, address account) internal view virtual {\r\n if (!hasRole(role, account)) {\r\n revert(\r\n string(\r\n abi.encodePacked(\r\n "AccessControl: account ",\r\n Strings.toHexString(account),\r\n " is missing role ",\r\n Strings.toHexString(uint256(role), 32)\r\n )\r\n )\r\n );\r\n }\r\n }\r\n\r\n /**\r\n * @dev Returns the admin role that controls `role`. See {grantRole} and\r\n * {revokeRole}.\r\n *\r\n * To change a role\'s admin, use {_setRoleAdmin}.\r\n */\r\n function getRoleAdmin(bytes32 role) public view virtual override returns (bytes32) {\r\n return _roles[role].adminRole;\r\n }\r\n\r\n /**\r\n * @dev Grants `role` to `account`.\r\n *\r\n * If `account` had not been already granted `role`, emits a {RoleGranted}\r\n * event.\r\n *\r\n * Requirements:\r\n *\r\n * - the caller must have ``role``\'s admin role.\r\n *\r\n * May emit a {RoleGranted} event.\r\n */\r\n function grantRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {\r\n _grantRole(role, account);\r\n }\r\n\r\n /**\r\n * @dev Revokes `role` from `account`.\r\n *\r\n * If `account` had been granted `role`, emits a {RoleRevoked} event.\r\n *\r\n * Requirements:\r\n *\r\n * - the caller must have ``role``\'s admin role.\r\n *\r\n * May emit a {RoleRevoked} event.\r\n */\r\n function revokeRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {\r\n _revokeRole(role, account);\r\n }\r\n\r\n /**\r\n * @dev Revokes `role` from the calling account.\r\n *\r\n * Roles are often managed via {grantRole} and {revokeRole}: this function\'s\r\n * purpose is to provide a mechanism for accounts to lose their privileges\r\n * if they are compromised (such as when a trusted device is misplaced).\r\n *\r\n * If the calling account had been revoked `role`, emits a {RoleRevoked}\r\n * event.\r\n *\r\n * Requirements:\r\n *\r\n * - the caller must be `account`.\r\n *\r\n * May emit a {RoleRevoked} event.\r\n */\r\n function renounceRole(bytes32 role, address account) public virtual override {\r\n require(account == _msgSender(), "AccessControl: can only renounce roles for self");\r\n\r\n _revokeRole(role, account);\r\n }\r\n\r\n /**\r\n * @dev Grants `role` to `account`.\r\n *\r\n * If `account` had not been already granted `role`, emits a {RoleGranted}\r\n * event. Note that unlike {grantRole}, this function doesn\'t perform any\r\n * checks on the calling account.\r\n *\r\n * May emit a {RoleGranted} event.\r\n *\r\n * [WARNING]\r\n * ====\r\n * This function should only be called from the constructor when setting\r\n * up the initial roles for the system.\r\n *\r\n * Using this function in any other way is effectively circumventing the admin\r\n * system imposed by {AccessControl}.\r\n * ====\r\n *\r\n * NOTE: This function is deprecated in favor of {_grantRole}.\r\n */\r\n function _setupRole(bytes32 role, address account) internal virtual {\r\n _grantRole(role, account);\r\n }\r\n\r\n /**\r\n * @dev Sets `adminRole` as ``role``\'s admin role.\r\n *\r\n * Emits a {RoleAdminChanged} event.\r\n */\r\n function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {\r\n bytes32 previousAdminRole = getRoleAdmin(role);\r\n _roles[role].adminRole = adminRole;\r\n emit RoleAdminChanged(role, previousAdminRole, adminRole);\r\n }\r\n\r\n /**\r\n * @dev Grants `role` to `account`.\r\n *\r\n * Internal function without access restriction.\r\n *\r\n * May emit a {RoleGranted} event.\r\n */\r\n function _grantRole(bytes32 role, address account) internal virtual {\r\n if (!hasRole(role, account)) {\r\n _roles[role].members[account] = true;\r\n emit RoleGranted(role, account, _msgSender());\r\n }\r\n }\r\n\r\n /**\r\n * @dev Revokes `role` from `account`.\r\n *\r\n * Internal function without access restriction.\r\n *\r\n * May emit a {RoleRevoked} event.\r\n */\r\n function _revokeRole(bytes32 role, address account) internal virtual {\r\n if (hasRole(role, account)) {\r\n _roles[role].members[account] = false;\r\n emit RoleRevoked(role, account, _msgSender());\r\n }\r\n }\r\n}\r\n' + '// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (proxy/beacon/UpgradeableBeacon.sol)\n\npragma solidity ^0.8.0;\n\nimport "./IBeacon.sol";\nimport "../../access/Ownable.sol";\nimport "../../utils/Address.sol";\n\n/**\n * @dev This contract is used in conjunction with one or more instances of {BeaconProxy} to determine their\n * implementation contract, which is where they will delegate all function calls.\n *\n * An owner is able to change the implementation the beacon points to, thus upgrading the proxies that use this beacon.\n */\ncontract UpgradeableBeacon is IBeacon, Ownable {\n address private _implementation;\n\n /**\n * @dev Emitted when the implementation returned by the beacon is changed.\n */\n event Upgraded(address indexed implementation);\n\n /**\n * @dev Sets the address of the initial implementation, and the deployer account as the owner who can upgrade the\n * beacon.\n */\n constructor(address implementation_) {\n _setImplementation(implementation_);\n }\n\n /**\n * @dev Returns the current implementation address.\n */\n function implementation() public view virtual override returns (address) {\n return _implementation;\n }\n\n /**\n * @dev Upgrades the beacon to a new implementation.\n *\n * Emits an {Upgraded} event.\n *\n * Requirements:\n *\n * - msg.sender must be the owner of the contract.\n * - `newImplementation` must be a contract.\n */\n function upgradeTo(address newImplementation) public virtual onlyOwner {\n _setImplementation(newImplementation);\n emit Upgraded(newImplementation);\n }\n\n /**\n * @dev Sets the implementation contract address for this beacon\n *\n * Requirements:\n *\n * - `newImplementation` must be a contract.\n */\n function _setImplementation(address newImplementation) private {\n require(Address.isContract(newImplementation), "UpgradeableBeacon: implementation is not a contract");\n _implementation = newImplementation;\n }\n}\n' }, - 'lib/openzeppelin/contracts/access/AccessControlEnumerable.sol': { + 'lib/openzeppelin/contracts/utils/Create2.sol': { content: - '// SPDX-License-Identifier: MIT\r\n// OpenZeppelin Contracts (last updated v4.5.0) (access/AccessControlEnumerable.sol)\r\n\r\npragma solidity ^0.8.0;\r\n\r\nimport "./IAccessControlEnumerable.sol";\r\nimport "./AccessControl.sol";\r\nimport "../utils/structs/EnumerableSet.sol";\r\n\r\n/**\r\n * @dev Extension of {AccessControl} that allows enumerating the members of each role.\r\n */\r\nabstract contract AccessControlEnumerable is IAccessControlEnumerable, AccessControl {\r\n using EnumerableSet for EnumerableSet.AddressSet;\r\n\r\n mapping(bytes32 => EnumerableSet.AddressSet) private _roleMembers;\r\n\r\n /**\r\n * @dev See {IERC165-supportsInterface}.\r\n */\r\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\r\n return interfaceId == type(IAccessControlEnumerable).interfaceId || super.supportsInterface(interfaceId);\r\n }\r\n\r\n /**\r\n * @dev Returns one of the accounts that have `role`. `index` must be a\r\n * value between 0 and {getRoleMemberCount}, non-inclusive.\r\n *\r\n * Role bearers are not sorted in any particular way, and their ordering may\r\n * change at any point.\r\n *\r\n * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure\r\n * you perform all queries on the same block. See the following\r\n * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post]\r\n * for more information.\r\n */\r\n function getRoleMember(bytes32 role, uint256 index) public view virtual override returns (address) {\r\n return _roleMembers[role].at(index);\r\n }\r\n\r\n /**\r\n * @dev Returns the number of accounts that have `role`. Can be used\r\n * together with {getRoleMember} to enumerate all bearers of a role.\r\n */\r\n function getRoleMemberCount(bytes32 role) public view virtual override returns (uint256) {\r\n return _roleMembers[role].length();\r\n }\r\n\r\n /**\r\n * @dev Overload {_grantRole} to track enumerable memberships\r\n */\r\n function _grantRole(bytes32 role, address account) internal virtual override {\r\n super._grantRole(role, account);\r\n _roleMembers[role].add(account);\r\n }\r\n\r\n /**\r\n * @dev Overload {_revokeRole} to track enumerable memberships\r\n */\r\n function _revokeRole(bytes32 role, address account) internal virtual override {\r\n super._revokeRole(role, account);\r\n _roleMembers[role].remove(account);\r\n }\r\n}\r\n' + '// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Create2.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Helper to make usage of the `CREATE2` EVM opcode easier and safer.\n * `CREATE2` can be used to compute in advance the address where a smart\n * contract will be deployed, which allows for interesting new mechanisms known\n * as \'counterfactual interactions\'.\n *\n * See the https://eips.ethereum.org/EIPS/eip-1014#motivation[EIP] for more\n * information.\n */\nlibrary Create2 {\n /**\n * @dev Deploys a contract using `CREATE2`. The address where the contract\n * will be deployed can be known in advance via {computeAddress}.\n *\n * The bytecode for a contract can be obtained from Solidity with\n * `type(contractName).creationCode`.\n *\n * Requirements:\n *\n * - `bytecode` must not be empty.\n * - `salt` must have not been used for `bytecode` already.\n * - the factory must have a balance of at least `amount`.\n * - if `amount` is non-zero, `bytecode` must have a `payable` constructor.\n */\n function deploy(uint256 amount, bytes32 salt, bytes memory bytecode) internal returns (address addr) {\n require(address(this).balance >= amount, "Create2: insufficient balance");\n require(bytecode.length != 0, "Create2: bytecode length is zero");\n /// @solidity memory-safe-assembly\n assembly {\n addr := create2(amount, add(bytecode, 0x20), mload(bytecode), salt)\n }\n require(addr != address(0), "Create2: Failed on deploy");\n }\n\n /**\n * @dev Returns the address where a contract will be stored if deployed via {deploy}. Any change in the\n * `bytecodeHash` or `salt` will result in a new destination address.\n */\n function computeAddress(bytes32 salt, bytes32 bytecodeHash) internal view returns (address) {\n return computeAddress(salt, bytecodeHash, address(this));\n }\n\n /**\n * @dev Returns the address where a contract will be stored if deployed via {deploy} from a contract located at\n * `deployer`. If `deployer` is this contract\'s address, returns the same value as {computeAddress}.\n */\n function computeAddress(bytes32 salt, bytes32 bytecodeHash, address deployer) internal pure returns (address addr) {\n /// @solidity memory-safe-assembly\n assembly {\n let ptr := mload(0x40) // Get free memory pointer\n\n // | | ↓ ptr ... ↓ ptr + 0x0B (start) ... ↓ ptr + 0x20 ... ↓ ptr + 0x40 ... |\n // |-------------------|---------------------------------------------------------------------------|\n // | bytecodeHash | CCCCCCCCCCCCC...CC |\n // | salt | BBBBBBBBBBBBB...BB |\n // | deployer | 000000...0000AAAAAAAAAAAAAAAAAAA...AA |\n // | 0xFF | FF |\n // |-------------------|---------------------------------------------------------------------------|\n // | memory | 000000...00FFAAAAAAAAAAAAAAAAAAA...AABBBBBBBBBBBBB...BBCCCCCCCCCCCCC...CC |\n // | keccak(start, 85) | ↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑ |\n\n mstore(add(ptr, 0x40), bytecodeHash)\n mstore(add(ptr, 0x20), salt)\n mstore(ptr, deployer) // Right-aligned with 12 preceding garbage bytes\n let start := add(ptr, 0x0b) // The hashed data starts at the final garbage byte which we will set to 0xff\n mstore8(start, 0xff)\n addr := keccak256(start, 85)\n }\n }\n}\n' }, - 'lib/openzeppelin/contracts/access/IAccessControl.sol': { + 'src/tokens/ERC1155/extensions/supply/ERC1155Supply.sol': { content: - "// SPDX-License-Identifier: MIT\r\n// OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol)\r\n\r\npragma solidity ^0.8.0;\r\n\r\n/**\r\n * @dev External interface of AccessControl declared to support ERC165 detection.\r\n */\r\ninterface IAccessControl {\r\n /**\r\n * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`\r\n *\r\n * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite\r\n * {RoleAdminChanged} not being emitted signaling this.\r\n *\r\n * _Available since v3.1._\r\n */\r\n event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);\r\n\r\n /**\r\n * @dev Emitted when `account` is granted `role`.\r\n *\r\n * `sender` is the account that originated the contract call, an admin role\r\n * bearer except when using {AccessControl-_setupRole}.\r\n */\r\n event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);\r\n\r\n /**\r\n * @dev Emitted when `account` is revoked `role`.\r\n *\r\n * `sender` is the account that originated the contract call:\r\n * - if using `revokeRole`, it is the admin role bearer\r\n * - if using `renounceRole`, it is the role bearer (i.e. `account`)\r\n */\r\n event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);\r\n\r\n /**\r\n * @dev Returns `true` if `account` has been granted `role`.\r\n */\r\n function hasRole(bytes32 role, address account) external view returns (bool);\r\n\r\n /**\r\n * @dev Returns the admin role that controls `role`. See {grantRole} and\r\n * {revokeRole}.\r\n *\r\n * To change a role's admin, use {AccessControl-_setRoleAdmin}.\r\n */\r\n function getRoleAdmin(bytes32 role) external view returns (bytes32);\r\n\r\n /**\r\n * @dev Grants `role` to `account`.\r\n *\r\n * If `account` had not been already granted `role`, emits a {RoleGranted}\r\n * event.\r\n *\r\n * Requirements:\r\n *\r\n * - the caller must have ``role``'s admin role.\r\n */\r\n function grantRole(bytes32 role, address account) external;\r\n\r\n /**\r\n * @dev Revokes `role` from `account`.\r\n *\r\n * If `account` had been granted `role`, emits a {RoleRevoked} event.\r\n *\r\n * Requirements:\r\n *\r\n * - the caller must have ``role``'s admin role.\r\n */\r\n function revokeRole(bytes32 role, address account) external;\r\n\r\n /**\r\n * @dev Revokes `role` from the calling account.\r\n *\r\n * Roles are often managed via {grantRole} and {revokeRole}: this function's\r\n * purpose is to provide a mechanism for accounts to lose their privileges\r\n * if they are compromised (such as when a trusted device is misplaced).\r\n *\r\n * If the calling account had been granted `role`, emits a {RoleRevoked}\r\n * event.\r\n *\r\n * Requirements:\r\n *\r\n * - the caller must be `account`.\r\n */\r\n function renounceRole(bytes32 role, address account) external;\r\n}\r\n" + '// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8.19;\n\nimport {\n IERC1155Supply,\n IERC1155SupplyFunctions\n} from "@0xsequence/contracts-library/tokens/ERC1155/extensions/supply/IERC1155Supply.sol";\nimport { ERC1155 } from "@0xsequence/erc-1155/contracts/tokens/ERC1155/ERC1155.sol";\n\n/**\n * An ERC-1155 extension that tracks token supply.\n */\nabstract contract ERC1155Supply is ERC1155, IERC1155Supply {\n\n // Current supply\n uint256 public totalSupply;\n mapping(uint256 => uint256) public tokenSupply;\n\n /**\n * Mint _amount of tokens of a given id\n * @param _to The address to mint tokens to\n * @param _id Token id to mint\n * @param _amount The amount to be minted\n * @param _data Data to pass if receiver is contract\n */\n function _mint(address _to, uint256 _id, uint256 _amount, bytes memory _data) internal virtual {\n totalSupply += _amount;\n tokenSupply[_id] += _amount;\n balances[_to][_id] += _amount;\n\n emit TransferSingle(msg.sender, address(0x0), _to, _id, _amount);\n\n _callonERC1155Received(address(0x0), _to, _id, _amount, gasleft(), _data);\n }\n\n /**\n * Mint tokens for each ids in _ids\n * @param _to The address to mint tokens to\n * @param _ids Array of ids to mint\n * @param _amounts Array of amount of tokens to mint per id\n * @param _data Data to pass if receiver is contract\n */\n function _batchMint(\n address _to,\n uint256[] memory _ids,\n uint256[] memory _amounts,\n bytes memory _data\n ) internal virtual {\n uint256 nMint = _ids.length;\n if (nMint != _amounts.length) {\n revert InvalidArrayLength();\n }\n\n // Executing all minting\n uint256 totalAmount = 0;\n for (uint256 i = 0; i < nMint; i++) {\n // Update storage balance\n balances[_to][_ids[i]] += _amounts[i];\n tokenSupply[_ids[i]] += _amounts[i];\n totalAmount += _amounts[i];\n }\n totalSupply += totalAmount;\n\n emit TransferBatch(msg.sender, address(0x0), _to, _ids, _amounts);\n\n // Calling onReceive method if recipient is contract\n _callonERC1155BatchReceived(address(0x0), _to, _ids, _amounts, gasleft(), _data);\n }\n\n /**\n * Burn _amount of tokens of a given token id\n * @param _from The address to burn tokens from\n * @param _id Token id to burn\n * @param _amount The amount to be burned\n */\n function _burn(address _from, uint256 _id, uint256 _amount) internal virtual {\n // Supply\n totalSupply -= _amount;\n tokenSupply[_id] -= _amount;\n\n // Balances\n balances[_from][_id] -= _amount;\n\n // Emit event\n emit TransferSingle(msg.sender, _from, address(0x0), _id, _amount);\n }\n\n /**\n * Burn tokens of given token id for each (_ids[i], _amounts[i]) pair\n * @param _from The address to burn tokens from\n * @param _ids Array of token ids to burn\n * @param _amounts Array of the amount to be burned\n */\n function _batchBurn(address _from, uint256[] memory _ids, uint256[] memory _amounts) internal virtual {\n uint256 nBurn = _ids.length;\n if (nBurn != _amounts.length) {\n revert InvalidArrayLength();\n }\n\n uint256 totalAmount = 0;\n for (uint256 i = 0; i < nBurn; i++) {\n // Update balances\n balances[_from][_ids[i]] -= _amounts[i];\n tokenSupply[_ids[i]] -= _amounts[i];\n totalAmount += _amounts[i];\n }\n totalSupply -= totalAmount;\n\n // Emit batch mint event\n emit TransferBatch(msg.sender, _from, address(0x0), _ids, _amounts);\n }\n\n //\n // Views\n //\n\n /**\n * Check interface support.\n * @param interfaceId Interface id\n * @return True if supported\n */\n function supportsInterface(\n bytes4 interfaceId\n ) public view virtual override(ERC1155) returns (bool) {\n return type(IERC1155SupplyFunctions).interfaceId == interfaceId || super.supportsInterface(interfaceId);\n }\n\n}\n' }, - 'lib/openzeppelin/contracts/access/IAccessControlEnumerable.sol': { + 'src/tokens/ERC1155/utility/sale/IERC1155Sale.sol': { content: - '// SPDX-License-Identifier: MIT\r\n// OpenZeppelin Contracts v4.4.1 (access/IAccessControlEnumerable.sol)\r\n\r\npragma solidity ^0.8.0;\r\n\r\nimport "./IAccessControl.sol";\r\n\r\n/**\r\n * @dev External interface of AccessControlEnumerable declared to support ERC165 detection.\r\n */\r\ninterface IAccessControlEnumerable is IAccessControl {\r\n /**\r\n * @dev Returns one of the accounts that have `role`. `index` must be a\r\n * value between 0 and {getRoleMemberCount}, non-inclusive.\r\n *\r\n * Role bearers are not sorted in any particular way, and their ordering may\r\n * change at any point.\r\n *\r\n * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure\r\n * you perform all queries on the same block. See the following\r\n * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post]\r\n * for more information.\r\n */\r\n function getRoleMember(bytes32 role, uint256 index) external view returns (address);\r\n\r\n /**\r\n * @dev Returns the number of accounts that have `role`. Can be used\r\n * together with {getRoleMember} to enumerate all bearers of a role.\r\n */\r\n function getRoleMemberCount(bytes32 role) external view returns (uint256);\r\n}\r\n' + "// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8.19;\n\ninterface IERC1155SaleFunctions {\n\n struct SaleDetails {\n uint256 cost;\n uint256 supplyCap; // 0 supply cap indicates unlimited supply\n uint64 startTime;\n uint64 endTime; // 0 end time indicates sale inactive\n bytes32 merkleRoot; // Root of allowed addresses\n }\n\n /**\n * Get global sales details.\n * @return Sale details.\n * @notice Global sales details apply to all tokens.\n * @notice Global sales details are overriden when token sale is active.\n */\n function globalSaleDetails() external view returns (SaleDetails memory);\n\n /**\n * Get token sale details.\n * @param tokenId Token ID to get sale details for.\n * @return Sale details.\n * @notice Token sale details override global sale details.\n */\n function tokenSaleDetails(\n uint256 tokenId\n ) external view returns (SaleDetails memory);\n\n /**\n * Get sale details for multiple tokens.\n * @param tokenIds Array of token IDs to retrieve sale details for.\n * @return Array of sale details corresponding to each token ID.\n * @notice Each token's sale details override the global sale details if set.\n */\n function tokenSaleDetailsBatch(\n uint256[] calldata tokenIds\n ) external view returns (SaleDetails[] memory);\n\n /**\n * Get payment token.\n * @return Payment token address.\n * @notice address(0) indicates payment in ETH.\n */\n function paymentToken() external view returns (address);\n\n /**\n * Mint tokens.\n * @param to Address to mint tokens to.\n * @param tokenIds Token IDs to mint.\n * @param amounts Amounts of tokens to mint.\n * @param data Data to pass if receiver is contract.\n * @param paymentToken ERC20 token address to accept payment in. address(0) indicates ETH.\n * @param maxTotal Maximum amount of payment tokens.\n * @param proof Merkle proof for allowlist minting.\n * @notice Sale must be active for all tokens.\n * @dev tokenIds must be sorted ascending without duplicates.\n * @dev An empty proof is supplied when no proof is required.\n */\n function mint(\n address to,\n uint256[] memory tokenIds,\n uint256[] memory amounts,\n bytes memory data,\n address paymentToken,\n uint256 maxTotal,\n bytes32[] calldata proof\n ) external payable;\n\n}\n\ninterface IERC1155SaleSignals {\n\n event GlobalSaleDetailsUpdated(\n uint256 cost, uint256 supplyCap, uint64 startTime, uint64 endTime, bytes32 merkleRoot\n );\n event TokenSaleDetailsUpdated(\n uint256 tokenId, uint256 cost, uint256 supplyCap, uint64 startTime, uint64 endTime, bytes32 merkleRoot\n );\n event ItemsMinted(address to, uint256[] tokenIds, uint256[] amounts);\n\n /**\n * Contract already initialized.\n */\n error InvalidInitialization();\n\n /**\n * Sale details supplied are invalid.\n */\n error InvalidSaleDetails();\n\n /**\n * Sale is not active globally.\n */\n error GlobalSaleInactive();\n\n /**\n * Sale is not active.\n * @param tokenId Invalid Token ID.\n */\n error SaleInactive(uint256 tokenId);\n\n /**\n * Insufficient tokens for payment.\n * @param currency Currency address. address(0) indicates ETH.\n * @param expected Expected amount of tokens.\n * @param actual Actual amount of tokens.\n */\n error InsufficientPayment(address currency, uint256 expected, uint256 actual);\n\n /**\n * Invalid token IDs.\n */\n error InvalidTokenIds();\n\n /**\n * Insufficient supply of tokens.\n */\n error InsufficientSupply(uint256 currentSupply, uint256 requestedAmount, uint256 maxSupply);\n\n}\n\ninterface IERC1155Sale is IERC1155SaleFunctions, IERC1155SaleSignals { }\n" }, - 'lib/openzeppelin/contracts/access/Ownable.sol': { + 'src/tokens/common/MerkleProofSingleUse.sol': { content: - '// SPDX-License-Identifier: MIT\r\n// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)\r\n\r\npragma solidity ^0.8.0;\r\n\r\nimport "../utils/Context.sol";\r\n\r\n/**\r\n * @dev Contract module which provides a basic access control mechanism, where\r\n * there is an account (an owner) that can be granted exclusive access to\r\n * specific functions.\r\n *\r\n * By default, the owner account will be the one that deploys the contract. This\r\n * can later be changed with {transferOwnership}.\r\n *\r\n * This module is used through inheritance. It will make available the modifier\r\n * `onlyOwner`, which can be applied to your functions to restrict their use to\r\n * the owner.\r\n */\r\nabstract contract Ownable is Context {\r\n address private _owner;\r\n\r\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\r\n\r\n /**\r\n * @dev Initializes the contract setting the deployer as the initial owner.\r\n */\r\n constructor() {\r\n _transferOwnership(_msgSender());\r\n }\r\n\r\n /**\r\n * @dev Throws if called by any account other than the owner.\r\n */\r\n modifier onlyOwner() {\r\n _checkOwner();\r\n _;\r\n }\r\n\r\n /**\r\n * @dev Returns the address of the current owner.\r\n */\r\n function owner() public view virtual returns (address) {\r\n return _owner;\r\n }\r\n\r\n /**\r\n * @dev Throws if the sender is not the owner.\r\n */\r\n function _checkOwner() internal view virtual {\r\n require(owner() == _msgSender(), "Ownable: caller is not the owner");\r\n }\r\n\r\n /**\r\n * @dev Leaves the contract without owner. It will not be possible to call\r\n * `onlyOwner` functions. Can only be called by the current owner.\r\n *\r\n * NOTE: Renouncing ownership will leave the contract without an owner,\r\n * thereby disabling any functionality that is only available to the owner.\r\n */\r\n function renounceOwnership() public virtual onlyOwner {\r\n _transferOwnership(address(0));\r\n }\r\n\r\n /**\r\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\r\n * Can only be called by the current owner.\r\n */\r\n function transferOwnership(address newOwner) public virtual onlyOwner {\r\n require(newOwner != address(0), "Ownable: new owner is the zero address");\r\n _transferOwnership(newOwner);\r\n }\r\n\r\n /**\r\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\r\n * Internal function without access restriction.\r\n */\r\n function _transferOwnership(address newOwner) internal virtual {\r\n address oldOwner = _owner;\r\n _owner = newOwner;\r\n emit OwnershipTransferred(oldOwner, newOwner);\r\n }\r\n}\r\n' + '// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8.19;\n\nimport { IMerkleProofSingleUse } from "@0xsequence/contracts-library/tokens/common/IMerkleProofSingleUse.sol";\nimport { MerkleProof } from "@openzeppelin/contracts/utils/cryptography/MerkleProof.sol";\n\n/**\n * Require single use merkle proofs per address.\n */\nabstract contract MerkleProofSingleUse is IMerkleProofSingleUse {\n\n // Stores proofs used by an address\n mapping(address => mapping(bytes32 => bool)) private _proofUsed;\n\n /**\n * Requires the given merkle proof to be valid.\n * @param root Merkle root.\n * @param proof Merkle proof.\n * @param addr Address to check.\n * @param salt Salt used to generate the merkle leaf.\n * @notice Fails when the proof is invalid or the proof has already been claimed by this address.\n * @dev This function reverts on failure.\n */\n function requireMerkleProof(bytes32 root, bytes32[] calldata proof, address addr, bytes32 salt) internal {\n if (root != bytes32(0)) {\n if (!checkMerkleProof(root, proof, addr, salt)) {\n revert MerkleProofInvalid(root, proof, addr, salt);\n }\n _proofUsed[addr][root] = true;\n }\n }\n\n /**\n * Checks if the given merkle proof is valid.\n * @param root Merkle root.\n * @param proof Merkle proof.\n * @param addr Address to check.\n * @param salt Salt used to generate the merkle leaf.\n * @return True if the proof is valid and has not yet been used by {addr}.\n */\n function checkMerkleProof(\n bytes32 root,\n bytes32[] calldata proof,\n address addr,\n bytes32 salt\n ) public view returns (bool) {\n return !_proofUsed[addr][root] && MerkleProof.verify(proof, root, keccak256(abi.encodePacked(addr, salt)));\n }\n\n}\n' }, - 'lib/openzeppelin/contracts/interfaces/IERC1967.sol': { + 'src/tokens/common/WithdrawControlled.sol': { content: - '// SPDX-License-Identifier: MIT\r\n// OpenZeppelin Contracts (last updated v4.9.0) (interfaces/IERC1967.sol)\r\n\r\npragma solidity ^0.8.0;\r\n\r\n/**\r\n * @dev ERC-1967: Proxy Storage Slots. This interface contains the events defined in the ERC.\r\n *\r\n * _Available since v4.8.3._\r\n */\r\ninterface IERC1967 {\r\n /**\r\n * @dev Emitted when the implementation is upgraded.\r\n */\r\n event Upgraded(address indexed implementation);\r\n\r\n /**\r\n * @dev Emitted when the admin account has changed.\r\n */\r\n event AdminChanged(address previousAdmin, address newAdmin);\r\n\r\n /**\r\n * @dev Emitted when the beacon is changed.\r\n */\r\n event BeaconUpgraded(address indexed beacon);\r\n}\r\n' + '// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8.19;\n\nimport { IWithdrawControlled } from "@0xsequence/contracts-library/tokens/common/IWithdrawControlled.sol";\n\nimport { AccessControlEnumerable } from "@openzeppelin/contracts/access/AccessControlEnumerable.sol";\nimport { IERC20, SafeERC20 } from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";\n\n/**\n * An abstract contract that allows ETH and ERC20 tokens stored in the contract to be withdrawn.\n */\nabstract contract WithdrawControlled is AccessControlEnumerable, IWithdrawControlled {\n\n bytes32 internal constant WITHDRAW_ROLE = keccak256("WITHDRAW_ROLE");\n\n //\n // Withdraw\n //\n\n /**\n * Withdraws ERC20 tokens owned by this contract.\n * @param token The ERC20 token address.\n * @param to Address to withdraw to.\n * @param value Amount to withdraw.\n * @notice Only callable by an address with the withdraw role.\n */\n function withdrawERC20(address token, address to, uint256 value) public onlyRole(WITHDRAW_ROLE) {\n SafeERC20.safeTransfer(IERC20(token), to, value);\n }\n\n /**\n * Withdraws ETH owned by this sale contract.\n * @param to Address to withdraw to.\n * @param value Amount to withdraw.\n * @notice Only callable by an address with the withdraw role.\n */\n function withdrawETH(address to, uint256 value) public onlyRole(WITHDRAW_ROLE) {\n (bool success,) = to.call{ value: value }("");\n if (!success) {\n revert WithdrawFailed();\n }\n }\n\n}\n' }, - 'lib/openzeppelin/contracts/interfaces/draft-IERC1822.sol': { + 'src/tokens/ERC1155/extensions/supply/IERC1155Supply.sol': { content: - '// SPDX-License-Identifier: MIT\r\n// OpenZeppelin Contracts (last updated v4.5.0) (interfaces/draft-IERC1822.sol)\r\n\r\npragma solidity ^0.8.0;\r\n\r\n/**\r\n * @dev ERC1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified\r\n * proxy whose upgrades are fully controlled by the current implementation.\r\n */\r\ninterface IERC1822Proxiable {\r\n /**\r\n * @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation\r\n * address.\r\n *\r\n * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks\r\n * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this\r\n * function revert if invoked through a proxy.\r\n */\r\n function proxiableUUID() external view returns (bytes32);\r\n}\r\n' + '// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8.19;\n\ninterface IERC1155SupplyFunctions {\n\n /**\n * Returns the total supply of ERC1155 tokens.\n */\n function totalSupply() external returns (uint256);\n\n /**\n * Returns the total supply of a given ERC1155 token.\n * @param tokenId The ERC1155 token id.\n */\n function tokenSupply(\n uint256 tokenId\n ) external returns (uint256);\n\n}\n\ninterface IERC1155SupplySignals {\n\n /**\n * Invalid array input length.\n */\n error InvalidArrayLength();\n\n}\n\ninterface IERC1155Supply is IERC1155SupplySignals { }\n' }, - 'lib/openzeppelin/contracts/proxy/ERC1967/ERC1967Upgrade.sol': { + 'src/tokens/ERC1155/presets/items/IERC1155Items.sol': { content: - '// SPDX-License-Identifier: MIT\r\n// OpenZeppelin Contracts (last updated v4.9.0) (proxy/ERC1967/ERC1967Upgrade.sol)\r\n\r\npragma solidity ^0.8.2;\r\n\r\nimport "../beacon/IBeacon.sol";\r\nimport "../../interfaces/IERC1967.sol";\r\nimport "../../interfaces/draft-IERC1822.sol";\r\nimport "../../utils/Address.sol";\r\nimport "../../utils/StorageSlot.sol";\r\n\r\n/**\r\n * @dev This abstract contract provides getters and event emitting update functions for\r\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots.\r\n *\r\n * _Available since v4.1._\r\n */\r\nabstract contract ERC1967Upgrade is IERC1967 {\r\n // This is the keccak-256 hash of "eip1967.proxy.rollback" subtracted by 1\r\n bytes32 private constant _ROLLBACK_SLOT = 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143;\r\n\r\n /**\r\n * @dev Storage slot with the address of the current implementation.\r\n * This is the keccak-256 hash of "eip1967.proxy.implementation" subtracted by 1, and is\r\n * validated in the constructor.\r\n */\r\n bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\r\n\r\n /**\r\n * @dev Returns the current implementation address.\r\n */\r\n function _getImplementation() internal view returns (address) {\r\n return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\r\n }\r\n\r\n /**\r\n * @dev Stores a new address in the EIP1967 implementation slot.\r\n */\r\n function _setImplementation(address newImplementation) private {\r\n require(Address.isContract(newImplementation), "ERC1967: new implementation is not a contract");\r\n StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\r\n }\r\n\r\n /**\r\n * @dev Perform implementation upgrade\r\n *\r\n * Emits an {Upgraded} event.\r\n */\r\n function _upgradeTo(address newImplementation) internal {\r\n _setImplementation(newImplementation);\r\n emit Upgraded(newImplementation);\r\n }\r\n\r\n /**\r\n * @dev Perform implementation upgrade with additional setup call.\r\n *\r\n * Emits an {Upgraded} event.\r\n */\r\n function _upgradeToAndCall(address newImplementation, bytes memory data, bool forceCall) internal {\r\n _upgradeTo(newImplementation);\r\n if (data.length > 0 || forceCall) {\r\n Address.functionDelegateCall(newImplementation, data);\r\n }\r\n }\r\n\r\n /**\r\n * @dev Perform implementation upgrade with security checks for UUPS proxies, and additional setup call.\r\n *\r\n * Emits an {Upgraded} event.\r\n */\r\n function _upgradeToAndCallUUPS(address newImplementation, bytes memory data, bool forceCall) internal {\r\n // Upgrades from old implementations will perform a rollback test. This test requires the new\r\n // implementation to upgrade back to the old, non-ERC1822 compliant, implementation. Removing\r\n // this special case will break upgrade paths from old UUPS implementation to new ones.\r\n if (StorageSlot.getBooleanSlot(_ROLLBACK_SLOT).value) {\r\n _setImplementation(newImplementation);\r\n } else {\r\n try IERC1822Proxiable(newImplementation).proxiableUUID() returns (bytes32 slot) {\r\n require(slot == _IMPLEMENTATION_SLOT, "ERC1967Upgrade: unsupported proxiableUUID");\r\n } catch {\r\n revert("ERC1967Upgrade: new implementation is not UUPS");\r\n }\r\n _upgradeToAndCall(newImplementation, data, forceCall);\r\n }\r\n }\r\n\r\n /**\r\n * @dev Storage slot with the admin of the contract.\r\n * This is the keccak-256 hash of "eip1967.proxy.admin" subtracted by 1, and is\r\n * validated in the constructor.\r\n */\r\n bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\r\n\r\n /**\r\n * @dev Returns the current admin.\r\n */\r\n function _getAdmin() internal view returns (address) {\r\n return StorageSlot.getAddressSlot(_ADMIN_SLOT).value;\r\n }\r\n\r\n /**\r\n * @dev Stores a new address in the EIP1967 admin slot.\r\n */\r\n function _setAdmin(address newAdmin) private {\r\n require(newAdmin != address(0), "ERC1967: new admin is the zero address");\r\n StorageSlot.getAddressSlot(_ADMIN_SLOT).value = newAdmin;\r\n }\r\n\r\n /**\r\n * @dev Changes the admin of the proxy.\r\n *\r\n * Emits an {AdminChanged} event.\r\n */\r\n function _changeAdmin(address newAdmin) internal {\r\n emit AdminChanged(_getAdmin(), newAdmin);\r\n _setAdmin(newAdmin);\r\n }\r\n\r\n /**\r\n * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy.\r\n * This is bytes32(uint256(keccak256(\'eip1967.proxy.beacon\')) - 1)) and is validated in the constructor.\r\n */\r\n bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50;\r\n\r\n /**\r\n * @dev Returns the current beacon.\r\n */\r\n function _getBeacon() internal view returns (address) {\r\n return StorageSlot.getAddressSlot(_BEACON_SLOT).value;\r\n }\r\n\r\n /**\r\n * @dev Stores a new beacon in the EIP1967 beacon slot.\r\n */\r\n function _setBeacon(address newBeacon) private {\r\n require(Address.isContract(newBeacon), "ERC1967: new beacon is not a contract");\r\n require(\r\n Address.isContract(IBeacon(newBeacon).implementation()),\r\n "ERC1967: beacon implementation is not a contract"\r\n );\r\n StorageSlot.getAddressSlot(_BEACON_SLOT).value = newBeacon;\r\n }\r\n\r\n /**\r\n * @dev Perform beacon upgrade with additional setup call. Note: This upgrades the address of the beacon, it does\r\n * not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that).\r\n *\r\n * Emits a {BeaconUpgraded} event.\r\n */\r\n function _upgradeBeaconToAndCall(address newBeacon, bytes memory data, bool forceCall) internal {\r\n _setBeacon(newBeacon);\r\n emit BeaconUpgraded(newBeacon);\r\n if (data.length > 0 || forceCall) {\r\n Address.functionDelegateCall(IBeacon(newBeacon).implementation(), data);\r\n }\r\n }\r\n}\r\n' + '// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8.19;\n\ninterface IERC1155ItemsFunctions {\n\n /**\n * Mint tokens.\n * @param to Address to mint tokens to.\n * @param tokenId Token ID to mint.\n * @param amount Amount of tokens to mint.\n * @param data Data to pass if receiver is contract.\n */\n function mint(address to, uint256 tokenId, uint256 amount, bytes memory data) external;\n\n /**\n * Mint tokens.\n * @param to Address to mint tokens to.\n * @param tokenIds Token IDs to mint.\n * @param amounts Amounts of tokens to mint.\n * @param data Data to pass if receiver is contract.\n */\n function batchMint(address to, uint256[] memory tokenIds, uint256[] memory amounts, bytes memory data) external;\n\n}\n\ninterface IERC1155ItemsSignals {\n\n /**\n * Invalid initialization error.\n */\n error InvalidInitialization();\n\n}\n\ninterface IERC1155Items is IERC1155ItemsFunctions, IERC1155ItemsSignals { }\n' }, - 'lib/openzeppelin/contracts/proxy/Proxy.sol': { + 'lib/0xsequence/erc-1155/src/contracts/interfaces/IERC1155.sol': { content: - "// SPDX-License-Identifier: MIT\r\n// OpenZeppelin Contracts (last updated v4.6.0) (proxy/Proxy.sol)\r\n\r\npragma solidity ^0.8.0;\r\n\r\n/**\r\n * @dev This abstract contract provides a fallback function that delegates all calls to another contract using the EVM\r\n * instruction `delegatecall`. We refer to the second contract as the _implementation_ behind the proxy, and it has to\r\n * be specified by overriding the virtual {_implementation} function.\r\n *\r\n * Additionally, delegation to the implementation can be triggered manually through the {_fallback} function, or to a\r\n * different contract through the {_delegate} function.\r\n *\r\n * The success and return data of the delegated call will be returned back to the caller of the proxy.\r\n */\r\nabstract contract Proxy {\r\n /**\r\n * @dev Delegates the current call to `implementation`.\r\n *\r\n * This function does not return to its internal call site, it will return directly to the external caller.\r\n */\r\n function _delegate(address implementation) internal virtual {\r\n assembly {\r\n // Copy msg.data. We take full control of memory in this inline assembly\r\n // block because it will not return to Solidity code. We overwrite the\r\n // Solidity scratch pad at memory position 0.\r\n calldatacopy(0, 0, calldatasize())\r\n\r\n // Call the implementation.\r\n // out and outsize are 0 because we don't know the size yet.\r\n let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)\r\n\r\n // Copy the returned data.\r\n returndatacopy(0, 0, returndatasize())\r\n\r\n switch result\r\n // delegatecall returns 0 on error.\r\n case 0 {\r\n revert(0, returndatasize())\r\n }\r\n default {\r\n return(0, returndatasize())\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * @dev This is a virtual function that should be overridden so it returns the address to which the fallback function\r\n * and {_fallback} should delegate.\r\n */\r\n function _implementation() internal view virtual returns (address);\r\n\r\n /**\r\n * @dev Delegates the current call to the address returned by `_implementation()`.\r\n *\r\n * This function does not return to its internal call site, it will return directly to the external caller.\r\n */\r\n function _fallback() internal virtual {\r\n _beforeFallback();\r\n _delegate(_implementation());\r\n }\r\n\r\n /**\r\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other\r\n * function in the contract matches the call data.\r\n */\r\n fallback() external payable virtual {\r\n _fallback();\r\n }\r\n\r\n /**\r\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if call data\r\n * is empty.\r\n */\r\n receive() external payable virtual {\r\n _fallback();\r\n }\r\n\r\n /**\r\n * @dev Hook that is called before falling back to the implementation. Can happen as part of a manual `_fallback`\r\n * call, or as part of the Solidity `fallback` or `receive` functions.\r\n *\r\n * If overridden should call `super._beforeFallback()`.\r\n */\r\n function _beforeFallback() internal virtual {}\r\n}\r\n" + '// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8.0;\nimport \'./IERC165.sol\';\n\n\ninterface IERC1155 is IERC165 {\n\n /****************************************|\n | Events |\n |_______________________________________*/\n\n /**\n * @dev Either TransferSingle or TransferBatch MUST emit when tokens are transferred, including zero amount transfers as well as minting or burning\n * Operator MUST be msg.sender\n * When minting/creating tokens, the `_from` field MUST be set to `0x0`\n * When burning/destroying tokens, the `_to` field MUST be set to `0x0`\n * The total amount transferred from address 0x0 minus the total amount transferred to 0x0 may be used by clients and exchanges to be added to the "circulating supply" for a given token ID\n * To broadcast the existence of a token ID with no initial balance, the contract SHOULD emit the TransferSingle event from `0x0` to `0x0`, with the token creator as `_operator`, and a `_amount` of 0\n */\n event TransferSingle(address indexed _operator, address indexed _from, address indexed _to, uint256 _id, uint256 _amount);\n\n /**\n * @dev Either TransferSingle or TransferBatch MUST emit when tokens are transferred, including zero amount transfers as well as minting or burning\n * Operator MUST be msg.sender\n * When minting/creating tokens, the `_from` field MUST be set to `0x0`\n * When burning/destroying tokens, the `_to` field MUST be set to `0x0`\n * The total amount transferred from address 0x0 minus the total amount transferred to 0x0 may be used by clients and exchanges to be added to the "circulating supply" for a given token ID\n * To broadcast the existence of multiple token IDs with no initial balance, this SHOULD emit the TransferBatch event from `0x0` to `0x0`, with the token creator as `_operator`, and a `_amount` of 0\n */\n event TransferBatch(address indexed _operator, address indexed _from, address indexed _to, uint256[] _ids, uint256[] _amounts);\n\n /**\n * @dev MUST emit when an approval is updated\n */\n event ApprovalForAll(address indexed _owner, address indexed _operator, bool _approved);\n\n\n /****************************************|\n | Functions |\n |_______________________________________*/\n\n /**\n * @notice Transfers amount of an _id from the _from address to the _to address specified\n * @dev MUST emit TransferSingle event on success\n * Caller must be approved to manage the _from account\'s tokens (see isApprovedForAll)\n * MUST throw if `_to` is the zero address\n * MUST throw if balance of sender for token `_id` is lower than the `_amount` sent\n * MUST throw on any other error\n * When transfer is complete, this function MUST check if `_to` is a smart contract (code size > 0). If so, it MUST call `onERC1155Received` on `_to` and revert if the return amount is not `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))`\n * @param _from Source address\n * @param _to Target address\n * @param _id ID of the token type\n * @param _amount Transfered amount\n * @param _data Additional data with no specified format, sent in call to `_to`\n */\n function safeTransferFrom(address _from, address _to, uint256 _id, uint256 _amount, bytes calldata _data) external;\n\n /**\n * @notice Send multiple types of Tokens from the _from address to the _to address (with safety call)\n * @dev MUST emit TransferBatch event on success\n * Caller must be approved to manage the _from account\'s tokens (see isApprovedForAll)\n * MUST throw if `_to` is the zero address\n * MUST throw if length of `_ids` is not the same as length of `_amounts`\n * MUST throw if any of the balance of sender for token `_ids` is lower than the respective `_amounts` sent\n * MUST throw on any other error\n * When transfer is complete, this function MUST check if `_to` is a smart contract (code size > 0). If so, it MUST call `onERC1155BatchReceived` on `_to` and revert if the return amount is not `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))`\n * Transfers and events MUST occur in the array order they were submitted (_ids[0] before _ids[1], etc)\n * @param _from Source addresses\n * @param _to Target addresses\n * @param _ids IDs of each token type\n * @param _amounts Transfer amounts per token type\n * @param _data Additional data with no specified format, sent in call to `_to`\n */\n function safeBatchTransferFrom(address _from, address _to, uint256[] calldata _ids, uint256[] calldata _amounts, bytes calldata _data) 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 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 isOperator True if the operator is approved, false if not\n */\n function isApprovedForAll(address _owner, address _operator) external view returns (bool isOperator);\n}\n' }, - 'lib/openzeppelin/contracts/proxy/beacon/IBeacon.sol': { + 'src/proxies/openzeppelin/BeaconProxy.sol': { content: - '// SPDX-License-Identifier: MIT\r\n// OpenZeppelin Contracts v4.4.1 (proxy/beacon/IBeacon.sol)\r\n\r\npragma solidity ^0.8.0;\r\n\r\n/**\r\n * @dev This is the interface that {BeaconProxy} expects of its beacon.\r\n */\r\ninterface IBeacon {\r\n /**\r\n * @dev Must return an address that can be used as a delegate call target.\r\n *\r\n * {BeaconProxy} will check that this address is a contract.\r\n */\r\n function implementation() external view returns (address);\r\n}\r\n' + '// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/beacon/BeaconProxy.sol)\n\n// Note: This implementation is an exact copy with the constructor removed, and pragma and imports updated.\n\npragma solidity ^0.8.19;\n\nimport "@openzeppelin/contracts/proxy/ERC1967/ERC1967Upgrade.sol";\nimport "@openzeppelin/contracts/proxy/Proxy.sol";\nimport "@openzeppelin/contracts/proxy/beacon/IBeacon.sol";\n\n/**\n * @dev This contract implements a proxy that gets the implementation address for each call from an {UpgradeableBeacon}.\n *\n * The beacon address is stored in storage slot `uint256(keccak256(\'eip1967.proxy.beacon\')) - 1`, so that it doesn\'t\n * conflict with the storage layout of the implementation behind the proxy.\n *\n * _Available since v3.4._\n */\ncontract BeaconProxy is Proxy, ERC1967Upgrade {\n\n /**\n * @dev Returns the current beacon address.\n */\n function _beacon() internal view virtual returns (address) {\n return _getBeacon();\n }\n\n /**\n * @dev Returns the current implementation address of the associated beacon.\n */\n function _implementation() internal view virtual override returns (address) {\n return IBeacon(_getBeacon()).implementation();\n }\n\n /**\n * @dev Changes the proxy to use a new beacon. Deprecated: see {_upgradeBeaconToAndCall}.\n *\n * If `data` is nonempty, it\'s used as data in a delegate call to the implementation returned by the beacon.\n *\n * Requirements:\n *\n * - `beacon` must be a contract.\n * - The implementation returned by `beacon` must be a contract.\n */\n function _setBeacon(address beacon, bytes memory data) internal virtual {\n _upgradeBeaconToAndCall(beacon, data, false);\n }\n\n}\n' }, - 'lib/openzeppelin/contracts/proxy/beacon/UpgradeableBeacon.sol': { + 'src/proxies/openzeppelin/TransparentUpgradeableProxy.sol': { content: - '// SPDX-License-Identifier: MIT\r\n// OpenZeppelin Contracts v4.4.1 (proxy/beacon/UpgradeableBeacon.sol)\r\n\r\npragma solidity ^0.8.0;\r\n\r\nimport "./IBeacon.sol";\r\nimport "../../access/Ownable.sol";\r\nimport "../../utils/Address.sol";\r\n\r\n/**\r\n * @dev This contract is used in conjunction with one or more instances of {BeaconProxy} to determine their\r\n * implementation contract, which is where they will delegate all function calls.\r\n *\r\n * An owner is able to change the implementation the beacon points to, thus upgrading the proxies that use this beacon.\r\n */\r\ncontract UpgradeableBeacon is IBeacon, Ownable {\r\n address private _implementation;\r\n\r\n /**\r\n * @dev Emitted when the implementation returned by the beacon is changed.\r\n */\r\n event Upgraded(address indexed implementation);\r\n\r\n /**\r\n * @dev Sets the address of the initial implementation, and the deployer account as the owner who can upgrade the\r\n * beacon.\r\n */\r\n constructor(address implementation_) {\r\n _setImplementation(implementation_);\r\n }\r\n\r\n /**\r\n * @dev Returns the current implementation address.\r\n */\r\n function implementation() public view virtual override returns (address) {\r\n return _implementation;\r\n }\r\n\r\n /**\r\n * @dev Upgrades the beacon to a new implementation.\r\n *\r\n * Emits an {Upgraded} event.\r\n *\r\n * Requirements:\r\n *\r\n * - msg.sender must be the owner of the contract.\r\n * - `newImplementation` must be a contract.\r\n */\r\n function upgradeTo(address newImplementation) public virtual onlyOwner {\r\n _setImplementation(newImplementation);\r\n emit Upgraded(newImplementation);\r\n }\r\n\r\n /**\r\n * @dev Sets the implementation contract address for this beacon\r\n *\r\n * Requirements:\r\n *\r\n * - `newImplementation` must be a contract.\r\n */\r\n function _setImplementation(address newImplementation) private {\r\n require(Address.isContract(newImplementation), "UpgradeableBeacon: implementation is not a contract");\r\n _implementation = newImplementation;\r\n }\r\n}\r\n' + '// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (proxy/transparent/TransparentUpgradeableProxy.sol)\n\n/// @notice This implementation is a copy of OpenZeppelin\'s with the following changes:\n/// - Pragma updated\n/// - Imports updated\n/// - Constructor removed\n/// - Allows admin to call implementation\n\npragma solidity ^0.8.19;\n\nimport "./ERC1967Proxy.sol";\n\n/**\n * @dev Interface for {TransparentUpgradeableProxy}. In order to implement transparency, {TransparentUpgradeableProxy}\n * does not implement this interface directly, and some of its functions are implemented by an internal dispatch\n * mechanism. The compiler is unaware that these functions are implemented by {TransparentUpgradeableProxy} and will not\n * include them in the ABI so this interface must be used to interact with it.\n */\ninterface ITransparentUpgradeableProxy is IERC1967 {\n\n function admin() external view returns (address);\n\n function implementation() external view returns (address);\n\n function changeAdmin(\n address\n ) external;\n\n function upgradeTo(\n address\n ) external;\n\n function upgradeToAndCall(address, bytes memory) external payable;\n\n}\n\n/**\n * @dev This contract implements a proxy that is upgradeable by an admin.\n *\n * Unlike the original OpenZeppelin implementation, this contract does not prevent the admin from calling the implementation.\n * This potentially exposes the admin to a proxy selector attack. See\n * https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector clashing].\n * When using this contract, you must ensure that the implementation function selectors do not clash with the proxy selectors.\n * The proxy selectors are:\n * - 0x3659cfe6: upgradeTo\n * - 0x4f1ef286: upgradeToAndCall\n * - 0x8f283970: changeAdmin\n * - 0xf851a440: admin\n * - 0x5c60da1b: implementation\n *\n * NOTE: The real interface of this proxy is that defined in `ITransparentUpgradeableProxy`. This contract does not\n * inherit from that interface, and instead the admin functions are implicitly implemented using a custom dispatch\n * mechanism in `_fallback`. Consequently, the compiler will not produce an ABI for this contract. This is necessary to\n * fully implement transparency without decoding reverts caused by selector clashes between the proxy and the\n * implementation.\n *\n * WARNING: It is not recommended to extend this contract to add additional external functions. If you do so, the compiler\n * will not check that there are no selector conflicts, due to the note above. A selector clash between any new function\n * and the functions declared in {ITransparentUpgradeableProxy} will be resolved in favor of the new one. This could\n * render the admin operations inaccessible, which could prevent upgradeability. Transparency may also be compromised.\n */\ncontract TransparentUpgradeableProxy is ERC1967Proxy {\n\n /**\n * @dev Modifier used internally that will delegate the call to the implementation unless the sender is the admin.\n *\n * CAUTION: This modifier is deprecated, as it could cause issues if the modified function has arguments, and the\n * implementation provides a function with the same selector.\n */\n modifier ifAdmin() {\n if (msg.sender == _getAdmin()) {\n _;\n } else {\n _fallback();\n }\n }\n\n /**\n * @dev If caller is the admin process the call internally, otherwise transparently fallback to the proxy behavior\n */\n function _fallback() internal virtual override {\n if (msg.sender == _getAdmin()) {\n bytes memory ret;\n bytes4 selector = msg.sig;\n if (selector == ITransparentUpgradeableProxy.upgradeTo.selector) {\n ret = _dispatchUpgradeTo();\n } else if (selector == ITransparentUpgradeableProxy.upgradeToAndCall.selector) {\n ret = _dispatchUpgradeToAndCall();\n } else if (selector == ITransparentUpgradeableProxy.changeAdmin.selector) {\n ret = _dispatchChangeAdmin();\n } else if (selector == ITransparentUpgradeableProxy.admin.selector) {\n ret = _dispatchAdmin();\n } else if (selector == ITransparentUpgradeableProxy.implementation.selector) {\n ret = _dispatchImplementation();\n } else {\n // Call implementation\n return super._fallback();\n }\n assembly {\n return(add(ret, 0x20), mload(ret))\n }\n } else {\n super._fallback();\n }\n }\n\n /**\n * @dev Returns the current admin.\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 _dispatchAdmin() private returns (bytes memory) {\n _requireZeroValue();\n\n address admin = _getAdmin();\n return abi.encode(admin);\n }\n\n /**\n * @dev Returns the current implementation.\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 _dispatchImplementation() private returns (bytes memory) {\n _requireZeroValue();\n\n address implementation = _implementation();\n return abi.encode(implementation);\n }\n\n /**\n * @dev Changes the admin of the proxy.\n *\n * Emits an {AdminChanged} event.\n */\n function _dispatchChangeAdmin() private returns (bytes memory) {\n _requireZeroValue();\n\n address newAdmin = abi.decode(msg.data[4:], (address));\n _changeAdmin(newAdmin);\n\n return "";\n }\n\n /**\n * @dev Upgrade the implementation of the proxy.\n */\n function _dispatchUpgradeTo() private returns (bytes memory) {\n _requireZeroValue();\n\n address newImplementation = abi.decode(msg.data[4:], (address));\n _upgradeToAndCall(newImplementation, bytes(""), false);\n\n return "";\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 function _dispatchUpgradeToAndCall() private returns (bytes memory) {\n (address newImplementation, bytes memory data) = abi.decode(msg.data[4:], (address, bytes));\n _upgradeToAndCall(newImplementation, data, true);\n\n return "";\n }\n\n /**\n * @dev Returns the current admin.\n *\n * CAUTION: This function is deprecated. Use {ERC1967Upgrade-_getAdmin} instead.\n */\n function _admin() internal view virtual returns (address) {\n return _getAdmin();\n }\n\n /**\n * @dev To keep this contract fully transparent, all `ifAdmin` functions must be payable. This helper is here to\n * emulate some proxy functions being non-payable while still allowing value to pass through.\n */\n function _requireZeroValue() internal {\n require(msg.value == 0);\n }\n\n}\n' }, - 'lib/openzeppelin/contracts/token/ERC20/IERC20.sol': { + 'lib/openzeppelin/contracts/utils/Context.sol': { content: - "// SPDX-License-Identifier: MIT\r\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)\r\n\r\npragma solidity ^0.8.0;\r\n\r\n/**\r\n * @dev Interface of the ERC20 standard as defined in the EIP.\r\n */\r\ninterface IERC20 {\r\n /**\r\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\r\n * another (`to`).\r\n *\r\n * Note that `value` may be zero.\r\n */\r\n event Transfer(address indexed from, address indexed to, uint256 value);\r\n\r\n /**\r\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\r\n * a call to {approve}. `value` is the new allowance.\r\n */\r\n event Approval(address indexed owner, address indexed spender, uint256 value);\r\n\r\n /**\r\n * @dev Returns the amount of tokens in existence.\r\n */\r\n function totalSupply() external view returns (uint256);\r\n\r\n /**\r\n * @dev Returns the amount of tokens owned by `account`.\r\n */\r\n function balanceOf(address account) external view returns (uint256);\r\n\r\n /**\r\n * @dev Moves `amount` tokens from the caller's account to `to`.\r\n *\r\n * Returns a boolean value indicating whether the operation succeeded.\r\n *\r\n * Emits a {Transfer} event.\r\n */\r\n function transfer(address to, uint256 amount) external returns (bool);\r\n\r\n /**\r\n * @dev Returns the remaining number of tokens that `spender` will be\r\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\r\n * zero by default.\r\n *\r\n * This value changes when {approve} or {transferFrom} are called.\r\n */\r\n function allowance(address owner, address spender) external view returns (uint256);\r\n\r\n /**\r\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\r\n *\r\n * Returns a boolean value indicating whether the operation succeeded.\r\n *\r\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\r\n * that someone may use both the old and the new allowance by unfortunate\r\n * transaction ordering. One possible solution to mitigate this race\r\n * condition is to first reduce the spender's allowance to 0 and set the\r\n * desired value afterwards:\r\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\r\n *\r\n * Emits an {Approval} event.\r\n */\r\n function approve(address spender, uint256 amount) external returns (bool);\r\n\r\n /**\r\n * @dev Moves `amount` tokens from `from` to `to` using the\r\n * allowance mechanism. `amount` is then deducted from the caller's\r\n * allowance.\r\n *\r\n * Returns a boolean value indicating whether the operation succeeded.\r\n *\r\n * Emits a {Transfer} event.\r\n */\r\n function transferFrom(address from, address to, uint256 amount) external returns (bool);\r\n}\r\n" + '// 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' }, - 'lib/openzeppelin/contracts/token/ERC20/extensions/IERC20Permit.sol': { + 'lib/openzeppelin/contracts/proxy/beacon/IBeacon.sol': { content: - "// SPDX-License-Identifier: MIT\r\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/extensions/IERC20Permit.sol)\r\n\r\npragma solidity ^0.8.0;\r\n\r\n/**\r\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\r\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\r\n *\r\n * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by\r\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\r\n * need to send a transaction, and thus is not required to hold Ether at all.\r\n */\r\ninterface IERC20Permit {\r\n /**\r\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\r\n * given ``owner``'s signed approval.\r\n *\r\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\r\n * ordering also apply here.\r\n *\r\n * Emits an {Approval} event.\r\n *\r\n * Requirements:\r\n *\r\n * - `spender` cannot be the zero address.\r\n * - `deadline` must be a timestamp in the future.\r\n * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`\r\n * over the EIP712-formatted function arguments.\r\n * - the signature must use ``owner``'s current nonce (see {nonces}).\r\n *\r\n * For more information on the signature format, see the\r\n * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP\r\n * section].\r\n */\r\n function permit(\r\n address owner,\r\n address spender,\r\n uint256 value,\r\n uint256 deadline,\r\n uint8 v,\r\n bytes32 r,\r\n bytes32 s\r\n ) external;\r\n\r\n /**\r\n * @dev Returns the current nonce for `owner`. This value must be\r\n * included whenever a signature is generated for {permit}.\r\n *\r\n * Every successful call to {permit} increases ``owner``'s nonce by one. This\r\n * prevents a signature from being used multiple times.\r\n */\r\n function nonces(address owner) external view returns (uint256);\r\n\r\n /**\r\n * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.\r\n */\r\n // solhint-disable-next-line func-name-mixedcase\r\n function DOMAIN_SEPARATOR() external view returns (bytes32);\r\n}\r\n" + '// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (proxy/beacon/IBeacon.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev This is the interface that {BeaconProxy} expects of its beacon.\n */\ninterface IBeacon {\n /**\n * @dev Must return an address that can be used as a delegate call target.\n *\n * {BeaconProxy} will check that this address is a contract.\n */\n function implementation() external view returns (address);\n}\n' }, - 'lib/openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol': { + 'lib/openzeppelin/contracts/utils/Address.sol': { content: - '// SPDX-License-Identifier: MIT\r\n// OpenZeppelin Contracts (last updated v4.9.3) (token/ERC20/utils/SafeERC20.sol)\r\n\r\npragma solidity ^0.8.0;\r\n\r\nimport "../IERC20.sol";\r\nimport "../extensions/IERC20Permit.sol";\r\nimport "../../../utils/Address.sol";\r\n\r\n/**\r\n * @title SafeERC20\r\n * @dev Wrappers around ERC20 operations that throw on failure (when the token\r\n * contract returns false). Tokens that return no value (and instead revert or\r\n * throw on failure) are also supported, non-reverting calls are assumed to be\r\n * successful.\r\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\r\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\r\n */\r\nlibrary SafeERC20 {\r\n using Address for address;\r\n\r\n /**\r\n * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,\r\n * non-reverting calls are assumed to be successful.\r\n */\r\n function safeTransfer(IERC20 token, address to, uint256 value) internal {\r\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\r\n }\r\n\r\n /**\r\n * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the\r\n * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.\r\n */\r\n function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {\r\n _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));\r\n }\r\n\r\n /**\r\n * @dev Deprecated. This function has issues similar to the ones found in\r\n * {IERC20-approve}, and its usage is discouraged.\r\n *\r\n * Whenever possible, use {safeIncreaseAllowance} and\r\n * {safeDecreaseAllowance} instead.\r\n */\r\n function safeApprove(IERC20 token, address spender, uint256 value) internal {\r\n // safeApprove should only be called when setting an initial allowance,\r\n // or when resetting it to zero. To increase and decrease it, use\r\n // \'safeIncreaseAllowance\' and \'safeDecreaseAllowance\'\r\n require(\r\n (value == 0) || (token.allowance(address(this), spender) == 0),\r\n "SafeERC20: approve from non-zero to non-zero allowance"\r\n );\r\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));\r\n }\r\n\r\n /**\r\n * @dev Increase the calling contract\'s allowance toward `spender` by `value`. If `token` returns no value,\r\n * non-reverting calls are assumed to be successful.\r\n */\r\n function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {\r\n uint256 oldAllowance = token.allowance(address(this), spender);\r\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance + value));\r\n }\r\n\r\n /**\r\n * @dev Decrease the calling contract\'s allowance toward `spender` by `value`. If `token` returns no value,\r\n * non-reverting calls are assumed to be successful.\r\n */\r\n function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal {\r\n unchecked {\r\n uint256 oldAllowance = token.allowance(address(this), spender);\r\n require(oldAllowance >= value, "SafeERC20: decreased allowance below zero");\r\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance - value));\r\n }\r\n }\r\n\r\n /**\r\n * @dev Set the calling contract\'s allowance toward `spender` to `value`. If `token` returns no value,\r\n * non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval\r\n * to be set to zero before setting it to a non-zero value, such as USDT.\r\n */\r\n function forceApprove(IERC20 token, address spender, uint256 value) internal {\r\n bytes memory approvalCall = abi.encodeWithSelector(token.approve.selector, spender, value);\r\n\r\n if (!_callOptionalReturnBool(token, approvalCall)) {\r\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, 0));\r\n _callOptionalReturn(token, approvalCall);\r\n }\r\n }\r\n\r\n /**\r\n * @dev Use a ERC-2612 signature to set the `owner` approval toward `spender` on `token`.\r\n * Revert on invalid signature.\r\n */\r\n function safePermit(\r\n IERC20Permit token,\r\n address owner,\r\n address spender,\r\n uint256 value,\r\n uint256 deadline,\r\n uint8 v,\r\n bytes32 r,\r\n bytes32 s\r\n ) internal {\r\n uint256 nonceBefore = token.nonces(owner);\r\n token.permit(owner, spender, value, deadline, v, r, s);\r\n uint256 nonceAfter = token.nonces(owner);\r\n require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed");\r\n }\r\n\r\n /**\r\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\r\n * on the return value: the return value is optional (but if data is returned, it must not be false).\r\n * @param token The token targeted by the call.\r\n * @param data The call data (encoded using abi.encode or one of its variants).\r\n */\r\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\r\n // We need to perform a low level call here, to bypass Solidity\'s return data size checking mechanism, since\r\n // we\'re implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that\r\n // the target address contains contract code and also asserts for success in the low-level call.\r\n\r\n bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed");\r\n require(returndata.length == 0 || abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");\r\n }\r\n\r\n /**\r\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\r\n * on the return value: the return value is optional (but if data is returned, it must not be false).\r\n * @param token The token targeted by the call.\r\n * @param data The call data (encoded using abi.encode or one of its variants).\r\n *\r\n * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.\r\n */\r\n function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {\r\n // We need to perform a low level call here, to bypass Solidity\'s return data size checking mechanism, since\r\n // we\'re implementing it ourselves. We cannot use {Address-functionCall} here since this should return false\r\n // and not revert is the subcall reverts.\r\n\r\n (bool success, bytes memory returndata) = address(token).call(data);\r\n return\r\n success && (returndata.length == 0 || abi.decode(returndata, (bool))) && Address.isContract(address(token));\r\n }\r\n}\r\n' + '// 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 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 * 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' }, - 'lib/openzeppelin/contracts/utils/Address.sol': { + 'lib/0xsequence/erc-1155/src/contracts/tokens/ERC1155/ERC1155.sol': { content: - '// SPDX-License-Identifier: MIT\r\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)\r\n\r\npragma solidity ^0.8.1;\r\n\r\n/**\r\n * @dev Collection of functions related to the address type\r\n */\r\nlibrary Address {\r\n /**\r\n * @dev Returns true if `account` is a contract.\r\n *\r\n * [IMPORTANT]\r\n * ====\r\n * It is unsafe to assume that an address for which this function returns\r\n * false is an externally-owned account (EOA) and not a contract.\r\n *\r\n * Among others, `isContract` will return false for the following\r\n * types of addresses:\r\n *\r\n * - an externally-owned account\r\n * - a contract in construction\r\n * - an address where a contract will be created\r\n * - an address where a contract lived, but was destroyed\r\n *\r\n * Furthermore, `isContract` will also return true if the target contract within\r\n * the same transaction is already scheduled for destruction by `SELFDESTRUCT`,\r\n * which only has an effect at the end of a transaction.\r\n * ====\r\n *\r\n * [IMPORTANT]\r\n * ====\r\n * You shouldn\'t rely on `isContract` to protect against flash loan attacks!\r\n *\r\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\r\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\r\n * constructor.\r\n * ====\r\n */\r\n function isContract(address account) internal view returns (bool) {\r\n // This method relies on extcodesize/address.code.length, which returns 0\r\n // for contracts in construction, since the code is only stored at the end\r\n // of the constructor execution.\r\n\r\n return account.code.length > 0;\r\n }\r\n\r\n /**\r\n * @dev Replacement for Solidity\'s `transfer`: sends `amount` wei to\r\n * `recipient`, forwarding all available gas and reverting on errors.\r\n *\r\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\r\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\r\n * imposed by `transfer`, making them unable to receive funds via\r\n * `transfer`. {sendValue} removes this limitation.\r\n *\r\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\r\n *\r\n * IMPORTANT: because control is transferred to `recipient`, care must be\r\n * taken to not create reentrancy vulnerabilities. Consider using\r\n * {ReentrancyGuard} or the\r\n * https://solidity.readthedocs.io/en/v0.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\r\n */\r\n function sendValue(address payable recipient, uint256 amount) internal {\r\n require(address(this).balance >= amount, "Address: insufficient balance");\r\n\r\n (bool success, ) = recipient.call{value: amount}("");\r\n require(success, "Address: unable to send value, recipient may have reverted");\r\n }\r\n\r\n /**\r\n * @dev Performs a Solidity function call using a low level `call`. A\r\n * plain `call` is an unsafe replacement for a function call: use this\r\n * function instead.\r\n *\r\n * If `target` reverts with a revert reason, it is bubbled up by this\r\n * function (like regular Solidity function calls).\r\n *\r\n * Returns the raw returned data. To convert to the expected return value,\r\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\r\n *\r\n * Requirements:\r\n *\r\n * - `target` must be a contract.\r\n * - calling `target` with `data` must not revert.\r\n *\r\n * _Available since v3.1._\r\n */\r\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\r\n return functionCallWithValue(target, data, 0, "Address: low-level call failed");\r\n }\r\n\r\n /**\r\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\r\n * `errorMessage` as a fallback revert reason when `target` reverts.\r\n *\r\n * _Available since v3.1._\r\n */\r\n function functionCall(\r\n address target,\r\n bytes memory data,\r\n string memory errorMessage\r\n ) internal returns (bytes memory) {\r\n return functionCallWithValue(target, data, 0, errorMessage);\r\n }\r\n\r\n /**\r\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\r\n * but also transferring `value` wei to `target`.\r\n *\r\n * Requirements:\r\n *\r\n * - the calling contract must have an ETH balance of at least `value`.\r\n * - the called Solidity function must be `payable`.\r\n *\r\n * _Available since v3.1._\r\n */\r\n function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\r\n return functionCallWithValue(target, data, value, "Address: low-level call with value failed");\r\n }\r\n\r\n /**\r\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\r\n * with `errorMessage` as a fallback revert reason when `target` reverts.\r\n *\r\n * _Available since v3.1._\r\n */\r\n function functionCallWithValue(\r\n address target,\r\n bytes memory data,\r\n uint256 value,\r\n string memory errorMessage\r\n ) internal returns (bytes memory) {\r\n require(address(this).balance >= value, "Address: insufficient balance for call");\r\n (bool success, bytes memory returndata) = target.call{value: value}(data);\r\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\r\n }\r\n\r\n /**\r\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\r\n * but performing a static call.\r\n *\r\n * _Available since v3.3._\r\n */\r\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\r\n return functionStaticCall(target, data, "Address: low-level static call failed");\r\n }\r\n\r\n /**\r\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\r\n * but performing a static call.\r\n *\r\n * _Available since v3.3._\r\n */\r\n function functionStaticCall(\r\n address target,\r\n bytes memory data,\r\n string memory errorMessage\r\n ) internal view returns (bytes memory) {\r\n (bool success, bytes memory returndata) = target.staticcall(data);\r\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\r\n }\r\n\r\n /**\r\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\r\n * but performing a delegate call.\r\n *\r\n * _Available since v3.4._\r\n */\r\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\r\n return functionDelegateCall(target, data, "Address: low-level delegate call failed");\r\n }\r\n\r\n /**\r\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\r\n * but performing a delegate call.\r\n *\r\n * _Available since v3.4._\r\n */\r\n function functionDelegateCall(\r\n address target,\r\n bytes memory data,\r\n string memory errorMessage\r\n ) internal returns (bytes memory) {\r\n (bool success, bytes memory returndata) = target.delegatecall(data);\r\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\r\n }\r\n\r\n /**\r\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\r\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\r\n *\r\n * _Available since v4.8._\r\n */\r\n function verifyCallResultFromTarget(\r\n address target,\r\n bool success,\r\n bytes memory returndata,\r\n string memory errorMessage\r\n ) internal view returns (bytes memory) {\r\n if (success) {\r\n if (returndata.length == 0) {\r\n // only check isContract if the call was successful and the return data is empty\r\n // otherwise we already know that it was a contract\r\n require(isContract(target), "Address: call to non-contract");\r\n }\r\n return returndata;\r\n } else {\r\n _revert(returndata, errorMessage);\r\n }\r\n }\r\n\r\n /**\r\n * @dev Tool to verify that a low level call was successful, and revert if it wasn\'t, either by bubbling the\r\n * revert reason or using the provided one.\r\n *\r\n * _Available since v4.3._\r\n */\r\n function verifyCallResult(\r\n bool success,\r\n bytes memory returndata,\r\n string memory errorMessage\r\n ) internal pure returns (bytes memory) {\r\n if (success) {\r\n return returndata;\r\n } else {\r\n _revert(returndata, errorMessage);\r\n }\r\n }\r\n\r\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\r\n // Look for revert reason and bubble it up if present\r\n if (returndata.length > 0) {\r\n // The easiest way to bubble the revert reason is using memory via assembly\r\n /// @solidity memory-safe-assembly\r\n assembly {\r\n let returndata_size := mload(returndata)\r\n revert(add(32, returndata), returndata_size)\r\n }\r\n } else {\r\n revert(errorMessage);\r\n }\r\n }\r\n}\r\n' + '// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8.0;\n\nimport "../../interfaces/IERC1155TokenReceiver.sol";\nimport "../../interfaces/IERC1155.sol";\nimport "../../utils/Address.sol";\nimport "../../utils/ERC165.sol";\n\n/**\n * @dev Implementation of Multi-Token Standard contract\n */\ncontract ERC1155 is IERC1155, ERC165 {\n using Address for address;\n\n /***********************************|\n | Variables and Events |\n |__________________________________*/\n\n // onReceive function signatures\n bytes4 constant internal ERC1155_RECEIVED_VALUE = 0xf23a6e61;\n bytes4 constant internal ERC1155_BATCH_RECEIVED_VALUE = 0xbc197c81;\n\n // Objects balances\n mapping (address => mapping(uint256 => uint256)) internal balances;\n\n // Operator Functions\n mapping (address => mapping(address => bool)) internal operators;\n\n\n /***********************************|\n | Public Transfer Functions |\n |__________________________________*/\n\n /**\n * @notice Transfers amount amount of an _id from the _from address to the _to address specified\n * @param _from Source address\n * @param _to Target address\n * @param _id ID of the token type\n * @param _amount Transfered amount\n * @param _data Additional data with no specified format, sent in call to `_to`\n */\n function safeTransferFrom(address _from, address _to, uint256 _id, uint256 _amount, bytes memory _data)\n public virtual override\n {\n require((msg.sender == _from) || isApprovedForAll(_from, msg.sender), "ERC1155#safeTransferFrom: INVALID_OPERATOR");\n require(_to != address(0),"ERC1155#safeTransferFrom: INVALID_RECIPIENT");\n\n _safeTransferFrom(_from, _to, _id, _amount);\n _callonERC1155Received(_from, _to, _id, _amount, gasleft(), _data);\n }\n\n /**\n * @notice Send multiple types of Tokens from the _from address to the _to address (with safety call)\n * @param _from Source addresses\n * @param _to Target addresses\n * @param _ids IDs of each token type\n * @param _amounts Transfer amounts per token type\n * @param _data Additional data with no specified format, sent in call to `_to`\n */\n function safeBatchTransferFrom(address _from, address _to, uint256[] memory _ids, uint256[] memory _amounts, bytes memory _data)\n public virtual override\n {\n // Requirements\n require((msg.sender == _from) || isApprovedForAll(_from, msg.sender), "ERC1155#safeBatchTransferFrom: INVALID_OPERATOR");\n require(_to != address(0), "ERC1155#safeBatchTransferFrom: INVALID_RECIPIENT");\n\n _safeBatchTransferFrom(_from, _to, _ids, _amounts);\n _callonERC1155BatchReceived(_from, _to, _ids, _amounts, gasleft(), _data);\n }\n\n\n /***********************************|\n | Internal Transfer Functions |\n |__________________________________*/\n\n /**\n * @notice Transfers amount amount of an _id from the _from address to the _to address specified\n * @param _from Source address\n * @param _to Target address\n * @param _id ID of the token type\n * @param _amount Transfered amount\n */\n function _safeTransferFrom(address _from, address _to, uint256 _id, uint256 _amount)\n internal virtual\n {\n // Update balances\n balances[_from][_id] -= _amount;\n balances[_to][_id] += _amount;\n\n // Emit event\n emit TransferSingle(msg.sender, _from, _to, _id, _amount);\n }\n\n /**\n * @notice Verifies if receiver is contract and if so, calls (_to).onERC1155Received(...)\n */\n function _callonERC1155Received(address _from, address _to, uint256 _id, uint256 _amount, uint256 _gasLimit, bytes memory _data)\n internal virtual\n {\n // Check if recipient is contract\n if (_to.isContract()) {\n bytes4 retval = IERC1155TokenReceiver(_to).onERC1155Received{gas: _gasLimit}(msg.sender, _from, _id, _amount, _data);\n require(retval == ERC1155_RECEIVED_VALUE, "ERC1155#_callonERC1155Received: INVALID_ON_RECEIVE_MESSAGE");\n }\n }\n\n /**\n * @notice Send multiple types of Tokens from the _from address to the _to address (with safety call)\n * @param _from Source addresses\n * @param _to Target addresses\n * @param _ids IDs of each token type\n * @param _amounts Transfer amounts per token type\n */\n function _safeBatchTransferFrom(address _from, address _to, uint256[] memory _ids, uint256[] memory _amounts)\n internal virtual\n {\n require(_ids.length == _amounts.length, "ERC1155#_safeBatchTransferFrom: INVALID_ARRAYS_LENGTH");\n\n // Number of transfer to execute\n uint256 nTransfer = _ids.length;\n\n // Executing all transfers\n for (uint256 i = 0; i < nTransfer; i++) {\n // Update storage balance of previous bin\n balances[_from][_ids[i]] -= _amounts[i];\n balances[_to][_ids[i]] += _amounts[i];\n }\n\n // Emit event\n emit TransferBatch(msg.sender, _from, _to, _ids, _amounts);\n }\n\n /**\n * @notice Verifies if receiver is contract and if so, calls (_to).onERC1155BatchReceived(...)\n */\n function _callonERC1155BatchReceived(address _from, address _to, uint256[] memory _ids, uint256[] memory _amounts, uint256 _gasLimit, bytes memory _data)\n internal virtual\n {\n // Pass data if recipient is contract\n if (_to.isContract()) {\n bytes4 retval = IERC1155TokenReceiver(_to).onERC1155BatchReceived{gas: _gasLimit}(msg.sender, _from, _ids, _amounts, _data);\n require(retval == ERC1155_BATCH_RECEIVED_VALUE, "ERC1155#_callonERC1155BatchReceived: INVALID_ON_RECEIVE_MESSAGE");\n }\n }\n\n\n /***********************************|\n | Operator Functions |\n |__________________________________*/\n\n /**\n * @notice Enable or disable approval for a third party ("operator") to manage all of caller\'s tokens\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)\n external virtual override\n {\n // Update operator status\n operators[msg.sender][_operator] = _approved;\n emit ApprovalForAll(msg.sender, _operator, _approved);\n }\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 isOperator True if the operator is approved, false if not\n */\n function isApprovedForAll(address _owner, address _operator)\n public view virtual override returns (bool isOperator)\n {\n return operators[_owner][_operator];\n }\n\n\n /***********************************|\n | Balance Functions |\n |__________________________________*/\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 public view virtual override returns (uint256)\n {\n return balances[_owner][_id];\n }\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[] memory _owners, uint256[] memory _ids)\n public view virtual override returns (uint256[] memory)\n {\n require(_owners.length == _ids.length, "ERC1155#balanceOfBatch: INVALID_ARRAY_LENGTH");\n\n // Variables\n uint256[] memory batchBalances = new uint256[](_owners.length);\n\n // Iterate over each owner and token ID\n for (uint256 i = 0; i < _owners.length; i++) {\n batchBalances[i] = balances[_owners[i]][_ids[i]];\n }\n\n return batchBalances;\n }\n\n\n /***********************************|\n | ERC165 Functions |\n |__________________________________*/\n\n /**\n * @notice Query if a contract implements an interface\n * @param _interfaceID The interface identifier, as specified in ERC-165\n * @return `true` if the contract implements `_interfaceID` and\n */\n function supportsInterface(bytes4 _interfaceID) public view virtual override(ERC165, IERC165) returns (bool) {\n if (_interfaceID == type(IERC1155).interfaceId) {\n return true;\n }\n return super.supportsInterface(_interfaceID);\n }\n}\n' }, - 'lib/openzeppelin/contracts/utils/Context.sol': { + 'src/tokens/common/IMerkleProofSingleUse.sol': { content: - '// SPDX-License-Identifier: MIT\r\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\r\n\r\npragma solidity ^0.8.0;\r\n\r\n/**\r\n * @dev Provides information about the current execution context, including the\r\n * sender of the transaction and its data. While these are generally available\r\n * via msg.sender and msg.data, they should not be accessed in such a direct\r\n * manner, since when dealing with meta-transactions the account sending and\r\n * paying for execution may not be the actual sender (as far as an application\r\n * is concerned).\r\n *\r\n * This contract is only required for intermediate, library-like contracts.\r\n */\r\nabstract contract Context {\r\n function _msgSender() internal view virtual returns (address) {\r\n return msg.sender;\r\n }\r\n\r\n function _msgData() internal view virtual returns (bytes calldata) {\r\n return msg.data;\r\n }\r\n}\r\n' + '// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8.19;\n\ninterface IMerkleProofSingleUseFunctions {\n\n /**\n * Checks if the given merkle proof is valid.\n * @param root Merkle root.\n * @param proof Merkle proof.\n * @param addr Address to check.\n * @param salt Salt used to generate the merkle leaf.\n * @return True if the proof is valid and has not yet been used by {addr}.\n */\n function checkMerkleProof(\n bytes32 root,\n bytes32[] calldata proof,\n address addr,\n bytes32 salt\n ) external view returns (bool);\n\n}\n\ninterface IMerkleProofSingleUseSignals {\n\n /**\n * Thrown when the merkle proof is invalid or has already been used.\n * @param root Merkle root.\n * @param proof Merkle proof.\n * @param addr Address to check.\n * @param salt Salt used to generate the merkle leaf.\n */\n error MerkleProofInvalid(bytes32 root, bytes32[] proof, address addr, bytes32 salt);\n\n}\n\ninterface IMerkleProofSingleUse is IMerkleProofSingleUseFunctions, IMerkleProofSingleUseSignals { }\n' }, - 'lib/openzeppelin/contracts/utils/Create2.sol': { + 'lib/openzeppelin/contracts/utils/cryptography/MerkleProof.sol': { content: - '// SPDX-License-Identifier: MIT\r\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Create2.sol)\r\n\r\npragma solidity ^0.8.0;\r\n\r\n/**\r\n * @dev Helper to make usage of the `CREATE2` EVM opcode easier and safer.\r\n * `CREATE2` can be used to compute in advance the address where a smart\r\n * contract will be deployed, which allows for interesting new mechanisms known\r\n * as \'counterfactual interactions\'.\r\n *\r\n * See the https://eips.ethereum.org/EIPS/eip-1014#motivation[EIP] for more\r\n * information.\r\n */\r\nlibrary Create2 {\r\n /**\r\n * @dev Deploys a contract using `CREATE2`. The address where the contract\r\n * will be deployed can be known in advance via {computeAddress}.\r\n *\r\n * The bytecode for a contract can be obtained from Solidity with\r\n * `type(contractName).creationCode`.\r\n *\r\n * Requirements:\r\n *\r\n * - `bytecode` must not be empty.\r\n * - `salt` must have not been used for `bytecode` already.\r\n * - the factory must have a balance of at least `amount`.\r\n * - if `amount` is non-zero, `bytecode` must have a `payable` constructor.\r\n */\r\n function deploy(uint256 amount, bytes32 salt, bytes memory bytecode) internal returns (address addr) {\r\n require(address(this).balance >= amount, "Create2: insufficient balance");\r\n require(bytecode.length != 0, "Create2: bytecode length is zero");\r\n /// @solidity memory-safe-assembly\r\n assembly {\r\n addr := create2(amount, add(bytecode, 0x20), mload(bytecode), salt)\r\n }\r\n require(addr != address(0), "Create2: Failed on deploy");\r\n }\r\n\r\n /**\r\n * @dev Returns the address where a contract will be stored if deployed via {deploy}. Any change in the\r\n * `bytecodeHash` or `salt` will result in a new destination address.\r\n */\r\n function computeAddress(bytes32 salt, bytes32 bytecodeHash) internal view returns (address) {\r\n return computeAddress(salt, bytecodeHash, address(this));\r\n }\r\n\r\n /**\r\n * @dev Returns the address where a contract will be stored if deployed via {deploy} from a contract located at\r\n * `deployer`. If `deployer` is this contract\'s address, returns the same value as {computeAddress}.\r\n */\r\n function computeAddress(bytes32 salt, bytes32 bytecodeHash, address deployer) internal pure returns (address addr) {\r\n /// @solidity memory-safe-assembly\r\n assembly {\r\n let ptr := mload(0x40) // Get free memory pointer\r\n\r\n // | | ↓ ptr ... ↓ ptr + 0x0B (start) ... ↓ ptr + 0x20 ... ↓ ptr + 0x40 ... |\r\n // |-------------------|---------------------------------------------------------------------------|\r\n // | bytecodeHash | CCCCCCCCCCCCC...CC |\r\n // | salt | BBBBBBBBBBBBB...BB |\r\n // | deployer | 000000...0000AAAAAAAAAAAAAAAAAAA...AA |\r\n // | 0xFF | FF |\r\n // |-------------------|---------------------------------------------------------------------------|\r\n // | memory | 000000...00FFAAAAAAAAAAAAAAAAAAA...AABBBBBBBBBBBBB...BBCCCCCCCCCCCCC...CC |\r\n // | keccak(start, 85) | ↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑ |\r\n\r\n mstore(add(ptr, 0x40), bytecodeHash)\r\n mstore(add(ptr, 0x20), salt)\r\n mstore(ptr, deployer) // Right-aligned with 12 preceding garbage bytes\r\n let start := add(ptr, 0x0b) // The hashed data starts at the final garbage byte which we will set to 0xff\r\n mstore8(start, 0xff)\r\n addr := keccak256(start, 85)\r\n }\r\n }\r\n}\r\n' + '// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.2) (utils/cryptography/MerkleProof.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev These functions deal with verification of Merkle Tree proofs.\n *\n * The tree and the proofs can be generated using our\n * https://github.com/OpenZeppelin/merkle-tree[JavaScript library].\n * You will find a quickstart guide in the readme.\n *\n * WARNING: You should avoid using leaf values that are 64 bytes long prior to\n * hashing, or use a hash function other than keccak256 for hashing leaves.\n * This is because the concatenation of a sorted pair of internal nodes in\n * the merkle tree could be reinterpreted as a leaf value.\n * OpenZeppelin\'s JavaScript library generates merkle trees that are safe\n * against this attack out of the box.\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(bytes32[] memory proof, bytes32 root, bytes32 leaf) internal pure returns (bool) {\n return processProof(proof, leaf) == root;\n }\n\n /**\n * @dev Calldata version of {verify}\n *\n * _Available since v4.7._\n */\n function verifyCalldata(bytes32[] calldata proof, bytes32 root, bytes32 leaf) internal pure returns (bool) {\n return processProofCalldata(proof, leaf) == root;\n }\n\n /**\n * @dev Returns the rebuilt hash obtained by traversing a Merkle 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 computedHash = _hashPair(computedHash, proof[i]);\n }\n return computedHash;\n }\n\n /**\n * @dev Calldata version of {processProof}\n *\n * _Available since v4.7._\n */\n function processProofCalldata(bytes32[] calldata proof, bytes32 leaf) internal pure returns (bytes32) {\n bytes32 computedHash = leaf;\n for (uint256 i = 0; i < proof.length; i++) {\n computedHash = _hashPair(computedHash, proof[i]);\n }\n return computedHash;\n }\n\n /**\n * @dev Returns true if the `leaves` can be simultaneously proven to be a part of a merkle tree defined by\n * `root`, according to `proof` and `proofFlags` as described in {processMultiProof}.\n *\n * CAUTION: Not all merkle trees admit multiproofs. See {processMultiProof} for details.\n *\n * _Available since v4.7._\n */\n function multiProofVerify(\n bytes32[] memory proof,\n bool[] memory proofFlags,\n bytes32 root,\n bytes32[] memory leaves\n ) internal pure returns (bool) {\n return processMultiProof(proof, proofFlags, leaves) == root;\n }\n\n /**\n * @dev Calldata version of {multiProofVerify}\n *\n * CAUTION: Not all merkle trees admit multiproofs. See {processMultiProof} for details.\n *\n * _Available since v4.7._\n */\n function multiProofVerifyCalldata(\n bytes32[] calldata proof,\n bool[] calldata proofFlags,\n bytes32 root,\n bytes32[] memory leaves\n ) internal pure returns (bool) {\n return processMultiProofCalldata(proof, proofFlags, leaves) == root;\n }\n\n /**\n * @dev Returns the root of a tree reconstructed from `leaves` and sibling nodes in `proof`. The reconstruction\n * proceeds by incrementally reconstructing all inner nodes by combining a leaf/inner node with either another\n * leaf/inner node or a proof sibling node, depending on whether each `proofFlags` item is true or false\n * respectively.\n *\n * CAUTION: Not all merkle trees admit multiproofs. To use multiproofs, it is sufficient to ensure that: 1) the tree\n * is complete (but not necessarily perfect), 2) the leaves to be proven are in the opposite order they are in the\n * tree (i.e., as seen from right to left starting at the deepest layer and continuing at the next layer).\n *\n * _Available since v4.7._\n */\n function processMultiProof(\n bytes32[] memory proof,\n bool[] memory proofFlags,\n bytes32[] memory leaves\n ) internal pure returns (bytes32 merkleRoot) {\n // This function rebuilds the root hash by traversing the tree up from the leaves. The root is rebuilt by\n // consuming and producing values on a queue. The queue starts with the `leaves` array, then goes onto the\n // `hashes` array. At the end of the process, the last hash in the `hashes` array should contain the root of\n // the merkle tree.\n uint256 leavesLen = leaves.length;\n uint256 proofLen = proof.length;\n uint256 totalHashes = proofFlags.length;\n\n // Check proof validity.\n require(leavesLen + proofLen - 1 == totalHashes, "MerkleProof: invalid multiproof");\n\n // The xxxPos values are "pointers" to the next value to consume in each array. All accesses are done using\n // `xxx[xxxPos++]`, which return the current value and increment the pointer, thus mimicking a queue\'s "pop".\n bytes32[] memory hashes = new bytes32[](totalHashes);\n uint256 leafPos = 0;\n uint256 hashPos = 0;\n uint256 proofPos = 0;\n // At each step, we compute the next hash using two values:\n // - a value from the "main queue". If not all leaves have been consumed, we get the next leaf, otherwise we\n // get the next hash.\n // - depending on the flag, either another value from the "main queue" (merging branches) or an element from the\n // `proof` array.\n for (uint256 i = 0; i < totalHashes; i++) {\n bytes32 a = leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++];\n bytes32 b = proofFlags[i]\n ? (leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++])\n : proof[proofPos++];\n hashes[i] = _hashPair(a, b);\n }\n\n if (totalHashes > 0) {\n require(proofPos == proofLen, "MerkleProof: invalid multiproof");\n unchecked {\n return hashes[totalHashes - 1];\n }\n } else if (leavesLen > 0) {\n return leaves[0];\n } else {\n return proof[0];\n }\n }\n\n /**\n * @dev Calldata version of {processMultiProof}.\n *\n * CAUTION: Not all merkle trees admit multiproofs. See {processMultiProof} for details.\n *\n * _Available since v4.7._\n */\n function processMultiProofCalldata(\n bytes32[] calldata proof,\n bool[] calldata proofFlags,\n bytes32[] memory leaves\n ) internal pure returns (bytes32 merkleRoot) {\n // This function rebuilds the root hash by traversing the tree up from the leaves. The root is rebuilt by\n // consuming and producing values on a queue. The queue starts with the `leaves` array, then goes onto the\n // `hashes` array. At the end of the process, the last hash in the `hashes` array should contain the root of\n // the merkle tree.\n uint256 leavesLen = leaves.length;\n uint256 proofLen = proof.length;\n uint256 totalHashes = proofFlags.length;\n\n // Check proof validity.\n require(leavesLen + proofLen - 1 == totalHashes, "MerkleProof: invalid multiproof");\n\n // The xxxPos values are "pointers" to the next value to consume in each array. All accesses are done using\n // `xxx[xxxPos++]`, which return the current value and increment the pointer, thus mimicking a queue\'s "pop".\n bytes32[] memory hashes = new bytes32[](totalHashes);\n uint256 leafPos = 0;\n uint256 hashPos = 0;\n uint256 proofPos = 0;\n // At each step, we compute the next hash using two values:\n // - a value from the "main queue". If not all leaves have been consumed, we get the next leaf, otherwise we\n // get the next hash.\n // - depending on the flag, either another value from the "main queue" (merging branches) or an element from the\n // `proof` array.\n for (uint256 i = 0; i < totalHashes; i++) {\n bytes32 a = leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++];\n bytes32 b = proofFlags[i]\n ? (leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++])\n : proof[proofPos++];\n hashes[i] = _hashPair(a, b);\n }\n\n if (totalHashes > 0) {\n require(proofPos == proofLen, "MerkleProof: invalid multiproof");\n unchecked {\n return hashes[totalHashes - 1];\n }\n } else if (leavesLen > 0) {\n return leaves[0];\n } else {\n return proof[0];\n }\n }\n\n function _hashPair(bytes32 a, bytes32 b) private pure returns (bytes32) {\n return a < b ? _efficientHash(a, b) : _efficientHash(b, a);\n }\n\n function _efficientHash(bytes32 a, bytes32 b) private pure returns (bytes32 value) {\n /// @solidity memory-safe-assembly\n assembly {\n mstore(0x00, a)\n mstore(0x20, b)\n value := keccak256(0x00, 0x40)\n }\n }\n}\n' }, - 'lib/openzeppelin/contracts/utils/StorageSlot.sol': { + 'src/tokens/common/IWithdrawControlled.sol': { content: - '// SPDX-License-Identifier: MIT\r\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/StorageSlot.sol)\r\n// This file was procedurally generated from scripts/generate/templates/StorageSlot.js.\r\n\r\npragma solidity ^0.8.0;\r\n\r\n/**\r\n * @dev Library for reading and writing primitive types to specific storage slots.\r\n *\r\n * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.\r\n * This library helps with reading and writing to such slots without the need for inline assembly.\r\n *\r\n * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.\r\n *\r\n * Example usage to set ERC1967 implementation slot:\r\n * ```solidity\r\n * contract ERC1967 {\r\n * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\r\n *\r\n * function _getImplementation() internal view returns (address) {\r\n * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\r\n * }\r\n *\r\n * function _setImplementation(address newImplementation) internal {\r\n * require(Address.isContract(newImplementation), "ERC1967: new implementation is not a contract");\r\n * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\r\n * }\r\n * }\r\n * ```\r\n *\r\n * _Available since v4.1 for `address`, `bool`, `bytes32`, `uint256`._\r\n * _Available since v4.9 for `string`, `bytes`._\r\n */\r\nlibrary StorageSlot {\r\n struct AddressSlot {\r\n address value;\r\n }\r\n\r\n struct BooleanSlot {\r\n bool value;\r\n }\r\n\r\n struct Bytes32Slot {\r\n bytes32 value;\r\n }\r\n\r\n struct Uint256Slot {\r\n uint256 value;\r\n }\r\n\r\n struct StringSlot {\r\n string value;\r\n }\r\n\r\n struct BytesSlot {\r\n bytes value;\r\n }\r\n\r\n /**\r\n * @dev Returns an `AddressSlot` with member `value` located at `slot`.\r\n */\r\n function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\r\n /// @solidity memory-safe-assembly\r\n assembly {\r\n r.slot := slot\r\n }\r\n }\r\n\r\n /**\r\n * @dev Returns an `BooleanSlot` with member `value` located at `slot`.\r\n */\r\n function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {\r\n /// @solidity memory-safe-assembly\r\n assembly {\r\n r.slot := slot\r\n }\r\n }\r\n\r\n /**\r\n * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.\r\n */\r\n function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {\r\n /// @solidity memory-safe-assembly\r\n assembly {\r\n r.slot := slot\r\n }\r\n }\r\n\r\n /**\r\n * @dev Returns an `Uint256Slot` with member `value` located at `slot`.\r\n */\r\n function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {\r\n /// @solidity memory-safe-assembly\r\n assembly {\r\n r.slot := slot\r\n }\r\n }\r\n\r\n /**\r\n * @dev Returns an `StringSlot` with member `value` located at `slot`.\r\n */\r\n function getStringSlot(bytes32 slot) internal pure returns (StringSlot storage r) {\r\n /// @solidity memory-safe-assembly\r\n assembly {\r\n r.slot := slot\r\n }\r\n }\r\n\r\n /**\r\n * @dev Returns an `StringSlot` representation of the string storage pointer `store`.\r\n */\r\n function getStringSlot(string storage store) internal pure returns (StringSlot storage r) {\r\n /// @solidity memory-safe-assembly\r\n assembly {\r\n r.slot := store.slot\r\n }\r\n }\r\n\r\n /**\r\n * @dev Returns an `BytesSlot` with member `value` located at `slot`.\r\n */\r\n function getBytesSlot(bytes32 slot) internal pure returns (BytesSlot storage r) {\r\n /// @solidity memory-safe-assembly\r\n assembly {\r\n r.slot := slot\r\n }\r\n }\r\n\r\n /**\r\n * @dev Returns an `BytesSlot` representation of the bytes storage pointer `store`.\r\n */\r\n function getBytesSlot(bytes storage store) internal pure returns (BytesSlot storage r) {\r\n /// @solidity memory-safe-assembly\r\n assembly {\r\n r.slot := store.slot\r\n }\r\n }\r\n}\r\n' + '// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8.19;\n\ninterface IWithdrawControlledFunctions {\n\n /**\n * Withdraws ERC20 tokens owned by this contract.\n * @param token The ERC20 token address.\n * @param to Address to withdraw to.\n * @param value Amount to withdraw.\n */\n function withdrawERC20(address token, address to, uint256 value) external;\n\n /**\n * Withdraws ETH owned by this sale contract.\n * @param to Address to withdraw to.\n * @param value Amount to withdraw.\n */\n function withdrawETH(address to, uint256 value) external;\n\n}\n\ninterface IWithdrawControlledSignals {\n\n /**\n * Withdraw failed error.\n */\n error WithdrawFailed();\n\n}\n\ninterface IWithdrawControlled is IWithdrawControlledFunctions, IWithdrawControlledSignals { }\n' }, - 'lib/openzeppelin/contracts/utils/Strings.sol': { + 'lib/openzeppelin/contracts/access/AccessControlEnumerable.sol': { content: - '// SPDX-License-Identifier: MIT\r\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Strings.sol)\r\n\r\npragma solidity ^0.8.0;\r\n\r\nimport "./math/Math.sol";\r\nimport "./math/SignedMath.sol";\r\n\r\n/**\r\n * @dev String operations.\r\n */\r\nlibrary Strings {\r\n bytes16 private constant _SYMBOLS = "0123456789abcdef";\r\n uint8 private constant _ADDRESS_LENGTH = 20;\r\n\r\n /**\r\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\r\n */\r\n function toString(uint256 value) internal pure returns (string memory) {\r\n unchecked {\r\n uint256 length = Math.log10(value) + 1;\r\n string memory buffer = new string(length);\r\n uint256 ptr;\r\n /// @solidity memory-safe-assembly\r\n assembly {\r\n ptr := add(buffer, add(32, length))\r\n }\r\n while (true) {\r\n ptr--;\r\n /// @solidity memory-safe-assembly\r\n assembly {\r\n mstore8(ptr, byte(mod(value, 10), _SYMBOLS))\r\n }\r\n value /= 10;\r\n if (value == 0) break;\r\n }\r\n return buffer;\r\n }\r\n }\r\n\r\n /**\r\n * @dev Converts a `int256` to its ASCII `string` decimal representation.\r\n */\r\n function toString(int256 value) internal pure returns (string memory) {\r\n return string(abi.encodePacked(value < 0 ? "-" : "", toString(SignedMath.abs(value))));\r\n }\r\n\r\n /**\r\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\r\n */\r\n function toHexString(uint256 value) internal pure returns (string memory) {\r\n unchecked {\r\n return toHexString(value, Math.log256(value) + 1);\r\n }\r\n }\r\n\r\n /**\r\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\r\n */\r\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\r\n bytes memory buffer = new bytes(2 * length + 2);\r\n buffer[0] = "0";\r\n buffer[1] = "x";\r\n for (uint256 i = 2 * length + 1; i > 1; --i) {\r\n buffer[i] = _SYMBOLS[value & 0xf];\r\n value >>= 4;\r\n }\r\n require(value == 0, "Strings: hex length insufficient");\r\n return string(buffer);\r\n }\r\n\r\n /**\r\n * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.\r\n */\r\n function toHexString(address addr) internal pure returns (string memory) {\r\n return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\r\n }\r\n\r\n /**\r\n * @dev Returns true if the two strings are equal.\r\n */\r\n function equal(string memory a, string memory b) internal pure returns (bool) {\r\n return keccak256(bytes(a)) == keccak256(bytes(b));\r\n }\r\n}\r\n' + '// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (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 virtual 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 virtual 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' }, - 'lib/openzeppelin/contracts/utils/cryptography/MerkleProof.sol': { + 'lib/openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol': { content: - '// SPDX-License-Identifier: MIT\r\n// OpenZeppelin Contracts (last updated v4.9.2) (utils/cryptography/MerkleProof.sol)\r\n\r\npragma solidity ^0.8.0;\r\n\r\n/**\r\n * @dev These functions deal with verification of Merkle Tree proofs.\r\n *\r\n * The tree and the proofs can be generated using our\r\n * https://github.com/OpenZeppelin/merkle-tree[JavaScript library].\r\n * You will find a quickstart guide in the readme.\r\n *\r\n * WARNING: You should avoid using leaf values that are 64 bytes long prior to\r\n * hashing, or use a hash function other than keccak256 for hashing leaves.\r\n * This is because the concatenation of a sorted pair of internal nodes in\r\n * the merkle tree could be reinterpreted as a leaf value.\r\n * OpenZeppelin\'s JavaScript library generates merkle trees that are safe\r\n * against this attack out of the box.\r\n */\r\nlibrary MerkleProof {\r\n /**\r\n * @dev Returns true if a `leaf` can be proved to be a part of a Merkle tree\r\n * defined by `root`. For this, a `proof` must be provided, containing\r\n * sibling hashes on the branch from the leaf to the root of the tree. Each\r\n * pair of leaves and each pair of pre-images are assumed to be sorted.\r\n */\r\n function verify(bytes32[] memory proof, bytes32 root, bytes32 leaf) internal pure returns (bool) {\r\n return processProof(proof, leaf) == root;\r\n }\r\n\r\n /**\r\n * @dev Calldata version of {verify}\r\n *\r\n * _Available since v4.7._\r\n */\r\n function verifyCalldata(bytes32[] calldata proof, bytes32 root, bytes32 leaf) internal pure returns (bool) {\r\n return processProofCalldata(proof, leaf) == root;\r\n }\r\n\r\n /**\r\n * @dev Returns the rebuilt hash obtained by traversing a Merkle tree up\r\n * from `leaf` using `proof`. A `proof` is valid if and only if the rebuilt\r\n * hash matches the root of the tree. When processing the proof, the pairs\r\n * of leafs & pre-images are assumed to be sorted.\r\n *\r\n * _Available since v4.4._\r\n */\r\n function processProof(bytes32[] memory proof, bytes32 leaf) internal pure returns (bytes32) {\r\n bytes32 computedHash = leaf;\r\n for (uint256 i = 0; i < proof.length; i++) {\r\n computedHash = _hashPair(computedHash, proof[i]);\r\n }\r\n return computedHash;\r\n }\r\n\r\n /**\r\n * @dev Calldata version of {processProof}\r\n *\r\n * _Available since v4.7._\r\n */\r\n function processProofCalldata(bytes32[] calldata proof, bytes32 leaf) internal pure returns (bytes32) {\r\n bytes32 computedHash = leaf;\r\n for (uint256 i = 0; i < proof.length; i++) {\r\n computedHash = _hashPair(computedHash, proof[i]);\r\n }\r\n return computedHash;\r\n }\r\n\r\n /**\r\n * @dev Returns true if the `leaves` can be simultaneously proven to be a part of a merkle tree defined by\r\n * `root`, according to `proof` and `proofFlags` as described in {processMultiProof}.\r\n *\r\n * CAUTION: Not all merkle trees admit multiproofs. See {processMultiProof} for details.\r\n *\r\n * _Available since v4.7._\r\n */\r\n function multiProofVerify(\r\n bytes32[] memory proof,\r\n bool[] memory proofFlags,\r\n bytes32 root,\r\n bytes32[] memory leaves\r\n ) internal pure returns (bool) {\r\n return processMultiProof(proof, proofFlags, leaves) == root;\r\n }\r\n\r\n /**\r\n * @dev Calldata version of {multiProofVerify}\r\n *\r\n * CAUTION: Not all merkle trees admit multiproofs. See {processMultiProof} for details.\r\n *\r\n * _Available since v4.7._\r\n */\r\n function multiProofVerifyCalldata(\r\n bytes32[] calldata proof,\r\n bool[] calldata proofFlags,\r\n bytes32 root,\r\n bytes32[] memory leaves\r\n ) internal pure returns (bool) {\r\n return processMultiProofCalldata(proof, proofFlags, leaves) == root;\r\n }\r\n\r\n /**\r\n * @dev Returns the root of a tree reconstructed from `leaves` and sibling nodes in `proof`. The reconstruction\r\n * proceeds by incrementally reconstructing all inner nodes by combining a leaf/inner node with either another\r\n * leaf/inner node or a proof sibling node, depending on whether each `proofFlags` item is true or false\r\n * respectively.\r\n *\r\n * CAUTION: Not all merkle trees admit multiproofs. To use multiproofs, it is sufficient to ensure that: 1) the tree\r\n * is complete (but not necessarily perfect), 2) the leaves to be proven are in the opposite order they are in the\r\n * tree (i.e., as seen from right to left starting at the deepest layer and continuing at the next layer).\r\n *\r\n * _Available since v4.7._\r\n */\r\n function processMultiProof(\r\n bytes32[] memory proof,\r\n bool[] memory proofFlags,\r\n bytes32[] memory leaves\r\n ) internal pure returns (bytes32 merkleRoot) {\r\n // This function rebuilds the root hash by traversing the tree up from the leaves. The root is rebuilt by\r\n // consuming and producing values on a queue. The queue starts with the `leaves` array, then goes onto the\r\n // `hashes` array. At the end of the process, the last hash in the `hashes` array should contain the root of\r\n // the merkle tree.\r\n uint256 leavesLen = leaves.length;\r\n uint256 proofLen = proof.length;\r\n uint256 totalHashes = proofFlags.length;\r\n\r\n // Check proof validity.\r\n require(leavesLen + proofLen - 1 == totalHashes, "MerkleProof: invalid multiproof");\r\n\r\n // The xxxPos values are "pointers" to the next value to consume in each array. All accesses are done using\r\n // `xxx[xxxPos++]`, which return the current value and increment the pointer, thus mimicking a queue\'s "pop".\r\n bytes32[] memory hashes = new bytes32[](totalHashes);\r\n uint256 leafPos = 0;\r\n uint256 hashPos = 0;\r\n uint256 proofPos = 0;\r\n // At each step, we compute the next hash using two values:\r\n // - a value from the "main queue". If not all leaves have been consumed, we get the next leaf, otherwise we\r\n // get the next hash.\r\n // - depending on the flag, either another value from the "main queue" (merging branches) or an element from the\r\n // `proof` array.\r\n for (uint256 i = 0; i < totalHashes; i++) {\r\n bytes32 a = leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++];\r\n bytes32 b = proofFlags[i]\r\n ? (leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++])\r\n : proof[proofPos++];\r\n hashes[i] = _hashPair(a, b);\r\n }\r\n\r\n if (totalHashes > 0) {\r\n require(proofPos == proofLen, "MerkleProof: invalid multiproof");\r\n unchecked {\r\n return hashes[totalHashes - 1];\r\n }\r\n } else if (leavesLen > 0) {\r\n return leaves[0];\r\n } else {\r\n return proof[0];\r\n }\r\n }\r\n\r\n /**\r\n * @dev Calldata version of {processMultiProof}.\r\n *\r\n * CAUTION: Not all merkle trees admit multiproofs. See {processMultiProof} for details.\r\n *\r\n * _Available since v4.7._\r\n */\r\n function processMultiProofCalldata(\r\n bytes32[] calldata proof,\r\n bool[] calldata proofFlags,\r\n bytes32[] memory leaves\r\n ) internal pure returns (bytes32 merkleRoot) {\r\n // This function rebuilds the root hash by traversing the tree up from the leaves. The root is rebuilt by\r\n // consuming and producing values on a queue. The queue starts with the `leaves` array, then goes onto the\r\n // `hashes` array. At the end of the process, the last hash in the `hashes` array should contain the root of\r\n // the merkle tree.\r\n uint256 leavesLen = leaves.length;\r\n uint256 proofLen = proof.length;\r\n uint256 totalHashes = proofFlags.length;\r\n\r\n // Check proof validity.\r\n require(leavesLen + proofLen - 1 == totalHashes, "MerkleProof: invalid multiproof");\r\n\r\n // The xxxPos values are "pointers" to the next value to consume in each array. All accesses are done using\r\n // `xxx[xxxPos++]`, which return the current value and increment the pointer, thus mimicking a queue\'s "pop".\r\n bytes32[] memory hashes = new bytes32[](totalHashes);\r\n uint256 leafPos = 0;\r\n uint256 hashPos = 0;\r\n uint256 proofPos = 0;\r\n // At each step, we compute the next hash using two values:\r\n // - a value from the "main queue". If not all leaves have been consumed, we get the next leaf, otherwise we\r\n // get the next hash.\r\n // - depending on the flag, either another value from the "main queue" (merging branches) or an element from the\r\n // `proof` array.\r\n for (uint256 i = 0; i < totalHashes; i++) {\r\n bytes32 a = leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++];\r\n bytes32 b = proofFlags[i]\r\n ? (leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++])\r\n : proof[proofPos++];\r\n hashes[i] = _hashPair(a, b);\r\n }\r\n\r\n if (totalHashes > 0) {\r\n require(proofPos == proofLen, "MerkleProof: invalid multiproof");\r\n unchecked {\r\n return hashes[totalHashes - 1];\r\n }\r\n } else if (leavesLen > 0) {\r\n return leaves[0];\r\n } else {\r\n return proof[0];\r\n }\r\n }\r\n\r\n function _hashPair(bytes32 a, bytes32 b) private pure returns (bytes32) {\r\n return a < b ? _efficientHash(a, b) : _efficientHash(b, a);\r\n }\r\n\r\n function _efficientHash(bytes32 a, bytes32 b) private pure returns (bytes32 value) {\r\n /// @solidity memory-safe-assembly\r\n assembly {\r\n mstore(0x00, a)\r\n mstore(0x20, b)\r\n value := keccak256(0x00, 0x40)\r\n }\r\n }\r\n}\r\n' + '// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.3) (token/ERC20/utils/SafeERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport "../IERC20.sol";\nimport "../extensions/IERC20Permit.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 /**\n * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,\n * non-reverting calls are assumed to be successful.\n */\n function safeTransfer(IERC20 token, address to, uint256 value) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\n }\n\n /**\n * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the\n * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.\n */\n function safeTransferFrom(IERC20 token, address from, address to, uint256 value) 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(IERC20 token, address spender, uint256 value) 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 /**\n * @dev Increase the calling contract\'s allowance toward `spender` by `value`. If `token` returns no value,\n * non-reverting calls are assumed to be successful.\n */\n function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {\n uint256 oldAllowance = token.allowance(address(this), spender);\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance + value));\n }\n\n /**\n * @dev Decrease the calling contract\'s allowance toward `spender` by `value`. If `token` returns no value,\n * non-reverting calls are assumed to be successful.\n */\n function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal {\n unchecked {\n uint256 oldAllowance = token.allowance(address(this), spender);\n require(oldAllowance >= value, "SafeERC20: decreased allowance below zero");\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance - value));\n }\n }\n\n /**\n * @dev Set the calling contract\'s allowance toward `spender` to `value`. If `token` returns no value,\n * non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval\n * to be set to zero before setting it to a non-zero value, such as USDT.\n */\n function forceApprove(IERC20 token, address spender, uint256 value) internal {\n bytes memory approvalCall = abi.encodeWithSelector(token.approve.selector, spender, value);\n\n if (!_callOptionalReturnBool(token, approvalCall)) {\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, 0));\n _callOptionalReturn(token, approvalCall);\n }\n }\n\n /**\n * @dev Use a ERC-2612 signature to set the `owner` approval toward `spender` on `token`.\n * Revert on invalid signature.\n */\n function safePermit(\n IERC20Permit token,\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) internal {\n uint256 nonceBefore = token.nonces(owner);\n token.permit(owner, spender, value, deadline, v, r, s);\n uint256 nonceAfter = token.nonces(owner);\n require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed");\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 require(returndata.length == 0 || abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");\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 * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.\n */\n function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {\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 cannot use {Address-functionCall} here since this should return false\n // and not revert is the subcall reverts.\n\n (bool success, bytes memory returndata) = address(token).call(data);\n return\n success && (returndata.length == 0 || abi.decode(returndata, (bool))) && Address.isContract(address(token));\n }\n}\n' }, - 'lib/openzeppelin/contracts/utils/introspection/ERC165.sol': { + 'lib/0xsequence/erc-1155/src/contracts/interfaces/IERC165.sol': { content: - '// SPDX-License-Identifier: MIT\r\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\r\n\r\npragma solidity ^0.8.0;\r\n\r\nimport "./IERC165.sol";\r\n\r\n/**\r\n * @dev Implementation of the {IERC165} interface.\r\n *\r\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\r\n * for the additional interface id that will be supported. For example:\r\n *\r\n * ```solidity\r\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\r\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\r\n * }\r\n * ```\r\n *\r\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\r\n */\r\nabstract contract ERC165 is IERC165 {\r\n /**\r\n * @dev See {IERC165-supportsInterface}.\r\n */\r\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\r\n return interfaceId == type(IERC165).interfaceId;\r\n }\r\n}\r\n' + '// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8.0;\n\n\n/**\n * @title ERC165\n * @dev https://github.com/ethereum/EIPs/blob/master/EIPS/eip-165.md\n */\ninterface IERC165 {\n\n /**\n * @notice Query if a contract implements an interface\n * @dev Interface identification is specified in ERC-165. This function\n * uses less than 30,000 gas\n * @param _interfaceId The interface identifier, as specified in ERC-165\n */\n function supportsInterface(bytes4 _interfaceId)\n external\n view\n returns (bool);\n}\n' }, - 'lib/openzeppelin/contracts/utils/introspection/IERC165.sol': { + 'lib/openzeppelin/contracts/proxy/ERC1967/ERC1967Upgrade.sol': { content: - '// SPDX-License-Identifier: MIT\r\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\r\n\r\npragma solidity ^0.8.0;\r\n\r\n/**\r\n * @dev Interface of the ERC165 standard, as defined in the\r\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\r\n *\r\n * Implementers can declare support of contract interfaces, which can then be\r\n * queried by others ({ERC165Checker}).\r\n *\r\n * For an implementation, see {ERC165}.\r\n */\r\ninterface IERC165 {\r\n /**\r\n * @dev Returns true if this contract implements the interface defined by\r\n * `interfaceId`. See the corresponding\r\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\r\n * to learn more about how these ids are created.\r\n *\r\n * This function call must use less than 30 000 gas.\r\n */\r\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\r\n}\r\n' + '// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (proxy/ERC1967/ERC1967Upgrade.sol)\n\npragma solidity ^0.8.2;\n\nimport "../beacon/IBeacon.sol";\nimport "../../interfaces/IERC1967.sol";\nimport "../../interfaces/draft-IERC1822.sol";\nimport "../../utils/Address.sol";\nimport "../../utils/StorageSlot.sol";\n\n/**\n * @dev This abstract contract provides getters and event emitting update functions for\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots.\n *\n * _Available since v4.1._\n */\nabstract contract ERC1967Upgrade is IERC1967 {\n // This is the keccak-256 hash of "eip1967.proxy.rollback" subtracted by 1\n bytes32 private constant _ROLLBACK_SLOT = 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143;\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 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\n\n /**\n * @dev Returns the current implementation address.\n */\n function _getImplementation() internal view returns (address) {\n return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\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), "ERC1967: new implementation is not a contract");\n StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\n }\n\n /**\n * @dev Perform implementation upgrade\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 Perform implementation upgrade with additional setup call.\n *\n * Emits an {Upgraded} event.\n */\n function _upgradeToAndCall(address newImplementation, bytes memory data, bool forceCall) internal {\n _upgradeTo(newImplementation);\n if (data.length > 0 || forceCall) {\n Address.functionDelegateCall(newImplementation, data);\n }\n }\n\n /**\n * @dev Perform implementation upgrade with security checks for UUPS proxies, and additional setup call.\n *\n * Emits an {Upgraded} event.\n */\n function _upgradeToAndCallUUPS(address newImplementation, bytes memory data, bool forceCall) internal {\n // Upgrades from old implementations will perform a rollback test. This test requires the new\n // implementation to upgrade back to the old, non-ERC1822 compliant, implementation. Removing\n // this special case will break upgrade paths from old UUPS implementation to new ones.\n if (StorageSlot.getBooleanSlot(_ROLLBACK_SLOT).value) {\n _setImplementation(newImplementation);\n } else {\n try IERC1822Proxiable(newImplementation).proxiableUUID() returns (bytes32 slot) {\n require(slot == _IMPLEMENTATION_SLOT, "ERC1967Upgrade: unsupported proxiableUUID");\n } catch {\n revert("ERC1967Upgrade: new implementation is not UUPS");\n }\n _upgradeToAndCall(newImplementation, data, forceCall);\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 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\n\n /**\n * @dev Returns the current admin.\n */\n function _getAdmin() internal view returns (address) {\n return StorageSlot.getAddressSlot(_ADMIN_SLOT).value;\n }\n\n /**\n * @dev Stores a new address in the EIP1967 admin slot.\n */\n function _setAdmin(address newAdmin) private {\n require(newAdmin != address(0), "ERC1967: new admin is the zero address");\n StorageSlot.getAddressSlot(_ADMIN_SLOT).value = newAdmin;\n }\n\n /**\n * @dev Changes the admin of the proxy.\n *\n * Emits an {AdminChanged} event.\n */\n function _changeAdmin(address newAdmin) internal {\n emit AdminChanged(_getAdmin(), newAdmin);\n _setAdmin(newAdmin);\n }\n\n /**\n * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy.\n * This is bytes32(uint256(keccak256(\'eip1967.proxy.beacon\')) - 1)) and is validated in the constructor.\n */\n bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50;\n\n /**\n * @dev Returns the current beacon.\n */\n function _getBeacon() internal view returns (address) {\n return StorageSlot.getAddressSlot(_BEACON_SLOT).value;\n }\n\n /**\n * @dev Stores a new beacon in the EIP1967 beacon slot.\n */\n function _setBeacon(address newBeacon) private {\n require(Address.isContract(newBeacon), "ERC1967: new beacon is not a contract");\n require(\n Address.isContract(IBeacon(newBeacon).implementation()),\n "ERC1967: beacon implementation is not a contract"\n );\n StorageSlot.getAddressSlot(_BEACON_SLOT).value = newBeacon;\n }\n\n /**\n * @dev Perform beacon upgrade with additional setup call. Note: This upgrades the address of the beacon, it does\n * not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that).\n *\n * Emits a {BeaconUpgraded} event.\n */\n function _upgradeBeaconToAndCall(address newBeacon, bytes memory data, bool forceCall) internal {\n _setBeacon(newBeacon);\n emit BeaconUpgraded(newBeacon);\n if (data.length > 0 || forceCall) {\n Address.functionDelegateCall(IBeacon(newBeacon).implementation(), data);\n }\n }\n}\n' }, - 'lib/openzeppelin/contracts/utils/math/Math.sol': { + 'lib/openzeppelin/contracts/proxy/Proxy.sol': { content: - '// SPDX-License-Identifier: MIT\r\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/math/Math.sol)\r\n\r\npragma solidity ^0.8.0;\r\n\r\n/**\r\n * @dev Standard math utilities missing in the Solidity language.\r\n */\r\nlibrary Math {\r\n enum Rounding {\r\n Down, // Toward negative infinity\r\n Up, // Toward infinity\r\n Zero // Toward zero\r\n }\r\n\r\n /**\r\n * @dev Returns the largest of two numbers.\r\n */\r\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\r\n return a > b ? a : b;\r\n }\r\n\r\n /**\r\n * @dev Returns the smallest of two numbers.\r\n */\r\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\r\n return a < b ? a : b;\r\n }\r\n\r\n /**\r\n * @dev Returns the average of two numbers. The result is rounded towards\r\n * zero.\r\n */\r\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\r\n // (a + b) / 2 can overflow.\r\n return (a & b) + (a ^ b) / 2;\r\n }\r\n\r\n /**\r\n * @dev Returns the ceiling of the division of two numbers.\r\n *\r\n * This differs from standard division with `/` in that it rounds up instead\r\n * of rounding down.\r\n */\r\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\r\n // (a + b - 1) / b can overflow on addition, so we distribute.\r\n return a == 0 ? 0 : (a - 1) / b + 1;\r\n }\r\n\r\n /**\r\n * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\r\n * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)\r\n * with further edits by Uniswap Labs also under MIT license.\r\n */\r\n function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) {\r\n unchecked {\r\n // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use\r\n // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256\r\n // variables such that product = prod1 * 2^256 + prod0.\r\n uint256 prod0; // Least significant 256 bits of the product\r\n uint256 prod1; // Most significant 256 bits of the product\r\n assembly {\r\n let mm := mulmod(x, y, not(0))\r\n prod0 := mul(x, y)\r\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\r\n }\r\n\r\n // Handle non-overflow cases, 256 by 256 division.\r\n if (prod1 == 0) {\r\n // Solidity will revert if denominator == 0, unlike the div opcode on its own.\r\n // The surrounding unchecked block does not change this fact.\r\n // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.\r\n return prod0 / denominator;\r\n }\r\n\r\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\r\n require(denominator > prod1, "Math: mulDiv overflow");\r\n\r\n ///////////////////////////////////////////////\r\n // 512 by 256 division.\r\n ///////////////////////////////////////////////\r\n\r\n // Make division exact by subtracting the remainder from [prod1 prod0].\r\n uint256 remainder;\r\n assembly {\r\n // Compute remainder using mulmod.\r\n remainder := mulmod(x, y, denominator)\r\n\r\n // Subtract 256 bit number from 512 bit number.\r\n prod1 := sub(prod1, gt(remainder, prod0))\r\n prod0 := sub(prod0, remainder)\r\n }\r\n\r\n // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.\r\n // See https://cs.stackexchange.com/q/138556/92363.\r\n\r\n // Does not overflow because the denominator cannot be zero at this stage in the function.\r\n uint256 twos = denominator & (~denominator + 1);\r\n assembly {\r\n // Divide denominator by twos.\r\n denominator := div(denominator, twos)\r\n\r\n // Divide [prod1 prod0] by twos.\r\n prod0 := div(prod0, twos)\r\n\r\n // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.\r\n twos := add(div(sub(0, twos), twos), 1)\r\n }\r\n\r\n // Shift in bits from prod1 into prod0.\r\n prod0 |= prod1 * twos;\r\n\r\n // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such\r\n // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for\r\n // four bits. That is, denominator * inv = 1 mod 2^4.\r\n uint256 inverse = (3 * denominator) ^ 2;\r\n\r\n // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel\'s lifting lemma, this also works\r\n // in modular arithmetic, doubling the correct bits in each step.\r\n inverse *= 2 - denominator * inverse; // inverse mod 2^8\r\n inverse *= 2 - denominator * inverse; // inverse mod 2^16\r\n inverse *= 2 - denominator * inverse; // inverse mod 2^32\r\n inverse *= 2 - denominator * inverse; // inverse mod 2^64\r\n inverse *= 2 - denominator * inverse; // inverse mod 2^128\r\n inverse *= 2 - denominator * inverse; // inverse mod 2^256\r\n\r\n // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.\r\n // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is\r\n // less than 2^256, this is the final result. We don\'t need to compute the high bits of the result and prod1\r\n // is no longer required.\r\n result = prod0 * inverse;\r\n return result;\r\n }\r\n }\r\n\r\n /**\r\n * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.\r\n */\r\n function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) {\r\n uint256 result = mulDiv(x, y, denominator);\r\n if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {\r\n result += 1;\r\n }\r\n return result;\r\n }\r\n\r\n /**\r\n * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.\r\n *\r\n * Inspired by Henry S. Warren, Jr.\'s "Hacker\'s Delight" (Chapter 11).\r\n */\r\n function sqrt(uint256 a) internal pure returns (uint256) {\r\n if (a == 0) {\r\n return 0;\r\n }\r\n\r\n // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.\r\n //\r\n // We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have\r\n // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\r\n //\r\n // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\r\n // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\r\n // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\r\n //\r\n // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\r\n uint256 result = 1 << (log2(a) >> 1);\r\n\r\n // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,\r\n // since it is the square root of a uint256. Newton\'s method converges quadratically (precision doubles at\r\n // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision\r\n // into the expected uint128 result.\r\n unchecked {\r\n result = (result + a / result) >> 1;\r\n result = (result + a / result) >> 1;\r\n result = (result + a / result) >> 1;\r\n result = (result + a / result) >> 1;\r\n result = (result + a / result) >> 1;\r\n result = (result + a / result) >> 1;\r\n result = (result + a / result) >> 1;\r\n return min(result, a / result);\r\n }\r\n }\r\n\r\n /**\r\n * @notice Calculates sqrt(a), following the selected rounding direction.\r\n */\r\n function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {\r\n unchecked {\r\n uint256 result = sqrt(a);\r\n return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);\r\n }\r\n }\r\n\r\n /**\r\n * @dev Return the log in base 2, rounded down, of a positive value.\r\n * Returns 0 if given 0.\r\n */\r\n function log2(uint256 value) internal pure returns (uint256) {\r\n uint256 result = 0;\r\n unchecked {\r\n if (value >> 128 > 0) {\r\n value >>= 128;\r\n result += 128;\r\n }\r\n if (value >> 64 > 0) {\r\n value >>= 64;\r\n result += 64;\r\n }\r\n if (value >> 32 > 0) {\r\n value >>= 32;\r\n result += 32;\r\n }\r\n if (value >> 16 > 0) {\r\n value >>= 16;\r\n result += 16;\r\n }\r\n if (value >> 8 > 0) {\r\n value >>= 8;\r\n result += 8;\r\n }\r\n if (value >> 4 > 0) {\r\n value >>= 4;\r\n result += 4;\r\n }\r\n if (value >> 2 > 0) {\r\n value >>= 2;\r\n result += 2;\r\n }\r\n if (value >> 1 > 0) {\r\n result += 1;\r\n }\r\n }\r\n return result;\r\n }\r\n\r\n /**\r\n * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\r\n * Returns 0 if given 0.\r\n */\r\n function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\r\n unchecked {\r\n uint256 result = log2(value);\r\n return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\r\n }\r\n }\r\n\r\n /**\r\n * @dev Return the log in base 10, rounded down, of a positive value.\r\n * Returns 0 if given 0.\r\n */\r\n function log10(uint256 value) internal pure returns (uint256) {\r\n uint256 result = 0;\r\n unchecked {\r\n if (value >= 10 ** 64) {\r\n value /= 10 ** 64;\r\n result += 64;\r\n }\r\n if (value >= 10 ** 32) {\r\n value /= 10 ** 32;\r\n result += 32;\r\n }\r\n if (value >= 10 ** 16) {\r\n value /= 10 ** 16;\r\n result += 16;\r\n }\r\n if (value >= 10 ** 8) {\r\n value /= 10 ** 8;\r\n result += 8;\r\n }\r\n if (value >= 10 ** 4) {\r\n value /= 10 ** 4;\r\n result += 4;\r\n }\r\n if (value >= 10 ** 2) {\r\n value /= 10 ** 2;\r\n result += 2;\r\n }\r\n if (value >= 10 ** 1) {\r\n result += 1;\r\n }\r\n }\r\n return result;\r\n }\r\n\r\n /**\r\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\r\n * Returns 0 if given 0.\r\n */\r\n function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\r\n unchecked {\r\n uint256 result = log10(value);\r\n return result + (rounding == Rounding.Up && 10 ** result < value ? 1 : 0);\r\n }\r\n }\r\n\r\n /**\r\n * @dev Return the log in base 256, rounded down, of a positive value.\r\n * Returns 0 if given 0.\r\n *\r\n * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\r\n */\r\n function log256(uint256 value) internal pure returns (uint256) {\r\n uint256 result = 0;\r\n unchecked {\r\n if (value >> 128 > 0) {\r\n value >>= 128;\r\n result += 16;\r\n }\r\n if (value >> 64 > 0) {\r\n value >>= 64;\r\n result += 8;\r\n }\r\n if (value >> 32 > 0) {\r\n value >>= 32;\r\n result += 4;\r\n }\r\n if (value >> 16 > 0) {\r\n value >>= 16;\r\n result += 2;\r\n }\r\n if (value >> 8 > 0) {\r\n result += 1;\r\n }\r\n }\r\n return result;\r\n }\r\n\r\n /**\r\n * @dev Return the log in base 256, following the selected rounding direction, of a positive value.\r\n * Returns 0 if given 0.\r\n */\r\n function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\r\n unchecked {\r\n uint256 result = log256(value);\r\n return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0);\r\n }\r\n }\r\n}\r\n' + "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (proxy/Proxy.sol)\n\npragma solidity ^0.8.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 internal call site, it will return directly to the external caller.\n */\n function _delegate(address implementation) internal virtual {\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 {\n revert(0, returndatasize())\n }\n default {\n return(0, returndatasize())\n }\n }\n }\n\n /**\n * @dev This is a virtual function that should be overridden so it returns the address to which the fallback function\n * and {_fallback} should delegate.\n */\n function _implementation() internal view virtual 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 internal call site, it will return directly to the external caller.\n */\n function _fallback() internal virtual {\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() external payable virtual {\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() external payable virtual {\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 overridden should call `super._beforeFallback()`.\n */\n function _beforeFallback() internal virtual {}\n}\n" }, - 'lib/openzeppelin/contracts/utils/math/SignedMath.sol': { + 'src/proxies/openzeppelin/ERC1967Proxy.sol': { content: - '// SPDX-License-Identifier: MIT\r\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol)\r\n\r\npragma solidity ^0.8.0;\r\n\r\n/**\r\n * @dev Standard signed math utilities missing in the Solidity language.\r\n */\r\nlibrary SignedMath {\r\n /**\r\n * @dev Returns the largest of two signed numbers.\r\n */\r\n function max(int256 a, int256 b) internal pure returns (int256) {\r\n return a > b ? a : b;\r\n }\r\n\r\n /**\r\n * @dev Returns the smallest of two signed numbers.\r\n */\r\n function min(int256 a, int256 b) internal pure returns (int256) {\r\n return a < b ? a : b;\r\n }\r\n\r\n /**\r\n * @dev Returns the average of two signed numbers without overflow.\r\n * The result is rounded towards zero.\r\n */\r\n function average(int256 a, int256 b) internal pure returns (int256) {\r\n // Formula from the book "Hacker\'s Delight"\r\n int256 x = (a & b) + ((a ^ b) >> 1);\r\n return x + (int256(uint256(x) >> 255) & (a ^ b));\r\n }\r\n\r\n /**\r\n * @dev Returns the absolute unsigned value of a signed value.\r\n */\r\n function abs(int256 n) internal pure returns (uint256) {\r\n unchecked {\r\n // must be unchecked in order to support `n = type(int256).min`\r\n return uint256(n >= 0 ? n : -n);\r\n }\r\n }\r\n}\r\n' + '// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/ERC1967/ERC1967Proxy.sol)\n\n// Note: This implementation is an exact copy with the constructor removed, and pragma and imports updated.\n\npragma solidity ^0.8.19;\n\nimport "@openzeppelin/contracts/proxy/ERC1967/ERC1967Upgrade.sol";\nimport "@openzeppelin/contracts/proxy/Proxy.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 */\ncontract ERC1967Proxy is Proxy, ERC1967Upgrade {\n\n /**\n * @dev Returns the current implementation address.\n */\n function _implementation() internal view virtual override returns (address impl) {\n return ERC1967Upgrade._getImplementation();\n }\n\n}\n' }, - 'lib/openzeppelin/contracts/utils/structs/EnumerableSet.sol': { + 'lib/0xsequence/erc-1155/src/contracts/interfaces/IERC1155TokenReceiver.sol': { content: - "// SPDX-License-Identifier: MIT\r\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/structs/EnumerableSet.sol)\r\n// This file was procedurally generated from scripts/generate/templates/EnumerableSet.js.\r\n\r\npragma solidity ^0.8.0;\r\n\r\n/**\r\n * @dev Library for managing\r\n * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive\r\n * types.\r\n *\r\n * Sets have the following properties:\r\n *\r\n * - Elements are added, removed, and checked for existence in constant time\r\n * (O(1)).\r\n * - Elements are enumerated in O(n). No guarantees are made on the ordering.\r\n *\r\n * ```solidity\r\n * contract Example {\r\n * // Add the library methods\r\n * using EnumerableSet for EnumerableSet.AddressSet;\r\n *\r\n * // Declare a set state variable\r\n * EnumerableSet.AddressSet private mySet;\r\n * }\r\n * ```\r\n *\r\n * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)\r\n * and `uint256` (`UintSet`) are supported.\r\n *\r\n * [WARNING]\r\n * ====\r\n * Trying to delete such a structure from storage will likely result in data corruption, rendering the structure\r\n * unusable.\r\n * See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info.\r\n *\r\n * In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an\r\n * array of EnumerableSet.\r\n * ====\r\n */\r\nlibrary EnumerableSet {\r\n // To implement this library for multiple types with as little code\r\n // repetition as possible, we write it in terms of a generic Set type with\r\n // bytes32 values.\r\n // The Set implementation uses private functions, and user-facing\r\n // implementations (such as AddressSet) are just wrappers around the\r\n // underlying Set.\r\n // This means that we can only create new EnumerableSets for types that fit\r\n // in bytes32.\r\n\r\n struct Set {\r\n // Storage of set values\r\n bytes32[] _values;\r\n // Position of the value in the `values` array, plus 1 because index 0\r\n // means a value is not in the set.\r\n mapping(bytes32 => uint256) _indexes;\r\n }\r\n\r\n /**\r\n * @dev Add a value to a set. O(1).\r\n *\r\n * Returns true if the value was added to the set, that is if it was not\r\n * already present.\r\n */\r\n function _add(Set storage set, bytes32 value) private returns (bool) {\r\n if (!_contains(set, value)) {\r\n set._values.push(value);\r\n // The value is stored at length-1, but we add 1 to all indexes\r\n // and use 0 as a sentinel value\r\n set._indexes[value] = set._values.length;\r\n return true;\r\n } else {\r\n return false;\r\n }\r\n }\r\n\r\n /**\r\n * @dev Removes a value from a set. O(1).\r\n *\r\n * Returns true if the value was removed from the set, that is if it was\r\n * present.\r\n */\r\n function _remove(Set storage set, bytes32 value) private returns (bool) {\r\n // We read and store the value's index to prevent multiple reads from the same storage slot\r\n uint256 valueIndex = set._indexes[value];\r\n\r\n if (valueIndex != 0) {\r\n // Equivalent to contains(set, value)\r\n // To delete an element from the _values array in O(1), we swap the element to delete with the last one in\r\n // the array, and then remove the last element (sometimes called as 'swap and pop').\r\n // This modifies the order of the array, as noted in {at}.\r\n\r\n uint256 toDeleteIndex = valueIndex - 1;\r\n uint256 lastIndex = set._values.length - 1;\r\n\r\n if (lastIndex != toDeleteIndex) {\r\n bytes32 lastValue = set._values[lastIndex];\r\n\r\n // Move the last value to the index where the value to delete is\r\n set._values[toDeleteIndex] = lastValue;\r\n // Update the index for the moved value\r\n set._indexes[lastValue] = valueIndex; // Replace lastValue's index to valueIndex\r\n }\r\n\r\n // Delete the slot where the moved value was stored\r\n set._values.pop();\r\n\r\n // Delete the index for the deleted slot\r\n delete set._indexes[value];\r\n\r\n return true;\r\n } else {\r\n return false;\r\n }\r\n }\r\n\r\n /**\r\n * @dev Returns true if the value is in the set. O(1).\r\n */\r\n function _contains(Set storage set, bytes32 value) private view returns (bool) {\r\n return set._indexes[value] != 0;\r\n }\r\n\r\n /**\r\n * @dev Returns the number of values on the set. O(1).\r\n */\r\n function _length(Set storage set) private view returns (uint256) {\r\n return set._values.length;\r\n }\r\n\r\n /**\r\n * @dev Returns the value stored at position `index` in the set. O(1).\r\n *\r\n * Note that there are no guarantees on the ordering of values inside the\r\n * array, and it may change when more values are added or removed.\r\n *\r\n * Requirements:\r\n *\r\n * - `index` must be strictly less than {length}.\r\n */\r\n function _at(Set storage set, uint256 index) private view returns (bytes32) {\r\n return set._values[index];\r\n }\r\n\r\n /**\r\n * @dev Return the entire set in an array\r\n *\r\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\r\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\r\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\r\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\r\n */\r\n function _values(Set storage set) private view returns (bytes32[] memory) {\r\n return set._values;\r\n }\r\n\r\n // Bytes32Set\r\n\r\n struct Bytes32Set {\r\n Set _inner;\r\n }\r\n\r\n /**\r\n * @dev Add a value to a set. O(1).\r\n *\r\n * Returns true if the value was added to the set, that is if it was not\r\n * already present.\r\n */\r\n function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {\r\n return _add(set._inner, value);\r\n }\r\n\r\n /**\r\n * @dev Removes a value from a set. O(1).\r\n *\r\n * Returns true if the value was removed from the set, that is if it was\r\n * present.\r\n */\r\n function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {\r\n return _remove(set._inner, value);\r\n }\r\n\r\n /**\r\n * @dev Returns true if the value is in the set. O(1).\r\n */\r\n function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {\r\n return _contains(set._inner, value);\r\n }\r\n\r\n /**\r\n * @dev Returns the number of values in the set. O(1).\r\n */\r\n function length(Bytes32Set storage set) internal view returns (uint256) {\r\n return _length(set._inner);\r\n }\r\n\r\n /**\r\n * @dev Returns the value stored at position `index` in the set. O(1).\r\n *\r\n * Note that there are no guarantees on the ordering of values inside the\r\n * array, and it may change when more values are added or removed.\r\n *\r\n * Requirements:\r\n *\r\n * - `index` must be strictly less than {length}.\r\n */\r\n function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {\r\n return _at(set._inner, index);\r\n }\r\n\r\n /**\r\n * @dev Return the entire set in an array\r\n *\r\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\r\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\r\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\r\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\r\n */\r\n function values(Bytes32Set storage set) internal view returns (bytes32[] memory) {\r\n bytes32[] memory store = _values(set._inner);\r\n bytes32[] memory result;\r\n\r\n /// @solidity memory-safe-assembly\r\n assembly {\r\n result := store\r\n }\r\n\r\n return result;\r\n }\r\n\r\n // AddressSet\r\n\r\n struct AddressSet {\r\n Set _inner;\r\n }\r\n\r\n /**\r\n * @dev Add a value to a set. O(1).\r\n *\r\n * Returns true if the value was added to the set, that is if it was not\r\n * already present.\r\n */\r\n function add(AddressSet storage set, address value) internal returns (bool) {\r\n return _add(set._inner, bytes32(uint256(uint160(value))));\r\n }\r\n\r\n /**\r\n * @dev Removes a value from a set. O(1).\r\n *\r\n * Returns true if the value was removed from the set, that is if it was\r\n * present.\r\n */\r\n function remove(AddressSet storage set, address value) internal returns (bool) {\r\n return _remove(set._inner, bytes32(uint256(uint160(value))));\r\n }\r\n\r\n /**\r\n * @dev Returns true if the value is in the set. O(1).\r\n */\r\n function contains(AddressSet storage set, address value) internal view returns (bool) {\r\n return _contains(set._inner, bytes32(uint256(uint160(value))));\r\n }\r\n\r\n /**\r\n * @dev Returns the number of values in the set. O(1).\r\n */\r\n function length(AddressSet storage set) internal view returns (uint256) {\r\n return _length(set._inner);\r\n }\r\n\r\n /**\r\n * @dev Returns the value stored at position `index` in the set. O(1).\r\n *\r\n * Note that there are no guarantees on the ordering of values inside the\r\n * array, and it may change when more values are added or removed.\r\n *\r\n * Requirements:\r\n *\r\n * - `index` must be strictly less than {length}.\r\n */\r\n function at(AddressSet storage set, uint256 index) internal view returns (address) {\r\n return address(uint160(uint256(_at(set._inner, index))));\r\n }\r\n\r\n /**\r\n * @dev Return the entire set in an array\r\n *\r\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\r\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\r\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\r\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\r\n */\r\n function values(AddressSet storage set) internal view returns (address[] memory) {\r\n bytes32[] memory store = _values(set._inner);\r\n address[] memory result;\r\n\r\n /// @solidity memory-safe-assembly\r\n assembly {\r\n result := store\r\n }\r\n\r\n return result;\r\n }\r\n\r\n // UintSet\r\n\r\n struct UintSet {\r\n Set _inner;\r\n }\r\n\r\n /**\r\n * @dev Add a value to a set. O(1).\r\n *\r\n * Returns true if the value was added to the set, that is if it was not\r\n * already present.\r\n */\r\n function add(UintSet storage set, uint256 value) internal returns (bool) {\r\n return _add(set._inner, bytes32(value));\r\n }\r\n\r\n /**\r\n * @dev Removes a value from a set. O(1).\r\n *\r\n * Returns true if the value was removed from the set, that is if it was\r\n * present.\r\n */\r\n function remove(UintSet storage set, uint256 value) internal returns (bool) {\r\n return _remove(set._inner, bytes32(value));\r\n }\r\n\r\n /**\r\n * @dev Returns true if the value is in the set. O(1).\r\n */\r\n function contains(UintSet storage set, uint256 value) internal view returns (bool) {\r\n return _contains(set._inner, bytes32(value));\r\n }\r\n\r\n /**\r\n * @dev Returns the number of values in the set. O(1).\r\n */\r\n function length(UintSet storage set) internal view returns (uint256) {\r\n return _length(set._inner);\r\n }\r\n\r\n /**\r\n * @dev Returns the value stored at position `index` in the set. O(1).\r\n *\r\n * Note that there are no guarantees on the ordering of values inside the\r\n * array, and it may change when more values are added or removed.\r\n *\r\n * Requirements:\r\n *\r\n * - `index` must be strictly less than {length}.\r\n */\r\n function at(UintSet storage set, uint256 index) internal view returns (uint256) {\r\n return uint256(_at(set._inner, index));\r\n }\r\n\r\n /**\r\n * @dev Return the entire set in an array\r\n *\r\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\r\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\r\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\r\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\r\n */\r\n function values(UintSet storage set) internal view returns (uint256[] memory) {\r\n bytes32[] memory store = _values(set._inner);\r\n uint256[] memory result;\r\n\r\n /// @solidity memory-safe-assembly\r\n assembly {\r\n result := store\r\n }\r\n\r\n return result;\r\n }\r\n}\r\n" + '// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8.0;\n\n/**\n * @dev ERC-1155 interface for accepting safe transfers.\n */\ninterface IERC1155TokenReceiver {\n\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 MAY throw to revert and reject the transfer\n * Return of other amount than the magic value MUST result in the transaction being reverted\n * Note: The token contract address is always the message sender\n * @param _operator The address which called the `safeTransferFrom` function\n * @param _from The address which previously owned the token\n * @param _id The id of the token being transferred\n * @param _amount 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(address _operator, address _from, uint256 _id, uint256 _amount, bytes calldata _data) 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 MAY throw to revert and reject the transfer\n * Return of other amount than the magic value WILL result in the transaction being reverted\n * Note: The token contract address is always the message sender\n * @param _operator The address which called the `safeBatchTransferFrom` function\n * @param _from The address which previously owned the token\n * @param _ids An array containing ids of each token being transferred\n * @param _amounts An array containing amounts of each token being transferred\n * @param _data Additional data with no specified format\n * @return `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))`\n */\n function onERC1155BatchReceived(address _operator, address _from, uint256[] calldata _ids, uint256[] calldata _amounts, bytes calldata _data) external returns(bytes4);\n}\n' }, - 'src/proxies/SequenceProxyFactory.sol': { + 'lib/0xsequence/erc-1155/src/contracts/utils/Address.sol': { content: - '// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8.19;\n\nimport {\n TransparentUpgradeableBeaconProxy,\n ITransparentUpgradeableBeaconProxy\n} from "./TransparentUpgradeableBeaconProxy.sol";\n\nimport {Create2} from "@openzeppelin/contracts/utils/Create2.sol";\nimport {Ownable} from "@openzeppelin/contracts/access/Ownable.sol";\nimport {UpgradeableBeacon} from "@openzeppelin/contracts/proxy/beacon/UpgradeableBeacon.sol";\n\n/**\n * An proxy factory that deploys upgradeable beacon proxies.\n * @dev The factory owner is able to upgrade the beacon implementation.\n * @dev Proxy deployers are able to override the beacon reference with their own.\n */\nabstract contract SequenceProxyFactory is Ownable {\n UpgradeableBeacon public beacon;\n\n /**\n * Initialize a Sequence Proxy Factory.\n * @param implementation The initial beacon implementation.\n * @param factoryOwner The owner of the factory.\n */\n function _initialize(address implementation, address factoryOwner) internal {\n beacon = new UpgradeableBeacon(implementation);\n Ownable._transferOwnership(factoryOwner);\n }\n\n /**\n * Deploys and initializes a new proxy instance.\n * @param _salt The deployment salt.\n * @param _proxyOwner The owner of the proxy.\n * @param _data The initialization data.\n * @return proxyAddress The address of the deployed proxy.\n */\n function _createProxy(bytes32 _salt, address _proxyOwner, bytes memory _data)\n internal\n returns (address proxyAddress)\n {\n bytes32 saltedHash = keccak256(abi.encodePacked(_salt, _proxyOwner, address(beacon), _data));\n bytes memory bytecode = type(TransparentUpgradeableBeaconProxy).creationCode;\n\n proxyAddress = Create2.deploy(0, saltedHash, bytecode);\n ITransparentUpgradeableBeaconProxy(payable(proxyAddress)).initialize(_proxyOwner, address(beacon), _data);\n }\n\n /**\n * Computes the address of a proxy instance.\n * @param _salt The deployment salt.\n * @param _proxyOwner The owner of the proxy.\n * @return proxy The expected address of the deployed proxy.\n */\n function _computeProxyAddress(bytes32 _salt, address _proxyOwner, bytes memory _data)\n internal\n view\n returns (address)\n {\n bytes32 saltedHash = keccak256(abi.encodePacked(_salt, _proxyOwner, address(beacon), _data));\n bytes32 bytecodeHash = keccak256(type(TransparentUpgradeableBeaconProxy).creationCode);\n\n return Create2.computeAddress(saltedHash, bytecodeHash);\n }\n\n /**\n * Upgrades the beacon implementation.\n * @param implementation The new beacon implementation.\n */\n function upgradeBeacon(address implementation) public onlyOwner {\n beacon.upgradeTo(implementation);\n }\n}\n' + 'pragma solidity ^0.8.0;\n\n/**\n * Utility library of inline functions on addresses\n */\nlibrary Address {\n\n // Default hash for EOA accounts returned by extcodehash\n bytes32 constant internal ACCOUNT_HASH = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;\n\n /**\n * Returns whether the target address is a contract\n * @dev This function will return false if invoked during the constructor of a contract.\n * @param _address address of the account to check\n * @return Whether the target address is a contract\n */\n function isContract(address _address) internal view returns (bool) {\n bytes32 codehash;\n\n // Currently there is no better way to check if there is a contract in an address\n // than to check the size of the code at that address or if it has a non-zero code hash or account hash\n assembly { codehash := extcodehash(_address) }\n return (codehash != 0x0 && codehash != ACCOUNT_HASH);\n }\n}\n' }, - 'src/proxies/TransparentUpgradeableBeaconProxy.sol': { + 'lib/0xsequence/erc-1155/src/contracts/utils/ERC165.sol': { content: - '// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8.19;\n\nimport {BeaconProxy, Proxy} from "./openzeppelin/BeaconProxy.sol";\nimport {TransparentUpgradeableProxy, ERC1967Proxy} from "./openzeppelin/TransparentUpgradeableProxy.sol";\n\ninterface ITransparentUpgradeableBeaconProxy {\n function initialize(address admin, address beacon, bytes memory data) external;\n}\n\nerror InvalidInitialization();\n\n/**\n * @dev As the underlying proxy implementation (TransparentUpgradeableProxy) allows the admin to call the implementation,\n * care must be taken to avoid proxy selector collisions. Implementation selectors must not conflict with the proxy selectors.\n * See https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector clashing].\n * The proxy selectors are:\n * - 0xcf7a1d77: initialize\n * - 0x3659cfe6: upgradeTo (from TransparentUpgradeableProxy)\n * - 0x4f1ef286: upgradeToAndCall (from TransparentUpgradeableProxy)\n * - 0x8f283970: changeAdmin (from TransparentUpgradeableProxy)\n * - 0xf851a440: admin (from TransparentUpgradeableProxy)\n * - 0x5c60da1b: implementation (from TransparentUpgradeableProxy)\n */\ncontract TransparentUpgradeableBeaconProxy is TransparentUpgradeableProxy, BeaconProxy {\n /**\n * Decode the initialization data from the msg.data and call the initialize function.\n */\n function _dispatchInitialize() private returns (bytes memory) {\n _requireZeroValue();\n\n (address admin, address beacon, bytes memory data) = abi.decode(msg.data[4:], (address, address, bytes));\n initialize(admin, beacon, data);\n\n return "";\n }\n\n function initialize(address admin, address beacon, bytes memory data) internal {\n if (_admin() != address(0)) {\n // Redundant call. This function can only be called when the admin is not set.\n revert InvalidInitialization();\n }\n _changeAdmin(admin);\n _upgradeBeaconToAndCall(beacon, data, false);\n }\n\n /**\n * @dev If the admin is not set, the fallback function is used to initialize the proxy.\n * @dev If the admin is set, the fallback function is used to delegatecall the implementation.\n */\n function _fallback() internal override (TransparentUpgradeableProxy, Proxy) {\n if (_getAdmin() == address(0)) {\n bytes memory ret;\n bytes4 selector = msg.sig;\n if (selector == ITransparentUpgradeableBeaconProxy.initialize.selector) {\n ret = _dispatchInitialize();\n // solhint-disable-next-line no-inline-assembly\n assembly {\n return(add(ret, 0x20), mload(ret))\n }\n }\n // When the admin is not set, the fallback function is used to initialize the proxy.\n revert InvalidInitialization();\n }\n TransparentUpgradeableProxy._fallback();\n }\n\n /**\n * Returns the current implementation address.\n * @dev This is the implementation address set by the admin, or the beacon implementation.\n */\n function _implementation() internal view override (ERC1967Proxy, BeaconProxy) returns (address) {\n address implementation = ERC1967Proxy._implementation();\n if (implementation != address(0)) {\n return implementation;\n }\n return BeaconProxy._implementation();\n }\n}\n' + 'pragma solidity ^0.8.0;\nimport "../interfaces/IERC165.sol";\n\nabstract contract ERC165 is IERC165 {\n /**\n * @notice Query if a contract implements an interface\n * @param _interfaceID The interface identifier, as specified in ERC-165\n * @return `true` if the contract implements `_interfaceID`\n */\n function supportsInterface(bytes4 _interfaceID) public view virtual override returns (bool) {\n return _interfaceID == this.supportsInterface.selector;\n }\n}\n' }, - 'src/proxies/openzeppelin/BeaconProxy.sol': { + 'lib/openzeppelin/contracts/access/IAccessControlEnumerable.sol': { content: - '// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/beacon/BeaconProxy.sol)\n\n// Note: This implementation is an exact copy with the constructor removed, and pragma and imports updated.\n\npragma solidity ^0.8.19;\n\nimport "@openzeppelin/contracts/proxy/beacon/IBeacon.sol";\nimport "@openzeppelin/contracts/proxy/Proxy.sol";\nimport "@openzeppelin/contracts/proxy/ERC1967/ERC1967Upgrade.sol";\n\n/**\n * @dev This contract implements a proxy that gets the implementation address for each call from an {UpgradeableBeacon}.\n *\n * The beacon address is stored in storage slot `uint256(keccak256(\'eip1967.proxy.beacon\')) - 1`, so that it doesn\'t\n * conflict with the storage layout of the implementation behind the proxy.\n *\n * _Available since v3.4._\n */\ncontract BeaconProxy is Proxy, ERC1967Upgrade {\n /**\n * @dev Returns the current beacon address.\n */\n function _beacon() internal view virtual returns (address) {\n return _getBeacon();\n }\n\n /**\n * @dev Returns the current implementation address of the associated beacon.\n */\n function _implementation() internal view virtual override returns (address) {\n return IBeacon(_getBeacon()).implementation();\n }\n\n /**\n * @dev Changes the proxy to use a new beacon. Deprecated: see {_upgradeBeaconToAndCall}.\n *\n * If `data` is nonempty, it\'s used as data in a delegate call to the implementation returned by the beacon.\n *\n * Requirements:\n *\n * - `beacon` must be a contract.\n * - The implementation returned by `beacon` must be a contract.\n */\n function _setBeacon(address beacon, bytes memory data) internal virtual {\n _upgradeBeaconToAndCall(beacon, data, false);\n }\n}\n' + '// 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' }, - 'src/proxies/openzeppelin/ERC1967Proxy.sol': { + 'lib/openzeppelin/contracts/access/AccessControl.sol': { content: - '// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/ERC1967/ERC1967Proxy.sol)\n\n// Note: This implementation is an exact copy with the constructor removed, and pragma and imports updated.\n\npragma solidity ^0.8.19;\n\nimport "@openzeppelin/contracts/proxy/Proxy.sol";\nimport "@openzeppelin/contracts/proxy/ERC1967/ERC1967Upgrade.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 */\ncontract ERC1967Proxy is Proxy, ERC1967Upgrade {\n /**\n * @dev Returns the current implementation address.\n */\n function _implementation() internal view virtual override returns (address impl) {\n return ERC1967Upgrade._getImplementation();\n }\n}\n' + '// 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' }, - 'src/proxies/openzeppelin/TransparentUpgradeableProxy.sol': { + 'lib/openzeppelin/contracts/utils/structs/EnumerableSet.sol': { content: - '// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (proxy/transparent/TransparentUpgradeableProxy.sol)\n\n/// @notice This implementation is a copy of OpenZeppelin\'s with the following changes:\n/// - Pragma updated\n/// - Imports updated\n/// - Constructor removed\n/// - Allows admin to call implementation\n\npragma solidity ^0.8.19;\n\nimport "./ERC1967Proxy.sol";\n\n/**\n * @dev Interface for {TransparentUpgradeableProxy}. In order to implement transparency, {TransparentUpgradeableProxy}\n * does not implement this interface directly, and some of its functions are implemented by an internal dispatch\n * mechanism. The compiler is unaware that these functions are implemented by {TransparentUpgradeableProxy} and will not\n * include them in the ABI so this interface must be used to interact with it.\n */\ninterface ITransparentUpgradeableProxy is IERC1967 {\n function admin() external view returns (address);\n\n function implementation() external view returns (address);\n\n function changeAdmin(address) external;\n\n function upgradeTo(address) external;\n\n function upgradeToAndCall(address, bytes memory) external payable;\n}\n\n/**\n * @dev This contract implements a proxy that is upgradeable by an admin.\n *\n * Unlike the original OpenZeppelin implementation, this contract does not prevent the admin from calling the implementation.\n * This potentially exposes the admin to a proxy selector attack. See\n * https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector clashing].\n * When using this contract, you must ensure that the implementation function selectors do not clash with the proxy selectors.\n * The proxy selectors are:\n * - 0x3659cfe6: upgradeTo\n * - 0x4f1ef286: upgradeToAndCall\n * - 0x8f283970: changeAdmin\n * - 0xf851a440: admin\n * - 0x5c60da1b: implementation\n *\n * NOTE: The real interface of this proxy is that defined in `ITransparentUpgradeableProxy`. This contract does not\n * inherit from that interface, and instead the admin functions are implicitly implemented using a custom dispatch\n * mechanism in `_fallback`. Consequently, the compiler will not produce an ABI for this contract. This is necessary to\n * fully implement transparency without decoding reverts caused by selector clashes between the proxy and the\n * implementation.\n *\n * WARNING: It is not recommended to extend this contract to add additional external functions. If you do so, the compiler\n * will not check that there are no selector conflicts, due to the note above. A selector clash between any new function\n * and the functions declared in {ITransparentUpgradeableProxy} will be resolved in favor of the new one. This could\n * render the admin operations inaccessible, which could prevent upgradeability. Transparency may also be compromised.\n */\ncontract TransparentUpgradeableProxy is ERC1967Proxy {\n /**\n * @dev Modifier used internally that will delegate the call to the implementation unless the sender is the admin.\n *\n * CAUTION: This modifier is deprecated, as it could cause issues if the modified function has arguments, and the\n * implementation provides a function with the same selector.\n */\n modifier ifAdmin() {\n if (msg.sender == _getAdmin()) {\n _;\n } else {\n _fallback();\n }\n }\n\n /**\n * @dev If caller is the admin process the call internally, otherwise transparently fallback to the proxy behavior\n */\n function _fallback() internal virtual override {\n if (msg.sender == _getAdmin()) {\n bytes memory ret;\n bytes4 selector = msg.sig;\n if (selector == ITransparentUpgradeableProxy.upgradeTo.selector) {\n ret = _dispatchUpgradeTo();\n } else if (selector == ITransparentUpgradeableProxy.upgradeToAndCall.selector) {\n ret = _dispatchUpgradeToAndCall();\n } else if (selector == ITransparentUpgradeableProxy.changeAdmin.selector) {\n ret = _dispatchChangeAdmin();\n } else if (selector == ITransparentUpgradeableProxy.admin.selector) {\n ret = _dispatchAdmin();\n } else if (selector == ITransparentUpgradeableProxy.implementation.selector) {\n ret = _dispatchImplementation();\n } else {\n // Call implementation\n return super._fallback();\n }\n assembly {\n return(add(ret, 0x20), mload(ret))\n }\n } else {\n super._fallback();\n }\n }\n\n /**\n * @dev Returns the current admin.\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 _dispatchAdmin() private returns (bytes memory) {\n _requireZeroValue();\n\n address admin = _getAdmin();\n return abi.encode(admin);\n }\n\n /**\n * @dev Returns the current implementation.\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 _dispatchImplementation() private returns (bytes memory) {\n _requireZeroValue();\n\n address implementation = _implementation();\n return abi.encode(implementation);\n }\n\n /**\n * @dev Changes the admin of the proxy.\n *\n * Emits an {AdminChanged} event.\n */\n function _dispatchChangeAdmin() private returns (bytes memory) {\n _requireZeroValue();\n\n address newAdmin = abi.decode(msg.data[4:], (address));\n _changeAdmin(newAdmin);\n\n return "";\n }\n\n /**\n * @dev Upgrade the implementation of the proxy.\n */\n function _dispatchUpgradeTo() private returns (bytes memory) {\n _requireZeroValue();\n\n address newImplementation = abi.decode(msg.data[4:], (address));\n _upgradeToAndCall(newImplementation, bytes(""), false);\n\n return "";\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 function _dispatchUpgradeToAndCall() private returns (bytes memory) {\n (address newImplementation, bytes memory data) = abi.decode(msg.data[4:], (address, bytes));\n _upgradeToAndCall(newImplementation, data, true);\n\n return "";\n }\n\n /**\n * @dev Returns the current admin.\n *\n * CAUTION: This function is deprecated. Use {ERC1967Upgrade-_getAdmin} instead.\n */\n function _admin() internal view virtual returns (address) {\n return _getAdmin();\n }\n\n /**\n * @dev To keep this contract fully transparent, all `ifAdmin` functions must be payable. This helper is here to\n * emulate some proxy functions being non-payable while still allowing value to pass through.\n */\n function _requireZeroValue() internal {\n require(msg.value == 0);\n }\n}\n' + "// 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" }, - 'src/tokens/ERC1155/extensions/supply/ERC1155Supply.sol': { + 'lib/openzeppelin/contracts/token/ERC20/IERC20.sol': { content: - '// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8.19;\n\nimport {ERC1155} from "@0xsequence/erc-1155/contracts/tokens/ERC1155/ERC1155.sol";\nimport {\n IERC1155Supply,\n IERC1155SupplyFunctions\n} from "@0xsequence/contracts-library/tokens/ERC1155/extensions/supply/IERC1155Supply.sol";\n\n/**\n * An ERC-1155 extension that tracks token supply.\n */\nabstract contract ERC1155Supply is ERC1155, IERC1155Supply {\n // Current supply\n uint256 public totalSupply;\n mapping(uint256 => uint256) public tokenSupply;\n\n /**\n * Mint _amount of tokens of a given id\n * @param _to The address to mint tokens to\n * @param _id Token id to mint\n * @param _amount The amount to be minted\n * @param _data Data to pass if receiver is contract\n */\n function _mint(address _to, uint256 _id, uint256 _amount, bytes memory _data) internal virtual {\n totalSupply += _amount;\n tokenSupply[_id] += _amount;\n balances[_to][_id] += _amount;\n\n emit TransferSingle(msg.sender, address(0x0), _to, _id, _amount);\n\n _callonERC1155Received(address(0x0), _to, _id, _amount, gasleft(), _data);\n }\n\n /**\n * Mint tokens for each ids in _ids\n * @param _to The address to mint tokens to\n * @param _ids Array of ids to mint\n * @param _amounts Array of amount of tokens to mint per id\n * @param _data Data to pass if receiver is contract\n */\n function _batchMint(address _to, uint256[] memory _ids, uint256[] memory _amounts, bytes memory _data)\n internal\n virtual\n {\n uint256 nMint = _ids.length;\n if (nMint != _amounts.length) {\n revert InvalidArrayLength();\n }\n\n // Executing all minting\n uint256 totalAmount = 0;\n for (uint256 i = 0; i < nMint; i++) {\n // Update storage balance\n balances[_to][_ids[i]] += _amounts[i];\n tokenSupply[_ids[i]] += _amounts[i];\n totalAmount += _amounts[i];\n }\n totalSupply += totalAmount;\n\n emit TransferBatch(msg.sender, address(0x0), _to, _ids, _amounts);\n\n // Calling onReceive method if recipient is contract\n _callonERC1155BatchReceived(address(0x0), _to, _ids, _amounts, gasleft(), _data);\n }\n\n /**\n * Burn _amount of tokens of a given token id\n * @param _from The address to burn tokens from\n * @param _id Token id to burn\n * @param _amount The amount to be burned\n */\n function _burn(address _from, uint256 _id, uint256 _amount) internal virtual {\n // Supply\n totalSupply -= _amount;\n tokenSupply[_id] -= _amount;\n\n // Balances\n balances[_from][_id] -= _amount;\n\n // Emit event\n emit TransferSingle(msg.sender, _from, address(0x0), _id, _amount);\n }\n\n /**\n * Burn tokens of given token id for each (_ids[i], _amounts[i]) pair\n * @param _from The address to burn tokens from\n * @param _ids Array of token ids to burn\n * @param _amounts Array of the amount to be burned\n */\n function _batchBurn(address _from, uint256[] memory _ids, uint256[] memory _amounts) internal virtual {\n uint256 nBurn = _ids.length;\n if (nBurn != _amounts.length) {\n revert InvalidArrayLength();\n }\n\n uint256 totalAmount = 0;\n for (uint256 i = 0; i < nBurn; i++) {\n // Update balances\n balances[_from][_ids[i]] -= _amounts[i];\n tokenSupply[_ids[i]] -= _amounts[i];\n totalAmount += _amounts[i];\n }\n totalSupply -= totalAmount;\n\n // Emit batch mint event\n emit TransferBatch(msg.sender, _from, address(0x0), _ids, _amounts);\n }\n\n //\n // Views\n //\n\n /**\n * Check interface support.\n * @param interfaceId Interface id\n * @return True if supported\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override (ERC1155) returns (bool) {\n return type(IERC1155SupplyFunctions).interfaceId == interfaceId || super.supportsInterface(interfaceId);\n }\n}\n' + "// 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" }, - 'src/tokens/ERC1155/extensions/supply/IERC1155Supply.sol': { + 'lib/openzeppelin/contracts/token/ERC20/extensions/IERC20Permit.sol': { content: - '// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8.19;\n\ninterface IERC1155SupplyFunctions {\n\n /**\n * Returns the total supply of ERC1155 tokens.\n */\n function totalSupply() external returns (uint256);\n\n /**\n * Returns the total supply of a given ERC1155 token.\n * @param tokenId The ERC1155 token id.\n */\n function tokenSupply(uint256 tokenId) external returns (uint256);\n}\n\ninterface IERC1155SupplySignals {\n\n /**\n * Invalid array input length.\n */\n error InvalidArrayLength();\n}\n\ninterface IERC1155Supply is IERC1155SupplySignals {}\n' + "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/extensions/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" }, - 'src/tokens/ERC1155/presets/items/IERC1155Items.sol': { + 'lib/openzeppelin/contracts/interfaces/IERC1967.sol': { content: - '// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8.19;\n\ninterface IERC1155ItemsFunctions {\n /**\n * Mint tokens.\n * @param to Address to mint tokens to.\n * @param tokenId Token ID to mint.\n * @param amount Amount of tokens to mint.\n * @param data Data to pass if receiver is contract.\n */\n function mint(address to, uint256 tokenId, uint256 amount, bytes memory data) external;\n\n /**\n * Mint tokens.\n * @param to Address to mint tokens to.\n * @param tokenIds Token IDs to mint.\n * @param amounts Amounts of tokens to mint.\n * @param data Data to pass if receiver is contract.\n */\n function batchMint(address to, uint256[] memory tokenIds, uint256[] memory amounts, bytes memory data) external;\n}\n\ninterface IERC1155ItemsSignals {\n /**\n * Invalid initialization error.\n */\n error InvalidInitialization();\n}\n\ninterface IERC1155Items is IERC1155ItemsFunctions, IERC1155ItemsSignals {}\n' + '// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (interfaces/IERC1967.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev ERC-1967: Proxy Storage Slots. This interface contains the events defined in the ERC.\n *\n * _Available since v4.8.3._\n */\ninterface IERC1967 {\n /**\n * @dev Emitted when the implementation is upgraded.\n */\n event Upgraded(address indexed implementation);\n\n /**\n * @dev Emitted when the admin account has changed.\n */\n event AdminChanged(address previousAdmin, address newAdmin);\n\n /**\n * @dev Emitted when the beacon is changed.\n */\n event BeaconUpgraded(address indexed beacon);\n}\n' }, - 'src/tokens/ERC1155/utility/sale/ERC1155Sale.sol': { + 'lib/openzeppelin/contracts/interfaces/draft-IERC1822.sol': { content: - '// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8.19;\n\nimport {\n IERC1155Sale,\n IERC1155SaleFunctions\n} from "@0xsequence/contracts-library/tokens/ERC1155/utility/sale/IERC1155Sale.sol";\nimport {ERC1155Supply} from "@0xsequence/contracts-library/tokens/ERC1155/extensions/supply/ERC1155Supply.sol";\nimport {\n WithdrawControlled,\n AccessControlEnumerable,\n SafeERC20,\n IERC20\n} from "@0xsequence/contracts-library/tokens/common/WithdrawControlled.sol";\nimport {MerkleProofSingleUse} from "@0xsequence/contracts-library/tokens/common/MerkleProofSingleUse.sol";\n\nimport {IERC1155} from "@0xsequence/erc-1155/contracts/interfaces/IERC1155.sol";\nimport {IERC1155SupplyFunctions} from\n "@0xsequence/contracts-library/tokens/ERC1155/extensions/supply/IERC1155Supply.sol";\nimport {IERC1155ItemsFunctions} from "@0xsequence/contracts-library/tokens/ERC1155/presets/items/IERC1155Items.sol";\n\ncontract ERC1155Sale is IERC1155Sale, WithdrawControlled, MerkleProofSingleUse {\n bytes32 internal constant MINT_ADMIN_ROLE = keccak256("MINT_ADMIN_ROLE");\n\n bool private _initialized;\n address private _items;\n\n // ERC20 token address for payment. address(0) indicated payment in ETH.\n address private _paymentToken;\n\n SaleDetails private _globalSaleDetails;\n mapping(uint256 => SaleDetails) private _tokenSaleDetails;\n\n /**\n * Initialize the contract.\n * @param owner Owner address\n * @param items The ERC-1155 Items contract address\n * @dev This should be called immediately after deployment.\n */\n function initialize(address owner, address items) public virtual {\n if (_initialized) {\n revert InvalidInitialization();\n }\n\n _items = items;\n\n _grantRole(DEFAULT_ADMIN_ROLE, owner);\n _grantRole(MINT_ADMIN_ROLE, owner);\n _grantRole(WITHDRAW_ROLE, owner);\n\n _initialized = true;\n }\n\n /**\n * Checks if the current block.timestamp is out of the give timestamp range.\n * @param _startTime Earliest acceptable timestamp (inclusive).\n * @param _endTime Latest acceptable timestamp (exclusive).\n * @dev A zero endTime value is always considered out of bounds.\n */\n function _blockTimeOutOfBounds(uint256 _startTime, uint256 _endTime) private view returns (bool) {\n // 0 end time indicates inactive sale.\n return _endTime == 0 || block.timestamp < _startTime || block.timestamp >= _endTime; // solhint-disable-line not-rely-on-time\n }\n\n /**\n * Checks the sale is active and takes payment.\n * @param _tokenIds Token IDs to mint.\n * @param _amounts Amounts of tokens to mint.\n * @param _expectedPaymentToken ERC20 token address to accept payment in. address(0) indicates ETH.\n * @param _maxTotal Maximum amount of payment tokens.\n * @param _proof Merkle proof for allowlist minting.\n */\n function _payForActiveMint(\n uint256[] memory _tokenIds,\n uint256[] memory _amounts,\n address _expectedPaymentToken,\n uint256 _maxTotal,\n bytes32[] calldata _proof\n )\n private\n {\n uint256 lastTokenId;\n uint256 totalCost;\n uint256 totalAmount;\n\n SaleDetails memory gSaleDetails = _globalSaleDetails;\n bool globalSaleInactive = _blockTimeOutOfBounds(gSaleDetails.startTime, gSaleDetails.endTime);\n bool globalMerkleCheckRequired = false;\n for (uint256 i; i < _tokenIds.length; i++) {\n uint256 tokenId = _tokenIds[i];\n // Test tokenIds ordering\n if (i != 0 && lastTokenId >= tokenId) {\n revert InvalidTokenIds();\n }\n lastTokenId = tokenId;\n\n uint256 amount = _amounts[i];\n\n // Active sale test\n SaleDetails memory saleDetails = _tokenSaleDetails[tokenId];\n bool tokenSaleInactive = _blockTimeOutOfBounds(saleDetails.startTime, saleDetails.endTime);\n if (tokenSaleInactive) {\n // Prefer token sale\n if (globalSaleInactive) {\n // Both sales inactive\n revert SaleInactive(tokenId);\n }\n // Use global sale details\n globalMerkleCheckRequired = true;\n totalCost += gSaleDetails.cost * amount;\n } else {\n // Use token sale details\n requireMerkleProof(saleDetails.merkleRoot, _proof, msg.sender, bytes32(tokenId));\n totalCost += saleDetails.cost * amount;\n }\n totalAmount += amount;\n }\n\n if (globalMerkleCheckRequired) {\n // Check it once outside the loop only when required\n requireMerkleProof(gSaleDetails.merkleRoot, _proof, msg.sender, bytes32(type(uint256).max));\n }\n\n if (_expectedPaymentToken != _paymentToken) {\n // Caller expected different payment token\n revert InsufficientPayment(_paymentToken, totalCost, 0);\n }\n if (_maxTotal < totalCost) {\n // Caller expected to pay less\n revert InsufficientPayment(_expectedPaymentToken, totalCost, _maxTotal);\n }\n if (_expectedPaymentToken == address(0)) {\n // Paid in ETH\n if (msg.value != totalCost) {\n // We expect exact value match\n revert InsufficientPayment(_expectedPaymentToken, totalCost, msg.value);\n }\n } else if (msg.value > 0) {\n // Paid in ERC20, but sent ETH\n revert InsufficientPayment(address(0), 0, msg.value);\n } else {\n // Paid in ERC20\n SafeERC20.safeTransferFrom(IERC20(_expectedPaymentToken), msg.sender, address(this), totalCost);\n }\n }\n\n //\n // Minting\n //\n\n /**\n * Mint tokens.\n * @param to Address to mint tokens to.\n * @param tokenIds Token IDs to mint.\n * @param amounts Amounts of tokens to mint.\n * @param data Data to pass if receiver is contract.\n * @param expectedPaymentToken ERC20 token address to accept payment in. address(0) indicates ETH.\n * @param maxTotal Maximum amount of payment tokens.\n * @param proof Merkle proof for allowlist minting.\n * @notice Sale must be active for all tokens.\n * @dev tokenIds must be sorted ascending without duplicates.\n * @dev An empty proof is supplied when no proof is required.\n */\n function mint(\n address to,\n uint256[] memory tokenIds,\n uint256[] memory amounts,\n bytes memory data,\n address expectedPaymentToken,\n uint256 maxTotal,\n bytes32[] calldata proof\n )\n public\n payable\n {\n _payForActiveMint(tokenIds, amounts, expectedPaymentToken, maxTotal, proof);\n\n IERC1155SupplyFunctions items = IERC1155SupplyFunctions(_items);\n uint256 totalAmount = 0;\n uint256 nMint = tokenIds.length;\n for (uint256 i = 0; i < nMint; i++) {\n // Update storage balance\n uint256 tokenSupplyCap = _tokenSaleDetails[tokenIds[i]].supplyCap;\n if (\n tokenSupplyCap > 0 && items.tokenSupply(tokenIds[i]) + amounts[i] > tokenSupplyCap\n ) {\n revert InsufficientSupply(items.tokenSupply(tokenIds[i]), amounts[i], tokenSupplyCap);\n }\n totalAmount += amounts[i];\n }\n uint256 totalSupplyCap = _globalSaleDetails.supplyCap;\n if (totalSupplyCap > 0 && items.totalSupply() + totalAmount > totalSupplyCap) {\n revert InsufficientSupply(items.totalSupply(), totalAmount, totalSupplyCap);\n }\n\n IERC1155ItemsFunctions(_items).batchMint(to, tokenIds, amounts, data);\n }\n\n //\n // Admin\n //\n\n /**\n * Set the payment token.\n * @param paymentTokenAddr The ERC20 token address to accept payment in. address(0) indicates ETH.\n * @dev This should be set before the sale starts.\n */\n function setPaymentToken(address paymentTokenAddr) public onlyRole(MINT_ADMIN_ROLE) {\n _paymentToken = paymentTokenAddr;\n }\n\n /**\n * Set the global sale details.\n * @param cost The amount of payment tokens to accept for each token minted.\n * @param supplyCap The maximum number of tokens that can be minted.\n * @param startTime The start time of the sale. Tokens cannot be minted before this time.\n * @param endTime The end time of the sale. Tokens cannot be minted after this time.\n * @param merkleRoot The merkle root for allowlist minting.\n * @dev A zero end time indicates an inactive sale.\n * @notice The payment token is set globally.\n */\n function setGlobalSaleDetails(\n uint256 cost,\n uint256 supplyCap,\n uint64 startTime,\n uint64 endTime,\n bytes32 merkleRoot\n )\n public\n onlyRole(MINT_ADMIN_ROLE)\n {\n // solhint-disable-next-line not-rely-on-time\n if (endTime < startTime || endTime <= block.timestamp) {\n revert InvalidSaleDetails();\n }\n _globalSaleDetails = SaleDetails(cost, supplyCap, startTime, endTime, merkleRoot);\n emit GlobalSaleDetailsUpdated(cost, supplyCap, startTime, endTime, merkleRoot);\n }\n\n /**\n * Set the sale details for an individual token.\n * @param tokenId The token ID to set the sale details for.\n * @param cost The amount of payment tokens to accept for each token minted.\n * @param supplyCap The maximum number of tokens that can be minted.\n * @param startTime The start time of the sale. Tokens cannot be minted before this time.\n * @param endTime The end time of the sale. Tokens cannot be minted after this time.\n * @param merkleRoot The merkle root for allowlist minting.\n * @dev A zero end time indicates an inactive sale.\n * @notice The payment token is set globally.\n */\n function setTokenSaleDetails(\n uint256 tokenId,\n uint256 cost,\n uint256 supplyCap,\n uint64 startTime,\n uint64 endTime,\n bytes32 merkleRoot\n )\n public\n onlyRole(MINT_ADMIN_ROLE)\n {\n // solhint-disable-next-line not-rely-on-time\n if (endTime < startTime || endTime <= block.timestamp) {\n revert InvalidSaleDetails();\n }\n _tokenSaleDetails[tokenId] = SaleDetails(cost, supplyCap, startTime, endTime, merkleRoot);\n emit TokenSaleDetailsUpdated(tokenId, cost, supplyCap, startTime, endTime, merkleRoot);\n }\n\n //\n // Views\n //\n\n /**\n * Get global sales details.\n * @return Sale details.\n * @notice Global sales details apply to all tokens.\n * @notice Global sales details are overriden when token sale is active.\n */\n function globalSaleDetails() external view returns (SaleDetails memory) {\n return _globalSaleDetails;\n }\n\n /**\n * Get token sale details.\n * @param tokenId Token ID to get sale details for.\n * @return Sale details.\n * @notice Token sale details override global sale details.\n */\n function tokenSaleDetails(uint256 tokenId) external view returns (SaleDetails memory) {\n return _tokenSaleDetails[tokenId];\n }\n\n /**\n * Get payment token.\n * @return Payment token address.\n * @notice address(0) indicates payment in ETH.\n */\n function paymentToken() external view returns (address) {\n return _paymentToken;\n }\n\n /**\n * Check interface support.\n * @param interfaceId Interface id\n * @return True if supported\n */\n function supportsInterface(bytes4 interfaceId)\n public\n view\n virtual\n override (AccessControlEnumerable)\n returns (bool)\n {\n return type(IERC1155SaleFunctions).interfaceId == interfaceId || super.supportsInterface(interfaceId);\n }\n}\n' + '// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (interfaces/draft-IERC1822.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev ERC1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified\n * proxy whose upgrades are fully controlled by the current implementation.\n */\ninterface IERC1822Proxiable {\n /**\n * @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation\n * address.\n *\n * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks\n * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this\n * function revert if invoked through a proxy.\n */\n function proxiableUUID() external view returns (bytes32);\n}\n' }, - 'src/tokens/ERC1155/utility/sale/ERC1155SaleFactory.sol': { + 'lib/openzeppelin/contracts/utils/StorageSlot.sol': { content: - '// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8.19;\n\nimport {ERC1155Sale} from "@0xsequence/contracts-library/tokens/ERC1155/utility/sale/ERC1155Sale.sol";\nimport {IERC1155SaleFactory, IERC1155SaleFactoryFunctions} from "@0xsequence/contracts-library/tokens/ERC1155/utility/sale/IERC1155SaleFactory.sol";\nimport {SequenceProxyFactory} from "@0xsequence/contracts-library/proxies/SequenceProxyFactory.sol";\n\n/**\n * Deployer of ERC-1155 Sale proxies.\n */\ncontract ERC1155SaleFactory is IERC1155SaleFactory, SequenceProxyFactory {\n /**\n * Creates an ERC-1155 Sale Factory.\n * @param factoryOwner The owner of the ERC-1155 Sale Factory\n */\n constructor(address factoryOwner) {\n ERC1155Sale impl = new ERC1155Sale();\n SequenceProxyFactory._initialize(address(impl), factoryOwner);\n }\n\n /// @inheritdoc IERC1155SaleFactoryFunctions\n function deploy(address proxyOwner, address tokenOwner, address items) external returns (address proxyAddr) {\n bytes32 salt = keccak256(abi.encode(tokenOwner, items));\n proxyAddr = _createProxy(salt, proxyOwner, "");\n ERC1155Sale(proxyAddr).initialize(tokenOwner, items);\n emit ERC1155SaleDeployed(proxyAddr);\n return proxyAddr;\n }\n\n /// @inheritdoc IERC1155SaleFactoryFunctions\n function determineAddress(address proxyOwner, address tokenOwner, address items) external view returns (address proxyAddr) {\n bytes32 salt = keccak256(abi.encode(tokenOwner, items));\n return _computeProxyAddress(salt, proxyOwner, "");\n }\n}\n' + '// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/StorageSlot.sol)\n// This file was procedurally generated from scripts/generate/templates/StorageSlot.js.\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Library for reading and writing primitive types to specific storage slots.\n *\n * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.\n * This library helps with reading and writing to such slots without the need for inline assembly.\n *\n * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.\n *\n * Example usage to set ERC1967 implementation slot:\n * ```solidity\n * contract ERC1967 {\n * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\n *\n * function _getImplementation() internal view returns (address) {\n * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\n * }\n *\n * function _setImplementation(address newImplementation) internal {\n * require(Address.isContract(newImplementation), "ERC1967: new implementation is not a contract");\n * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\n * }\n * }\n * ```\n *\n * _Available since v4.1 for `address`, `bool`, `bytes32`, `uint256`._\n * _Available since v4.9 for `string`, `bytes`._\n */\nlibrary StorageSlot {\n struct AddressSlot {\n address value;\n }\n\n struct BooleanSlot {\n bool value;\n }\n\n struct Bytes32Slot {\n bytes32 value;\n }\n\n struct Uint256Slot {\n uint256 value;\n }\n\n struct StringSlot {\n string value;\n }\n\n struct BytesSlot {\n bytes value;\n }\n\n /**\n * @dev Returns an `AddressSlot` with member `value` located at `slot`.\n */\n function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `BooleanSlot` with member `value` located at `slot`.\n */\n function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.\n */\n function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `Uint256Slot` with member `value` located at `slot`.\n */\n function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `StringSlot` with member `value` located at `slot`.\n */\n function getStringSlot(bytes32 slot) internal pure returns (StringSlot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `StringSlot` representation of the string storage pointer `store`.\n */\n function getStringSlot(string storage store) internal pure returns (StringSlot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := store.slot\n }\n }\n\n /**\n * @dev Returns an `BytesSlot` with member `value` located at `slot`.\n */\n function getBytesSlot(bytes32 slot) internal pure returns (BytesSlot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `BytesSlot` representation of the bytes storage pointer `store`.\n */\n function getBytesSlot(bytes storage store) internal pure returns (BytesSlot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := store.slot\n }\n }\n}\n' }, - 'src/tokens/ERC1155/utility/sale/IERC1155Sale.sol': { + 'lib/openzeppelin/contracts/access/IAccessControl.sol': { content: - '// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8.19;\n\ninterface IERC1155SaleFunctions {\n\n struct SaleDetails {\n uint256 cost;\n uint256 supplyCap; // 0 supply cap indicates unlimited supply\n uint64 startTime;\n uint64 endTime; // 0 end time indicates sale inactive\n bytes32 merkleRoot; // Root of allowed addresses\n }\n\n /**\n * Get global sales details.\n * @return Sale details.\n * @notice Global sales details apply to all tokens.\n * @notice Global sales details are overriden when token sale is active.\n */\n function globalSaleDetails() external returns (SaleDetails memory);\n\n /**\n * Get token sale details.\n * @param tokenId Token ID to get sale details for.\n * @return Sale details.\n * @notice Token sale details override global sale details.\n */\n function tokenSaleDetails(uint256 tokenId) external returns (SaleDetails memory);\n\n /**\n * Get payment token.\n * @return Payment token address.\n * @notice address(0) indicates payment in ETH.\n */\n function paymentToken() external returns (address);\n\n /**\n * Mint tokens.\n * @param to Address to mint tokens to.\n * @param tokenIds Token IDs to mint.\n * @param amounts Amounts of tokens to mint.\n * @param data Data to pass if receiver is contract.\n * @param paymentToken ERC20 token address to accept payment in. address(0) indicates ETH.\n * @param maxTotal Maximum amount of payment tokens.\n * @param proof Merkle proof for allowlist minting.\n * @notice Sale must be active for all tokens.\n * @dev tokenIds must be sorted ascending without duplicates.\n * @dev An empty proof is supplied when no proof is required.\n */\n function mint(\n address to,\n uint256[] memory tokenIds,\n uint256[] memory amounts,\n bytes memory data,\n address paymentToken,\n uint256 maxTotal,\n bytes32[] calldata proof\n )\n external\n payable;\n}\n\ninterface IERC1155SaleSignals {\n\n event GlobalSaleDetailsUpdated(uint256 cost, uint256 supplyCap, uint64 startTime, uint64 endTime, bytes32 merkleRoot);\n event TokenSaleDetailsUpdated(uint256 tokenId, uint256 cost, uint256 supplyCap, uint64 startTime, uint64 endTime, bytes32 merkleRoot);\n\n /**\n * Contract already initialized.\n */\n error InvalidInitialization();\n\n /**\n * Sale details supplied are invalid.\n */\n error InvalidSaleDetails();\n\n /**\n * Sale is not active globally.\n */\n error GlobalSaleInactive();\n\n /**\n * Sale is not active.\n * @param tokenId Invalid Token ID.\n */\n error SaleInactive(uint256 tokenId);\n\n /**\n * Insufficient tokens for payment.\n * @param currency Currency address. address(0) indicates ETH.\n * @param expected Expected amount of tokens.\n * @param actual Actual amount of tokens.\n */\n error InsufficientPayment(address currency, uint256 expected, uint256 actual);\n\n /**\n * Invalid token IDs.\n */\n error InvalidTokenIds();\n\n /**\n * Insufficient supply of tokens.\n */\n error InsufficientSupply(uint256 currentSupply, uint256 requestedAmount, uint256 maxSupply);\n}\n\ninterface IERC1155Sale is IERC1155SaleFunctions, IERC1155SaleSignals {}\n' + "// 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" }, - 'src/tokens/ERC1155/utility/sale/IERC1155SaleFactory.sol': { + 'lib/openzeppelin/contracts/utils/Strings.sol': { content: - '// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8.19;\n\ninterface IERC1155SaleFactoryFunctions {\n /**\n * Creates an ERC-1155 Sale proxy contract\n * @param proxyOwner The owner of the ERC-1155 Sale proxy\n * @param tokenOwner The owner of the ERC-1155 Sale implementation\n * @param items The ERC-1155 Items contract address\n * @return proxyAddr The address of the ERC-1155 Sale Proxy\n * @notice The deployed contract must be granted the MINTER_ROLE on the ERC-1155 Items contract.\n */\n function deploy(address proxyOwner, address tokenOwner, address items) external returns (address proxyAddr);\n\n /**\n * Computes the address of a proxy instance.\n * @param proxyOwner The owner of the ERC-1155 Sale proxy\n * @param tokenOwner The owner of the ERC-1155 Sale implementation\n * @param items The ERC-1155 Items contract address\n * @return proxyAddr The address of the ERC-1155 Sale Proxy\n */\n function determineAddress(address proxyOwner, address tokenOwner, address items) external returns (address proxyAddr);\n}\n\ninterface IERC1155SaleFactorySignals {\n /**\n * Event emitted when a new ERC-1155 Sale proxy contract is deployed.\n * @param proxyAddr The address of the deployed proxy.\n */\n event ERC1155SaleDeployed(address proxyAddr);\n}\n\ninterface IERC1155SaleFactory is IERC1155SaleFactoryFunctions, IERC1155SaleFactorySignals {}\n' + '// 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' }, - 'src/tokens/common/IMerkleProofSingleUse.sol': { + 'lib/openzeppelin/contracts/utils/introspection/ERC165.sol': { content: - '// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8.19;\n\ninterface IMerkleProofSingleUseFunctions {\n /**\n * Checks if the given merkle proof is valid.\n * @param root Merkle root.\n * @param proof Merkle proof.\n * @param addr Address to check.\n * @param salt Salt used to generate the merkle leaf.\n * @return True if the proof is valid and has not yet been used by {addr}.\n */\n function checkMerkleProof(bytes32 root, bytes32[] calldata proof, address addr, bytes32 salt)\n external\n view\n returns (bool);\n}\n\ninterface IMerkleProofSingleUseSignals {\n /**\n * Thrown when the merkle proof is invalid or has already been used.\n * @param root Merkle root.\n * @param proof Merkle proof.\n * @param addr Address to check.\n * @param salt Salt used to generate the merkle leaf.\n */\n error MerkleProofInvalid(bytes32 root, bytes32[] proof, address addr, bytes32 salt);\n}\n\ninterface IMerkleProofSingleUse is IMerkleProofSingleUseFunctions, IMerkleProofSingleUseSignals {}\n' + '// 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' }, - 'src/tokens/common/IWithdrawControlled.sol': { + 'lib/openzeppelin/contracts/utils/math/Math.sol': { content: - '// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8.19;\n\ninterface IWithdrawControlledFunctions {\n\n /**\n * Withdraws ERC20 tokens owned by this contract.\n * @param token The ERC20 token address.\n * @param to Address to withdraw to.\n * @param value Amount to withdraw.\n */\n function withdrawERC20(address token, address to, uint256 value) external;\n\n /**\n * Withdraws ETH owned by this sale contract.\n * @param to Address to withdraw to.\n * @param value Amount to withdraw.\n */\n function withdrawETH(address to, uint256 value) external;\n}\n\ninterface IWithdrawControlledSignals {\n\n /**\n * Withdraw failed error.\n */\n error WithdrawFailed();\n}\n\ninterface IWithdrawControlled is IWithdrawControlledFunctions, IWithdrawControlledSignals {}\n' + '// 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' }, - 'src/tokens/common/MerkleProofSingleUse.sol': { + 'lib/openzeppelin/contracts/utils/math/SignedMath.sol': { content: - '// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8.19;\n\nimport {IMerkleProofSingleUse} from "@0xsequence/contracts-library/tokens/common/IMerkleProofSingleUse.sol";\nimport {MerkleProof} from "@openzeppelin/contracts/utils/cryptography/MerkleProof.sol";\n\n/**\n * Require single use merkle proofs per address.\n */\nabstract contract MerkleProofSingleUse is IMerkleProofSingleUse {\n // Stores proofs used by an address\n mapping(address => mapping(bytes32 => bool)) private _proofUsed;\n\n /**\n * Requires the given merkle proof to be valid.\n * @param root Merkle root.\n * @param proof Merkle proof.\n * @param addr Address to check.\n * @param salt Salt used to generate the merkle leaf.\n * @notice Fails when the proof is invalid or the proof has already been claimed by this address.\n * @dev This function reverts on failure.\n */\n function requireMerkleProof(bytes32 root, bytes32[] calldata proof, address addr, bytes32 salt) internal {\n if (root != bytes32(0)) {\n if (!checkMerkleProof(root, proof, addr, salt)) {\n revert MerkleProofInvalid(root, proof, addr, salt);\n }\n _proofUsed[addr][root] = true;\n }\n }\n\n /**\n * Checks if the given merkle proof is valid.\n * @param root Merkle root.\n * @param proof Merkle proof.\n * @param addr Address to check.\n * @param salt Salt used to generate the merkle leaf.\n * @return True if the proof is valid and has not yet been used by {addr}.\n */\n function checkMerkleProof(bytes32 root, bytes32[] calldata proof, address addr, bytes32 salt)\n public\n view\n returns (bool)\n {\n return !_proofUsed[addr][root] && MerkleProof.verify(proof, root, keccak256(abi.encodePacked(addr, salt)));\n }\n}\n' + '// 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' }, - 'src/tokens/common/WithdrawControlled.sol': { + 'lib/openzeppelin/contracts/utils/introspection/IERC165.sol': { content: - '// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8.19;\n\nimport {IWithdrawControlled} from "@0xsequence/contracts-library/tokens/common/IWithdrawControlled.sol";\nimport {SafeERC20, IERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";\nimport {AccessControlEnumerable} from "@openzeppelin/contracts/access/AccessControlEnumerable.sol";\n\n/**\n * An abstract contract that allows ETH and ERC20 tokens stored in the contract to be withdrawn.\n */\nabstract contract WithdrawControlled is AccessControlEnumerable, IWithdrawControlled {\n bytes32 internal constant WITHDRAW_ROLE = keccak256("WITHDRAW_ROLE");\n\n //\n // Withdraw\n //\n\n /**\n * Withdraws ERC20 tokens owned by this contract.\n * @param token The ERC20 token address.\n * @param to Address to withdraw to.\n * @param value Amount to withdraw.\n * @notice Only callable by an address with the withdraw role.\n */\n function withdrawERC20(address token, address to, uint256 value) public onlyRole(WITHDRAW_ROLE) {\n SafeERC20.safeTransfer(IERC20(token), to, value);\n }\n\n /**\n * Withdraws ETH owned by this sale contract.\n * @param to Address to withdraw to.\n * @param value Amount to withdraw.\n * @notice Only callable by an address with the withdraw role.\n */\n function withdrawETH(address to, uint256 value) public onlyRole(WITHDRAW_ROLE) {\n (bool success,) = to.call{value: value}("");\n if (!success) {\n revert WithdrawFailed();\n }\n }\n}\n' + '// 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' } }, settings: { evmVersion: 'paris', libraries: {}, - metadata: { bytecodeHash: 'ipfs' }, + metadata: { + useLiteralContent: true, + bytecodeHash: 'ipfs', + appendCBOR: true + }, optimizer: { enabled: true, runs: 20000 }, remappings: [ - '0xsequence/=lib/0xsequence/', '@0xsequence/contracts-library/=src/', - '@0xsequence/erc-1155/=lib/0xsequence/erc-1155/src/', - '@0xsequence/erc20-meta-token/=lib/0xsequence/erc20-meta-token/src/', - '@openzeppelin/=lib/openzeppelin/', - 'chiru-labs/=lib/chiru-labs/', 'ds-test/=lib/forge-std/lib/ds-test/src/', - 'erc721a-upgradeable/=lib/chiru-labs/erc721a-upgradeable/', - 'erc721a/=lib/chiru-labs/erc721a/', 'forge-std/=lib/forge-std/src/', 'murky/=lib/murky/src/', + '@0xsequence/erc20-meta-token/=lib/0xsequence/erc20-meta-token/src/', + '@0xsequence/erc-1155/=lib/0xsequence/erc-1155/src/', + 'erc721a/=lib/chiru-labs/erc721a/', + 'erc721a-upgradeable/=lib/chiru-labs/erc721a-upgradeable/', + '@openzeppelin/=lib/openzeppelin/', + '@openzeppelin-upgradeable/=lib/openzeppelin-contracts-upgradeable/', + 'solady/=lib/solady/src/', + '0xsequence/=lib/0xsequence/', + 'chiru-labs/=lib/chiru-labs/', + 'erc4626-tests/=lib/openzeppelin/lib/erc4626-tests/', + 'openzeppelin-contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/', 'openzeppelin-contracts/=lib/murky/lib/openzeppelin-contracts/', - 'openzeppelin/=lib/openzeppelin/', - 'solady/=lib/solady/src/' + 'openzeppelin/=lib/openzeppelin/' ], viaIR: true, outputSelection: { diff --git a/scripts/factories/token_library/ERC721SaleFactory.ts b/scripts/factories/token_library/ERC721SaleFactory.ts index 2e4a7dc..2e416c4 100644 --- a/scripts/factories/token_library/ERC721SaleFactory.ts +++ b/scripts/factories/token_library/ERC721SaleFactory.ts @@ -1,114 +1,168 @@ import { ContractFactory, type ethers } from 'ethers' import type { VerificationRequest } from 'scripts/types' -// https://github.com/0xsequence/contracts-library/blob/1c25713588271180f077185cc78afd403df0c094/src/tokens/ERC721/utility/sale/ERC721SaleFactory.sol +// https://github.com/0xsequence/contracts-library/blob/ead1baf34270c76260d01cfc130bb7cc9d57518e/src/tokens/ERC721/utility/sale/ERC721SaleFactory.sol const abi = [ { - type: 'constructor', - inputs: [{ name: 'factoryOwner', type: 'address', internalType: 'address' }], - stateMutability: 'nonpayable' - }, - { - type: 'function', - name: 'beacon', - inputs: [], - outputs: [ + inputs: [ { - name: '', - type: 'address', - internalType: 'contract UpgradeableBeacon' + internalType: 'address', + name: 'factoryOwner', + type: 'address' } ], - stateMutability: 'view' + stateMutability: 'nonpayable', + type: 'constructor' }, { - type: 'function', - name: 'deploy', + anonymous: false, inputs: [ - { name: 'proxyOwner', type: 'address', internalType: 'address' }, - { name: 'tokenOwner', type: 'address', internalType: 'address' }, - { name: 'items', type: 'address', internalType: 'address' } + { + indexed: false, + internalType: 'address', + name: 'proxyAddr', + type: 'address' + } ], - outputs: [{ name: 'proxyAddr', type: 'address', internalType: 'address' }], - stateMutability: 'nonpayable' + name: 'ERC721SaleDeployed', + type: 'event' }, { - type: 'function', - name: 'determineAddress', + anonymous: false, inputs: [ - { name: 'proxyOwner', type: 'address', internalType: 'address' }, - { name: 'tokenOwner', type: 'address', internalType: 'address' }, - { name: 'items', type: 'address', internalType: 'address' } + { + indexed: true, + internalType: 'address', + name: 'previousOwner', + type: 'address' + }, + { + indexed: true, + internalType: 'address', + name: 'newOwner', + type: 'address' + } ], - outputs: [{ name: 'proxyAddr', type: 'address', internalType: 'address' }], - stateMutability: 'view' + name: 'OwnershipTransferred', + type: 'event' }, { - type: 'function', - name: 'owner', inputs: [], - outputs: [{ name: '', type: 'address', internalType: 'address' }], - stateMutability: 'view' + name: 'beacon', + outputs: [ + { + internalType: 'contract UpgradeableBeacon', + name: '', + type: 'address' + } + ], + stateMutability: 'view', + type: 'function' }, { - type: 'function', - name: 'renounceOwnership', - inputs: [], - outputs: [], - stateMutability: 'nonpayable' + inputs: [ + { + internalType: 'address', + name: 'proxyOwner', + type: 'address' + }, + { + internalType: 'address', + name: 'tokenOwner', + type: 'address' + }, + { + internalType: 'address', + name: 'items', + type: 'address' + } + ], + name: 'deploy', + outputs: [ + { + internalType: 'address', + name: 'proxyAddr', + type: 'address' + } + ], + stateMutability: 'nonpayable', + type: 'function' }, { - type: 'function', - name: 'transferOwnership', - inputs: [{ name: 'newOwner', type: 'address', internalType: 'address' }], - outputs: [], - stateMutability: 'nonpayable' + inputs: [ + { + internalType: 'address', + name: 'proxyOwner', + type: 'address' + }, + { + internalType: 'address', + name: 'tokenOwner', + type: 'address' + }, + { + internalType: 'address', + name: 'items', + type: 'address' + } + ], + name: 'determineAddress', + outputs: [ + { + internalType: 'address', + name: 'proxyAddr', + type: 'address' + } + ], + stateMutability: 'view', + type: 'function' }, { - type: 'function', - name: 'upgradeBeacon', - inputs: [ + inputs: [], + name: 'owner', + outputs: [ { - name: 'implementation', - type: 'address', - internalType: 'address' + internalType: 'address', + name: '', + type: 'address' } ], + stateMutability: 'view', + type: 'function' + }, + { + inputs: [], + name: 'renounceOwnership', outputs: [], - stateMutability: 'nonpayable' + stateMutability: 'nonpayable', + type: 'function' }, { - type: 'event', - name: 'ERC721SaleDeployed', inputs: [ { - name: 'proxyAddr', - type: 'address', - indexed: false, - internalType: 'address' + internalType: 'address', + name: 'newOwner', + type: 'address' } ], - anonymous: false + name: 'transferOwnership', + outputs: [], + stateMutability: 'nonpayable', + type: 'function' }, { - type: 'event', - name: 'OwnershipTransferred', inputs: [ { - name: 'previousOwner', - type: 'address', - indexed: true, - internalType: 'address' - }, - { - name: 'newOwner', - type: 'address', - indexed: true, - internalType: 'address' + internalType: 'address', + name: 'implementation', + type: 'address' } ], - anonymous: false + name: 'upgradeBeacon', + outputs: [], + stateMutability: 'nonpayable', + type: 'function' } ] @@ -116,7 +170,7 @@ export class ERC721SaleFactory extends ContractFactory { constructor(signer?: ethers.Signer) { super( abi, - '0x608034610121576001600160401b0390601f61483938819003918201601f191683019291908484118385101761010b57816020928492604096875283398101031261012157516001600160a01b0380821682036101215761005f33610126565b82519361246794858101958187108388111761010b576123d2823980600096039086f0908115610101578451916105ee808401928311848410176100ed5791848492602094611de4853916815203019085f080156100e0576100d39394501660018060a01b03196001541617600155610126565b51611c76908161016e8239f35b50505051903d90823e3d90fd5b634e487b7160e01b88526041600452602488fd5b84513d87823e3d90fd5b634e487b7160e01b600052604160045260246000fd5b600080fd5b600080546001600160a01b039283166001600160a01b03198216811783559216907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09080a356fe6040608081526004908136101561001557600080fd5b600091823560e01c80631bce45831461079057806359659e901461073d578063715018a6146106a05780638da5cb5b1461064b578063d9181cd3146102ee578063e657f693146101aa5763f2fde38b1461006e57600080fd5b346101a65760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126101a6576100a561084f565b906100ae6108bd565b73ffffffffffffffffffffffffffffffffffffffff809216928315610123575050600054827fffffffffffffffffffffffff0000000000000000000000000000000000000000821617600055167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0600080a380f35b90602060849251917f08c379a0000000000000000000000000000000000000000000000000000000008352820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152fd5b8280fd5b8284346102eb5760607ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126102eb57506101e461084f565b906101ed610877565b916055600b6101fa61089a565b845173ffffffffffffffffffffffffffffffffffffffff968716602080830191825292909716604080830191909152815290957fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe09161025a60608261099b565b519020906102ab86519161026d8361097f565b6000835273ffffffffffffffffffffffffffffffffffffffff9661029f8860015416948a519586938d850198896109ff565b0390810183528261099b565b5190206111eb85516102bf8883018261099b565b81815287810191610a5683395190209085519186830152868201523081520160ff815320915191168152f35b80fd5b5090346101a65760607ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126101a65761032761084f565b92610330610877565b61033861089a565b908351946020968787018761037586868490602090939293604083019473ffffffffffffffffffffffffffffffffffffffff809216845216910152565b03976103a77fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0998a810183528261099b565b5190208651916103b68361097f565b6000835273ffffffffffffffffffffffffffffffffffffffff91816103f98c6103ed878d88600154169051958694850197886109ff565b038c810183528261099b565b5190206111eb895161040d8d83018261099b565b8181528c810191610a5683398051156105f057518492918af516988915610594578260015416938a3b156105905791608491601f8a95946104988f8e51998a9889977fcf7a1d77000000000000000000000000000000000000000000000000000000008952168c880152602487015260606044870152825192839182606489015288880191016109dc565b01168101030181838b5af1801561058657908591610572575b5050853b1561056e5784517f485cc95500000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff928316918101918252929091166020820152829082908190604001038183885af1801561056457610550575b50507fe3fc4d8c7984f762222579e0c4564a72a74f96cde3f6bae2751d01108c6ec240838251848152a151908152f35b61055a829161093c565b6102eb5780610520565b83513d84823e3d90fd5b8380fd5b61057b9061093c565b61056e5783386104b1565b86513d87823e3d90fd5b8880fd5b6064858c8b51917f08c379a0000000000000000000000000000000000000000000000000000000008352820152601960248201527f437265617465323a204661696c6564206f6e206465706c6f79000000000000006044820152fd5b6064878e808e51927f08c379a000000000000000000000000000000000000000000000000000000000845283015260248201527f437265617465323a2062797465636f6465206c656e677468206973207a65726f6044820152fd5b50503461069c57817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261069c5773ffffffffffffffffffffffffffffffffffffffff60209254169051908152f35b5080fd5b83346102eb57807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126102eb576106d76108bd565b600073ffffffffffffffffffffffffffffffffffffffff81547fffffffffffffffffffffffff000000000000000000000000000000000000000081168355167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08280a380f35b50503461069c57817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261069c5760209073ffffffffffffffffffffffffffffffffffffffff600154169051908152f35b5090346101a65760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126101a657826107ca61084f565b6107d26108bd565b73ffffffffffffffffffffffffffffffffffffffff90816001541690813b1561056e5783602492865197889586947f3659cfe600000000000000000000000000000000000000000000000000000000865216908401525af1908115610846575061083a575080f35b6108439061093c565b80f35b513d84823e3d90fd5b6004359073ffffffffffffffffffffffffffffffffffffffff8216820361087257565b600080fd5b6024359073ffffffffffffffffffffffffffffffffffffffff8216820361087257565b6044359073ffffffffffffffffffffffffffffffffffffffff8216820361087257565b73ffffffffffffffffffffffffffffffffffffffff6000541633036108de57565b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602060248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152fd5b67ffffffffffffffff811161095057604052565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6020810190811067ffffffffffffffff82111761095057604052565b90601f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0910116810190811067ffffffffffffffff82111761095057604052565b60005b8381106109ef5750506000910152565b81810151838201526020016109df565b9190926048949383527fffffffffffffffffffffffffffffffffffffffff000000000000000000000000809260601b16602084015260601b166034820152610a5082518093602086850191016109dc565b01019056fe60808060405234610016576111cf908161001c8239f35b600080fdfe604060808152366103825773ffffffffffffffffffffffffffffffffffffffff807fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035416158015610b94576000917fcf7a1d77000000000000000000000000000000000000000000000000000000007fffffffff00000000000000000000000000000000000000000000000000000000843516146100c057600484517ff92ee8a9000000000000000000000000000000000000000000000000000000008152fd5b6100c8611192565b60049136831161037e5760607ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261037e578235916101088361067f565b602435926101158461067f565b60443567ffffffffffffffff811161037a57610135839136908801610789565b941692156103525761014791166107e3565b803b156102cf578451907f5c60da1b000000000000000000000000000000000000000000000000000000009384835260209687848381865afa9384156102a657889461019d9189916102b2575b503b1515610926565b7fa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d5080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff85161790555194827f1cf3b03a6cf19fa2baba4df148e9dcabedea7f8a5c07840e207e5c089be95d3e8880a28451158015906102ab575b610242575b8361023c6107d0565b80519101f35b8592839182525afa9182156102a65761026a9392610277575b506102646109b1565b91610a21565b5038808083818080610233565b610298919250843d861161029f575b610290818361070e565b810190610902565b903861025b565b503d610286565b61091a565b508661022e565b6102c99150863d881161029f57610290818361070e565b38610194565b60848360208751917f08c379a0000000000000000000000000000000000000000000000000000000008352820152602560248201527f455243313936373a206e657720626561636f6e206973206e6f74206120636f6e60448201527f74726163740000000000000000000000000000000000000000000000000000006064820152fd5b8487517ff92ee8a9000000000000000000000000000000000000000000000000000000008152fd5b8680fd5b8380fd5b73ffffffffffffffffffffffffffffffffffffffff807fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035416158015610b94576000907fcf7a1d77000000000000000000000000000000000000000000000000000000007fffffffff00000000000000000000000000000000000000000000000000000000833516146104395760046040517ff92ee8a9000000000000000000000000000000000000000000000000000000008152fd5b610441611192565b60049236841161067b5760607ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261067b5783356104808161067f565b6024359161048d8361067f565b60443567ffffffffffffffff8111610677576104ad829136908901610789565b9316931561064e576104bf91166107e3565b813b156105ca576040517f5c60da1b000000000000000000000000000000000000000000000000000000009283825260209586838281855afa9283156102a65787936105149188916105b357503b1515610926565b7fa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d5080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff841617905560405194827f1cf3b03a6cf19fa2baba4df148e9dcabedea7f8a5c07840e207e5c089be95d3e8880a28451158015906102ab57610242578361023c6107d0565b6102c99150853d871161029f57610290818361070e565b6084846020604051917f08c379a0000000000000000000000000000000000000000000000000000000008352820152602560248201527f455243313936373a206e657720626561636f6e206973206e6f74206120636f6e60448201527f74726163740000000000000000000000000000000000000000000000000000006064820152fd5b856040517ff92ee8a9000000000000000000000000000000000000000000000000000000008152fd5b8580fd5b8280fd5b73ffffffffffffffffffffffffffffffffffffffff81160361069d57565b600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6020810190811067ffffffffffffffff8211176106ed57604052565b6106a2565b6040810190811067ffffffffffffffff8211176106ed57604052565b90601f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0910116810190811067ffffffffffffffff8211176106ed57604052565b67ffffffffffffffff81116106ed57601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01660200190565b81601f8201121561069d578035906107a08261074f565b926107ae604051948561070e565b8284526020838301011161069d57816000926020809301838601378301015290565b604051906107dd826106d1565b60008252565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61039081547f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f604080519373ffffffffffffffffffffffffffffffffffffffff9081851686521693846020820152a1811561087e577fffffffffffffffffffffffff000000000000000000000000000000000000000016179055565b60846040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152fd5b9081602091031261069d57516109178161067f565b90565b6040513d6000823e3d90fd5b1561092d57565b60846040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603060248201527f455243313936373a20626561636f6e20696d706c656d656e746174696f6e206960448201527f73206e6f74206120636f6e7472616374000000000000000000000000000000006064820152fd5b604051906060820182811067ffffffffffffffff8211176106ed57604052602782527f206661696c6564000000000000000000000000000000000000000000000000006040837f416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c60208201520152565b6000806109179493602081519101845af43d15610a60573d91610a438361074f565b92610a51604051948561070e565b83523d6000602085013e610acd565b606091610acd565b15610a6f57565b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152fd5b91929015610aed5750815115610ae1575090565b610917903b1515610a68565b825190915015610b005750805190602001fd5b604051907f08c379a000000000000000000000000000000000000000000000000000000000825281602080600483015282519283602484015260005b848110610b7d575050507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f836000604480968601015201168101030190fd5b818101830151868201604401528593508201610b3c565b610bee610bd57fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035473ffffffffffffffffffffffffffffffffffffffff1690565b73ffffffffffffffffffffffffffffffffffffffff1690565b3303610d14576000357fffffffff00000000000000000000000000000000000000000000000000000000167f3659cfe6000000000000000000000000000000000000000000000000000000008103610c515750610c49610f0f565b602081519101f35b7f4f1ef286000000000000000000000000000000000000000000000000000000008103610c865750610c81611083565b610c49565b7f8f283970000000000000000000000000000000000000000000000000000000008103610cb65750610c81610ec5565b7ff851a440000000000000000000000000000000000000000000000000000000008103610ce65750610c81610dfd565b7f5c60da1b0000000000000000000000000000000000000000000000000000000003610d1457610c81610e53565b610d1c610d3b565b6000808092368280378136915af43d82803e15610d37573d90f35b3d90fd5b73ffffffffffffffffffffffffffffffffffffffff807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc541680610df8575060206004917fa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d505416604051928380927f5c60da1b0000000000000000000000000000000000000000000000000000000082525afa9081156102a657600091610de0575090565b610917915060203d811161029f57610290818361070e565b905090565b610e05611192565b73ffffffffffffffffffffffffffffffffffffffff7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103541660405190602082015260208152610917816106f2565b610e5b611192565b610e63610d3b565b73ffffffffffffffffffffffffffffffffffffffff6040519116602082015260208152610917816106f2565b7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc602091011261069d576004356109178161067f565b610ecd611192565b3660041161069d57610efc73ffffffffffffffffffffffffffffffffffffffff610ef636610e8f565b166107e3565b604051610f08816106d1565b6000815290565b610f17611192565b3660041161069d5773ffffffffffffffffffffffffffffffffffffffff610f3d36610e8f565b1660405190610f4b826106d1565b60008252803b15610fff577f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc817fffffffffffffffffffffffff0000000000000000000000000000000000000000825416179055807fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b600080a2815115801590610ff7575b610fe3575b5050604051610f08816106d1565b610fef916102646109b1565b503880610fd5565b506000610fd0565b60846040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201527f6f74206120636f6e7472616374000000000000000000000000000000000000006064820152fd5b3660041161069d5760407ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261069d576004356110c18161067f565b60243567ffffffffffffffff811161069d576110f673ffffffffffffffffffffffffffffffffffffffff913690600401610789565b9116803b15610fff577f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc817fffffffffffffffffffffffff0000000000000000000000000000000000000000825416179055807fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b600080a281511580159061118a57610fe3575050604051610f08816106d1565b506001610fd0565b3461069d5756fea264697066735822122074ad3060f809c0a3b330e975dfd539d895d2c29692fa157860c461b67aa37b9864736f6c63430008130033a26469706673582212208f0170f1bb758527b7f4cdbb1048af235f1f359633ab5ac7dd9ce4dc9483c8c664736f6c6343000813003360803461011a57601f6105ee38819003918201601f19168301916001600160401b0383118484101761011f5780849260209460405283398101031261011a57516001600160a01b03808216919082820361011a576000549160018060a01b0319923384821617600055604051923391167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0600080a33b156100b2575060015416176001556040516104b890816101368239f35b62461bcd60e51b815260206004820152603360248201527f5570677261646561626c65426561636f6e3a20696d706c656d656e746174696f60448201527f6e206973206e6f74206120636f6e7472616374000000000000000000000000006064820152608490fd5b600080fd5b634e487b7160e01b600052604160045260246000fdfe6080604052600436101561001257600080fd5b6000803560e01c80633659cfe6146102ce5780635c60da1b1461027c578063715018a6146101e05780638da5cb5b1461018f5763f2fde38b1461005457600080fd5b3461018c5760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261018c5760043573ffffffffffffffffffffffffffffffffffffffff808216809203610188576100ad610403565b8115610104578254827fffffffffffffffffffffffff00000000000000000000000000000000000000008216178455167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08380a380f35b60846040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152fd5b8280fd5b80fd5b503461018c57807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261018c5773ffffffffffffffffffffffffffffffffffffffff6020915416604051908152f35b503461018c57807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261018c57610217610403565b8073ffffffffffffffffffffffffffffffffffffffff81547fffffffffffffffffffffffff000000000000000000000000000000000000000081168355167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08280a380f35b503461018c57807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261018c57602073ffffffffffffffffffffffffffffffffffffffff60015416604051908152f35b503461018c5760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261018c5760043573ffffffffffffffffffffffffffffffffffffffff81169081810361018857610328610403565b3b1561037f57807fffffffffffffffffffffffff000000000000000000000000000000000000000060015416176001557fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b8280a280f35b60846040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603360248201527f5570677261646561626c65426561636f6e3a20696d706c656d656e746174696f60448201527f6e206973206e6f74206120636f6e7472616374000000000000000000000000006064820152fd5b73ffffffffffffffffffffffffffffffffffffffff60005416330361042457565b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602060248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152fdfea2646970667358221220208419369f26b5959a9a13b662721d5be2985e9cc7d2d9139fa35a2939a96bee64736f6c63430008130033608080604052346100165761244b908161001c8239f35b600080fdfe608060408181526004908136101561001657600080fd5b600092833560e01c90816301ffc9a714611673575080630668d0bb14610f3b578063248a9ca314610f115780632f2ff15d14610e915780633474a4a614610dc057806336568abe14610cf957806344004cc114610c255780634782f77914610bc2578063485cc955146108bf5780638c17030f146104475780639010d07c146103f857806391d14854146103a5578063a217fddf1461038a578063a971e8421461034e578063bad4366114610146578063ca15c8731461011e5763d547741f146100df57600080fd5b3461011a578060031936011261011a57610117913561011260016101016117be565b938387528660205286200154611aab565b611d16565b80f35b8280fd5b50903461011a57602060031936011261011a5760209282913581526001845220549051908152f35b503461011a57608060031936011261011a578135602490813567ffffffffffffffff9586821161034b575061017e90369086016117e1565b949061018861179b565b9573ffffffffffffffffffffffffffffffffffffffff8716600052602097600289528660002085600052895260ff8760002054161597886101cf575b898989519015158152f35b9091929497508695989396517fffffffffffffffffffffffffffffffffffffffff0000000000000000000000008582019260601b16825260643560348201526034815261021b81611c53565b51902090821161031e5760059382851b86519361023a86830186611c8b565b845284840190820191368311610319578590915b8383106103095750505050926000935b82518510156102f25784821b830184015190866000838310156102e55750506000528352846000205b937fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff81146102b8576001019361025e565b886011887f4e487b7100000000000000000000000000000000000000000000000000000000600052526000fd5b9190928252855220610287565b9496955050509450501490388080808080806101c4565b823581529181019186910161024e565b600080fd5b876041877f4e487b7100000000000000000000000000000000000000000000000000000000600052526000fd5b80fd5b83823461038657816003193601126103865760209073ffffffffffffffffffffffffffffffffffffffff60035460081c169051908152f35b5080fd5b83823461038657816003193601126103865751908152602090f35b50903461011a578160031936011261011a5773ffffffffffffffffffffffffffffffffffffffff826020946103d86117be565b93358152808652209116600052825260ff81600020541690519015158152f35b50903461011a578160031936011261011a5761043860209373ffffffffffffffffffffffffffffffffffffffff9235815260018552836024359120611f7e565b92905490519260031b1c168152f35b50903461011a5760c060031936011261011a5780359160249081359061046b61179b565b906064359267ffffffffffffffff9485851694858103610319576084359687168097036103195760a435977f4c02318d8c3aadc98ccf18aebbf3126f651e0c3f6a1de5ff8edcf6724a2ad5c280600052602093600085528660002033600052855260ff87600020541615610628575050868810801561061e575b6105f7579189979593917fabec13ca1773eed55d54d2f64593c33fa520ee45cac73a162f13928a2ebee2339a86948b60a073ffffffffffffffffffffffffffffffffffffffff60c09e9c9a519961053b8b611c08565b858b5288888c0152169889898201528a60608201528b608082015201525582600555847fffffffff000000000000000000000000000000000000000000000000000000007bffffffffffffffff00000000000000000000000000000000000000006006549360a01b1692161717600655857fffffffffffffffffffffffffffffffffffffffffffffffff000000000000000060075416176007558660085582519788528701528501526060840152608083015260a0820152a180f35b84517f85d4a748000000000000000000000000000000000000000000000000000000008152fd5b50428811156104e5565b919450915061063633611e09565b85519161064283611c6f565b604283528483019360603686378351156108925760308553835160019081101561086557607860218601536041905b80821161079d575050610742575061073e938693610710936107016048946106cc9a519a857f416363657373436f6e74726f6c3a206163636f756e74200000000000000000008d978801528251928391603789019101611be5565b8401917f206973206d697373696e6720726f6c6520000000000000000000000000000000603784015251809386840190611be5565b01036028810187520185611c8b565b519283927f08c379a00000000000000000000000000000000000000000000000000000000084528301611ccc565b0390fd5b925050508160649451937f08c379a00000000000000000000000000000000000000000000000000000000085528401528201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152fd5b9091600f81166010811015610838577f3031323334353637383961626364656600000000000000000000000000000000901a6107d98488611dc9565b53881c91801561080b577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0190610671565b8360118a7f4e487b7100000000000000000000000000000000000000000000000000000000600052526000fd5b8460328b7f4e487b7100000000000000000000000000000000000000000000000000000000600052526000fd5b826032897f4e487b7100000000000000000000000000000000000000000000000000000000600052526000fd5b506032867f4e487b7100000000000000000000000000000000000000000000000000000000600052526000fd5b50903461011a578160031936011261011a576108d9611778565b906108e26117be565b6003549160ff8316610b9b5750907fffffffffffffffffffffff0000000000000000000000000000000000000000ff74ffffffffffffffffffffffffffffffffffffffff00610a2c949360081b16911617600355600080526020926000845273ffffffffffffffffffffffffffffffffffffffff8160002092169182600052845260ff81600020541615610b2f575b60008052600184818096526109898484600020611f96565b507f4c02318d8c3aadc98ccf18aebbf3126f651e0c3f6a1de5ff8edcf6724a2ad5c280600052600082528360002085600052825260ff84600020541615610ac4575b6000528181526109de8484600020611f96565b507f5d8e12c39142ff96d79d04d15d1ba1269e4fe57bb9d26f43523628b34ba108ec80600052600082528360002085600052825260ff84600020541615610a59575b60005252600020611f96565b507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00600354161760035580f35b80600052600082528360002085600052825283600020837fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff008254161790553385827f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d600080a4610a20565b80600052600082528360002085600052825283600020837fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff008254161790553385827f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d600080a46109cb565b6000805260008452806000208260005284528060002060017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00825416179055338260007f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d8180a4610971565b84517ff92ee8a9000000000000000000000000000000000000000000000000000000008152fd5b503461011a578060031936011261011a5782808080610bdf611778565b610be7611812565b602435905af1610bf56122f3565b5015610bff578280f35b517f750b219c000000000000000000000000000000000000000000000000000000008152fd5b83823461038657606060031936011261038657610cc773ffffffffffffffffffffffffffffffffffffffff61011792610cf3610c5f611778565b91610c686117be565b90610c71611812565b517fa9059cbb00000000000000000000000000000000000000000000000000000000602082015273ffffffffffffffffffffffffffffffffffffffff909116602482015260448035908201529384906064820190565b037fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08101855284611c8b565b166121b0565b50919034610386578260031936011261038657610d146117be565b903373ffffffffffffffffffffffffffffffffffffffff831603610d3d57906101179135611d16565b60849060208551917f08c379a0000000000000000000000000000000000000000000000000000000008352820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201527f20726f6c657320666f722073656c6600000000000000000000000000000000006064820152fd5b50903461011a578260031936011261011a5760c09260a08351610de281611c08565b82815282602082015282858201528260608201528260808201520152815190610e0a82611c08565b5491828252600554602083019081526006548284019273ffffffffffffffffffffffffffffffffffffffff908183168552606086019167ffffffffffffffff9586809560a01c1684528460075416956080890196875260a060085499019889528351998a525160208a015251169087015251166060850152511660808301525160a0820152f35b503461011a578060031936011261011a57610f0d9135906001610eb26117be565b92808652602090868252610eca838589200154611aab565b806000526000825273ffffffffffffffffffffffffffffffffffffffff8460002095169485600052825260ff84600020541615610a595760005252600020611f96565b5080f35b50903461011a57602060031936011261011a57816020936001923581528085522001549051908152f35b5060a060031936011261011a57610f50611778565b91610f5961179b565b9067ffffffffffffffff60843581811161166f57610f7a90369084016117e1565b600354908651927f18160ddd0000000000000000000000000000000000000000000000000000000084526020938481888173ffffffffffffffffffffffffffffffffffffffff809860081c165afa908115611665578b91611634575b50865490811515806115f4575b6115b75750508460065460a01c16856007541680159182156115ad575b5081156115a2575b5061157a57600854918261131a575b505050600554602495863593848302928084048614901517156112ef578360065416848316908082036112b5575060643584811061125a5750806111815750508134036111255750509087915b60035460081c16803b1561011a576110cd97838851809a819582947f40c10f190000000000000000000000000000000000000000000000000000000084528a84016020909392919373ffffffffffffffffffffffffffffffffffffffff60408201951681520152565b03925af1801561111b576110df578580f35b84116110f15750505238808080808580f35b604185917f4e487b7100000000000000000000000000000000000000000000000000000000835252fd5b84513d88823e3d90fd5b61073e8689519384937f1eabcfbe0000000000000000000000000000000000000000000000000000000085523492850160409194939273ffffffffffffffffffffffffffffffffffffffff606083019616825260208201520152565b989a96999698909290915034156111cc5760648a8a8a818f51937f1eabcfbe000000000000000000000000000000000000000000000000000000008552840152820152346044820152fd5b7f23b872dd000000000000000000000000000000000000000000000000000000008b999b9a979a5193840152338884015230604484015260648301526064825260a082018281108682111761122f5788528993929161122a916121b0565b611064565b878b6041897f4e487b7100000000000000000000000000000000000000000000000000000000835252fd5b8a517f1eabcfbe00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8516818b019081526020810187905260408101929092529081906060010390fd5b888d868c6064948f51947f1eabcfbe0000000000000000000000000000000000000000000000000000000086528501528301526044820152fd5b878b6011897f4e487b7100000000000000000000000000000000000000000000000000000000835252fd5b338b5260028552888b20838c52855260ff898c2054161580611403575b1561138157505033895260028352868920908952825285882060017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00825416179055388080611017565b8a9087938a51947f265c66a8000000000000000000000000000000000000000000000000000000008652850152608060248501528060848501527f07ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff81116103865791839160a49360051b80928585013733604484015260648301528101030190fd5b50999892889792949591969851868101907fffffffffffffffffffffffffffffffffffffffff0000000000000000000000003360601b1682528b60348201526034815261144f81611c53565b51902094828c1161154e5788519560059594939291908d871b8e6114758b83018b611c8b565b89528a0189890136821161154a578a8c915b83831061153a5750505050988c995b88518b1015611523578a881b89018a0151908e82821015611515575289528a8d205b997fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff81146114e95760010199611496565b60248e60118f7f4e487b7100000000000000000000000000000000000000000000000000000000835252fd5b9190915289528a8d206114b8565b91959c9d9398975093999a98508491955014611337565b82358152918101918c9101611487565b8e80fd5b60248b60418c7f4e487b7100000000000000000000000000000000000000000000000000000000835252fd5b8588517f3f886774000000000000000000000000000000000000000000000000000000008152fd5b905042101538611008565b4210915038611000565b60649188918b51927fa922783000000000000000000000000000000000000000000000000000000000845283015260243560248301526044820152fd5b506024358101808211611608578210610fe3565b60248d60118b7f4e487b7100000000000000000000000000000000000000000000000000000000835252fd5b90508481813d831161165e575b61164b8183611c8b565b8101031261165a575138610fd6565b8a80fd5b503d611641565b89513d8d823e3d90fd5b8680fd5b8490843461011a57602060031936011261011a57357fffffffff00000000000000000000000000000000000000000000000000000000811680910361011a57602092507fbe0b77120000000000000000000000000000000000000000000000000000000081149081156116e8575b5015158152f35b7f5a05180f0000000000000000000000000000000000000000000000000000000081149150811561171b575b50836116e1565b7f7965db0b0000000000000000000000000000000000000000000000000000000081149150811561174e575b5083611714565b7f01ffc9a70000000000000000000000000000000000000000000000000000000091501483611747565b6004359073ffffffffffffffffffffffffffffffffffffffff8216820361031957565b6044359073ffffffffffffffffffffffffffffffffffffffff8216820361031957565b6024359073ffffffffffffffffffffffffffffffffffffffff8216820361031957565b9181601f840112156103195782359167ffffffffffffffff8311610319576020808501948460051b01011161031957565b3360009081527f20be27040b8e00df40bca0df34743417f3574a156386188f7d7f14369e5ee82b60209081526040808320549092907f5d8e12c39142ff96d79d04d15d1ba1269e4fe57bb9d26f43523628b34ba108ec9060ff16156118775750505050565b61188033611e09565b84519161188c83611c6f565b60428352848301936060368637835115611a7e5760308553835190600191821015611a7e5790607860218601536041915b8183116119b357505050611957576106cc9385936119279361191860489461073e995198857f416363657373436f6e74726f6c3a206163636f756e74200000000000000000008b978801528251928391603789019101611be5565b01036028810185520183611c8b565b519182917f08c379a000000000000000000000000000000000000000000000000000000000835260048301611ccc565b6064848651907f08c379a000000000000000000000000000000000000000000000000000000000825280600483015260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152fd5b909192600f81166010811015611a51577f3031323334353637383961626364656600000000000000000000000000000000901a6119f08588611dc9565b5360041c928015611a24577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0191906118bd565b6024827f4e487b710000000000000000000000000000000000000000000000000000000081526011600452fd5b6024837f4e487b710000000000000000000000000000000000000000000000000000000081526032600452fd5b807f4e487b7100000000000000000000000000000000000000000000000000000000602492526032600452fd5b6000818152602090808252604092838220338352835260ff848320541615611ad35750505050565b611adc33611e09565b845191611ae883611c6f565b60428352848301936060368637835115611a7e5760308553835190600191821015611a7e5790607860218601536041915b818311611b7457505050611957576106cc9385936119279361191860489461073e995198857f416363657373436f6e74726f6c3a206163636f756e74200000000000000000008b978801528251928391603789019101611be5565b909192600f81166010811015611a51577f3031323334353637383961626364656600000000000000000000000000000000901a611bb18588611dc9565b5360041c928015611a24577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff019190611b19565b60005b838110611bf85750506000910152565b8181015183820152602001611be8565b60c0810190811067ffffffffffffffff821117611c2457604052565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6060810190811067ffffffffffffffff821117611c2457604052565b6080810190811067ffffffffffffffff821117611c2457604052565b90601f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0910116810190811067ffffffffffffffff821117611c2457604052565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f60409360208452611d0f8151809281602088015260208888019101611be5565b0116010190565b906040611d61926000908082528160205273ffffffffffffffffffffffffffffffffffffffff83832094169384835260205260ff8383205416611d64575b8152600160205220612057565b50565b808252816020528282208483526020528282207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0081541690553384827ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b8580a4611d54565b908151811015611dda570160200190565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60405190611e1682611c53565b602a8252602082016040368237825115611dda57603090538151600190811015611dda57607860218401536029905b808211611eb3575050611e555790565b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602060248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152fd5b9091600f81166010811015611f50577f3031323334353637383961626364656600000000000000000000000000000000901a611eef8486611dc9565b5360041c918015611f22577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0190611e45565b602460007f4e487b710000000000000000000000000000000000000000000000000000000081526011600452fd5b602460007f4e487b710000000000000000000000000000000000000000000000000000000081526032600452fd5b8054821015611dda5760005260206000200190600090565b9190600183016000908282528060205260408220541560001461205157845494680100000000000000008610156120245783612014611fdf886001604098999a01855584611f7e565b81939154907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff9060031b92831b921b19161790565b9055549382526020522055600190565b6024837f4e487b710000000000000000000000000000000000000000000000000000000081526041600452fd5b50925050565b906001820190600092818452826020526040842054908115156000146121a9577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff9182810181811161217c5782549084820191821161214f5780820361211a575b505050805480156120ed578201916120d08383611f7e565b909182549160031b1b191690555582526020526040812055600190565b6024867f4e487b710000000000000000000000000000000000000000000000000000000081526031600452fd5b61213a61212a611fdf9386611f7e565b90549060031b1c92839286611f7e565b905586528460205260408620553880806120b8565b6024887f4e487b710000000000000000000000000000000000000000000000000000000081526011600452fd5b6024877f4e487b710000000000000000000000000000000000000000000000000000000081526011600452fd5b5050505090565b73ffffffffffffffffffffffffffffffffffffffff1690604051604081019080821067ffffffffffffffff831117611c2457612230916040526020938482527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564858301526000808587829751910182855af161222a6122f3565b91612351565b8051918215918483156122cf575b50505090501561224b5750565b608490604051907f08c379a00000000000000000000000000000000000000000000000000000000082526004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152fd5b9193818094500103126103865782015190811515820361034b57508038808461223e565b3d1561234c573d9067ffffffffffffffff8211611c24576040519161234060207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f8401160184611c8b565b82523d6000602084013e565b606090565b919290156123cc5750815115612365575090565b3b1561236e5790565b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152fd5b8251909150156123df5750805190602001fd5b61073e906040519182917f08c379a000000000000000000000000000000000000000000000000000000000835260048301611ccc56fea2646970667358221220cb5d9e6b16161fa2406381893f6870b673d77d593c20d02145f96d674ba8a4e464736f6c63430008130033', + '608034610121576001600160401b0390601f6148a438819003918201601f191683019291908484118385101761010b57816020928492604096875283398101031261012157516001600160a01b0380821682036101215761005f33610126565b8251936124d294858101958187108388111761010b576123d2823980600096039086f0908115610101578451916105ee808401928311848410176100ed5791848492602094611de4853916815203019085f080156100e0576100d39394501660018060a01b03196001541617600155610126565b51611c76908161016e8239f35b50505051903d90823e3d90fd5b634e487b7160e01b88526041600452602488fd5b84513d87823e3d90fd5b634e487b7160e01b600052604160045260246000fd5b600080fd5b600080546001600160a01b039283166001600160a01b03198216811783559216907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09080a356fe6040608081526004908136101561001557600080fd5b600091823560e01c80631bce45831461079057806359659e901461073d578063715018a6146106a05780638da5cb5b1461064b578063d9181cd3146102ee578063e657f693146101aa5763f2fde38b1461006e57600080fd5b346101a65760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126101a6576100a561084f565b906100ae6108bd565b73ffffffffffffffffffffffffffffffffffffffff809216928315610123575050600054827fffffffffffffffffffffffff0000000000000000000000000000000000000000821617600055167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0600080a380f35b90602060849251917f08c379a0000000000000000000000000000000000000000000000000000000008352820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152fd5b8280fd5b8284346102eb5760607ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126102eb57506101e461084f565b906101ed610877565b916055600b6101fa61089a565b845173ffffffffffffffffffffffffffffffffffffffff968716602080830191825292909716604080830191909152815290957fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe09161025a60608261099b565b519020906102ab86519161026d8361097f565b6000835273ffffffffffffffffffffffffffffffffffffffff9661029f8860015416948a519586938d850198896109ff565b0390810183528261099b565b5190206111eb85516102bf8883018261099b565b81815287810191610a5683395190209085519186830152868201523081520160ff815320915191168152f35b80fd5b5090346101a65760607ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126101a65761032761084f565b92610330610877565b61033861089a565b908351946020968787018761037586868490602090939293604083019473ffffffffffffffffffffffffffffffffffffffff809216845216910152565b03976103a77fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0998a810183528261099b565b5190208651916103b68361097f565b6000835273ffffffffffffffffffffffffffffffffffffffff91816103f98c6103ed878d88600154169051958694850197886109ff565b038c810183528261099b565b5190206111eb895161040d8d83018261099b565b8181528c810191610a5683398051156105f057518492918af516988915610594578260015416938a3b156105905791608491601f8a95946104988f8e51998a9889977fcf7a1d77000000000000000000000000000000000000000000000000000000008952168c880152602487015260606044870152825192839182606489015288880191016109dc565b01168101030181838b5af1801561058657908591610572575b5050853b1561056e5784517f485cc95500000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff928316918101918252929091166020820152829082908190604001038183885af1801561056457610550575b50507fe3fc4d8c7984f762222579e0c4564a72a74f96cde3f6bae2751d01108c6ec240838251848152a151908152f35b61055a829161093c565b6102eb5780610520565b83513d84823e3d90fd5b8380fd5b61057b9061093c565b61056e5783386104b1565b86513d87823e3d90fd5b8880fd5b6064858c8b51917f08c379a0000000000000000000000000000000000000000000000000000000008352820152601960248201527f437265617465323a204661696c6564206f6e206465706c6f79000000000000006044820152fd5b6064878e808e51927f08c379a000000000000000000000000000000000000000000000000000000000845283015260248201527f437265617465323a2062797465636f6465206c656e677468206973207a65726f6044820152fd5b50503461069c57817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261069c5773ffffffffffffffffffffffffffffffffffffffff60209254169051908152f35b5080fd5b83346102eb57807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126102eb576106d76108bd565b600073ffffffffffffffffffffffffffffffffffffffff81547fffffffffffffffffffffffff000000000000000000000000000000000000000081168355167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08280a380f35b50503461069c57817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261069c5760209073ffffffffffffffffffffffffffffffffffffffff600154169051908152f35b5090346101a65760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126101a657826107ca61084f565b6107d26108bd565b73ffffffffffffffffffffffffffffffffffffffff90816001541690813b1561056e5783602492865197889586947f3659cfe600000000000000000000000000000000000000000000000000000000865216908401525af1908115610846575061083a575080f35b6108439061093c565b80f35b513d84823e3d90fd5b6004359073ffffffffffffffffffffffffffffffffffffffff8216820361087257565b600080fd5b6024359073ffffffffffffffffffffffffffffffffffffffff8216820361087257565b6044359073ffffffffffffffffffffffffffffffffffffffff8216820361087257565b73ffffffffffffffffffffffffffffffffffffffff6000541633036108de57565b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602060248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152fd5b67ffffffffffffffff811161095057604052565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6020810190811067ffffffffffffffff82111761095057604052565b90601f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0910116810190811067ffffffffffffffff82111761095057604052565b60005b8381106109ef5750506000910152565b81810151838201526020016109df565b9190926048949383527fffffffffffffffffffffffffffffffffffffffff000000000000000000000000809260601b16602084015260601b166034820152610a5082518093602086850191016109dc565b01019056fe60808060405234610016576111cf908161001c8239f35b600080fdfe604060808152366103825773ffffffffffffffffffffffffffffffffffffffff807fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035416158015610b94576000917fcf7a1d77000000000000000000000000000000000000000000000000000000007fffffffff00000000000000000000000000000000000000000000000000000000843516146100c057600484517ff92ee8a9000000000000000000000000000000000000000000000000000000008152fd5b6100c8611192565b60049136831161037e5760607ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261037e578235916101088361067f565b602435926101158461067f565b60443567ffffffffffffffff811161037a57610135839136908801610789565b941692156103525761014791166107e3565b803b156102cf578451907f5c60da1b000000000000000000000000000000000000000000000000000000009384835260209687848381865afa9384156102a657889461019d9189916102b2575b503b1515610926565b7fa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d5080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff85161790555194827f1cf3b03a6cf19fa2baba4df148e9dcabedea7f8a5c07840e207e5c089be95d3e8880a28451158015906102ab575b610242575b8361023c6107d0565b80519101f35b8592839182525afa9182156102a65761026a9392610277575b506102646109b1565b91610a21565b5038808083818080610233565b610298919250843d861161029f575b610290818361070e565b810190610902565b903861025b565b503d610286565b61091a565b508661022e565b6102c99150863d881161029f57610290818361070e565b38610194565b60848360208751917f08c379a0000000000000000000000000000000000000000000000000000000008352820152602560248201527f455243313936373a206e657720626561636f6e206973206e6f74206120636f6e60448201527f74726163740000000000000000000000000000000000000000000000000000006064820152fd5b8487517ff92ee8a9000000000000000000000000000000000000000000000000000000008152fd5b8680fd5b8380fd5b73ffffffffffffffffffffffffffffffffffffffff807fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035416158015610b94576000907fcf7a1d77000000000000000000000000000000000000000000000000000000007fffffffff00000000000000000000000000000000000000000000000000000000833516146104395760046040517ff92ee8a9000000000000000000000000000000000000000000000000000000008152fd5b610441611192565b60049236841161067b5760607ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261067b5783356104808161067f565b6024359161048d8361067f565b60443567ffffffffffffffff8111610677576104ad829136908901610789565b9316931561064e576104bf91166107e3565b813b156105ca576040517f5c60da1b000000000000000000000000000000000000000000000000000000009283825260209586838281855afa9283156102a65787936105149188916105b357503b1515610926565b7fa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d5080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff841617905560405194827f1cf3b03a6cf19fa2baba4df148e9dcabedea7f8a5c07840e207e5c089be95d3e8880a28451158015906102ab57610242578361023c6107d0565b6102c99150853d871161029f57610290818361070e565b6084846020604051917f08c379a0000000000000000000000000000000000000000000000000000000008352820152602560248201527f455243313936373a206e657720626561636f6e206973206e6f74206120636f6e60448201527f74726163740000000000000000000000000000000000000000000000000000006064820152fd5b856040517ff92ee8a9000000000000000000000000000000000000000000000000000000008152fd5b8580fd5b8280fd5b73ffffffffffffffffffffffffffffffffffffffff81160361069d57565b600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6020810190811067ffffffffffffffff8211176106ed57604052565b6106a2565b6040810190811067ffffffffffffffff8211176106ed57604052565b90601f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0910116810190811067ffffffffffffffff8211176106ed57604052565b67ffffffffffffffff81116106ed57601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01660200190565b81601f8201121561069d578035906107a08261074f565b926107ae604051948561070e565b8284526020838301011161069d57816000926020809301838601378301015290565b604051906107dd826106d1565b60008252565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61039081547f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f604080519373ffffffffffffffffffffffffffffffffffffffff9081851686521693846020820152a1811561087e577fffffffffffffffffffffffff000000000000000000000000000000000000000016179055565b60846040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152fd5b9081602091031261069d57516109178161067f565b90565b6040513d6000823e3d90fd5b1561092d57565b60846040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603060248201527f455243313936373a20626561636f6e20696d706c656d656e746174696f6e206960448201527f73206e6f74206120636f6e7472616374000000000000000000000000000000006064820152fd5b604051906060820182811067ffffffffffffffff8211176106ed57604052602782527f206661696c6564000000000000000000000000000000000000000000000000006040837f416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c60208201520152565b6000806109179493602081519101845af43d15610a60573d91610a438361074f565b92610a51604051948561070e565b83523d6000602085013e610acd565b606091610acd565b15610a6f57565b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152fd5b91929015610aed5750815115610ae1575090565b610917903b1515610a68565b825190915015610b005750805190602001fd5b604051907f08c379a000000000000000000000000000000000000000000000000000000000825281602080600483015282519283602484015260005b848110610b7d575050507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f836000604480968601015201168101030190fd5b818101830151868201604401528593508201610b3c565b610bee610bd57fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035473ffffffffffffffffffffffffffffffffffffffff1690565b73ffffffffffffffffffffffffffffffffffffffff1690565b3303610d14576000357fffffffff00000000000000000000000000000000000000000000000000000000167f3659cfe6000000000000000000000000000000000000000000000000000000008103610c515750610c49610f0f565b602081519101f35b7f4f1ef286000000000000000000000000000000000000000000000000000000008103610c865750610c81611083565b610c49565b7f8f283970000000000000000000000000000000000000000000000000000000008103610cb65750610c81610ec5565b7ff851a440000000000000000000000000000000000000000000000000000000008103610ce65750610c81610dfd565b7f5c60da1b0000000000000000000000000000000000000000000000000000000003610d1457610c81610e53565b610d1c610d3b565b6000808092368280378136915af43d82803e15610d37573d90f35b3d90fd5b73ffffffffffffffffffffffffffffffffffffffff807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc541680610df8575060206004917fa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d505416604051928380927f5c60da1b0000000000000000000000000000000000000000000000000000000082525afa9081156102a657600091610de0575090565b610917915060203d811161029f57610290818361070e565b905090565b610e05611192565b73ffffffffffffffffffffffffffffffffffffffff7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103541660405190602082015260208152610917816106f2565b610e5b611192565b610e63610d3b565b73ffffffffffffffffffffffffffffffffffffffff6040519116602082015260208152610917816106f2565b7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc602091011261069d576004356109178161067f565b610ecd611192565b3660041161069d57610efc73ffffffffffffffffffffffffffffffffffffffff610ef636610e8f565b166107e3565b604051610f08816106d1565b6000815290565b610f17611192565b3660041161069d5773ffffffffffffffffffffffffffffffffffffffff610f3d36610e8f565b1660405190610f4b826106d1565b60008252803b15610fff577f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc817fffffffffffffffffffffffff0000000000000000000000000000000000000000825416179055807fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b600080a2815115801590610ff7575b610fe3575b5050604051610f08816106d1565b610fef916102646109b1565b503880610fd5565b506000610fd0565b60846040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201527f6f74206120636f6e7472616374000000000000000000000000000000000000006064820152fd5b3660041161069d5760407ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261069d576004356110c18161067f565b60243567ffffffffffffffff811161069d576110f673ffffffffffffffffffffffffffffffffffffffff913690600401610789565b9116803b15610fff577f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc817fffffffffffffffffffffffff0000000000000000000000000000000000000000825416179055807fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b600080a281511580159061118a57610fe3575050604051610f08816106d1565b506001610fd0565b3461069d5756fea2646970667358221220a592f27f25373407ca73911ddc0bbaa6ea0e0d6dfcce18bb6b5765f70d2e1a1764736f6c63430008130033a2646970667358221220f7464573d2144d649988f0f60625c5f6ed3b279c89ac9793209a1b06152866e664736f6c6343000813003360803461011a57601f6105ee38819003918201601f19168301916001600160401b0383118484101761011f5780849260209460405283398101031261011a57516001600160a01b03808216919082820361011a576000549160018060a01b0319923384821617600055604051923391167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0600080a33b156100b2575060015416176001556040516104b890816101368239f35b62461bcd60e51b815260206004820152603360248201527f5570677261646561626c65426561636f6e3a20696d706c656d656e746174696f60448201527f6e206973206e6f74206120636f6e7472616374000000000000000000000000006064820152608490fd5b600080fd5b634e487b7160e01b600052604160045260246000fdfe6080604052600436101561001257600080fd5b6000803560e01c80633659cfe6146102ce5780635c60da1b1461027c578063715018a6146101e05780638da5cb5b1461018f5763f2fde38b1461005457600080fd5b3461018c5760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261018c5760043573ffffffffffffffffffffffffffffffffffffffff808216809203610188576100ad610403565b8115610104578254827fffffffffffffffffffffffff00000000000000000000000000000000000000008216178455167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08380a380f35b60846040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152fd5b8280fd5b80fd5b503461018c57807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261018c5773ffffffffffffffffffffffffffffffffffffffff6020915416604051908152f35b503461018c57807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261018c57610217610403565b8073ffffffffffffffffffffffffffffffffffffffff81547fffffffffffffffffffffffff000000000000000000000000000000000000000081168355167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08280a380f35b503461018c57807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261018c57602073ffffffffffffffffffffffffffffffffffffffff60015416604051908152f35b503461018c5760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261018c5760043573ffffffffffffffffffffffffffffffffffffffff81169081810361018857610328610403565b3b1561037f57807fffffffffffffffffffffffff000000000000000000000000000000000000000060015416176001557fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b8280a280f35b60846040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603360248201527f5570677261646561626c65426561636f6e3a20696d706c656d656e746174696f60448201527f6e206973206e6f74206120636f6e7472616374000000000000000000000000006064820152fd5b73ffffffffffffffffffffffffffffffffffffffff60005416330361042457565b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602060248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152fdfea2646970667358221220ff9f63e676c96c753988d58c9eed378dc3ae25dde2df2114b6217eba7bb9455964736f6c6343000813003360808060405234610016576124b6908161001c8239f35b600080fdfe608060408181526004908136101561001657600080fd5b600092833560e01c90816301ffc9a7146116de575080630668d0bb14610f3b578063248a9ca314610f115780632f2ff15d14610e915780633474a4a614610dc057806336568abe14610cf957806344004cc114610c255780634782f77914610bc2578063485cc955146108bf5780638c17030f146104475780639010d07c146103f857806391d14854146103a5578063a217fddf1461038a578063a971e8421461034e578063bad4366114610146578063ca15c8731461011e5763d547741f146100df57600080fd5b3461011a578060031936011261011a5761011791356101126001610101611829565b938387528660205286200154611b16565b611d81565b80f35b8280fd5b50903461011a57602060031936011261011a5760209282913581526001845220549051908152f35b503461011a57608060031936011261011a578135602490813567ffffffffffffffff9586821161034b575061017e903690860161184c565b9490610188611806565b9573ffffffffffffffffffffffffffffffffffffffff8716600052602097600289528660002085600052895260ff8760002054161597886101cf575b898989519015158152f35b9091929497508695989396517fffffffffffffffffffffffffffffffffffffffff0000000000000000000000008582019260601b16825260643560348201526034815261021b81611cbe565b51902090821161031e5760059382851b86519361023a86830186611cf6565b845284840190820191368311610319578590915b8383106103095750505050926000935b82518510156102f25784821b830184015190866000838310156102e55750506000528352846000205b937fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff81146102b8576001019361025e565b886011887f4e487b7100000000000000000000000000000000000000000000000000000000600052526000fd5b9190928252855220610287565b9496955050509450501490388080808080806101c4565b823581529181019186910161024e565b600080fd5b876041877f4e487b7100000000000000000000000000000000000000000000000000000000600052526000fd5b80fd5b83823461038657816003193601126103865760209073ffffffffffffffffffffffffffffffffffffffff60035460081c169051908152f35b5080fd5b83823461038657816003193601126103865751908152602090f35b50903461011a578160031936011261011a5773ffffffffffffffffffffffffffffffffffffffff826020946103d8611829565b93358152808652209116600052825260ff81600020541690519015158152f35b50903461011a578160031936011261011a5761043860209373ffffffffffffffffffffffffffffffffffffffff9235815260018552836024359120611fe9565b92905490519260031b1c168152f35b50903461011a5760c060031936011261011a5780359160249081359061046b611806565b906064359267ffffffffffffffff9485851694858103610319576084359687168097036103195760a435977f4c02318d8c3aadc98ccf18aebbf3126f651e0c3f6a1de5ff8edcf6724a2ad5c280600052602093600085528660002033600052855260ff87600020541615610628575050868810801561061e575b6105f7579189979593917fabec13ca1773eed55d54d2f64593c33fa520ee45cac73a162f13928a2ebee2339a86948b60a073ffffffffffffffffffffffffffffffffffffffff60c09e9c9a519961053b8b611c73565b858b5288888c0152169889898201528a60608201528b608082015201525582600555847fffffffff000000000000000000000000000000000000000000000000000000007bffffffffffffffff00000000000000000000000000000000000000006006549360a01b1692161717600655857fffffffffffffffffffffffffffffffffffffffffffffffff000000000000000060075416176007558660085582519788528701528501526060840152608083015260a0820152a180f35b84517f85d4a748000000000000000000000000000000000000000000000000000000008152fd5b50428811156104e5565b919450915061063633611e74565b85519161064283611cda565b604283528483019360603686378351156108925760308553835160019081101561086557607860218601536041905b80821161079d575050610742575061073e938693610710936107016048946106cc9a519a857f416363657373436f6e74726f6c3a206163636f756e74200000000000000000008d978801528251928391603789019101611c50565b8401917f206973206d697373696e6720726f6c6520000000000000000000000000000000603784015251809386840190611c50565b01036028810187520185611cf6565b519283927f08c379a00000000000000000000000000000000000000000000000000000000084528301611d37565b0390fd5b925050508160649451937f08c379a00000000000000000000000000000000000000000000000000000000085528401528201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152fd5b9091600f81166010811015610838577f3031323334353637383961626364656600000000000000000000000000000000901a6107d98488611e34565b53881c91801561080b577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0190610671565b8360118a7f4e487b7100000000000000000000000000000000000000000000000000000000600052526000fd5b8460328b7f4e487b7100000000000000000000000000000000000000000000000000000000600052526000fd5b826032897f4e487b7100000000000000000000000000000000000000000000000000000000600052526000fd5b506032867f4e487b7100000000000000000000000000000000000000000000000000000000600052526000fd5b50903461011a578160031936011261011a576108d96117e3565b906108e2611829565b6003549160ff8316610b9b5750907fffffffffffffffffffffff0000000000000000000000000000000000000000ff74ffffffffffffffffffffffffffffffffffffffff00610a2c949360081b16911617600355600080526020926000845273ffffffffffffffffffffffffffffffffffffffff8160002092169182600052845260ff81600020541615610b2f575b60008052600184818096526109898484600020612001565b507f4c02318d8c3aadc98ccf18aebbf3126f651e0c3f6a1de5ff8edcf6724a2ad5c280600052600082528360002085600052825260ff84600020541615610ac4575b6000528181526109de8484600020612001565b507f5d8e12c39142ff96d79d04d15d1ba1269e4fe57bb9d26f43523628b34ba108ec80600052600082528360002085600052825260ff84600020541615610a59575b60005252600020612001565b507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00600354161760035580f35b80600052600082528360002085600052825283600020837fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff008254161790553385827f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d600080a4610a20565b80600052600082528360002085600052825283600020837fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff008254161790553385827f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d600080a46109cb565b6000805260008452806000208260005284528060002060017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00825416179055338260007f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d8180a4610971565b84517ff92ee8a9000000000000000000000000000000000000000000000000000000008152fd5b503461011a578060031936011261011a5782808080610bdf6117e3565b610be761187d565b602435905af1610bf561235e565b5015610bff578280f35b517f750b219c000000000000000000000000000000000000000000000000000000008152fd5b83823461038657606060031936011261038657610cc773ffffffffffffffffffffffffffffffffffffffff61011792610cf3610c5f6117e3565b91610c68611829565b90610c7161187d565b517fa9059cbb00000000000000000000000000000000000000000000000000000000602082015273ffffffffffffffffffffffffffffffffffffffff909116602482015260448035908201529384906064820190565b037fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08101855284611cf6565b1661221b565b50919034610386578260031936011261038657610d14611829565b903373ffffffffffffffffffffffffffffffffffffffff831603610d3d57906101179135611d81565b60849060208551917f08c379a0000000000000000000000000000000000000000000000000000000008352820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201527f20726f6c657320666f722073656c6600000000000000000000000000000000006064820152fd5b50903461011a578260031936011261011a5760c09260a08351610de281611c73565b82815282602082015282858201528260608201528260808201520152815190610e0a82611c73565b5491828252600554602083019081526006548284019273ffffffffffffffffffffffffffffffffffffffff908183168552606086019167ffffffffffffffff9586809560a01c1684528460075416956080890196875260a060085499019889528351998a525160208a015251169087015251166060850152511660808301525160a0820152f35b503461011a578060031936011261011a57610f0d9135906001610eb2611829565b92808652602090868252610eca838589200154611b16565b806000526000825273ffffffffffffffffffffffffffffffffffffffff8460002095169485600052825260ff84600020541615610a595760005252600020612001565b5080f35b50903461011a57602060031936011261011a57816020936001923581528085522001549051908152f35b509060a060031936011261011a57610f516117e3565b602491823592610f5f611806565b67ffffffffffffffff929060843584811161123257610f81903690840161184c565b8560065460a01c16866007541680159182156116d4575b5081156116c9575b506116a157600854918261143d575b505050600554868102908082048814901517156114125773ffffffffffffffffffffffffffffffffffffffff918260065416838216908082036113d8575060643583811061137d5750806112a457508134036112485750505b60035460081c169286517f18160ddd0000000000000000000000000000000000000000000000000000000081526020818481885afa90811561123e578991611209575b50825490811515806111cc575b611192575050833b1561118e5787875180957f40c10f190000000000000000000000000000000000000000000000000000000082528183816110c08c8c8a84016020909392919373ffffffffffffffffffffffffffffffffffffffff60408201951681520152565b03925af1801561118457611125575b5050935173ffffffffffffffffffffffffffffffffffffffff90921682525060208101919091527ff32d98590495ee51bacb93809409a188e7ab8268b70b4c969d9da3a883c539f7915080604081015b0390a180f35b831161115a575050835261111f7ff32d98590495ee51bacb93809409a188e7ab8268b70b4c969d9da3a883c539f738806110cf565b604187917f4e487b7100000000000000000000000000000000000000000000000000000000835252fd5b87513d8a823e3d90fd5b8780fd5b606491888686938c51947fa92278300000000000000000000000000000000000000000000000000000000086528501528301526044820152fd5b508781018082116111de578210611058565b858b6011877f4e487b7100000000000000000000000000000000000000000000000000000000835252fd5b90506020813d8211611236575b8161122360209383611cf6565b8101031261123257513861104b565b8880fd5b3d9150611216565b88513d8b823e3d90fd5b61073e848a519384937f1eabcfbe0000000000000000000000000000000000000000000000000000000085523492850160409194939273ffffffffffffffffffffffffffffffffffffffff606083019616825260208201520152565b939894979496949593905034156112ef576064898b8a818b51937f1eabcfbe000000000000000000000000000000000000000000000000000000008552840152820152346044820152fd5b8698939597949651917f23b872dd000000000000000000000000000000000000000000000000000000006020840152338684015230604484015260648301526064825260a082018281108782111761135257895261134d919061221b565b611008565b858b6041877f4e487b7100000000000000000000000000000000000000000000000000000000835252fd5b8a517f1eabcfbe00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff84168188019081526020810186905260408101929092529081906060010390fd5b858c85896064948f51947f1eabcfbe0000000000000000000000000000000000000000000000000000000086528501528301526044820152fd5b83896011857f4e487b7100000000000000000000000000000000000000000000000000000000835252fd5b338b52602091600283528a8c20848d52835260ff8b8d2054161580611528575b156114a6575050338a5260028152888a20918a525286882060017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00825416179055388080610faf565b908b8692608089878f51967f265c66a80000000000000000000000000000000000000000000000000000000088528701528501528060848501527f07ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff81116103865791839160a49360051b80928585013733604484015260648301528101030190fd5b50999690959a989293879892959851868101907fffffffffffffffffffffffffffffffffffffffff0000000000000000000000003360601b1682528b60348201526034815261157681611cbe565b51902094828c116116765788519560059594939291908d871b8e61159c8b83018b611cf6565b89528a01898901368211611672578a8c915b8383106116625750505050988c995b88518b1015611649578a881b89018a0151908e8282101561163b575289528a8d205b997fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff811461161057600101996115bd565b8f8e60118f7f4e487b7100000000000000000000000000000000000000000000000000000000835252fd5b9190915289528a8d206115df565b919650939a97949b9d9850859196509b91989b1461145d565b82358152918101918c91016115ae565b8e80fd5b8c8b60418c7f4e487b7100000000000000000000000000000000000000000000000000000000835252fd5b8389517f3f886774000000000000000000000000000000000000000000000000000000008152fd5b905042101538610fa0565b4210915038610f98565b8490843461011a57602060031936011261011a57357fffffffff00000000000000000000000000000000000000000000000000000000811680910361011a57602092507fbe0b7712000000000000000000000000000000000000000000000000000000008114908115611753575b5015158152f35b7f5a05180f00000000000000000000000000000000000000000000000000000000811491508115611786575b508361174c565b7f7965db0b000000000000000000000000000000000000000000000000000000008114915081156117b9575b508361177f565b7f01ffc9a700000000000000000000000000000000000000000000000000000000915014836117b2565b6004359073ffffffffffffffffffffffffffffffffffffffff8216820361031957565b6044359073ffffffffffffffffffffffffffffffffffffffff8216820361031957565b6024359073ffffffffffffffffffffffffffffffffffffffff8216820361031957565b9181601f840112156103195782359167ffffffffffffffff8311610319576020808501948460051b01011161031957565b3360009081527f20be27040b8e00df40bca0df34743417f3574a156386188f7d7f14369e5ee82b60209081526040808320549092907f5d8e12c39142ff96d79d04d15d1ba1269e4fe57bb9d26f43523628b34ba108ec9060ff16156118e25750505050565b6118eb33611e74565b8451916118f783611cda565b60428352848301936060368637835115611ae95760308553835190600191821015611ae95790607860218601536041915b818311611a1e575050506119c2576106cc9385936119929361198360489461073e995198857f416363657373436f6e74726f6c3a206163636f756e74200000000000000000008b978801528251928391603789019101611c50565b01036028810185520183611cf6565b519182917f08c379a000000000000000000000000000000000000000000000000000000000835260048301611d37565b6064848651907f08c379a000000000000000000000000000000000000000000000000000000000825280600483015260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152fd5b909192600f81166010811015611abc577f3031323334353637383961626364656600000000000000000000000000000000901a611a5b8588611e34565b5360041c928015611a8f577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff019190611928565b6024827f4e487b710000000000000000000000000000000000000000000000000000000081526011600452fd5b6024837f4e487b710000000000000000000000000000000000000000000000000000000081526032600452fd5b807f4e487b7100000000000000000000000000000000000000000000000000000000602492526032600452fd5b6000818152602090808252604092838220338352835260ff848320541615611b3e5750505050565b611b4733611e74565b845191611b5383611cda565b60428352848301936060368637835115611ae95760308553835190600191821015611ae95790607860218601536041915b818311611bdf575050506119c2576106cc9385936119929361198360489461073e995198857f416363657373436f6e74726f6c3a206163636f756e74200000000000000000008b978801528251928391603789019101611c50565b909192600f81166010811015611abc577f3031323334353637383961626364656600000000000000000000000000000000901a611c1c8588611e34565b5360041c928015611a8f577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff019190611b84565b60005b838110611c635750506000910152565b8181015183820152602001611c53565b60c0810190811067ffffffffffffffff821117611c8f57604052565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6060810190811067ffffffffffffffff821117611c8f57604052565b6080810190811067ffffffffffffffff821117611c8f57604052565b90601f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0910116810190811067ffffffffffffffff821117611c8f57604052565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f60409360208452611d7a8151809281602088015260208888019101611c50565b0116010190565b906040611dcc926000908082528160205273ffffffffffffffffffffffffffffffffffffffff83832094169384835260205260ff8383205416611dcf575b81526001602052206120c2565b50565b808252816020528282208483526020528282207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0081541690553384827ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b8580a4611dbf565b908151811015611e45570160200190565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60405190611e8182611cbe565b602a8252602082016040368237825115611e4557603090538151600190811015611e4557607860218401536029905b808211611f1e575050611ec05790565b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602060248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152fd5b9091600f81166010811015611fbb577f3031323334353637383961626364656600000000000000000000000000000000901a611f5a8486611e34565b5360041c918015611f8d577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0190611eb0565b602460007f4e487b710000000000000000000000000000000000000000000000000000000081526011600452fd5b602460007f4e487b710000000000000000000000000000000000000000000000000000000081526032600452fd5b8054821015611e455760005260206000200190600090565b919060018301600090828252806020526040822054156000146120bc578454946801000000000000000086101561208f578361207f61204a886001604098999a01855584611fe9565b81939154907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff9060031b92831b921b19161790565b9055549382526020522055600190565b6024837f4e487b710000000000000000000000000000000000000000000000000000000081526041600452fd5b50925050565b90600182019060009281845282602052604084205490811515600014612214577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff918281018181116121e7578254908482019182116121ba57808203612185575b505050805480156121585782019161213b8383611fe9565b909182549160031b1b191690555582526020526040812055600190565b6024867f4e487b710000000000000000000000000000000000000000000000000000000081526031600452fd5b6121a561219561204a9386611fe9565b90549060031b1c92839286611fe9565b90558652846020526040862055388080612123565b6024887f4e487b710000000000000000000000000000000000000000000000000000000081526011600452fd5b6024877f4e487b710000000000000000000000000000000000000000000000000000000081526011600452fd5b5050505090565b73ffffffffffffffffffffffffffffffffffffffff1690604051604081019080821067ffffffffffffffff831117611c8f5761229b916040526020938482527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564858301526000808587829751910182855af161229561235e565b916123bc565b80519182159184831561233a575b5050509050156122b65750565b608490604051907f08c379a00000000000000000000000000000000000000000000000000000000082526004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152fd5b9193818094500103126103865782015190811515820361034b5750803880846122a9565b3d156123b7573d9067ffffffffffffffff8211611c8f57604051916123ab60207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f8401160184611cf6565b82523d6000602084013e565b606090565b9192901561243757508151156123d0575090565b3b156123d95790565b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152fd5b82519091501561244a5750805190602001fd5b61073e906040519182917f08c379a000000000000000000000000000000000000000000000000000000000835260048301611d3756fea26469706673582212209f37eab5b9ee7f4712182c88f56ac6041c6dd2dc3e533abce5b326ab2343314564736f6c63430008130033', signer ) } @@ -129,199 +183,206 @@ export const ERC721SALEFACTORY_VERIFICATION: Omit 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' + '// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8.19;\n\nimport { SequenceProxyFactory } from "@0xsequence/contracts-library/proxies/SequenceProxyFactory.sol";\nimport { ERC721Sale } from "@0xsequence/contracts-library/tokens/ERC721/utility/sale/ERC721Sale.sol";\nimport {\n IERC721SaleFactory,\n IERC721SaleFactoryFunctions\n} from "@0xsequence/contracts-library/tokens/ERC721/utility/sale/IERC721SaleFactory.sol";\n\n/**\n * Deployer of ERC-721 Sale proxies.\n */\ncontract ERC721SaleFactory is IERC721SaleFactory, SequenceProxyFactory {\n\n /**\n * Creates an ERC-721 Sale Factory.\n * @param factoryOwner The owner of the ERC-721 Sale Factory\n */\n constructor(\n address factoryOwner\n ) {\n ERC721Sale impl = new ERC721Sale();\n SequenceProxyFactory._initialize(address(impl), factoryOwner);\n }\n\n /// @inheritdoc IERC721SaleFactoryFunctions\n function deploy(address proxyOwner, address tokenOwner, address items) external returns (address proxyAddr) {\n bytes32 salt = keccak256(abi.encode(tokenOwner, items));\n proxyAddr = _createProxy(salt, proxyOwner, "");\n ERC721Sale(proxyAddr).initialize(tokenOwner, items);\n emit ERC721SaleDeployed(proxyAddr);\n return proxyAddr;\n }\n\n /// @inheritdoc IERC721SaleFactoryFunctions\n function determineAddress(\n address proxyOwner,\n address tokenOwner,\n address items\n ) external view returns (address proxyAddr) {\n bytes32 salt = keccak256(abi.encode(tokenOwner, items));\n return _computeProxyAddress(salt, proxyOwner, "");\n }\n\n}\n' }, - 'node_modules/@openzeppelin/contracts/access/AccessControlEnumerable.sol': { + 'src/proxies/SequenceProxyFactory.sol': { content: - '// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (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 virtual 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 virtual 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' + '// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8.19;\n\nimport {\n ITransparentUpgradeableBeaconProxy,\n TransparentUpgradeableBeaconProxy\n} from "./TransparentUpgradeableBeaconProxy.sol";\n\nimport { Ownable } from "@openzeppelin/contracts/access/Ownable.sol";\nimport { UpgradeableBeacon } from "@openzeppelin/contracts/proxy/beacon/UpgradeableBeacon.sol";\nimport { Create2 } from "@openzeppelin/contracts/utils/Create2.sol";\n\n/**\n * An proxy factory that deploys upgradeable beacon proxies.\n * @dev The factory owner is able to upgrade the beacon implementation.\n * @dev Proxy deployers are able to override the beacon reference with their own.\n */\nabstract contract SequenceProxyFactory is Ownable {\n\n UpgradeableBeacon public beacon;\n\n /**\n * Initialize a Sequence Proxy Factory.\n * @param implementation The initial beacon implementation.\n * @param factoryOwner The owner of the factory.\n */\n function _initialize(address implementation, address factoryOwner) internal {\n beacon = new UpgradeableBeacon(implementation);\n Ownable._transferOwnership(factoryOwner);\n }\n\n /**\n * Deploys and initializes a new proxy instance.\n * @param _salt The deployment salt.\n * @param _proxyOwner The owner of the proxy.\n * @param _data The initialization data.\n * @return proxyAddress The address of the deployed proxy.\n */\n function _createProxy(\n bytes32 _salt,\n address _proxyOwner,\n bytes memory _data\n ) internal returns (address proxyAddress) {\n bytes32 saltedHash = keccak256(abi.encodePacked(_salt, _proxyOwner, address(beacon), _data));\n bytes memory bytecode = type(TransparentUpgradeableBeaconProxy).creationCode;\n\n proxyAddress = Create2.deploy(0, saltedHash, bytecode);\n ITransparentUpgradeableBeaconProxy(payable(proxyAddress)).initialize(_proxyOwner, address(beacon), _data);\n }\n\n /**\n * Computes the address of a proxy instance.\n * @param _salt The deployment salt.\n * @param _proxyOwner The owner of the proxy.\n * @return proxy The expected address of the deployed proxy.\n */\n function _computeProxyAddress(\n bytes32 _salt,\n address _proxyOwner,\n bytes memory _data\n ) internal view returns (address) {\n bytes32 saltedHash = keccak256(abi.encodePacked(_salt, _proxyOwner, address(beacon), _data));\n bytes32 bytecodeHash = keccak256(type(TransparentUpgradeableBeaconProxy).creationCode);\n\n return Create2.computeAddress(saltedHash, bytecodeHash);\n }\n\n /**\n * Upgrades the beacon implementation.\n * @param implementation The new beacon implementation.\n */\n function upgradeBeacon(\n address implementation\n ) public onlyOwner {\n beacon.upgradeTo(implementation);\n }\n\n}\n' }, - 'node_modules/@openzeppelin/contracts/access/IAccessControl.sol': { + 'src/tokens/ERC721/utility/sale/ERC721Sale.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" + '// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8.19;\n\nimport {\n IERC721Sale, IERC721SaleFunctions\n} from "@0xsequence/contracts-library/tokens/ERC721/utility/sale/IERC721Sale.sol";\n\nimport { MerkleProofSingleUse } from "@0xsequence/contracts-library/tokens/common/MerkleProofSingleUse.sol";\nimport {\n AccessControlEnumerable,\n IERC20,\n SafeERC20,\n WithdrawControlled\n} from "@0xsequence/contracts-library/tokens/common/WithdrawControlled.sol";\n\nimport { IERC721ItemsFunctions } from "@0xsequence/contracts-library/tokens/ERC721/presets/items/IERC721Items.sol";\nimport { IERC721A } from "erc721a/contracts/extensions/ERC721AQueryable.sol";\n\n/**\n * An ERC-721 token contract with primary sale mechanisms.\n */\ncontract ERC721Sale is IERC721Sale, WithdrawControlled, MerkleProofSingleUse {\n\n bytes32 internal constant MINT_ADMIN_ROLE = keccak256("MINT_ADMIN_ROLE");\n\n bool private _initialized;\n address private _items;\n SaleDetails private _saleDetails;\n\n /**\n * Initialize the contract.\n * @param owner The owner of the contract\n * @param items The ERC-721 Items contract address\n * @dev This should be called immediately after deployment.\n */\n function initialize(address owner, address items) public virtual {\n if (_initialized) {\n revert InvalidInitialization();\n }\n\n _items = items;\n\n _grantRole(DEFAULT_ADMIN_ROLE, owner);\n _grantRole(MINT_ADMIN_ROLE, owner);\n _grantRole(WITHDRAW_ROLE, owner);\n\n _initialized = true;\n }\n\n /**\n * Checks if the current block.timestamp is out of the give timestamp range.\n * @param _startTime Earliest acceptable timestamp (inclusive).\n * @param _endTime Latest acceptable timestamp (exclusive).\n * @dev A zero endTime value is always considered out of bounds.\n */\n function _blockTimeOutOfBounds(uint256 _startTime, uint256 _endTime) private view returns (bool) {\n // 0 end time indicates inactive sale.\n return _endTime == 0 || block.timestamp < _startTime || block.timestamp >= _endTime; // solhint-disable-line not-rely-on-time\n }\n\n /**\n * Checks the sale is active and takes payment.\n * @param _amount Amount of tokens to mint.\n * @param _expectedPaymentToken ERC20 token address to accept payment in. address(0) indicates ETH.\n * @param _maxTotal Maximum amount of payment tokens.\n * @param _proof Merkle proof for allowlist minting.\n */\n function _payForActiveMint(\n uint256 _amount,\n address _expectedPaymentToken,\n uint256 _maxTotal,\n bytes32[] calldata _proof\n ) private {\n // Active sale test\n if (_blockTimeOutOfBounds(_saleDetails.startTime, _saleDetails.endTime)) {\n revert SaleInactive();\n }\n requireMerkleProof(_saleDetails.merkleRoot, _proof, msg.sender, "");\n\n uint256 total = _saleDetails.cost * _amount;\n if (_expectedPaymentToken != _saleDetails.paymentToken) {\n // Caller expected different payment token\n revert InsufficientPayment(_saleDetails.paymentToken, total, 0);\n }\n if (_maxTotal < total) {\n // Caller expected to pay less\n revert InsufficientPayment(_expectedPaymentToken, total, _maxTotal);\n }\n if (_expectedPaymentToken == address(0)) {\n // Paid in ETH\n if (msg.value != total) {\n // We expect exact value match\n revert InsufficientPayment(_expectedPaymentToken, total, msg.value);\n }\n } else if (msg.value > 0) {\n // Paid in ERC20, but sent ETH\n revert InsufficientPayment(address(0), 0, msg.value);\n } else {\n // Paid in ERC20\n SafeERC20.safeTransferFrom(IERC20(_expectedPaymentToken), msg.sender, address(this), total);\n }\n }\n\n //\n // Minting\n //\n\n /**\n * Mint tokens.\n * @param to Address to mint tokens to.\n * @param amount Amount of tokens to mint.\n * @param paymentToken ERC20 token address to accept payment in. address(0) indicates ETH.\n * @param maxTotal Maximum amount of payment tokens.\n * @param proof Merkle proof for allowlist minting.\n * @notice Sale must be active for all tokens.\n * @dev An empty proof is supplied when no proof is required.\n * @dev `paymentToken` must match the `paymentToken` in the sale details.\n */\n function mint(\n address to,\n uint256 amount,\n address paymentToken,\n uint256 maxTotal,\n bytes32[] calldata proof\n ) public payable {\n _payForActiveMint(amount, paymentToken, maxTotal, proof);\n\n uint256 currentSupply = IERC721A(_items).totalSupply();\n uint256 supplyCap = _saleDetails.supplyCap;\n if (supplyCap > 0 && currentSupply + amount > supplyCap) {\n revert InsufficientSupply(currentSupply, amount, supplyCap);\n }\n\n IERC721ItemsFunctions(_items).mint(to, amount);\n emit ItemsMinted(to, amount);\n }\n\n /**\n * Set the sale details.\n * @param supplyCap The maximum number of tokens that can be minted. 0 indicates unlimited supply.\n * @param cost The amount of payment tokens to accept for each token minted.\n * @param paymentToken The ERC20 token address to accept payment in. address(0) indicates ETH.\n * @param startTime The start time of the sale. Tokens cannot be minted before this time.\n * @param endTime The end time of the sale. Tokens cannot be minted after this time.\n * @param merkleRoot The merkle root for allowlist minting.\n * @dev A zero end time indicates an inactive sale.\n */\n function setSaleDetails(\n uint256 supplyCap,\n uint256 cost,\n address paymentToken,\n uint64 startTime,\n uint64 endTime,\n bytes32 merkleRoot\n ) public onlyRole(MINT_ADMIN_ROLE) {\n // solhint-disable-next-line not-rely-on-time\n if (endTime < startTime || endTime <= block.timestamp) {\n revert InvalidSaleDetails();\n }\n _saleDetails = SaleDetails(supplyCap, cost, paymentToken, startTime, endTime, merkleRoot);\n emit SaleDetailsUpdated(supplyCap, cost, paymentToken, startTime, endTime, merkleRoot);\n }\n\n //\n // Views\n //\n function itemsContract() external view returns (address) {\n return address(_items);\n }\n\n /**\n * Get sale details.\n * @return Sale details.\n */\n function saleDetails() external view returns (SaleDetails memory) {\n return _saleDetails;\n }\n\n /**\n * Check interface support.\n * @param interfaceId Interface id\n * @return True if supported\n */\n function supportsInterface(\n bytes4 interfaceId\n ) public view virtual override(AccessControlEnumerable) returns (bool) {\n return interfaceId == type(IERC721SaleFunctions).interfaceId || super.supportsInterface(interfaceId);\n }\n\n}\n' }, - 'node_modules/@openzeppelin/contracts/access/IAccessControlEnumerable.sol': { + 'src/tokens/ERC721/utility/sale/IERC721SaleFactory.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' + '// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8.19;\n\ninterface IERC721SaleFactoryFunctions {\n\n /**\n * Creates an ERC-721 Sale for given token contract\n * @param proxyOwner The owner of the ERC-721 Sale proxy\n * @param tokenOwner The owner of the ERC-721 Sale implementation\n * @param items The ERC-721 Items contract address\n * @return proxyAddr The address of the ERC-721 Sale Proxy\n * @notice The deployed contract must be granted the MINTER_ROLE on the ERC-721 Items contract.\n */\n function deploy(address proxyOwner, address tokenOwner, address items) external returns (address proxyAddr);\n\n /**\n * Computes the address of a proxy instance.\n * @param proxyOwner The owner of the ERC-721 Sale proxy\n * @param tokenOwner The owner of the ERC-721 Sale implementation\n * @param items The ERC-721 Items contract address\n * @return proxyAddr The address of the ERC-721 Sale Proxy\n */\n function determineAddress(\n address proxyOwner,\n address tokenOwner,\n address items\n ) external returns (address proxyAddr);\n\n}\n\ninterface IERC721SaleFactorySignals {\n\n /**\n * Event emitted when a new ERC-721 Sale proxy contract is deployed.\n * @param proxyAddr The address of the deployed proxy.\n */\n event ERC721SaleDeployed(address proxyAddr);\n\n}\n\ninterface IERC721SaleFactory is IERC721SaleFactoryFunctions, IERC721SaleFactorySignals { }\n' }, - 'node_modules/@openzeppelin/contracts/access/Ownable.sol': { + 'src/proxies/TransparentUpgradeableBeaconProxy.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' + '// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8.19;\n\nimport { BeaconProxy, Proxy } from "./openzeppelin/BeaconProxy.sol";\nimport { ERC1967Proxy, TransparentUpgradeableProxy } from "./openzeppelin/TransparentUpgradeableProxy.sol";\n\ninterface ITransparentUpgradeableBeaconProxy {\n\n function initialize(address admin, address beacon, bytes memory data) external;\n\n}\n\nerror InvalidInitialization();\n\n/**\n * @dev As the underlying proxy implementation (TransparentUpgradeableProxy) allows the admin to call the implementation,\n * care must be taken to avoid proxy selector collisions. Implementation selectors must not conflict with the proxy selectors.\n * See https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector clashing].\n * The proxy selectors are:\n * - 0xcf7a1d77: initialize\n * - 0x3659cfe6: upgradeTo (from TransparentUpgradeableProxy)\n * - 0x4f1ef286: upgradeToAndCall (from TransparentUpgradeableProxy)\n * - 0x8f283970: changeAdmin (from TransparentUpgradeableProxy)\n * - 0xf851a440: admin (from TransparentUpgradeableProxy)\n * - 0x5c60da1b: implementation (from TransparentUpgradeableProxy)\n */\ncontract TransparentUpgradeableBeaconProxy is TransparentUpgradeableProxy, BeaconProxy {\n\n /**\n * Decode the initialization data from the msg.data and call the initialize function.\n */\n function _dispatchInitialize() private returns (bytes memory) {\n _requireZeroValue();\n\n (address admin, address beacon, bytes memory data) = abi.decode(msg.data[4:], (address, address, bytes));\n initialize(admin, beacon, data);\n\n return "";\n }\n\n function initialize(address admin, address beacon, bytes memory data) internal {\n if (_admin() != address(0)) {\n // Redundant call. This function can only be called when the admin is not set.\n revert InvalidInitialization();\n }\n _changeAdmin(admin);\n _upgradeBeaconToAndCall(beacon, data, false);\n }\n\n /**\n * @dev If the admin is not set, the fallback function is used to initialize the proxy.\n * @dev If the admin is set, the fallback function is used to delegatecall the implementation.\n */\n function _fallback() internal override(TransparentUpgradeableProxy, Proxy) {\n if (_getAdmin() == address(0)) {\n bytes memory ret;\n bytes4 selector = msg.sig;\n if (selector == ITransparentUpgradeableBeaconProxy.initialize.selector) {\n ret = _dispatchInitialize();\n // solhint-disable-next-line no-inline-assembly\n assembly {\n return(add(ret, 0x20), mload(ret))\n }\n }\n // When the admin is not set, the fallback function is used to initialize the proxy.\n revert InvalidInitialization();\n }\n TransparentUpgradeableProxy._fallback();\n }\n\n /**\n * Returns the current implementation address.\n * @dev This is the implementation address set by the admin, or the beacon implementation.\n */\n function _implementation() internal view override(ERC1967Proxy, BeaconProxy) returns (address) {\n address implementation = ERC1967Proxy._implementation();\n if (implementation != address(0)) {\n return implementation;\n }\n return BeaconProxy._implementation();\n }\n\n}\n' }, - 'node_modules/@openzeppelin/contracts/interfaces/IERC1967.sol': { + 'lib/openzeppelin/contracts/access/Ownable.sol': { content: - '// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (interfaces/IERC1967.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev ERC-1967: Proxy Storage Slots. This interface contains the events defined in the ERC.\n *\n * _Available since v4.8.3._\n */\ninterface IERC1967 {\n /**\n * @dev Emitted when the implementation is upgraded.\n */\n event Upgraded(address indexed implementation);\n\n /**\n * @dev Emitted when the admin account has changed.\n */\n event AdminChanged(address previousAdmin, address newAdmin);\n\n /**\n * @dev Emitted when the beacon is changed.\n */\n event BeaconUpgraded(address indexed beacon);\n}\n' + '// 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' }, - 'node_modules/@openzeppelin/contracts/interfaces/draft-IERC1822.sol': { + 'lib/openzeppelin/contracts/proxy/beacon/UpgradeableBeacon.sol': { content: - '// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (interfaces/draft-IERC1822.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev ERC1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified\n * proxy whose upgrades are fully controlled by the current implementation.\n */\ninterface IERC1822Proxiable {\n /**\n * @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation\n * address.\n *\n * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks\n * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this\n * function revert if invoked through a proxy.\n */\n function proxiableUUID() external view returns (bytes32);\n}\n' + '// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (proxy/beacon/UpgradeableBeacon.sol)\n\npragma solidity ^0.8.0;\n\nimport "./IBeacon.sol";\nimport "../../access/Ownable.sol";\nimport "../../utils/Address.sol";\n\n/**\n * @dev This contract is used in conjunction with one or more instances of {BeaconProxy} to determine their\n * implementation contract, which is where they will delegate all function calls.\n *\n * An owner is able to change the implementation the beacon points to, thus upgrading the proxies that use this beacon.\n */\ncontract UpgradeableBeacon is IBeacon, Ownable {\n address private _implementation;\n\n /**\n * @dev Emitted when the implementation returned by the beacon is changed.\n */\n event Upgraded(address indexed implementation);\n\n /**\n * @dev Sets the address of the initial implementation, and the deployer account as the owner who can upgrade the\n * beacon.\n */\n constructor(address implementation_) {\n _setImplementation(implementation_);\n }\n\n /**\n * @dev Returns the current implementation address.\n */\n function implementation() public view virtual override returns (address) {\n return _implementation;\n }\n\n /**\n * @dev Upgrades the beacon to a new implementation.\n *\n * Emits an {Upgraded} event.\n *\n * Requirements:\n *\n * - msg.sender must be the owner of the contract.\n * - `newImplementation` must be a contract.\n */\n function upgradeTo(address newImplementation) public virtual onlyOwner {\n _setImplementation(newImplementation);\n emit Upgraded(newImplementation);\n }\n\n /**\n * @dev Sets the implementation contract address for this beacon\n *\n * Requirements:\n *\n * - `newImplementation` must be a contract.\n */\n function _setImplementation(address newImplementation) private {\n require(Address.isContract(newImplementation), "UpgradeableBeacon: implementation is not a contract");\n _implementation = newImplementation;\n }\n}\n' }, - 'node_modules/@openzeppelin/contracts/proxy/ERC1967/ERC1967Upgrade.sol': { + 'lib/openzeppelin/contracts/utils/Create2.sol': { content: - '// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (proxy/ERC1967/ERC1967Upgrade.sol)\n\npragma solidity ^0.8.2;\n\nimport "../beacon/IBeacon.sol";\nimport "../../interfaces/IERC1967.sol";\nimport "../../interfaces/draft-IERC1822.sol";\nimport "../../utils/Address.sol";\nimport "../../utils/StorageSlot.sol";\n\n/**\n * @dev This abstract contract provides getters and event emitting update functions for\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots.\n *\n * _Available since v4.1._\n */\nabstract contract ERC1967Upgrade is IERC1967 {\n // This is the keccak-256 hash of "eip1967.proxy.rollback" subtracted by 1\n bytes32 private constant _ROLLBACK_SLOT = 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143;\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 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\n\n /**\n * @dev Returns the current implementation address.\n */\n function _getImplementation() internal view returns (address) {\n return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\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), "ERC1967: new implementation is not a contract");\n StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\n }\n\n /**\n * @dev Perform implementation upgrade\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 Perform implementation upgrade with additional setup call.\n *\n * Emits an {Upgraded} event.\n */\n function _upgradeToAndCall(address newImplementation, bytes memory data, bool forceCall) internal {\n _upgradeTo(newImplementation);\n if (data.length > 0 || forceCall) {\n Address.functionDelegateCall(newImplementation, data);\n }\n }\n\n /**\n * @dev Perform implementation upgrade with security checks for UUPS proxies, and additional setup call.\n *\n * Emits an {Upgraded} event.\n */\n function _upgradeToAndCallUUPS(address newImplementation, bytes memory data, bool forceCall) internal {\n // Upgrades from old implementations will perform a rollback test. This test requires the new\n // implementation to upgrade back to the old, non-ERC1822 compliant, implementation. Removing\n // this special case will break upgrade paths from old UUPS implementation to new ones.\n if (StorageSlot.getBooleanSlot(_ROLLBACK_SLOT).value) {\n _setImplementation(newImplementation);\n } else {\n try IERC1822Proxiable(newImplementation).proxiableUUID() returns (bytes32 slot) {\n require(slot == _IMPLEMENTATION_SLOT, "ERC1967Upgrade: unsupported proxiableUUID");\n } catch {\n revert("ERC1967Upgrade: new implementation is not UUPS");\n }\n _upgradeToAndCall(newImplementation, data, forceCall);\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 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\n\n /**\n * @dev Returns the current admin.\n */\n function _getAdmin() internal view returns (address) {\n return StorageSlot.getAddressSlot(_ADMIN_SLOT).value;\n }\n\n /**\n * @dev Stores a new address in the EIP1967 admin slot.\n */\n function _setAdmin(address newAdmin) private {\n require(newAdmin != address(0), "ERC1967: new admin is the zero address");\n StorageSlot.getAddressSlot(_ADMIN_SLOT).value = newAdmin;\n }\n\n /**\n * @dev Changes the admin of the proxy.\n *\n * Emits an {AdminChanged} event.\n */\n function _changeAdmin(address newAdmin) internal {\n emit AdminChanged(_getAdmin(), newAdmin);\n _setAdmin(newAdmin);\n }\n\n /**\n * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy.\n * This is bytes32(uint256(keccak256(\'eip1967.proxy.beacon\')) - 1)) and is validated in the constructor.\n */\n bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50;\n\n /**\n * @dev Returns the current beacon.\n */\n function _getBeacon() internal view returns (address) {\n return StorageSlot.getAddressSlot(_BEACON_SLOT).value;\n }\n\n /**\n * @dev Stores a new beacon in the EIP1967 beacon slot.\n */\n function _setBeacon(address newBeacon) private {\n require(Address.isContract(newBeacon), "ERC1967: new beacon is not a contract");\n require(\n Address.isContract(IBeacon(newBeacon).implementation()),\n "ERC1967: beacon implementation is not a contract"\n );\n StorageSlot.getAddressSlot(_BEACON_SLOT).value = newBeacon;\n }\n\n /**\n * @dev Perform beacon upgrade with additional setup call. Note: This upgrades the address of the beacon, it does\n * not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that).\n *\n * Emits a {BeaconUpgraded} event.\n */\n function _upgradeBeaconToAndCall(address newBeacon, bytes memory data, bool forceCall) internal {\n _setBeacon(newBeacon);\n emit BeaconUpgraded(newBeacon);\n if (data.length > 0 || forceCall) {\n Address.functionDelegateCall(IBeacon(newBeacon).implementation(), data);\n }\n }\n}\n' + '// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Create2.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Helper to make usage of the `CREATE2` EVM opcode easier and safer.\n * `CREATE2` can be used to compute in advance the address where a smart\n * contract will be deployed, which allows for interesting new mechanisms known\n * as \'counterfactual interactions\'.\n *\n * See the https://eips.ethereum.org/EIPS/eip-1014#motivation[EIP] for more\n * information.\n */\nlibrary Create2 {\n /**\n * @dev Deploys a contract using `CREATE2`. The address where the contract\n * will be deployed can be known in advance via {computeAddress}.\n *\n * The bytecode for a contract can be obtained from Solidity with\n * `type(contractName).creationCode`.\n *\n * Requirements:\n *\n * - `bytecode` must not be empty.\n * - `salt` must have not been used for `bytecode` already.\n * - the factory must have a balance of at least `amount`.\n * - if `amount` is non-zero, `bytecode` must have a `payable` constructor.\n */\n function deploy(uint256 amount, bytes32 salt, bytes memory bytecode) internal returns (address addr) {\n require(address(this).balance >= amount, "Create2: insufficient balance");\n require(bytecode.length != 0, "Create2: bytecode length is zero");\n /// @solidity memory-safe-assembly\n assembly {\n addr := create2(amount, add(bytecode, 0x20), mload(bytecode), salt)\n }\n require(addr != address(0), "Create2: Failed on deploy");\n }\n\n /**\n * @dev Returns the address where a contract will be stored if deployed via {deploy}. Any change in the\n * `bytecodeHash` or `salt` will result in a new destination address.\n */\n function computeAddress(bytes32 salt, bytes32 bytecodeHash) internal view returns (address) {\n return computeAddress(salt, bytecodeHash, address(this));\n }\n\n /**\n * @dev Returns the address where a contract will be stored if deployed via {deploy} from a contract located at\n * `deployer`. If `deployer` is this contract\'s address, returns the same value as {computeAddress}.\n */\n function computeAddress(bytes32 salt, bytes32 bytecodeHash, address deployer) internal pure returns (address addr) {\n /// @solidity memory-safe-assembly\n assembly {\n let ptr := mload(0x40) // Get free memory pointer\n\n // | | ↓ ptr ... ↓ ptr + 0x0B (start) ... ↓ ptr + 0x20 ... ↓ ptr + 0x40 ... |\n // |-------------------|---------------------------------------------------------------------------|\n // | bytecodeHash | CCCCCCCCCCCCC...CC |\n // | salt | BBBBBBBBBBBBB...BB |\n // | deployer | 000000...0000AAAAAAAAAAAAAAAAAAA...AA |\n // | 0xFF | FF |\n // |-------------------|---------------------------------------------------------------------------|\n // | memory | 000000...00FFAAAAAAAAAAAAAAAAAAA...AABBBBBBBBBBBBB...BBCCCCCCCCCCCCC...CC |\n // | keccak(start, 85) | ↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑ |\n\n mstore(add(ptr, 0x40), bytecodeHash)\n mstore(add(ptr, 0x20), salt)\n mstore(ptr, deployer) // Right-aligned with 12 preceding garbage bytes\n let start := add(ptr, 0x0b) // The hashed data starts at the final garbage byte which we will set to 0xff\n mstore8(start, 0xff)\n addr := keccak256(start, 85)\n }\n }\n}\n' }, - 'node_modules/@openzeppelin/contracts/proxy/Proxy.sol': { + 'src/tokens/ERC721/utility/sale/IERC721Sale.sol': { content: - "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (proxy/Proxy.sol)\n\npragma solidity ^0.8.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 internal call site, it will return directly to the external caller.\n */\n function _delegate(address implementation) internal virtual {\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 {\n revert(0, returndatasize())\n }\n default {\n return(0, returndatasize())\n }\n }\n }\n\n /**\n * @dev This is a virtual function that should be overridden so it returns the address to which the fallback function\n * and {_fallback} should delegate.\n */\n function _implementation() internal view virtual 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 internal call site, it will return directly to the external caller.\n */\n function _fallback() internal virtual {\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() external payable virtual {\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() external payable virtual {\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 overridden should call `super._beforeFallback()`.\n */\n function _beforeFallback() internal virtual {}\n}\n" + '// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8.19;\n\ninterface IERC721SaleFunctions {\n\n struct SaleDetails {\n uint256 supplyCap; // 0 supply cap indicates unlimited supply\n uint256 cost;\n address paymentToken; // ERC20 token address for payment. address(0) indicated payment in ETH.\n uint64 startTime;\n uint64 endTime; // 0 end time indicates sale inactive\n bytes32 merkleRoot; // Root of allowed addresses\n }\n\n /**\n * Mint tokens.\n * @param to Address to mint tokens to.\n * @param amount Amount of tokens to mint.\n * @param paymentToken ERC20 token address to accept payment in. address(0) indicates ETH.\n * @param maxTotal Maximum amount of payment tokens.\n * @param proof Merkle proof for allowlist minting.\n * @notice Sale must be active for all tokens.\n * @dev An empty proof is supplied when no proof is required.\n */\n function mint(\n address to,\n uint256 amount,\n address paymentToken,\n uint256 maxTotal,\n bytes32[] memory proof\n ) external payable;\n\n /**\n * Set the sale details.\n * @param supplyCap The maximum number of tokens that can be minted. 0 indicates unlimited supply.\n * @param cost The amount of payment tokens to accept for each token minted.\n * @param paymentToken The ERC20 token address to accept payment in. address(0) indicates ETH.\n * @param startTime The start time of the sale. Tokens cannot be minted before this time.\n * @param endTime The end time of the sale. Tokens cannot be minted after this time.\n * @param merkleRoot The merkle root for allowlist minting.\n */\n function setSaleDetails(\n uint256 supplyCap,\n uint256 cost,\n address paymentToken,\n uint64 startTime,\n uint64 endTime,\n bytes32 merkleRoot\n ) external;\n\n /**\n * Get sale details.\n * @return Sale details.\n */\n function saleDetails() external view returns (SaleDetails memory);\n\n}\n\ninterface IERC721SaleSignals {\n\n event SaleDetailsUpdated(\n uint256 supplyCap, uint256 cost, address paymentToken, uint64 startTime, uint64 endTime, bytes32 merkleRoot\n );\n event ItemsMinted(address to, uint256 amount);\n\n /**\n * Contract already initialized.\n */\n error InvalidInitialization();\n\n /**\n * Sale details supplied are invalid.\n */\n error InvalidSaleDetails();\n\n /**\n * Sale is not active.\n */\n error SaleInactive();\n\n /**\n * Insufficient supply.\n * @param currentSupply Current supply.\n * @param amount Amount to mint.\n * @param maxSupply Maximum supply.\n */\n error InsufficientSupply(uint256 currentSupply, uint256 amount, uint256 maxSupply);\n\n /**\n * Insufficient tokens for payment.\n * @param currency Currency address. address(0) indicates ETH.\n * @param expected Expected amount of tokens.\n * @param actual Actual amount of tokens.\n */\n error InsufficientPayment(address currency, uint256 expected, uint256 actual);\n\n}\n\ninterface IERC721Sale is IERC721SaleFunctions, IERC721SaleSignals { }\n' }, - 'node_modules/@openzeppelin/contracts/proxy/beacon/IBeacon.sol': { + 'src/tokens/common/MerkleProofSingleUse.sol': { content: - '// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (proxy/beacon/IBeacon.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev This is the interface that {BeaconProxy} expects of its beacon.\n */\ninterface IBeacon {\n /**\n * @dev Must return an address that can be used as a delegate call target.\n *\n * {BeaconProxy} will check that this address is a contract.\n */\n function implementation() external view returns (address);\n}\n' + '// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8.19;\n\nimport { IMerkleProofSingleUse } from "@0xsequence/contracts-library/tokens/common/IMerkleProofSingleUse.sol";\nimport { MerkleProof } from "@openzeppelin/contracts/utils/cryptography/MerkleProof.sol";\n\n/**\n * Require single use merkle proofs per address.\n */\nabstract contract MerkleProofSingleUse is IMerkleProofSingleUse {\n\n // Stores proofs used by an address\n mapping(address => mapping(bytes32 => bool)) private _proofUsed;\n\n /**\n * Requires the given merkle proof to be valid.\n * @param root Merkle root.\n * @param proof Merkle proof.\n * @param addr Address to check.\n * @param salt Salt used to generate the merkle leaf.\n * @notice Fails when the proof is invalid or the proof has already been claimed by this address.\n * @dev This function reverts on failure.\n */\n function requireMerkleProof(bytes32 root, bytes32[] calldata proof, address addr, bytes32 salt) internal {\n if (root != bytes32(0)) {\n if (!checkMerkleProof(root, proof, addr, salt)) {\n revert MerkleProofInvalid(root, proof, addr, salt);\n }\n _proofUsed[addr][root] = true;\n }\n }\n\n /**\n * Checks if the given merkle proof is valid.\n * @param root Merkle root.\n * @param proof Merkle proof.\n * @param addr Address to check.\n * @param salt Salt used to generate the merkle leaf.\n * @return True if the proof is valid and has not yet been used by {addr}.\n */\n function checkMerkleProof(\n bytes32 root,\n bytes32[] calldata proof,\n address addr,\n bytes32 salt\n ) public view returns (bool) {\n return !_proofUsed[addr][root] && MerkleProof.verify(proof, root, keccak256(abi.encodePacked(addr, salt)));\n }\n\n}\n' }, - 'node_modules/@openzeppelin/contracts/proxy/beacon/UpgradeableBeacon.sol': { + 'src/tokens/common/WithdrawControlled.sol': { content: - '// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (proxy/beacon/UpgradeableBeacon.sol)\n\npragma solidity ^0.8.0;\n\nimport "./IBeacon.sol";\nimport "../../access/Ownable.sol";\nimport "../../utils/Address.sol";\n\n/**\n * @dev This contract is used in conjunction with one or more instances of {BeaconProxy} to determine their\n * implementation contract, which is where they will delegate all function calls.\n *\n * An owner is able to change the implementation the beacon points to, thus upgrading the proxies that use this beacon.\n */\ncontract UpgradeableBeacon is IBeacon, Ownable {\n address private _implementation;\n\n /**\n * @dev Emitted when the implementation returned by the beacon is changed.\n */\n event Upgraded(address indexed implementation);\n\n /**\n * @dev Sets the address of the initial implementation, and the deployer account as the owner who can upgrade the\n * beacon.\n */\n constructor(address implementation_) {\n _setImplementation(implementation_);\n }\n\n /**\n * @dev Returns the current implementation address.\n */\n function implementation() public view virtual override returns (address) {\n return _implementation;\n }\n\n /**\n * @dev Upgrades the beacon to a new implementation.\n *\n * Emits an {Upgraded} event.\n *\n * Requirements:\n *\n * - msg.sender must be the owner of the contract.\n * - `newImplementation` must be a contract.\n */\n function upgradeTo(address newImplementation) public virtual onlyOwner {\n _setImplementation(newImplementation);\n emit Upgraded(newImplementation);\n }\n\n /**\n * @dev Sets the implementation contract address for this beacon\n *\n * Requirements:\n *\n * - `newImplementation` must be a contract.\n */\n function _setImplementation(address newImplementation) private {\n require(Address.isContract(newImplementation), "UpgradeableBeacon: implementation is not a contract");\n _implementation = newImplementation;\n }\n}\n' + '// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8.19;\n\nimport { IWithdrawControlled } from "@0xsequence/contracts-library/tokens/common/IWithdrawControlled.sol";\n\nimport { AccessControlEnumerable } from "@openzeppelin/contracts/access/AccessControlEnumerable.sol";\nimport { IERC20, SafeERC20 } from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";\n\n/**\n * An abstract contract that allows ETH and ERC20 tokens stored in the contract to be withdrawn.\n */\nabstract contract WithdrawControlled is AccessControlEnumerable, IWithdrawControlled {\n\n bytes32 internal constant WITHDRAW_ROLE = keccak256("WITHDRAW_ROLE");\n\n //\n // Withdraw\n //\n\n /**\n * Withdraws ERC20 tokens owned by this contract.\n * @param token The ERC20 token address.\n * @param to Address to withdraw to.\n * @param value Amount to withdraw.\n * @notice Only callable by an address with the withdraw role.\n */\n function withdrawERC20(address token, address to, uint256 value) public onlyRole(WITHDRAW_ROLE) {\n SafeERC20.safeTransfer(IERC20(token), to, value);\n }\n\n /**\n * Withdraws ETH owned by this sale contract.\n * @param to Address to withdraw to.\n * @param value Amount to withdraw.\n * @notice Only callable by an address with the withdraw role.\n */\n function withdrawETH(address to, uint256 value) public onlyRole(WITHDRAW_ROLE) {\n (bool success,) = to.call{ value: value }("");\n if (!success) {\n revert WithdrawFailed();\n }\n }\n\n}\n' }, - 'node_modules/@openzeppelin/contracts/token/ERC20/IERC20.sol': { + 'src/tokens/ERC721/presets/items/IERC721Items.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" + '// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8.19;\n\ninterface IERC721ItemsFunctions {\n\n /**\n * Mint tokens.\n * @param to Address to mint tokens to.\n * @param amount Amount of tokens to mint.\n */\n function mint(address to, uint256 amount) external;\n\n}\n\ninterface IERC721ItemsSignals {\n\n /**\n * Invalid initialization error.\n */\n error InvalidInitialization();\n\n}\n\ninterface IERC721Items is IERC721ItemsFunctions, IERC721ItemsSignals { }\n' }, - 'node_modules/@openzeppelin/contracts/token/ERC20/extensions/IERC20Permit.sol': { + 'lib/chiru-labs/erc721a/contracts/extensions/ERC721AQueryable.sol': { content: - "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/extensions/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" + "// SPDX-License-Identifier: MIT\n// ERC721A Contracts v4.3.0\n// Creator: Chiru Labs\n\npragma solidity ^0.8.4;\n\nimport './IERC721AQueryable.sol';\nimport '../ERC721A.sol';\n\n/**\n * @title ERC721AQueryable.\n *\n * @dev ERC721A subclass with convenience query functions.\n */\nabstract contract ERC721AQueryable is ERC721A, IERC721AQueryable {\n /**\n * @dev Returns the `TokenOwnership` struct at `tokenId` without reverting.\n *\n * If the `tokenId` is out of bounds:\n *\n * - `addr = address(0)`\n * - `startTimestamp = 0`\n * - `burned = false`\n * - `extraData = 0`\n *\n * If the `tokenId` is burned:\n *\n * - `addr =
`\n * - `startTimestamp = `\n * - `burned = true`\n * - `extraData = `\n *\n * Otherwise:\n *\n * - `addr =
`\n * - `startTimestamp = `\n * - `burned = false`\n * - `extraData = `\n */\n function explicitOwnershipOf(uint256 tokenId)\n public\n view\n virtual\n override\n returns (TokenOwnership memory ownership)\n {\n unchecked {\n if (tokenId >= _startTokenId()) {\n if (tokenId > _sequentialUpTo()) return _ownershipAt(tokenId);\n\n if (tokenId < _nextTokenId()) {\n // If the `tokenId` is within bounds,\n // scan backwards for the initialized ownership slot.\n while (!_ownershipIsInitialized(tokenId)) --tokenId;\n return _ownershipAt(tokenId);\n }\n }\n }\n }\n\n /**\n * @dev Returns an array of `TokenOwnership` structs at `tokenIds` in order.\n * See {ERC721AQueryable-explicitOwnershipOf}\n */\n function explicitOwnershipsOf(uint256[] calldata tokenIds)\n external\n view\n virtual\n override\n returns (TokenOwnership[] memory)\n {\n TokenOwnership[] memory ownerships;\n uint256 i = tokenIds.length;\n assembly {\n // Grab the free memory pointer.\n ownerships := mload(0x40)\n // Store the length.\n mstore(ownerships, i)\n // Allocate one word for the length,\n // `tokenIds.length` words for the pointers.\n i := shl(5, i) // Multiply `i` by 32.\n mstore(0x40, add(add(ownerships, 0x20), i))\n }\n while (i != 0) {\n uint256 tokenId;\n assembly {\n i := sub(i, 0x20)\n tokenId := calldataload(add(tokenIds.offset, i))\n }\n TokenOwnership memory ownership = explicitOwnershipOf(tokenId);\n assembly {\n // Store the pointer of `ownership` in the `ownerships` array.\n mstore(add(add(ownerships, 0x20), i), ownership)\n }\n }\n return ownerships;\n }\n\n /**\n * @dev Returns an array of token IDs owned by `owner`,\n * in the range [`start`, `stop`)\n * (i.e. `start <= tokenId < stop`).\n *\n * This function allows for tokens to be queried if the collection\n * grows too big for a single call of {ERC721AQueryable-tokensOfOwner}.\n *\n * Requirements:\n *\n * - `start < stop`\n */\n function tokensOfOwnerIn(\n address owner,\n uint256 start,\n uint256 stop\n ) external view virtual override returns (uint256[] memory) {\n return _tokensOfOwnerIn(owner, start, stop);\n }\n\n /**\n * @dev Returns an array of token IDs owned by `owner`.\n *\n * This function scans the ownership mapping and is O(`totalSupply`) in complexity.\n * It is meant to be called off-chain.\n *\n * See {ERC721AQueryable-tokensOfOwnerIn} for splitting the scan into\n * multiple smaller scans if the collection is large enough to cause\n * an out-of-gas error (10K collections should be fine).\n */\n function tokensOfOwner(address owner) external view virtual override returns (uint256[] memory) {\n // If spot mints are enabled, full-range scan is disabled.\n if (_sequentialUpTo() != type(uint256).max) _revert(NotCompatibleWithSpotMints.selector);\n uint256 start = _startTokenId();\n uint256 stop = _nextTokenId();\n uint256[] memory tokenIds;\n if (start != stop) tokenIds = _tokensOfOwnerIn(owner, start, stop);\n return tokenIds;\n }\n\n /**\n * @dev Helper function for returning an array of token IDs owned by `owner`.\n *\n * Note that this function is optimized for smaller bytecode size over runtime gas,\n * since it is meant to be called off-chain.\n */\n function _tokensOfOwnerIn(\n address owner,\n uint256 start,\n uint256 stop\n ) private view returns (uint256[] memory tokenIds) {\n unchecked {\n if (start >= stop) _revert(InvalidQueryRange.selector);\n // Set `start = max(start, _startTokenId())`.\n if (start < _startTokenId()) start = _startTokenId();\n uint256 nextTokenId = _nextTokenId();\n // If spot mints are enabled, scan all the way until the specified `stop`.\n uint256 stopLimit = _sequentialUpTo() != type(uint256).max ? stop : nextTokenId;\n // Set `stop = min(stop, stopLimit)`.\n if (stop >= stopLimit) stop = stopLimit;\n // Number of tokens to scan.\n uint256 tokenIdsMaxLength = balanceOf(owner);\n // Set `tokenIdsMaxLength` to zero if the range contains no tokens.\n if (start >= stop) tokenIdsMaxLength = 0;\n // If there are one or more tokens to scan.\n if (tokenIdsMaxLength != 0) {\n // Set `tokenIdsMaxLength = min(balanceOf(owner), tokenIdsMaxLength)`.\n if (stop - start <= tokenIdsMaxLength) tokenIdsMaxLength = stop - start;\n uint256 m; // Start of available memory.\n assembly {\n // Grab the free memory pointer.\n tokenIds := mload(0x40)\n // Allocate one word for the length, and `tokenIdsMaxLength` words\n // for the data. `shl(5, x)` is equivalent to `mul(32, x)`.\n m := add(tokenIds, shl(5, add(tokenIdsMaxLength, 1)))\n mstore(0x40, m)\n }\n // We need to call `explicitOwnershipOf(start)`,\n // because the slot at `start` may not be initialized.\n TokenOwnership memory ownership = explicitOwnershipOf(start);\n address currOwnershipAddr;\n // If the starting slot exists (i.e. not burned),\n // initialize `currOwnershipAddr`.\n // `ownership.address` will not be zero,\n // as `start` is clamped to the valid token ID range.\n if (!ownership.burned) currOwnershipAddr = ownership.addr;\n uint256 tokenIdsIdx;\n // Use a do-while, which is slightly more efficient for this case,\n // as the array will at least contain one element.\n do {\n if (_sequentialUpTo() != type(uint256).max) {\n // Skip the remaining unused sequential slots.\n if (start == nextTokenId) start = _sequentialUpTo() + 1;\n // Reset `currOwnershipAddr`, as each spot-minted token is a batch of one.\n if (start > _sequentialUpTo()) currOwnershipAddr = address(0);\n }\n ownership = _ownershipAt(start); // This implicitly allocates memory.\n assembly {\n switch mload(add(ownership, 0x40))\n // if `ownership.burned == false`.\n case 0 {\n // if `ownership.addr != address(0)`.\n // The `addr` already has it's upper 96 bits clearned,\n // since it is written to memory with regular Solidity.\n if mload(ownership) {\n currOwnershipAddr := mload(ownership)\n }\n // if `currOwnershipAddr == owner`.\n // The `shl(96, x)` is to make the comparison agnostic to any\n // dirty upper 96 bits in `owner`.\n if iszero(shl(96, xor(currOwnershipAddr, owner))) {\n tokenIdsIdx := add(tokenIdsIdx, 1)\n mstore(add(tokenIds, shl(5, tokenIdsIdx)), start)\n }\n }\n // Otherwise, reset `currOwnershipAddr`.\n // This handles the case of batch burned tokens\n // (burned bit of first slot set, remaining slots left uninitialized).\n default {\n currOwnershipAddr := 0\n }\n start := add(start, 1)\n // Free temporary memory implicitly allocated for ownership\n // to avoid quadratic memory expansion costs.\n mstore(0x40, m)\n }\n } while (!(start == stop || tokenIdsIdx == tokenIdsMaxLength));\n // Store the length of the array.\n assembly {\n mstore(tokenIds, tokenIdsIdx)\n }\n }\n }\n }\n}\n" }, - 'node_modules/@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol': { + 'src/proxies/openzeppelin/BeaconProxy.sol': { content: - '// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.3) (token/ERC20/utils/SafeERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport "../IERC20.sol";\nimport "../extensions/IERC20Permit.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 /**\n * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,\n * non-reverting calls are assumed to be successful.\n */\n function safeTransfer(IERC20 token, address to, uint256 value) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\n }\n\n /**\n * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the\n * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.\n */\n function safeTransferFrom(IERC20 token, address from, address to, uint256 value) 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(IERC20 token, address spender, uint256 value) 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 /**\n * @dev Increase the calling contract\'s allowance toward `spender` by `value`. If `token` returns no value,\n * non-reverting calls are assumed to be successful.\n */\n function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {\n uint256 oldAllowance = token.allowance(address(this), spender);\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance + value));\n }\n\n /**\n * @dev Decrease the calling contract\'s allowance toward `spender` by `value`. If `token` returns no value,\n * non-reverting calls are assumed to be successful.\n */\n function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal {\n unchecked {\n uint256 oldAllowance = token.allowance(address(this), spender);\n require(oldAllowance >= value, "SafeERC20: decreased allowance below zero");\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance - value));\n }\n }\n\n /**\n * @dev Set the calling contract\'s allowance toward `spender` to `value`. If `token` returns no value,\n * non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval\n * to be set to zero before setting it to a non-zero value, such as USDT.\n */\n function forceApprove(IERC20 token, address spender, uint256 value) internal {\n bytes memory approvalCall = abi.encodeWithSelector(token.approve.selector, spender, value);\n\n if (!_callOptionalReturnBool(token, approvalCall)) {\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, 0));\n _callOptionalReturn(token, approvalCall);\n }\n }\n\n /**\n * @dev Use a ERC-2612 signature to set the `owner` approval toward `spender` on `token`.\n * Revert on invalid signature.\n */\n function safePermit(\n IERC20Permit token,\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) internal {\n uint256 nonceBefore = token.nonces(owner);\n token.permit(owner, spender, value, deadline, v, r, s);\n uint256 nonceAfter = token.nonces(owner);\n require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed");\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 require(returndata.length == 0 || abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");\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 * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.\n */\n function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {\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 cannot use {Address-functionCall} here since this should return false\n // and not revert is the subcall reverts.\n\n (bool success, bytes memory returndata) = address(token).call(data);\n return\n success && (returndata.length == 0 || abi.decode(returndata, (bool))) && Address.isContract(address(token));\n }\n}\n' + '// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/beacon/BeaconProxy.sol)\n\n// Note: This implementation is an exact copy with the constructor removed, and pragma and imports updated.\n\npragma solidity ^0.8.19;\n\nimport "@openzeppelin/contracts/proxy/ERC1967/ERC1967Upgrade.sol";\nimport "@openzeppelin/contracts/proxy/Proxy.sol";\nimport "@openzeppelin/contracts/proxy/beacon/IBeacon.sol";\n\n/**\n * @dev This contract implements a proxy that gets the implementation address for each call from an {UpgradeableBeacon}.\n *\n * The beacon address is stored in storage slot `uint256(keccak256(\'eip1967.proxy.beacon\')) - 1`, so that it doesn\'t\n * conflict with the storage layout of the implementation behind the proxy.\n *\n * _Available since v3.4._\n */\ncontract BeaconProxy is Proxy, ERC1967Upgrade {\n\n /**\n * @dev Returns the current beacon address.\n */\n function _beacon() internal view virtual returns (address) {\n return _getBeacon();\n }\n\n /**\n * @dev Returns the current implementation address of the associated beacon.\n */\n function _implementation() internal view virtual override returns (address) {\n return IBeacon(_getBeacon()).implementation();\n }\n\n /**\n * @dev Changes the proxy to use a new beacon. Deprecated: see {_upgradeBeaconToAndCall}.\n *\n * If `data` is nonempty, it\'s used as data in a delegate call to the implementation returned by the beacon.\n *\n * Requirements:\n *\n * - `beacon` must be a contract.\n * - The implementation returned by `beacon` must be a contract.\n */\n function _setBeacon(address beacon, bytes memory data) internal virtual {\n _upgradeBeaconToAndCall(beacon, data, false);\n }\n\n}\n' }, - 'node_modules/@openzeppelin/contracts/utils/Address.sol': { + 'src/proxies/openzeppelin/TransparentUpgradeableProxy.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 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 * 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' + '// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (proxy/transparent/TransparentUpgradeableProxy.sol)\n\n/// @notice This implementation is a copy of OpenZeppelin\'s with the following changes:\n/// - Pragma updated\n/// - Imports updated\n/// - Constructor removed\n/// - Allows admin to call implementation\n\npragma solidity ^0.8.19;\n\nimport "./ERC1967Proxy.sol";\n\n/**\n * @dev Interface for {TransparentUpgradeableProxy}. In order to implement transparency, {TransparentUpgradeableProxy}\n * does not implement this interface directly, and some of its functions are implemented by an internal dispatch\n * mechanism. The compiler is unaware that these functions are implemented by {TransparentUpgradeableProxy} and will not\n * include them in the ABI so this interface must be used to interact with it.\n */\ninterface ITransparentUpgradeableProxy is IERC1967 {\n\n function admin() external view returns (address);\n\n function implementation() external view returns (address);\n\n function changeAdmin(\n address\n ) external;\n\n function upgradeTo(\n address\n ) external;\n\n function upgradeToAndCall(address, bytes memory) external payable;\n\n}\n\n/**\n * @dev This contract implements a proxy that is upgradeable by an admin.\n *\n * Unlike the original OpenZeppelin implementation, this contract does not prevent the admin from calling the implementation.\n * This potentially exposes the admin to a proxy selector attack. See\n * https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector clashing].\n * When using this contract, you must ensure that the implementation function selectors do not clash with the proxy selectors.\n * The proxy selectors are:\n * - 0x3659cfe6: upgradeTo\n * - 0x4f1ef286: upgradeToAndCall\n * - 0x8f283970: changeAdmin\n * - 0xf851a440: admin\n * - 0x5c60da1b: implementation\n *\n * NOTE: The real interface of this proxy is that defined in `ITransparentUpgradeableProxy`. This contract does not\n * inherit from that interface, and instead the admin functions are implicitly implemented using a custom dispatch\n * mechanism in `_fallback`. Consequently, the compiler will not produce an ABI for this contract. This is necessary to\n * fully implement transparency without decoding reverts caused by selector clashes between the proxy and the\n * implementation.\n *\n * WARNING: It is not recommended to extend this contract to add additional external functions. If you do so, the compiler\n * will not check that there are no selector conflicts, due to the note above. A selector clash between any new function\n * and the functions declared in {ITransparentUpgradeableProxy} will be resolved in favor of the new one. This could\n * render the admin operations inaccessible, which could prevent upgradeability. Transparency may also be compromised.\n */\ncontract TransparentUpgradeableProxy is ERC1967Proxy {\n\n /**\n * @dev Modifier used internally that will delegate the call to the implementation unless the sender is the admin.\n *\n * CAUTION: This modifier is deprecated, as it could cause issues if the modified function has arguments, and the\n * implementation provides a function with the same selector.\n */\n modifier ifAdmin() {\n if (msg.sender == _getAdmin()) {\n _;\n } else {\n _fallback();\n }\n }\n\n /**\n * @dev If caller is the admin process the call internally, otherwise transparently fallback to the proxy behavior\n */\n function _fallback() internal virtual override {\n if (msg.sender == _getAdmin()) {\n bytes memory ret;\n bytes4 selector = msg.sig;\n if (selector == ITransparentUpgradeableProxy.upgradeTo.selector) {\n ret = _dispatchUpgradeTo();\n } else if (selector == ITransparentUpgradeableProxy.upgradeToAndCall.selector) {\n ret = _dispatchUpgradeToAndCall();\n } else if (selector == ITransparentUpgradeableProxy.changeAdmin.selector) {\n ret = _dispatchChangeAdmin();\n } else if (selector == ITransparentUpgradeableProxy.admin.selector) {\n ret = _dispatchAdmin();\n } else if (selector == ITransparentUpgradeableProxy.implementation.selector) {\n ret = _dispatchImplementation();\n } else {\n // Call implementation\n return super._fallback();\n }\n assembly {\n return(add(ret, 0x20), mload(ret))\n }\n } else {\n super._fallback();\n }\n }\n\n /**\n * @dev Returns the current admin.\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 _dispatchAdmin() private returns (bytes memory) {\n _requireZeroValue();\n\n address admin = _getAdmin();\n return abi.encode(admin);\n }\n\n /**\n * @dev Returns the current implementation.\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 _dispatchImplementation() private returns (bytes memory) {\n _requireZeroValue();\n\n address implementation = _implementation();\n return abi.encode(implementation);\n }\n\n /**\n * @dev Changes the admin of the proxy.\n *\n * Emits an {AdminChanged} event.\n */\n function _dispatchChangeAdmin() private returns (bytes memory) {\n _requireZeroValue();\n\n address newAdmin = abi.decode(msg.data[4:], (address));\n _changeAdmin(newAdmin);\n\n return "";\n }\n\n /**\n * @dev Upgrade the implementation of the proxy.\n */\n function _dispatchUpgradeTo() private returns (bytes memory) {\n _requireZeroValue();\n\n address newImplementation = abi.decode(msg.data[4:], (address));\n _upgradeToAndCall(newImplementation, bytes(""), false);\n\n return "";\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 function _dispatchUpgradeToAndCall() private returns (bytes memory) {\n (address newImplementation, bytes memory data) = abi.decode(msg.data[4:], (address, bytes));\n _upgradeToAndCall(newImplementation, data, true);\n\n return "";\n }\n\n /**\n * @dev Returns the current admin.\n *\n * CAUTION: This function is deprecated. Use {ERC1967Upgrade-_getAdmin} instead.\n */\n function _admin() internal view virtual returns (address) {\n return _getAdmin();\n }\n\n /**\n * @dev To keep this contract fully transparent, all `ifAdmin` functions must be payable. This helper is here to\n * emulate some proxy functions being non-payable while still allowing value to pass through.\n */\n function _requireZeroValue() internal {\n require(msg.value == 0);\n }\n\n}\n' }, - 'node_modules/@openzeppelin/contracts/utils/Context.sol': { + 'lib/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' }, - 'node_modules/@openzeppelin/contracts/utils/Create2.sol': { + 'lib/openzeppelin/contracts/proxy/beacon/IBeacon.sol': { content: - '// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Create2.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Helper to make usage of the `CREATE2` EVM opcode easier and safer.\n * `CREATE2` can be used to compute in advance the address where a smart\n * contract will be deployed, which allows for interesting new mechanisms known\n * as \'counterfactual interactions\'.\n *\n * See the https://eips.ethereum.org/EIPS/eip-1014#motivation[EIP] for more\n * information.\n */\nlibrary Create2 {\n /**\n * @dev Deploys a contract using `CREATE2`. The address where the contract\n * will be deployed can be known in advance via {computeAddress}.\n *\n * The bytecode for a contract can be obtained from Solidity with\n * `type(contractName).creationCode`.\n *\n * Requirements:\n *\n * - `bytecode` must not be empty.\n * - `salt` must have not been used for `bytecode` already.\n * - the factory must have a balance of at least `amount`.\n * - if `amount` is non-zero, `bytecode` must have a `payable` constructor.\n */\n function deploy(uint256 amount, bytes32 salt, bytes memory bytecode) internal returns (address addr) {\n require(address(this).balance >= amount, "Create2: insufficient balance");\n require(bytecode.length != 0, "Create2: bytecode length is zero");\n /// @solidity memory-safe-assembly\n assembly {\n addr := create2(amount, add(bytecode, 0x20), mload(bytecode), salt)\n }\n require(addr != address(0), "Create2: Failed on deploy");\n }\n\n /**\n * @dev Returns the address where a contract will be stored if deployed via {deploy}. Any change in the\n * `bytecodeHash` or `salt` will result in a new destination address.\n */\n function computeAddress(bytes32 salt, bytes32 bytecodeHash) internal view returns (address) {\n return computeAddress(salt, bytecodeHash, address(this));\n }\n\n /**\n * @dev Returns the address where a contract will be stored if deployed via {deploy} from a contract located at\n * `deployer`. If `deployer` is this contract\'s address, returns the same value as {computeAddress}.\n */\n function computeAddress(bytes32 salt, bytes32 bytecodeHash, address deployer) internal pure returns (address addr) {\n /// @solidity memory-safe-assembly\n assembly {\n let ptr := mload(0x40) // Get free memory pointer\n\n // | | ↓ ptr ... ↓ ptr + 0x0B (start) ... ↓ ptr + 0x20 ... ↓ ptr + 0x40 ... |\n // |-------------------|---------------------------------------------------------------------------|\n // | bytecodeHash | CCCCCCCCCCCCC...CC |\n // | salt | BBBBBBBBBBBBB...BB |\n // | deployer | 000000...0000AAAAAAAAAAAAAAAAAAA...AA |\n // | 0xFF | FF |\n // |-------------------|---------------------------------------------------------------------------|\n // | memory | 000000...00FFAAAAAAAAAAAAAAAAAAA...AABBBBBBBBBBBBB...BBCCCCCCCCCCCCC...CC |\n // | keccak(start, 85) | ↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑ |\n\n mstore(add(ptr, 0x40), bytecodeHash)\n mstore(add(ptr, 0x20), salt)\n mstore(ptr, deployer) // Right-aligned with 12 preceding garbage bytes\n let start := add(ptr, 0x0b) // The hashed data starts at the final garbage byte which we will set to 0xff\n mstore8(start, 0xff)\n addr := keccak256(start, 85)\n }\n }\n}\n' + '// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (proxy/beacon/IBeacon.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev This is the interface that {BeaconProxy} expects of its beacon.\n */\ninterface IBeacon {\n /**\n * @dev Must return an address that can be used as a delegate call target.\n *\n * {BeaconProxy} will check that this address is a contract.\n */\n function implementation() external view returns (address);\n}\n' }, - 'node_modules/@openzeppelin/contracts/utils/StorageSlot.sol': { + 'lib/openzeppelin/contracts/utils/Address.sol': { content: - '// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/StorageSlot.sol)\n// This file was procedurally generated from scripts/generate/templates/StorageSlot.js.\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Library for reading and writing primitive types to specific storage slots.\n *\n * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.\n * This library helps with reading and writing to such slots without the need for inline assembly.\n *\n * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.\n *\n * Example usage to set ERC1967 implementation slot:\n * ```solidity\n * contract ERC1967 {\n * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\n *\n * function _getImplementation() internal view returns (address) {\n * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\n * }\n *\n * function _setImplementation(address newImplementation) internal {\n * require(Address.isContract(newImplementation), "ERC1967: new implementation is not a contract");\n * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\n * }\n * }\n * ```\n *\n * _Available since v4.1 for `address`, `bool`, `bytes32`, `uint256`._\n * _Available since v4.9 for `string`, `bytes`._\n */\nlibrary StorageSlot {\n struct AddressSlot {\n address value;\n }\n\n struct BooleanSlot {\n bool value;\n }\n\n struct Bytes32Slot {\n bytes32 value;\n }\n\n struct Uint256Slot {\n uint256 value;\n }\n\n struct StringSlot {\n string value;\n }\n\n struct BytesSlot {\n bytes value;\n }\n\n /**\n * @dev Returns an `AddressSlot` with member `value` located at `slot`.\n */\n function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `BooleanSlot` with member `value` located at `slot`.\n */\n function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.\n */\n function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `Uint256Slot` with member `value` located at `slot`.\n */\n function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `StringSlot` with member `value` located at `slot`.\n */\n function getStringSlot(bytes32 slot) internal pure returns (StringSlot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `StringSlot` representation of the string storage pointer `store`.\n */\n function getStringSlot(string storage store) internal pure returns (StringSlot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := store.slot\n }\n }\n\n /**\n * @dev Returns an `BytesSlot` with member `value` located at `slot`.\n */\n function getBytesSlot(bytes32 slot) internal pure returns (BytesSlot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `BytesSlot` representation of the bytes storage pointer `store`.\n */\n function getBytesSlot(bytes storage store) internal pure returns (BytesSlot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := store.slot\n }\n }\n}\n' + '// 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 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 * 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' }, - 'node_modules/@openzeppelin/contracts/utils/Strings.sol': { + 'src/tokens/common/IMerkleProofSingleUse.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' + '// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8.19;\n\ninterface IMerkleProofSingleUseFunctions {\n\n /**\n * Checks if the given merkle proof is valid.\n * @param root Merkle root.\n * @param proof Merkle proof.\n * @param addr Address to check.\n * @param salt Salt used to generate the merkle leaf.\n * @return True if the proof is valid and has not yet been used by {addr}.\n */\n function checkMerkleProof(\n bytes32 root,\n bytes32[] calldata proof,\n address addr,\n bytes32 salt\n ) external view returns (bool);\n\n}\n\ninterface IMerkleProofSingleUseSignals {\n\n /**\n * Thrown when the merkle proof is invalid or has already been used.\n * @param root Merkle root.\n * @param proof Merkle proof.\n * @param addr Address to check.\n * @param salt Salt used to generate the merkle leaf.\n */\n error MerkleProofInvalid(bytes32 root, bytes32[] proof, address addr, bytes32 salt);\n\n}\n\ninterface IMerkleProofSingleUse is IMerkleProofSingleUseFunctions, IMerkleProofSingleUseSignals { }\n' }, - 'node_modules/@openzeppelin/contracts/utils/cryptography/MerkleProof.sol': { + 'lib/openzeppelin/contracts/utils/cryptography/MerkleProof.sol': { content: '// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.2) (utils/cryptography/MerkleProof.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev These functions deal with verification of Merkle Tree proofs.\n *\n * The tree and the proofs can be generated using our\n * https://github.com/OpenZeppelin/merkle-tree[JavaScript library].\n * You will find a quickstart guide in the readme.\n *\n * WARNING: You should avoid using leaf values that are 64 bytes long prior to\n * hashing, or use a hash function other than keccak256 for hashing leaves.\n * This is because the concatenation of a sorted pair of internal nodes in\n * the merkle tree could be reinterpreted as a leaf value.\n * OpenZeppelin\'s JavaScript library generates merkle trees that are safe\n * against this attack out of the box.\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(bytes32[] memory proof, bytes32 root, bytes32 leaf) internal pure returns (bool) {\n return processProof(proof, leaf) == root;\n }\n\n /**\n * @dev Calldata version of {verify}\n *\n * _Available since v4.7._\n */\n function verifyCalldata(bytes32[] calldata proof, bytes32 root, bytes32 leaf) internal pure returns (bool) {\n return processProofCalldata(proof, leaf) == root;\n }\n\n /**\n * @dev Returns the rebuilt hash obtained by traversing a Merkle 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 computedHash = _hashPair(computedHash, proof[i]);\n }\n return computedHash;\n }\n\n /**\n * @dev Calldata version of {processProof}\n *\n * _Available since v4.7._\n */\n function processProofCalldata(bytes32[] calldata proof, bytes32 leaf) internal pure returns (bytes32) {\n bytes32 computedHash = leaf;\n for (uint256 i = 0; i < proof.length; i++) {\n computedHash = _hashPair(computedHash, proof[i]);\n }\n return computedHash;\n }\n\n /**\n * @dev Returns true if the `leaves` can be simultaneously proven to be a part of a merkle tree defined by\n * `root`, according to `proof` and `proofFlags` as described in {processMultiProof}.\n *\n * CAUTION: Not all merkle trees admit multiproofs. See {processMultiProof} for details.\n *\n * _Available since v4.7._\n */\n function multiProofVerify(\n bytes32[] memory proof,\n bool[] memory proofFlags,\n bytes32 root,\n bytes32[] memory leaves\n ) internal pure returns (bool) {\n return processMultiProof(proof, proofFlags, leaves) == root;\n }\n\n /**\n * @dev Calldata version of {multiProofVerify}\n *\n * CAUTION: Not all merkle trees admit multiproofs. See {processMultiProof} for details.\n *\n * _Available since v4.7._\n */\n function multiProofVerifyCalldata(\n bytes32[] calldata proof,\n bool[] calldata proofFlags,\n bytes32 root,\n bytes32[] memory leaves\n ) internal pure returns (bool) {\n return processMultiProofCalldata(proof, proofFlags, leaves) == root;\n }\n\n /**\n * @dev Returns the root of a tree reconstructed from `leaves` and sibling nodes in `proof`. The reconstruction\n * proceeds by incrementally reconstructing all inner nodes by combining a leaf/inner node with either another\n * leaf/inner node or a proof sibling node, depending on whether each `proofFlags` item is true or false\n * respectively.\n *\n * CAUTION: Not all merkle trees admit multiproofs. To use multiproofs, it is sufficient to ensure that: 1) the tree\n * is complete (but not necessarily perfect), 2) the leaves to be proven are in the opposite order they are in the\n * tree (i.e., as seen from right to left starting at the deepest layer and continuing at the next layer).\n *\n * _Available since v4.7._\n */\n function processMultiProof(\n bytes32[] memory proof,\n bool[] memory proofFlags,\n bytes32[] memory leaves\n ) internal pure returns (bytes32 merkleRoot) {\n // This function rebuilds the root hash by traversing the tree up from the leaves. The root is rebuilt by\n // consuming and producing values on a queue. The queue starts with the `leaves` array, then goes onto the\n // `hashes` array. At the end of the process, the last hash in the `hashes` array should contain the root of\n // the merkle tree.\n uint256 leavesLen = leaves.length;\n uint256 proofLen = proof.length;\n uint256 totalHashes = proofFlags.length;\n\n // Check proof validity.\n require(leavesLen + proofLen - 1 == totalHashes, "MerkleProof: invalid multiproof");\n\n // The xxxPos values are "pointers" to the next value to consume in each array. All accesses are done using\n // `xxx[xxxPos++]`, which return the current value and increment the pointer, thus mimicking a queue\'s "pop".\n bytes32[] memory hashes = new bytes32[](totalHashes);\n uint256 leafPos = 0;\n uint256 hashPos = 0;\n uint256 proofPos = 0;\n // At each step, we compute the next hash using two values:\n // - a value from the "main queue". If not all leaves have been consumed, we get the next leaf, otherwise we\n // get the next hash.\n // - depending on the flag, either another value from the "main queue" (merging branches) or an element from the\n // `proof` array.\n for (uint256 i = 0; i < totalHashes; i++) {\n bytes32 a = leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++];\n bytes32 b = proofFlags[i]\n ? (leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++])\n : proof[proofPos++];\n hashes[i] = _hashPair(a, b);\n }\n\n if (totalHashes > 0) {\n require(proofPos == proofLen, "MerkleProof: invalid multiproof");\n unchecked {\n return hashes[totalHashes - 1];\n }\n } else if (leavesLen > 0) {\n return leaves[0];\n } else {\n return proof[0];\n }\n }\n\n /**\n * @dev Calldata version of {processMultiProof}.\n *\n * CAUTION: Not all merkle trees admit multiproofs. See {processMultiProof} for details.\n *\n * _Available since v4.7._\n */\n function processMultiProofCalldata(\n bytes32[] calldata proof,\n bool[] calldata proofFlags,\n bytes32[] memory leaves\n ) internal pure returns (bytes32 merkleRoot) {\n // This function rebuilds the root hash by traversing the tree up from the leaves. The root is rebuilt by\n // consuming and producing values on a queue. The queue starts with the `leaves` array, then goes onto the\n // `hashes` array. At the end of the process, the last hash in the `hashes` array should contain the root of\n // the merkle tree.\n uint256 leavesLen = leaves.length;\n uint256 proofLen = proof.length;\n uint256 totalHashes = proofFlags.length;\n\n // Check proof validity.\n require(leavesLen + proofLen - 1 == totalHashes, "MerkleProof: invalid multiproof");\n\n // The xxxPos values are "pointers" to the next value to consume in each array. All accesses are done using\n // `xxx[xxxPos++]`, which return the current value and increment the pointer, thus mimicking a queue\'s "pop".\n bytes32[] memory hashes = new bytes32[](totalHashes);\n uint256 leafPos = 0;\n uint256 hashPos = 0;\n uint256 proofPos = 0;\n // At each step, we compute the next hash using two values:\n // - a value from the "main queue". If not all leaves have been consumed, we get the next leaf, otherwise we\n // get the next hash.\n // - depending on the flag, either another value from the "main queue" (merging branches) or an element from the\n // `proof` array.\n for (uint256 i = 0; i < totalHashes; i++) {\n bytes32 a = leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++];\n bytes32 b = proofFlags[i]\n ? (leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++])\n : proof[proofPos++];\n hashes[i] = _hashPair(a, b);\n }\n\n if (totalHashes > 0) {\n require(proofPos == proofLen, "MerkleProof: invalid multiproof");\n unchecked {\n return hashes[totalHashes - 1];\n }\n } else if (leavesLen > 0) {\n return leaves[0];\n } else {\n return proof[0];\n }\n }\n\n function _hashPair(bytes32 a, bytes32 b) private pure returns (bytes32) {\n return a < b ? _efficientHash(a, b) : _efficientHash(b, a);\n }\n\n function _efficientHash(bytes32 a, bytes32 b) private pure returns (bytes32 value) {\n /// @solidity memory-safe-assembly\n assembly {\n mstore(0x00, a)\n mstore(0x20, b)\n value := keccak256(0x00, 0x40)\n }\n }\n}\n' }, - 'node_modules/@openzeppelin/contracts/utils/introspection/ERC165.sol': { + 'src/tokens/common/IWithdrawControlled.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' + '// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8.19;\n\ninterface IWithdrawControlledFunctions {\n\n /**\n * Withdraws ERC20 tokens owned by this contract.\n * @param token The ERC20 token address.\n * @param to Address to withdraw to.\n * @param value Amount to withdraw.\n */\n function withdrawERC20(address token, address to, uint256 value) external;\n\n /**\n * Withdraws ETH owned by this sale contract.\n * @param to Address to withdraw to.\n * @param value Amount to withdraw.\n */\n function withdrawETH(address to, uint256 value) external;\n\n}\n\ninterface IWithdrawControlledSignals {\n\n /**\n * Withdraw failed error.\n */\n error WithdrawFailed();\n\n}\n\ninterface IWithdrawControlled is IWithdrawControlledFunctions, IWithdrawControlledSignals { }\n' }, - 'node_modules/@openzeppelin/contracts/utils/introspection/IERC165.sol': { + 'lib/openzeppelin/contracts/access/AccessControlEnumerable.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' + '// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (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 virtual 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 virtual 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' }, - 'node_modules/@openzeppelin/contracts/utils/math/Math.sol': { + 'lib/openzeppelin/contracts/token/ERC20/utils/SafeERC20.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' + '// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.3) (token/ERC20/utils/SafeERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport "../IERC20.sol";\nimport "../extensions/IERC20Permit.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 /**\n * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,\n * non-reverting calls are assumed to be successful.\n */\n function safeTransfer(IERC20 token, address to, uint256 value) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\n }\n\n /**\n * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the\n * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.\n */\n function safeTransferFrom(IERC20 token, address from, address to, uint256 value) 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(IERC20 token, address spender, uint256 value) 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 /**\n * @dev Increase the calling contract\'s allowance toward `spender` by `value`. If `token` returns no value,\n * non-reverting calls are assumed to be successful.\n */\n function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {\n uint256 oldAllowance = token.allowance(address(this), spender);\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance + value));\n }\n\n /**\n * @dev Decrease the calling contract\'s allowance toward `spender` by `value`. If `token` returns no value,\n * non-reverting calls are assumed to be successful.\n */\n function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal {\n unchecked {\n uint256 oldAllowance = token.allowance(address(this), spender);\n require(oldAllowance >= value, "SafeERC20: decreased allowance below zero");\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance - value));\n }\n }\n\n /**\n * @dev Set the calling contract\'s allowance toward `spender` to `value`. If `token` returns no value,\n * non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval\n * to be set to zero before setting it to a non-zero value, such as USDT.\n */\n function forceApprove(IERC20 token, address spender, uint256 value) internal {\n bytes memory approvalCall = abi.encodeWithSelector(token.approve.selector, spender, value);\n\n if (!_callOptionalReturnBool(token, approvalCall)) {\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, 0));\n _callOptionalReturn(token, approvalCall);\n }\n }\n\n /**\n * @dev Use a ERC-2612 signature to set the `owner` approval toward `spender` on `token`.\n * Revert on invalid signature.\n */\n function safePermit(\n IERC20Permit token,\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) internal {\n uint256 nonceBefore = token.nonces(owner);\n token.permit(owner, spender, value, deadline, v, r, s);\n uint256 nonceAfter = token.nonces(owner);\n require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed");\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 require(returndata.length == 0 || abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");\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 * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.\n */\n function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {\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 cannot use {Address-functionCall} here since this should return false\n // and not revert is the subcall reverts.\n\n (bool success, bytes memory returndata) = address(token).call(data);\n return\n success && (returndata.length == 0 || abi.decode(returndata, (bool))) && Address.isContract(address(token));\n }\n}\n' }, - 'node_modules/@openzeppelin/contracts/utils/math/SignedMath.sol': { + 'lib/chiru-labs/erc721a/contracts/extensions/IERC721AQueryable.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' + "// SPDX-License-Identifier: MIT\n// ERC721A Contracts v4.3.0\n// Creator: Chiru Labs\n\npragma solidity ^0.8.4;\n\nimport '../IERC721A.sol';\n\n/**\n * @dev Interface of ERC721AQueryable.\n */\ninterface IERC721AQueryable is IERC721A {\n /**\n * Invalid query range (`start` >= `stop`).\n */\n error InvalidQueryRange();\n\n /**\n * @dev Returns the `TokenOwnership` struct at `tokenId` without reverting.\n *\n * If the `tokenId` is out of bounds:\n *\n * - `addr = address(0)`\n * - `startTimestamp = 0`\n * - `burned = false`\n * - `extraData = 0`\n *\n * If the `tokenId` is burned:\n *\n * - `addr =
`\n * - `startTimestamp = `\n * - `burned = true`\n * - `extraData = `\n *\n * Otherwise:\n *\n * - `addr =
`\n * - `startTimestamp = `\n * - `burned = false`\n * - `extraData = `\n */\n function explicitOwnershipOf(uint256 tokenId) external view returns (TokenOwnership memory);\n\n /**\n * @dev Returns an array of `TokenOwnership` structs at `tokenIds` in order.\n * See {ERC721AQueryable-explicitOwnershipOf}\n */\n function explicitOwnershipsOf(uint256[] memory tokenIds) external view returns (TokenOwnership[] memory);\n\n /**\n * @dev Returns an array of token IDs owned by `owner`,\n * in the range [`start`, `stop`)\n * (i.e. `start <= tokenId < stop`).\n *\n * This function allows for tokens to be queried if the collection\n * grows too big for a single call of {ERC721AQueryable-tokensOfOwner}.\n *\n * Requirements:\n *\n * - `start < stop`\n */\n function tokensOfOwnerIn(\n address owner,\n uint256 start,\n uint256 stop\n ) external view returns (uint256[] memory);\n\n /**\n * @dev Returns an array of token IDs owned by `owner`.\n *\n * This function scans the ownership mapping and is O(`totalSupply`) in complexity.\n * It is meant to be called off-chain.\n *\n * See {ERC721AQueryable-tokensOfOwnerIn} for splitting the scan into\n * multiple smaller scans if the collection is large enough to cause\n * an out-of-gas error (10K collections should be fine).\n */\n function tokensOfOwner(address owner) external view returns (uint256[] memory);\n}\n" }, - 'node_modules/@openzeppelin/contracts/utils/structs/EnumerableSet.sol': { + 'lib/chiru-labs/erc721a/contracts/ERC721A.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" + "// SPDX-License-Identifier: MIT\n// ERC721A Contracts v4.3.0\n// Creator: Chiru Labs\n\npragma solidity ^0.8.4;\n\nimport './IERC721A.sol';\n\n/**\n * @dev Interface of ERC721 token receiver.\n */\ninterface ERC721A__IERC721Receiver {\n function onERC721Received(\n address operator,\n address from,\n uint256 tokenId,\n bytes calldata data\n ) external returns (bytes4);\n}\n\n/**\n * @title ERC721A\n *\n * @dev Implementation of the [ERC721](https://eips.ethereum.org/EIPS/eip-721)\n * Non-Fungible Token Standard, including the Metadata extension.\n * Optimized for lower gas during batch mints.\n *\n * Token IDs are minted in sequential order (e.g. 0, 1, 2, 3, ...)\n * starting from `_startTokenId()`.\n *\n * The `_sequentialUpTo()` function can be overriden to enable spot mints\n * (i.e. non-consecutive mints) for `tokenId`s greater than `_sequentialUpTo()`.\n *\n * Assumptions:\n *\n * - An owner cannot have more than 2**64 - 1 (max value of uint64) of supply.\n * - The maximum token ID cannot exceed 2**256 - 1 (max value of uint256).\n */\ncontract ERC721A is IERC721A {\n // Bypass for a `--via-ir` bug (https://github.com/chiru-labs/ERC721A/pull/364).\n struct TokenApprovalRef {\n address value;\n }\n\n // =============================================================\n // CONSTANTS\n // =============================================================\n\n // Mask of an entry in packed address data.\n uint256 private constant _BITMASK_ADDRESS_DATA_ENTRY = (1 << 64) - 1;\n\n // The bit position of `numberMinted` in packed address data.\n uint256 private constant _BITPOS_NUMBER_MINTED = 64;\n\n // The bit position of `numberBurned` in packed address data.\n uint256 private constant _BITPOS_NUMBER_BURNED = 128;\n\n // The bit position of `aux` in packed address data.\n uint256 private constant _BITPOS_AUX = 192;\n\n // Mask of all 256 bits in packed address data except the 64 bits for `aux`.\n uint256 private constant _BITMASK_AUX_COMPLEMENT = (1 << 192) - 1;\n\n // The bit position of `startTimestamp` in packed ownership.\n uint256 private constant _BITPOS_START_TIMESTAMP = 160;\n\n // The bit mask of the `burned` bit in packed ownership.\n uint256 private constant _BITMASK_BURNED = 1 << 224;\n\n // The bit position of the `nextInitialized` bit in packed ownership.\n uint256 private constant _BITPOS_NEXT_INITIALIZED = 225;\n\n // The bit mask of the `nextInitialized` bit in packed ownership.\n uint256 private constant _BITMASK_NEXT_INITIALIZED = 1 << 225;\n\n // The bit position of `extraData` in packed ownership.\n uint256 private constant _BITPOS_EXTRA_DATA = 232;\n\n // Mask of all 256 bits in a packed ownership except the 24 bits for `extraData`.\n uint256 private constant _BITMASK_EXTRA_DATA_COMPLEMENT = (1 << 232) - 1;\n\n // The mask of the lower 160 bits for addresses.\n uint256 private constant _BITMASK_ADDRESS = (1 << 160) - 1;\n\n // The maximum `quantity` that can be minted with {_mintERC2309}.\n // This limit is to prevent overflows on the address data entries.\n // For a limit of 5000, a total of 3.689e15 calls to {_mintERC2309}\n // is required to cause an overflow, which is unrealistic.\n uint256 private constant _MAX_MINT_ERC2309_QUANTITY_LIMIT = 5000;\n\n // The `Transfer` event signature is given by:\n // `keccak256(bytes(\"Transfer(address,address,uint256)\"))`.\n bytes32 private constant _TRANSFER_EVENT_SIGNATURE =\n 0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef;\n\n // =============================================================\n // STORAGE\n // =============================================================\n\n // The next token ID to be minted.\n uint256 private _currentIndex;\n\n // The number of tokens burned.\n uint256 private _burnCounter;\n\n // Token name\n string private _name;\n\n // Token symbol\n string private _symbol;\n\n // Mapping from token ID to ownership details\n // An empty struct value does not necessarily mean the token is unowned.\n // See {_packedOwnershipOf} implementation for details.\n //\n // Bits Layout:\n // - [0..159] `addr`\n // - [160..223] `startTimestamp`\n // - [224] `burned`\n // - [225] `nextInitialized`\n // - [232..255] `extraData`\n mapping(uint256 => uint256) private _packedOwnerships;\n\n // Mapping owner address to address data.\n //\n // Bits Layout:\n // - [0..63] `balance`\n // - [64..127] `numberMinted`\n // - [128..191] `numberBurned`\n // - [192..255] `aux`\n mapping(address => uint256) private _packedAddressData;\n\n // Mapping from token ID to approved address.\n mapping(uint256 => TokenApprovalRef) private _tokenApprovals;\n\n // Mapping from owner to operator approvals\n mapping(address => mapping(address => bool)) private _operatorApprovals;\n\n // The amount of tokens minted above `_sequentialUpTo()`.\n // We call these spot mints (i.e. non-sequential mints).\n uint256 private _spotMinted;\n\n // =============================================================\n // CONSTRUCTOR\n // =============================================================\n\n constructor(string memory name_, string memory symbol_) {\n _name = name_;\n _symbol = symbol_;\n _currentIndex = _startTokenId();\n\n if (_sequentialUpTo() < _startTokenId()) _revert(SequentialUpToTooSmall.selector);\n }\n\n // =============================================================\n // TOKEN COUNTING OPERATIONS\n // =============================================================\n\n /**\n * @dev Returns the starting token ID for sequential mints.\n *\n * Override this function to change the starting token ID for sequential mints.\n *\n * Note: The value returned must never change after any tokens have been minted.\n */\n function _startTokenId() internal view virtual returns (uint256) {\n return 0;\n }\n\n /**\n * @dev Returns the maximum token ID (inclusive) for sequential mints.\n *\n * Override this function to return a value less than 2**256 - 1,\n * but greater than `_startTokenId()`, to enable spot (non-sequential) mints.\n *\n * Note: The value returned must never change after any tokens have been minted.\n */\n function _sequentialUpTo() internal view virtual returns (uint256) {\n return type(uint256).max;\n }\n\n /**\n * @dev Returns the next token ID to be minted.\n */\n function _nextTokenId() internal view virtual returns (uint256) {\n return _currentIndex;\n }\n\n /**\n * @dev Returns the total number of tokens in existence.\n * Burned tokens will reduce the count.\n * To get the total number of tokens minted, please see {_totalMinted}.\n */\n function totalSupply() public view virtual override returns (uint256 result) {\n // Counter underflow is impossible as `_burnCounter` cannot be incremented\n // more than `_currentIndex + _spotMinted - _startTokenId()` times.\n unchecked {\n // With spot minting, the intermediate `result` can be temporarily negative,\n // and the computation must be unchecked.\n result = _currentIndex - _burnCounter - _startTokenId();\n if (_sequentialUpTo() != type(uint256).max) result += _spotMinted;\n }\n }\n\n /**\n * @dev Returns the total amount of tokens minted in the contract.\n */\n function _totalMinted() internal view virtual returns (uint256 result) {\n // Counter underflow is impossible as `_currentIndex` does not decrement,\n // and it is initialized to `_startTokenId()`.\n unchecked {\n result = _currentIndex - _startTokenId();\n if (_sequentialUpTo() != type(uint256).max) result += _spotMinted;\n }\n }\n\n /**\n * @dev Returns the total number of tokens burned.\n */\n function _totalBurned() internal view virtual returns (uint256) {\n return _burnCounter;\n }\n\n /**\n * @dev Returns the total number of tokens that are spot-minted.\n */\n function _totalSpotMinted() internal view virtual returns (uint256) {\n return _spotMinted;\n }\n\n // =============================================================\n // ADDRESS DATA OPERATIONS\n // =============================================================\n\n /**\n * @dev Returns the number of tokens in `owner`'s account.\n */\n function balanceOf(address owner) public view virtual override returns (uint256) {\n if (owner == address(0)) _revert(BalanceQueryForZeroAddress.selector);\n return _packedAddressData[owner] & _BITMASK_ADDRESS_DATA_ENTRY;\n }\n\n /**\n * Returns the number of tokens minted by `owner`.\n */\n function _numberMinted(address owner) internal view returns (uint256) {\n return (_packedAddressData[owner] >> _BITPOS_NUMBER_MINTED) & _BITMASK_ADDRESS_DATA_ENTRY;\n }\n\n /**\n * Returns the number of tokens burned by or on behalf of `owner`.\n */\n function _numberBurned(address owner) internal view returns (uint256) {\n return (_packedAddressData[owner] >> _BITPOS_NUMBER_BURNED) & _BITMASK_ADDRESS_DATA_ENTRY;\n }\n\n /**\n * Returns the auxiliary data for `owner`. (e.g. number of whitelist mint slots used).\n */\n function _getAux(address owner) internal view returns (uint64) {\n return uint64(_packedAddressData[owner] >> _BITPOS_AUX);\n }\n\n /**\n * Sets the auxiliary data for `owner`. (e.g. number of whitelist mint slots used).\n * If there are multiple variables, please pack them into a uint64.\n */\n function _setAux(address owner, uint64 aux) internal virtual {\n uint256 packed = _packedAddressData[owner];\n uint256 auxCasted;\n // Cast `aux` with assembly to avoid redundant masking.\n assembly {\n auxCasted := aux\n }\n packed = (packed & _BITMASK_AUX_COMPLEMENT) | (auxCasted << _BITPOS_AUX);\n _packedAddressData[owner] = packed;\n }\n\n // =============================================================\n // IERC165\n // =============================================================\n\n /**\n * @dev Returns true if this contract implements the interface defined by\n * `interfaceId`. See the corresponding\n * [EIP section](https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified)\n * to learn more about how these ids are created.\n *\n * This function call must use less than 30000 gas.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n // The interface IDs are constants representing the first 4 bytes\n // of the XOR of all function selectors in the interface.\n // See: [ERC165](https://eips.ethereum.org/EIPS/eip-165)\n // (e.g. `bytes4(i.functionA.selector ^ i.functionB.selector ^ ...)`)\n return\n interfaceId == 0x01ffc9a7 || // ERC165 interface ID for ERC165.\n interfaceId == 0x80ac58cd || // ERC165 interface ID for ERC721.\n interfaceId == 0x5b5e139f; // ERC165 interface ID for ERC721Metadata.\n }\n\n // =============================================================\n // IERC721Metadata\n // =============================================================\n\n /**\n * @dev Returns the token collection name.\n */\n function name() public view virtual override returns (string memory) {\n return _name;\n }\n\n /**\n * @dev Returns the token collection symbol.\n */\n function symbol() public view virtual override returns (string memory) {\n return _symbol;\n }\n\n /**\n * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.\n */\n function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {\n if (!_exists(tokenId)) _revert(URIQueryForNonexistentToken.selector);\n\n string memory baseURI = _baseURI();\n return bytes(baseURI).length != 0 ? string(abi.encodePacked(baseURI, _toString(tokenId))) : '';\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, it can be overridden in child contracts.\n */\n function _baseURI() internal view virtual returns (string memory) {\n return '';\n }\n\n // =============================================================\n // OWNERSHIPS OPERATIONS\n // =============================================================\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) public view virtual override returns (address) {\n return address(uint160(_packedOwnershipOf(tokenId)));\n }\n\n /**\n * @dev Gas spent here starts off proportional to the maximum mint batch size.\n * It gradually moves to O(1) as tokens get transferred around over time.\n */\n function _ownershipOf(uint256 tokenId) internal view virtual returns (TokenOwnership memory) {\n return _unpackedOwnership(_packedOwnershipOf(tokenId));\n }\n\n /**\n * @dev Returns the unpacked `TokenOwnership` struct at `index`.\n */\n function _ownershipAt(uint256 index) internal view virtual returns (TokenOwnership memory) {\n return _unpackedOwnership(_packedOwnerships[index]);\n }\n\n /**\n * @dev Returns whether the ownership slot at `index` is initialized.\n * An uninitialized slot does not necessarily mean that the slot has no owner.\n */\n function _ownershipIsInitialized(uint256 index) internal view virtual returns (bool) {\n return _packedOwnerships[index] != 0;\n }\n\n /**\n * @dev Initializes the ownership slot minted at `index` for efficiency purposes.\n */\n function _initializeOwnershipAt(uint256 index) internal virtual {\n if (_packedOwnerships[index] == 0) {\n _packedOwnerships[index] = _packedOwnershipOf(index);\n }\n }\n\n /**\n * @dev Returns the packed ownership data of `tokenId`.\n */\n function _packedOwnershipOf(uint256 tokenId) private view returns (uint256 packed) {\n if (_startTokenId() <= tokenId) {\n packed = _packedOwnerships[tokenId];\n\n if (tokenId > _sequentialUpTo()) {\n if (_packedOwnershipExists(packed)) return packed;\n _revert(OwnerQueryForNonexistentToken.selector);\n }\n\n // If the data at the starting slot does not exist, start the scan.\n if (packed == 0) {\n if (tokenId >= _currentIndex) _revert(OwnerQueryForNonexistentToken.selector);\n // Invariant:\n // There will always be an initialized ownership slot\n // (i.e. `ownership.addr != address(0) && ownership.burned == false`)\n // before an unintialized ownership slot\n // (i.e. `ownership.addr == address(0) && ownership.burned == false`)\n // Hence, `tokenId` will not underflow.\n //\n // We can directly compare the packed value.\n // If the address is zero, packed will be zero.\n for (;;) {\n unchecked {\n packed = _packedOwnerships[--tokenId];\n }\n if (packed == 0) continue;\n if (packed & _BITMASK_BURNED == 0) return packed;\n // Otherwise, the token is burned, and we must revert.\n // This handles the case of batch burned tokens, where only the burned bit\n // of the starting slot is set, and remaining slots are left uninitialized.\n _revert(OwnerQueryForNonexistentToken.selector);\n }\n }\n // Otherwise, the data exists and we can skip the scan.\n // This is possible because we have already achieved the target condition.\n // This saves 2143 gas on transfers of initialized tokens.\n // If the token is not burned, return `packed`. Otherwise, revert.\n if (packed & _BITMASK_BURNED == 0) return packed;\n }\n _revert(OwnerQueryForNonexistentToken.selector);\n }\n\n /**\n * @dev Returns the unpacked `TokenOwnership` struct from `packed`.\n */\n function _unpackedOwnership(uint256 packed) private pure returns (TokenOwnership memory ownership) {\n ownership.addr = address(uint160(packed));\n ownership.startTimestamp = uint64(packed >> _BITPOS_START_TIMESTAMP);\n ownership.burned = packed & _BITMASK_BURNED != 0;\n ownership.extraData = uint24(packed >> _BITPOS_EXTRA_DATA);\n }\n\n /**\n * @dev Packs ownership data into a single uint256.\n */\n function _packOwnershipData(address owner, uint256 flags) private view returns (uint256 result) {\n assembly {\n // Mask `owner` to the lower 160 bits, in case the upper bits somehow aren't clean.\n owner := and(owner, _BITMASK_ADDRESS)\n // `owner | (block.timestamp << _BITPOS_START_TIMESTAMP) | flags`.\n result := or(owner, or(shl(_BITPOS_START_TIMESTAMP, timestamp()), flags))\n }\n }\n\n /**\n * @dev Returns the `nextInitialized` flag set if `quantity` equals 1.\n */\n function _nextInitializedFlag(uint256 quantity) private pure returns (uint256 result) {\n // For branchless setting of the `nextInitialized` flag.\n assembly {\n // `(quantity == 1) << _BITPOS_NEXT_INITIALIZED`.\n result := shl(_BITPOS_NEXT_INITIALIZED, eq(quantity, 1))\n }\n }\n\n // =============================================================\n // APPROVAL OPERATIONS\n // =============================================================\n\n /**\n * @dev Gives permission to `to` to transfer `tokenId` token to another account. See {ERC721A-_approve}.\n *\n * Requirements:\n *\n * - The caller must own the token or be an approved operator.\n */\n function approve(address to, uint256 tokenId) public payable virtual override {\n _approve(to, tokenId, true);\n }\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) public view virtual override returns (address) {\n if (!_exists(tokenId)) _revert(ApprovalQueryForNonexistentToken.selector);\n\n return _tokenApprovals[tokenId].value;\n }\n\n /**\n * @dev Approve or remove `operator` as an operator for the caller.\n * Operators can call {transferFrom} or {safeTransferFrom}\n * 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) public virtual override {\n _operatorApprovals[_msgSenderERC721A()][operator] = approved;\n emit ApprovalForAll(_msgSenderERC721A(), operator, approved);\n }\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) public view virtual override returns (bool) {\n return _operatorApprovals[owner][operator];\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. See {_mint}.\n */\n function _exists(uint256 tokenId) internal view virtual returns (bool result) {\n if (_startTokenId() <= tokenId) {\n if (tokenId > _sequentialUpTo()) return _packedOwnershipExists(_packedOwnerships[tokenId]);\n\n if (tokenId < _currentIndex) {\n uint256 packed;\n while ((packed = _packedOwnerships[tokenId]) == 0) --tokenId;\n result = packed & _BITMASK_BURNED == 0;\n }\n }\n }\n\n /**\n * @dev Returns whether `packed` represents a token that exists.\n */\n function _packedOwnershipExists(uint256 packed) private pure returns (bool result) {\n assembly {\n // The following is equivalent to `owner != address(0) && burned == false`.\n // Symbolically tested.\n result := gt(and(packed, _BITMASK_ADDRESS), and(packed, _BITMASK_BURNED))\n }\n }\n\n /**\n * @dev Returns whether `msgSender` is equal to `approvedAddress` or `owner`.\n */\n function _isSenderApprovedOrOwner(\n address approvedAddress,\n address owner,\n address msgSender\n ) private pure returns (bool result) {\n assembly {\n // Mask `owner` to the lower 160 bits, in case the upper bits somehow aren't clean.\n owner := and(owner, _BITMASK_ADDRESS)\n // Mask `msgSender` to the lower 160 bits, in case the upper bits somehow aren't clean.\n msgSender := and(msgSender, _BITMASK_ADDRESS)\n // `msgSender == owner || msgSender == approvedAddress`.\n result := or(eq(msgSender, owner), eq(msgSender, approvedAddress))\n }\n }\n\n /**\n * @dev Returns the storage slot and value for the approved address of `tokenId`.\n */\n function _getApprovedSlotAndAddress(uint256 tokenId)\n private\n view\n returns (uint256 approvedAddressSlot, address approvedAddress)\n {\n TokenApprovalRef storage tokenApproval = _tokenApprovals[tokenId];\n // The following is equivalent to `approvedAddress = _tokenApprovals[tokenId].value`.\n assembly {\n approvedAddressSlot := tokenApproval.slot\n approvedAddress := sload(approvedAddressSlot)\n }\n }\n\n // =============================================================\n // TRANSFER OPERATIONS\n // =============================================================\n\n /**\n * @dev Transfers `tokenId` 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 be owned by `from`.\n * - If the caller is not `from`, it must be approved to move this token\n * 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 ) public payable virtual override {\n uint256 prevOwnershipPacked = _packedOwnershipOf(tokenId);\n\n // Mask `from` to the lower 160 bits, in case the upper bits somehow aren't clean.\n from = address(uint160(uint256(uint160(from)) & _BITMASK_ADDRESS));\n\n if (address(uint160(prevOwnershipPacked)) != from) _revert(TransferFromIncorrectOwner.selector);\n\n (uint256 approvedAddressSlot, address approvedAddress) = _getApprovedSlotAndAddress(tokenId);\n\n // The nested ifs save around 20+ gas over a compound boolean condition.\n if (!_isSenderApprovedOrOwner(approvedAddress, from, _msgSenderERC721A()))\n if (!isApprovedForAll(from, _msgSenderERC721A())) _revert(TransferCallerNotOwnerNorApproved.selector);\n\n _beforeTokenTransfers(from, to, tokenId, 1);\n\n // Clear approvals from the previous owner.\n assembly {\n if approvedAddress {\n // This is equivalent to `delete _tokenApprovals[tokenId]`.\n sstore(approvedAddressSlot, 0)\n }\n }\n\n // Underflow of the sender's balance is impossible because we check for\n // ownership above and the recipient's balance can't realistically overflow.\n // Counter overflow is incredibly unrealistic as `tokenId` would have to be 2**256.\n unchecked {\n // We can directly increment and decrement the balances.\n --_packedAddressData[from]; // Updates: `balance -= 1`.\n ++_packedAddressData[to]; // Updates: `balance += 1`.\n\n // Updates:\n // - `address` to the next owner.\n // - `startTimestamp` to the timestamp of transfering.\n // - `burned` to `false`.\n // - `nextInitialized` to `true`.\n _packedOwnerships[tokenId] = _packOwnershipData(\n to,\n _BITMASK_NEXT_INITIALIZED | _nextExtraData(from, to, prevOwnershipPacked)\n );\n\n // If the next slot may not have been initialized (i.e. `nextInitialized == false`) .\n if (prevOwnershipPacked & _BITMASK_NEXT_INITIALIZED == 0) {\n uint256 nextTokenId = tokenId + 1;\n // If the next slot's address is zero and not burned (i.e. packed value is zero).\n if (_packedOwnerships[nextTokenId] == 0) {\n // If the next slot is within bounds.\n if (nextTokenId != _currentIndex) {\n // Initialize the next slot to maintain correctness for `ownerOf(tokenId + 1)`.\n _packedOwnerships[nextTokenId] = prevOwnershipPacked;\n }\n }\n }\n }\n\n // Mask `to` to the lower 160 bits, in case the upper bits somehow aren't clean.\n uint256 toMasked = uint256(uint160(to)) & _BITMASK_ADDRESS;\n assembly {\n // Emit the `Transfer` event.\n log4(\n 0, // Start of data (0, since no data).\n 0, // End of data (0, since no data).\n _TRANSFER_EVENT_SIGNATURE, // Signature.\n from, // `from`.\n toMasked, // `to`.\n tokenId // `tokenId`.\n )\n }\n if (toMasked == 0) _revert(TransferToZeroAddress.selector);\n\n _afterTokenTransfers(from, to, tokenId, 1);\n }\n\n /**\n * @dev Equivalent to `safeTransferFrom(from, to, tokenId, '')`.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId\n ) public payable virtual override {\n safeTransferFrom(from, to, tokenId, '');\n }\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\n * by either {approve} or {setApprovalForAll}.\n * - If `to` refers to a smart contract, it must implement\n * {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 memory _data\n ) public payable virtual override {\n transferFrom(from, to, tokenId);\n if (to.code.length != 0)\n if (!_checkContractOnERC721Received(from, to, tokenId, _data)) {\n _revert(TransferToNonERC721ReceiverImplementer.selector);\n }\n }\n\n /**\n * @dev Hook that is called before a set of serially-ordered token IDs\n * are about to be transferred. This includes minting.\n * And also called before burning one token.\n *\n * `startTokenId` - the first token ID to be transferred.\n * `quantity` - the amount to be transferred.\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, `tokenId` will be burned by `from`.\n * - `from` and `to` are never both zero.\n */\n function _beforeTokenTransfers(\n address from,\n address to,\n uint256 startTokenId,\n uint256 quantity\n ) internal virtual {}\n\n /**\n * @dev Hook that is called after a set of serially-ordered token IDs\n * have been transferred. This includes minting.\n * And also called after one token has been burned.\n *\n * `startTokenId` - the first token ID to be transferred.\n * `quantity` - the amount to be transferred.\n *\n * Calling conditions:\n *\n * - When `from` and `to` are both non-zero, `from`'s `tokenId` has been\n * transferred to `to`.\n * - When `from` is zero, `tokenId` has been minted for `to`.\n * - When `to` is zero, `tokenId` has been burned by `from`.\n * - `from` and `to` are never both zero.\n */\n function _afterTokenTransfers(\n address from,\n address to,\n uint256 startTokenId,\n uint256 quantity\n ) internal virtual {}\n\n /**\n * @dev Private function to invoke {IERC721Receiver-onERC721Received} on a target contract.\n *\n * `from` - Previous owner of the given token ID.\n * `to` - Target address that will receive the token.\n * `tokenId` - Token ID to be transferred.\n * `_data` - Optional data to send along with the call.\n *\n * Returns whether the call correctly returned the expected magic value.\n */\n function _checkContractOnERC721Received(\n address from,\n address to,\n uint256 tokenId,\n bytes memory _data\n ) private returns (bool) {\n try ERC721A__IERC721Receiver(to).onERC721Received(_msgSenderERC721A(), from, tokenId, _data) returns (\n bytes4 retval\n ) {\n return retval == ERC721A__IERC721Receiver(to).onERC721Received.selector;\n } catch (bytes memory reason) {\n if (reason.length == 0) {\n _revert(TransferToNonERC721ReceiverImplementer.selector);\n }\n assembly {\n revert(add(32, reason), mload(reason))\n }\n }\n }\n\n // =============================================================\n // MINT OPERATIONS\n // =============================================================\n\n /**\n * @dev Mints `quantity` tokens and transfers them to `to`.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - `quantity` must be greater than 0.\n *\n * Emits a {Transfer} event for each mint.\n */\n function _mint(address to, uint256 quantity) internal virtual {\n uint256 startTokenId = _currentIndex;\n if (quantity == 0) _revert(MintZeroQuantity.selector);\n\n _beforeTokenTransfers(address(0), to, startTokenId, quantity);\n\n // Overflows are incredibly unrealistic.\n // `balance` and `numberMinted` have a maximum limit of 2**64.\n // `tokenId` has a maximum limit of 2**256.\n unchecked {\n // Updates:\n // - `address` to the owner.\n // - `startTimestamp` to the timestamp of minting.\n // - `burned` to `false`.\n // - `nextInitialized` to `quantity == 1`.\n _packedOwnerships[startTokenId] = _packOwnershipData(\n to,\n _nextInitializedFlag(quantity) | _nextExtraData(address(0), to, 0)\n );\n\n // Updates:\n // - `balance += quantity`.\n // - `numberMinted += quantity`.\n //\n // We can directly add to the `balance` and `numberMinted`.\n _packedAddressData[to] += quantity * ((1 << _BITPOS_NUMBER_MINTED) | 1);\n\n // Mask `to` to the lower 160 bits, in case the upper bits somehow aren't clean.\n uint256 toMasked = uint256(uint160(to)) & _BITMASK_ADDRESS;\n\n if (toMasked == 0) _revert(MintToZeroAddress.selector);\n\n uint256 end = startTokenId + quantity;\n uint256 tokenId = startTokenId;\n\n if (end - 1 > _sequentialUpTo()) _revert(SequentialMintExceedsLimit.selector);\n\n do {\n assembly {\n // Emit the `Transfer` event.\n log4(\n 0, // Start of data (0, since no data).\n 0, // End of data (0, since no data).\n _TRANSFER_EVENT_SIGNATURE, // Signature.\n 0, // `address(0)`.\n toMasked, // `to`.\n tokenId // `tokenId`.\n )\n }\n // The `!=` check ensures that large values of `quantity`\n // that overflows uint256 will make the loop run out of gas.\n } while (++tokenId != end);\n\n _currentIndex = end;\n }\n _afterTokenTransfers(address(0), to, startTokenId, quantity);\n }\n\n /**\n * @dev Mints `quantity` tokens and transfers them to `to`.\n *\n * This function is intended for efficient minting only during contract creation.\n *\n * It emits only one {ConsecutiveTransfer} as defined in\n * [ERC2309](https://eips.ethereum.org/EIPS/eip-2309),\n * instead of a sequence of {Transfer} event(s).\n *\n * Calling this function outside of contract creation WILL make your contract\n * non-compliant with the ERC721 standard.\n * For full ERC721 compliance, substituting ERC721 {Transfer} event(s) with the ERC2309\n * {ConsecutiveTransfer} event is only permissible during contract creation.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - `quantity` must be greater than 0.\n *\n * Emits a {ConsecutiveTransfer} event.\n */\n function _mintERC2309(address to, uint256 quantity) internal virtual {\n uint256 startTokenId = _currentIndex;\n if (to == address(0)) _revert(MintToZeroAddress.selector);\n if (quantity == 0) _revert(MintZeroQuantity.selector);\n if (quantity > _MAX_MINT_ERC2309_QUANTITY_LIMIT) _revert(MintERC2309QuantityExceedsLimit.selector);\n\n _beforeTokenTransfers(address(0), to, startTokenId, quantity);\n\n // Overflows are unrealistic due to the above check for `quantity` to be below the limit.\n unchecked {\n // Updates:\n // - `balance += quantity`.\n // - `numberMinted += quantity`.\n //\n // We can directly add to the `balance` and `numberMinted`.\n _packedAddressData[to] += quantity * ((1 << _BITPOS_NUMBER_MINTED) | 1);\n\n // Updates:\n // - `address` to the owner.\n // - `startTimestamp` to the timestamp of minting.\n // - `burned` to `false`.\n // - `nextInitialized` to `quantity == 1`.\n _packedOwnerships[startTokenId] = _packOwnershipData(\n to,\n _nextInitializedFlag(quantity) | _nextExtraData(address(0), to, 0)\n );\n\n if (startTokenId + quantity - 1 > _sequentialUpTo()) _revert(SequentialMintExceedsLimit.selector);\n\n emit ConsecutiveTransfer(startTokenId, startTokenId + quantity - 1, address(0), to);\n\n _currentIndex = startTokenId + quantity;\n }\n _afterTokenTransfers(address(0), to, startTokenId, quantity);\n }\n\n /**\n * @dev Safely mints `quantity` tokens and transfers them to `to`.\n *\n * Requirements:\n *\n * - If `to` refers to a smart contract, it must implement\n * {IERC721Receiver-onERC721Received}, which is called for each safe transfer.\n * - `quantity` must be greater than 0.\n *\n * See {_mint}.\n *\n * Emits a {Transfer} event for each mint.\n */\n function _safeMint(\n address to,\n uint256 quantity,\n bytes memory _data\n ) internal virtual {\n _mint(to, quantity);\n\n unchecked {\n if (to.code.length != 0) {\n uint256 end = _currentIndex;\n uint256 index = end - quantity;\n do {\n if (!_checkContractOnERC721Received(address(0), to, index++, _data)) {\n _revert(TransferToNonERC721ReceiverImplementer.selector);\n }\n } while (index < end);\n // This prevents reentrancy to `_safeMint`.\n // It does not prevent reentrancy to `_safeMintSpot`.\n if (_currentIndex != end) revert();\n }\n }\n }\n\n /**\n * @dev Equivalent to `_safeMint(to, quantity, '')`.\n */\n function _safeMint(address to, uint256 quantity) internal virtual {\n _safeMint(to, quantity, '');\n }\n\n /**\n * @dev Mints a single token at `tokenId`.\n *\n * Note: A spot-minted `tokenId` that has been burned can be re-minted again.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - `tokenId` must be greater than `_sequentialUpTo()`.\n * - `tokenId` must not exist.\n *\n * Emits a {Transfer} event for each mint.\n */\n function _mintSpot(address to, uint256 tokenId) internal virtual {\n if (tokenId <= _sequentialUpTo()) _revert(SpotMintTokenIdTooSmall.selector);\n uint256 prevOwnershipPacked = _packedOwnerships[tokenId];\n if (_packedOwnershipExists(prevOwnershipPacked)) _revert(TokenAlreadyExists.selector);\n\n _beforeTokenTransfers(address(0), to, tokenId, 1);\n\n // Overflows are incredibly unrealistic.\n // The `numberMinted` for `to` is incremented by 1, and has a max limit of 2**64 - 1.\n // `_spotMinted` is incremented by 1, and has a max limit of 2**256 - 1.\n unchecked {\n // Updates:\n // - `address` to the owner.\n // - `startTimestamp` to the timestamp of minting.\n // - `burned` to `false`.\n // - `nextInitialized` to `true` (as `quantity == 1`).\n _packedOwnerships[tokenId] = _packOwnershipData(\n to,\n _nextInitializedFlag(1) | _nextExtraData(address(0), to, prevOwnershipPacked)\n );\n\n // Updates:\n // - `balance += 1`.\n // - `numberMinted += 1`.\n //\n // We can directly add to the `balance` and `numberMinted`.\n _packedAddressData[to] += (1 << _BITPOS_NUMBER_MINTED) | 1;\n\n // Mask `to` to the lower 160 bits, in case the upper bits somehow aren't clean.\n uint256 toMasked = uint256(uint160(to)) & _BITMASK_ADDRESS;\n\n if (toMasked == 0) _revert(MintToZeroAddress.selector);\n\n assembly {\n // Emit the `Transfer` event.\n log4(\n 0, // Start of data (0, since no data).\n 0, // End of data (0, since no data).\n _TRANSFER_EVENT_SIGNATURE, // Signature.\n 0, // `address(0)`.\n toMasked, // `to`.\n tokenId // `tokenId`.\n )\n }\n\n ++_spotMinted;\n }\n\n _afterTokenTransfers(address(0), to, tokenId, 1);\n }\n\n /**\n * @dev Safely mints a single token at `tokenId`.\n *\n * Note: A spot-minted `tokenId` that has been burned can be re-minted again.\n *\n * Requirements:\n *\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}.\n * - `tokenId` must be greater than `_sequentialUpTo()`.\n * - `tokenId` must not exist.\n *\n * See {_mintSpot}.\n *\n * Emits a {Transfer} event.\n */\n function _safeMintSpot(\n address to,\n uint256 tokenId,\n bytes memory _data\n ) internal virtual {\n _mintSpot(to, tokenId);\n\n unchecked {\n if (to.code.length != 0) {\n uint256 currentSpotMinted = _spotMinted;\n if (!_checkContractOnERC721Received(address(0), to, tokenId, _data)) {\n _revert(TransferToNonERC721ReceiverImplementer.selector);\n }\n // This prevents reentrancy to `_safeMintSpot`.\n // It does not prevent reentrancy to `_safeMint`.\n if (_spotMinted != currentSpotMinted) revert();\n }\n }\n }\n\n /**\n * @dev Equivalent to `_safeMintSpot(to, tokenId, '')`.\n */\n function _safeMintSpot(address to, uint256 tokenId) internal virtual {\n _safeMintSpot(to, tokenId, '');\n }\n\n // =============================================================\n // APPROVAL OPERATIONS\n // =============================================================\n\n /**\n * @dev Equivalent to `_approve(to, tokenId, false)`.\n */\n function _approve(address to, uint256 tokenId) internal virtual {\n _approve(to, tokenId, false);\n }\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\n * zero address clears previous approvals.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n *\n * Emits an {Approval} event.\n */\n function _approve(\n address to,\n uint256 tokenId,\n bool approvalCheck\n ) internal virtual {\n address owner = ownerOf(tokenId);\n\n if (approvalCheck && _msgSenderERC721A() != owner)\n if (!isApprovedForAll(owner, _msgSenderERC721A())) {\n _revert(ApprovalCallerNotOwnerNorApproved.selector);\n }\n\n _tokenApprovals[tokenId].value = to;\n emit Approval(owner, to, tokenId);\n }\n\n // =============================================================\n // BURN OPERATIONS\n // =============================================================\n\n /**\n * @dev Equivalent to `_burn(tokenId, false)`.\n */\n function _burn(uint256 tokenId) internal virtual {\n _burn(tokenId, false);\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, bool approvalCheck) internal virtual {\n uint256 prevOwnershipPacked = _packedOwnershipOf(tokenId);\n\n address from = address(uint160(prevOwnershipPacked));\n\n (uint256 approvedAddressSlot, address approvedAddress) = _getApprovedSlotAndAddress(tokenId);\n\n if (approvalCheck) {\n // The nested ifs save around 20+ gas over a compound boolean condition.\n if (!_isSenderApprovedOrOwner(approvedAddress, from, _msgSenderERC721A()))\n if (!isApprovedForAll(from, _msgSenderERC721A())) _revert(TransferCallerNotOwnerNorApproved.selector);\n }\n\n _beforeTokenTransfers(from, address(0), tokenId, 1);\n\n // Clear approvals from the previous owner.\n assembly {\n if approvedAddress {\n // This is equivalent to `delete _tokenApprovals[tokenId]`.\n sstore(approvedAddressSlot, 0)\n }\n }\n\n // Underflow of the sender's balance is impossible because we check for\n // ownership above and the recipient's balance can't realistically overflow.\n // Counter overflow is incredibly unrealistic as `tokenId` would have to be 2**256.\n unchecked {\n // Updates:\n // - `balance -= 1`.\n // - `numberBurned += 1`.\n //\n // We can directly decrement the balance, and increment the number burned.\n // This is equivalent to `packed -= 1; packed += 1 << _BITPOS_NUMBER_BURNED;`.\n _packedAddressData[from] += (1 << _BITPOS_NUMBER_BURNED) - 1;\n\n // Updates:\n // - `address` to the last owner.\n // - `startTimestamp` to the timestamp of burning.\n // - `burned` to `true`.\n // - `nextInitialized` to `true`.\n _packedOwnerships[tokenId] = _packOwnershipData(\n from,\n (_BITMASK_BURNED | _BITMASK_NEXT_INITIALIZED) | _nextExtraData(from, address(0), prevOwnershipPacked)\n );\n\n // If the next slot may not have been initialized (i.e. `nextInitialized == false`) .\n if (prevOwnershipPacked & _BITMASK_NEXT_INITIALIZED == 0) {\n uint256 nextTokenId = tokenId + 1;\n // If the next slot's address is zero and not burned (i.e. packed value is zero).\n if (_packedOwnerships[nextTokenId] == 0) {\n // If the next slot is within bounds.\n if (nextTokenId != _currentIndex) {\n // Initialize the next slot to maintain correctness for `ownerOf(tokenId + 1)`.\n _packedOwnerships[nextTokenId] = prevOwnershipPacked;\n }\n }\n }\n }\n\n emit Transfer(from, address(0), tokenId);\n _afterTokenTransfers(from, address(0), tokenId, 1);\n\n // Overflow not possible, as `_burnCounter` cannot be exceed `_currentIndex + _spotMinted` times.\n unchecked {\n _burnCounter++;\n }\n }\n\n // =============================================================\n // EXTRA DATA OPERATIONS\n // =============================================================\n\n /**\n * @dev Directly sets the extra data for the ownership data `index`.\n */\n function _setExtraDataAt(uint256 index, uint24 extraData) internal virtual {\n uint256 packed = _packedOwnerships[index];\n if (packed == 0) _revert(OwnershipNotInitializedForExtraData.selector);\n uint256 extraDataCasted;\n // Cast `extraData` with assembly to avoid redundant masking.\n assembly {\n extraDataCasted := extraData\n }\n packed = (packed & _BITMASK_EXTRA_DATA_COMPLEMENT) | (extraDataCasted << _BITPOS_EXTRA_DATA);\n _packedOwnerships[index] = packed;\n }\n\n /**\n * @dev Called during each token transfer to set the 24bit `extraData` field.\n * Intended to be overridden by the cosumer contract.\n *\n * `previousExtraData` - the value of `extraData` before transfer.\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, `tokenId` will be burned by `from`.\n * - `from` and `to` are never both zero.\n */\n function _extraData(\n address from,\n address to,\n uint24 previousExtraData\n ) internal view virtual returns (uint24) {}\n\n /**\n * @dev Returns the next extra data for the packed ownership data.\n * The returned result is shifted into position.\n */\n function _nextExtraData(\n address from,\n address to,\n uint256 prevOwnershipPacked\n ) private view returns (uint256) {\n uint24 extraData = uint24(prevOwnershipPacked >> _BITPOS_EXTRA_DATA);\n return uint256(_extraData(from, to, extraData)) << _BITPOS_EXTRA_DATA;\n }\n\n // =============================================================\n // OTHER OPERATIONS\n // =============================================================\n\n /**\n * @dev Returns the message sender (defaults to `msg.sender`).\n *\n * If you are writing GSN compatible contracts, you need to override this function.\n */\n function _msgSenderERC721A() internal view virtual returns (address) {\n return msg.sender;\n }\n\n /**\n * @dev Converts a uint256 to its ASCII string decimal representation.\n */\n function _toString(uint256 value) internal pure virtual returns (string memory str) {\n assembly {\n // The maximum value of a uint256 contains 78 digits (1 byte per digit), but\n // we allocate 0xa0 bytes to keep the free memory pointer 32-byte word aligned.\n // We will need 1 word for the trailing zeros padding, 1 word for the length,\n // and 3 words for a maximum of 78 digits. Total: 5 * 0x20 = 0xa0.\n let m := add(mload(0x40), 0xa0)\n // Update the free memory pointer to allocate.\n mstore(0x40, m)\n // Assign the `str` to the end.\n str := sub(m, 0x20)\n // Zeroize the slot after the string.\n mstore(str, 0)\n\n // Cache the end of the memory to calculate the length later.\n let end := str\n\n // We write the string from rightmost digit to leftmost digit.\n // The following is essentially a do-while loop that also handles the zero case.\n // prettier-ignore\n for { let temp := value } 1 {} {\n str := sub(str, 1)\n // Write the character to the pointer.\n // The ASCII index of the '0' character is 48.\n mstore8(str, add(48, mod(temp, 10)))\n // Keep dividing `temp` until zero.\n temp := div(temp, 10)\n // prettier-ignore\n if iszero(temp) { break }\n }\n\n let length := sub(end, str)\n // Move the pointer 32 bytes leftwards to make room for the length.\n str := sub(str, 0x20)\n // Store the length.\n mstore(str, length)\n }\n }\n\n /**\n * @dev For more efficient reverts.\n */\n function _revert(bytes4 errorSelector) internal pure {\n assembly {\n mstore(0x00, errorSelector)\n revert(0x00, 0x04)\n }\n }\n}\n" }, - 'node_modules/erc721a/contracts/ERC721A.sol': { + 'lib/openzeppelin/contracts/proxy/ERC1967/ERC1967Upgrade.sol': { content: - "// SPDX-License-Identifier: MIT\n// ERC721A Contracts v4.2.3\n// Creator: Chiru Labs\n\npragma solidity ^0.8.4;\n\nimport './IERC721A.sol';\n\n/**\n * @dev Interface of ERC721 token receiver.\n */\ninterface ERC721A__IERC721Receiver {\n function onERC721Received(\n address operator,\n address from,\n uint256 tokenId,\n bytes calldata data\n ) external returns (bytes4);\n}\n\n/**\n * @title ERC721A\n *\n * @dev Implementation of the [ERC721](https://eips.ethereum.org/EIPS/eip-721)\n * Non-Fungible Token Standard, including the Metadata extension.\n * Optimized for lower gas during batch mints.\n *\n * Token IDs are minted in sequential order (e.g. 0, 1, 2, 3, ...)\n * starting from `_startTokenId()`.\n *\n * Assumptions:\n *\n * - An owner cannot have more than 2**64 - 1 (max value of uint64) of supply.\n * - The maximum token ID cannot exceed 2**256 - 1 (max value of uint256).\n */\ncontract ERC721A is IERC721A {\n // Bypass for a `--via-ir` bug (https://github.com/chiru-labs/ERC721A/pull/364).\n struct TokenApprovalRef {\n address value;\n }\n\n // =============================================================\n // CONSTANTS\n // =============================================================\n\n // Mask of an entry in packed address data.\n uint256 private constant _BITMASK_ADDRESS_DATA_ENTRY = (1 << 64) - 1;\n\n // The bit position of `numberMinted` in packed address data.\n uint256 private constant _BITPOS_NUMBER_MINTED = 64;\n\n // The bit position of `numberBurned` in packed address data.\n uint256 private constant _BITPOS_NUMBER_BURNED = 128;\n\n // The bit position of `aux` in packed address data.\n uint256 private constant _BITPOS_AUX = 192;\n\n // Mask of all 256 bits in packed address data except the 64 bits for `aux`.\n uint256 private constant _BITMASK_AUX_COMPLEMENT = (1 << 192) - 1;\n\n // The bit position of `startTimestamp` in packed ownership.\n uint256 private constant _BITPOS_START_TIMESTAMP = 160;\n\n // The bit mask of the `burned` bit in packed ownership.\n uint256 private constant _BITMASK_BURNED = 1 << 224;\n\n // The bit position of the `nextInitialized` bit in packed ownership.\n uint256 private constant _BITPOS_NEXT_INITIALIZED = 225;\n\n // The bit mask of the `nextInitialized` bit in packed ownership.\n uint256 private constant _BITMASK_NEXT_INITIALIZED = 1 << 225;\n\n // The bit position of `extraData` in packed ownership.\n uint256 private constant _BITPOS_EXTRA_DATA = 232;\n\n // Mask of all 256 bits in a packed ownership except the 24 bits for `extraData`.\n uint256 private constant _BITMASK_EXTRA_DATA_COMPLEMENT = (1 << 232) - 1;\n\n // The mask of the lower 160 bits for addresses.\n uint256 private constant _BITMASK_ADDRESS = (1 << 160) - 1;\n\n // The maximum `quantity` that can be minted with {_mintERC2309}.\n // This limit is to prevent overflows on the address data entries.\n // For a limit of 5000, a total of 3.689e15 calls to {_mintERC2309}\n // is required to cause an overflow, which is unrealistic.\n uint256 private constant _MAX_MINT_ERC2309_QUANTITY_LIMIT = 5000;\n\n // The `Transfer` event signature is given by:\n // `keccak256(bytes(\"Transfer(address,address,uint256)\"))`.\n bytes32 private constant _TRANSFER_EVENT_SIGNATURE =\n 0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef;\n\n // =============================================================\n // STORAGE\n // =============================================================\n\n // The next token ID to be minted.\n uint256 private _currentIndex;\n\n // The number of tokens burned.\n uint256 private _burnCounter;\n\n // Token name\n string private _name;\n\n // Token symbol\n string private _symbol;\n\n // Mapping from token ID to ownership details\n // An empty struct value does not necessarily mean the token is unowned.\n // See {_packedOwnershipOf} implementation for details.\n //\n // Bits Layout:\n // - [0..159] `addr`\n // - [160..223] `startTimestamp`\n // - [224] `burned`\n // - [225] `nextInitialized`\n // - [232..255] `extraData`\n mapping(uint256 => uint256) private _packedOwnerships;\n\n // Mapping owner address to address data.\n //\n // Bits Layout:\n // - [0..63] `balance`\n // - [64..127] `numberMinted`\n // - [128..191] `numberBurned`\n // - [192..255] `aux`\n mapping(address => uint256) private _packedAddressData;\n\n // Mapping from token ID to approved address.\n mapping(uint256 => TokenApprovalRef) private _tokenApprovals;\n\n // Mapping from owner to operator approvals\n mapping(address => mapping(address => bool)) private _operatorApprovals;\n\n // =============================================================\n // CONSTRUCTOR\n // =============================================================\n\n constructor(string memory name_, string memory symbol_) {\n _name = name_;\n _symbol = symbol_;\n _currentIndex = _startTokenId();\n }\n\n // =============================================================\n // TOKEN COUNTING OPERATIONS\n // =============================================================\n\n /**\n * @dev Returns the starting token ID.\n * To change the starting token ID, please override this function.\n */\n function _startTokenId() internal view virtual returns (uint256) {\n return 0;\n }\n\n /**\n * @dev Returns the next token ID to be minted.\n */\n function _nextTokenId() internal view virtual returns (uint256) {\n return _currentIndex;\n }\n\n /**\n * @dev Returns the total number of tokens in existence.\n * Burned tokens will reduce the count.\n * To get the total number of tokens minted, please see {_totalMinted}.\n */\n function totalSupply() public view virtual override returns (uint256) {\n // Counter underflow is impossible as _burnCounter cannot be incremented\n // more than `_currentIndex - _startTokenId()` times.\n unchecked {\n return _currentIndex - _burnCounter - _startTokenId();\n }\n }\n\n /**\n * @dev Returns the total amount of tokens minted in the contract.\n */\n function _totalMinted() internal view virtual returns (uint256) {\n // Counter underflow is impossible as `_currentIndex` does not decrement,\n // and it is initialized to `_startTokenId()`.\n unchecked {\n return _currentIndex - _startTokenId();\n }\n }\n\n /**\n * @dev Returns the total number of tokens burned.\n */\n function _totalBurned() internal view virtual returns (uint256) {\n return _burnCounter;\n }\n\n // =============================================================\n // ADDRESS DATA OPERATIONS\n // =============================================================\n\n /**\n * @dev Returns the number of tokens in `owner`'s account.\n */\n function balanceOf(address owner) public view virtual override returns (uint256) {\n if (owner == address(0)) revert BalanceQueryForZeroAddress();\n return _packedAddressData[owner] & _BITMASK_ADDRESS_DATA_ENTRY;\n }\n\n /**\n * Returns the number of tokens minted by `owner`.\n */\n function _numberMinted(address owner) internal view returns (uint256) {\n return (_packedAddressData[owner] >> _BITPOS_NUMBER_MINTED) & _BITMASK_ADDRESS_DATA_ENTRY;\n }\n\n /**\n * Returns the number of tokens burned by or on behalf of `owner`.\n */\n function _numberBurned(address owner) internal view returns (uint256) {\n return (_packedAddressData[owner] >> _BITPOS_NUMBER_BURNED) & _BITMASK_ADDRESS_DATA_ENTRY;\n }\n\n /**\n * Returns the auxiliary data for `owner`. (e.g. number of whitelist mint slots used).\n */\n function _getAux(address owner) internal view returns (uint64) {\n return uint64(_packedAddressData[owner] >> _BITPOS_AUX);\n }\n\n /**\n * Sets the auxiliary data for `owner`. (e.g. number of whitelist mint slots used).\n * If there are multiple variables, please pack them into a uint64.\n */\n function _setAux(address owner, uint64 aux) internal virtual {\n uint256 packed = _packedAddressData[owner];\n uint256 auxCasted;\n // Cast `aux` with assembly to avoid redundant masking.\n assembly {\n auxCasted := aux\n }\n packed = (packed & _BITMASK_AUX_COMPLEMENT) | (auxCasted << _BITPOS_AUX);\n _packedAddressData[owner] = packed;\n }\n\n // =============================================================\n // IERC165\n // =============================================================\n\n /**\n * @dev Returns true if this contract implements the interface defined by\n * `interfaceId`. See the corresponding\n * [EIP section](https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified)\n * to learn more about how these ids are created.\n *\n * This function call must use less than 30000 gas.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n // The interface IDs are constants representing the first 4 bytes\n // of the XOR of all function selectors in the interface.\n // See: [ERC165](https://eips.ethereum.org/EIPS/eip-165)\n // (e.g. `bytes4(i.functionA.selector ^ i.functionB.selector ^ ...)`)\n return\n interfaceId == 0x01ffc9a7 || // ERC165 interface ID for ERC165.\n interfaceId == 0x80ac58cd || // ERC165 interface ID for ERC721.\n interfaceId == 0x5b5e139f; // ERC165 interface ID for ERC721Metadata.\n }\n\n // =============================================================\n // IERC721Metadata\n // =============================================================\n\n /**\n * @dev Returns the token collection name.\n */\n function name() public view virtual override returns (string memory) {\n return _name;\n }\n\n /**\n * @dev Returns the token collection symbol.\n */\n function symbol() public view virtual override returns (string memory) {\n return _symbol;\n }\n\n /**\n * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.\n */\n function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {\n if (!_exists(tokenId)) revert URIQueryForNonexistentToken();\n\n string memory baseURI = _baseURI();\n return bytes(baseURI).length != 0 ? string(abi.encodePacked(baseURI, _toString(tokenId))) : '';\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, it can be overridden in child contracts.\n */\n function _baseURI() internal view virtual returns (string memory) {\n return '';\n }\n\n // =============================================================\n // OWNERSHIPS OPERATIONS\n // =============================================================\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) public view virtual override returns (address) {\n return address(uint160(_packedOwnershipOf(tokenId)));\n }\n\n /**\n * @dev Gas spent here starts off proportional to the maximum mint batch size.\n * It gradually moves to O(1) as tokens get transferred around over time.\n */\n function _ownershipOf(uint256 tokenId) internal view virtual returns (TokenOwnership memory) {\n return _unpackedOwnership(_packedOwnershipOf(tokenId));\n }\n\n /**\n * @dev Returns the unpacked `TokenOwnership` struct at `index`.\n */\n function _ownershipAt(uint256 index) internal view virtual returns (TokenOwnership memory) {\n return _unpackedOwnership(_packedOwnerships[index]);\n }\n\n /**\n * @dev Initializes the ownership slot minted at `index` for efficiency purposes.\n */\n function _initializeOwnershipAt(uint256 index) internal virtual {\n if (_packedOwnerships[index] == 0) {\n _packedOwnerships[index] = _packedOwnershipOf(index);\n }\n }\n\n /**\n * Returns the packed ownership data of `tokenId`.\n */\n function _packedOwnershipOf(uint256 tokenId) private view returns (uint256) {\n uint256 curr = tokenId;\n\n unchecked {\n if (_startTokenId() <= curr)\n if (curr < _currentIndex) {\n uint256 packed = _packedOwnerships[curr];\n // If not burned.\n if (packed & _BITMASK_BURNED == 0) {\n // Invariant:\n // There will always be an initialized ownership slot\n // (i.e. `ownership.addr != address(0) && ownership.burned == false`)\n // before an unintialized ownership slot\n // (i.e. `ownership.addr == address(0) && ownership.burned == false`)\n // Hence, `curr` will not underflow.\n //\n // We can directly compare the packed value.\n // If the address is zero, packed will be zero.\n while (packed == 0) {\n packed = _packedOwnerships[--curr];\n }\n return packed;\n }\n }\n }\n revert OwnerQueryForNonexistentToken();\n }\n\n /**\n * @dev Returns the unpacked `TokenOwnership` struct from `packed`.\n */\n function _unpackedOwnership(uint256 packed) private pure returns (TokenOwnership memory ownership) {\n ownership.addr = address(uint160(packed));\n ownership.startTimestamp = uint64(packed >> _BITPOS_START_TIMESTAMP);\n ownership.burned = packed & _BITMASK_BURNED != 0;\n ownership.extraData = uint24(packed >> _BITPOS_EXTRA_DATA);\n }\n\n /**\n * @dev Packs ownership data into a single uint256.\n */\n function _packOwnershipData(address owner, uint256 flags) private view returns (uint256 result) {\n assembly {\n // Mask `owner` to the lower 160 bits, in case the upper bits somehow aren't clean.\n owner := and(owner, _BITMASK_ADDRESS)\n // `owner | (block.timestamp << _BITPOS_START_TIMESTAMP) | flags`.\n result := or(owner, or(shl(_BITPOS_START_TIMESTAMP, timestamp()), flags))\n }\n }\n\n /**\n * @dev Returns the `nextInitialized` flag set if `quantity` equals 1.\n */\n function _nextInitializedFlag(uint256 quantity) private pure returns (uint256 result) {\n // For branchless setting of the `nextInitialized` flag.\n assembly {\n // `(quantity == 1) << _BITPOS_NEXT_INITIALIZED`.\n result := shl(_BITPOS_NEXT_INITIALIZED, eq(quantity, 1))\n }\n }\n\n // =============================================================\n // APPROVAL OPERATIONS\n // =============================================================\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\n * 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) public payable virtual override {\n address owner = ownerOf(tokenId);\n\n if (_msgSenderERC721A() != owner)\n if (!isApprovedForAll(owner, _msgSenderERC721A())) {\n revert ApprovalCallerNotOwnerNorApproved();\n }\n\n _tokenApprovals[tokenId].value = to;\n emit Approval(owner, to, tokenId);\n }\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) public view virtual override returns (address) {\n if (!_exists(tokenId)) revert ApprovalQueryForNonexistentToken();\n\n return _tokenApprovals[tokenId].value;\n }\n\n /**\n * @dev Approve or remove `operator` as an operator for the caller.\n * Operators can call {transferFrom} or {safeTransferFrom}\n * 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) public virtual override {\n _operatorApprovals[_msgSenderERC721A()][operator] = approved;\n emit ApprovalForAll(_msgSenderERC721A(), operator, approved);\n }\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) public view virtual override returns (bool) {\n return _operatorApprovals[owner][operator];\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. See {_mint}.\n */\n function _exists(uint256 tokenId) internal view virtual returns (bool) {\n return\n _startTokenId() <= tokenId &&\n tokenId < _currentIndex && // If within bounds,\n _packedOwnerships[tokenId] & _BITMASK_BURNED == 0; // and not burned.\n }\n\n /**\n * @dev Returns whether `msgSender` is equal to `approvedAddress` or `owner`.\n */\n function _isSenderApprovedOrOwner(\n address approvedAddress,\n address owner,\n address msgSender\n ) private pure returns (bool result) {\n assembly {\n // Mask `owner` to the lower 160 bits, in case the upper bits somehow aren't clean.\n owner := and(owner, _BITMASK_ADDRESS)\n // Mask `msgSender` to the lower 160 bits, in case the upper bits somehow aren't clean.\n msgSender := and(msgSender, _BITMASK_ADDRESS)\n // `msgSender == owner || msgSender == approvedAddress`.\n result := or(eq(msgSender, owner), eq(msgSender, approvedAddress))\n }\n }\n\n /**\n * @dev Returns the storage slot and value for the approved address of `tokenId`.\n */\n function _getApprovedSlotAndAddress(uint256 tokenId)\n private\n view\n returns (uint256 approvedAddressSlot, address approvedAddress)\n {\n TokenApprovalRef storage tokenApproval = _tokenApprovals[tokenId];\n // The following is equivalent to `approvedAddress = _tokenApprovals[tokenId].value`.\n assembly {\n approvedAddressSlot := tokenApproval.slot\n approvedAddress := sload(approvedAddressSlot)\n }\n }\n\n // =============================================================\n // TRANSFER OPERATIONS\n // =============================================================\n\n /**\n * @dev Transfers `tokenId` 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 be owned by `from`.\n * - If the caller is not `from`, it must be approved to move this token\n * 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 ) public payable virtual override {\n uint256 prevOwnershipPacked = _packedOwnershipOf(tokenId);\n\n if (address(uint160(prevOwnershipPacked)) != from) revert TransferFromIncorrectOwner();\n\n (uint256 approvedAddressSlot, address approvedAddress) = _getApprovedSlotAndAddress(tokenId);\n\n // The nested ifs save around 20+ gas over a compound boolean condition.\n if (!_isSenderApprovedOrOwner(approvedAddress, from, _msgSenderERC721A()))\n if (!isApprovedForAll(from, _msgSenderERC721A())) revert TransferCallerNotOwnerNorApproved();\n\n if (to == address(0)) revert TransferToZeroAddress();\n\n _beforeTokenTransfers(from, to, tokenId, 1);\n\n // Clear approvals from the previous owner.\n assembly {\n if approvedAddress {\n // This is equivalent to `delete _tokenApprovals[tokenId]`.\n sstore(approvedAddressSlot, 0)\n }\n }\n\n // Underflow of the sender's balance is impossible because we check for\n // ownership above and the recipient's balance can't realistically overflow.\n // Counter overflow is incredibly unrealistic as `tokenId` would have to be 2**256.\n unchecked {\n // We can directly increment and decrement the balances.\n --_packedAddressData[from]; // Updates: `balance -= 1`.\n ++_packedAddressData[to]; // Updates: `balance += 1`.\n\n // Updates:\n // - `address` to the next owner.\n // - `startTimestamp` to the timestamp of transfering.\n // - `burned` to `false`.\n // - `nextInitialized` to `true`.\n _packedOwnerships[tokenId] = _packOwnershipData(\n to,\n _BITMASK_NEXT_INITIALIZED | _nextExtraData(from, to, prevOwnershipPacked)\n );\n\n // If the next slot may not have been initialized (i.e. `nextInitialized == false`) .\n if (prevOwnershipPacked & _BITMASK_NEXT_INITIALIZED == 0) {\n uint256 nextTokenId = tokenId + 1;\n // If the next slot's address is zero and not burned (i.e. packed value is zero).\n if (_packedOwnerships[nextTokenId] == 0) {\n // If the next slot is within bounds.\n if (nextTokenId != _currentIndex) {\n // Initialize the next slot to maintain correctness for `ownerOf(tokenId + 1)`.\n _packedOwnerships[nextTokenId] = prevOwnershipPacked;\n }\n }\n }\n }\n\n emit Transfer(from, to, tokenId);\n _afterTokenTransfers(from, to, tokenId, 1);\n }\n\n /**\n * @dev Equivalent to `safeTransferFrom(from, to, tokenId, '')`.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId\n ) public payable virtual override {\n safeTransferFrom(from, to, tokenId, '');\n }\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\n * by either {approve} or {setApprovalForAll}.\n * - If `to` refers to a smart contract, it must implement\n * {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 memory _data\n ) public payable virtual override {\n transferFrom(from, to, tokenId);\n if (to.code.length != 0)\n if (!_checkContractOnERC721Received(from, to, tokenId, _data)) {\n revert TransferToNonERC721ReceiverImplementer();\n }\n }\n\n /**\n * @dev Hook that is called before a set of serially-ordered token IDs\n * are about to be transferred. This includes minting.\n * And also called before burning one token.\n *\n * `startTokenId` - the first token ID to be transferred.\n * `quantity` - the amount to be transferred.\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, `tokenId` will be burned by `from`.\n * - `from` and `to` are never both zero.\n */\n function _beforeTokenTransfers(\n address from,\n address to,\n uint256 startTokenId,\n uint256 quantity\n ) internal virtual {}\n\n /**\n * @dev Hook that is called after a set of serially-ordered token IDs\n * have been transferred. This includes minting.\n * And also called after one token has been burned.\n *\n * `startTokenId` - the first token ID to be transferred.\n * `quantity` - the amount to be transferred.\n *\n * Calling conditions:\n *\n * - When `from` and `to` are both non-zero, `from`'s `tokenId` has been\n * transferred to `to`.\n * - When `from` is zero, `tokenId` has been minted for `to`.\n * - When `to` is zero, `tokenId` has been burned by `from`.\n * - `from` and `to` are never both zero.\n */\n function _afterTokenTransfers(\n address from,\n address to,\n uint256 startTokenId,\n uint256 quantity\n ) internal virtual {}\n\n /**\n * @dev Private function to invoke {IERC721Receiver-onERC721Received} on a target contract.\n *\n * `from` - Previous owner of the given token ID.\n * `to` - Target address that will receive the token.\n * `tokenId` - Token ID to be transferred.\n * `_data` - Optional data to send along with the call.\n *\n * Returns whether the call correctly returned the expected magic value.\n */\n function _checkContractOnERC721Received(\n address from,\n address to,\n uint256 tokenId,\n bytes memory _data\n ) private returns (bool) {\n try ERC721A__IERC721Receiver(to).onERC721Received(_msgSenderERC721A(), from, tokenId, _data) returns (\n bytes4 retval\n ) {\n return retval == ERC721A__IERC721Receiver(to).onERC721Received.selector;\n } catch (bytes memory reason) {\n if (reason.length == 0) {\n revert TransferToNonERC721ReceiverImplementer();\n } else {\n assembly {\n revert(add(32, reason), mload(reason))\n }\n }\n }\n }\n\n // =============================================================\n // MINT OPERATIONS\n // =============================================================\n\n /**\n * @dev Mints `quantity` tokens and transfers them to `to`.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - `quantity` must be greater than 0.\n *\n * Emits a {Transfer} event for each mint.\n */\n function _mint(address to, uint256 quantity) internal virtual {\n uint256 startTokenId = _currentIndex;\n if (quantity == 0) revert MintZeroQuantity();\n\n _beforeTokenTransfers(address(0), to, startTokenId, quantity);\n\n // Overflows are incredibly unrealistic.\n // `balance` and `numberMinted` have a maximum limit of 2**64.\n // `tokenId` has a maximum limit of 2**256.\n unchecked {\n // Updates:\n // - `balance += quantity`.\n // - `numberMinted += quantity`.\n //\n // We can directly add to the `balance` and `numberMinted`.\n _packedAddressData[to] += quantity * ((1 << _BITPOS_NUMBER_MINTED) | 1);\n\n // Updates:\n // - `address` to the owner.\n // - `startTimestamp` to the timestamp of minting.\n // - `burned` to `false`.\n // - `nextInitialized` to `quantity == 1`.\n _packedOwnerships[startTokenId] = _packOwnershipData(\n to,\n _nextInitializedFlag(quantity) | _nextExtraData(address(0), to, 0)\n );\n\n uint256 toMasked;\n uint256 end = startTokenId + quantity;\n\n // Use assembly to loop and emit the `Transfer` event for gas savings.\n // The duplicated `log4` removes an extra check and reduces stack juggling.\n // The assembly, together with the surrounding Solidity code, have been\n // delicately arranged to nudge the compiler into producing optimized opcodes.\n assembly {\n // Mask `to` to the lower 160 bits, in case the upper bits somehow aren't clean.\n toMasked := and(to, _BITMASK_ADDRESS)\n // Emit the `Transfer` event.\n log4(\n 0, // Start of data (0, since no data).\n 0, // End of data (0, since no data).\n _TRANSFER_EVENT_SIGNATURE, // Signature.\n 0, // `address(0)`.\n toMasked, // `to`.\n startTokenId // `tokenId`.\n )\n\n // The `iszero(eq(,))` check ensures that large values of `quantity`\n // that overflows uint256 will make the loop run out of gas.\n // The compiler will optimize the `iszero` away for performance.\n for {\n let tokenId := add(startTokenId, 1)\n } iszero(eq(tokenId, end)) {\n tokenId := add(tokenId, 1)\n } {\n // Emit the `Transfer` event. Similar to above.\n log4(0, 0, _TRANSFER_EVENT_SIGNATURE, 0, toMasked, tokenId)\n }\n }\n if (toMasked == 0) revert MintToZeroAddress();\n\n _currentIndex = end;\n }\n _afterTokenTransfers(address(0), to, startTokenId, quantity);\n }\n\n /**\n * @dev Mints `quantity` tokens and transfers them to `to`.\n *\n * This function is intended for efficient minting only during contract creation.\n *\n * It emits only one {ConsecutiveTransfer} as defined in\n * [ERC2309](https://eips.ethereum.org/EIPS/eip-2309),\n * instead of a sequence of {Transfer} event(s).\n *\n * Calling this function outside of contract creation WILL make your contract\n * non-compliant with the ERC721 standard.\n * For full ERC721 compliance, substituting ERC721 {Transfer} event(s) with the ERC2309\n * {ConsecutiveTransfer} event is only permissible during contract creation.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - `quantity` must be greater than 0.\n *\n * Emits a {ConsecutiveTransfer} event.\n */\n function _mintERC2309(address to, uint256 quantity) internal virtual {\n uint256 startTokenId = _currentIndex;\n if (to == address(0)) revert MintToZeroAddress();\n if (quantity == 0) revert MintZeroQuantity();\n if (quantity > _MAX_MINT_ERC2309_QUANTITY_LIMIT) revert MintERC2309QuantityExceedsLimit();\n\n _beforeTokenTransfers(address(0), to, startTokenId, quantity);\n\n // Overflows are unrealistic due to the above check for `quantity` to be below the limit.\n unchecked {\n // Updates:\n // - `balance += quantity`.\n // - `numberMinted += quantity`.\n //\n // We can directly add to the `balance` and `numberMinted`.\n _packedAddressData[to] += quantity * ((1 << _BITPOS_NUMBER_MINTED) | 1);\n\n // Updates:\n // - `address` to the owner.\n // - `startTimestamp` to the timestamp of minting.\n // - `burned` to `false`.\n // - `nextInitialized` to `quantity == 1`.\n _packedOwnerships[startTokenId] = _packOwnershipData(\n to,\n _nextInitializedFlag(quantity) | _nextExtraData(address(0), to, 0)\n );\n\n emit ConsecutiveTransfer(startTokenId, startTokenId + quantity - 1, address(0), to);\n\n _currentIndex = startTokenId + quantity;\n }\n _afterTokenTransfers(address(0), to, startTokenId, quantity);\n }\n\n /**\n * @dev Safely mints `quantity` tokens and transfers them to `to`.\n *\n * Requirements:\n *\n * - If `to` refers to a smart contract, it must implement\n * {IERC721Receiver-onERC721Received}, which is called for each safe transfer.\n * - `quantity` must be greater than 0.\n *\n * See {_mint}.\n *\n * Emits a {Transfer} event for each mint.\n */\n function _safeMint(\n address to,\n uint256 quantity,\n bytes memory _data\n ) internal virtual {\n _mint(to, quantity);\n\n unchecked {\n if (to.code.length != 0) {\n uint256 end = _currentIndex;\n uint256 index = end - quantity;\n do {\n if (!_checkContractOnERC721Received(address(0), to, index++, _data)) {\n revert TransferToNonERC721ReceiverImplementer();\n }\n } while (index < end);\n // Reentrancy protection.\n if (_currentIndex != end) revert();\n }\n }\n }\n\n /**\n * @dev Equivalent to `_safeMint(to, quantity, '')`.\n */\n function _safeMint(address to, uint256 quantity) internal virtual {\n _safeMint(to, quantity, '');\n }\n\n // =============================================================\n // BURN OPERATIONS\n // =============================================================\n\n /**\n * @dev Equivalent to `_burn(tokenId, false)`.\n */\n function _burn(uint256 tokenId) internal virtual {\n _burn(tokenId, false);\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, bool approvalCheck) internal virtual {\n uint256 prevOwnershipPacked = _packedOwnershipOf(tokenId);\n\n address from = address(uint160(prevOwnershipPacked));\n\n (uint256 approvedAddressSlot, address approvedAddress) = _getApprovedSlotAndAddress(tokenId);\n\n if (approvalCheck) {\n // The nested ifs save around 20+ gas over a compound boolean condition.\n if (!_isSenderApprovedOrOwner(approvedAddress, from, _msgSenderERC721A()))\n if (!isApprovedForAll(from, _msgSenderERC721A())) revert TransferCallerNotOwnerNorApproved();\n }\n\n _beforeTokenTransfers(from, address(0), tokenId, 1);\n\n // Clear approvals from the previous owner.\n assembly {\n if approvedAddress {\n // This is equivalent to `delete _tokenApprovals[tokenId]`.\n sstore(approvedAddressSlot, 0)\n }\n }\n\n // Underflow of the sender's balance is impossible because we check for\n // ownership above and the recipient's balance can't realistically overflow.\n // Counter overflow is incredibly unrealistic as `tokenId` would have to be 2**256.\n unchecked {\n // Updates:\n // - `balance -= 1`.\n // - `numberBurned += 1`.\n //\n // We can directly decrement the balance, and increment the number burned.\n // This is equivalent to `packed -= 1; packed += 1 << _BITPOS_NUMBER_BURNED;`.\n _packedAddressData[from] += (1 << _BITPOS_NUMBER_BURNED) - 1;\n\n // Updates:\n // - `address` to the last owner.\n // - `startTimestamp` to the timestamp of burning.\n // - `burned` to `true`.\n // - `nextInitialized` to `true`.\n _packedOwnerships[tokenId] = _packOwnershipData(\n from,\n (_BITMASK_BURNED | _BITMASK_NEXT_INITIALIZED) | _nextExtraData(from, address(0), prevOwnershipPacked)\n );\n\n // If the next slot may not have been initialized (i.e. `nextInitialized == false`) .\n if (prevOwnershipPacked & _BITMASK_NEXT_INITIALIZED == 0) {\n uint256 nextTokenId = tokenId + 1;\n // If the next slot's address is zero and not burned (i.e. packed value is zero).\n if (_packedOwnerships[nextTokenId] == 0) {\n // If the next slot is within bounds.\n if (nextTokenId != _currentIndex) {\n // Initialize the next slot to maintain correctness for `ownerOf(tokenId + 1)`.\n _packedOwnerships[nextTokenId] = prevOwnershipPacked;\n }\n }\n }\n }\n\n emit Transfer(from, address(0), tokenId);\n _afterTokenTransfers(from, address(0), tokenId, 1);\n\n // Overflow not possible, as _burnCounter cannot be exceed _currentIndex times.\n unchecked {\n _burnCounter++;\n }\n }\n\n // =============================================================\n // EXTRA DATA OPERATIONS\n // =============================================================\n\n /**\n * @dev Directly sets the extra data for the ownership data `index`.\n */\n function _setExtraDataAt(uint256 index, uint24 extraData) internal virtual {\n uint256 packed = _packedOwnerships[index];\n if (packed == 0) revert OwnershipNotInitializedForExtraData();\n uint256 extraDataCasted;\n // Cast `extraData` with assembly to avoid redundant masking.\n assembly {\n extraDataCasted := extraData\n }\n packed = (packed & _BITMASK_EXTRA_DATA_COMPLEMENT) | (extraDataCasted << _BITPOS_EXTRA_DATA);\n _packedOwnerships[index] = packed;\n }\n\n /**\n * @dev Called during each token transfer to set the 24bit `extraData` field.\n * Intended to be overridden by the cosumer contract.\n *\n * `previousExtraData` - the value of `extraData` before transfer.\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, `tokenId` will be burned by `from`.\n * - `from` and `to` are never both zero.\n */\n function _extraData(\n address from,\n address to,\n uint24 previousExtraData\n ) internal view virtual returns (uint24) {}\n\n /**\n * @dev Returns the next extra data for the packed ownership data.\n * The returned result is shifted into position.\n */\n function _nextExtraData(\n address from,\n address to,\n uint256 prevOwnershipPacked\n ) private view returns (uint256) {\n uint24 extraData = uint24(prevOwnershipPacked >> _BITPOS_EXTRA_DATA);\n return uint256(_extraData(from, to, extraData)) << _BITPOS_EXTRA_DATA;\n }\n\n // =============================================================\n // OTHER OPERATIONS\n // =============================================================\n\n /**\n * @dev Returns the message sender (defaults to `msg.sender`).\n *\n * If you are writing GSN compatible contracts, you need to override this function.\n */\n function _msgSenderERC721A() internal view virtual returns (address) {\n return msg.sender;\n }\n\n /**\n * @dev Converts a uint256 to its ASCII string decimal representation.\n */\n function _toString(uint256 value) internal pure virtual returns (string memory str) {\n assembly {\n // The maximum value of a uint256 contains 78 digits (1 byte per digit), but\n // we allocate 0xa0 bytes to keep the free memory pointer 32-byte word aligned.\n // We will need 1 word for the trailing zeros padding, 1 word for the length,\n // and 3 words for a maximum of 78 digits. Total: 5 * 0x20 = 0xa0.\n let m := add(mload(0x40), 0xa0)\n // Update the free memory pointer to allocate.\n mstore(0x40, m)\n // Assign the `str` to the end.\n str := sub(m, 0x20)\n // Zeroize the slot after the string.\n mstore(str, 0)\n\n // Cache the end of the memory to calculate the length later.\n let end := str\n\n // We write the string from rightmost digit to leftmost digit.\n // The following is essentially a do-while loop that also handles the zero case.\n // prettier-ignore\n for { let temp := value } 1 {} {\n str := sub(str, 1)\n // Write the character to the pointer.\n // The ASCII index of the '0' character is 48.\n mstore8(str, add(48, mod(temp, 10)))\n // Keep dividing `temp` until zero.\n temp := div(temp, 10)\n // prettier-ignore\n if iszero(temp) { break }\n }\n\n let length := sub(end, str)\n // Move the pointer 32 bytes leftwards to make room for the length.\n str := sub(str, 0x20)\n // Store the length.\n mstore(str, length)\n }\n }\n}\n" + '// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (proxy/ERC1967/ERC1967Upgrade.sol)\n\npragma solidity ^0.8.2;\n\nimport "../beacon/IBeacon.sol";\nimport "../../interfaces/IERC1967.sol";\nimport "../../interfaces/draft-IERC1822.sol";\nimport "../../utils/Address.sol";\nimport "../../utils/StorageSlot.sol";\n\n/**\n * @dev This abstract contract provides getters and event emitting update functions for\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots.\n *\n * _Available since v4.1._\n */\nabstract contract ERC1967Upgrade is IERC1967 {\n // This is the keccak-256 hash of "eip1967.proxy.rollback" subtracted by 1\n bytes32 private constant _ROLLBACK_SLOT = 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143;\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 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\n\n /**\n * @dev Returns the current implementation address.\n */\n function _getImplementation() internal view returns (address) {\n return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\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), "ERC1967: new implementation is not a contract");\n StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\n }\n\n /**\n * @dev Perform implementation upgrade\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 Perform implementation upgrade with additional setup call.\n *\n * Emits an {Upgraded} event.\n */\n function _upgradeToAndCall(address newImplementation, bytes memory data, bool forceCall) internal {\n _upgradeTo(newImplementation);\n if (data.length > 0 || forceCall) {\n Address.functionDelegateCall(newImplementation, data);\n }\n }\n\n /**\n * @dev Perform implementation upgrade with security checks for UUPS proxies, and additional setup call.\n *\n * Emits an {Upgraded} event.\n */\n function _upgradeToAndCallUUPS(address newImplementation, bytes memory data, bool forceCall) internal {\n // Upgrades from old implementations will perform a rollback test. This test requires the new\n // implementation to upgrade back to the old, non-ERC1822 compliant, implementation. Removing\n // this special case will break upgrade paths from old UUPS implementation to new ones.\n if (StorageSlot.getBooleanSlot(_ROLLBACK_SLOT).value) {\n _setImplementation(newImplementation);\n } else {\n try IERC1822Proxiable(newImplementation).proxiableUUID() returns (bytes32 slot) {\n require(slot == _IMPLEMENTATION_SLOT, "ERC1967Upgrade: unsupported proxiableUUID");\n } catch {\n revert("ERC1967Upgrade: new implementation is not UUPS");\n }\n _upgradeToAndCall(newImplementation, data, forceCall);\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 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\n\n /**\n * @dev Returns the current admin.\n */\n function _getAdmin() internal view returns (address) {\n return StorageSlot.getAddressSlot(_ADMIN_SLOT).value;\n }\n\n /**\n * @dev Stores a new address in the EIP1967 admin slot.\n */\n function _setAdmin(address newAdmin) private {\n require(newAdmin != address(0), "ERC1967: new admin is the zero address");\n StorageSlot.getAddressSlot(_ADMIN_SLOT).value = newAdmin;\n }\n\n /**\n * @dev Changes the admin of the proxy.\n *\n * Emits an {AdminChanged} event.\n */\n function _changeAdmin(address newAdmin) internal {\n emit AdminChanged(_getAdmin(), newAdmin);\n _setAdmin(newAdmin);\n }\n\n /**\n * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy.\n * This is bytes32(uint256(keccak256(\'eip1967.proxy.beacon\')) - 1)) and is validated in the constructor.\n */\n bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50;\n\n /**\n * @dev Returns the current beacon.\n */\n function _getBeacon() internal view returns (address) {\n return StorageSlot.getAddressSlot(_BEACON_SLOT).value;\n }\n\n /**\n * @dev Stores a new beacon in the EIP1967 beacon slot.\n */\n function _setBeacon(address newBeacon) private {\n require(Address.isContract(newBeacon), "ERC1967: new beacon is not a contract");\n require(\n Address.isContract(IBeacon(newBeacon).implementation()),\n "ERC1967: beacon implementation is not a contract"\n );\n StorageSlot.getAddressSlot(_BEACON_SLOT).value = newBeacon;\n }\n\n /**\n * @dev Perform beacon upgrade with additional setup call. Note: This upgrades the address of the beacon, it does\n * not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that).\n *\n * Emits a {BeaconUpgraded} event.\n */\n function _upgradeBeaconToAndCall(address newBeacon, bytes memory data, bool forceCall) internal {\n _setBeacon(newBeacon);\n emit BeaconUpgraded(newBeacon);\n if (data.length > 0 || forceCall) {\n Address.functionDelegateCall(IBeacon(newBeacon).implementation(), data);\n }\n }\n}\n' }, - 'node_modules/erc721a/contracts/IERC721A.sol': { + 'lib/openzeppelin/contracts/proxy/Proxy.sol': { content: - "// SPDX-License-Identifier: MIT\n// ERC721A Contracts v4.2.3\n// Creator: Chiru Labs\n\npragma solidity ^0.8.4;\n\n/**\n * @dev Interface of ERC721A.\n */\ninterface IERC721A {\n /**\n * The caller must own the token or be an approved operator.\n */\n error ApprovalCallerNotOwnerNorApproved();\n\n /**\n * The token does not exist.\n */\n error ApprovalQueryForNonexistentToken();\n\n /**\n * Cannot query the balance for the zero address.\n */\n error BalanceQueryForZeroAddress();\n\n /**\n * Cannot mint to the zero address.\n */\n error MintToZeroAddress();\n\n /**\n * The quantity of tokens minted must be more than zero.\n */\n error MintZeroQuantity();\n\n /**\n * The token does not exist.\n */\n error OwnerQueryForNonexistentToken();\n\n /**\n * The caller must own the token or be an approved operator.\n */\n error TransferCallerNotOwnerNorApproved();\n\n /**\n * The token must be owned by `from`.\n */\n error TransferFromIncorrectOwner();\n\n /**\n * Cannot safely transfer to a contract that does not implement the\n * ERC721Receiver interface.\n */\n error TransferToNonERC721ReceiverImplementer();\n\n /**\n * Cannot transfer to the zero address.\n */\n error TransferToZeroAddress();\n\n /**\n * The token does not exist.\n */\n error URIQueryForNonexistentToken();\n\n /**\n * The `quantity` minted with ERC2309 exceeds the safety limit.\n */\n error MintERC2309QuantityExceedsLimit();\n\n /**\n * The `extraData` cannot be set on an unintialized ownership slot.\n */\n error OwnershipNotInitializedForExtraData();\n\n // =============================================================\n // STRUCTS\n // =============================================================\n\n struct TokenOwnership {\n // The address of the owner.\n address addr;\n // Stores the start time of ownership with minimal overhead for tokenomics.\n uint64 startTimestamp;\n // Whether the token has been burned.\n bool burned;\n // Arbitrary data similar to `startTimestamp` that can be set via {_extraData}.\n uint24 extraData;\n }\n\n // =============================================================\n // TOKEN COUNTERS\n // =============================================================\n\n /**\n * @dev Returns the total number of tokens in existence.\n * Burned tokens will reduce the count.\n * To get the total number of tokens minted, please see {_totalMinted}.\n */\n function totalSupply() external view returns (uint256);\n\n // =============================================================\n // IERC165\n // =============================================================\n\n /**\n * @dev Returns true if this contract implements the interface defined by\n * `interfaceId`. See the corresponding\n * [EIP section](https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified)\n * to learn more about how these ids are created.\n *\n * This function call must use less than 30000 gas.\n */\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\n\n // =============================================================\n // IERC721\n // =============================================================\n\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\n * (`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 * checking first that contract recipients are aware of the ERC721 protocol\n * 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\n * this token by either {approve} or {setApprovalForAll}.\n * - If `to` refers to a smart contract, it must implement\n * {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 payable;\n\n /**\n * @dev Equivalent to `safeTransferFrom(from, to, tokenId, '')`.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId\n ) external payable;\n\n /**\n * @dev Transfers `tokenId` from `from` to `to`.\n *\n * WARNING: Usage of this method is discouraged, use {safeTransferFrom}\n * 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\n * 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 payable;\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\n * 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 payable;\n\n /**\n * @dev Approve or remove `operator` as an operator for the caller.\n * Operators can call {transferFrom} or {safeTransferFrom}\n * 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 // =============================================================\n // IERC721Metadata\n // =============================================================\n\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 // =============================================================\n // IERC2309\n // =============================================================\n\n /**\n * @dev Emitted when tokens in `fromTokenId` to `toTokenId`\n * (inclusive) is transferred from `from` to `to`, as defined in the\n * [ERC2309](https://eips.ethereum.org/EIPS/eip-2309) standard.\n *\n * See {_mintERC2309} for more details.\n */\n event ConsecutiveTransfer(uint256 indexed fromTokenId, uint256 toTokenId, address indexed from, address indexed to);\n}\n" + "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (proxy/Proxy.sol)\n\npragma solidity ^0.8.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 internal call site, it will return directly to the external caller.\n */\n function _delegate(address implementation) internal virtual {\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 {\n revert(0, returndatasize())\n }\n default {\n return(0, returndatasize())\n }\n }\n }\n\n /**\n * @dev This is a virtual function that should be overridden so it returns the address to which the fallback function\n * and {_fallback} should delegate.\n */\n function _implementation() internal view virtual 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 internal call site, it will return directly to the external caller.\n */\n function _fallback() internal virtual {\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() external payable virtual {\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() external payable virtual {\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 overridden should call `super._beforeFallback()`.\n */\n function _beforeFallback() internal virtual {}\n}\n" }, - 'node_modules/erc721a/contracts/extensions/ERC721AQueryable.sol': { + 'src/proxies/openzeppelin/ERC1967Proxy.sol': { content: - "// SPDX-License-Identifier: MIT\n// ERC721A Contracts v4.2.3\n// Creator: Chiru Labs\n\npragma solidity ^0.8.4;\n\nimport './IERC721AQueryable.sol';\nimport '../ERC721A.sol';\n\n/**\n * @title ERC721AQueryable.\n *\n * @dev ERC721A subclass with convenience query functions.\n */\nabstract contract ERC721AQueryable is ERC721A, IERC721AQueryable {\n /**\n * @dev Returns the `TokenOwnership` struct at `tokenId` without reverting.\n *\n * If the `tokenId` is out of bounds:\n *\n * - `addr = address(0)`\n * - `startTimestamp = 0`\n * - `burned = false`\n * - `extraData = 0`\n *\n * If the `tokenId` is burned:\n *\n * - `addr =
`\n * - `startTimestamp = `\n * - `burned = true`\n * - `extraData = `\n *\n * Otherwise:\n *\n * - `addr =
`\n * - `startTimestamp = `\n * - `burned = false`\n * - `extraData = `\n */\n function explicitOwnershipOf(uint256 tokenId) public view virtual override returns (TokenOwnership memory) {\n TokenOwnership memory ownership;\n if (tokenId < _startTokenId() || tokenId >= _nextTokenId()) {\n return ownership;\n }\n ownership = _ownershipAt(tokenId);\n if (ownership.burned) {\n return ownership;\n }\n return _ownershipOf(tokenId);\n }\n\n /**\n * @dev Returns an array of `TokenOwnership` structs at `tokenIds` in order.\n * See {ERC721AQueryable-explicitOwnershipOf}\n */\n function explicitOwnershipsOf(uint256[] calldata tokenIds)\n external\n view\n virtual\n override\n returns (TokenOwnership[] memory)\n {\n unchecked {\n uint256 tokenIdsLength = tokenIds.length;\n TokenOwnership[] memory ownerships = new TokenOwnership[](tokenIdsLength);\n for (uint256 i; i != tokenIdsLength; ++i) {\n ownerships[i] = explicitOwnershipOf(tokenIds[i]);\n }\n return ownerships;\n }\n }\n\n /**\n * @dev Returns an array of token IDs owned by `owner`,\n * in the range [`start`, `stop`)\n * (i.e. `start <= tokenId < stop`).\n *\n * This function allows for tokens to be queried if the collection\n * grows too big for a single call of {ERC721AQueryable-tokensOfOwner}.\n *\n * Requirements:\n *\n * - `start < stop`\n */\n function tokensOfOwnerIn(\n address owner,\n uint256 start,\n uint256 stop\n ) external view virtual override returns (uint256[] memory) {\n unchecked {\n if (start >= stop) revert InvalidQueryRange();\n uint256 tokenIdsIdx;\n uint256 stopLimit = _nextTokenId();\n // Set `start = max(start, _startTokenId())`.\n if (start < _startTokenId()) {\n start = _startTokenId();\n }\n // Set `stop = min(stop, stopLimit)`.\n if (stop > stopLimit) {\n stop = stopLimit;\n }\n uint256 tokenIdsMaxLength = balanceOf(owner);\n // Set `tokenIdsMaxLength = min(balanceOf(owner), stop - start)`,\n // to cater for cases where `balanceOf(owner)` is too big.\n if (start < stop) {\n uint256 rangeLength = stop - start;\n if (rangeLength < tokenIdsMaxLength) {\n tokenIdsMaxLength = rangeLength;\n }\n } else {\n tokenIdsMaxLength = 0;\n }\n uint256[] memory tokenIds = new uint256[](tokenIdsMaxLength);\n if (tokenIdsMaxLength == 0) {\n return tokenIds;\n }\n // We need to call `explicitOwnershipOf(start)`,\n // because the slot at `start` may not be initialized.\n TokenOwnership memory ownership = explicitOwnershipOf(start);\n address currOwnershipAddr;\n // If the starting slot exists (i.e. not burned), initialize `currOwnershipAddr`.\n // `ownership.address` will not be zero, as `start` is clamped to the valid token ID range.\n if (!ownership.burned) {\n currOwnershipAddr = ownership.addr;\n }\n for (uint256 i = start; i != stop && tokenIdsIdx != tokenIdsMaxLength; ++i) {\n ownership = _ownershipAt(i);\n if (ownership.burned) {\n continue;\n }\n if (ownership.addr != address(0)) {\n currOwnershipAddr = ownership.addr;\n }\n if (currOwnershipAddr == owner) {\n tokenIds[tokenIdsIdx++] = i;\n }\n }\n // Downsize the array to fit.\n assembly {\n mstore(tokenIds, tokenIdsIdx)\n }\n return tokenIds;\n }\n }\n\n /**\n * @dev Returns an array of token IDs owned by `owner`.\n *\n * This function scans the ownership mapping and is O(`totalSupply`) in complexity.\n * It is meant to be called off-chain.\n *\n * See {ERC721AQueryable-tokensOfOwnerIn} for splitting the scan into\n * multiple smaller scans if the collection is large enough to cause\n * an out-of-gas error (10K collections should be fine).\n */\n function tokensOfOwner(address owner) external view virtual override returns (uint256[] memory) {\n unchecked {\n uint256 tokenIdsIdx;\n address currOwnershipAddr;\n uint256 tokenIdsLength = balanceOf(owner);\n uint256[] memory tokenIds = new uint256[](tokenIdsLength);\n TokenOwnership memory ownership;\n for (uint256 i = _startTokenId(); tokenIdsIdx != tokenIdsLength; ++i) {\n ownership = _ownershipAt(i);\n if (ownership.burned) {\n continue;\n }\n if (ownership.addr != address(0)) {\n currOwnershipAddr = ownership.addr;\n }\n if (currOwnershipAddr == owner) {\n tokenIds[tokenIdsIdx++] = i;\n }\n }\n return tokenIds;\n }\n }\n}\n" + '// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/ERC1967/ERC1967Proxy.sol)\n\n// Note: This implementation is an exact copy with the constructor removed, and pragma and imports updated.\n\npragma solidity ^0.8.19;\n\nimport "@openzeppelin/contracts/proxy/ERC1967/ERC1967Upgrade.sol";\nimport "@openzeppelin/contracts/proxy/Proxy.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 */\ncontract ERC1967Proxy is Proxy, ERC1967Upgrade {\n\n /**\n * @dev Returns the current implementation address.\n */\n function _implementation() internal view virtual override returns (address impl) {\n return ERC1967Upgrade._getImplementation();\n }\n\n}\n' }, - 'node_modules/erc721a/contracts/extensions/IERC721AQueryable.sol': { + 'lib/openzeppelin/contracts/access/IAccessControlEnumerable.sol': { content: - "// SPDX-License-Identifier: MIT\n// ERC721A Contracts v4.2.3\n// Creator: Chiru Labs\n\npragma solidity ^0.8.4;\n\nimport '../IERC721A.sol';\n\n/**\n * @dev Interface of ERC721AQueryable.\n */\ninterface IERC721AQueryable is IERC721A {\n /**\n * Invalid query range (`start` >= `stop`).\n */\n error InvalidQueryRange();\n\n /**\n * @dev Returns the `TokenOwnership` struct at `tokenId` without reverting.\n *\n * If the `tokenId` is out of bounds:\n *\n * - `addr = address(0)`\n * - `startTimestamp = 0`\n * - `burned = false`\n * - `extraData = 0`\n *\n * If the `tokenId` is burned:\n *\n * - `addr =
`\n * - `startTimestamp = `\n * - `burned = true`\n * - `extraData = `\n *\n * Otherwise:\n *\n * - `addr =
`\n * - `startTimestamp = `\n * - `burned = false`\n * - `extraData = `\n */\n function explicitOwnershipOf(uint256 tokenId) external view returns (TokenOwnership memory);\n\n /**\n * @dev Returns an array of `TokenOwnership` structs at `tokenIds` in order.\n * See {ERC721AQueryable-explicitOwnershipOf}\n */\n function explicitOwnershipsOf(uint256[] memory tokenIds) external view returns (TokenOwnership[] memory);\n\n /**\n * @dev Returns an array of token IDs owned by `owner`,\n * in the range [`start`, `stop`)\n * (i.e. `start <= tokenId < stop`).\n *\n * This function allows for tokens to be queried if the collection\n * grows too big for a single call of {ERC721AQueryable-tokensOfOwner}.\n *\n * Requirements:\n *\n * - `start < stop`\n */\n function tokensOfOwnerIn(\n address owner,\n uint256 start,\n uint256 stop\n ) external view returns (uint256[] memory);\n\n /**\n * @dev Returns an array of token IDs owned by `owner`.\n *\n * This function scans the ownership mapping and is O(`totalSupply`) in complexity.\n * It is meant to be called off-chain.\n *\n * See {ERC721AQueryable-tokensOfOwnerIn} for splitting the scan into\n * multiple smaller scans if the collection is large enough to cause\n * an out-of-gas error (10K collections should be fine).\n */\n function tokensOfOwner(address owner) external view returns (uint256[] memory);\n}\n" + '// 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' }, - 'src/proxies/SequenceProxyFactory.sol': { + 'lib/openzeppelin/contracts/access/AccessControl.sol': { content: - '// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8.19;\n\nimport {\n TransparentUpgradeableBeaconProxy,\n ITransparentUpgradeableBeaconProxy\n} from "./TransparentUpgradeableBeaconProxy.sol";\n\nimport {Create2} from "@openzeppelin/contracts/utils/Create2.sol";\nimport {Ownable} from "@openzeppelin/contracts/access/Ownable.sol";\nimport {UpgradeableBeacon} from "@openzeppelin/contracts/proxy/beacon/UpgradeableBeacon.sol";\n\n/**\n * An proxy factory that deploys upgradeable beacon proxies.\n * @dev The factory owner is able to upgrade the beacon implementation.\n * @dev Proxy deployers are able to override the beacon reference with their own.\n */\nabstract contract SequenceProxyFactory is Ownable {\n UpgradeableBeacon public beacon;\n\n /**\n * Initialize a Sequence Proxy Factory.\n * @param implementation The initial beacon implementation.\n * @param factoryOwner The owner of the factory.\n */\n function _initialize(address implementation, address factoryOwner) internal {\n beacon = new UpgradeableBeacon(implementation);\n Ownable._transferOwnership(factoryOwner);\n }\n\n /**\n * Deploys and initializes a new proxy instance.\n * @param _salt The deployment salt.\n * @param _proxyOwner The owner of the proxy.\n * @param _data The initialization data.\n * @return proxyAddress The address of the deployed proxy.\n */\n function _createProxy(bytes32 _salt, address _proxyOwner, bytes memory _data)\n internal\n returns (address proxyAddress)\n {\n bytes32 saltedHash = keccak256(abi.encodePacked(_salt, _proxyOwner, address(beacon), _data));\n bytes memory bytecode = type(TransparentUpgradeableBeaconProxy).creationCode;\n\n proxyAddress = Create2.deploy(0, saltedHash, bytecode);\n ITransparentUpgradeableBeaconProxy(payable(proxyAddress)).initialize(_proxyOwner, address(beacon), _data);\n }\n\n /**\n * Computes the address of a proxy instance.\n * @param _salt The deployment salt.\n * @param _proxyOwner The owner of the proxy.\n * @return proxy The expected address of the deployed proxy.\n */\n function _computeProxyAddress(bytes32 _salt, address _proxyOwner, bytes memory _data)\n internal\n view\n returns (address)\n {\n bytes32 saltedHash = keccak256(abi.encodePacked(_salt, _proxyOwner, address(beacon), _data));\n bytes32 bytecodeHash = keccak256(type(TransparentUpgradeableBeaconProxy).creationCode);\n\n return Create2.computeAddress(saltedHash, bytecodeHash);\n }\n\n /**\n * Upgrades the beacon implementation.\n * @param implementation The new beacon implementation.\n */\n function upgradeBeacon(address implementation) public onlyOwner {\n beacon.upgradeTo(implementation);\n }\n}\n' + '// 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' }, - 'src/proxies/TransparentUpgradeableBeaconProxy.sol': { + 'lib/openzeppelin/contracts/utils/structs/EnumerableSet.sol': { content: - '// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8.19;\n\nimport {BeaconProxy, Proxy} from "./openzeppelin/BeaconProxy.sol";\nimport {TransparentUpgradeableProxy, ERC1967Proxy} from "./openzeppelin/TransparentUpgradeableProxy.sol";\n\ninterface ITransparentUpgradeableBeaconProxy {\n function initialize(address admin, address beacon, bytes memory data) external;\n}\n\nerror InvalidInitialization();\n\n/**\n * @dev As the underlying proxy implementation (TransparentUpgradeableProxy) allows the admin to call the implementation,\n * care must be taken to avoid proxy selector collisions. Implementation selectors must not conflict with the proxy selectors.\n * See https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector clashing].\n * The proxy selectors are:\n * - 0xcf7a1d77: initialize\n * - 0x3659cfe6: upgradeTo (from TransparentUpgradeableProxy)\n * - 0x4f1ef286: upgradeToAndCall (from TransparentUpgradeableProxy)\n * - 0x8f283970: changeAdmin (from TransparentUpgradeableProxy)\n * - 0xf851a440: admin (from TransparentUpgradeableProxy)\n * - 0x5c60da1b: implementation (from TransparentUpgradeableProxy)\n */\ncontract TransparentUpgradeableBeaconProxy is TransparentUpgradeableProxy, BeaconProxy {\n /**\n * Decode the initialization data from the msg.data and call the initialize function.\n */\n function _dispatchInitialize() private returns (bytes memory) {\n _requireZeroValue();\n\n (address admin, address beacon, bytes memory data) = abi.decode(msg.data[4:], (address, address, bytes));\n initialize(admin, beacon, data);\n\n return "";\n }\n\n function initialize(address admin, address beacon, bytes memory data) internal {\n if (_admin() != address(0)) {\n // Redundant call. This function can only be called when the admin is not set.\n revert InvalidInitialization();\n }\n _changeAdmin(admin);\n _upgradeBeaconToAndCall(beacon, data, false);\n }\n\n /**\n * @dev If the admin is not set, the fallback function is used to initialize the proxy.\n * @dev If the admin is set, the fallback function is used to delegatecall the implementation.\n */\n function _fallback() internal override (TransparentUpgradeableProxy, Proxy) {\n if (_getAdmin() == address(0)) {\n bytes memory ret;\n bytes4 selector = msg.sig;\n if (selector == ITransparentUpgradeableBeaconProxy.initialize.selector) {\n ret = _dispatchInitialize();\n // solhint-disable-next-line no-inline-assembly\n assembly {\n return(add(ret, 0x20), mload(ret))\n }\n }\n // When the admin is not set, the fallback function is used to initialize the proxy.\n revert InvalidInitialization();\n }\n TransparentUpgradeableProxy._fallback();\n }\n\n /**\n * Returns the current implementation address.\n * @dev This is the implementation address set by the admin, or the beacon implementation.\n */\n function _implementation() internal view override (ERC1967Proxy, BeaconProxy) returns (address) {\n address implementation = ERC1967Proxy._implementation();\n if (implementation != address(0)) {\n return implementation;\n }\n return BeaconProxy._implementation();\n }\n}\n' + "// 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" }, - 'src/proxies/openzeppelin/BeaconProxy.sol': { + 'lib/openzeppelin/contracts/token/ERC20/IERC20.sol': { content: - '// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/beacon/BeaconProxy.sol)\n\n// Note: This implementation is an exact copy with the constructor removed, and pragma and imports updated.\n\npragma solidity ^0.8.19;\n\nimport "@openzeppelin/contracts/proxy/beacon/IBeacon.sol";\nimport "@openzeppelin/contracts/proxy/Proxy.sol";\nimport "@openzeppelin/contracts/proxy/ERC1967/ERC1967Upgrade.sol";\n\n/**\n * @dev This contract implements a proxy that gets the implementation address for each call from an {UpgradeableBeacon}.\n *\n * The beacon address is stored in storage slot `uint256(keccak256(\'eip1967.proxy.beacon\')) - 1`, so that it doesn\'t\n * conflict with the storage layout of the implementation behind the proxy.\n *\n * _Available since v3.4._\n */\ncontract BeaconProxy is Proxy, ERC1967Upgrade {\n /**\n * @dev Returns the current beacon address.\n */\n function _beacon() internal view virtual returns (address) {\n return _getBeacon();\n }\n\n /**\n * @dev Returns the current implementation address of the associated beacon.\n */\n function _implementation() internal view virtual override returns (address) {\n return IBeacon(_getBeacon()).implementation();\n }\n\n /**\n * @dev Changes the proxy to use a new beacon. Deprecated: see {_upgradeBeaconToAndCall}.\n *\n * If `data` is nonempty, it\'s used as data in a delegate call to the implementation returned by the beacon.\n *\n * Requirements:\n *\n * - `beacon` must be a contract.\n * - The implementation returned by `beacon` must be a contract.\n */\n function _setBeacon(address beacon, bytes memory data) internal virtual {\n _upgradeBeaconToAndCall(beacon, data, false);\n }\n}\n' + "// 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" }, - 'src/proxies/openzeppelin/ERC1967Proxy.sol': { + 'lib/openzeppelin/contracts/token/ERC20/extensions/IERC20Permit.sol': { content: - '// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/ERC1967/ERC1967Proxy.sol)\n\n// Note: This implementation is an exact copy with the constructor removed, and pragma and imports updated.\n\npragma solidity ^0.8.19;\n\nimport "@openzeppelin/contracts/proxy/Proxy.sol";\nimport "@openzeppelin/contracts/proxy/ERC1967/ERC1967Upgrade.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 */\ncontract ERC1967Proxy is Proxy, ERC1967Upgrade {\n /**\n * @dev Returns the current implementation address.\n */\n function _implementation() internal view virtual override returns (address impl) {\n return ERC1967Upgrade._getImplementation();\n }\n}\n' + "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/extensions/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" }, - 'src/proxies/openzeppelin/TransparentUpgradeableProxy.sol': { + 'lib/chiru-labs/erc721a/contracts/IERC721A.sol': { content: - '// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (proxy/transparent/TransparentUpgradeableProxy.sol)\n\n/// @notice This implementation is a copy of OpenZeppelin\'s with the following changes:\n/// - Pragma updated\n/// - Imports updated\n/// - Constructor removed\n/// - Allows admin to call implementation\n\npragma solidity ^0.8.19;\n\nimport "./ERC1967Proxy.sol";\n\n/**\n * @dev Interface for {TransparentUpgradeableProxy}. In order to implement transparency, {TransparentUpgradeableProxy}\n * does not implement this interface directly, and some of its functions are implemented by an internal dispatch\n * mechanism. The compiler is unaware that these functions are implemented by {TransparentUpgradeableProxy} and will not\n * include them in the ABI so this interface must be used to interact with it.\n */\ninterface ITransparentUpgradeableProxy is IERC1967 {\n function admin() external view returns (address);\n\n function implementation() external view returns (address);\n\n function changeAdmin(address) external;\n\n function upgradeTo(address) external;\n\n function upgradeToAndCall(address, bytes memory) external payable;\n}\n\n/**\n * @dev This contract implements a proxy that is upgradeable by an admin.\n *\n * Unlike the original OpenZeppelin implementation, this contract does not prevent the admin from calling the implementation.\n * This potentially exposes the admin to a proxy selector attack. See\n * https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector clashing].\n * When using this contract, you must ensure that the implementation function selectors do not clash with the proxy selectors.\n * The proxy selectors are:\n * - 0x3659cfe6: upgradeTo\n * - 0x4f1ef286: upgradeToAndCall\n * - 0x8f283970: changeAdmin\n * - 0xf851a440: admin\n * - 0x5c60da1b: implementation\n *\n * NOTE: The real interface of this proxy is that defined in `ITransparentUpgradeableProxy`. This contract does not\n * inherit from that interface, and instead the admin functions are implicitly implemented using a custom dispatch\n * mechanism in `_fallback`. Consequently, the compiler will not produce an ABI for this contract. This is necessary to\n * fully implement transparency without decoding reverts caused by selector clashes between the proxy and the\n * implementation.\n *\n * WARNING: It is not recommended to extend this contract to add additional external functions. If you do so, the compiler\n * will not check that there are no selector conflicts, due to the note above. A selector clash between any new function\n * and the functions declared in {ITransparentUpgradeableProxy} will be resolved in favor of the new one. This could\n * render the admin operations inaccessible, which could prevent upgradeability. Transparency may also be compromised.\n */\ncontract TransparentUpgradeableProxy is ERC1967Proxy {\n /**\n * @dev Modifier used internally that will delegate the call to the implementation unless the sender is the admin.\n *\n * CAUTION: This modifier is deprecated, as it could cause issues if the modified function has arguments, and the\n * implementation provides a function with the same selector.\n */\n modifier ifAdmin() {\n if (msg.sender == _getAdmin()) {\n _;\n } else {\n _fallback();\n }\n }\n\n /**\n * @dev If caller is the admin process the call internally, otherwise transparently fallback to the proxy behavior\n */\n function _fallback() internal virtual override {\n if (msg.sender == _getAdmin()) {\n bytes memory ret;\n bytes4 selector = msg.sig;\n if (selector == ITransparentUpgradeableProxy.upgradeTo.selector) {\n ret = _dispatchUpgradeTo();\n } else if (selector == ITransparentUpgradeableProxy.upgradeToAndCall.selector) {\n ret = _dispatchUpgradeToAndCall();\n } else if (selector == ITransparentUpgradeableProxy.changeAdmin.selector) {\n ret = _dispatchChangeAdmin();\n } else if (selector == ITransparentUpgradeableProxy.admin.selector) {\n ret = _dispatchAdmin();\n } else if (selector == ITransparentUpgradeableProxy.implementation.selector) {\n ret = _dispatchImplementation();\n } else {\n // Call implementation\n return super._fallback();\n }\n assembly {\n return(add(ret, 0x20), mload(ret))\n }\n } else {\n super._fallback();\n }\n }\n\n /**\n * @dev Returns the current admin.\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 _dispatchAdmin() private returns (bytes memory) {\n _requireZeroValue();\n\n address admin = _getAdmin();\n return abi.encode(admin);\n }\n\n /**\n * @dev Returns the current implementation.\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 _dispatchImplementation() private returns (bytes memory) {\n _requireZeroValue();\n\n address implementation = _implementation();\n return abi.encode(implementation);\n }\n\n /**\n * @dev Changes the admin of the proxy.\n *\n * Emits an {AdminChanged} event.\n */\n function _dispatchChangeAdmin() private returns (bytes memory) {\n _requireZeroValue();\n\n address newAdmin = abi.decode(msg.data[4:], (address));\n _changeAdmin(newAdmin);\n\n return "";\n }\n\n /**\n * @dev Upgrade the implementation of the proxy.\n */\n function _dispatchUpgradeTo() private returns (bytes memory) {\n _requireZeroValue();\n\n address newImplementation = abi.decode(msg.data[4:], (address));\n _upgradeToAndCall(newImplementation, bytes(""), false);\n\n return "";\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 function _dispatchUpgradeToAndCall() private returns (bytes memory) {\n (address newImplementation, bytes memory data) = abi.decode(msg.data[4:], (address, bytes));\n _upgradeToAndCall(newImplementation, data, true);\n\n return "";\n }\n\n /**\n * @dev Returns the current admin.\n *\n * CAUTION: This function is deprecated. Use {ERC1967Upgrade-_getAdmin} instead.\n */\n function _admin() internal view virtual returns (address) {\n return _getAdmin();\n }\n\n /**\n * @dev To keep this contract fully transparent, all `ifAdmin` functions must be payable. This helper is here to\n * emulate some proxy functions being non-payable while still allowing value to pass through.\n */\n function _requireZeroValue() internal {\n require(msg.value == 0);\n }\n}\n' + "// SPDX-License-Identifier: MIT\n// ERC721A Contracts v4.3.0\n// Creator: Chiru Labs\n\npragma solidity ^0.8.4;\n\n/**\n * @dev Interface of ERC721A.\n */\ninterface IERC721A {\n /**\n * The caller must own the token or be an approved operator.\n */\n error ApprovalCallerNotOwnerNorApproved();\n\n /**\n * The token does not exist.\n */\n error ApprovalQueryForNonexistentToken();\n\n /**\n * Cannot query the balance for the zero address.\n */\n error BalanceQueryForZeroAddress();\n\n /**\n * Cannot mint to the zero address.\n */\n error MintToZeroAddress();\n\n /**\n * The quantity of tokens minted must be more than zero.\n */\n error MintZeroQuantity();\n\n /**\n * The token does not exist.\n */\n error OwnerQueryForNonexistentToken();\n\n /**\n * The caller must own the token or be an approved operator.\n */\n error TransferCallerNotOwnerNorApproved();\n\n /**\n * The token must be owned by `from`.\n */\n error TransferFromIncorrectOwner();\n\n /**\n * Cannot safely transfer to a contract that does not implement the\n * ERC721Receiver interface.\n */\n error TransferToNonERC721ReceiverImplementer();\n\n /**\n * Cannot transfer to the zero address.\n */\n error TransferToZeroAddress();\n\n /**\n * The token does not exist.\n */\n error URIQueryForNonexistentToken();\n\n /**\n * The `quantity` minted with ERC2309 exceeds the safety limit.\n */\n error MintERC2309QuantityExceedsLimit();\n\n /**\n * The `extraData` cannot be set on an unintialized ownership slot.\n */\n error OwnershipNotInitializedForExtraData();\n\n /**\n * `_sequentialUpTo()` must be greater than `_startTokenId()`.\n */\n error SequentialUpToTooSmall();\n\n /**\n * The `tokenId` of a sequential mint exceeds `_sequentialUpTo()`.\n */\n error SequentialMintExceedsLimit();\n\n /**\n * Spot minting requires a `tokenId` greater than `_sequentialUpTo()`.\n */\n error SpotMintTokenIdTooSmall();\n\n /**\n * Cannot mint over a token that already exists.\n */\n error TokenAlreadyExists();\n\n /**\n * The feature is not compatible with spot mints.\n */\n error NotCompatibleWithSpotMints();\n\n // =============================================================\n // STRUCTS\n // =============================================================\n\n struct TokenOwnership {\n // The address of the owner.\n address addr;\n // Stores the start time of ownership with minimal overhead for tokenomics.\n uint64 startTimestamp;\n // Whether the token has been burned.\n bool burned;\n // Arbitrary data similar to `startTimestamp` that can be set via {_extraData}.\n uint24 extraData;\n }\n\n // =============================================================\n // TOKEN COUNTERS\n // =============================================================\n\n /**\n * @dev Returns the total number of tokens in existence.\n * Burned tokens will reduce the count.\n * To get the total number of tokens minted, please see {_totalMinted}.\n */\n function totalSupply() external view returns (uint256);\n\n // =============================================================\n // IERC165\n // =============================================================\n\n /**\n * @dev Returns true if this contract implements the interface defined by\n * `interfaceId`. See the corresponding\n * [EIP section](https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified)\n * to learn more about how these ids are created.\n *\n * This function call must use less than 30000 gas.\n */\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\n\n // =============================================================\n // IERC721\n // =============================================================\n\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\n * (`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 * checking first that contract recipients are aware of the ERC721 protocol\n * 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\n * this token by either {approve} or {setApprovalForAll}.\n * - If `to` refers to a smart contract, it must implement\n * {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 payable;\n\n /**\n * @dev Equivalent to `safeTransferFrom(from, to, tokenId, '')`.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId\n ) external payable;\n\n /**\n * @dev Transfers `tokenId` from `from` to `to`.\n *\n * WARNING: Usage of this method is discouraged, use {safeTransferFrom}\n * 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\n * 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 payable;\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\n * 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 payable;\n\n /**\n * @dev Approve or remove `operator` as an operator for the caller.\n * Operators can call {transferFrom} or {safeTransferFrom}\n * 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 // =============================================================\n // IERC721Metadata\n // =============================================================\n\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 // =============================================================\n // IERC2309\n // =============================================================\n\n /**\n * @dev Emitted when tokens in `fromTokenId` to `toTokenId`\n * (inclusive) is transferred from `from` to `to`, as defined in the\n * [ERC2309](https://eips.ethereum.org/EIPS/eip-2309) standard.\n *\n * See {_mintERC2309} for more details.\n */\n event ConsecutiveTransfer(uint256 indexed fromTokenId, uint256 toTokenId, address indexed from, address indexed to);\n}\n" }, - 'src/tokens/ERC721/presets/items/IERC721Items.sol': { + 'lib/openzeppelin/contracts/interfaces/IERC1967.sol': { content: - '// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8.19;\n\ninterface IERC721ItemsFunctions {\n /**\n * Mint tokens.\n * @param to Address to mint tokens to.\n * @param amount Amount of tokens to mint.\n */\n function mint(address to, uint256 amount) external;\n}\n\ninterface IERC721ItemsSignals {\n /**\n * Invalid initialization error.\n */\n error InvalidInitialization();\n}\n\ninterface IERC721Items is IERC721ItemsFunctions, IERC721ItemsSignals {}\n' + '// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (interfaces/IERC1967.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev ERC-1967: Proxy Storage Slots. This interface contains the events defined in the ERC.\n *\n * _Available since v4.8.3._\n */\ninterface IERC1967 {\n /**\n * @dev Emitted when the implementation is upgraded.\n */\n event Upgraded(address indexed implementation);\n\n /**\n * @dev Emitted when the admin account has changed.\n */\n event AdminChanged(address previousAdmin, address newAdmin);\n\n /**\n * @dev Emitted when the beacon is changed.\n */\n event BeaconUpgraded(address indexed beacon);\n}\n' }, - 'src/tokens/ERC721/utility/sale/ERC721Sale.sol': { + 'lib/openzeppelin/contracts/interfaces/draft-IERC1822.sol': { content: - '// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8.19;\n\nimport {\n IERC721Sale, IERC721SaleFunctions\n} from "@0xsequence/contracts-library/tokens/ERC721/utility/sale/IERC721Sale.sol";\nimport {\n WithdrawControlled,\n AccessControlEnumerable,\n SafeERC20,\n IERC20\n} from "@0xsequence/contracts-library/tokens/common/WithdrawControlled.sol";\nimport {MerkleProofSingleUse} from "@0xsequence/contracts-library/tokens/common/MerkleProofSingleUse.sol";\n\nimport {IERC721A} from "erc721a/contracts/extensions/ERC721AQueryable.sol";\nimport {IERC721ItemsFunctions} from "@0xsequence/contracts-library/tokens/ERC721/presets/items/IERC721Items.sol";\n\n/**\n * An ERC-721 token contract with primary sale mechanisms.\n */\ncontract ERC721Sale is IERC721Sale, WithdrawControlled, MerkleProofSingleUse {\n bytes32 internal constant MINT_ADMIN_ROLE = keccak256("MINT_ADMIN_ROLE");\n\n bool private _initialized;\n address private _items;\n SaleDetails private _saleDetails;\n\n /**\n * Initialize the contract.\n * @param owner The owner of the contract\n * @param items The ERC-721 Items contract address\n * @dev This should be called immediately after deployment.\n */\n function initialize(address owner, address items) public virtual {\n if (_initialized) {\n revert InvalidInitialization();\n }\n\n _items = items;\n\n _grantRole(DEFAULT_ADMIN_ROLE, owner);\n _grantRole(MINT_ADMIN_ROLE, owner);\n _grantRole(WITHDRAW_ROLE, owner);\n\n _initialized = true;\n }\n\n /**\n * Checks if the current block.timestamp is out of the give timestamp range.\n * @param _startTime Earliest acceptable timestamp (inclusive).\n * @param _endTime Latest acceptable timestamp (exclusive).\n * @dev A zero endTime value is always considered out of bounds.\n */\n function _blockTimeOutOfBounds(uint256 _startTime, uint256 _endTime) private view returns (bool) {\n // 0 end time indicates inactive sale.\n return _endTime == 0 || block.timestamp < _startTime || block.timestamp >= _endTime; // solhint-disable-line not-rely-on-time\n }\n\n /**\n * Checks the sale is active and takes payment.\n * @param _amount Amount of tokens to mint.\n * @param _expectedPaymentToken ERC20 token address to accept payment in. address(0) indicates ETH.\n * @param _maxTotal Maximum amount of payment tokens.\n * @param _proof Merkle proof for allowlist minting.\n */\n function _payForActiveMint(\n uint256 _amount,\n address _expectedPaymentToken,\n uint256 _maxTotal,\n bytes32[] calldata _proof\n )\n private\n {\n // Active sale test\n if (_blockTimeOutOfBounds(_saleDetails.startTime, _saleDetails.endTime)) {\n revert SaleInactive();\n }\n requireMerkleProof(_saleDetails.merkleRoot, _proof, msg.sender, "");\n\n uint256 total = _saleDetails.cost * _amount;\n if (_expectedPaymentToken != _saleDetails.paymentToken) {\n // Caller expected different payment token\n revert InsufficientPayment(_saleDetails.paymentToken, total, 0);\n }\n if (_maxTotal < total) {\n // Caller expected to pay less\n revert InsufficientPayment(_expectedPaymentToken, total, _maxTotal);\n }\n if (_expectedPaymentToken == address(0)) {\n // Paid in ETH\n if (msg.value != total) {\n // We expect exact value match\n revert InsufficientPayment(_expectedPaymentToken, total, msg.value);\n }\n } else if (msg.value > 0) {\n // Paid in ERC20, but sent ETH\n revert InsufficientPayment(address(0), 0, msg.value);\n } else {\n // Paid in ERC20\n SafeERC20.safeTransferFrom(IERC20(_expectedPaymentToken), msg.sender, address(this), total);\n }\n }\n\n //\n // Minting\n //\n\n /**\n * Mint tokens.\n * @param to Address to mint tokens to.\n * @param amount Amount of tokens to mint.\n * @param paymentToken ERC20 token address to accept payment in. address(0) indicates ETH.\n * @param maxTotal Maximum amount of payment tokens.\n * @param proof Merkle proof for allowlist minting.\n * @notice Sale must be active for all tokens.\n * @dev An empty proof is supplied when no proof is required.\n * @dev `paymentToken` must match the `paymentToken` in the sale details.\n */\n function mint(address to, uint256 amount, address paymentToken, uint256 maxTotal, bytes32[] calldata proof)\n public\n payable\n {\n uint256 currentSupply = IERC721A(_items).totalSupply();\n uint256 supplyCap = _saleDetails.supplyCap;\n if (supplyCap > 0 && currentSupply + amount > supplyCap) {\n revert InsufficientSupply(currentSupply, amount, supplyCap);\n }\n _payForActiveMint(amount, paymentToken, maxTotal, proof);\n IERC721ItemsFunctions(_items).mint(to, amount);\n }\n\n /**\n * Set the sale details.\n * @param supplyCap The maximum number of tokens that can be minted. 0 indicates unlimited supply.\n * @param cost The amount of payment tokens to accept for each token minted.\n * @param paymentToken The ERC20 token address to accept payment in. address(0) indicates ETH.\n * @param startTime The start time of the sale. Tokens cannot be minted before this time.\n * @param endTime The end time of the sale. Tokens cannot be minted after this time.\n * @param merkleRoot The merkle root for allowlist minting.\n * @dev A zero end time indicates an inactive sale.\n */\n function setSaleDetails(\n uint256 supplyCap,\n uint256 cost,\n address paymentToken,\n uint64 startTime,\n uint64 endTime,\n bytes32 merkleRoot\n )\n public\n onlyRole(MINT_ADMIN_ROLE)\n {\n // solhint-disable-next-line not-rely-on-time\n if (endTime < startTime || endTime <= block.timestamp) {\n revert InvalidSaleDetails();\n }\n _saleDetails = SaleDetails(supplyCap, cost, paymentToken, startTime, endTime, merkleRoot);\n emit SaleDetailsUpdated(supplyCap, cost, paymentToken, startTime, endTime, merkleRoot);\n }\n\n //\n // Views\n //\n\n function itemsContract() external view returns (address) {\n return address(_items);\n }\n\n /**\n * Get sale details.\n * @return Sale details.\n */\n function saleDetails() external view returns (SaleDetails memory) {\n return _saleDetails;\n }\n\n /**\n * Check interface support.\n * @param interfaceId Interface id\n * @return True if supported\n */\n function supportsInterface(bytes4 interfaceId)\n public\n view\n virtual\n override (AccessControlEnumerable)\n returns (bool)\n {\n return interfaceId == type(IERC721SaleFunctions).interfaceId || super.supportsInterface(interfaceId);\n }\n}\n' + '// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (interfaces/draft-IERC1822.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev ERC1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified\n * proxy whose upgrades are fully controlled by the current implementation.\n */\ninterface IERC1822Proxiable {\n /**\n * @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation\n * address.\n *\n * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks\n * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this\n * function revert if invoked through a proxy.\n */\n function proxiableUUID() external view returns (bytes32);\n}\n' }, - 'src/tokens/ERC721/utility/sale/ERC721SaleFactory.sol': { + 'lib/openzeppelin/contracts/utils/StorageSlot.sol': { content: - '// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8.19;\n\nimport {ERC721Sale} from "@0xsequence/contracts-library/tokens/ERC721/utility/sale/ERC721Sale.sol";\nimport {IERC721SaleFactory, IERC721SaleFactoryFunctions} from "@0xsequence/contracts-library/tokens/ERC721/utility/sale/IERC721SaleFactory.sol";\nimport {SequenceProxyFactory} from "@0xsequence/contracts-library/proxies/SequenceProxyFactory.sol";\n\n/**\n * Deployer of ERC-721 Sale proxies.\n */\ncontract ERC721SaleFactory is IERC721SaleFactory, SequenceProxyFactory {\n /**\n * Creates an ERC-721 Sale Factory.\n * @param factoryOwner The owner of the ERC-721 Sale Factory\n */\n constructor(address factoryOwner) {\n ERC721Sale impl = new ERC721Sale();\n SequenceProxyFactory._initialize(address(impl), factoryOwner);\n }\n\n /// @inheritdoc IERC721SaleFactoryFunctions\n function deploy(address proxyOwner, address tokenOwner, address items) external returns (address proxyAddr) {\n bytes32 salt = keccak256(abi.encode(tokenOwner, items));\n proxyAddr = _createProxy(salt, proxyOwner, "");\n ERC721Sale(proxyAddr).initialize(tokenOwner, items);\n emit ERC721SaleDeployed(proxyAddr);\n return proxyAddr;\n }\n\n /// @inheritdoc IERC721SaleFactoryFunctions\n function determineAddress(address proxyOwner, address tokenOwner, address items) external view returns (address proxyAddr) {\n bytes32 salt = keccak256(abi.encode(tokenOwner, items));\n return _computeProxyAddress(salt, proxyOwner, "");\n }\n}\n' + '// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/StorageSlot.sol)\n// This file was procedurally generated from scripts/generate/templates/StorageSlot.js.\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Library for reading and writing primitive types to specific storage slots.\n *\n * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.\n * This library helps with reading and writing to such slots without the need for inline assembly.\n *\n * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.\n *\n * Example usage to set ERC1967 implementation slot:\n * ```solidity\n * contract ERC1967 {\n * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\n *\n * function _getImplementation() internal view returns (address) {\n * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\n * }\n *\n * function _setImplementation(address newImplementation) internal {\n * require(Address.isContract(newImplementation), "ERC1967: new implementation is not a contract");\n * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\n * }\n * }\n * ```\n *\n * _Available since v4.1 for `address`, `bool`, `bytes32`, `uint256`._\n * _Available since v4.9 for `string`, `bytes`._\n */\nlibrary StorageSlot {\n struct AddressSlot {\n address value;\n }\n\n struct BooleanSlot {\n bool value;\n }\n\n struct Bytes32Slot {\n bytes32 value;\n }\n\n struct Uint256Slot {\n uint256 value;\n }\n\n struct StringSlot {\n string value;\n }\n\n struct BytesSlot {\n bytes value;\n }\n\n /**\n * @dev Returns an `AddressSlot` with member `value` located at `slot`.\n */\n function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `BooleanSlot` with member `value` located at `slot`.\n */\n function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.\n */\n function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `Uint256Slot` with member `value` located at `slot`.\n */\n function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `StringSlot` with member `value` located at `slot`.\n */\n function getStringSlot(bytes32 slot) internal pure returns (StringSlot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `StringSlot` representation of the string storage pointer `store`.\n */\n function getStringSlot(string storage store) internal pure returns (StringSlot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := store.slot\n }\n }\n\n /**\n * @dev Returns an `BytesSlot` with member `value` located at `slot`.\n */\n function getBytesSlot(bytes32 slot) internal pure returns (BytesSlot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `BytesSlot` representation of the bytes storage pointer `store`.\n */\n function getBytesSlot(bytes storage store) internal pure returns (BytesSlot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := store.slot\n }\n }\n}\n' }, - 'src/tokens/ERC721/utility/sale/IERC721Sale.sol': { + 'lib/openzeppelin/contracts/access/IAccessControl.sol': { content: - '// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8.19;\n\ninterface IERC721SaleFunctions {\n\n struct SaleDetails {\n uint256 supplyCap; // 0 supply cap indicates unlimited supply\n uint256 cost;\n address paymentToken; // ERC20 token address for payment. address(0) indicated payment in ETH.\n uint64 startTime;\n uint64 endTime; // 0 end time indicates sale inactive\n bytes32 merkleRoot; // Root of allowed addresses\n }\n\n /**\n * Mint tokens.\n * @param to Address to mint tokens to.\n * @param amount Amount of tokens to mint.\n * @param paymentToken ERC20 token address to accept payment in. address(0) indicates ETH.\n * @param maxTotal Maximum amount of payment tokens.\n * @param proof Merkle proof for allowlist minting.\n * @notice Sale must be active for all tokens.\n * @dev An empty proof is supplied when no proof is required.\n */\n function mint(\n address to,\n uint256 amount,\n address paymentToken,\n uint256 maxTotal,\n bytes32[] memory proof\n ) external payable;\n\n /**\n * Set the sale details.\n * @param supplyCap The maximum number of tokens that can be minted. 0 indicates unlimited supply.\n * @param cost The amount of payment tokens to accept for each token minted.\n * @param paymentToken The ERC20 token address to accept payment in. address(0) indicates ETH.\n * @param startTime The start time of the sale. Tokens cannot be minted before this time.\n * @param endTime The end time of the sale. Tokens cannot be minted after this time.\n * @param merkleRoot The merkle root for allowlist minting.\n */\n function setSaleDetails(\n uint256 supplyCap,\n uint256 cost,\n address paymentToken,\n uint64 startTime,\n uint64 endTime,\n bytes32 merkleRoot\n ) external;\n\n /**\n * Get sale details.\n * @return Sale details.\n */\n function saleDetails() external view returns (SaleDetails memory);\n}\n\ninterface IERC721SaleSignals {\n event SaleDetailsUpdated(uint256 supplyCap, uint256 cost, address paymentToken, uint64 startTime, uint64 endTime, bytes32 merkleRoot);\n\n /**\n * Contract already initialized.\n */\n error InvalidInitialization();\n\n /**\n * Sale details supplied are invalid.\n */\n error InvalidSaleDetails();\n\n /**\n * Sale is not active.\n */\n error SaleInactive();\n\n /**\n * Insufficient supply.\n * @param currentSupply Current supply.\n * @param amount Amount to mint.\n * @param maxSupply Maximum supply.\n */\n error InsufficientSupply(uint256 currentSupply, uint256 amount, uint256 maxSupply);\n\n /**\n * Insufficient tokens for payment.\n * @param currency Currency address. address(0) indicates ETH.\n * @param expected Expected amount of tokens.\n * @param actual Actual amount of tokens.\n */\n error InsufficientPayment(address currency, uint256 expected, uint256 actual);\n}\n\ninterface IERC721Sale is IERC721SaleFunctions, IERC721SaleSignals {}\n' + "// 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" }, - 'src/tokens/ERC721/utility/sale/IERC721SaleFactory.sol': { + 'lib/openzeppelin/contracts/utils/Strings.sol': { content: - '// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8.19;\n\ninterface IERC721SaleFactoryFunctions {\n /**\n * Creates an ERC-721 Sale for given token contract\n * @param proxyOwner The owner of the ERC-721 Sale proxy\n * @param tokenOwner The owner of the ERC-721 Sale implementation\n * @param items The ERC-721 Items contract address\n * @return proxyAddr The address of the ERC-721 Sale Proxy\n * @notice The deployed contract must be granted the MINTER_ROLE on the ERC-721 Items contract.\n */\n function deploy(address proxyOwner, address tokenOwner, address items) external returns (address proxyAddr);\n\n /**\n * Computes the address of a proxy instance.\n * @param proxyOwner The owner of the ERC-721 Sale proxy\n * @param tokenOwner The owner of the ERC-721 Sale implementation\n * @param items The ERC-721 Items contract address\n * @return proxyAddr The address of the ERC-721 Sale Proxy\n */\n function determineAddress(address proxyOwner, address tokenOwner, address items) external returns (address proxyAddr);\n}\n\ninterface IERC721SaleFactorySignals {\n /**\n * Event emitted when a new ERC-721 Sale proxy contract is deployed.\n * @param proxyAddr The address of the deployed proxy.\n */\n event ERC721SaleDeployed(address proxyAddr);\n}\n\ninterface IERC721SaleFactory is IERC721SaleFactoryFunctions, IERC721SaleFactorySignals {}\n' + '// 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' }, - 'src/tokens/common/IMerkleProofSingleUse.sol': { + 'lib/openzeppelin/contracts/utils/introspection/ERC165.sol': { content: - '// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8.19;\n\ninterface IMerkleProofSingleUseFunctions {\n /**\n * Checks if the given merkle proof is valid.\n * @param root Merkle root.\n * @param proof Merkle proof.\n * @param addr Address to check.\n * @param salt Salt used to generate the merkle leaf.\n * @return True if the proof is valid and has not yet been used by {addr}.\n */\n function checkMerkleProof(bytes32 root, bytes32[] calldata proof, address addr, bytes32 salt)\n external\n view\n returns (bool);\n}\n\ninterface IMerkleProofSingleUseSignals {\n /**\n * Thrown when the merkle proof is invalid or has already been used.\n * @param root Merkle root.\n * @param proof Merkle proof.\n * @param addr Address to check.\n * @param salt Salt used to generate the merkle leaf.\n */\n error MerkleProofInvalid(bytes32 root, bytes32[] proof, address addr, bytes32 salt);\n}\n\ninterface IMerkleProofSingleUse is IMerkleProofSingleUseFunctions, IMerkleProofSingleUseSignals {}\n' + '// 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' }, - 'src/tokens/common/IWithdrawControlled.sol': { + 'lib/openzeppelin/contracts/utils/math/Math.sol': { content: - '// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8.19;\n\ninterface IWithdrawControlledFunctions {\n\n /**\n * Withdraws ERC20 tokens owned by this contract.\n * @param token The ERC20 token address.\n * @param to Address to withdraw to.\n * @param value Amount to withdraw.\n */\n function withdrawERC20(address token, address to, uint256 value) external;\n\n /**\n * Withdraws ETH owned by this sale contract.\n * @param to Address to withdraw to.\n * @param value Amount to withdraw.\n */\n function withdrawETH(address to, uint256 value) external;\n}\n\ninterface IWithdrawControlledSignals {\n\n /**\n * Withdraw failed error.\n */\n error WithdrawFailed();\n}\n\ninterface IWithdrawControlled is IWithdrawControlledFunctions, IWithdrawControlledSignals {}\n' + '// 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' }, - 'src/tokens/common/MerkleProofSingleUse.sol': { + 'lib/openzeppelin/contracts/utils/math/SignedMath.sol': { content: - '// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8.19;\n\nimport {IMerkleProofSingleUse} from "@0xsequence/contracts-library/tokens/common/IMerkleProofSingleUse.sol";\nimport {MerkleProof} from "@openzeppelin/contracts/utils/cryptography/MerkleProof.sol";\n\n/**\n * Require single use merkle proofs per address.\n */\nabstract contract MerkleProofSingleUse is IMerkleProofSingleUse {\n // Stores proofs used by an address\n mapping(address => mapping(bytes32 => bool)) private _proofUsed;\n\n /**\n * Requires the given merkle proof to be valid.\n * @param root Merkle root.\n * @param proof Merkle proof.\n * @param addr Address to check.\n * @param salt Salt used to generate the merkle leaf.\n * @notice Fails when the proof is invalid or the proof has already been claimed by this address.\n * @dev This function reverts on failure.\n */\n function requireMerkleProof(bytes32 root, bytes32[] calldata proof, address addr, bytes32 salt) internal {\n if (root != bytes32(0)) {\n if (!checkMerkleProof(root, proof, addr, salt)) {\n revert MerkleProofInvalid(root, proof, addr, salt);\n }\n _proofUsed[addr][root] = true;\n }\n }\n\n /**\n * Checks if the given merkle proof is valid.\n * @param root Merkle root.\n * @param proof Merkle proof.\n * @param addr Address to check.\n * @param salt Salt used to generate the merkle leaf.\n * @return True if the proof is valid and has not yet been used by {addr}.\n */\n function checkMerkleProof(bytes32 root, bytes32[] calldata proof, address addr, bytes32 salt)\n public\n view\n returns (bool)\n {\n return !_proofUsed[addr][root] && MerkleProof.verify(proof, root, keccak256(abi.encodePacked(addr, salt)));\n }\n}\n' + '// 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' }, - 'src/tokens/common/WithdrawControlled.sol': { + 'lib/openzeppelin/contracts/utils/introspection/IERC165.sol': { content: - '// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8.19;\n\nimport {IWithdrawControlled} from "@0xsequence/contracts-library/tokens/common/IWithdrawControlled.sol";\nimport {SafeERC20, IERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";\nimport {AccessControlEnumerable} from "@openzeppelin/contracts/access/AccessControlEnumerable.sol";\n\n/**\n * An abstract contract that allows ETH and ERC20 tokens stored in the contract to be withdrawn.\n */\nabstract contract WithdrawControlled is AccessControlEnumerable, IWithdrawControlled {\n bytes32 internal constant WITHDRAW_ROLE = keccak256("WITHDRAW_ROLE");\n\n //\n // Withdraw\n //\n\n /**\n * Withdraws ERC20 tokens owned by this contract.\n * @param token The ERC20 token address.\n * @param to Address to withdraw to.\n * @param value Amount to withdraw.\n * @notice Only callable by an address with the withdraw role.\n */\n function withdrawERC20(address token, address to, uint256 value) public onlyRole(WITHDRAW_ROLE) {\n SafeERC20.safeTransfer(IERC20(token), to, value);\n }\n\n /**\n * Withdraws ETH owned by this sale contract.\n * @param to Address to withdraw to.\n * @param value Amount to withdraw.\n * @notice Only callable by an address with the withdraw role.\n */\n function withdrawETH(address to, uint256 value) public onlyRole(WITHDRAW_ROLE) {\n (bool success,) = to.call{value: value}("");\n if (!success) {\n revert WithdrawFailed();\n }\n }\n}\n' + '// 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' } }, settings: { evmVersion: 'paris', libraries: {}, - metadata: { bytecodeHash: 'ipfs' }, + metadata: { + useLiteralContent: true, + bytecodeHash: 'ipfs', + appendCBOR: true + }, optimizer: { enabled: true, runs: 20000 }, remappings: [ - '0xsequence/=lib/0xsequence/', '@0xsequence/contracts-library/=src/', - '@0xsequence/erc-1155/=node_modules/@0xsequence/erc-1155/', - '@0xsequence/erc20-meta-token/=node_modules/@0xsequence/erc20-meta-token/', - '@openzeppelin/=node_modules/@openzeppelin/', - 'chiru-labs/=lib/chiru-labs/', 'ds-test/=lib/forge-std/lib/ds-test/src/', - 'erc721a-upgradeable/=node_modules/erc721a-upgradeable/', - 'erc721a/=node_modules/erc721a/', 'forge-std/=lib/forge-std/src/', 'murky/=lib/murky/src/', + '@0xsequence/erc20-meta-token/=lib/0xsequence/erc20-meta-token/src/', + '@0xsequence/erc-1155/=lib/0xsequence/erc-1155/src/', + 'erc721a/=lib/chiru-labs/erc721a/', + 'erc721a-upgradeable/=lib/chiru-labs/erc721a-upgradeable/', + '@openzeppelin/=lib/openzeppelin/', + '@openzeppelin-upgradeable/=lib/openzeppelin-contracts-upgradeable/', + 'solady/=lib/solady/src/', + '0xsequence/=lib/0xsequence/', + 'chiru-labs/=lib/chiru-labs/', + 'erc4626-tests/=lib/openzeppelin/lib/erc4626-tests/', + 'openzeppelin-contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/', 'openzeppelin-contracts/=lib/murky/lib/openzeppelin-contracts/', - 'openzeppelin/=lib/openzeppelin/', - 'solady/=lib/solady/src/' + 'openzeppelin/=lib/openzeppelin/' ], viaIR: true, outputSelection: {