diff --git a/abis/ISmartAccount.json b/abis/ISmartAccount.json index fa0b154..56cca5a 100644 --- a/abis/ISmartAccount.json +++ b/abis/ISmartAccount.json @@ -8,20 +8,14 @@ "name": "owner", "type": "address" }, - { - "indexed": false, - "internalType": "bytes4", - "name": "selector", - "type": "bytes4" - }, { "indexed": false, "internalType": "address", - "name": "implementation", + "name": "controller", "type": "address" } ], - "name": "OverrideUpdated", + "name": "ExecutionControllerUpdated", "type": "event" }, { diff --git a/abis/SmartAccount.json b/abis/SmartAccount.json index a033dd0..f8a2d9c 100644 --- a/abis/SmartAccount.json +++ b/abis/SmartAccount.json @@ -33,20 +33,14 @@ "name": "owner", "type": "address" }, - { - "indexed": false, - "internalType": "bytes4", - "name": "selector", - "type": "bytes4" - }, { "indexed": false, "internalType": "address", - "name": "implementation", + "name": "controller", "type": "address" } ], - "name": "OverrideUpdated", + "name": "ExecutionControllerUpdated", "type": "event" }, { @@ -441,6 +435,32 @@ "stateMutability": "view", "type": "function" }, + { + "inputs": [ + { + "internalType": "address", + "name": "chargedParticles", + "type": "address" + } + ], + "name": "setChargedParticles", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "executionController", + "type": "address" + } + ], + "name": "setExecutionController", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, { "inputs": [ { diff --git a/abis/SmartAccountBase.json b/abis/SmartAccountBase.json index 2e3af66..bf1e3d4 100644 --- a/abis/SmartAccountBase.json +++ b/abis/SmartAccountBase.json @@ -28,20 +28,14 @@ "name": "owner", "type": "address" }, - { - "indexed": false, - "internalType": "bytes4", - "name": "selector", - "type": "bytes4" - }, { "indexed": false, "internalType": "address", - "name": "implementation", + "name": "controller", "type": "address" } ], - "name": "OverrideUpdated", + "name": "ExecutionControllerUpdated", "type": "event" }, { @@ -436,6 +430,32 @@ "stateMutability": "view", "type": "function" }, + { + "inputs": [ + { + "internalType": "address", + "name": "chargedParticles", + "type": "address" + } + ], + "name": "setChargedParticles", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "executionController", + "type": "address" + } + ], + "name": "setExecutionController", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, { "inputs": [ { diff --git a/abis/SmartAccountTimelocks.json b/abis/SmartAccountTimelocks.json index 2b20c97..e7a81e0 100644 --- a/abis/SmartAccountTimelocks.json +++ b/abis/SmartAccountTimelocks.json @@ -39,12 +39,18 @@ "inputs": [ { "indexed": false, - "internalType": "uint256", - "name": "lockedUntil", - "type": "uint256" + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "controller", + "type": "address" } ], - "name": "LockUpdated", + "name": "ExecutionControllerUpdated", "type": "event" }, { @@ -52,24 +58,12 @@ "inputs": [ { "indexed": false, - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "indexed": false, - "internalType": "bytes4", - "name": "selector", - "type": "bytes4" - }, - { - "indexed": false, - "internalType": "address", - "name": "implementation", - "type": "address" + "internalType": "uint256", + "name": "lockedUntil", + "type": "uint256" } ], - "name": "OverrideUpdated", + "name": "LockUpdated", "type": "event" }, { @@ -509,6 +503,32 @@ "stateMutability": "view", "type": "function" }, + { + "inputs": [ + { + "internalType": "address", + "name": "chargedParticles", + "type": "address" + } + ], + "name": "setChargedParticles", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "executionController", + "type": "address" + } + ], + "name": "setExecutionController", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, { "inputs": [ { diff --git a/deploy/Setup_ChargedParticles.ts b/deploy/Setup_ChargedParticles.ts index 7da8d57..6b8b8af 100644 --- a/deploy/Setup_ChargedParticles.ts +++ b/deploy/Setup_ChargedParticles.ts @@ -11,18 +11,22 @@ const Setup_ChargedParticles: DeployFunction = async (hre: HardhatRuntimeEnviron // Load ChargedParticles const chargedParticles: ChargedParticles = await ethers.getContract('ChargedParticles'); const chargedParticlesAddress = await chargedParticles.getAddress(); - // console.log(` -- Charged Particles Address: ${chargedParticlesAddress}`); + console.log(` -- Charged Particles Address: ${chargedParticlesAddress}`); // Load SmartAccountController_Example1 const controller: SmartAccountController_Example1 = await ethers.getContract('SmartAccountController_Example1'); const controllerAddress = await controller.getAddress(); - // console.log(` -- Execution Controller Address: ${controllerAddress}`); + console.log(` -- Execution Controller Address: ${controllerAddress}`); // Set Default Execution Controller - await performTx( - await chargedParticles.setDefaultExecutionController(controllerAddress), - ' -- Default Execution Controller Set for SmartAccounts!' - ); + const setController = await chargedParticles.setDefaultExecutionController(controllerAddress); + console.log(setController) + + await setController.wait() + // await performTx( + // await chargedParticles.setDefaultExecutionController(controllerAddress), + // ' -- Default Execution Controller Set for SmartAccounts!' + // ); }; export default Setup_ChargedParticles; diff --git a/deployments/sepolia/.chainId b/deployments/sepolia/.chainId new file mode 100644 index 0000000..bd8d1cd --- /dev/null +++ b/deployments/sepolia/.chainId @@ -0,0 +1 @@ +11155111 \ No newline at end of file diff --git a/deployments/sepolia/ChargedParticles.json b/deployments/sepolia/ChargedParticles.json new file mode 100644 index 0000000..ef7a3b0 --- /dev/null +++ b/deployments/sepolia/ChargedParticles.json @@ -0,0 +1,641 @@ +{ + "address": "0x0C8f698732c0f857a4D0290EB77dC4b1EA89eBd0", + "abi": [ + { + "inputs": [ + { + "internalType": "address", + "name": "registry", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "receiver", + "type": "address" + }, + { + "internalType": "address", + "name": "contractAddress", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "address", + "name": "nftTokenAddress", + "type": "address" + }, + { + "internalType": "uint256", + "name": "nftTokenId", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "nftTokenAmount", + "type": "uint256" + } + ], + "name": "breakCovalentBond", + "outputs": [ + { + "internalType": "bool", + "name": "success", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "contractAddress", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "address", + "name": "nftTokenAddress", + "type": "address" + }, + { + "internalType": "uint256", + "name": "nftTokenId", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "nftTokenAmount", + "type": "uint256" + } + ], + "name": "covalentBond", + "outputs": [ + { + "internalType": "bool", + "name": "success", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "contractAddress", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "address", + "name": "assetToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "assetAmount", + "type": "uint256" + } + ], + "name": "energizeParticle", + "outputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "nftContract", + "type": "address" + } + ], + "name": "getAccountImplementation", + "outputs": [ + { + "internalType": "address", + "name": "accountImplementation", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getCurrentRegistry", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "nftContract", + "type": "address" + } + ], + "name": "getExecutionController", + "outputs": [ + { + "internalType": "address", + "name": "executionController", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "registry", + "type": "uint256" + } + ], + "name": "getRegistry", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "receiver", + "type": "address" + }, + { + "internalType": "address", + "name": "contractAddress", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "address", + "name": "assetToken", + "type": "address" + } + ], + "name": "releaseParticle", + "outputs": [ + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "receiver", + "type": "address" + }, + { + "internalType": "address", + "name": "contractAddress", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "address", + "name": "assetToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "assetAmount", + "type": "uint256" + } + ], + "name": "releaseParticleAmount", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "nftContract", + "type": "address" + }, + { + "internalType": "address", + "name": "accountImplementation", + "type": "address" + } + ], + "name": "setCustomAccountImplementation", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "nftContract", + "type": "address" + }, + { + "internalType": "address", + "name": "executionController", + "type": "address" + } + ], + "name": "setCustomExecutionController", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "accountImplementation", + "type": "address" + } + ], + "name": "setDefaultAccountImplementation", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "executionController", + "type": "address" + } + ], + "name": "setDefaultExecutionController", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "version", + "type": "uint256" + } + ], + "name": "setDefaultRegistryVersion", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "version", + "type": "uint256" + }, + { + "internalType": "address", + "name": "registry", + "type": "address" + } + ], + "name": "setRegistry", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ], + "transactionHash": "0xa76fa342701a9f7d351f9b5a2ac3a5309bc7798ff15bc22a13eb13707d1fcdb9", + "receipt": { + "to": null, + "from": "0x6d46b37708dA7Ed4E5C4509495768Fecd3D17C01", + "contractAddress": "0x0C8f698732c0f857a4D0290EB77dC4b1EA89eBd0", + "transactionIndex": 91, + "gasUsed": "3537877", + "logsBloom": "0x00000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008000000000000020000001000000000000000000000000000000000000020000000000000000000800000000000000000000000000000000400000000000000000000000000000000000000000040000000400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000010000000000000000080000000000000", + "blockHash": "0x740dc3a61cb1589896f0c78f1db056f59d9d15db90957c2459bc948d6235ff0e", + "transactionHash": "0xa76fa342701a9f7d351f9b5a2ac3a5309bc7798ff15bc22a13eb13707d1fcdb9", + "logs": [ + { + "transactionIndex": 91, + "blockNumber": 5328357, + "transactionHash": "0xa76fa342701a9f7d351f9b5a2ac3a5309bc7798ff15bc22a13eb13707d1fcdb9", + "address": "0x0C8f698732c0f857a4D0290EB77dC4b1EA89eBd0", + "topics": [ + "0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0", + "0x0000000000000000000000000000000000000000000000000000000000000000", + "0x0000000000000000000000006d46b37708da7ed4e5c4509495768fecd3d17c01" + ], + "data": "0x", + "logIndex": 240, + "blockHash": "0x740dc3a61cb1589896f0c78f1db056f59d9d15db90957c2459bc948d6235ff0e" + } + ], + "blockNumber": 5328357, + "cumulativeGasUsed": "23426393", + "status": 1, + "byzantium": true + }, + "args": [ + "0x000000006551c19487814612e58FE06813775758" + ], + "numDeployments": 1, + "solcInputHash": "39d5a6c9cdeadda9b99b6b4ba5249a9f", + "metadata": "{\"compiler\":{\"version\":\"0.8.17+commit.8df45f5f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"registry\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"receiver\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"contractAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"nftTokenAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"nftTokenId\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"nftTokenAmount\",\"type\":\"uint256\"}],\"name\":\"breakCovalentBond\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"success\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"contractAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"nftTokenAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"nftTokenId\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"nftTokenAmount\",\"type\":\"uint256\"}],\"name\":\"covalentBond\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"success\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"contractAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"assetToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"assetAmount\",\"type\":\"uint256\"}],\"name\":\"energizeParticle\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"nftContract\",\"type\":\"address\"}],\"name\":\"getAccountImplementation\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"accountImplementation\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getCurrentRegistry\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"nftContract\",\"type\":\"address\"}],\"name\":\"getExecutionController\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"executionController\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"registry\",\"type\":\"uint256\"}],\"name\":\"getRegistry\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"receiver\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"contractAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"assetToken\",\"type\":\"address\"}],\"name\":\"releaseParticle\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"receiver\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"contractAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"assetToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"assetAmount\",\"type\":\"uint256\"}],\"name\":\"releaseParticleAmount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"nftContract\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"accountImplementation\",\"type\":\"address\"}],\"name\":\"setCustomAccountImplementation\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"nftContract\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"executionController\",\"type\":\"address\"}],\"name\":\"setCustomExecutionController\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"accountImplementation\",\"type\":\"address\"}],\"name\":\"setDefaultAccountImplementation\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"executionController\",\"type\":\"address\"}],\"name\":\"setDefaultExecutionController\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"version\",\"type\":\"uint256\"}],\"name\":\"setDefaultRegistryVersion\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"version\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"registry\",\"type\":\"address\"}],\"name\":\"setRegistry\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"breakCovalentBond(address,address,uint256,address,uint256,uint256)\":{\"params\":{\"contractAddress\":\"The Address to the Contract of the Token to Energize\",\"nftTokenAddress\":\"The Address of the NFT Token being deposited\",\"nftTokenAmount\":\"The amount of Tokens to Withdraw (ERC1155-specific)\",\"nftTokenId\":\"The ID of the NFT Token being deposited\",\"receiver\":\"The Address to Receive the Released Asset Tokens\",\"tokenId\":\"The ID of the Token to Energize\"}},\"covalentBond(address,uint256,address,uint256,uint256)\":{\"params\":{\"contractAddress\":\"The Address to the Contract of the Token to Energize\",\"nftTokenAddress\":\"The Address of the NFT Token being deposited\",\"nftTokenAmount\":\"The amount of Tokens to Deposit (ERC1155-specific)\",\"nftTokenId\":\"The ID of the NFT Token being deposited\",\"tokenId\":\"The ID of the Token to Energize\"}},\"energizeParticle(address,uint256,address,uint256)\":{\"params\":{\"assetAmount\":\"The Amount of Asset Token to Energize the Token with\",\"assetToken\":\"The Address of the Asset Token being used\",\"contractAddress\":\"The Address to the Contract of the Token to Energize\",\"tokenId\":\"The ID of the Token to Energize\"}},\"getAccountImplementation(address)\":{\"details\":\"...\"},\"getCurrentRegistry()\":{\"details\":\"...\"},\"getExecutionController(address)\":{\"details\":\"...\"},\"getRegistry(uint256)\":{\"details\":\"...\"},\"owner()\":{\"details\":\"Returns the address of the current owner.\"},\"renounceOwnership()\":{\"details\":\"Leaves the contract without owner. It will not be possible to call `onlyOwner` functions. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby disabling any functionality that is only available to the owner.\"},\"setCustomAccountImplementation(address,address)\":{\"details\":\"...\"},\"setCustomExecutionController(address,address)\":{\"details\":\"...\"},\"setDefaultAccountImplementation(address)\":{\"details\":\"...\"},\"setDefaultExecutionController(address)\":{\"details\":\"...\"},\"setDefaultRegistryVersion(uint256)\":{\"details\":\"...\"},\"setRegistry(uint256,address)\":{\"details\":\"...\"},\"transferOwnership(address)\":{\"details\":\"Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"breakCovalentBond(address,address,uint256,address,uint256,uint256)\":{\"notice\":\"Release NFT Assets from the Particle\"},\"covalentBond(address,uint256,address,uint256,uint256)\":{\"notice\":\"Deposit other NFT Assets into the Particle Must be called by the account providing the Asset Account must Approve THIS contract as Operator of Asset\"},\"energizeParticle(address,uint256,address,uint256)\":{\"notice\":\"Fund Particle with Asset Token Must be called by the account providing the Asset Account must Approve THIS contract as Operator of Asset\"}},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/ChargedParticles.sol\":\"ChargedParticles\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/access/Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../utils/Context.sol\\\";\\n\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\n * the owner.\\n */\\nabstract contract Ownable is Context {\\n address private _owner;\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the deployer as the initial owner.\\n */\\n constructor() {\\n _transferOwnership(_msgSender());\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n _checkOwner();\\n _;\\n }\\n\\n /**\\n * @dev Returns the address of the current owner.\\n */\\n function owner() public view virtual returns (address) {\\n return _owner;\\n }\\n\\n /**\\n * @dev Throws if the sender is not the owner.\\n */\\n function _checkOwner() internal view virtual {\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby disabling any functionality that is only available to the owner.\\n */\\n function renounceOwnership() public virtual onlyOwner {\\n _transferOwnership(address(0));\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\n _transferOwnership(newOwner);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Internal function without access restriction.\\n */\\n function _transferOwnership(address newOwner) internal virtual {\\n address oldOwner = _owner;\\n _owner = newOwner;\\n emit OwnershipTransferred(oldOwner, newOwner);\\n }\\n}\\n\",\"keccak256\":\"0xba43b97fba0d32eb4254f6a5a297b39a19a247082a02d6e69349e071e2946218\",\"license\":\"MIT\"},\"@openzeppelin/contracts/interfaces/IERC1271.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (interfaces/IERC1271.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC1271 standard signature validation method for\\n * contracts as defined in https://eips.ethereum.org/EIPS/eip-1271[ERC-1271].\\n *\\n * _Available since v4.1._\\n */\\ninterface IERC1271 {\\n /**\\n * @dev Should return whether the signature provided is valid for the provided data\\n * @param hash Hash of the data to be signed\\n * @param signature Signature byte array associated with _data\\n */\\n function isValidSignature(bytes32 hash, bytes memory signature) external view returns (bytes4 magicValue);\\n}\\n\",\"keccak256\":\"0x0705a4b1b86d7b0bd8432118f226ba139c44b9dcaba0a6eafba2dd7d0639c544\",\"license\":\"MIT\"},\"@openzeppelin/contracts/security/ReentrancyGuard.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (security/ReentrancyGuard.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Contract module that helps prevent reentrant calls to a function.\\n *\\n * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier\\n * available, which can be applied to functions to make sure there are no nested\\n * (reentrant) calls to them.\\n *\\n * Note that because there is a single `nonReentrant` guard, functions marked as\\n * `nonReentrant` may not call one another. This can be worked around by making\\n * those functions `private`, and then adding `external` `nonReentrant` entry\\n * points to them.\\n *\\n * TIP: If you would like to learn more about reentrancy and alternative ways\\n * to protect against it, check out our blog post\\n * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].\\n */\\nabstract contract ReentrancyGuard {\\n // Booleans are more expensive than uint256 or any type that takes up a full\\n // word because each write operation emits an extra SLOAD to first read the\\n // slot's contents, replace the bits taken up by the boolean, and then write\\n // back. This is the compiler's defense against contract upgrades and\\n // pointer aliasing, and it cannot be disabled.\\n\\n // The values being non-zero value makes deployment a bit more expensive,\\n // but in exchange the refund on every call to nonReentrant will be lower in\\n // amount. Since refunds are capped to a percentage of the total\\n // transaction's gas, it is best to keep them low in cases like this one, to\\n // increase the likelihood of the full refund coming into effect.\\n uint256 private constant _NOT_ENTERED = 1;\\n uint256 private constant _ENTERED = 2;\\n\\n uint256 private _status;\\n\\n constructor() {\\n _status = _NOT_ENTERED;\\n }\\n\\n /**\\n * @dev Prevents a contract from calling itself, directly or indirectly.\\n * Calling a `nonReentrant` function from another `nonReentrant`\\n * function is not supported. It is possible to prevent this from happening\\n * by making the `nonReentrant` function external, and making it call a\\n * `private` function that does the actual work.\\n */\\n modifier nonReentrant() {\\n _nonReentrantBefore();\\n _;\\n _nonReentrantAfter();\\n }\\n\\n function _nonReentrantBefore() private {\\n // On the first call to nonReentrant, _status will be _NOT_ENTERED\\n require(_status != _ENTERED, \\\"ReentrancyGuard: reentrant call\\\");\\n\\n // Any calls to nonReentrant after this point will fail\\n _status = _ENTERED;\\n }\\n\\n function _nonReentrantAfter() private {\\n // By storing the original value once again, a refund is triggered (see\\n // https://eips.ethereum.org/EIPS/eip-2200)\\n _status = _NOT_ENTERED;\\n }\\n\\n /**\\n * @dev Returns true if the reentrancy guard is currently set to \\\"entered\\\", which indicates there is a\\n * `nonReentrant` function in the call stack.\\n */\\n function _reentrancyGuardEntered() internal view returns (bool) {\\n return _status == _ENTERED;\\n }\\n}\\n\",\"keccak256\":\"0xa535a5df777d44e945dd24aa43a11e44b024140fc340ad0dfe42acf4002aade1\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC1155/IERC1155.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC1155/IERC1155.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../../utils/introspection/IERC165.sol\\\";\\n\\n/**\\n * @dev Required interface of an ERC1155 compliant contract, as defined in the\\n * https://eips.ethereum.org/EIPS/eip-1155[EIP].\\n *\\n * _Available since v3.1._\\n */\\ninterface IERC1155 is IERC165 {\\n /**\\n * @dev Emitted when `value` tokens of token type `id` are transferred from `from` to `to` by `operator`.\\n */\\n event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value);\\n\\n /**\\n * @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all\\n * transfers.\\n */\\n event TransferBatch(\\n address indexed operator,\\n address indexed from,\\n address indexed to,\\n uint256[] ids,\\n uint256[] values\\n );\\n\\n /**\\n * @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to\\n * `approved`.\\n */\\n event ApprovalForAll(address indexed account, address indexed operator, bool approved);\\n\\n /**\\n * @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI.\\n *\\n * If an {URI} event was emitted for `id`, the standard\\n * https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value\\n * returned by {IERC1155MetadataURI-uri}.\\n */\\n event URI(string value, uint256 indexed id);\\n\\n /**\\n * @dev Returns the amount of tokens of token type `id` owned by `account`.\\n *\\n * Requirements:\\n *\\n * - `account` cannot be the zero address.\\n */\\n function balanceOf(address account, uint256 id) external view returns (uint256);\\n\\n /**\\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}.\\n *\\n * Requirements:\\n *\\n * - `accounts` and `ids` must have the same length.\\n */\\n function balanceOfBatch(\\n address[] calldata accounts,\\n uint256[] calldata ids\\n ) external view returns (uint256[] memory);\\n\\n /**\\n * @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`,\\n *\\n * Emits an {ApprovalForAll} event.\\n *\\n * Requirements:\\n *\\n * - `operator` cannot be the caller.\\n */\\n function setApprovalForAll(address operator, bool approved) external;\\n\\n /**\\n * @dev Returns true if `operator` is approved to transfer ``account``'s tokens.\\n *\\n * See {setApprovalForAll}.\\n */\\n function isApprovedForAll(address account, address operator) external view returns (bool);\\n\\n /**\\n * @dev Transfers `amount` tokens of token type `id` from `from` to `to`.\\n *\\n * Emits a {TransferSingle} event.\\n *\\n * Requirements:\\n *\\n * - `to` cannot be the zero address.\\n * - If the caller is not `from`, it must have been approved to spend ``from``'s tokens via {setApprovalForAll}.\\n * - `from` must have a balance of tokens of type `id` of at least `amount`.\\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the\\n * acceptance magic value.\\n */\\n function safeTransferFrom(address from, address to, uint256 id, uint256 amount, bytes calldata data) external;\\n\\n /**\\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.\\n *\\n * Emits a {TransferBatch} event.\\n *\\n * Requirements:\\n *\\n * - `ids` and `amounts` must have the same length.\\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the\\n * acceptance magic value.\\n */\\n function safeBatchTransferFrom(\\n address from,\\n address to,\\n uint256[] calldata ids,\\n uint256[] calldata amounts,\\n bytes calldata data\\n ) external;\\n}\\n\",\"keccak256\":\"0xcab667ddad478ff0d39c2053ca77fac778af8483c18ab07d810277b4216fd582\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC1155/IERC1155Receiver.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../../utils/introspection/IERC165.sol\\\";\\n\\n/**\\n * @dev _Available since v3.1._\\n */\\ninterface IERC1155Receiver is IERC165 {\\n /**\\n * @dev Handles the receipt of a single ERC1155 token type. This function is\\n * called at the end of a `safeTransferFrom` after the balance has been updated.\\n *\\n * NOTE: To accept the transfer, this must return\\n * `bytes4(keccak256(\\\"onERC1155Received(address,address,uint256,uint256,bytes)\\\"))`\\n * (i.e. 0xf23a6e61, or its own function selector).\\n *\\n * @param operator The address which initiated the transfer (i.e. msg.sender)\\n * @param from The address which previously owned the token\\n * @param id The ID of the token being transferred\\n * @param value The amount of tokens being transferred\\n * @param data Additional data with no specified format\\n * @return `bytes4(keccak256(\\\"onERC1155Received(address,address,uint256,uint256,bytes)\\\"))` if transfer is allowed\\n */\\n function onERC1155Received(\\n address operator,\\n address from,\\n uint256 id,\\n uint256 value,\\n bytes calldata data\\n ) external returns (bytes4);\\n\\n /**\\n * @dev Handles the receipt of a multiple ERC1155 token types. This function\\n * is called at the end of a `safeBatchTransferFrom` after the balances have\\n * been updated.\\n *\\n * NOTE: To accept the transfer(s), this must return\\n * `bytes4(keccak256(\\\"onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)\\\"))`\\n * (i.e. 0xbc197c81, or its own function selector).\\n *\\n * @param operator The address which initiated the batch transfer (i.e. msg.sender)\\n * @param from The address which previously owned the token\\n * @param ids An array containing ids of each token being transferred (order and length must match values array)\\n * @param values An array containing amounts of each token being transferred (order and length must match ids array)\\n * @param data Additional data with no specified format\\n * @return `bytes4(keccak256(\\\"onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)\\\"))` if transfer is allowed\\n */\\n function onERC1155BatchReceived(\\n address operator,\\n address from,\\n uint256[] calldata ids,\\n uint256[] calldata values,\\n bytes calldata data\\n ) external returns (bytes4);\\n}\\n\",\"keccak256\":\"0xeb373f1fdc7b755c6a750123a9b9e3a8a02c1470042fd6505d875000a80bde0b\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\n */\\ninterface IERC20 {\\n /**\\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\\n * another (`to`).\\n *\\n * Note that `value` may be zero.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 value);\\n\\n /**\\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\\n * a call to {approve}. `value` is the new allowance.\\n */\\n event Approval(address indexed owner, address indexed spender, uint256 value);\\n\\n /**\\n * @dev Returns the amount of tokens in existence.\\n */\\n function totalSupply() external view returns (uint256);\\n\\n /**\\n * @dev Returns the amount of tokens owned by `account`.\\n */\\n function balanceOf(address account) external view returns (uint256);\\n\\n /**\\n * @dev Moves `amount` tokens from the caller's account to `to`.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transfer(address to, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Returns the remaining number of tokens that `spender` will be\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\n * zero by default.\\n *\\n * This value changes when {approve} or {transferFrom} are called.\\n */\\n function allowance(address owner, address spender) external view returns (uint256);\\n\\n /**\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\n * that someone may use both the old and the new allowance by unfortunate\\n * transaction ordering. One possible solution to mitigate this race\\n * condition is to first reduce the spender's allowance to 0 and set the\\n * desired value afterwards:\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address spender, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Moves `amount` tokens from `from` to `to` using the\\n * allowance mechanism. `amount` is then deducted from the caller's\\n * allowance.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(address from, address to, uint256 amount) external returns (bool);\\n}\\n\",\"keccak256\":\"0x287b55befed2961a7eabd7d7b1b2839cbca8a5b80ef8dcbb25ed3d4c2002c305\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC721/IERC721.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC721/IERC721.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../../utils/introspection/IERC165.sol\\\";\\n\\n/**\\n * @dev Required interface of an ERC721 compliant contract.\\n */\\ninterface IERC721 is IERC165 {\\n /**\\n * @dev Emitted when `tokenId` token is transferred from `from` to `to`.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);\\n\\n /**\\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\\n */\\n event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);\\n\\n /**\\n * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.\\n */\\n event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\\n\\n /**\\n * @dev Returns the number of tokens in ``owner``'s account.\\n */\\n function balanceOf(address owner) external view returns (uint256 balance);\\n\\n /**\\n * @dev Returns the owner of the `tokenId` token.\\n *\\n * Requirements:\\n *\\n * - `tokenId` must exist.\\n */\\n function ownerOf(uint256 tokenId) external view returns (address owner);\\n\\n /**\\n * @dev Safely transfers `tokenId` token from `from` to `to`.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must exist and be owned by `from`.\\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\\n *\\n * Emits a {Transfer} event.\\n */\\n function safeTransferFrom(address from, address to, uint256 tokenId, bytes calldata data) external;\\n\\n /**\\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must exist and be owned by `from`.\\n * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or {setApprovalForAll}.\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\\n *\\n * Emits a {Transfer} event.\\n */\\n function safeTransferFrom(address from, address to, uint256 tokenId) external;\\n\\n /**\\n * @dev Transfers `tokenId` token from `from` to `to`.\\n *\\n * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721\\n * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must\\n * understand this adds an external call which potentially creates a reentrancy vulnerability.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must be owned by `from`.\\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(address from, address to, uint256 tokenId) external;\\n\\n /**\\n * @dev Gives permission to `to` to transfer `tokenId` token to another account.\\n * The approval is cleared when the token is transferred.\\n *\\n * Only a single account can be approved at a time, so approving the zero address clears previous approvals.\\n *\\n * Requirements:\\n *\\n * - The caller must own the token or be an approved operator.\\n * - `tokenId` must exist.\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address to, uint256 tokenId) external;\\n\\n /**\\n * @dev Approve or remove `operator` as an operator for the caller.\\n * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.\\n *\\n * Requirements:\\n *\\n * - The `operator` cannot be the caller.\\n *\\n * Emits an {ApprovalForAll} event.\\n */\\n function setApprovalForAll(address operator, bool approved) external;\\n\\n /**\\n * @dev Returns the account approved for `tokenId` token.\\n *\\n * Requirements:\\n *\\n * - `tokenId` must exist.\\n */\\n function getApproved(uint256 tokenId) external view returns (address operator);\\n\\n /**\\n * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.\\n *\\n * See {setApprovalForAll}\\n */\\n function isApprovedForAll(address owner, address operator) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x5bce51e11f7d194b79ea59fe00c9e8de9fa2c5530124960f29a24d4c740a3266\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721Receiver.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @title ERC721 token receiver interface\\n * @dev Interface for any contract that wants to support safeTransfers\\n * from ERC721 asset contracts.\\n */\\ninterface IERC721Receiver {\\n /**\\n * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}\\n * by `operator` from `from`, this function is called.\\n *\\n * It must return its Solidity selector to confirm the token transfer.\\n * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.\\n *\\n * The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.selector`.\\n */\\n function onERC721Received(\\n address operator,\\n address from,\\n uint256 tokenId,\\n bytes calldata data\\n ) external returns (bytes4);\\n}\\n\",\"keccak256\":\"0xa82b58eca1ee256be466e536706850163d2ec7821945abd6b4778cfb3bee37da\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract Context {\\n function _msgSender() internal view virtual returns (address) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes calldata) {\\n return msg.data;\\n }\\n}\\n\",\"keccak256\":\"0xe2e337e6dde9ef6b680e07338c493ebea1b5fd09b43424112868e9cc1706bca7\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Create2.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 // | | \\u2193 ptr ... \\u2193 ptr + 0x0B (start) ... \\u2193 ptr + 0x20 ... \\u2193 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) | \\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191 |\\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\",\"keccak256\":\"0x6e00f269073ffc4350e56b7e8153c9092d5f70bfba423299990514183101ef89\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Strings.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Strings.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./math/Math.sol\\\";\\nimport \\\"./math/SignedMath.sol\\\";\\n\\n/**\\n * @dev String operations.\\n */\\nlibrary Strings {\\n bytes16 private constant _SYMBOLS = \\\"0123456789abcdef\\\";\\n uint8 private constant _ADDRESS_LENGTH = 20;\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\\n */\\n function toString(uint256 value) internal pure returns (string memory) {\\n unchecked {\\n uint256 length = Math.log10(value) + 1;\\n string memory buffer = new string(length);\\n uint256 ptr;\\n /// @solidity memory-safe-assembly\\n assembly {\\n ptr := add(buffer, add(32, length))\\n }\\n while (true) {\\n ptr--;\\n /// @solidity memory-safe-assembly\\n assembly {\\n mstore8(ptr, byte(mod(value, 10), _SYMBOLS))\\n }\\n value /= 10;\\n if (value == 0) break;\\n }\\n return buffer;\\n }\\n }\\n\\n /**\\n * @dev Converts a `int256` to its ASCII `string` decimal representation.\\n */\\n function toString(int256 value) internal pure returns (string memory) {\\n return string(abi.encodePacked(value < 0 ? \\\"-\\\" : \\\"\\\", toString(SignedMath.abs(value))));\\n }\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\\n */\\n function toHexString(uint256 value) internal pure returns (string memory) {\\n unchecked {\\n return toHexString(value, Math.log256(value) + 1);\\n }\\n }\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\\n */\\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\\n bytes memory buffer = new bytes(2 * length + 2);\\n buffer[0] = \\\"0\\\";\\n buffer[1] = \\\"x\\\";\\n for (uint256 i = 2 * length + 1; i > 1; --i) {\\n buffer[i] = _SYMBOLS[value & 0xf];\\n value >>= 4;\\n }\\n require(value == 0, \\\"Strings: hex length insufficient\\\");\\n return string(buffer);\\n }\\n\\n /**\\n * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.\\n */\\n function toHexString(address addr) internal pure returns (string memory) {\\n return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\\n }\\n\\n /**\\n * @dev Returns true if the two strings are equal.\\n */\\n function equal(string memory a, string memory b) internal pure returns (bool) {\\n return keccak256(bytes(a)) == keccak256(bytes(b));\\n }\\n}\\n\",\"keccak256\":\"0x3088eb2868e8d13d89d16670b5f8612c4ab9ff8956272837d8e90106c59c14a0\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/cryptography/ECDSA.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/cryptography/ECDSA.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../Strings.sol\\\";\\n\\n/**\\n * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.\\n *\\n * These functions can be used to verify that a message was signed by the holder\\n * of the private keys of a given address.\\n */\\nlibrary ECDSA {\\n enum RecoverError {\\n NoError,\\n InvalidSignature,\\n InvalidSignatureLength,\\n InvalidSignatureS,\\n InvalidSignatureV // Deprecated in v4.8\\n }\\n\\n function _throwError(RecoverError error) private pure {\\n if (error == RecoverError.NoError) {\\n return; // no error: do nothing\\n } else if (error == RecoverError.InvalidSignature) {\\n revert(\\\"ECDSA: invalid signature\\\");\\n } else if (error == RecoverError.InvalidSignatureLength) {\\n revert(\\\"ECDSA: invalid signature length\\\");\\n } else if (error == RecoverError.InvalidSignatureS) {\\n revert(\\\"ECDSA: invalid signature 's' value\\\");\\n }\\n }\\n\\n /**\\n * @dev Returns the address that signed a hashed message (`hash`) with\\n * `signature` or error string. This address can then be used for verification purposes.\\n *\\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\\n * this function rejects them by requiring the `s` value to be in the lower\\n * half order, and the `v` value to be either 27 or 28.\\n *\\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\\n * verification to be secure: it is possible to craft signatures that\\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\\n * this is by receiving a hash of the original message (which may otherwise\\n * be too long), and then calling {toEthSignedMessageHash} on it.\\n *\\n * Documentation for signature generation:\\n * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]\\n * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]\\n *\\n * _Available since v4.3._\\n */\\n function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) {\\n if (signature.length == 65) {\\n bytes32 r;\\n bytes32 s;\\n uint8 v;\\n // ecrecover takes the signature parameters, and the only way to get them\\n // currently is to use assembly.\\n /// @solidity memory-safe-assembly\\n assembly {\\n r := mload(add(signature, 0x20))\\n s := mload(add(signature, 0x40))\\n v := byte(0, mload(add(signature, 0x60)))\\n }\\n return tryRecover(hash, v, r, s);\\n } else {\\n return (address(0), RecoverError.InvalidSignatureLength);\\n }\\n }\\n\\n /**\\n * @dev Returns the address that signed a hashed message (`hash`) with\\n * `signature`. This address can then be used for verification purposes.\\n *\\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\\n * this function rejects them by requiring the `s` value to be in the lower\\n * half order, and the `v` value to be either 27 or 28.\\n *\\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\\n * verification to be secure: it is possible to craft signatures that\\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\\n * this is by receiving a hash of the original message (which may otherwise\\n * be too long), and then calling {toEthSignedMessageHash} on it.\\n */\\n function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {\\n (address recovered, RecoverError error) = tryRecover(hash, signature);\\n _throwError(error);\\n return recovered;\\n }\\n\\n /**\\n * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.\\n *\\n * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures]\\n *\\n * _Available since v4.3._\\n */\\n function tryRecover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address, RecoverError) {\\n bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff);\\n uint8 v = uint8((uint256(vs) >> 255) + 27);\\n return tryRecover(hash, v, r, s);\\n }\\n\\n /**\\n * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately.\\n *\\n * _Available since v4.2._\\n */\\n function recover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address) {\\n (address recovered, RecoverError error) = tryRecover(hash, r, vs);\\n _throwError(error);\\n return recovered;\\n }\\n\\n /**\\n * @dev Overload of {ECDSA-tryRecover} that receives the `v`,\\n * `r` and `s` signature fields separately.\\n *\\n * _Available since v4.3._\\n */\\n function tryRecover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) internal pure returns (address, RecoverError) {\\n // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature\\n // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines\\n // the valid range for s in (301): 0 < s < secp256k1n \\u00f7 2 + 1, and for v in (302): v \\u2208 {27, 28}. Most\\n // signatures from current libraries generate a unique signature with an s-value in the lower half order.\\n //\\n // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value\\n // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or\\n // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept\\n // these malleable signatures as well.\\n if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {\\n return (address(0), RecoverError.InvalidSignatureS);\\n }\\n\\n // If the signature is valid (and not malleable), return the signer address\\n address signer = ecrecover(hash, v, r, s);\\n if (signer == address(0)) {\\n return (address(0), RecoverError.InvalidSignature);\\n }\\n\\n return (signer, RecoverError.NoError);\\n }\\n\\n /**\\n * @dev Overload of {ECDSA-recover} that receives the `v`,\\n * `r` and `s` signature fields separately.\\n */\\n function recover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) internal pure returns (address) {\\n (address recovered, RecoverError error) = tryRecover(hash, v, r, s);\\n _throwError(error);\\n return recovered;\\n }\\n\\n /**\\n * @dev Returns an Ethereum Signed Message, created from a `hash`. This\\n * produces hash corresponding to the one signed with the\\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\\n * JSON-RPC method as part of EIP-191.\\n *\\n * See {recover}.\\n */\\n function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32 message) {\\n // 32 is the length in bytes of hash,\\n // enforced by the type signature above\\n /// @solidity memory-safe-assembly\\n assembly {\\n mstore(0x00, \\\"\\\\x19Ethereum Signed Message:\\\\n32\\\")\\n mstore(0x1c, hash)\\n message := keccak256(0x00, 0x3c)\\n }\\n }\\n\\n /**\\n * @dev Returns an Ethereum Signed Message, created from `s`. This\\n * produces hash corresponding to the one signed with the\\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\\n * JSON-RPC method as part of EIP-191.\\n *\\n * See {recover}.\\n */\\n function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) {\\n return keccak256(abi.encodePacked(\\\"\\\\x19Ethereum Signed Message:\\\\n\\\", Strings.toString(s.length), s));\\n }\\n\\n /**\\n * @dev Returns an Ethereum Signed Typed Data, created from a\\n * `domainSeparator` and a `structHash`. This produces hash corresponding\\n * to the one signed with the\\n * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`]\\n * JSON-RPC method as part of EIP-712.\\n *\\n * See {recover}.\\n */\\n function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32 data) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n let ptr := mload(0x40)\\n mstore(ptr, \\\"\\\\x19\\\\x01\\\")\\n mstore(add(ptr, 0x02), domainSeparator)\\n mstore(add(ptr, 0x22), structHash)\\n data := keccak256(ptr, 0x42)\\n }\\n }\\n\\n /**\\n * @dev Returns an Ethereum Signed Data with intended validator, created from a\\n * `validator` and `data` according to the version 0 of EIP-191.\\n *\\n * See {recover}.\\n */\\n function toDataWithIntendedValidatorHash(address validator, bytes memory data) internal pure returns (bytes32) {\\n return keccak256(abi.encodePacked(\\\"\\\\x19\\\\x00\\\", validator, data));\\n }\\n}\\n\",\"keccak256\":\"0x809bc3edb4bcbef8263fa616c1b60ee0004b50a8a1bfa164d8f57fd31f520c58\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/cryptography/SignatureChecker.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/cryptography/SignatureChecker.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./ECDSA.sol\\\";\\nimport \\\"../../interfaces/IERC1271.sol\\\";\\n\\n/**\\n * @dev Signature verification helper that can be used instead of `ECDSA.recover` to seamlessly support both ECDSA\\n * signatures from externally owned accounts (EOAs) as well as ERC1271 signatures from smart contract wallets like\\n * Argent and Gnosis Safe.\\n *\\n * _Available since v4.1._\\n */\\nlibrary SignatureChecker {\\n /**\\n * @dev Checks if a signature is valid for a given signer and data hash. If the signer is a smart contract, the\\n * signature is validated against that smart contract using ERC1271, otherwise it's validated using `ECDSA.recover`.\\n *\\n * NOTE: Unlike ECDSA signatures, contract signatures are revocable, and the outcome of this function can thus\\n * change through time. It could return true at block N and false at block N+1 (or the opposite).\\n */\\n function isValidSignatureNow(address signer, bytes32 hash, bytes memory signature) internal view returns (bool) {\\n (address recovered, ECDSA.RecoverError error) = ECDSA.tryRecover(hash, signature);\\n return\\n (error == ECDSA.RecoverError.NoError && recovered == signer) ||\\n isValidERC1271SignatureNow(signer, hash, signature);\\n }\\n\\n /**\\n * @dev Checks if a signature is valid for a given signer and data hash. The signature is validated\\n * against the signer smart contract using ERC1271.\\n *\\n * NOTE: Unlike ECDSA signatures, contract signatures are revocable, and the outcome of this function can thus\\n * change through time. It could return true at block N and false at block N+1 (or the opposite).\\n */\\n function isValidERC1271SignatureNow(\\n address signer,\\n bytes32 hash,\\n bytes memory signature\\n ) internal view returns (bool) {\\n (bool success, bytes memory result) = signer.staticcall(\\n abi.encodeWithSelector(IERC1271.isValidSignature.selector, hash, signature)\\n );\\n return (success &&\\n result.length >= 32 &&\\n abi.decode(result, (bytes32)) == bytes32(IERC1271.isValidSignature.selector));\\n }\\n}\\n\",\"keccak256\":\"0x3af3ca86df39aac39a0514c84459d691434a108d2151c8ce9d69f32e315cab80\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/ERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./IERC165.sol\\\";\\n\\n/**\\n * @dev Implementation of the {IERC165} interface.\\n *\\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\\n * for the additional interface id that will be supported. For example:\\n *\\n * ```solidity\\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\\n * }\\n * ```\\n *\\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\\n */\\nabstract contract ERC165 is IERC165 {\\n /**\\n * @dev See {IERC165-supportsInterface}.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n return interfaceId == type(IERC165).interfaceId;\\n }\\n}\\n\",\"keccak256\":\"0xd10975de010d89fd1c78dc5e8a9a7e7f496198085c151648f20cba166b32582b\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/IERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC165 standard, as defined in the\\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\\n *\\n * Implementers can declare support of contract interfaces, which can then be\\n * queried by others ({ERC165Checker}).\\n *\\n * For an implementation, see {ERC165}.\\n */\\ninterface IERC165 {\\n /**\\n * @dev Returns true if this contract implements the interface defined by\\n * `interfaceId`. See the corresponding\\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\\n * to learn more about how these ids are created.\\n *\\n * This function call must use less than 30 000 gas.\\n */\\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x447a5f3ddc18419d41ff92b3773fb86471b1db25773e07f877f548918a185bf1\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/math/Math.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/math/Math.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Standard math utilities missing in the Solidity language.\\n */\\nlibrary Math {\\n enum Rounding {\\n Down, // Toward negative infinity\\n Up, // Toward infinity\\n Zero // Toward zero\\n }\\n\\n /**\\n * @dev Returns the largest of two numbers.\\n */\\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a > b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the smallest of two numbers.\\n */\\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a < b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the average of two numbers. The result is rounded towards\\n * zero.\\n */\\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\\n // (a + b) / 2 can overflow.\\n return (a & b) + (a ^ b) / 2;\\n }\\n\\n /**\\n * @dev Returns the ceiling of the division of two numbers.\\n *\\n * This differs from standard division with `/` in that it rounds up instead\\n * of rounding down.\\n */\\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\\n // (a + b - 1) / b can overflow on addition, so we distribute.\\n return a == 0 ? 0 : (a - 1) / b + 1;\\n }\\n\\n /**\\n * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\\n * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)\\n * with further edits by Uniswap Labs also under MIT license.\\n */\\n function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) {\\n unchecked {\\n // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use\\n // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256\\n // variables such that product = prod1 * 2^256 + prod0.\\n uint256 prod0; // Least significant 256 bits of the product\\n uint256 prod1; // Most significant 256 bits of the product\\n assembly {\\n let mm := mulmod(x, y, not(0))\\n prod0 := mul(x, y)\\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\\n }\\n\\n // Handle non-overflow cases, 256 by 256 division.\\n if (prod1 == 0) {\\n // Solidity will revert if denominator == 0, unlike the div opcode on its own.\\n // The surrounding unchecked block does not change this fact.\\n // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.\\n return prod0 / denominator;\\n }\\n\\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\\n require(denominator > prod1, \\\"Math: mulDiv overflow\\\");\\n\\n ///////////////////////////////////////////////\\n // 512 by 256 division.\\n ///////////////////////////////////////////////\\n\\n // Make division exact by subtracting the remainder from [prod1 prod0].\\n uint256 remainder;\\n assembly {\\n // Compute remainder using mulmod.\\n remainder := mulmod(x, y, denominator)\\n\\n // Subtract 256 bit number from 512 bit number.\\n prod1 := sub(prod1, gt(remainder, prod0))\\n prod0 := sub(prod0, remainder)\\n }\\n\\n // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.\\n // See https://cs.stackexchange.com/q/138556/92363.\\n\\n // Does not overflow because the denominator cannot be zero at this stage in the function.\\n uint256 twos = denominator & (~denominator + 1);\\n assembly {\\n // Divide denominator by twos.\\n denominator := div(denominator, twos)\\n\\n // Divide [prod1 prod0] by twos.\\n prod0 := div(prod0, twos)\\n\\n // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.\\n twos := add(div(sub(0, twos), twos), 1)\\n }\\n\\n // Shift in bits from prod1 into prod0.\\n prod0 |= prod1 * twos;\\n\\n // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such\\n // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for\\n // four bits. That is, denominator * inv = 1 mod 2^4.\\n uint256 inverse = (3 * denominator) ^ 2;\\n\\n // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works\\n // in modular arithmetic, doubling the correct bits in each step.\\n inverse *= 2 - denominator * inverse; // inverse mod 2^8\\n inverse *= 2 - denominator * inverse; // inverse mod 2^16\\n inverse *= 2 - denominator * inverse; // inverse mod 2^32\\n inverse *= 2 - denominator * inverse; // inverse mod 2^64\\n inverse *= 2 - denominator * inverse; // inverse mod 2^128\\n inverse *= 2 - denominator * inverse; // inverse mod 2^256\\n\\n // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.\\n // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is\\n // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1\\n // is no longer required.\\n result = prod0 * inverse;\\n return result;\\n }\\n }\\n\\n /**\\n * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.\\n */\\n function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) {\\n uint256 result = mulDiv(x, y, denominator);\\n if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {\\n result += 1;\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.\\n *\\n * Inspired by Henry S. Warren, Jr.'s \\\"Hacker's Delight\\\" (Chapter 11).\\n */\\n function sqrt(uint256 a) internal pure returns (uint256) {\\n if (a == 0) {\\n return 0;\\n }\\n\\n // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.\\n //\\n // We know that the \\\"msb\\\" (most significant bit) of our target number `a` is a power of 2 such that we have\\n // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\\n //\\n // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\\n // \\u2192 `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\\n // \\u2192 `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\\n //\\n // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\\n uint256 result = 1 << (log2(a) >> 1);\\n\\n // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,\\n // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at\\n // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision\\n // into the expected uint128 result.\\n unchecked {\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n return min(result, a / result);\\n }\\n }\\n\\n /**\\n * @notice Calculates sqrt(a), following the selected rounding direction.\\n */\\n function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = sqrt(a);\\n return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 2, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log2(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >> 128 > 0) {\\n value >>= 128;\\n result += 128;\\n }\\n if (value >> 64 > 0) {\\n value >>= 64;\\n result += 64;\\n }\\n if (value >> 32 > 0) {\\n value >>= 32;\\n result += 32;\\n }\\n if (value >> 16 > 0) {\\n value >>= 16;\\n result += 16;\\n }\\n if (value >> 8 > 0) {\\n value >>= 8;\\n result += 8;\\n }\\n if (value >> 4 > 0) {\\n value >>= 4;\\n result += 4;\\n }\\n if (value >> 2 > 0) {\\n value >>= 2;\\n result += 2;\\n }\\n if (value >> 1 > 0) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log2(value);\\n return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 10, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log10(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >= 10 ** 64) {\\n value /= 10 ** 64;\\n result += 64;\\n }\\n if (value >= 10 ** 32) {\\n value /= 10 ** 32;\\n result += 32;\\n }\\n if (value >= 10 ** 16) {\\n value /= 10 ** 16;\\n result += 16;\\n }\\n if (value >= 10 ** 8) {\\n value /= 10 ** 8;\\n result += 8;\\n }\\n if (value >= 10 ** 4) {\\n value /= 10 ** 4;\\n result += 4;\\n }\\n if (value >= 10 ** 2) {\\n value /= 10 ** 2;\\n result += 2;\\n }\\n if (value >= 10 ** 1) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log10(value);\\n return result + (rounding == Rounding.Up && 10 ** result < value ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 256, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n *\\n * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\\n */\\n function log256(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >> 128 > 0) {\\n value >>= 128;\\n result += 16;\\n }\\n if (value >> 64 > 0) {\\n value >>= 64;\\n result += 8;\\n }\\n if (value >> 32 > 0) {\\n value >>= 32;\\n result += 4;\\n }\\n if (value >> 16 > 0) {\\n value >>= 16;\\n result += 2;\\n }\\n if (value >> 8 > 0) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 256, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log256(value);\\n return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0);\\n }\\n }\\n}\\n\",\"keccak256\":\"0xe4455ac1eb7fc497bb7402579e7b4d64d928b846fce7d2b6fde06d366f21c2b3\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/math/SignedMath.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Standard signed math utilities missing in the Solidity language.\\n */\\nlibrary SignedMath {\\n /**\\n * @dev Returns the largest of two signed numbers.\\n */\\n function max(int256 a, int256 b) internal pure returns (int256) {\\n return a > b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the smallest of two signed numbers.\\n */\\n function min(int256 a, int256 b) internal pure returns (int256) {\\n return a < b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the average of two signed numbers without overflow.\\n * The result is rounded towards zero.\\n */\\n function average(int256 a, int256 b) internal pure returns (int256) {\\n // Formula from the book \\\"Hacker's Delight\\\"\\n int256 x = (a & b) + ((a ^ b) >> 1);\\n return x + (int256(uint256(x) >> 255) & (a ^ b));\\n }\\n\\n /**\\n * @dev Returns the absolute unsigned value of a signed value.\\n */\\n function abs(int256 n) internal pure returns (uint256) {\\n unchecked {\\n // must be unchecked in order to support `n = type(int256).min`\\n return uint256(n >= 0 ? n : -n);\\n }\\n }\\n}\\n\",\"keccak256\":\"0xf92515413956f529d95977adc9b0567d583c6203fc31ab1c23824c35187e3ddc\",\"license\":\"MIT\"},\"contracts/ChargedParticles.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\npragma solidity ^0.8.13;\\n\\nimport {IERC165} from \\\"@openzeppelin/contracts/utils/introspection/IERC165.sol\\\";\\nimport {IERC721} from \\\"@openzeppelin/contracts/token/ERC721/IERC721.sol\\\";\\nimport {IERC1155} from \\\"@openzeppelin/contracts/token/ERC1155/IERC1155.sol\\\";\\nimport {IERC20} from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport {Ownable} from \\\"@openzeppelin/contracts/access/Ownable.sol\\\";\\nimport {ReentrancyGuard} from \\\"@openzeppelin/contracts/security/ReentrancyGuard.sol\\\";\\n\\nimport {IERC6551Registry} from \\\"./interfaces/IERC6551Registry.sol\\\";\\nimport {IChargedParticles} from \\\"./interfaces/IChargedParticles.sol\\\";\\nimport {NftTokenInfo} from \\\"./lib/NftTokenInfo.sol\\\";\\nimport {ISmartAccount} from \\\"./interfaces/ISmartAccount.sol\\\";\\nimport {ISmartAccountController} from \\\"./interfaces/ISmartAccountController.sol\\\";\\nimport {IDynamicTraits} from \\\"./interfaces/IDynamicTraits.sol\\\";\\nimport {SmartAccountTimelocks} from \\\"./extensions/SmartAccountTimelocks.sol\\\";\\n\\n// import \\\"hardhat/console.sol\\\";\\n\\ncontract ChargedParticles is IChargedParticles, Ownable, ReentrancyGuard {\\n using NftTokenInfo for address;\\n\\n // NFT contract => SmartAccount Implementation\\n mapping (address => address) internal accountImplementations;\\n address internal defaultAccountImplementation;\\n\\n // NFT contract => Execution Controller\\n mapping (address => address) internal executionControllers;\\n address internal defaultExecutionController;\\n\\n // Registry Version => Registry Address\\n mapping (uint256 => address) internal erc6551registry;\\n uint256 internal defaultRegistry;\\n\\n\\n // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\\n // Initialization\\n\\n constructor(address registry) Ownable() ReentrancyGuard() {\\n erc6551registry[defaultRegistry] = registry;\\n defaultAccountImplementation = address(new SmartAccountTimelocks());\\n }\\n\\n\\n // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\\n // Energize (Deposit)\\n\\n /// @notice Fund Particle with Asset Token\\n /// Must be called by the account providing the Asset\\n /// Account must Approve THIS contract as Operator of Asset\\n ///\\n /// @param contractAddress The Address to the Contract of the Token to Energize\\n /// @param tokenId The ID of the Token to Energize\\n /// @param assetToken The Address of the Asset Token being used\\n /// @param assetAmount The Amount of Asset Token to Energize the Token with\\n function energizeParticle(\\n address contractAddress,\\n uint256 tokenId,\\n address assetToken,\\n uint256 assetAmount\\n )\\n external\\n virtual\\n override\\n nonReentrant\\n returns (address account)\\n {\\n // Find the SmartAccount for this NFT\\n IERC6551Registry registry = IERC6551Registry(erc6551registry[defaultRegistry]);\\n address accountImpl = getAccountImplementation(contractAddress);\\n account = registry.createAccount(accountImpl, bytes32(0), block.chainid, contractAddress, tokenId);\\n ISmartAccount smartAccount = ISmartAccount(payable(account));\\n\\n // Initialize the Account\\n if (!smartAccount.isInitialized()) {\\n address executionController = getExecutionController(contractAddress);\\n smartAccount.initialize(address(this), executionController);\\n }\\n\\n // Transfer to SmartAccount\\n IERC20(assetToken).transferFrom(msg.sender, account, assetAmount);\\n\\n // Pre-approve Charged Particles to transfer back out\\n smartAccount.execute(assetToken, 0, abi.encodeWithSelector(IERC20.approve.selector, address(this), type(uint256).max), 0);\\n\\n // Call \\\"update\\\" on SmartAccount\\n if (IERC165(account).supportsInterface(type(ISmartAccount).interfaceId)) {\\n smartAccount.handleTokenUpdate(true, assetToken, assetAmount);\\n }\\n }\\n\\n\\n // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\\n // Release (Withdraw)\\n\\n function releaseParticle(\\n address receiver,\\n address contractAddress,\\n uint256 tokenId,\\n address assetToken\\n )\\n external\\n virtual\\n override\\n onlyNFTOwnerOrOperator(contractAddress, tokenId)\\n nonReentrant\\n returns (uint256 amount)\\n {\\n // Find the SmartAccount for this NFT\\n IERC6551Registry registry = IERC6551Registry(erc6551registry[defaultRegistry]);\\n address accountImpl = getAccountImplementation(contractAddress);\\n address account = registry.account(accountImpl, bytes32(0), block.chainid, contractAddress, tokenId);\\n\\n // Transfer to Receiver\\n amount = IERC20(assetToken).balanceOf(account);\\n IERC20(assetToken).transferFrom(account, receiver, amount);\\n\\n // Call \\\"update\\\" on SmartAccount\\n if (IERC165(account).supportsInterface(type(ISmartAccount).interfaceId)) {\\n ISmartAccount(payable(account)).handleTokenUpdate(false, assetToken, amount);\\n }\\n }\\n\\n function releaseParticleAmount(\\n address receiver,\\n address contractAddress,\\n uint256 tokenId,\\n address assetToken,\\n uint256 assetAmount\\n )\\n external\\n virtual\\n override\\n onlyNFTOwnerOrOperator(contractAddress, tokenId)\\n nonReentrant\\n returns (uint256)\\n {\\n // Find the SmartAccount for this NFT\\n IERC6551Registry registry = IERC6551Registry(erc6551registry[defaultRegistry]);\\n address accountImpl = getAccountImplementation(contractAddress);\\n address account = registry.account(accountImpl, bytes32(0), block.chainid, contractAddress, tokenId);\\n\\n // Transfer to Receiver\\n IERC20(assetToken).transferFrom(account, receiver, assetAmount);\\n\\n // Call \\\"update\\\" on SmartAccount\\n if (IERC165(account).supportsInterface(type(ISmartAccount).interfaceId)) {\\n ISmartAccount(payable(account)).handleTokenUpdate(false, assetToken, assetAmount);\\n }\\n\\n return assetAmount;\\n }\\n\\n\\n // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\\n // Covalent Bonds (Nested NFTs)\\n\\n /// @notice Deposit other NFT Assets into the Particle\\n /// Must be called by the account providing the Asset\\n /// Account must Approve THIS contract as Operator of Asset\\n ///\\n /// @param contractAddress The Address to the Contract of the Token to Energize\\n /// @param tokenId The ID of the Token to Energize\\n /// @param nftTokenAddress The Address of the NFT Token being deposited\\n /// @param nftTokenId The ID of the NFT Token being deposited\\n /// @param nftTokenAmount The amount of Tokens to Deposit (ERC1155-specific)\\n function covalentBond(\\n address contractAddress,\\n uint256 tokenId,\\n address nftTokenAddress,\\n uint256 nftTokenId,\\n uint256 nftTokenAmount\\n )\\n external\\n virtual\\n override\\n nonReentrant\\n returns (bool success)\\n {\\n // Find the SmartAccount for this NFT\\n IERC6551Registry registry = IERC6551Registry(erc6551registry[defaultRegistry]);\\n address accountImpl = getAccountImplementation(contractAddress);\\n address account = registry.createAccount(accountImpl, bytes32(0), block.chainid, contractAddress, tokenId);\\n ISmartAccount smartAccount = ISmartAccount(payable(account));\\n\\n // Initialize the Account\\n if (!smartAccount.isInitialized()) {\\n address executionController = getExecutionController(contractAddress);\\n smartAccount.initialize(address(this), executionController);\\n }\\n\\n // Transfer to SmartAccount and pre-approve Charged Particles to transfer back out\\n if (nftTokenAddress.isERC1155()) {\\n IERC1155(nftTokenAddress).safeTransferFrom(msg.sender, account, tokenId, nftTokenAmount, \\\"\\\");\\n smartAccount.execute(nftTokenAddress, 0, abi.encodeWithSelector(IERC1155.setApprovalForAll.selector, address(this), true), 0);\\n } else {\\n IERC721(nftTokenAddress).safeTransferFrom(msg.sender, account, nftTokenId);\\n smartAccount.execute(nftTokenAddress, 0, abi.encodeWithSelector(IERC721.setApprovalForAll.selector, address(this), true), 0);\\n }\\n\\n // Call \\\"update\\\" on SmartAccount\\n if (IERC165(account).supportsInterface(type(ISmartAccount).interfaceId)) {\\n smartAccount.handleNFTUpdate(true, nftTokenAddress, nftTokenId, nftTokenAmount);\\n }\\n return true;\\n }\\n\\n /// @notice Release NFT Assets from the Particle\\n /// @param receiver The Address to Receive the Released Asset Tokens\\n /// @param contractAddress The Address to the Contract of the Token to Energize\\n /// @param tokenId The ID of the Token to Energize\\n /// @param nftTokenAddress The Address of the NFT Token being deposited\\n /// @param nftTokenId The ID of the NFT Token being deposited\\n /// @param nftTokenAmount The amount of Tokens to Withdraw (ERC1155-specific)\\n function breakCovalentBond(\\n address receiver,\\n address contractAddress,\\n uint256 tokenId,\\n address nftTokenAddress,\\n uint256 nftTokenId,\\n uint256 nftTokenAmount\\n )\\n external\\n virtual\\n override\\n onlyNFTOwnerOrOperator(contractAddress, tokenId)\\n nonReentrant\\n returns (bool success)\\n {\\n // Find the SmartAccount for this NFT\\n IERC6551Registry registry = IERC6551Registry(erc6551registry[defaultRegistry]);\\n address accountImpl = getAccountImplementation(contractAddress);\\n address account = registry.account(accountImpl, bytes32(0), block.chainid, contractAddress, tokenId);\\n\\n // Transfer to Receiver\\n if (nftTokenAddress.isERC1155()) {\\n IERC1155(nftTokenAddress).safeTransferFrom(account, receiver, tokenId, nftTokenAmount, \\\"\\\");\\n } else {\\n IERC721(nftTokenAddress).safeTransferFrom(account, receiver, nftTokenId);\\n }\\n\\n // Call \\\"update\\\" on SmartAccount\\n if (IERC165(account).supportsInterface(type(ISmartAccount).interfaceId)) {\\n ISmartAccount(payable(account)).handleNFTUpdate(false, nftTokenAddress, nftTokenId, nftTokenAmount);\\n }\\n\\n return true;\\n }\\n\\n\\n // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\\n // ERC6551 Wallet Registry\\n\\n /// @dev ...\\n function getCurrentRegistry() external view returns (address) {\\n return erc6551registry[defaultRegistry];\\n }\\n\\n /// @dev ...\\n function getRegistry(uint256 registry) external view returns (address) {\\n return erc6551registry[registry];\\n }\\n\\n /// @dev ...\\n function setRegistry(uint256 version, address registry) external onlyOwner {\\n erc6551registry[version] = registry;\\n }\\n\\n /// @dev ...\\n function setDefaultRegistryVersion(uint256 version) external onlyOwner {\\n defaultRegistry = version;\\n }\\n\\n\\n // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\\n // SmartAccount Execution Controllers\\n // - any NFT contract can have its own custom execution controller\\n\\n /// @dev ...\\n function setDefaultExecutionController(address executionController) public virtual onlyOwner {\\n defaultExecutionController = executionController;\\n }\\n\\n /// @dev ...\\n function setCustomExecutionController(address nftContract, address executionController) public virtual onlyOwner {\\n executionControllers[nftContract] = executionController;\\n }\\n\\n /// @dev ...\\n function getExecutionController(address nftContract) public view returns (address executionController) {\\n executionController = executionControllers[nftContract];\\n if (executionController == address(0)) {\\n executionController = defaultExecutionController;\\n }\\n }\\n\\n\\n // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\\n // SmartAccount Implementations\\n // - any NFT contract can have its own custom execution controller\\n\\n /// @dev ...\\n function setDefaultAccountImplementation(address accountImplementation) public virtual onlyOwner {\\n defaultAccountImplementation = accountImplementation;\\n }\\n\\n /// @dev ...\\n function setCustomAccountImplementation(address nftContract, address accountImplementation) public virtual onlyOwner {\\n accountImplementations[nftContract] = accountImplementation;\\n }\\n\\n /// @dev ...\\n function getAccountImplementation(address nftContract) public view returns (address accountImplementation) {\\n accountImplementation = accountImplementations[nftContract];\\n if (accountImplementation == address(0)) {\\n accountImplementation = defaultAccountImplementation;\\n }\\n }\\n\\n\\n // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\\n // Internal Modifiers\\n\\n modifier onlyNFTOwnerOrOperator(address contractAddress, uint256 tokenId) {\\n require(contractAddress.isNFTOwnerOrOperator(tokenId, msg.sender), \\\"Invalid owner or operator\\\");\\n _;\\n }\\n}\\n\",\"keccak256\":\"0x66a4169949f6dfe6f1c7afef028916844559f2ffb4fe39cd2c3c2ece7f014bbe\",\"license\":\"UNLICENSED\"},\"contracts/SmartAccount.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\npragma solidity ^0.8.13;\\n\\nimport {IERC165} from \\\"@openzeppelin/contracts/utils/introspection/IERC165.sol\\\";\\nimport {SmartAccountBase, NotAuthorized, InvalidInput} from \\\"./lib/SmartAccountBase.sol\\\";\\n\\n/**\\n * @title A smart contract account owned by a single ERC721 token\\n */\\ncontract SmartAccount is SmartAccountBase {\\n uint256 public state;\\n\\n constructor() SmartAccountBase() {}\\n\\n\\n /// @dev allows eth transfers by default\\n receive() external payable virtual override {}\\n\\n /// @dev executes a low-level call against an account if the caller is authorized to make calls\\n function execute(\\n address to,\\n uint256 value,\\n bytes calldata data,\\n uint8 operation\\n )\\n public\\n payable\\n virtual\\n override\\n onlyValidSigner\\n returns (bytes memory)\\n {\\n require(operation == 0, \\\"Only call operations are supported\\\");\\n ++state;\\n\\n // Perform custom checks/updates from within a custom controller\\n _onExecute(to, value, data, operation);\\n\\n // Execute Call on Account\\n return _call(to, value, data);\\n }\\n\\n\\n function handleTokenUpdate(\\n bool isReceiving,\\n address assetToken,\\n uint256 assetAmount\\n )\\n public\\n virtual\\n override\\n onlyValidSigner\\n {\\n // Perform custom checks/updates from within a custom controller\\n _onUpdateToken(isReceiving, assetToken, assetAmount);\\n }\\n\\n function handleNFTUpdate(\\n bool isReceiving,\\n address tokenContract,\\n uint256 tokenId,\\n uint256 tokenAmount\\n )\\n public\\n virtual\\n override\\n onlyValidSigner\\n {\\n // Perform custom checks/updates from within a custom controller\\n _onUpdateNFT(isReceiving, tokenContract, tokenId, tokenAmount);\\n }\\n\\n function handleNFTBatchUpdate(\\n bool isReceiving,\\n address tokenContract,\\n uint256[] calldata tokenIds,\\n uint256[] calldata tokenAmounts\\n )\\n public\\n virtual\\n override\\n onlyValidSigner\\n {\\n // Perform custom checks/updates from within a custom controller\\n _onUpdateNFTBatch(isReceiving, tokenContract, tokenIds, tokenAmounts);\\n }\\n}\\n\",\"keccak256\":\"0x5c6be5a56047e471fab21971be83da357154f7eb36ed87500f810c3db44bb315\",\"license\":\"UNLICENSED\"},\"contracts/extensions/SmartAccountTimelocks.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\npragma solidity ^0.8.13;\\n\\nimport {SmartAccount} from \\\"../SmartAccount.sol\\\";\\n\\nerror AccountLocked();\\nerror ExceedsMaxLockTime();\\n\\n/**\\n * @title A smart contract account owned by a single ERC721 token\\n */\\ncontract SmartAccountTimelocks is SmartAccount {\\n event LockUpdated(uint256 lockedUntil);\\n\\n /// @dev timestamp at which this account will be unlocked.\\n /// Attached to \\\"owner\\\" so that the lock is cleared when transferred.\\n mapping(address => uint256) public lockedUntil;\\n\\n constructor() SmartAccount() {}\\n\\n /// @dev returns the current lock status of the account as a boolean\\n function isLocked() public view returns (bool) {\\n return lockedUntil[owner()] > block.timestamp;\\n }\\n\\n /// @dev locks the account until a certain timestamp\\n function lock(uint256 _lockedUntil) external onlyValidSigner {\\n if (_lockedUntil > block.timestamp + 365 days) {\\n revert ExceedsMaxLockTime();\\n }\\n\\n lockedUntil[owner()] = _lockedUntil;\\n\\n emit LockUpdated(_lockedUntil);\\n }\\n\\n /// @dev grants a given caller execution permissions\\n function setPermissions(\\n address[] calldata callers,\\n bool[] calldata _permissions\\n ) public virtual override {\\n if (isLocked()) {\\n revert AccountLocked();\\n }\\n return super.setPermissions(callers, _permissions);\\n }\\n\\n /// @dev executes a low-level call against an account if the caller is authorized to make calls\\n function execute(\\n address to,\\n uint256 value,\\n bytes calldata data,\\n uint8 operation\\n ) public payable virtual override returns (bytes memory) {\\n if (isLocked()) { revert AccountLocked(); }\\n return super.execute(to, value, data, operation);\\n }\\n\\n function handleTokenUpdate(\\n bool isReceiving,\\n address assetToken,\\n uint256 assetAmount\\n ) public virtual override {\\n if (isLocked()) { revert AccountLocked(); }\\n return super.handleTokenUpdate(isReceiving, assetToken, assetAmount);\\n }\\n\\n function handleNFTUpdate(\\n bool isReceiving,\\n address tokenContract,\\n uint256 tokenId,\\n uint256 tokenAmount\\n ) public virtual override {\\n if (isLocked()) { revert AccountLocked(); }\\n return super.handleNFTUpdate(isReceiving, tokenContract, tokenId, tokenAmount);\\n }\\n\\n function handleNFTBatchUpdate(\\n bool isReceiving,\\n address tokenContract,\\n uint256[] calldata tokenIds,\\n uint256[] calldata tokenAmounts\\n ) public virtual override {\\n if (isLocked()) { revert AccountLocked(); }\\n return super.handleNFTBatchUpdate(isReceiving, tokenContract, tokenIds, tokenAmounts);\\n }\\n}\\n\",\"keccak256\":\"0xfb2b084710eecc2f939faa432adbee9babe032275942d89c95f39ccd37646e1b\",\"license\":\"UNLICENSED\"},\"contracts/interfaces/IChargedParticles.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\n// IChargedParticles.sol -- Part of the Charged Particles Protocol\\n// Copyright (c) 2021 Firma Lux, Inc. \\n//\\n// Permission is hereby granted, free of charge, to any person obtaining a copy\\n// of this software and associated documentation files (the \\\"Software\\\"), to deal\\n// in the Software without restriction, including without limitation the rights\\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\\n// copies of the Software, and to permit persons to whom the Software is\\n// furnished to do so, subject to the following conditions:\\n//\\n// The above copyright notice and this permission notice shall be included in all\\n// copies or substantial portions of the Software.\\n//\\n// THE SOFTWARE IS PROVIDED \\\"AS IS\\\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\\n// FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE\\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\\n// SOFTWARE.\\n\\npragma solidity ^0.8.13;\\n\\n/**\\n * @notice Interface for Charged Particles\\n */\\ninterface IChargedParticles {\\n\\n function setDefaultExecutionController(address executionController) external;\\n function setCustomExecutionController(address nftContract, address executionController) external;\\n function getExecutionController(address nftContract) external view returns (address executionController);\\n\\n function setDefaultAccountImplementation(address accountImplementation) external;\\n function setCustomAccountImplementation(address nftContract, address accountImplementation) external;\\n function getAccountImplementation(address nftContract) external view returns (address accountImplementation);\\n\\n /***********************************|\\n | Particle Mechanics |\\n |__________________________________*/\\n\\n function energizeParticle(\\n address contractAddress,\\n uint256 tokenId,\\n address assetToken,\\n uint256 assetAmount\\n ) external returns (address account);\\n\\n function releaseParticle(\\n address receiver,\\n address contractAddress,\\n uint256 tokenId,\\n address assetToken\\n ) external returns (uint256 amount);\\n\\n function releaseParticleAmount(\\n address receiver,\\n address contractAddress,\\n uint256 tokenId,\\n address assetToken,\\n uint256 assetAmount\\n ) external returns (uint256 amount);\\n\\n function covalentBond(\\n address contractAddress,\\n uint256 tokenId,\\n address nftTokenAddress,\\n uint256 nftTokenId,\\n uint256 nftTokenAmount\\n ) external returns (bool success);\\n\\n function breakCovalentBond(\\n address receiver,\\n address contractAddress,\\n uint256 tokenId,\\n address nftTokenAddress,\\n uint256 nftTokenId,\\n uint256 nftTokenAmount\\n ) external returns (bool success);\\n}\\n\",\"keccak256\":\"0x56efea6fe7c7ca90515aaa4caf8a737c82a2b9217c89125a3ceb069a2bc26c19\",\"license\":\"MIT\"},\"contracts/interfaces/IDynamicTraits.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\n// IDynamicTraits.sol -- Part of the Charged Particles Protocol\\n// Copyright (c) 2023 Firma Lux, Inc. \\n//\\n// Permission is hereby granted, free of charge, to any person obtaining a copy\\n// of this software and associated documentation files (the \\\"Software\\\"), to deal\\n// in the Software without restriction, including without limitation the rights\\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\\n// copies of the Software, and to permit persons to whom the Software is\\n// furnished to do so, subject to the following conditions:\\n//\\n// The above copyright notice and this permission notice shall be included in all\\n// copies or substantial portions of the Software.\\n//\\n// THE SOFTWARE IS PROVIDED \\\"AS IS\\\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\\n// FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE\\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\\n// SOFTWARE.\\n\\npragma solidity ^0.8.13;\\n\\ninterface IDynamicTraits {\\n function getTraits(uint256 tokenId) external view returns (uint256);\\n function hasTrait(uint256 tokenId, uint256 trait) external view returns (bool);\\n function traitCount(uint256 tokenId) external view returns (uint256 totalTraits);\\n}\\n\",\"keccak256\":\"0xc63aaf534e9f13272f88caa97fb6f2d1e5047b932d9b05f6467c243c82fd1023\",\"license\":\"MIT\"},\"contracts/interfaces/IERC6551Account.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\npragma solidity ^0.8.13;\\n\\n/// @dev the ERC-165 identifier for this interface is `0x6faff5f1`\\ninterface IERC6551Account {\\n /**\\n * @dev Allows the account to receive Ether.\\n *\\n * Accounts MUST implement a `receive` function.\\n *\\n * Accounts MAY perform arbitrary logic to restrict conditions\\n * under which Ether can be received.\\n */\\n receive() external payable;\\n\\n /**\\n * @dev Returns the identifier of the non-fungible token which owns the account.\\n *\\n * The return value of this function MUST be constant - it MUST NOT change over time.\\n *\\n * @return chainId The chain ID of the chain the token exists on\\n * @return tokenContract The contract address of the token\\n * @return tokenId The ID of the token\\n */\\n function token()\\n external\\n view\\n returns (uint256 chainId, address tokenContract, uint256 tokenId);\\n\\n /**\\n * @dev Returns a value that SHOULD be modified each time the account changes state.\\n *\\n * @return The current account state\\n */\\n function state() external view returns (uint256);\\n\\n /**\\n * @dev Returns a magic value indicating whether a given signer is authorized to act on behalf\\n * of the account.\\n *\\n * MUST return the bytes4 magic value 0x523e3260 if the given signer is valid.\\n *\\n * By default, the holder of the non-fungible token the account is bound to MUST be considered\\n * a valid signer.\\n *\\n * Accounts MAY implement additional authorization logic which invalidates the holder as a\\n * signer or grants signing permissions to other non-holder accounts.\\n *\\n * @param signer The address to check signing authorization for\\n * @param context Additional data used to determine whether the signer is valid\\n * @return magicValue Magic value indicating whether the signer is valid\\n */\\n function isValidSigner(address signer, bytes calldata context)\\n external\\n view\\n returns (bytes4 magicValue);\\n}\\n\\n\",\"keccak256\":\"0x9972b9769e138d0f5855d5f0990dc9942977088e6fc5a9b1e289431f8e213339\",\"license\":\"UNLICENSED\"},\"contracts/interfaces/IERC6551Executable.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\npragma solidity ^0.8.13;\\n\\n/// @dev the ERC-165 identifier for this interface is `0x51945447`\\ninterface IERC6551Executable {\\n /**\\n * @dev Executes a low-level operation if the caller is a valid signer on the account.\\n *\\n * Reverts and bubbles up error if operation fails.\\n *\\n * Accounts implementing this interface MUST accept the following operation parameter values:\\n * - 0 = CALL\\n * - 1 = DELEGATECALL\\n * - 2 = CREATE\\n * - 3 = CREATE2\\n *\\n * Accounts implementing this interface MAY support additional operations or restrict a signer's\\n * ability to execute certain operations.\\n *\\n * @param to The target address of the operation\\n * @param value The Ether value to be sent to the target\\n * @param data The encoded operation calldata\\n * @param operation A value indicating the type of operation to perform\\n * @return The result of the operation\\n */\\n function execute(address to, uint256 value, bytes calldata data, uint8 operation)\\n external\\n payable\\n returns (bytes memory);\\n}\\n\",\"keccak256\":\"0x4b24c8509ccf2fc6fd9744df0c994809133522991951dc7c467120b04f683051\",\"license\":\"UNLICENSED\"},\"contracts/interfaces/IERC6551Registry.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\npragma solidity ^0.8.13;\\ninterface IERC6551Registry {\\n /**\\n * @dev The registry MUST emit the ERC6551AccountCreated event upon successful account creation.\\n */\\n event ERC6551AccountCreated(\\n address account,\\n address indexed implementation,\\n bytes32 salt,\\n uint256 chainId,\\n address indexed tokenContract,\\n uint256 indexed tokenId\\n );\\n\\n /**\\n * @dev The registry MUST revert with AccountCreationFailed error if the create2 operation fails.\\n */\\n error AccountCreationFailed();\\n\\n /**\\n * @dev Creates a token bound account for a non-fungible token.\\n *\\n * If account has already been created, returns the account address without calling create2.\\n *\\n * Emits ERC6551AccountCreated event.\\n *\\n * @return account The address of the token bound account\\n */\\n function createAccount(\\n address implementation,\\n bytes32 salt,\\n uint256 chainId,\\n address tokenContract,\\n uint256 tokenId\\n ) external returns (address account);\\n\\n /**\\n * @dev Returns the computed token bound account address for a non-fungible token.\\n *\\n * @return account The address of the token bound account\\n */\\n function account(\\n address implementation,\\n bytes32 salt,\\n uint256 chainId,\\n address tokenContract,\\n uint256 tokenId\\n ) external view returns (address account);\\n}\",\"keccak256\":\"0x643509231801358c05e209b3498173d9562e24bc268a8f40a23a2e2fcf5acc1d\",\"license\":\"UNLICENSED\"},\"contracts/interfaces/ISmartAccount.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\npragma solidity ^0.8.13;\\n\\nimport {IERC6551Account} from \\\"../interfaces/IERC6551Account.sol\\\";\\nimport {IERC6551Executable} from \\\"../interfaces/IERC6551Executable.sol\\\";\\n\\nimport {IERC165} from \\\"@openzeppelin/contracts/utils/introspection/IERC165.sol\\\";\\nimport {IERC721Receiver} from \\\"@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol\\\";\\nimport {IERC1155Receiver} from \\\"@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol\\\";\\n\\n/**\\n * @title A smart contract account owned by a single ERC721 token\\n */\\ninterface ISmartAccount is\\n IERC165,\\n IERC6551Account,\\n IERC6551Executable,\\n IERC721Receiver,\\n IERC1155Receiver\\n{\\n event PermissionUpdated(address owner, address caller, bool hasPermission);\\n event ExecutionControllerUpdated(address owner, address controller);\\n\\n function isInitialized() external returns (bool);\\n function initialize(address chargedParticles, address executionController) external;\\n\\n function handleTokenUpdate(\\n bool isReceiving,\\n address assetToken,\\n uint256 assetAmount\\n ) external;\\n\\n function handleNFTUpdate(\\n bool isReceiving,\\n address tokenContract,\\n uint256 tokenId,\\n uint256 tokenAmount\\n ) external;\\n\\n function handleNFTBatchUpdate(\\n bool isReceiving,\\n address tokenContract,\\n uint256[] calldata tokenIds,\\n uint256[] calldata tokenAmounts\\n ) external;\\n}\\n\",\"keccak256\":\"0x3e1d81240184e57b095cbec255a3bb78e044c3d1328b5e5cdf8d69f61bf5df58\",\"license\":\"UNLICENSED\"},\"contracts/interfaces/ISmartAccountController.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\npragma solidity ^0.8.13;\\n\\nimport {IERC165} from \\\"@openzeppelin/contracts/utils/introspection/IERC165.sol\\\";\\n\\n/**\\n * @title\\n */\\ninterface ISmartAccountController is IERC165 {\\n function onExecute(\\n address to,\\n uint256 value,\\n bytes calldata data,\\n uint8 operation\\n ) external returns (string memory revertReason);\\n\\n function onUpdateToken(\\n bool isReceiving,\\n uint256 chainId,\\n address tokenContract,\\n uint256 tokenId,\\n address receivedAssetToken,\\n uint256 receivedAssetAmount\\n ) external;\\n\\n function onUpdateNFT(\\n bool isReceiving,\\n uint256 chainId,\\n address tokenContract,\\n uint256 tokenId,\\n address receivedTokenContract,\\n uint256 receivedTokenId,\\n uint256 receivedTokenAmount\\n ) external;\\n\\n function onUpdateNFTBatch(\\n bool isReceiving,\\n uint256 chainId,\\n address tokenContract,\\n uint256 tokenId,\\n address receivedTokenContract,\\n uint256[] calldata receivedTokenIds,\\n uint256[] calldata receivedTokenAmounts\\n ) external;\\n}\\n\",\"keccak256\":\"0x5e88c28a39826906d5490c52fc767d7f3e3a6536b13e9949f7d689f378213001\",\"license\":\"UNLICENSED\"},\"contracts/lib/ERC6551AccountLib.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport \\\"@openzeppelin/contracts/utils/Create2.sol\\\";\\nimport \\\"./ERC6551BytecodeLib.sol\\\";\\n\\nlibrary ERC6551AccountLib {\\n function computeAddress(\\n address registry,\\n address _implementation,\\n bytes32 _salt,\\n uint256 chainId,\\n address tokenContract,\\n uint256 tokenId\\n ) internal pure returns (address) {\\n bytes32 bytecodeHash = keccak256(\\n ERC6551BytecodeLib.getCreationCode(\\n _implementation, _salt, chainId, tokenContract, tokenId\\n )\\n );\\n\\n return Create2.computeAddress(_salt, bytecodeHash, registry);\\n }\\n\\n function isERC6551Account(address account, address expectedImplementation, address registry)\\n internal\\n view\\n returns (bool)\\n {\\n // invalid bytecode size\\n if (account.code.length != 0xAD) return false;\\n\\n address _implementation = implementation(account);\\n\\n // implementation does not exist\\n if (_implementation.code.length == 0) return false;\\n\\n // invalid implementation\\n if (_implementation != expectedImplementation) return false;\\n\\n (bytes32 _salt, uint256 chainId, address tokenContract, uint256 tokenId) = context(account);\\n\\n return account\\n == computeAddress(registry, _implementation, _salt, chainId, tokenContract, tokenId);\\n }\\n\\n function implementation(address account) internal view returns (address _implementation) {\\n assembly {\\n // copy proxy implementation (0x14 bytes)\\n extcodecopy(account, 0xC, 0xA, 0x14)\\n _implementation := mload(0x00)\\n }\\n }\\n\\n function implementation() internal view returns (address _implementation) {\\n return implementation(address(this));\\n }\\n\\n function token(address account) internal view returns (uint256, address, uint256) {\\n bytes memory encodedData = new bytes(0x60);\\n\\n assembly {\\n // copy 0x60 bytes from end of context\\n extcodecopy(account, add(encodedData, 0x20), 0x4d, 0x60)\\n }\\n\\n return abi.decode(encodedData, (uint256, address, uint256));\\n }\\n\\n function token() internal view returns (uint256, address, uint256) {\\n return token(address(this));\\n }\\n\\n function salt(address account) internal view returns (bytes32) {\\n bytes memory encodedData = new bytes(0x20);\\n\\n assembly {\\n // copy 0x20 bytes from beginning of context\\n extcodecopy(account, add(encodedData, 0x20), 0x2d, 0x20)\\n }\\n\\n return abi.decode(encodedData, (bytes32));\\n }\\n\\n function salt() internal view returns (bytes32) {\\n return salt(address(this));\\n }\\n\\n function context(address account) internal view returns (bytes32, uint256, address, uint256) {\\n bytes memory encodedData = new bytes(0x80);\\n\\n assembly {\\n // copy full context (0x80 bytes)\\n extcodecopy(account, add(encodedData, 0x20), 0x2D, 0x80)\\n }\\n\\n return abi.decode(encodedData, (bytes32, uint256, address, uint256));\\n }\\n\\n function context() internal view returns (bytes32, uint256, address, uint256) {\\n return context(address(this));\\n }\\n}\",\"keccak256\":\"0x5f8d8bcdc3a5ef2364826050ff085a55715b18a9c119111121c306d44b006215\",\"license\":\"MIT\"},\"contracts/lib/ERC6551BytecodeLib.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.4;\\n\\nlibrary ERC6551BytecodeLib {\\n /**\\n * @dev Returns the creation code of the token bound account for a non-fungible token.\\n *\\n * @return result The creation code of the token bound account\\n */\\n function getCreationCode(\\n address implementation,\\n bytes32 salt,\\n uint256 chainId,\\n address tokenContract,\\n uint256 tokenId\\n ) internal pure returns (bytes memory result) {\\n assembly {\\n result := mload(0x40) // Grab the free memory pointer\\n // Layout the variables and bytecode backwards\\n mstore(add(result, 0xb7), tokenId)\\n mstore(add(result, 0x97), shr(96, shl(96, tokenContract)))\\n mstore(add(result, 0x77), chainId)\\n mstore(add(result, 0x57), salt)\\n mstore(add(result, 0x37), 0x5af43d82803e903d91602b57fd5bf3)\\n mstore(add(result, 0x28), implementation)\\n mstore(add(result, 0x14), 0x3d60ad80600a3d3981f3363d3d373d3d3d363d73)\\n mstore(result, 0xb7) // Store the length\\n mstore(0x40, add(result, 0xd7)) // Allocate the memory\\n }\\n }\\n\\n /**\\n * @dev Returns the create2 address computed from `salt`, `bytecodeHash`, `deployer`.\\n *\\n * @return result The create2 address computed from `salt`, `bytecodeHash`, `deployer`\\n */\\n function computeAddress(bytes32 salt, bytes32 bytecodeHash, address deployer)\\n internal\\n pure\\n returns (address result)\\n {\\n assembly {\\n result := mload(0x40) // Grab the free memory pointer\\n mstore8(result, 0xff)\\n mstore(add(result, 0x35), bytecodeHash)\\n mstore(add(result, 0x01), shl(96, deployer))\\n mstore(add(result, 0x15), salt)\\n result := keccak256(result, 0x55)\\n }\\n }\\n}\",\"keccak256\":\"0x1f0300c4a8633e7712f22c6c2e7bca25e1647fbcdf31ffe5a28584a0934aa73c\",\"license\":\"MIT\"},\"contracts/lib/NftTokenInfo.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\n// NftTokenInfo.sol -- Part of the Charged Particles Protocol\\n// Copyright (c) 2021 Firma Lux, Inc. \\n//\\n// Permission is hereby granted, free of charge, to any person obtaining a copy\\n// of this software and associated documentation files (the \\\"Software\\\"), to deal\\n// in the Software without restriction, including without limitation the rights\\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\\n// copies of the Software, and to permit persons to whom the Software is\\n// furnished to do so, subject to the following conditions:\\n//\\n// The above copyright notice and this permission notice shall be included in all\\n// copies or substantial portions of the Software.\\n//\\n// THE SOFTWARE IS PROVIDED \\\"AS IS\\\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\\n// FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE\\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\\n// SOFTWARE.\\n\\npragma solidity ^0.8.13;\\n\\nimport {IERC165} from \\\"@openzeppelin/contracts/utils/introspection/IERC165.sol\\\";\\nimport {IERC721} from \\\"@openzeppelin/contracts/token/ERC721/IERC721.sol\\\";\\nimport {IERC1271} from \\\"@openzeppelin/contracts/interfaces/IERC1271.sol\\\";\\n\\nlibrary NftTokenInfo {\\n bytes4 constant internal INTERFACE_SIGNATURE_ERC721 = 0x80ac58cd;\\n bytes4 constant internal INTERFACE_SIGNATURE_ERC1155 = 0xd9b67a26;\\n\\n function isERC721(address contractAddress) internal view returns (bool) {\\n return IERC165(contractAddress).supportsInterface(INTERFACE_SIGNATURE_ERC721);\\n }\\n\\n function isERC1155(address contractAddress) internal view returns (bool) {\\n return IERC165(contractAddress).supportsInterface(INTERFACE_SIGNATURE_ERC1155);\\n }\\n\\n function getTokenUUID(address contractAddress, uint256 tokenId) internal pure returns (uint256) {\\n return uint256(keccak256(abi.encodePacked(contractAddress, tokenId)));\\n }\\n\\n function getTokenOwner(address contractAddress, uint256 tokenId) internal returns (address) {\\n return _getTokenOwner(contractAddress, tokenId);\\n }\\n\\n function isNFTOwnerOrOperator(address contractAddress, uint256 tokenId, address sender) internal returns (bool) {\\n IERC721 tokenInterface = IERC721(contractAddress);\\n address tokenOwner = _getTokenOwner(contractAddress, tokenId);\\n return (sender == tokenOwner || tokenInterface.isApprovedForAll(tokenOwner, sender));\\n }\\n\\n function _getTokenOwner(address contractAddress, uint256 tokenId) internal returns (address) {\\n // solhint-disable-next-line\\n (bool success, bytes memory returnData) = contractAddress.call(abi.encodeWithSelector(IERC721.ownerOf.selector, tokenId));\\n if (success) {\\n return abi.decode(returnData, (address));\\n } else {\\n return address(0x0);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x8af39855e46376c5ca202901a416bc2a7a4e9d8cc0d6a342f31dadde67d2f164\",\"license\":\"MIT\"},\"contracts/lib/SmartAccountBase.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\npragma solidity ^0.8.13;\\n\\nimport {IERC165, ERC165} from \\\"@openzeppelin/contracts/utils/introspection/ERC165.sol\\\";\\nimport {IERC721} from \\\"@openzeppelin/contracts/token/ERC721/IERC721.sol\\\";\\nimport {IERC1271} from \\\"@openzeppelin/contracts/interfaces/IERC1271.sol\\\";\\nimport {IERC721Receiver} from \\\"@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol\\\";\\nimport {IERC1155Receiver} from \\\"@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol\\\";\\nimport {SignatureChecker} from \\\"@openzeppelin/contracts/utils/cryptography/SignatureChecker.sol\\\";\\n\\nimport {IERC6551Account} from \\\"../interfaces/IERC6551Account.sol\\\";\\nimport {IERC6551Executable} from \\\"../interfaces/IERC6551Executable.sol\\\";\\nimport {ERC6551AccountLib} from \\\"./ERC6551AccountLib.sol\\\";\\n\\nimport {ISmartAccount} from \\\"../interfaces/ISmartAccount.sol\\\";\\nimport {ISmartAccountController} from \\\"../interfaces/ISmartAccountController.sol\\\";\\n\\n// import \\\"hardhat/console.sol\\\";\\n\\nerror AlreadyInitialized();\\nerror NotAuthorized();\\nerror InvalidInput();\\nerror OwnershipCycle();\\n\\n/**\\n * @title A smart contract account owned by a single ERC721 token\\n */\\nabstract contract SmartAccountBase is ISmartAccount, ERC165 {\\n address internal _chargedParticles;\\n address internal _executionController;\\n\\n /// @dev mapping from owner => caller => has permissions\\n mapping(address => mapping(address => bool)) internal _permissions;\\n\\n bool internal _initialized;\\n constructor() {}\\n\\n function initialize(address chargedParticles, address executionController) external {\\n if (_initialized) { revert AlreadyInitialized(); }\\n _initialized = true;\\n _chargedParticles = chargedParticles;\\n _executionController = executionController;\\n }\\n\\n /// @dev allows eth transfers by default, but allows account owner to override\\n receive() external payable virtual override {}\\n\\n function isInitialized() external view virtual override returns (bool) {\\n return _initialized;\\n }\\n\\n function permissions(address _owner, address caller) public view virtual returns (bool) {\\n return _permissions[_owner][caller];\\n }\\n\\n function getChargedParticles() public view virtual returns (address) {\\n return _chargedParticles;\\n }\\n\\n function setChargedParticles(address chargedParticles) public virtual onlyOwner {\\n if (chargedParticles == address(0)) { revert InvalidInput(); }\\n _chargedParticles = chargedParticles;\\n }\\n\\n function getExecutionController() public view virtual returns (address) {\\n return _executionController;\\n }\\n\\n function setExecutionController(address executionController) public virtual onlyOwner {\\n _executionController = executionController;\\n emit ExecutionControllerUpdated(msg.sender, executionController);\\n }\\n\\n /// @dev Returns the EIP-155 chain ID, token contract address, and token ID for the token that\\n /// owns this account.\\n function token()\\n public\\n view\\n virtual\\n returns (\\n uint256 chainId,\\n address tokenContract,\\n uint256 tokenId\\n )\\n {\\n return ERC6551AccountLib.token();\\n }\\n\\n /// @dev Returns the owner of the ERC-721 token which owns this account. By default, the owner\\n /// of the token has full permissions on the account.\\n function owner() public view virtual returns (address) {\\n (uint256 chainId, address tokenContract, uint256 tokenId) = ERC6551AccountLib.token();\\n if (chainId != block.chainid) { return address(0); }\\n\\n try IERC721(tokenContract).ownerOf(tokenId) returns (address _owner) {\\n return _owner;\\n } catch {\\n return address(0);\\n }\\n }\\n\\n function isValidSigner(address signer, bytes calldata) external view virtual returns (bytes4) {\\n if (_isValidSigner(signer)) {\\n return IERC6551Account.isValidSigner.selector;\\n }\\n return bytes4(0);\\n }\\n\\n function isValidSignature(bytes32 hash, bytes memory signature)\\n external\\n view\\n virtual\\n returns (bytes4 magicValue)\\n {\\n bool isValid = SignatureChecker.isValidSignatureNow(owner(), hash, signature);\\n if (isValid) {\\n return IERC1271.isValidSignature.selector;\\n }\\n return bytes4(0);\\n }\\n\\n /// @dev grants a given caller execution permissions\\n function setPermissions(address[] calldata callers, bool[] calldata newPermissions) public virtual {\\n address _owner = owner();\\n if (msg.sender != _owner) { revert NotAuthorized(); }\\n\\n uint256 length = callers.length;\\n if (newPermissions.length != length) { revert InvalidInput(); }\\n\\n for (uint256 i = 0; i < length; i++) {\\n _permissions[_owner][callers[i]] = newPermissions[i];\\n emit PermissionUpdated(_owner, callers[i], newPermissions[i]);\\n }\\n }\\n\\n /// @dev Returns true if a given interfaceId is supported by this account. This method can be\\n /// extended by an override.\\n function supportsInterface(bytes4 interfaceId)\\n public\\n view\\n virtual\\n override(IERC165, ERC165)\\n returns (bool)\\n {\\n return interfaceId == type(IERC6551Account).interfaceId\\n || interfaceId == type(IERC6551Executable).interfaceId\\n || interfaceId == type(ISmartAccount).interfaceId\\n || super.supportsInterface(interfaceId);\\n }\\n\\n /// @dev Allows ERC-721 tokens to be received so long as they do not cause an ownership cycle.\\n /// This function can be overriden.\\n function onERC721Received(\\n address,\\n address,\\n uint256 receivedTokenId,\\n bytes memory\\n ) public view virtual override returns (bytes4) {\\n (\\n uint256 chainId,\\n address tokenContract,\\n uint256 tokenId\\n ) = ERC6551AccountLib.token();\\n\\n if (chainId == block.chainid && tokenContract == msg.sender && tokenId == receivedTokenId) {\\n revert OwnershipCycle();\\n }\\n return this.onERC721Received.selector;\\n }\\n\\n /// @dev Allows ERC-1155 tokens to be received. This function can be overriden.\\n function onERC1155Received(\\n address,\\n address,\\n uint256,\\n uint256,\\n bytes memory\\n ) public pure virtual override returns (bytes4) {\\n return this.onERC1155Received.selector;\\n }\\n\\n /// @dev Allows ERC-1155 token batches to be received. This function can be overriden.\\n function onERC1155BatchReceived(\\n address,\\n address,\\n uint256[] memory,\\n uint256[] memory,\\n bytes memory\\n ) public pure virtual override returns (bytes4) {\\n return this.onERC1155BatchReceived.selector;\\n }\\n\\n /// @dev Executes a low-level call\\n function _call(\\n address to,\\n uint256 value,\\n bytes calldata data\\n ) internal returns (bytes memory result) {\\n bool success;\\n // solhint-disable-next-line avoid-low-level-calls\\n (success, result) = to.call{value: value}(data);\\n\\n if (!success) {\\n assembly {\\n revert(add(result, 32), mload(result))\\n }\\n }\\n }\\n\\n function _onExecute(\\n address to,\\n uint256 value,\\n bytes calldata data,\\n uint8 operation\\n ) internal {\\n if (IERC165(_executionController).supportsInterface(type(ISmartAccountController).interfaceId)) {\\n string memory revertReason = ISmartAccountController(_executionController).onExecute(to, value, data, operation);\\n if (bytes(revertReason).length > 0) {\\n revert(revertReason);\\n }\\n }\\n }\\n\\n function _onUpdateToken(\\n bool isReceiving,\\n address assetToken,\\n uint256 assetAmount\\n ) internal {\\n if (IERC165(_executionController).supportsInterface(type(ISmartAccountController).interfaceId)) {\\n (uint256 chainId, address tokenContract, uint256 tokenId) = ERC6551AccountLib.token();\\n ISmartAccountController(_executionController)\\n .onUpdateToken(isReceiving, chainId, tokenContract, tokenId, assetToken, assetAmount);\\n }\\n }\\n\\n function _onUpdateNFT(\\n bool isReceiving,\\n address childTokenContract,\\n uint256 childTokenId,\\n uint256 childTokenAmount\\n ) internal {\\n if (IERC165(_executionController).supportsInterface(type(ISmartAccountController).interfaceId)) {\\n (uint256 chainId, address tokenContract, uint256 tokenId) = ERC6551AccountLib.token();\\n ISmartAccountController(_executionController)\\n .onUpdateNFT(isReceiving, chainId, tokenContract, tokenId, childTokenContract, childTokenId, childTokenAmount);\\n }\\n }\\n\\n function _onUpdateNFTBatch(\\n bool isReceiving,\\n address childTokenContract,\\n uint256[] calldata childTokenIds,\\n uint256[] calldata childTokenAmounts\\n ) internal {\\n if (IERC165(_executionController).supportsInterface(type(ISmartAccountController).interfaceId)) {\\n (uint256 chainId, address tokenContract, uint256 tokenId) = ERC6551AccountLib.token();\\n ISmartAccountController(_executionController)\\n .onUpdateNFTBatch(isReceiving, chainId, tokenContract, tokenId, childTokenContract, childTokenIds, childTokenAmounts);\\n }\\n }\\n\\n function _isValidSigner(address signer) internal view virtual returns (bool) {\\n address ownerOf = owner();\\n\\n // Charged Particles always has permissions\\n if (signer == _chargedParticles) { return true; }\\n\\n // authorize caller if owner has granted permissions\\n if (_permissions[ownerOf][signer]) { return true; }\\n\\n // authorize token owner\\n return signer == ownerOf;\\n }\\n\\n /// @dev reverts if caller is not the owner of the NFT which owns the account\\n modifier onlyOwner() {\\n if (msg.sender != owner()) { revert NotAuthorized(); }\\n _;\\n }\\n\\n /// @dev reverts if caller is not authorized to execute on this account\\n modifier onlyValidSigner() {\\n if (!_isValidSigner(msg.sender)) { revert NotAuthorized(); }\\n _;\\n }\\n}\\n\",\"keccak256\":\"0xd7a142ad056fd4c49e42caa3fd0d4b78461f3c2fceb4551f8c7f4a5115505f4a\",\"license\":\"UNLICENSED\"}},\"version\":1}", + "bytecode": "0x60806040523480156200001157600080fd5b5060405162003e2938038062003e2983398101604081905262000034916200011e565b6200003f33620000c0565b600180556007546000908152600660205260409081902080546001600160a01b0319166001600160a01b038416179055516200007b9062000110565b604051809103906000f08015801562000098573d6000803e3d6000fd5b50600380546001600160a01b0319166001600160a01b03929092169190911790555062000150565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b611f7e8062001eab83390190565b6000602082840312156200013157600080fd5b81516001600160a01b03811681146200014957600080fd5b9392505050565b611d4b80620001606000396000f3fe608060405234801561001057600080fd5b50600436106101165760003560e01c80637c41e76b116100a2578063addf28f011610071578063addf28f014610258578063ce786f571461026b578063d56fb4e01461027e578063e9f592ec1461029e578063f2fde38b146102b157600080fd5b80637c41e76b1461020e578063882bd8cc146102215780638da5cb5b1461023457806397d917441461024557600080fd5b80634e6421aa116100e95780634e6421aa146101a8578063577f435c146101cb5780635fd6592b146101e0578063607abc71146101f3578063715018a61461020657600080fd5b8063193c045e1461011b5780631e59562f146101615780633b94ce2f146101825780633df070b114610195575b600080fd5b61014461012936600461182e565b6000908152600660205260409020546001600160a01b031690565b6040516001600160a01b0390911681526020015b60405180910390f35b61017461016f36600461185c565b6102c4565b604051908152602001610158565b6101446101903660046118af565b610587565b6101746101a33660046118f7565b610937565b6101bb6101b6366004611952565b610b88565b6040519015158152602001610158565b6101de6101d93660046119b7565b610e50565b005b6101446101ee3660046119b7565b610e7a565b6101de6102013660046119db565b610ead565b6101de610ee3565b6101de61021c36600461182e565b610ef7565b6101de61022f3660046119db565b610f04565b6000546001600160a01b0316610144565b6101446102533660046119b7565b610f3a565b6101bb610266366004611a14565b610f6b565b6101de610279366004611a66565b611451565b6007546000908152600660205260409020546001600160a01b0316610144565b6101de6102ac3660046119b7565b611487565b6101de6102bf3660046119b7565b6114b1565b600083836102dc6001600160a01b038316823361152a565b6103015760405162461bcd60e51b81526004016102f890611a8b565b60405180910390fd5b6103096115d1565b6007546000908152600660205260408120546001600160a01b03169061032e88610f3a565b60405163246a002160e01b81529091506000906001600160a01b0384169063246a002190610368908590859046908f908f90600401611ac2565b602060405180830381865afa158015610385573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103a99190611af5565b6040516370a0823160e01b81526001600160a01b038083166004830152919250908816906370a0823190602401602060405180830381865afa1580156103f3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104179190611b12565b6040516323b872dd60e01b81529096506001600160a01b038816906323b872dd9061044a9084908e908b90600401611b2b565b6020604051808303816000875af1158015610469573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061048d9190611b4f565b506040516301ffc9a760e01b81526001600160a01b038216906301ffc9a7906104c190632f62b22760e01b90600401611b71565b602060405180830381865afa1580156104de573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105029190611b4f565b1561057157604051631f459d9960e21b8152600060048201526001600160a01b03888116602483015260448201889052821690637d16766490606401600060405180830381600087803b15801561055857600080fd5b505af115801561056c573d6000803e3d6000fd5b505050505b50505061057d60018055565b5050949350505050565b60006105916115d1565b6007546000908152600660205260408120546001600160a01b0316906105b687610f3a565b604051638a54c52f60e01b81529091506001600160a01b03831690638a54c52f906105ee90849060009046908d908d90600401611ac2565b6020604051808303816000875af115801561060d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106319190611af5565b92506000839050806001600160a01b031663392e53cd6040518163ffffffff1660e01b81526004016020604051808303816000875af1158015610678573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061069c9190611b4f565b6107125760006106ab89610e7a565b60405163485cc95560e01b81523060048201526001600160a01b0380831660248301529192509083169063485cc95590604401600060405180830381600087803b1580156106f857600080fd5b505af115801561070c573d6000803e3d6000fd5b50505050505b6040516323b872dd60e01b81526001600160a01b038716906323b872dd9061074290339088908a90600401611b2b565b6020604051808303816000875af1158015610761573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107859190611b4f565b506040805130602482015260001960448083019190915282518083039091018152606490910182526020810180516001600160e01b031663095ea7b360e01b1790529051635194544760e01b81526001600160a01b038316916351945447916107f8918a91600091908290600401611baa565b6000604051808303816000875af1158015610817573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261083f9190810190611c14565b506040516301ffc9a760e01b81526001600160a01b038516906301ffc9a79061087390632f62b22760e01b90600401611b71565b602060405180830381865afa158015610890573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108b49190611b4f565b1561092357604051631f459d9960e21b8152600160048201526001600160a01b03878116602483015260448201879052821690637d16766490606401600060405180830381600087803b15801561090a57600080fd5b505af115801561091e573d6000803e3d6000fd5b505050505b50505061092f60018055565b949350505050565b6000848461094f6001600160a01b038316823361152a565b61096b5760405162461bcd60e51b81526004016102f890611a8b565b6109736115d1565b6007546000908152600660205260408120546001600160a01b03169061099889610f3a565b90506000826001600160a01b031663246a0021836000801b468e8e6040518663ffffffff1660e01b81526004016109d3959493929190611ac2565b602060405180830381865afa1580156109f0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a149190611af5565b6040516323b872dd60e01b81529091506001600160a01b038916906323b872dd90610a479084908f908c90600401611b2b565b6020604051808303816000875af1158015610a66573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a8a9190611b4f565b506040516301ffc9a760e01b81526001600160a01b038216906301ffc9a790610abe90632f62b22760e01b90600401611b71565b602060405180830381865afa158015610adb573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610aff9190611b4f565b15610b6e57604051631f459d9960e21b8152600060048201526001600160a01b03898116602483015260448201899052821690637d16766490606401600060405180830381600087803b158015610b5557600080fd5b505af1158015610b69573d6000803e3d6000fd5b505050505b869550505050610b7d60018055565b505095945050505050565b60008585610ba06001600160a01b038316823361152a565b610bbc5760405162461bcd60e51b81526004016102f890611a8b565b610bc46115d1565b6007546000908152600660205260408120546001600160a01b031690610be98a610f3a565b90506000826001600160a01b031663246a0021836000801b468f8f6040518663ffffffff1660e01b8152600401610c24959493929190611ac2565b602060405180830381865afa158015610c41573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c659190611af5565b9050610c79896001600160a01b031661162a565b15610ce757886001600160a01b031663f242432a828e8d8b6040518563ffffffff1660e01b8152600401610cb09493929190611cc1565b600060405180830381600087803b158015610cca57600080fd5b505af1158015610cde573d6000803e3d6000fd5b50505050610d4a565b886001600160a01b03166342842e0e828e8b6040518463ffffffff1660e01b8152600401610d1793929190611b2b565b600060405180830381600087803b158015610d3157600080fd5b505af1158015610d45573d6000803e3d6000fd5b505050505b6040516301ffc9a760e01b81526001600160a01b038216906301ffc9a790610d7d90632f62b22760e01b90600401611b71565b602060405180830381865afa158015610d9a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dbe9190611b4f565b15610e3457604051634787125b60e11b8152600060048201526001600160a01b038a81166024830152604482018a905260648201899052821690638f0e24b690608401600060405180830381600087803b158015610e1b57600080fd5b505af1158015610e2f573d6000803e3d6000fd5b505050505b60019550505050610e4460018055565b50509695505050505050565b610e586116a7565b600380546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038082166000908152600460205260409020541680610ea857506005546001600160a01b03165b919050565b610eb56116a7565b6001600160a01b03918216600090815260026020526040902080546001600160a01b03191691909216179055565b610eeb6116a7565b610ef56000611701565b565b610eff6116a7565b600755565b610f0c6116a7565b6001600160a01b03918216600090815260046020526040902080546001600160a01b03191691909216179055565b6001600160a01b038082166000908152600260205260409020541680610ea85750506003546001600160a01b031690565b6000610f756115d1565b6007546000908152600660205260408120546001600160a01b031690610f9a88610f3a565b604051638a54c52f60e01b81529091506000906001600160a01b03841690638a54c52f90610fd4908590859046908f908f90600401611ac2565b6020604051808303816000875af1158015610ff3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110179190611af5565b90506000819050806001600160a01b031663392e53cd6040518163ffffffff1660e01b81526004016020604051808303816000875af115801561105e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110829190611b4f565b6110f85760006110918b610e7a565b60405163485cc95560e01b81523060048201526001600160a01b0380831660248301529192509083169063485cc95590604401600060405180830381600087803b1580156110de57600080fd5b505af11580156110f2573d6000803e3d6000fd5b50505050505b61110a886001600160a01b031661162a565b1561123157604051637921219560e11b81526001600160a01b0389169063f242432a9061114190339086908e908c90600401611cc1565b600060405180830381600087803b15801561115b57600080fd5b505af115801561116f573d6000803e3d6000fd5b505060408051306024820152600160448083019190915282518083039091018152606490910182526020810180516001600160e01b031663a22cb46560e01b1790529051635194544760e01b81526001600160a01b0385169350635194544792506111e4918c91600091908290600401611baa565b6000604051808303816000875af1158015611203573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261122b9190810190611c14565b5061134d565b604051632142170760e11b81526001600160a01b038916906342842e0e9061126190339086908c90600401611b2b565b600060405180830381600087803b15801561127b57600080fd5b505af115801561128f573d6000803e3d6000fd5b505060408051306024820152600160448083019190915282518083039091018152606490910182526020810180516001600160e01b031663a22cb46560e01b1790529051635194544760e01b81526001600160a01b038516935063519454479250611304918c91600091908290600401611baa565b6000604051808303816000875af1158015611323573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261134b9190810190611c14565b505b6040516301ffc9a760e01b81526001600160a01b038316906301ffc9a79061138090632f62b22760e01b90600401611b71565b602060405180830381865afa15801561139d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113c19190611b4f565b1561143757604051634787125b60e11b8152600160048201526001600160a01b0389811660248301526044820189905260648201889052821690638f0e24b690608401600060405180830381600087803b15801561141e57600080fd5b505af1158015611432573d6000803e3d6000fd5b505050505b600194505050505061144860018055565b95945050505050565b6114596116a7565b60009182526006602052604090912080546001600160a01b0319166001600160a01b03909216919091179055565b61148f6116a7565b600580546001600160a01b0319166001600160a01b0392909216919091179055565b6114b96116a7565b6001600160a01b03811661151e5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016102f8565b61152781611701565b50565b600083816115388286611751565b9050806001600160a01b0316846001600160a01b031614806115c7575060405163e985e9c560e01b81526001600160a01b038281166004830152858116602483015283169063e985e9c590604401602060405180830381865afa1580156115a3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115c79190611b4f565b9695505050505050565b6002600154036116235760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016102f8565b6002600155565b6040516301ffc9a760e01b81526000906001600160a01b038316906301ffc9a79061166090636cdb3d1360e11b90600401611b71565b602060405180830381865afa15801561167d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116a19190611b4f565b92915050565b6000546001600160a01b03163314610ef55760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016102f8565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000806000846001600160a01b0316636352211e60e01b8560405160240161177b91815260200190565b60408051601f198184030181529181526020820180516001600160e01b03166001600160e01b03199094169390931790925290516117b99190611cf9565b6000604051808303816000865af19150503d80600081146117f6576040519150601f19603f3d011682016040523d82523d6000602084013e6117fb565b606091505b50915091508115611823578080602001905181019061181a9190611af5565b925050506116a1565b506000949350505050565b60006020828403121561184057600080fd5b5035919050565b6001600160a01b038116811461152757600080fd5b6000806000806080858703121561187257600080fd5b843561187d81611847565b9350602085013561188d81611847565b92506040850135915060608501356118a481611847565b939692955090935050565b600080600080608085870312156118c557600080fd5b84356118d081611847565b93506020850135925060408501356118e781611847565b9396929550929360600135925050565b600080600080600060a0868803121561190f57600080fd5b853561191a81611847565b9450602086013561192a81611847565b935060408601359250606086013561194181611847565b949793965091946080013592915050565b60008060008060008060c0878903121561196b57600080fd5b863561197681611847565b9550602087013561198681611847565b945060408701359350606087013561199d81611847565b9598949750929560808101359460a0909101359350915050565b6000602082840312156119c957600080fd5b81356119d481611847565b9392505050565b600080604083850312156119ee57600080fd5b82356119f981611847565b91506020830135611a0981611847565b809150509250929050565b600080600080600060a08688031215611a2c57600080fd5b8535611a3781611847565b9450602086013593506040860135611a4e81611847565b94979396509394606081013594506080013592915050565b60008060408385031215611a7957600080fd5b823591506020830135611a0981611847565b60208082526019908201527f496e76616c6964206f776e6572206f72206f70657261746f7200000000000000604082015260600190565b6001600160a01b039586168152602081019490945260408401929092529092166060820152608081019190915260a00190565b600060208284031215611b0757600080fd5b81516119d481611847565b600060208284031215611b2457600080fd5b5051919050565b6001600160a01b039384168152919092166020820152604081019190915260600190565b600060208284031215611b6157600080fd5b815180151581146119d457600080fd5b6001600160e01b031991909116815260200190565b60005b83811015611ba1578181015183820152602001611b89565b50506000910152565b60018060a01b03851681528360208201526080604082015260008351806080840152611bdd8160a0850160208801611b86565b60ff93909316606083015250601f91909101601f19160160a0019392505050565b634e487b7160e01b600052604160045260246000fd5b600060208284031215611c2657600080fd5b815167ffffffffffffffff80821115611c3e57600080fd5b818401915084601f830112611c5257600080fd5b815181811115611c6457611c64611bfe565b604051601f8201601f19908116603f01168101908382118183101715611c8c57611c8c611bfe565b81604052828152876020848701011115611ca557600080fd5b611cb6836020830160208801611b86565b979650505050505050565b6001600160a01b0394851681529290931660208301526040820152606081019190915260a06080820181905260009082015260c00190565b60008251611d0b818460208701611b86565b919091019291505056fea264697066735822122068ee32b967ea96a2ba2f532af35cdc245a151927cb9948058cc6fe0d61ac9eb464736f6c63430008110033608060405234801561001057600080fd5b50611f5e806100206000396000f3fe60806040526004361061014f5760003560e01c80638da5cb5b116100b6578063ae4d17531161006f578063ae4d1753146103f5578063bc197c8114610415578063c19d93fb14610441578063dd46706414610457578063f23a6e6114610477578063fc0c546a146104a357600080fd5b80638da5cb5b146103325780638f0e24b6146103475780639bc289f1146103675780639bf32a35146103a2578063a4e2d634146103c0578063ac087a6d146103d557600080fd5b8063392e53cd11610108578063392e53cd1461027a578063485cc9551461029257806351945447146102b2578063523e3260146102d25780636e5559fd146102f25780637d1676641461031257600080fd5b806301ffc9a71461015b578063039721b114610190578063150b7a02146101b25780631626ba7e146101df57806317dd2c92146101ff5780631f9838b51461023157600080fd5b3661015657005b600080fd5b34801561016757600080fd5b5061017b610176366004611552565b6104db565b60405190151581526020015b60405180910390f35b34801561019c57600080fd5b506101b06101ab3660046115c0565b610548565b005b3480156101be57600080fd5b506101d26101cd366004611706565b610580565b6040516101879190611771565b3480156101eb57600080fd5b506101d26101fa366004611786565b6105e8565b34801561020b57600080fd5b506000546001600160a01b03165b6040516001600160a01b039091168152602001610187565b34801561023d57600080fd5b5061017b61024c3660046117cc565b6001600160a01b03918216600090815260026020908152604080832093909416825291909152205460ff1690565b34801561028657600080fd5b5060035460ff1661017b565b34801561029e57600080fd5b506101b06102ad3660046117cc565b61061f565b6102c56102c0366004611846565b61067e565b604051610187919061190f565b3480156102de57600080fd5b506101d26102ed366004611922565b6106bd565b3480156102fe57600080fd5b506101b061030d366004611976565b6106de565b34801561031e57600080fd5b506101b061032d3660046119a1565b610760565b34801561033e57600080fd5b50610219610796565b34801561035357600080fd5b506101b06103623660046119e2565b610832565b34801561037357600080fd5b50610394610382366004611976565b60056020526000908152604090205481565b604051908152602001610187565b3480156103ae57600080fd5b506001546001600160a01b0316610219565b3480156103cc57600080fd5b5061017b610864565b3480156103e157600080fd5b506101b06103f0366004611a28565b61089a565b34801561040157600080fd5b506101b0610410366004611976565b6108d6565b34801561042157600080fd5b506101d2610430366004611b3b565b63bc197c8160e01b95945050505050565b34801561044d57600080fd5b5061039460045481565b34801561046357600080fd5b506101b0610472366004611be8565b61096b565b34801561048357600080fd5b506101d2610492366004611c01565b63f23a6e6160e01b95945050505050565b3480156104af57600080fd5b506104b8610a21565b604080519384526001600160a01b03909216602084015290820152606001610187565b60006001600160e01b03198216636faff5f160e01b148061050c57506001600160e01b03198216635194544760e01b145b8061052757506001600160e01b03198216632f62b22760e01b145b8061054257506301ffc9a760e01b6001600160e01b03198316145b92915050565b610550610864565b1561056e57604051636315bfbb60e01b815260040160405180910390fd5b61057a84848484610a39565b50505050565b60008060008061058e610bdf565b92509250925046831480156105ab57506001600160a01b03821633145b80156105b657508581145b156105d45760405163b79e3f3f60e01b815260040160405180910390fd5b50630a85bd0160e11b979650505050505050565b6000806105fd6105f6610796565b8585610bed565b905080156106155750630b135d3f60e11b9050610542565b5060009392505050565b60035460ff16156106425760405162dc149f60e41b815260040160405180910390fd5b60038054600160ff199091168117909155600080546001600160a01b03199081166001600160a01b039586161790915581541691909216179055565b6060610688610864565b156106a657604051636315bfbb60e01b815260040160405180910390fd5b6106b38686868686610c44565b9695505050505050565b60006106c884610cf9565b156106155750630291f19360e51b5b9392505050565b6106e6610796565b6001600160a01b0316336001600160a01b0316146107175760405163ea8e4eb560e01b815260040160405180910390fd5b6001600160a01b03811661073e5760405163b4fa3fb360e01b815260040160405180910390fd5b600080546001600160a01b0319166001600160a01b0392909216919091179055565b610768610864565b1561078657604051636315bfbb60e01b815260040160405180910390fd5b610791838383610d7a565b505050565b6000806000806107a4610bdf565b9250925092504683146107bb576000935050505090565b6040516331a9108f60e11b8152600481018290526001600160a01b03831690636352211e90602401602060405180830381865afa92505050801561081c575060408051601f3d908101601f1916820190925261081991810190611c69565b60015b61082a576000935050505090565b949350505050565b61083a610864565b1561085857604051636315bfbb60e01b815260040160405180910390fd5b61057a84848484610dab565b60004260056000610873610796565b6001600160a01b03166001600160a01b031681526020019081526020016000205411905090565b6108a2610864565b156108c057604051636315bfbb60e01b815260040160405180910390fd5b6108ce868686868686610ddd565b505050505050565b6108de610796565b6001600160a01b0316336001600160a01b03161461090f5760405163ea8e4eb560e01b815260040160405180910390fd5b600180546001600160a01b0319166001600160a01b0383169081179091556040805133815260208101929092527f8e49c81dbf3f64ca1e8afe0b105d6e6a159505016a63bf20d3e3f4324e7597c791015b60405180910390a150565b61097433610cf9565b6109915760405163ea8e4eb560e01b815260040160405180910390fd5b61099f426301e13380611c9c565b8111156109bf576040516301814f7d60e31b815260040160405180910390fd5b80600560006109cc610796565b6001600160a01b03166001600160a01b03168152602001908152602001600020819055507fa7b24c66dd3269a292a60b3facdbb8f3e7557d1e19e64d99e0d6ee7250be63ad8160405161096091815260200190565b6000806000610a2e610bdf565b925092509250909192565b6000610a43610796565b9050336001600160a01b03821614610a6e5760405163ea8e4eb560e01b815260040160405180910390fd5b83828114610a8f5760405163b4fa3fb360e01b815260040160405180910390fd5b60005b81811015610bd657848482818110610aac57610aac611caf565b9050602002016020810190610ac19190611cc5565b6001600160a01b038416600090815260026020526040812090898985818110610aec57610aec611caf565b9050602002016020810190610b019190611976565b6001600160a01b031681526020810191909152604001600020805460ff19169115159190911790557f394777a58092892d136a90c4bb7e4350c72ac50fba6a0208128677f36527dcf583888884818110610b5d57610b5d611caf565b9050602002016020810190610b729190611976565b878785818110610b8457610b84611caf565b9050602002016020810190610b999190611cc5565b604080516001600160a01b03948516815293909216602084015215159082015260600160405180910390a180610bce81611ce2565b915050610a92565b50505050505050565b6000806000610a2e30610e11565b6000806000610bfc8585610e66565b90925090506000816004811115610c1557610c15611cfb565b148015610c335750856001600160a01b0316826001600160a01b0316145b806106b357506106b3868686610eab565b6060610c4f33610cf9565b610c6c5760405163ea8e4eb560e01b815260040160405180910390fd5b60ff821615610ccd5760405162461bcd60e51b815260206004820152602260248201527f4f6e6c792063616c6c206f7065726174696f6e732061726520737570706f7274604482015261195960f21b60648201526084015b60405180910390fd5b600460008154610cdc90611ce2565b90915550610ced8686868686610f97565b6106b3868686866110bf565b600080610d04610796565b6000549091506001600160a01b0390811690841603610d265750600192915050565b6001600160a01b0380821660009081526002602090815260408083209387168352929052205460ff1615610d5d5750600192915050565b806001600160a01b0316836001600160a01b031614915050919050565b610d8333610cf9565b610da05760405163ea8e4eb560e01b815260040160405180910390fd5b61079183838361113b565b610db433610cf9565b610dd15760405163ea8e4eb560e01b815260040160405180910390fd5b61057a8484848461125b565b610de633610cf9565b610e035760405163ea8e4eb560e01b815260040160405180910390fd5b6108ce868686868686611381565b60408051606080825260808201909252600091829182918291906020820181803683370190505090506060604d60208301873c80806020019051810190610e589190611d11565b935093509350509193909250565b6000808251604103610e9c5760208301516040840151606085015160001a610e908782858561148e565b94509450505050610ea4565b506000905060025b9250929050565b6000806000856001600160a01b0316631626ba7e60e01b8686604051602401610ed5929190611d4a565b60408051601f198184030181529181526020820180516001600160e01b03166001600160e01b0319909416939093179092529051610f139190611d63565b600060405180830381855afa9150503d8060008114610f4e576040519150601f19603f3d011682016040523d82523d6000602084013e610f53565b606091505b5091509150818015610f6757506020815110155b80156106b357508051630b135d3f60e11b90610f8c9083016020908101908401611d7f565b149695505050505050565b6001546040516301ffc9a760e01b81526001600160a01b03909116906301ffc9a790610fce90630736863160e31b90600401611771565b602060405180830381865afa158015610feb573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061100f9190611d98565b156110b857600154604051631269c0cd60e21b81526000916001600160a01b0316906349a703349061104d9089908990899089908990600401611db5565b6000604051808303816000875af115801561106c573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526110949190810190611e0a565b8051909150156108ce578060405162461bcd60e51b8152600401610cc4919061190f565b5050505050565b60606000856001600160a01b03168585856040516110de929190611e80565b60006040518083038185875af1925050503d806000811461111b576040519150601f19603f3d011682016040523d82523d6000602084013e611120565b606091505b50925090508061113257815160208301fd5b50949350505050565b6001546040516301ffc9a760e01b81526001600160a01b03909116906301ffc9a79061117290630736863160e31b90600401611771565b602060405180830381865afa15801561118f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111b39190611d98565b156107915760008060006111c5610bdf565b6001546040516380ced4bf60e01b81528a15156004820152602481018590526001600160a01b038085166044830152606482018490528a8116608483015260a482018a905294975092955090935091909116906380ced4bf9060c401600060405180830381600087803b15801561123b57600080fd5b505af115801561124f573d6000803e3d6000fd5b50505050505050505050565b6001546040516301ffc9a760e01b81526001600160a01b03909116906301ffc9a79061129290630736863160e31b90600401611771565b602060405180830381865afa1580156112af573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112d39190611d98565b1561057a5760008060006112e5610bdf565b60015460405162da771360e01b81528b15156004820152602481018590526001600160a01b038085166044830152606482018490528b8116608483015260a482018b905260c482018a9052949750929550909350919091169062da77139060e401600060405180830381600087803b15801561136057600080fd5b505af1158015611374573d6000803e3d6000fd5b5050505050505050505050565b6001546040516301ffc9a760e01b81526001600160a01b03909116906301ffc9a7906113b890630736863160e31b90600401611771565b602060405180830381865afa1580156113d5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113f99190611d98565b156108ce57600080600061140b610bdf565b600154604051630f00791160e41b815293965091945092506001600160a01b03169063f007911090611451908c908790879087908f908f908f908f908f90600401611ec2565b600060405180830381600087803b15801561146b57600080fd5b505af115801561147f573d6000803e3d6000fd5b50505050505050505050505050565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a08311156114c55750600090506003611549565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa158015611519573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b03811661154257600060019250925050611549565b9150600090505b94509492505050565b60006020828403121561156457600080fd5b81356001600160e01b0319811681146106d757600080fd5b60008083601f84011261158e57600080fd5b5081356001600160401b038111156115a557600080fd5b6020830191508360208260051b8501011115610ea457600080fd5b600080600080604085870312156115d657600080fd5b84356001600160401b03808211156115ed57600080fd5b6115f98883890161157c565b9096509450602087013591508082111561161257600080fd5b5061161f8782880161157c565b95989497509550505050565b6001600160a01b038116811461164057600080fd5b50565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b038111828210171561168157611681611643565b604052919050565b60006001600160401b038211156116a2576116a2611643565b50601f01601f191660200190565b600082601f8301126116c157600080fd5b81356116d46116cf82611689565b611659565b8181528460208386010111156116e957600080fd5b816020850160208301376000918101602001919091529392505050565b6000806000806080858703121561171c57600080fd5b84356117278161162b565b935060208501356117378161162b565b92506040850135915060608501356001600160401b0381111561175957600080fd5b611765878288016116b0565b91505092959194509250565b6001600160e01b031991909116815260200190565b6000806040838503121561179957600080fd5b8235915060208301356001600160401b038111156117b657600080fd5b6117c2858286016116b0565b9150509250929050565b600080604083850312156117df57600080fd5b82356117ea8161162b565b915060208301356117fa8161162b565b809150509250929050565b60008083601f84011261181757600080fd5b5081356001600160401b0381111561182e57600080fd5b602083019150836020828501011115610ea457600080fd5b60008060008060006080868803121561185e57600080fd5b85356118698161162b565b94506020860135935060408601356001600160401b0381111561188b57600080fd5b61189788828901611805565b909450925050606086013560ff811681146118b157600080fd5b809150509295509295909350565b60005b838110156118da5781810151838201526020016118c2565b50506000910152565b600081518084526118fb8160208601602086016118bf565b601f01601f19169290920160200192915050565b6020815260006106d760208301846118e3565b60008060006040848603121561193757600080fd5b83356119428161162b565b925060208401356001600160401b0381111561195d57600080fd5b61196986828701611805565b9497909650939450505050565b60006020828403121561198857600080fd5b81356106d78161162b565b801515811461164057600080fd5b6000806000606084860312156119b657600080fd5b83356119c181611993565b925060208401356119d18161162b565b929592945050506040919091013590565b600080600080608085870312156119f857600080fd5b8435611a0381611993565b93506020850135611a138161162b565b93969395505050506040820135916060013590565b60008060008060008060808789031215611a4157600080fd5b8635611a4c81611993565b95506020870135611a5c8161162b565b945060408701356001600160401b0380821115611a7857600080fd5b611a848a838b0161157c565b90965094506060890135915080821115611a9d57600080fd5b50611aaa89828a0161157c565b979a9699509497509295939492505050565b600082601f830112611acd57600080fd5b813560206001600160401b03821115611ae857611ae8611643565b8160051b611af7828201611659565b9283528481018201928281019087851115611b1157600080fd5b83870192505b84831015611b3057823582529183019190830190611b17565b979650505050505050565b600080600080600060a08688031215611b5357600080fd5b8535611b5e8161162b565b94506020860135611b6e8161162b565b935060408601356001600160401b0380821115611b8a57600080fd5b611b9689838a01611abc565b94506060880135915080821115611bac57600080fd5b611bb889838a01611abc565b93506080880135915080821115611bce57600080fd5b50611bdb888289016116b0565b9150509295509295909350565b600060208284031215611bfa57600080fd5b5035919050565b600080600080600060a08688031215611c1957600080fd5b8535611c248161162b565b94506020860135611c348161162b565b9350604086013592506060860135915060808601356001600160401b03811115611c5d57600080fd5b611bdb888289016116b0565b600060208284031215611c7b57600080fd5b81516106d78161162b565b634e487b7160e01b600052601160045260246000fd5b8082018082111561054257610542611c86565b634e487b7160e01b600052603260045260246000fd5b600060208284031215611cd757600080fd5b81356106d781611993565b600060018201611cf457611cf4611c86565b5060010190565b634e487b7160e01b600052602160045260246000fd5b600080600060608486031215611d2657600080fd5b835192506020840151611d388161162b565b80925050604084015190509250925092565b82815260406020820152600061082a60408301846118e3565b60008251611d758184602087016118bf565b9190910192915050565b600060208284031215611d9157600080fd5b5051919050565b600060208284031215611daa57600080fd5b81516106d781611993565b6001600160a01b0386168152602081018590526080604082018190528101839052828460a0830137600060a08483010152600060a0601f19601f860116830101905060ff831660608301529695505050505050565b600060208284031215611e1c57600080fd5b81516001600160401b03811115611e3257600080fd5b8201601f81018413611e4357600080fd5b8051611e516116cf82611689565b818152856020838501011115611e6657600080fd5b611e778260208301602086016118bf565b95945050505050565b8183823760009101908152919050565b81835260006001600160fb1b03831115611ea957600080fd5b8260051b80836020870137939093016020019392505050565b8915158152602081018990526001600160a01b038881166040830152606082018890528616608082015260e060a08201819052600090611f059083018688611e90565b82810360c0840152611f18818587611e90565b9c9b50505050505050505050505056fea2646970667358221220eebe1d94ebbe68245deaea5e319e39cd42e94b9677f733cb661c7ffc33784d9e64736f6c63430008110033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106101165760003560e01c80637c41e76b116100a2578063addf28f011610071578063addf28f014610258578063ce786f571461026b578063d56fb4e01461027e578063e9f592ec1461029e578063f2fde38b146102b157600080fd5b80637c41e76b1461020e578063882bd8cc146102215780638da5cb5b1461023457806397d917441461024557600080fd5b80634e6421aa116100e95780634e6421aa146101a8578063577f435c146101cb5780635fd6592b146101e0578063607abc71146101f3578063715018a61461020657600080fd5b8063193c045e1461011b5780631e59562f146101615780633b94ce2f146101825780633df070b114610195575b600080fd5b61014461012936600461182e565b6000908152600660205260409020546001600160a01b031690565b6040516001600160a01b0390911681526020015b60405180910390f35b61017461016f36600461185c565b6102c4565b604051908152602001610158565b6101446101903660046118af565b610587565b6101746101a33660046118f7565b610937565b6101bb6101b6366004611952565b610b88565b6040519015158152602001610158565b6101de6101d93660046119b7565b610e50565b005b6101446101ee3660046119b7565b610e7a565b6101de6102013660046119db565b610ead565b6101de610ee3565b6101de61021c36600461182e565b610ef7565b6101de61022f3660046119db565b610f04565b6000546001600160a01b0316610144565b6101446102533660046119b7565b610f3a565b6101bb610266366004611a14565b610f6b565b6101de610279366004611a66565b611451565b6007546000908152600660205260409020546001600160a01b0316610144565b6101de6102ac3660046119b7565b611487565b6101de6102bf3660046119b7565b6114b1565b600083836102dc6001600160a01b038316823361152a565b6103015760405162461bcd60e51b81526004016102f890611a8b565b60405180910390fd5b6103096115d1565b6007546000908152600660205260408120546001600160a01b03169061032e88610f3a565b60405163246a002160e01b81529091506000906001600160a01b0384169063246a002190610368908590859046908f908f90600401611ac2565b602060405180830381865afa158015610385573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103a99190611af5565b6040516370a0823160e01b81526001600160a01b038083166004830152919250908816906370a0823190602401602060405180830381865afa1580156103f3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104179190611b12565b6040516323b872dd60e01b81529096506001600160a01b038816906323b872dd9061044a9084908e908b90600401611b2b565b6020604051808303816000875af1158015610469573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061048d9190611b4f565b506040516301ffc9a760e01b81526001600160a01b038216906301ffc9a7906104c190632f62b22760e01b90600401611b71565b602060405180830381865afa1580156104de573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105029190611b4f565b1561057157604051631f459d9960e21b8152600060048201526001600160a01b03888116602483015260448201889052821690637d16766490606401600060405180830381600087803b15801561055857600080fd5b505af115801561056c573d6000803e3d6000fd5b505050505b50505061057d60018055565b5050949350505050565b60006105916115d1565b6007546000908152600660205260408120546001600160a01b0316906105b687610f3a565b604051638a54c52f60e01b81529091506001600160a01b03831690638a54c52f906105ee90849060009046908d908d90600401611ac2565b6020604051808303816000875af115801561060d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106319190611af5565b92506000839050806001600160a01b031663392e53cd6040518163ffffffff1660e01b81526004016020604051808303816000875af1158015610678573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061069c9190611b4f565b6107125760006106ab89610e7a565b60405163485cc95560e01b81523060048201526001600160a01b0380831660248301529192509083169063485cc95590604401600060405180830381600087803b1580156106f857600080fd5b505af115801561070c573d6000803e3d6000fd5b50505050505b6040516323b872dd60e01b81526001600160a01b038716906323b872dd9061074290339088908a90600401611b2b565b6020604051808303816000875af1158015610761573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107859190611b4f565b506040805130602482015260001960448083019190915282518083039091018152606490910182526020810180516001600160e01b031663095ea7b360e01b1790529051635194544760e01b81526001600160a01b038316916351945447916107f8918a91600091908290600401611baa565b6000604051808303816000875af1158015610817573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261083f9190810190611c14565b506040516301ffc9a760e01b81526001600160a01b038516906301ffc9a79061087390632f62b22760e01b90600401611b71565b602060405180830381865afa158015610890573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108b49190611b4f565b1561092357604051631f459d9960e21b8152600160048201526001600160a01b03878116602483015260448201879052821690637d16766490606401600060405180830381600087803b15801561090a57600080fd5b505af115801561091e573d6000803e3d6000fd5b505050505b50505061092f60018055565b949350505050565b6000848461094f6001600160a01b038316823361152a565b61096b5760405162461bcd60e51b81526004016102f890611a8b565b6109736115d1565b6007546000908152600660205260408120546001600160a01b03169061099889610f3a565b90506000826001600160a01b031663246a0021836000801b468e8e6040518663ffffffff1660e01b81526004016109d3959493929190611ac2565b602060405180830381865afa1580156109f0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a149190611af5565b6040516323b872dd60e01b81529091506001600160a01b038916906323b872dd90610a479084908f908c90600401611b2b565b6020604051808303816000875af1158015610a66573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a8a9190611b4f565b506040516301ffc9a760e01b81526001600160a01b038216906301ffc9a790610abe90632f62b22760e01b90600401611b71565b602060405180830381865afa158015610adb573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610aff9190611b4f565b15610b6e57604051631f459d9960e21b8152600060048201526001600160a01b03898116602483015260448201899052821690637d16766490606401600060405180830381600087803b158015610b5557600080fd5b505af1158015610b69573d6000803e3d6000fd5b505050505b869550505050610b7d60018055565b505095945050505050565b60008585610ba06001600160a01b038316823361152a565b610bbc5760405162461bcd60e51b81526004016102f890611a8b565b610bc46115d1565b6007546000908152600660205260408120546001600160a01b031690610be98a610f3a565b90506000826001600160a01b031663246a0021836000801b468f8f6040518663ffffffff1660e01b8152600401610c24959493929190611ac2565b602060405180830381865afa158015610c41573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c659190611af5565b9050610c79896001600160a01b031661162a565b15610ce757886001600160a01b031663f242432a828e8d8b6040518563ffffffff1660e01b8152600401610cb09493929190611cc1565b600060405180830381600087803b158015610cca57600080fd5b505af1158015610cde573d6000803e3d6000fd5b50505050610d4a565b886001600160a01b03166342842e0e828e8b6040518463ffffffff1660e01b8152600401610d1793929190611b2b565b600060405180830381600087803b158015610d3157600080fd5b505af1158015610d45573d6000803e3d6000fd5b505050505b6040516301ffc9a760e01b81526001600160a01b038216906301ffc9a790610d7d90632f62b22760e01b90600401611b71565b602060405180830381865afa158015610d9a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dbe9190611b4f565b15610e3457604051634787125b60e11b8152600060048201526001600160a01b038a81166024830152604482018a905260648201899052821690638f0e24b690608401600060405180830381600087803b158015610e1b57600080fd5b505af1158015610e2f573d6000803e3d6000fd5b505050505b60019550505050610e4460018055565b50509695505050505050565b610e586116a7565b600380546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038082166000908152600460205260409020541680610ea857506005546001600160a01b03165b919050565b610eb56116a7565b6001600160a01b03918216600090815260026020526040902080546001600160a01b03191691909216179055565b610eeb6116a7565b610ef56000611701565b565b610eff6116a7565b600755565b610f0c6116a7565b6001600160a01b03918216600090815260046020526040902080546001600160a01b03191691909216179055565b6001600160a01b038082166000908152600260205260409020541680610ea85750506003546001600160a01b031690565b6000610f756115d1565b6007546000908152600660205260408120546001600160a01b031690610f9a88610f3a565b604051638a54c52f60e01b81529091506000906001600160a01b03841690638a54c52f90610fd4908590859046908f908f90600401611ac2565b6020604051808303816000875af1158015610ff3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110179190611af5565b90506000819050806001600160a01b031663392e53cd6040518163ffffffff1660e01b81526004016020604051808303816000875af115801561105e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110829190611b4f565b6110f85760006110918b610e7a565b60405163485cc95560e01b81523060048201526001600160a01b0380831660248301529192509083169063485cc95590604401600060405180830381600087803b1580156110de57600080fd5b505af11580156110f2573d6000803e3d6000fd5b50505050505b61110a886001600160a01b031661162a565b1561123157604051637921219560e11b81526001600160a01b0389169063f242432a9061114190339086908e908c90600401611cc1565b600060405180830381600087803b15801561115b57600080fd5b505af115801561116f573d6000803e3d6000fd5b505060408051306024820152600160448083019190915282518083039091018152606490910182526020810180516001600160e01b031663a22cb46560e01b1790529051635194544760e01b81526001600160a01b0385169350635194544792506111e4918c91600091908290600401611baa565b6000604051808303816000875af1158015611203573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261122b9190810190611c14565b5061134d565b604051632142170760e11b81526001600160a01b038916906342842e0e9061126190339086908c90600401611b2b565b600060405180830381600087803b15801561127b57600080fd5b505af115801561128f573d6000803e3d6000fd5b505060408051306024820152600160448083019190915282518083039091018152606490910182526020810180516001600160e01b031663a22cb46560e01b1790529051635194544760e01b81526001600160a01b038516935063519454479250611304918c91600091908290600401611baa565b6000604051808303816000875af1158015611323573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261134b9190810190611c14565b505b6040516301ffc9a760e01b81526001600160a01b038316906301ffc9a79061138090632f62b22760e01b90600401611b71565b602060405180830381865afa15801561139d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113c19190611b4f565b1561143757604051634787125b60e11b8152600160048201526001600160a01b0389811660248301526044820189905260648201889052821690638f0e24b690608401600060405180830381600087803b15801561141e57600080fd5b505af1158015611432573d6000803e3d6000fd5b505050505b600194505050505061144860018055565b95945050505050565b6114596116a7565b60009182526006602052604090912080546001600160a01b0319166001600160a01b03909216919091179055565b61148f6116a7565b600580546001600160a01b0319166001600160a01b0392909216919091179055565b6114b96116a7565b6001600160a01b03811661151e5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016102f8565b61152781611701565b50565b600083816115388286611751565b9050806001600160a01b0316846001600160a01b031614806115c7575060405163e985e9c560e01b81526001600160a01b038281166004830152858116602483015283169063e985e9c590604401602060405180830381865afa1580156115a3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115c79190611b4f565b9695505050505050565b6002600154036116235760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016102f8565b6002600155565b6040516301ffc9a760e01b81526000906001600160a01b038316906301ffc9a79061166090636cdb3d1360e11b90600401611b71565b602060405180830381865afa15801561167d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116a19190611b4f565b92915050565b6000546001600160a01b03163314610ef55760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016102f8565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000806000846001600160a01b0316636352211e60e01b8560405160240161177b91815260200190565b60408051601f198184030181529181526020820180516001600160e01b03166001600160e01b03199094169390931790925290516117b99190611cf9565b6000604051808303816000865af19150503d80600081146117f6576040519150601f19603f3d011682016040523d82523d6000602084013e6117fb565b606091505b50915091508115611823578080602001905181019061181a9190611af5565b925050506116a1565b506000949350505050565b60006020828403121561184057600080fd5b5035919050565b6001600160a01b038116811461152757600080fd5b6000806000806080858703121561187257600080fd5b843561187d81611847565b9350602085013561188d81611847565b92506040850135915060608501356118a481611847565b939692955090935050565b600080600080608085870312156118c557600080fd5b84356118d081611847565b93506020850135925060408501356118e781611847565b9396929550929360600135925050565b600080600080600060a0868803121561190f57600080fd5b853561191a81611847565b9450602086013561192a81611847565b935060408601359250606086013561194181611847565b949793965091946080013592915050565b60008060008060008060c0878903121561196b57600080fd5b863561197681611847565b9550602087013561198681611847565b945060408701359350606087013561199d81611847565b9598949750929560808101359460a0909101359350915050565b6000602082840312156119c957600080fd5b81356119d481611847565b9392505050565b600080604083850312156119ee57600080fd5b82356119f981611847565b91506020830135611a0981611847565b809150509250929050565b600080600080600060a08688031215611a2c57600080fd5b8535611a3781611847565b9450602086013593506040860135611a4e81611847565b94979396509394606081013594506080013592915050565b60008060408385031215611a7957600080fd5b823591506020830135611a0981611847565b60208082526019908201527f496e76616c6964206f776e6572206f72206f70657261746f7200000000000000604082015260600190565b6001600160a01b039586168152602081019490945260408401929092529092166060820152608081019190915260a00190565b600060208284031215611b0757600080fd5b81516119d481611847565b600060208284031215611b2457600080fd5b5051919050565b6001600160a01b039384168152919092166020820152604081019190915260600190565b600060208284031215611b6157600080fd5b815180151581146119d457600080fd5b6001600160e01b031991909116815260200190565b60005b83811015611ba1578181015183820152602001611b89565b50506000910152565b60018060a01b03851681528360208201526080604082015260008351806080840152611bdd8160a0850160208801611b86565b60ff93909316606083015250601f91909101601f19160160a0019392505050565b634e487b7160e01b600052604160045260246000fd5b600060208284031215611c2657600080fd5b815167ffffffffffffffff80821115611c3e57600080fd5b818401915084601f830112611c5257600080fd5b815181811115611c6457611c64611bfe565b604051601f8201601f19908116603f01168101908382118183101715611c8c57611c8c611bfe565b81604052828152876020848701011115611ca557600080fd5b611cb6836020830160208801611b86565b979650505050505050565b6001600160a01b0394851681529290931660208301526040820152606081019190915260a06080820181905260009082015260c00190565b60008251611d0b818460208701611b86565b919091019291505056fea264697066735822122068ee32b967ea96a2ba2f532af35cdc245a151927cb9948058cc6fe0d61ac9eb464736f6c63430008110033", + "devdoc": { + "kind": "dev", + "methods": { + "breakCovalentBond(address,address,uint256,address,uint256,uint256)": { + "params": { + "contractAddress": "The Address to the Contract of the Token to Energize", + "nftTokenAddress": "The Address of the NFT Token being deposited", + "nftTokenAmount": "The amount of Tokens to Withdraw (ERC1155-specific)", + "nftTokenId": "The ID of the NFT Token being deposited", + "receiver": "The Address to Receive the Released Asset Tokens", + "tokenId": "The ID of the Token to Energize" + } + }, + "covalentBond(address,uint256,address,uint256,uint256)": { + "params": { + "contractAddress": "The Address to the Contract of the Token to Energize", + "nftTokenAddress": "The Address of the NFT Token being deposited", + "nftTokenAmount": "The amount of Tokens to Deposit (ERC1155-specific)", + "nftTokenId": "The ID of the NFT Token being deposited", + "tokenId": "The ID of the Token to Energize" + } + }, + "energizeParticle(address,uint256,address,uint256)": { + "params": { + "assetAmount": "The Amount of Asset Token to Energize the Token with", + "assetToken": "The Address of the Asset Token being used", + "contractAddress": "The Address to the Contract of the Token to Energize", + "tokenId": "The ID of the Token to Energize" + } + }, + "getAccountImplementation(address)": { + "details": "..." + }, + "getCurrentRegistry()": { + "details": "..." + }, + "getExecutionController(address)": { + "details": "..." + }, + "getRegistry(uint256)": { + "details": "..." + }, + "owner()": { + "details": "Returns the address of the current owner." + }, + "renounceOwnership()": { + "details": "Leaves the contract without owner. It will not be possible to call `onlyOwner` functions. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby disabling any functionality that is only available to the owner." + }, + "setCustomAccountImplementation(address,address)": { + "details": "..." + }, + "setCustomExecutionController(address,address)": { + "details": "..." + }, + "setDefaultAccountImplementation(address)": { + "details": "..." + }, + "setDefaultExecutionController(address)": { + "details": "..." + }, + "setDefaultRegistryVersion(uint256)": { + "details": "..." + }, + "setRegistry(uint256,address)": { + "details": "..." + }, + "transferOwnership(address)": { + "details": "Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner." + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": { + "breakCovalentBond(address,address,uint256,address,uint256,uint256)": { + "notice": "Release NFT Assets from the Particle" + }, + "covalentBond(address,uint256,address,uint256,uint256)": { + "notice": "Deposit other NFT Assets into the Particle Must be called by the account providing the Asset Account must Approve THIS contract as Operator of Asset" + }, + "energizeParticle(address,uint256,address,uint256)": { + "notice": "Fund Particle with Asset Token Must be called by the account providing the Asset Account must Approve THIS contract as Operator of Asset" + } + }, + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 7, + "contract": "contracts/ChargedParticles.sol:ChargedParticles", + "label": "_owner", + "offset": 0, + "slot": "0", + "type": "t_address" + }, + { + "astId": 137, + "contract": "contracts/ChargedParticles.sol:ChargedParticles", + "label": "_status", + "offset": 0, + "slot": "1", + "type": "t_uint256" + }, + { + "astId": 4080, + "contract": "contracts/ChargedParticles.sol:ChargedParticles", + "label": "accountImplementations", + "offset": 0, + "slot": "2", + "type": "t_mapping(t_address,t_address)" + }, + { + "astId": 4082, + "contract": "contracts/ChargedParticles.sol:ChargedParticles", + "label": "defaultAccountImplementation", + "offset": 0, + "slot": "3", + "type": "t_address" + }, + { + "astId": 4086, + "contract": "contracts/ChargedParticles.sol:ChargedParticles", + "label": "executionControllers", + "offset": 0, + "slot": "4", + "type": "t_mapping(t_address,t_address)" + }, + { + "astId": 4088, + "contract": "contracts/ChargedParticles.sol:ChargedParticles", + "label": "defaultExecutionController", + "offset": 0, + "slot": "5", + "type": "t_address" + }, + { + "astId": 4092, + "contract": "contracts/ChargedParticles.sol:ChargedParticles", + "label": "erc6551registry", + "offset": 0, + "slot": "6", + "type": "t_mapping(t_uint256,t_address)" + }, + { + "astId": 4094, + "contract": "contracts/ChargedParticles.sol:ChargedParticles", + "label": "defaultRegistry", + "offset": 0, + "slot": "7", + "type": "t_uint256" + } + ], + "types": { + "t_address": { + "encoding": "inplace", + "label": "address", + "numberOfBytes": "20" + }, + "t_mapping(t_address,t_address)": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => address)", + "numberOfBytes": "32", + "value": "t_address" + }, + "t_mapping(t_uint256,t_address)": { + "encoding": "mapping", + "key": "t_uint256", + "label": "mapping(uint256 => address)", + "numberOfBytes": "32", + "value": "t_address" + }, + "t_uint256": { + "encoding": "inplace", + "label": "uint256", + "numberOfBytes": "32" + } + } + } +} \ No newline at end of file diff --git a/deployments/sepolia/SmartAccountController_Example1.json b/deployments/sepolia/SmartAccountController_Example1.json new file mode 100644 index 0000000..b6c384d --- /dev/null +++ b/deployments/sepolia/SmartAccountController_Example1.json @@ -0,0 +1,405 @@ +{ + "address": "0x65c34A8090d2A1992869A6db0f87D85B667e0216", + "abi": [ + { + "inputs": [], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "methodSignature", + "type": "bytes4" + } + ], + "name": "bannedMethods", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "isAllowedMethod", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + }, + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "name": "onExecute", + "outputs": [ + { + "internalType": "string", + "name": "revertReason", + "type": "string" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bool", + "name": "isReceiving", + "type": "bool" + }, + { + "internalType": "uint256", + "name": "chainId", + "type": "uint256" + }, + { + "internalType": "address", + "name": "tokenContract", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "address", + "name": "receivedTokenContract", + "type": "address" + }, + { + "internalType": "uint256", + "name": "receivedTokenId", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "onUpdateNFT", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bool", + "name": "isReceiving", + "type": "bool" + }, + { + "internalType": "uint256", + "name": "chainId", + "type": "uint256" + }, + { + "internalType": "address", + "name": "tokenContract", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "address", + "name": "receivedTokenContract", + "type": "address" + }, + { + "internalType": "uint256[]", + "name": "receivedTokenIds", + "type": "uint256[]" + }, + { + "internalType": "uint256[]", + "name": "", + "type": "uint256[]" + } + ], + "name": "onUpdateNFTBatch", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bool", + "name": "isReceiving", + "type": "bool" + }, + { + "internalType": "uint256", + "name": "chainId", + "type": "uint256" + }, + { + "internalType": "address", + "name": "tokenContract", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "address", + "name": "receivedAssetToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "receivedAssetAmount", + "type": "uint256" + } + ], + "name": "onUpdateToken", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "methodSignature", + "type": "bytes4" + }, + { + "internalType": "bool", + "name": "isBanned", + "type": "bool" + } + ], + "name": "setBannedMethod", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "interfaceId", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ], + "transactionHash": "0xd797f7b805e12e5581ecbbff2155c47c89215b584fda346f50d49e3d16b208c4", + "receipt": { + "to": null, + "from": "0x6d46b37708dA7Ed4E5C4509495768Fecd3D17C01", + "contractAddress": "0x65c34A8090d2A1992869A6db0f87D85B667e0216", + "transactionIndex": 70, + "gasUsed": "541204", + "logsBloom": "0x00000000000000000000000000000000000000000000000000800000000000000000000000001000000000000000000000000000000008000000000000000000000000000000000000000000000020000001000000000000000000000000000000000000020000000000000000000800000000000000000000000000000000400000000000000000000000000000000000000000040000000400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008000000000020000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x46dfeaf20d42d9e211422a42f888cc953b7f12e341e30bbfbb0ab11bac012eef", + "transactionHash": "0xd797f7b805e12e5581ecbbff2155c47c89215b584fda346f50d49e3d16b208c4", + "logs": [ + { + "transactionIndex": 70, + "blockNumber": 5328360, + "transactionHash": "0xd797f7b805e12e5581ecbbff2155c47c89215b584fda346f50d49e3d16b208c4", + "address": "0x65c34A8090d2A1992869A6db0f87D85B667e0216", + "topics": [ + "0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0", + "0x0000000000000000000000000000000000000000000000000000000000000000", + "0x0000000000000000000000006d46b37708da7ed4e5c4509495768fecd3d17c01" + ], + "data": "0x", + "logIndex": 129, + "blockHash": "0x46dfeaf20d42d9e211422a42f888cc953b7f12e341e30bbfbb0ab11bac012eef" + } + ], + "blockNumber": 5328360, + "cumulativeGasUsed": "8862677", + "status": 1, + "byzantium": true + }, + "args": [], + "numDeployments": 1, + "solcInputHash": "39d5a6c9cdeadda9b99b6b4ba5249a9f", + "metadata": "{\"compiler\":{\"version\":\"0.8.17+commit.8df45f5f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"methodSignature\",\"type\":\"bytes4\"}],\"name\":\"bannedMethods\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"isAllowedMethod\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"},{\"internalType\":\"uint8\",\"name\":\"\",\"type\":\"uint8\"}],\"name\":\"onExecute\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"revertReason\",\"type\":\"string\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bool\",\"name\":\"isReceiving\",\"type\":\"bool\"},{\"internalType\":\"uint256\",\"name\":\"chainId\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"tokenContract\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"receivedTokenContract\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"receivedTokenId\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"onUpdateNFT\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bool\",\"name\":\"isReceiving\",\"type\":\"bool\"},{\"internalType\":\"uint256\",\"name\":\"chainId\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"tokenContract\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"receivedTokenContract\",\"type\":\"address\"},{\"internalType\":\"uint256[]\",\"name\":\"receivedTokenIds\",\"type\":\"uint256[]\"},{\"internalType\":\"uint256[]\",\"name\":\"\",\"type\":\"uint256[]\"}],\"name\":\"onUpdateNFTBatch\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bool\",\"name\":\"isReceiving\",\"type\":\"bool\"},{\"internalType\":\"uint256\",\"name\":\"chainId\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"tokenContract\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"receivedAssetToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"receivedAssetAmount\",\"type\":\"uint256\"}],\"name\":\"onUpdateToken\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"methodSignature\",\"type\":\"bytes4\"},{\"internalType\":\"bool\",\"name\":\"isBanned\",\"type\":\"bool\"}],\"name\":\"setBannedMethod\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"interfaceId\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"owner()\":{\"details\":\"Returns the address of the current owner.\"},\"renounceOwnership()\":{\"details\":\"Leaves the contract without owner. It will not be possible to call `onlyOwner` functions. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby disabling any functionality that is only available to the owner.\"},\"supportsInterface(bytes4)\":{\"details\":\"Returns true if a given interfaceId is supported by this account. This method can be extended by an override.\"},\"transferOwnership(address)\":{\"details\":\"Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner.\"}},\"stateVariables\":{\"_bannedMethods\":{\"details\":\"mapping from method signature => banned method call\"}},\"title\":\"A SmartAccount Controller which only allows specific methods to be executed on the associated SmartAccount\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/controllers/SmartAccountController_Example1.sol\":\"SmartAccountController_Example1\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/access/Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../utils/Context.sol\\\";\\n\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\n * the owner.\\n */\\nabstract contract Ownable is Context {\\n address private _owner;\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the deployer as the initial owner.\\n */\\n constructor() {\\n _transferOwnership(_msgSender());\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n _checkOwner();\\n _;\\n }\\n\\n /**\\n * @dev Returns the address of the current owner.\\n */\\n function owner() public view virtual returns (address) {\\n return _owner;\\n }\\n\\n /**\\n * @dev Throws if the sender is not the owner.\\n */\\n function _checkOwner() internal view virtual {\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby disabling any functionality that is only available to the owner.\\n */\\n function renounceOwnership() public virtual onlyOwner {\\n _transferOwnership(address(0));\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\n _transferOwnership(newOwner);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Internal function without access restriction.\\n */\\n function _transferOwnership(address newOwner) internal virtual {\\n address oldOwner = _owner;\\n _owner = newOwner;\\n emit OwnershipTransferred(oldOwner, newOwner);\\n }\\n}\\n\",\"keccak256\":\"0xba43b97fba0d32eb4254f6a5a297b39a19a247082a02d6e69349e071e2946218\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract Context {\\n function _msgSender() internal view virtual returns (address) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes calldata) {\\n return msg.data;\\n }\\n}\\n\",\"keccak256\":\"0xe2e337e6dde9ef6b680e07338c493ebea1b5fd09b43424112868e9cc1706bca7\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/ERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./IERC165.sol\\\";\\n\\n/**\\n * @dev Implementation of the {IERC165} interface.\\n *\\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\\n * for the additional interface id that will be supported. For example:\\n *\\n * ```solidity\\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\\n * }\\n * ```\\n *\\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\\n */\\nabstract contract ERC165 is IERC165 {\\n /**\\n * @dev See {IERC165-supportsInterface}.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n return interfaceId == type(IERC165).interfaceId;\\n }\\n}\\n\",\"keccak256\":\"0xd10975de010d89fd1c78dc5e8a9a7e7f496198085c151648f20cba166b32582b\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/IERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC165 standard, as defined in the\\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\\n *\\n * Implementers can declare support of contract interfaces, which can then be\\n * queried by others ({ERC165Checker}).\\n *\\n * For an implementation, see {ERC165}.\\n */\\ninterface IERC165 {\\n /**\\n * @dev Returns true if this contract implements the interface defined by\\n * `interfaceId`. See the corresponding\\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\\n * to learn more about how these ids are created.\\n *\\n * This function call must use less than 30 000 gas.\\n */\\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x447a5f3ddc18419d41ff92b3773fb86471b1db25773e07f877f548918a185bf1\",\"license\":\"MIT\"},\"contracts/controllers/SmartAccountController_Example1.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\npragma solidity ^0.8.13;\\n\\nimport {IERC165, ERC165} from \\\"@openzeppelin/contracts/utils/introspection/ERC165.sol\\\";\\nimport {Ownable} from \\\"@openzeppelin/contracts/access/Ownable.sol\\\";\\nimport {ISmartAccountController} from \\\"../interfaces/ISmartAccountController.sol\\\";\\n\\n/**\\n * @title A SmartAccount Controller which only allows specific methods to be executed on the associated SmartAccount\\n */\\ncontract SmartAccountController_Example1 is ISmartAccountController, Ownable, ERC165 {\\n\\n /// @dev mapping from method signature => banned method call\\n mapping(bytes4 => bool) internal _bannedMethods;\\n\\n\\n // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\\n // Initialization\\n constructor() Ownable() {}\\n\\n\\n // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\\n // Banned Methods Logic\\n\\n function bannedMethods(bytes4 methodSignature) external view virtual returns (bool) {\\n return _bannedMethods[methodSignature];\\n }\\n\\n function isAllowedMethod(bytes calldata data) external view virtual returns (bool) {\\n return _isAllowedMethod(data);\\n }\\n\\n function setBannedMethod(bytes4 methodSignature, bool isBanned) external virtual onlyOwner {\\n _bannedMethods[methodSignature] = isBanned;\\n }\\n\\n function _isAllowedMethod(bytes calldata _data) internal view returns (bool) {\\n bytes4 signature = bytes4(_data[:4]);\\n return !_bannedMethods[signature];\\n }\\n\\n\\n // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\\n // SmartAccount Controller Logic\\n\\n function onExecute(\\n address,\\n uint256,\\n bytes calldata data,\\n uint8\\n ) external virtual override returns (string memory revertReason) {\\n if (!_isAllowedMethod(data)) {\\n revertReason = \\\"Method call not allowed\\\";\\n }\\n // else success\\n }\\n\\n function onUpdateToken(\\n bool isReceiving,\\n uint256 chainId,\\n address tokenContract,\\n uint256 tokenId,\\n address receivedAssetToken,\\n uint256 receivedAssetAmount\\n )\\n external\\n virtual\\n override\\n {\\n // perform conditional logic here..\\n }\\n\\n function onUpdateNFT(\\n bool isReceiving,\\n uint256 chainId,\\n address tokenContract,\\n uint256 tokenId,\\n address receivedTokenContract,\\n uint256 receivedTokenId,\\n uint256\\n )\\n external\\n virtual\\n override\\n {\\n // perform conditional logic here..\\n }\\n\\n function onUpdateNFTBatch(\\n bool isReceiving,\\n uint256 chainId,\\n address tokenContract,\\n uint256 tokenId,\\n address receivedTokenContract,\\n uint256[] calldata receivedTokenIds,\\n uint256[] calldata\\n )\\n external\\n virtual\\n override\\n {\\n // perform conditional logic here..\\n }\\n\\n\\n // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\\n // Interface Identification\\n\\n /// @dev Returns true if a given interfaceId is supported by this account. This method can be\\n /// extended by an override.\\n function supportsInterface(bytes4 interfaceId)\\n public\\n view\\n virtual\\n override(IERC165, ERC165)\\n returns (bool)\\n {\\n return\\n interfaceId == type(ISmartAccountController).interfaceId ||\\n super.supportsInterface(interfaceId);\\n }\\n}\\n\",\"keccak256\":\"0x9eed007bf276728a4444f304aa28bc42bb4fa995f52c551c901a455d86afd6b9\",\"license\":\"UNLICENSED\"},\"contracts/interfaces/ISmartAccountController.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\npragma solidity ^0.8.13;\\n\\nimport {IERC165} from \\\"@openzeppelin/contracts/utils/introspection/IERC165.sol\\\";\\n\\n/**\\n * @title\\n */\\ninterface ISmartAccountController is IERC165 {\\n function onExecute(\\n address to,\\n uint256 value,\\n bytes calldata data,\\n uint8 operation\\n ) external returns (string memory revertReason);\\n\\n function onUpdateToken(\\n bool isReceiving,\\n uint256 chainId,\\n address tokenContract,\\n uint256 tokenId,\\n address receivedAssetToken,\\n uint256 receivedAssetAmount\\n ) external;\\n\\n function onUpdateNFT(\\n bool isReceiving,\\n uint256 chainId,\\n address tokenContract,\\n uint256 tokenId,\\n address receivedTokenContract,\\n uint256 receivedTokenId,\\n uint256 receivedTokenAmount\\n ) external;\\n\\n function onUpdateNFTBatch(\\n bool isReceiving,\\n uint256 chainId,\\n address tokenContract,\\n uint256 tokenId,\\n address receivedTokenContract,\\n uint256[] calldata receivedTokenIds,\\n uint256[] calldata receivedTokenAmounts\\n ) external;\\n}\\n\",\"keccak256\":\"0x5e88c28a39826906d5490c52fc767d7f3e3a6536b13e9949f7d689f378213001\",\"license\":\"UNLICENSED\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b5061001a3361001f565b61006f565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6108608061007e6000396000f3fe608060405234801561001057600080fd5b50600436106100a85760003560e01c806380ced4bf1161007157806380ced4bf146101295780638da5cb5b1461013f578063c6ab098f1461015a578063ed64b4ea1461016d578063f00791101461019a578063f2fde38b146101b357600080fd5b8062da7713146100ad57806301ffc9a7146100c657806349a70334146100ee57806358f202bb1461010e578063715018a614610121575b600080fd5b6100c46100bb366004610439565b50505050505050565b005b6100d96100d43660046104bb565b6101c6565b60405190151581526020015b60405180910390f35b6101016100fc36600461051f565b6101fd565b6040516100e59190610597565b6100c461011c3660046105e5565b61024c565b6100c4610280565b6100c4610137366004610618565b505050505050565b6000546040516001600160a01b0390911681526020016100e5565b6100d9610168366004610677565b610294565b6100d961017b3660046104bb565b6001600160e01b03191660009081526001602052604090205460ff1690565b6100c46101a83660046106fe565b505050505050505050565b6100c46101c13660046107b5565b6102a7565b60006001600160e01b03198216630736863160e31b14806101f757506301ffc9a760e01b6001600160e01b03198316145b92915050565b60606102098484610325565b610243575060408051808201909152601781527f4d6574686f642063616c6c206e6f7420616c6c6f77656400000000000000000060208201525b95945050505050565b610254610363565b6001600160e01b0319919091166000908152600160205260409020805460ff1916911515919091179055565b610288610363565b61029260006103bd565b565b60006102a08383610325565b9392505050565b6102af610363565b6001600160a01b0381166103195760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084015b60405180910390fd5b610322816103bd565b50565b60008061033560048285876107d0565b61033e916107fa565b6001600160e01b03191660009081526001602052604090205460ff1615949350505050565b6000546001600160a01b031633146102925760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610310565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b8035801515811461041d57600080fd5b919050565b80356001600160a01b038116811461041d57600080fd5b600080600080600080600060e0888a03121561045457600080fd5b61045d8861040d565b96506020880135955061047260408901610422565b94506060880135935061048760808901610422565b925060a0880135915060c0880135905092959891949750929550565b80356001600160e01b03198116811461041d57600080fd5b6000602082840312156104cd57600080fd5b6102a0826104a3565b60008083601f8401126104e857600080fd5b50813567ffffffffffffffff81111561050057600080fd5b60208301915083602082850101111561051857600080fd5b9250929050565b60008060008060006080868803121561053757600080fd5b61054086610422565b945060208601359350604086013567ffffffffffffffff81111561056357600080fd5b61056f888289016104d6565b909450925050606086013560ff8116811461058957600080fd5b809150509295509295909350565b600060208083528351808285015260005b818110156105c4578581018301518582016040015282016105a8565b506000604082860101526040601f19601f8301168501019250505092915050565b600080604083850312156105f857600080fd5b610601836104a3565b915061060f6020840161040d565b90509250929050565b60008060008060008060c0878903121561063157600080fd5b61063a8761040d565b95506020870135945061064f60408801610422565b93506060870135925061066460808801610422565b915060a087013590509295509295509295565b6000806020838503121561068a57600080fd5b823567ffffffffffffffff8111156106a157600080fd5b6106ad858286016104d6565b90969095509350505050565b60008083601f8401126106cb57600080fd5b50813567ffffffffffffffff8111156106e357600080fd5b6020830191508360208260051b850101111561051857600080fd5b600080600080600080600080600060e08a8c03121561071c57600080fd5b6107258a61040d565b985060208a0135975061073a60408b01610422565b965060608a0135955061074f60808b01610422565b945060a08a013567ffffffffffffffff8082111561076c57600080fd5b6107788d838e016106b9565b909650945060c08c013591508082111561079157600080fd5b5061079e8c828d016106b9565b915080935050809150509295985092959850929598565b6000602082840312156107c757600080fd5b6102a082610422565b600080858511156107e057600080fd5b838611156107ed57600080fd5b5050820193919092039150565b6001600160e01b031981358181169160048510156108225780818660040360031b1b83161692505b50509291505056fea264697066735822122080567d7a29b9d027c788093c60b26a1025a953c9a188556d2ecb60712e3eb0ee64736f6c63430008110033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100a85760003560e01c806380ced4bf1161007157806380ced4bf146101295780638da5cb5b1461013f578063c6ab098f1461015a578063ed64b4ea1461016d578063f00791101461019a578063f2fde38b146101b357600080fd5b8062da7713146100ad57806301ffc9a7146100c657806349a70334146100ee57806358f202bb1461010e578063715018a614610121575b600080fd5b6100c46100bb366004610439565b50505050505050565b005b6100d96100d43660046104bb565b6101c6565b60405190151581526020015b60405180910390f35b6101016100fc36600461051f565b6101fd565b6040516100e59190610597565b6100c461011c3660046105e5565b61024c565b6100c4610280565b6100c4610137366004610618565b505050505050565b6000546040516001600160a01b0390911681526020016100e5565b6100d9610168366004610677565b610294565b6100d961017b3660046104bb565b6001600160e01b03191660009081526001602052604090205460ff1690565b6100c46101a83660046106fe565b505050505050505050565b6100c46101c13660046107b5565b6102a7565b60006001600160e01b03198216630736863160e31b14806101f757506301ffc9a760e01b6001600160e01b03198316145b92915050565b60606102098484610325565b610243575060408051808201909152601781527f4d6574686f642063616c6c206e6f7420616c6c6f77656400000000000000000060208201525b95945050505050565b610254610363565b6001600160e01b0319919091166000908152600160205260409020805460ff1916911515919091179055565b610288610363565b61029260006103bd565b565b60006102a08383610325565b9392505050565b6102af610363565b6001600160a01b0381166103195760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084015b60405180910390fd5b610322816103bd565b50565b60008061033560048285876107d0565b61033e916107fa565b6001600160e01b03191660009081526001602052604090205460ff1615949350505050565b6000546001600160a01b031633146102925760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610310565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b8035801515811461041d57600080fd5b919050565b80356001600160a01b038116811461041d57600080fd5b600080600080600080600060e0888a03121561045457600080fd5b61045d8861040d565b96506020880135955061047260408901610422565b94506060880135935061048760808901610422565b925060a0880135915060c0880135905092959891949750929550565b80356001600160e01b03198116811461041d57600080fd5b6000602082840312156104cd57600080fd5b6102a0826104a3565b60008083601f8401126104e857600080fd5b50813567ffffffffffffffff81111561050057600080fd5b60208301915083602082850101111561051857600080fd5b9250929050565b60008060008060006080868803121561053757600080fd5b61054086610422565b945060208601359350604086013567ffffffffffffffff81111561056357600080fd5b61056f888289016104d6565b909450925050606086013560ff8116811461058957600080fd5b809150509295509295909350565b600060208083528351808285015260005b818110156105c4578581018301518582016040015282016105a8565b506000604082860101526040601f19601f8301168501019250505092915050565b600080604083850312156105f857600080fd5b610601836104a3565b915061060f6020840161040d565b90509250929050565b60008060008060008060c0878903121561063157600080fd5b61063a8761040d565b95506020870135945061064f60408801610422565b93506060870135925061066460808801610422565b915060a087013590509295509295509295565b6000806020838503121561068a57600080fd5b823567ffffffffffffffff8111156106a157600080fd5b6106ad858286016104d6565b90969095509350505050565b60008083601f8401126106cb57600080fd5b50813567ffffffffffffffff8111156106e357600080fd5b6020830191508360208260051b850101111561051857600080fd5b600080600080600080600080600060e08a8c03121561071c57600080fd5b6107258a61040d565b985060208a0135975061073a60408b01610422565b965060608a0135955061074f60808b01610422565b945060a08a013567ffffffffffffffff8082111561076c57600080fd5b6107788d838e016106b9565b909650945060c08c013591508082111561079157600080fd5b5061079e8c828d016106b9565b915080935050809150509295985092959850929598565b6000602082840312156107c757600080fd5b6102a082610422565b600080858511156107e057600080fd5b838611156107ed57600080fd5b5050820193919092039150565b6001600160e01b031981358181169160048510156108225780818660040360031b1b83161692505b50509291505056fea264697066735822122080567d7a29b9d027c788093c60b26a1025a953c9a188556d2ecb60712e3eb0ee64736f6c63430008110033", + "devdoc": { + "kind": "dev", + "methods": { + "owner()": { + "details": "Returns the address of the current owner." + }, + "renounceOwnership()": { + "details": "Leaves the contract without owner. It will not be possible to call `onlyOwner` functions. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby disabling any functionality that is only available to the owner." + }, + "supportsInterface(bytes4)": { + "details": "Returns true if a given interfaceId is supported by this account. This method can be extended by an override." + }, + "transferOwnership(address)": { + "details": "Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner." + } + }, + "stateVariables": { + "_bannedMethods": { + "details": "mapping from method signature => banned method call" + } + }, + "title": "A SmartAccount Controller which only allows specific methods to be executed on the associated SmartAccount", + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 7, + "contract": "contracts/controllers/SmartAccountController_Example1.sol:SmartAccountController_Example1", + "label": "_owner", + "offset": 0, + "slot": "0", + "type": "t_address" + }, + { + "astId": 5049, + "contract": "contracts/controllers/SmartAccountController_Example1.sol:SmartAccountController_Example1", + "label": "_bannedMethods", + "offset": 0, + "slot": "1", + "type": "t_mapping(t_bytes4,t_bool)" + } + ], + "types": { + "t_address": { + "encoding": "inplace", + "label": "address", + "numberOfBytes": "20" + }, + "t_bool": { + "encoding": "inplace", + "label": "bool", + "numberOfBytes": "1" + }, + "t_bytes4": { + "encoding": "inplace", + "label": "bytes4", + "numberOfBytes": "4" + }, + "t_mapping(t_bytes4,t_bool)": { + "encoding": "mapping", + "key": "t_bytes4", + "label": "mapping(bytes4 => bool)", + "numberOfBytes": "32", + "value": "t_bool" + } + } + } +} \ No newline at end of file diff --git a/deployments/sepolia/solcInputs/39d5a6c9cdeadda9b99b6b4ba5249a9f.json b/deployments/sepolia/solcInputs/39d5a6c9cdeadda9b99b6b4ba5249a9f.json new file mode 100644 index 0000000..994ad36 --- /dev/null +++ b/deployments/sepolia/solcInputs/39d5a6c9cdeadda9b99b6b4ba5249a9f.json @@ -0,0 +1,146 @@ +{ + "language": "Solidity", + "sources": { + "@openzeppelin/contracts/access/Ownable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/Context.sol\";\n\n/**\n * @dev Contract module which provides a basic access control mechanism, where\n * there is an account (an owner) that can be granted exclusive access to\n * specific functions.\n *\n * By default, the owner account will be the one that deploys the contract. This\n * can later be changed with {transferOwnership}.\n *\n * This module is used through inheritance. It will make available the modifier\n * `onlyOwner`, which can be applied to your functions to restrict their use to\n * the owner.\n */\nabstract contract Ownable is Context {\n address private _owner;\n\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n\n /**\n * @dev Initializes the contract setting the deployer as the initial owner.\n */\n constructor() {\n _transferOwnership(_msgSender());\n }\n\n /**\n * @dev Throws if called by any account other than the owner.\n */\n modifier onlyOwner() {\n _checkOwner();\n _;\n }\n\n /**\n * @dev Returns the address of the current owner.\n */\n function owner() public view virtual returns (address) {\n return _owner;\n }\n\n /**\n * @dev Throws if the sender is not the owner.\n */\n function _checkOwner() internal view virtual {\n require(owner() == _msgSender(), \"Ownable: caller is not the owner\");\n }\n\n /**\n * @dev Leaves the contract without owner. It will not be possible to call\n * `onlyOwner` functions. Can only be called by the current owner.\n *\n * NOTE: Renouncing ownership will leave the contract without an owner,\n * thereby disabling any functionality that is only available to the owner.\n */\n function renounceOwnership() public virtual onlyOwner {\n _transferOwnership(address(0));\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Can only be called by the current owner.\n */\n function transferOwnership(address newOwner) public virtual onlyOwner {\n require(newOwner != address(0), \"Ownable: new owner is the zero address\");\n _transferOwnership(newOwner);\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Internal function without access restriction.\n */\n function _transferOwnership(address newOwner) internal virtual {\n address oldOwner = _owner;\n _owner = newOwner;\n emit OwnershipTransferred(oldOwner, newOwner);\n }\n}\n" + }, + "@openzeppelin/contracts/interfaces/IERC1271.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (interfaces/IERC1271.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC1271 standard signature validation method for\n * contracts as defined in https://eips.ethereum.org/EIPS/eip-1271[ERC-1271].\n *\n * _Available since v4.1._\n */\ninterface IERC1271 {\n /**\n * @dev Should return whether the signature provided is valid for the provided data\n * @param hash Hash of the data to be signed\n * @param signature Signature byte array associated with _data\n */\n function isValidSignature(bytes32 hash, bytes memory signature) external view returns (bytes4 magicValue);\n}\n" + }, + "@openzeppelin/contracts/security/ReentrancyGuard.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (security/ReentrancyGuard.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Contract module that helps prevent reentrant calls to a function.\n *\n * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier\n * available, which can be applied to functions to make sure there are no nested\n * (reentrant) calls to them.\n *\n * Note that because there is a single `nonReentrant` guard, functions marked as\n * `nonReentrant` may not call one another. This can be worked around by making\n * those functions `private`, and then adding `external` `nonReentrant` entry\n * points to them.\n *\n * TIP: If you would like to learn more about reentrancy and alternative ways\n * to protect against it, check out our blog post\n * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].\n */\nabstract contract ReentrancyGuard {\n // Booleans are more expensive than uint256 or any type that takes up a full\n // word because each write operation emits an extra SLOAD to first read the\n // slot's contents, replace the bits taken up by the boolean, and then write\n // back. This is the compiler's defense against contract upgrades and\n // pointer aliasing, and it cannot be disabled.\n\n // The values being non-zero value makes deployment a bit more expensive,\n // but in exchange the refund on every call to nonReentrant will be lower in\n // amount. Since refunds are capped to a percentage of the total\n // transaction's gas, it is best to keep them low in cases like this one, to\n // increase the likelihood of the full refund coming into effect.\n uint256 private constant _NOT_ENTERED = 1;\n uint256 private constant _ENTERED = 2;\n\n uint256 private _status;\n\n constructor() {\n _status = _NOT_ENTERED;\n }\n\n /**\n * @dev Prevents a contract from calling itself, directly or indirectly.\n * Calling a `nonReentrant` function from another `nonReentrant`\n * function is not supported. It is possible to prevent this from happening\n * by making the `nonReentrant` function external, and making it call a\n * `private` function that does the actual work.\n */\n modifier nonReentrant() {\n _nonReentrantBefore();\n _;\n _nonReentrantAfter();\n }\n\n function _nonReentrantBefore() private {\n // On the first call to nonReentrant, _status will be _NOT_ENTERED\n require(_status != _ENTERED, \"ReentrancyGuard: reentrant call\");\n\n // Any calls to nonReentrant after this point will fail\n _status = _ENTERED;\n }\n\n function _nonReentrantAfter() private {\n // By storing the original value once again, a refund is triggered (see\n // https://eips.ethereum.org/EIPS/eip-2200)\n _status = _NOT_ENTERED;\n }\n\n /**\n * @dev Returns true if the reentrancy guard is currently set to \"entered\", which indicates there is a\n * `nonReentrant` function in the call stack.\n */\n function _reentrancyGuardEntered() internal view returns (bool) {\n return _status == _ENTERED;\n }\n}\n" + }, + "@openzeppelin/contracts/token/ERC1155/IERC1155.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC1155/IERC1155.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165.sol\";\n\n/**\n * @dev Required interface of an ERC1155 compliant contract, as defined in the\n * https://eips.ethereum.org/EIPS/eip-1155[EIP].\n *\n * _Available since v3.1._\n */\ninterface IERC1155 is IERC165 {\n /**\n * @dev Emitted when `value` tokens of token type `id` are transferred from `from` to `to` by `operator`.\n */\n event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value);\n\n /**\n * @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all\n * transfers.\n */\n event TransferBatch(\n address indexed operator,\n address indexed from,\n address indexed to,\n uint256[] ids,\n uint256[] values\n );\n\n /**\n * @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to\n * `approved`.\n */\n event ApprovalForAll(address indexed account, address indexed operator, bool approved);\n\n /**\n * @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI.\n *\n * If an {URI} event was emitted for `id`, the standard\n * https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value\n * returned by {IERC1155MetadataURI-uri}.\n */\n event URI(string value, uint256 indexed id);\n\n /**\n * @dev Returns the amount of tokens of token type `id` owned by `account`.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n */\n function balanceOf(address account, uint256 id) external view returns (uint256);\n\n /**\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}.\n *\n * Requirements:\n *\n * - `accounts` and `ids` must have the same length.\n */\n function balanceOfBatch(\n address[] calldata accounts,\n uint256[] calldata ids\n ) external view returns (uint256[] memory);\n\n /**\n * @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`,\n *\n * Emits an {ApprovalForAll} event.\n *\n * Requirements:\n *\n * - `operator` cannot be the caller.\n */\n function setApprovalForAll(address operator, bool approved) external;\n\n /**\n * @dev Returns true if `operator` is approved to transfer ``account``'s tokens.\n *\n * See {setApprovalForAll}.\n */\n function isApprovedForAll(address account, address operator) external view returns (bool);\n\n /**\n * @dev Transfers `amount` tokens of token type `id` from `from` to `to`.\n *\n * Emits a {TransferSingle} event.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - If the caller is not `from`, it must have been approved to spend ``from``'s tokens via {setApprovalForAll}.\n * - `from` must have a balance of tokens of type `id` of at least `amount`.\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the\n * acceptance magic value.\n */\n function safeTransferFrom(address from, address to, uint256 id, uint256 amount, bytes calldata data) external;\n\n /**\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.\n *\n * Emits a {TransferBatch} event.\n *\n * Requirements:\n *\n * - `ids` and `amounts` must have the same length.\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the\n * acceptance magic value.\n */\n function safeBatchTransferFrom(\n address from,\n address to,\n uint256[] calldata ids,\n uint256[] calldata amounts,\n bytes calldata data\n ) external;\n}\n" + }, + "@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC1155/IERC1155Receiver.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165.sol\";\n\n/**\n * @dev _Available since v3.1._\n */\ninterface IERC1155Receiver is IERC165 {\n /**\n * @dev Handles the receipt of a single ERC1155 token type. This function is\n * called at the end of a `safeTransferFrom` after the balance has been updated.\n *\n * NOTE: To accept the transfer, this must return\n * `bytes4(keccak256(\"onERC1155Received(address,address,uint256,uint256,bytes)\"))`\n * (i.e. 0xf23a6e61, or its own function selector).\n *\n * @param operator The address which initiated the transfer (i.e. msg.sender)\n * @param from The address which previously owned the token\n * @param id The ID of the token being transferred\n * @param value The amount of tokens being transferred\n * @param data Additional data with no specified format\n * @return `bytes4(keccak256(\"onERC1155Received(address,address,uint256,uint256,bytes)\"))` if transfer is allowed\n */\n function onERC1155Received(\n address operator,\n address from,\n uint256 id,\n uint256 value,\n bytes calldata data\n ) external returns (bytes4);\n\n /**\n * @dev Handles the receipt of a multiple ERC1155 token types. This function\n * is called at the end of a `safeBatchTransferFrom` after the balances have\n * been updated.\n *\n * NOTE: To accept the transfer(s), this must return\n * `bytes4(keccak256(\"onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)\"))`\n * (i.e. 0xbc197c81, or its own function selector).\n *\n * @param operator The address which initiated the batch transfer (i.e. msg.sender)\n * @param from The address which previously owned the token\n * @param ids An array containing ids of each token being transferred (order and length must match values array)\n * @param values An array containing amounts of each token being transferred (order and length must match ids array)\n * @param data Additional data with no specified format\n * @return `bytes4(keccak256(\"onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)\"))` if transfer is allowed\n */\n function onERC1155BatchReceived(\n address operator,\n address from,\n uint256[] calldata ids,\n uint256[] calldata values,\n bytes calldata data\n ) external returns (bytes4);\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/IERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20 {\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n\n /**\n * @dev Returns the amount of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the amount of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `to`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address to, uint256 amount) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 amount) external returns (bool);\n\n /**\n * @dev Moves `amount` tokens from `from` to `to` using the\n * allowance mechanism. `amount` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(address from, address to, uint256 amount) external returns (bool);\n}\n" + }, + "@openzeppelin/contracts/token/ERC721/ERC721.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC721/ERC721.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC721.sol\";\nimport \"./IERC721Receiver.sol\";\nimport \"./extensions/IERC721Metadata.sol\";\nimport \"../../utils/Address.sol\";\nimport \"../../utils/Context.sol\";\nimport \"../../utils/Strings.sol\";\nimport \"../../utils/introspection/ERC165.sol\";\n\n/**\n * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including\n * the Metadata extension, but not including the Enumerable extension, which is available separately as\n * {ERC721Enumerable}.\n */\ncontract ERC721 is Context, ERC165, IERC721, IERC721Metadata {\n using Address for address;\n using Strings for uint256;\n\n // Token name\n string private _name;\n\n // Token symbol\n string private _symbol;\n\n // Mapping from token ID to owner address\n mapping(uint256 => address) private _owners;\n\n // Mapping owner address to token count\n mapping(address => uint256) private _balances;\n\n // Mapping from token ID to approved address\n mapping(uint256 => address) private _tokenApprovals;\n\n // Mapping from owner to operator approvals\n mapping(address => mapping(address => bool)) private _operatorApprovals;\n\n /**\n * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection.\n */\n constructor(string memory name_, string memory symbol_) {\n _name = name_;\n _symbol = symbol_;\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {\n return\n interfaceId == type(IERC721).interfaceId ||\n interfaceId == type(IERC721Metadata).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev See {IERC721-balanceOf}.\n */\n function balanceOf(address owner) public view virtual override returns (uint256) {\n require(owner != address(0), \"ERC721: address zero is not a valid owner\");\n return _balances[owner];\n }\n\n /**\n * @dev See {IERC721-ownerOf}.\n */\n function ownerOf(uint256 tokenId) public view virtual override returns (address) {\n address owner = _ownerOf(tokenId);\n require(owner != address(0), \"ERC721: invalid token ID\");\n return owner;\n }\n\n /**\n * @dev See {IERC721Metadata-name}.\n */\n function name() public view virtual override returns (string memory) {\n return _name;\n }\n\n /**\n * @dev See {IERC721Metadata-symbol}.\n */\n function symbol() public view virtual override returns (string memory) {\n return _symbol;\n }\n\n /**\n * @dev See {IERC721Metadata-tokenURI}.\n */\n function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {\n _requireMinted(tokenId);\n\n string memory baseURI = _baseURI();\n return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : \"\";\n }\n\n /**\n * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each\n * token will be the concatenation of the `baseURI` and the `tokenId`. Empty\n * by default, can be overridden in child contracts.\n */\n function _baseURI() internal view virtual returns (string memory) {\n return \"\";\n }\n\n /**\n * @dev See {IERC721-approve}.\n */\n function approve(address to, uint256 tokenId) public virtual override {\n address owner = ERC721.ownerOf(tokenId);\n require(to != owner, \"ERC721: approval to current owner\");\n\n require(\n _msgSender() == owner || isApprovedForAll(owner, _msgSender()),\n \"ERC721: approve caller is not token owner or approved for all\"\n );\n\n _approve(to, tokenId);\n }\n\n /**\n * @dev See {IERC721-getApproved}.\n */\n function getApproved(uint256 tokenId) public view virtual override returns (address) {\n _requireMinted(tokenId);\n\n return _tokenApprovals[tokenId];\n }\n\n /**\n * @dev See {IERC721-setApprovalForAll}.\n */\n function setApprovalForAll(address operator, bool approved) public virtual override {\n _setApprovalForAll(_msgSender(), operator, approved);\n }\n\n /**\n * @dev See {IERC721-isApprovedForAll}.\n */\n function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) {\n return _operatorApprovals[owner][operator];\n }\n\n /**\n * @dev See {IERC721-transferFrom}.\n */\n function transferFrom(address from, address to, uint256 tokenId) public virtual override {\n //solhint-disable-next-line max-line-length\n require(_isApprovedOrOwner(_msgSender(), tokenId), \"ERC721: caller is not token owner or approved\");\n\n _transfer(from, to, tokenId);\n }\n\n /**\n * @dev See {IERC721-safeTransferFrom}.\n */\n function safeTransferFrom(address from, address to, uint256 tokenId) public virtual override {\n safeTransferFrom(from, to, tokenId, \"\");\n }\n\n /**\n * @dev See {IERC721-safeTransferFrom}.\n */\n function safeTransferFrom(address from, address to, uint256 tokenId, bytes memory data) public virtual override {\n require(_isApprovedOrOwner(_msgSender(), tokenId), \"ERC721: caller is not token owner or approved\");\n _safeTransfer(from, to, tokenId, data);\n }\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\n *\n * `data` is additional data, it has no specified format and it is sent in call to `to`.\n *\n * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g.\n * implement alternative mechanisms to perform token transfer, such as signature-based.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function _safeTransfer(address from, address to, uint256 tokenId, bytes memory data) internal virtual {\n _transfer(from, to, tokenId);\n require(_checkOnERC721Received(from, to, tokenId, data), \"ERC721: transfer to non ERC721Receiver implementer\");\n }\n\n /**\n * @dev Returns the owner of the `tokenId`. Does NOT revert if token doesn't exist\n */\n function _ownerOf(uint256 tokenId) internal view virtual returns (address) {\n return _owners[tokenId];\n }\n\n /**\n * @dev Returns whether `tokenId` exists.\n *\n * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.\n *\n * Tokens start existing when they are minted (`_mint`),\n * and stop existing when they are burned (`_burn`).\n */\n function _exists(uint256 tokenId) internal view virtual returns (bool) {\n return _ownerOf(tokenId) != address(0);\n }\n\n /**\n * @dev Returns whether `spender` is allowed to manage `tokenId`.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) {\n address owner = ERC721.ownerOf(tokenId);\n return (spender == owner || isApprovedForAll(owner, spender) || getApproved(tokenId) == spender);\n }\n\n /**\n * @dev Safely mints `tokenId` and transfers it to `to`.\n *\n * Requirements:\n *\n * - `tokenId` must not exist.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function _safeMint(address to, uint256 tokenId) internal virtual {\n _safeMint(to, tokenId, \"\");\n }\n\n /**\n * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is\n * forwarded in {IERC721Receiver-onERC721Received} to contract recipients.\n */\n function _safeMint(address to, uint256 tokenId, bytes memory data) internal virtual {\n _mint(to, tokenId);\n require(\n _checkOnERC721Received(address(0), to, tokenId, data),\n \"ERC721: transfer to non ERC721Receiver implementer\"\n );\n }\n\n /**\n * @dev Mints `tokenId` and transfers it to `to`.\n *\n * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible\n *\n * Requirements:\n *\n * - `tokenId` must not exist.\n * - `to` cannot be the zero address.\n *\n * Emits a {Transfer} event.\n */\n function _mint(address to, uint256 tokenId) internal virtual {\n require(to != address(0), \"ERC721: mint to the zero address\");\n require(!_exists(tokenId), \"ERC721: token already minted\");\n\n _beforeTokenTransfer(address(0), to, tokenId, 1);\n\n // Check that tokenId was not minted by `_beforeTokenTransfer` hook\n require(!_exists(tokenId), \"ERC721: token already minted\");\n\n unchecked {\n // Will not overflow unless all 2**256 token ids are minted to the same owner.\n // Given that tokens are minted one by one, it is impossible in practice that\n // this ever happens. Might change if we allow batch minting.\n // The ERC fails to describe this case.\n _balances[to] += 1;\n }\n\n _owners[tokenId] = to;\n\n emit Transfer(address(0), to, tokenId);\n\n _afterTokenTransfer(address(0), to, tokenId, 1);\n }\n\n /**\n * @dev Destroys `tokenId`.\n * The approval is cleared when the token is burned.\n * This is an internal function that does not check if the sender is authorized to operate on the token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n *\n * Emits a {Transfer} event.\n */\n function _burn(uint256 tokenId) internal virtual {\n address owner = ERC721.ownerOf(tokenId);\n\n _beforeTokenTransfer(owner, address(0), tokenId, 1);\n\n // Update ownership in case tokenId was transferred by `_beforeTokenTransfer` hook\n owner = ERC721.ownerOf(tokenId);\n\n // Clear approvals\n delete _tokenApprovals[tokenId];\n\n unchecked {\n // Cannot overflow, as that would require more tokens to be burned/transferred\n // out than the owner initially received through minting and transferring in.\n _balances[owner] -= 1;\n }\n delete _owners[tokenId];\n\n emit Transfer(owner, address(0), tokenId);\n\n _afterTokenTransfer(owner, address(0), tokenId, 1);\n }\n\n /**\n * @dev Transfers `tokenId` from `from` to `to`.\n * As opposed to {transferFrom}, this imposes no restrictions on msg.sender.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - `tokenId` token must be owned by `from`.\n *\n * Emits a {Transfer} event.\n */\n function _transfer(address from, address to, uint256 tokenId) internal virtual {\n require(ERC721.ownerOf(tokenId) == from, \"ERC721: transfer from incorrect owner\");\n require(to != address(0), \"ERC721: transfer to the zero address\");\n\n _beforeTokenTransfer(from, to, tokenId, 1);\n\n // Check that tokenId was not transferred by `_beforeTokenTransfer` hook\n require(ERC721.ownerOf(tokenId) == from, \"ERC721: transfer from incorrect owner\");\n\n // Clear approvals from the previous owner\n delete _tokenApprovals[tokenId];\n\n unchecked {\n // `_balances[from]` cannot overflow for the same reason as described in `_burn`:\n // `from`'s balance is the number of token held, which is at least one before the current\n // transfer.\n // `_balances[to]` could overflow in the conditions described in `_mint`. That would require\n // all 2**256 token ids to be minted, which in practice is impossible.\n _balances[from] -= 1;\n _balances[to] += 1;\n }\n _owners[tokenId] = to;\n\n emit Transfer(from, to, tokenId);\n\n _afterTokenTransfer(from, to, tokenId, 1);\n }\n\n /**\n * @dev Approve `to` to operate on `tokenId`\n *\n * Emits an {Approval} event.\n */\n function _approve(address to, uint256 tokenId) internal virtual {\n _tokenApprovals[tokenId] = to;\n emit Approval(ERC721.ownerOf(tokenId), to, tokenId);\n }\n\n /**\n * @dev Approve `operator` to operate on all of `owner` tokens\n *\n * Emits an {ApprovalForAll} event.\n */\n function _setApprovalForAll(address owner, address operator, bool approved) internal virtual {\n require(owner != operator, \"ERC721: approve to caller\");\n _operatorApprovals[owner][operator] = approved;\n emit ApprovalForAll(owner, operator, approved);\n }\n\n /**\n * @dev Reverts if the `tokenId` has not been minted yet.\n */\n function _requireMinted(uint256 tokenId) internal view virtual {\n require(_exists(tokenId), \"ERC721: invalid token ID\");\n }\n\n /**\n * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address.\n * The call is not executed if the target address is not a contract.\n *\n * @param from address representing the previous owner of the given token ID\n * @param to target address that will receive the tokens\n * @param tokenId uint256 ID of the token to be transferred\n * @param data bytes optional data to send along with the call\n * @return bool whether the call correctly returned the expected magic value\n */\n function _checkOnERC721Received(\n address from,\n address to,\n uint256 tokenId,\n bytes memory data\n ) private returns (bool) {\n if (to.isContract()) {\n try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, data) returns (bytes4 retval) {\n return retval == IERC721Receiver.onERC721Received.selector;\n } catch (bytes memory reason) {\n if (reason.length == 0) {\n revert(\"ERC721: transfer to non ERC721Receiver implementer\");\n } else {\n /// @solidity memory-safe-assembly\n assembly {\n revert(add(32, reason), mload(reason))\n }\n }\n }\n } else {\n return true;\n }\n }\n\n /**\n * @dev Hook that is called before any token transfer. This includes minting and burning. If {ERC721Consecutive} is\n * used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1.\n *\n * Calling conditions:\n *\n * - When `from` and `to` are both non-zero, ``from``'s tokens will be transferred to `to`.\n * - When `from` is zero, the tokens will be minted for `to`.\n * - When `to` is zero, ``from``'s tokens will be burned.\n * - `from` and `to` are never both zero.\n * - `batchSize` is non-zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _beforeTokenTransfer(address from, address to, uint256 firstTokenId, uint256 batchSize) internal virtual {}\n\n /**\n * @dev Hook that is called after any token transfer. This includes minting and burning. If {ERC721Consecutive} is\n * used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1.\n *\n * Calling conditions:\n *\n * - When `from` and `to` are both non-zero, ``from``'s tokens were transferred to `to`.\n * - When `from` is zero, the tokens were minted for `to`.\n * - When `to` is zero, ``from``'s tokens were burned.\n * - `from` and `to` are never both zero.\n * - `batchSize` is non-zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _afterTokenTransfer(address from, address to, uint256 firstTokenId, uint256 batchSize) internal virtual {}\n\n /**\n * @dev Unsafe write access to the balances, used by extensions that \"mint\" tokens using an {ownerOf} override.\n *\n * WARNING: Anyone calling this MUST ensure that the balances remain consistent with the ownership. The invariant\n * being that for any address `a` the value returned by `balanceOf(a)` must be equal to the number of tokens such\n * that `ownerOf(tokenId)` is `a`.\n */\n // solhint-disable-next-line func-name-mixedcase\n function __unsafe_increaseBalance(address account, uint256 amount) internal {\n _balances[account] += amount;\n }\n}\n" + }, + "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC721/extensions/ERC721Enumerable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../ERC721.sol\";\nimport \"./IERC721Enumerable.sol\";\n\n/**\n * @dev This implements an optional extension of {ERC721} defined in the EIP that adds\n * enumerability of all the token ids in the contract as well as all token ids owned by each\n * account.\n */\nabstract contract ERC721Enumerable is ERC721, IERC721Enumerable {\n // Mapping from owner to list of owned token IDs\n mapping(address => mapping(uint256 => uint256)) private _ownedTokens;\n\n // Mapping from token ID to index of the owner tokens list\n mapping(uint256 => uint256) private _ownedTokensIndex;\n\n // Array with all token ids, used for enumeration\n uint256[] private _allTokens;\n\n // Mapping from token id to position in the allTokens array\n mapping(uint256 => uint256) private _allTokensIndex;\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165, ERC721) returns (bool) {\n return interfaceId == type(IERC721Enumerable).interfaceId || super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev See {IERC721Enumerable-tokenOfOwnerByIndex}.\n */\n function tokenOfOwnerByIndex(address owner, uint256 index) public view virtual override returns (uint256) {\n require(index < ERC721.balanceOf(owner), \"ERC721Enumerable: owner index out of bounds\");\n return _ownedTokens[owner][index];\n }\n\n /**\n * @dev See {IERC721Enumerable-totalSupply}.\n */\n function totalSupply() public view virtual override returns (uint256) {\n return _allTokens.length;\n }\n\n /**\n * @dev See {IERC721Enumerable-tokenByIndex}.\n */\n function tokenByIndex(uint256 index) public view virtual override returns (uint256) {\n require(index < ERC721Enumerable.totalSupply(), \"ERC721Enumerable: global index out of bounds\");\n return _allTokens[index];\n }\n\n /**\n * @dev See {ERC721-_beforeTokenTransfer}.\n */\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256 firstTokenId,\n uint256 batchSize\n ) internal virtual override {\n super._beforeTokenTransfer(from, to, firstTokenId, batchSize);\n\n if (batchSize > 1) {\n // Will only trigger during construction. Batch transferring (minting) is not available afterwards.\n revert(\"ERC721Enumerable: consecutive transfers not supported\");\n }\n\n uint256 tokenId = firstTokenId;\n\n if (from == address(0)) {\n _addTokenToAllTokensEnumeration(tokenId);\n } else if (from != to) {\n _removeTokenFromOwnerEnumeration(from, tokenId);\n }\n if (to == address(0)) {\n _removeTokenFromAllTokensEnumeration(tokenId);\n } else if (to != from) {\n _addTokenToOwnerEnumeration(to, tokenId);\n }\n }\n\n /**\n * @dev Private function to add a token to this extension's ownership-tracking data structures.\n * @param to address representing the new owner of the given token ID\n * @param tokenId uint256 ID of the token to be added to the tokens list of the given address\n */\n function _addTokenToOwnerEnumeration(address to, uint256 tokenId) private {\n uint256 length = ERC721.balanceOf(to);\n _ownedTokens[to][length] = tokenId;\n _ownedTokensIndex[tokenId] = length;\n }\n\n /**\n * @dev Private function to add a token to this extension's token tracking data structures.\n * @param tokenId uint256 ID of the token to be added to the tokens list\n */\n function _addTokenToAllTokensEnumeration(uint256 tokenId) private {\n _allTokensIndex[tokenId] = _allTokens.length;\n _allTokens.push(tokenId);\n }\n\n /**\n * @dev Private function to remove a token from this extension's ownership-tracking data structures. Note that\n * while the token is not assigned a new owner, the `_ownedTokensIndex` mapping is _not_ updated: this allows for\n * gas optimizations e.g. when performing a transfer operation (avoiding double writes).\n * This has O(1) time complexity, but alters the order of the _ownedTokens array.\n * @param from address representing the previous owner of the given token ID\n * @param tokenId uint256 ID of the token to be removed from the tokens list of the given address\n */\n function _removeTokenFromOwnerEnumeration(address from, uint256 tokenId) private {\n // To prevent a gap in from's tokens array, we store the last token in the index of the token to delete, and\n // then delete the last slot (swap and pop).\n\n uint256 lastTokenIndex = ERC721.balanceOf(from) - 1;\n uint256 tokenIndex = _ownedTokensIndex[tokenId];\n\n // When the token to delete is the last token, the swap operation is unnecessary\n if (tokenIndex != lastTokenIndex) {\n uint256 lastTokenId = _ownedTokens[from][lastTokenIndex];\n\n _ownedTokens[from][tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token\n _ownedTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index\n }\n\n // This also deletes the contents at the last position of the array\n delete _ownedTokensIndex[tokenId];\n delete _ownedTokens[from][lastTokenIndex];\n }\n\n /**\n * @dev Private function to remove a token from this extension's token tracking data structures.\n * This has O(1) time complexity, but alters the order of the _allTokens array.\n * @param tokenId uint256 ID of the token to be removed from the tokens list\n */\n function _removeTokenFromAllTokensEnumeration(uint256 tokenId) private {\n // To prevent a gap in the tokens array, we store the last token in the index of the token to delete, and\n // then delete the last slot (swap and pop).\n\n uint256 lastTokenIndex = _allTokens.length - 1;\n uint256 tokenIndex = _allTokensIndex[tokenId];\n\n // When the token to delete is the last token, the swap operation is unnecessary. However, since this occurs so\n // rarely (when the last minted token is burnt) that we still do the swap here to avoid the gas cost of adding\n // an 'if' statement (like in _removeTokenFromOwnerEnumeration)\n uint256 lastTokenId = _allTokens[lastTokenIndex];\n\n _allTokens[tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token\n _allTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index\n\n // This also deletes the contents at the last position of the array\n delete _allTokensIndex[tokenId];\n _allTokens.pop();\n }\n}\n" + }, + "@openzeppelin/contracts/token/ERC721/extensions/IERC721Enumerable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC721/extensions/IERC721Enumerable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC721.sol\";\n\n/**\n * @title ERC-721 Non-Fungible Token Standard, optional enumeration extension\n * @dev See https://eips.ethereum.org/EIPS/eip-721\n */\ninterface IERC721Enumerable is IERC721 {\n /**\n * @dev Returns the total amount of tokens stored by the contract.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns a token ID owned by `owner` at a given `index` of its token list.\n * Use along with {balanceOf} to enumerate all of ``owner``'s tokens.\n */\n function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256);\n\n /**\n * @dev Returns a token ID at a given `index` of all the tokens stored by the contract.\n * Use along with {totalSupply} to enumerate all tokens.\n */\n function tokenByIndex(uint256 index) external view returns (uint256);\n}\n" + }, + "@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC721.sol\";\n\n/**\n * @title ERC-721 Non-Fungible Token Standard, optional metadata extension\n * @dev See https://eips.ethereum.org/EIPS/eip-721\n */\ninterface IERC721Metadata is IERC721 {\n /**\n * @dev Returns the token collection name.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the token collection symbol.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.\n */\n function tokenURI(uint256 tokenId) external view returns (string memory);\n}\n" + }, + "@openzeppelin/contracts/token/ERC721/IERC721.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC721/IERC721.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165.sol\";\n\n/**\n * @dev Required interface of an ERC721 compliant contract.\n */\ninterface IERC721 is IERC165 {\n /**\n * @dev Emitted when `tokenId` token is transferred from `from` to `to`.\n */\n event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);\n\n /**\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\n */\n event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);\n\n /**\n * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.\n */\n event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\n\n /**\n * @dev Returns the number of tokens in ``owner``'s account.\n */\n function balanceOf(address owner) external view returns (uint256 balance);\n\n /**\n * @dev Returns the owner of the `tokenId` token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function ownerOf(uint256 tokenId) external view returns (address owner);\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function safeTransferFrom(address from, address to, uint256 tokenId, bytes calldata data) external;\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or {setApprovalForAll}.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function safeTransferFrom(address from, address to, uint256 tokenId) external;\n\n /**\n * @dev Transfers `tokenId` token from `from` to `to`.\n *\n * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721\n * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must\n * understand this adds an external call which potentially creates a reentrancy vulnerability.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must be owned by `from`.\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(address from, address to, uint256 tokenId) external;\n\n /**\n * @dev Gives permission to `to` to transfer `tokenId` token to another account.\n * The approval is cleared when the token is transferred.\n *\n * Only a single account can be approved at a time, so approving the zero address clears previous approvals.\n *\n * Requirements:\n *\n * - The caller must own the token or be an approved operator.\n * - `tokenId` must exist.\n *\n * Emits an {Approval} event.\n */\n function approve(address to, uint256 tokenId) external;\n\n /**\n * @dev Approve or remove `operator` as an operator for the caller.\n * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.\n *\n * Requirements:\n *\n * - The `operator` cannot be the caller.\n *\n * Emits an {ApprovalForAll} event.\n */\n function setApprovalForAll(address operator, bool approved) external;\n\n /**\n * @dev Returns the account approved for `tokenId` token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function getApproved(uint256 tokenId) external view returns (address operator);\n\n /**\n * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.\n *\n * See {setApprovalForAll}\n */\n function isApprovedForAll(address owner, address operator) external view returns (bool);\n}\n" + }, + "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721Receiver.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @title ERC721 token receiver interface\n * @dev Interface for any contract that wants to support safeTransfers\n * from ERC721 asset contracts.\n */\ninterface IERC721Receiver {\n /**\n * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}\n * by `operator` from `from`, this function is called.\n *\n * It must return its Solidity selector to confirm the token transfer.\n * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.\n *\n * The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.selector`.\n */\n function onERC721Received(\n address operator,\n address from,\n uint256 tokenId,\n bytes calldata data\n ) external returns (bytes4);\n}\n" + }, + "@openzeppelin/contracts/utils/Address.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" + }, + "@openzeppelin/contracts/utils/Context.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Create2.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" + }, + "@openzeppelin/contracts/utils/cryptography/ECDSA.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/cryptography/ECDSA.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../Strings.sol\";\n\n/**\n * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.\n *\n * These functions can be used to verify that a message was signed by the holder\n * of the private keys of a given address.\n */\nlibrary ECDSA {\n enum RecoverError {\n NoError,\n InvalidSignature,\n InvalidSignatureLength,\n InvalidSignatureS,\n InvalidSignatureV // Deprecated in v4.8\n }\n\n function _throwError(RecoverError error) private pure {\n if (error == RecoverError.NoError) {\n return; // no error: do nothing\n } else if (error == RecoverError.InvalidSignature) {\n revert(\"ECDSA: invalid signature\");\n } else if (error == RecoverError.InvalidSignatureLength) {\n revert(\"ECDSA: invalid signature length\");\n } else if (error == RecoverError.InvalidSignatureS) {\n revert(\"ECDSA: invalid signature 's' value\");\n }\n }\n\n /**\n * @dev Returns the address that signed a hashed message (`hash`) with\n * `signature` or error string. This address can then be used for verification purposes.\n *\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\n * this function rejects them by requiring the `s` value to be in the lower\n * half order, and the `v` value to be either 27 or 28.\n *\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\n * verification to be secure: it is possible to craft signatures that\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\n * this is by receiving a hash of the original message (which may otherwise\n * be too long), and then calling {toEthSignedMessageHash} on it.\n *\n * Documentation for signature generation:\n * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]\n * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]\n *\n * _Available since v4.3._\n */\n function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) {\n if (signature.length == 65) {\n bytes32 r;\n bytes32 s;\n uint8 v;\n // ecrecover takes the signature parameters, and the only way to get them\n // currently is to use assembly.\n /// @solidity memory-safe-assembly\n assembly {\n r := mload(add(signature, 0x20))\n s := mload(add(signature, 0x40))\n v := byte(0, mload(add(signature, 0x60)))\n }\n return tryRecover(hash, v, r, s);\n } else {\n return (address(0), RecoverError.InvalidSignatureLength);\n }\n }\n\n /**\n * @dev Returns the address that signed a hashed message (`hash`) with\n * `signature`. This address can then be used for verification purposes.\n *\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\n * this function rejects them by requiring the `s` value to be in the lower\n * half order, and the `v` value to be either 27 or 28.\n *\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\n * verification to be secure: it is possible to craft signatures that\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\n * this is by receiving a hash of the original message (which may otherwise\n * be too long), and then calling {toEthSignedMessageHash} on it.\n */\n function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {\n (address recovered, RecoverError error) = tryRecover(hash, signature);\n _throwError(error);\n return recovered;\n }\n\n /**\n * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.\n *\n * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures]\n *\n * _Available since v4.3._\n */\n function tryRecover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address, RecoverError) {\n bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff);\n uint8 v = uint8((uint256(vs) >> 255) + 27);\n return tryRecover(hash, v, r, s);\n }\n\n /**\n * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately.\n *\n * _Available since v4.2._\n */\n function recover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address) {\n (address recovered, RecoverError error) = tryRecover(hash, r, vs);\n _throwError(error);\n return recovered;\n }\n\n /**\n * @dev Overload of {ECDSA-tryRecover} that receives the `v`,\n * `r` and `s` signature fields separately.\n *\n * _Available since v4.3._\n */\n function tryRecover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) internal pure returns (address, RecoverError) {\n // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature\n // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines\n // the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most\n // signatures from current libraries generate a unique signature with an s-value in the lower half order.\n //\n // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value\n // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or\n // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept\n // these malleable signatures as well.\n if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {\n return (address(0), RecoverError.InvalidSignatureS);\n }\n\n // If the signature is valid (and not malleable), return the signer address\n address signer = ecrecover(hash, v, r, s);\n if (signer == address(0)) {\n return (address(0), RecoverError.InvalidSignature);\n }\n\n return (signer, RecoverError.NoError);\n }\n\n /**\n * @dev Overload of {ECDSA-recover} that receives the `v`,\n * `r` and `s` signature fields separately.\n */\n function recover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) internal pure returns (address) {\n (address recovered, RecoverError error) = tryRecover(hash, v, r, s);\n _throwError(error);\n return recovered;\n }\n\n /**\n * @dev Returns an Ethereum Signed Message, created from a `hash`. This\n * produces hash corresponding to the one signed with the\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\n * JSON-RPC method as part of EIP-191.\n *\n * See {recover}.\n */\n function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32 message) {\n // 32 is the length in bytes of hash,\n // enforced by the type signature above\n /// @solidity memory-safe-assembly\n assembly {\n mstore(0x00, \"\\x19Ethereum Signed Message:\\n32\")\n mstore(0x1c, hash)\n message := keccak256(0x00, 0x3c)\n }\n }\n\n /**\n * @dev Returns an Ethereum Signed Message, created from `s`. This\n * produces hash corresponding to the one signed with the\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\n * JSON-RPC method as part of EIP-191.\n *\n * See {recover}.\n */\n function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) {\n return keccak256(abi.encodePacked(\"\\x19Ethereum Signed Message:\\n\", Strings.toString(s.length), s));\n }\n\n /**\n * @dev Returns an Ethereum Signed Typed Data, created from a\n * `domainSeparator` and a `structHash`. This produces hash corresponding\n * to the one signed with the\n * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`]\n * JSON-RPC method as part of EIP-712.\n *\n * See {recover}.\n */\n function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32 data) {\n /// @solidity memory-safe-assembly\n assembly {\n let ptr := mload(0x40)\n mstore(ptr, \"\\x19\\x01\")\n mstore(add(ptr, 0x02), domainSeparator)\n mstore(add(ptr, 0x22), structHash)\n data := keccak256(ptr, 0x42)\n }\n }\n\n /**\n * @dev Returns an Ethereum Signed Data with intended validator, created from a\n * `validator` and `data` according to the version 0 of EIP-191.\n *\n * See {recover}.\n */\n function toDataWithIntendedValidatorHash(address validator, bytes memory data) internal pure returns (bytes32) {\n return keccak256(abi.encodePacked(\"\\x19\\x00\", validator, data));\n }\n}\n" + }, + "@openzeppelin/contracts/utils/cryptography/SignatureChecker.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/cryptography/SignatureChecker.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./ECDSA.sol\";\nimport \"../../interfaces/IERC1271.sol\";\n\n/**\n * @dev Signature verification helper that can be used instead of `ECDSA.recover` to seamlessly support both ECDSA\n * signatures from externally owned accounts (EOAs) as well as ERC1271 signatures from smart contract wallets like\n * Argent and Gnosis Safe.\n *\n * _Available since v4.1._\n */\nlibrary SignatureChecker {\n /**\n * @dev Checks if a signature is valid for a given signer and data hash. If the signer is a smart contract, the\n * signature is validated against that smart contract using ERC1271, otherwise it's validated using `ECDSA.recover`.\n *\n * NOTE: Unlike ECDSA signatures, contract signatures are revocable, and the outcome of this function can thus\n * change through time. It could return true at block N and false at block N+1 (or the opposite).\n */\n function isValidSignatureNow(address signer, bytes32 hash, bytes memory signature) internal view returns (bool) {\n (address recovered, ECDSA.RecoverError error) = ECDSA.tryRecover(hash, signature);\n return\n (error == ECDSA.RecoverError.NoError && recovered == signer) ||\n isValidERC1271SignatureNow(signer, hash, signature);\n }\n\n /**\n * @dev Checks if a signature is valid for a given signer and data hash. The signature is validated\n * against the signer smart contract using ERC1271.\n *\n * NOTE: Unlike ECDSA signatures, contract signatures are revocable, and the outcome of this function can thus\n * change through time. It could return true at block N and false at block N+1 (or the opposite).\n */\n function isValidERC1271SignatureNow(\n address signer,\n bytes32 hash,\n bytes memory signature\n ) internal view returns (bool) {\n (bool success, bytes memory result) = signer.staticcall(\n abi.encodeWithSelector(IERC1271.isValidSignature.selector, hash, signature)\n );\n return (success &&\n result.length >= 32 &&\n abi.decode(result, (bytes32)) == bytes32(IERC1271.isValidSignature.selector));\n }\n}\n" + }, + "@openzeppelin/contracts/utils/introspection/ERC165.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC165.sol\";\n\n/**\n * @dev Implementation of the {IERC165} interface.\n *\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\n * for the additional interface id that will be supported. For example:\n *\n * ```solidity\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\n * }\n * ```\n *\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\n */\nabstract contract ERC165 is IERC165 {\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IERC165).interfaceId;\n }\n}\n" + }, + "@openzeppelin/contracts/utils/introspection/IERC165.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165 {\n /**\n * @dev Returns true if this contract implements the interface defined by\n * `interfaceId`. See the corresponding\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\n * to learn more about how these ids are created.\n *\n * This function call must use less than 30 000 gas.\n */\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n" + }, + "@openzeppelin/contracts/utils/math/Math.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/math/Math.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Standard math utilities missing in the Solidity language.\n */\nlibrary Math {\n enum Rounding {\n Down, // Toward negative infinity\n Up, // Toward infinity\n Zero // Toward zero\n }\n\n /**\n * @dev Returns the largest of two numbers.\n */\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\n return a > b ? a : b;\n }\n\n /**\n * @dev Returns the smallest of two numbers.\n */\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\n return a < b ? a : b;\n }\n\n /**\n * @dev Returns the average of two numbers. The result is rounded towards\n * zero.\n */\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b) / 2 can overflow.\n return (a & b) + (a ^ b) / 2;\n }\n\n /**\n * @dev Returns the ceiling of the division of two numbers.\n *\n * This differs from standard division with `/` in that it rounds up instead\n * of rounding down.\n */\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b - 1) / b can overflow on addition, so we distribute.\n return a == 0 ? 0 : (a - 1) / b + 1;\n }\n\n /**\n * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\n * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)\n * with further edits by Uniswap Labs also under MIT license.\n */\n function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) {\n unchecked {\n // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use\n // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256\n // variables such that product = prod1 * 2^256 + prod0.\n uint256 prod0; // Least significant 256 bits of the product\n uint256 prod1; // Most significant 256 bits of the product\n assembly {\n let mm := mulmod(x, y, not(0))\n prod0 := mul(x, y)\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\n }\n\n // Handle non-overflow cases, 256 by 256 division.\n if (prod1 == 0) {\n // Solidity will revert if denominator == 0, unlike the div opcode on its own.\n // The surrounding unchecked block does not change this fact.\n // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.\n return prod0 / denominator;\n }\n\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\n require(denominator > prod1, \"Math: mulDiv overflow\");\n\n ///////////////////////////////////////////////\n // 512 by 256 division.\n ///////////////////////////////////////////////\n\n // Make division exact by subtracting the remainder from [prod1 prod0].\n uint256 remainder;\n assembly {\n // Compute remainder using mulmod.\n remainder := mulmod(x, y, denominator)\n\n // Subtract 256 bit number from 512 bit number.\n prod1 := sub(prod1, gt(remainder, prod0))\n prod0 := sub(prod0, remainder)\n }\n\n // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.\n // See https://cs.stackexchange.com/q/138556/92363.\n\n // Does not overflow because the denominator cannot be zero at this stage in the function.\n uint256 twos = denominator & (~denominator + 1);\n assembly {\n // Divide denominator by twos.\n denominator := div(denominator, twos)\n\n // Divide [prod1 prod0] by twos.\n prod0 := div(prod0, twos)\n\n // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.\n twos := add(div(sub(0, twos), twos), 1)\n }\n\n // Shift in bits from prod1 into prod0.\n prod0 |= prod1 * twos;\n\n // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such\n // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for\n // four bits. That is, denominator * inv = 1 mod 2^4.\n uint256 inverse = (3 * denominator) ^ 2;\n\n // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works\n // in modular arithmetic, doubling the correct bits in each step.\n inverse *= 2 - denominator * inverse; // inverse mod 2^8\n inverse *= 2 - denominator * inverse; // inverse mod 2^16\n inverse *= 2 - denominator * inverse; // inverse mod 2^32\n inverse *= 2 - denominator * inverse; // inverse mod 2^64\n inverse *= 2 - denominator * inverse; // inverse mod 2^128\n inverse *= 2 - denominator * inverse; // inverse mod 2^256\n\n // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.\n // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is\n // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1\n // is no longer required.\n result = prod0 * inverse;\n return result;\n }\n }\n\n /**\n * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.\n */\n function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) {\n uint256 result = mulDiv(x, y, denominator);\n if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {\n result += 1;\n }\n return result;\n }\n\n /**\n * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.\n *\n * Inspired by Henry S. Warren, Jr.'s \"Hacker's Delight\" (Chapter 11).\n */\n function sqrt(uint256 a) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.\n //\n // We know that the \"msb\" (most significant bit) of our target number `a` is a power of 2 such that we have\n // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\n //\n // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\n // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\n // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\n //\n // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\n uint256 result = 1 << (log2(a) >> 1);\n\n // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,\n // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at\n // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision\n // into the expected uint128 result.\n unchecked {\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n return min(result, a / result);\n }\n }\n\n /**\n * @notice Calculates sqrt(a), following the selected rounding direction.\n */\n function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = sqrt(a);\n return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 2, rounded down, of a positive value.\n * Returns 0 if given 0.\n */\n function log2(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n result += 128;\n }\n if (value >> 64 > 0) {\n value >>= 64;\n result += 64;\n }\n if (value >> 32 > 0) {\n value >>= 32;\n result += 32;\n }\n if (value >> 16 > 0) {\n value >>= 16;\n result += 16;\n }\n if (value >> 8 > 0) {\n value >>= 8;\n result += 8;\n }\n if (value >> 4 > 0) {\n value >>= 4;\n result += 4;\n }\n if (value >> 2 > 0) {\n value >>= 2;\n result += 2;\n }\n if (value >> 1 > 0) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log2(value);\n return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 10, rounded down, of a positive value.\n * Returns 0 if given 0.\n */\n function log10(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >= 10 ** 64) {\n value /= 10 ** 64;\n result += 64;\n }\n if (value >= 10 ** 32) {\n value /= 10 ** 32;\n result += 32;\n }\n if (value >= 10 ** 16) {\n value /= 10 ** 16;\n result += 16;\n }\n if (value >= 10 ** 8) {\n value /= 10 ** 8;\n result += 8;\n }\n if (value >= 10 ** 4) {\n value /= 10 ** 4;\n result += 4;\n }\n if (value >= 10 ** 2) {\n value /= 10 ** 2;\n result += 2;\n }\n if (value >= 10 ** 1) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log10(value);\n return result + (rounding == Rounding.Up && 10 ** result < value ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 256, rounded down, of a positive value.\n * Returns 0 if given 0.\n *\n * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\n */\n function log256(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n result += 16;\n }\n if (value >> 64 > 0) {\n value >>= 64;\n result += 8;\n }\n if (value >> 32 > 0) {\n value >>= 32;\n result += 4;\n }\n if (value >> 16 > 0) {\n value >>= 16;\n result += 2;\n }\n if (value >> 8 > 0) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 256, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log256(value);\n return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0);\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/math/SignedMath.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Standard signed math utilities missing in the Solidity language.\n */\nlibrary SignedMath {\n /**\n * @dev Returns the largest of two signed numbers.\n */\n function max(int256 a, int256 b) internal pure returns (int256) {\n return a > b ? a : b;\n }\n\n /**\n * @dev Returns the smallest of two signed numbers.\n */\n function min(int256 a, int256 b) internal pure returns (int256) {\n return a < b ? a : b;\n }\n\n /**\n * @dev Returns the average of two signed numbers without overflow.\n * The result is rounded towards zero.\n */\n function average(int256 a, int256 b) internal pure returns (int256) {\n // Formula from the book \"Hacker's Delight\"\n int256 x = (a & b) + ((a ^ b) >> 1);\n return x + (int256(uint256(x) >> 255) & (a ^ b));\n }\n\n /**\n * @dev Returns the absolute unsigned value of a signed value.\n */\n function abs(int256 n) internal pure returns (uint256) {\n unchecked {\n // must be unchecked in order to support `n = type(int256).min`\n return uint256(n >= 0 ? n : -n);\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Strings.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Strings.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./math/Math.sol\";\nimport \"./math/SignedMath.sol\";\n\n/**\n * @dev String operations.\n */\nlibrary Strings {\n bytes16 private constant _SYMBOLS = \"0123456789abcdef\";\n uint8 private constant _ADDRESS_LENGTH = 20;\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\n */\n function toString(uint256 value) internal pure returns (string memory) {\n unchecked {\n uint256 length = Math.log10(value) + 1;\n string memory buffer = new string(length);\n uint256 ptr;\n /// @solidity memory-safe-assembly\n assembly {\n ptr := add(buffer, add(32, length))\n }\n while (true) {\n ptr--;\n /// @solidity memory-safe-assembly\n assembly {\n mstore8(ptr, byte(mod(value, 10), _SYMBOLS))\n }\n value /= 10;\n if (value == 0) break;\n }\n return buffer;\n }\n }\n\n /**\n * @dev Converts a `int256` to its ASCII `string` decimal representation.\n */\n function toString(int256 value) internal pure returns (string memory) {\n return string(abi.encodePacked(value < 0 ? \"-\" : \"\", toString(SignedMath.abs(value))));\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\n */\n function toHexString(uint256 value) internal pure returns (string memory) {\n unchecked {\n return toHexString(value, Math.log256(value) + 1);\n }\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\n */\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\n bytes memory buffer = new bytes(2 * length + 2);\n buffer[0] = \"0\";\n buffer[1] = \"x\";\n for (uint256 i = 2 * length + 1; i > 1; --i) {\n buffer[i] = _SYMBOLS[value & 0xf];\n value >>= 4;\n }\n require(value == 0, \"Strings: hex length insufficient\");\n return string(buffer);\n }\n\n /**\n * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.\n */\n function toHexString(address addr) internal pure returns (string memory) {\n return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\n }\n\n /**\n * @dev Returns true if the two strings are equal.\n */\n function equal(string memory a, string memory b) internal pure returns (bool) {\n return keccak256(bytes(a)) == keccak256(bytes(b));\n }\n}\n" + }, + "contracts/ChargedParticles.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.13;\n\nimport {IERC165} from \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\nimport {IERC721} from \"@openzeppelin/contracts/token/ERC721/IERC721.sol\";\nimport {IERC1155} from \"@openzeppelin/contracts/token/ERC1155/IERC1155.sol\";\nimport {IERC20} from \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport {Ownable} from \"@openzeppelin/contracts/access/Ownable.sol\";\nimport {ReentrancyGuard} from \"@openzeppelin/contracts/security/ReentrancyGuard.sol\";\n\nimport {IERC6551Registry} from \"./interfaces/IERC6551Registry.sol\";\nimport {IChargedParticles} from \"./interfaces/IChargedParticles.sol\";\nimport {NftTokenInfo} from \"./lib/NftTokenInfo.sol\";\nimport {ISmartAccount} from \"./interfaces/ISmartAccount.sol\";\nimport {ISmartAccountController} from \"./interfaces/ISmartAccountController.sol\";\nimport {IDynamicTraits} from \"./interfaces/IDynamicTraits.sol\";\nimport {SmartAccountTimelocks} from \"./extensions/SmartAccountTimelocks.sol\";\n\n// import \"hardhat/console.sol\";\n\ncontract ChargedParticles is IChargedParticles, Ownable, ReentrancyGuard {\n using NftTokenInfo for address;\n\n // NFT contract => SmartAccount Implementation\n mapping (address => address) internal accountImplementations;\n address internal defaultAccountImplementation;\n\n // NFT contract => Execution Controller\n mapping (address => address) internal executionControllers;\n address internal defaultExecutionController;\n\n // Registry Version => Registry Address\n mapping (uint256 => address) internal erc6551registry;\n uint256 internal defaultRegistry;\n\n\n // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n // Initialization\n\n constructor(address registry) Ownable() ReentrancyGuard() {\n erc6551registry[defaultRegistry] = registry;\n defaultAccountImplementation = address(new SmartAccountTimelocks());\n }\n\n\n // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n // Energize (Deposit)\n\n /// @notice Fund Particle with Asset Token\n /// Must be called by the account providing the Asset\n /// Account must Approve THIS contract as Operator of Asset\n ///\n /// @param contractAddress The Address to the Contract of the Token to Energize\n /// @param tokenId The ID of the Token to Energize\n /// @param assetToken The Address of the Asset Token being used\n /// @param assetAmount The Amount of Asset Token to Energize the Token with\n function energizeParticle(\n address contractAddress,\n uint256 tokenId,\n address assetToken,\n uint256 assetAmount\n )\n external\n virtual\n override\n nonReentrant\n returns (address account)\n {\n // Find the SmartAccount for this NFT\n IERC6551Registry registry = IERC6551Registry(erc6551registry[defaultRegistry]);\n address accountImpl = getAccountImplementation(contractAddress);\n account = registry.createAccount(accountImpl, bytes32(0), block.chainid, contractAddress, tokenId);\n ISmartAccount smartAccount = ISmartAccount(payable(account));\n\n // Initialize the Account\n if (!smartAccount.isInitialized()) {\n address executionController = getExecutionController(contractAddress);\n smartAccount.initialize(address(this), executionController);\n }\n\n // Transfer to SmartAccount\n IERC20(assetToken).transferFrom(msg.sender, account, assetAmount);\n\n // Pre-approve Charged Particles to transfer back out\n smartAccount.execute(assetToken, 0, abi.encodeWithSelector(IERC20.approve.selector, address(this), type(uint256).max), 0);\n\n // Call \"update\" on SmartAccount\n if (IERC165(account).supportsInterface(type(ISmartAccount).interfaceId)) {\n smartAccount.handleTokenUpdate(true, assetToken, assetAmount);\n }\n }\n\n\n // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n // Release (Withdraw)\n\n function releaseParticle(\n address receiver,\n address contractAddress,\n uint256 tokenId,\n address assetToken\n )\n external\n virtual\n override\n onlyNFTOwnerOrOperator(contractAddress, tokenId)\n nonReentrant\n returns (uint256 amount)\n {\n // Find the SmartAccount for this NFT\n IERC6551Registry registry = IERC6551Registry(erc6551registry[defaultRegistry]);\n address accountImpl = getAccountImplementation(contractAddress);\n address account = registry.account(accountImpl, bytes32(0), block.chainid, contractAddress, tokenId);\n\n // Transfer to Receiver\n amount = IERC20(assetToken).balanceOf(account);\n IERC20(assetToken).transferFrom(account, receiver, amount);\n\n // Call \"update\" on SmartAccount\n if (IERC165(account).supportsInterface(type(ISmartAccount).interfaceId)) {\n ISmartAccount(payable(account)).handleTokenUpdate(false, assetToken, amount);\n }\n }\n\n function releaseParticleAmount(\n address receiver,\n address contractAddress,\n uint256 tokenId,\n address assetToken,\n uint256 assetAmount\n )\n external\n virtual\n override\n onlyNFTOwnerOrOperator(contractAddress, tokenId)\n nonReentrant\n returns (uint256)\n {\n // Find the SmartAccount for this NFT\n IERC6551Registry registry = IERC6551Registry(erc6551registry[defaultRegistry]);\n address accountImpl = getAccountImplementation(contractAddress);\n address account = registry.account(accountImpl, bytes32(0), block.chainid, contractAddress, tokenId);\n\n // Transfer to Receiver\n IERC20(assetToken).transferFrom(account, receiver, assetAmount);\n\n // Call \"update\" on SmartAccount\n if (IERC165(account).supportsInterface(type(ISmartAccount).interfaceId)) {\n ISmartAccount(payable(account)).handleTokenUpdate(false, assetToken, assetAmount);\n }\n\n return assetAmount;\n }\n\n\n // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n // Covalent Bonds (Nested NFTs)\n\n /// @notice Deposit other NFT Assets into the Particle\n /// Must be called by the account providing the Asset\n /// Account must Approve THIS contract as Operator of Asset\n ///\n /// @param contractAddress The Address to the Contract of the Token to Energize\n /// @param tokenId The ID of the Token to Energize\n /// @param nftTokenAddress The Address of the NFT Token being deposited\n /// @param nftTokenId The ID of the NFT Token being deposited\n /// @param nftTokenAmount The amount of Tokens to Deposit (ERC1155-specific)\n function covalentBond(\n address contractAddress,\n uint256 tokenId,\n address nftTokenAddress,\n uint256 nftTokenId,\n uint256 nftTokenAmount\n )\n external\n virtual\n override\n nonReentrant\n returns (bool success)\n {\n // Find the SmartAccount for this NFT\n IERC6551Registry registry = IERC6551Registry(erc6551registry[defaultRegistry]);\n address accountImpl = getAccountImplementation(contractAddress);\n address account = registry.createAccount(accountImpl, bytes32(0), block.chainid, contractAddress, tokenId);\n ISmartAccount smartAccount = ISmartAccount(payable(account));\n\n // Initialize the Account\n if (!smartAccount.isInitialized()) {\n address executionController = getExecutionController(contractAddress);\n smartAccount.initialize(address(this), executionController);\n }\n\n // Transfer to SmartAccount and pre-approve Charged Particles to transfer back out\n if (nftTokenAddress.isERC1155()) {\n IERC1155(nftTokenAddress).safeTransferFrom(msg.sender, account, tokenId, nftTokenAmount, \"\");\n smartAccount.execute(nftTokenAddress, 0, abi.encodeWithSelector(IERC1155.setApprovalForAll.selector, address(this), true), 0);\n } else {\n IERC721(nftTokenAddress).safeTransferFrom(msg.sender, account, nftTokenId);\n smartAccount.execute(nftTokenAddress, 0, abi.encodeWithSelector(IERC721.setApprovalForAll.selector, address(this), true), 0);\n }\n\n // Call \"update\" on SmartAccount\n if (IERC165(account).supportsInterface(type(ISmartAccount).interfaceId)) {\n smartAccount.handleNFTUpdate(true, nftTokenAddress, nftTokenId, nftTokenAmount);\n }\n return true;\n }\n\n /// @notice Release NFT Assets from the Particle\n /// @param receiver The Address to Receive the Released Asset Tokens\n /// @param contractAddress The Address to the Contract of the Token to Energize\n /// @param tokenId The ID of the Token to Energize\n /// @param nftTokenAddress The Address of the NFT Token being deposited\n /// @param nftTokenId The ID of the NFT Token being deposited\n /// @param nftTokenAmount The amount of Tokens to Withdraw (ERC1155-specific)\n function breakCovalentBond(\n address receiver,\n address contractAddress,\n uint256 tokenId,\n address nftTokenAddress,\n uint256 nftTokenId,\n uint256 nftTokenAmount\n )\n external\n virtual\n override\n onlyNFTOwnerOrOperator(contractAddress, tokenId)\n nonReentrant\n returns (bool success)\n {\n // Find the SmartAccount for this NFT\n IERC6551Registry registry = IERC6551Registry(erc6551registry[defaultRegistry]);\n address accountImpl = getAccountImplementation(contractAddress);\n address account = registry.account(accountImpl, bytes32(0), block.chainid, contractAddress, tokenId);\n\n // Transfer to Receiver\n if (nftTokenAddress.isERC1155()) {\n IERC1155(nftTokenAddress).safeTransferFrom(account, receiver, tokenId, nftTokenAmount, \"\");\n } else {\n IERC721(nftTokenAddress).safeTransferFrom(account, receiver, nftTokenId);\n }\n\n // Call \"update\" on SmartAccount\n if (IERC165(account).supportsInterface(type(ISmartAccount).interfaceId)) {\n ISmartAccount(payable(account)).handleNFTUpdate(false, nftTokenAddress, nftTokenId, nftTokenAmount);\n }\n\n return true;\n }\n\n\n // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n // ERC6551 Wallet Registry\n\n /// @dev ...\n function getCurrentRegistry() external view returns (address) {\n return erc6551registry[defaultRegistry];\n }\n\n /// @dev ...\n function getRegistry(uint256 registry) external view returns (address) {\n return erc6551registry[registry];\n }\n\n /// @dev ...\n function setRegistry(uint256 version, address registry) external onlyOwner {\n erc6551registry[version] = registry;\n }\n\n /// @dev ...\n function setDefaultRegistryVersion(uint256 version) external onlyOwner {\n defaultRegistry = version;\n }\n\n\n // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n // SmartAccount Execution Controllers\n // - any NFT contract can have its own custom execution controller\n\n /// @dev ...\n function setDefaultExecutionController(address executionController) public virtual onlyOwner {\n defaultExecutionController = executionController;\n }\n\n /// @dev ...\n function setCustomExecutionController(address nftContract, address executionController) public virtual onlyOwner {\n executionControllers[nftContract] = executionController;\n }\n\n /// @dev ...\n function getExecutionController(address nftContract) public view returns (address executionController) {\n executionController = executionControllers[nftContract];\n if (executionController == address(0)) {\n executionController = defaultExecutionController;\n }\n }\n\n\n // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n // SmartAccount Implementations\n // - any NFT contract can have its own custom execution controller\n\n /// @dev ...\n function setDefaultAccountImplementation(address accountImplementation) public virtual onlyOwner {\n defaultAccountImplementation = accountImplementation;\n }\n\n /// @dev ...\n function setCustomAccountImplementation(address nftContract, address accountImplementation) public virtual onlyOwner {\n accountImplementations[nftContract] = accountImplementation;\n }\n\n /// @dev ...\n function getAccountImplementation(address nftContract) public view returns (address accountImplementation) {\n accountImplementation = accountImplementations[nftContract];\n if (accountImplementation == address(0)) {\n accountImplementation = defaultAccountImplementation;\n }\n }\n\n\n // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n // Internal Modifiers\n\n modifier onlyNFTOwnerOrOperator(address contractAddress, uint256 tokenId) {\n require(contractAddress.isNFTOwnerOrOperator(tokenId, msg.sender), \"Invalid owner or operator\");\n _;\n }\n}\n" + }, + "contracts/controllers/SmartAccountController_Example1.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.13;\n\nimport {IERC165, ERC165} from \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\nimport {Ownable} from \"@openzeppelin/contracts/access/Ownable.sol\";\nimport {ISmartAccountController} from \"../interfaces/ISmartAccountController.sol\";\n\n/**\n * @title A SmartAccount Controller which only allows specific methods to be executed on the associated SmartAccount\n */\ncontract SmartAccountController_Example1 is ISmartAccountController, Ownable, ERC165 {\n\n /// @dev mapping from method signature => banned method call\n mapping(bytes4 => bool) internal _bannedMethods;\n\n\n // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n // Initialization\n constructor() Ownable() {}\n\n\n // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n // Banned Methods Logic\n\n function bannedMethods(bytes4 methodSignature) external view virtual returns (bool) {\n return _bannedMethods[methodSignature];\n }\n\n function isAllowedMethod(bytes calldata data) external view virtual returns (bool) {\n return _isAllowedMethod(data);\n }\n\n function setBannedMethod(bytes4 methodSignature, bool isBanned) external virtual onlyOwner {\n _bannedMethods[methodSignature] = isBanned;\n }\n\n function _isAllowedMethod(bytes calldata _data) internal view returns (bool) {\n bytes4 signature = bytes4(_data[:4]);\n return !_bannedMethods[signature];\n }\n\n\n // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n // SmartAccount Controller Logic\n\n function onExecute(\n address,\n uint256,\n bytes calldata data,\n uint8\n ) external virtual override returns (string memory revertReason) {\n if (!_isAllowedMethod(data)) {\n revertReason = \"Method call not allowed\";\n }\n // else success\n }\n\n function onUpdateToken(\n bool isReceiving,\n uint256 chainId,\n address tokenContract,\n uint256 tokenId,\n address receivedAssetToken,\n uint256 receivedAssetAmount\n )\n external\n virtual\n override\n {\n // perform conditional logic here..\n }\n\n function onUpdateNFT(\n bool isReceiving,\n uint256 chainId,\n address tokenContract,\n uint256 tokenId,\n address receivedTokenContract,\n uint256 receivedTokenId,\n uint256\n )\n external\n virtual\n override\n {\n // perform conditional logic here..\n }\n\n function onUpdateNFTBatch(\n bool isReceiving,\n uint256 chainId,\n address tokenContract,\n uint256 tokenId,\n address receivedTokenContract,\n uint256[] calldata receivedTokenIds,\n uint256[] calldata\n )\n external\n virtual\n override\n {\n // perform conditional logic here..\n }\n\n\n // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n // Interface Identification\n\n /// @dev Returns true if a given interfaceId is supported by this account. This method can be\n /// extended by an override.\n function supportsInterface(bytes4 interfaceId)\n public\n view\n virtual\n override(IERC165, ERC165)\n returns (bool)\n {\n return\n interfaceId == type(ISmartAccountController).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n}\n" + }, + "contracts/extensions/SmartAccountTimelocks.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.13;\n\nimport {SmartAccount} from \"../SmartAccount.sol\";\n\nerror AccountLocked();\nerror ExceedsMaxLockTime();\n\n/**\n * @title A smart contract account owned by a single ERC721 token\n */\ncontract SmartAccountTimelocks is SmartAccount {\n event LockUpdated(uint256 lockedUntil);\n\n /// @dev timestamp at which this account will be unlocked.\n /// Attached to \"owner\" so that the lock is cleared when transferred.\n mapping(address => uint256) public lockedUntil;\n\n constructor() SmartAccount() {}\n\n /// @dev returns the current lock status of the account as a boolean\n function isLocked() public view returns (bool) {\n return lockedUntil[owner()] > block.timestamp;\n }\n\n /// @dev locks the account until a certain timestamp\n function lock(uint256 _lockedUntil) external onlyValidSigner {\n if (_lockedUntil > block.timestamp + 365 days) {\n revert ExceedsMaxLockTime();\n }\n\n lockedUntil[owner()] = _lockedUntil;\n\n emit LockUpdated(_lockedUntil);\n }\n\n /// @dev grants a given caller execution permissions\n function setPermissions(\n address[] calldata callers,\n bool[] calldata _permissions\n ) public virtual override {\n if (isLocked()) {\n revert AccountLocked();\n }\n return super.setPermissions(callers, _permissions);\n }\n\n /// @dev executes a low-level call against an account if the caller is authorized to make calls\n function execute(\n address to,\n uint256 value,\n bytes calldata data,\n uint8 operation\n ) public payable virtual override returns (bytes memory) {\n if (isLocked()) { revert AccountLocked(); }\n return super.execute(to, value, data, operation);\n }\n\n function handleTokenUpdate(\n bool isReceiving,\n address assetToken,\n uint256 assetAmount\n ) public virtual override {\n if (isLocked()) { revert AccountLocked(); }\n return super.handleTokenUpdate(isReceiving, assetToken, assetAmount);\n }\n\n function handleNFTUpdate(\n bool isReceiving,\n address tokenContract,\n uint256 tokenId,\n uint256 tokenAmount\n ) public virtual override {\n if (isLocked()) { revert AccountLocked(); }\n return super.handleNFTUpdate(isReceiving, tokenContract, tokenId, tokenAmount);\n }\n\n function handleNFTBatchUpdate(\n bool isReceiving,\n address tokenContract,\n uint256[] calldata tokenIds,\n uint256[] calldata tokenAmounts\n ) public virtual override {\n if (isLocked()) { revert AccountLocked(); }\n return super.handleNFTBatchUpdate(isReceiving, tokenContract, tokenIds, tokenAmounts);\n }\n}\n" + }, + "contracts/interfaces/IChargedParticles.sol": { + "content": "// SPDX-License-Identifier: MIT\n\n// IChargedParticles.sol -- Part of the Charged Particles Protocol\n// Copyright (c) 2021 Firma Lux, Inc. \n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in all\n// copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n// SOFTWARE.\n\npragma solidity ^0.8.13;\n\n/**\n * @notice Interface for Charged Particles\n */\ninterface IChargedParticles {\n\n function setDefaultExecutionController(address executionController) external;\n function setCustomExecutionController(address nftContract, address executionController) external;\n function getExecutionController(address nftContract) external view returns (address executionController);\n\n function setDefaultAccountImplementation(address accountImplementation) external;\n function setCustomAccountImplementation(address nftContract, address accountImplementation) external;\n function getAccountImplementation(address nftContract) external view returns (address accountImplementation);\n\n /***********************************|\n | Particle Mechanics |\n |__________________________________*/\n\n function energizeParticle(\n address contractAddress,\n uint256 tokenId,\n address assetToken,\n uint256 assetAmount\n ) external returns (address account);\n\n function releaseParticle(\n address receiver,\n address contractAddress,\n uint256 tokenId,\n address assetToken\n ) external returns (uint256 amount);\n\n function releaseParticleAmount(\n address receiver,\n address contractAddress,\n uint256 tokenId,\n address assetToken,\n uint256 assetAmount\n ) external returns (uint256 amount);\n\n function covalentBond(\n address contractAddress,\n uint256 tokenId,\n address nftTokenAddress,\n uint256 nftTokenId,\n uint256 nftTokenAmount\n ) external returns (bool success);\n\n function breakCovalentBond(\n address receiver,\n address contractAddress,\n uint256 tokenId,\n address nftTokenAddress,\n uint256 nftTokenId,\n uint256 nftTokenAmount\n ) external returns (bool success);\n}\n" + }, + "contracts/interfaces/IDynamicTraits.sol": { + "content": "// SPDX-License-Identifier: MIT\n\n// IDynamicTraits.sol -- Part of the Charged Particles Protocol\n// Copyright (c) 2023 Firma Lux, Inc. \n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in all\n// copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n// SOFTWARE.\n\npragma solidity ^0.8.13;\n\ninterface IDynamicTraits {\n function getTraits(uint256 tokenId) external view returns (uint256);\n function hasTrait(uint256 tokenId, uint256 trait) external view returns (bool);\n function traitCount(uint256 tokenId) external view returns (uint256 totalTraits);\n}\n" + }, + "contracts/interfaces/IERC6551Account.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.13;\n\n/// @dev the ERC-165 identifier for this interface is `0x6faff5f1`\ninterface IERC6551Account {\n /**\n * @dev Allows the account to receive Ether.\n *\n * Accounts MUST implement a `receive` function.\n *\n * Accounts MAY perform arbitrary logic to restrict conditions\n * under which Ether can be received.\n */\n receive() external payable;\n\n /**\n * @dev Returns the identifier of the non-fungible token which owns the account.\n *\n * The return value of this function MUST be constant - it MUST NOT change over time.\n *\n * @return chainId The chain ID of the chain the token exists on\n * @return tokenContract The contract address of the token\n * @return tokenId The ID of the token\n */\n function token()\n external\n view\n returns (uint256 chainId, address tokenContract, uint256 tokenId);\n\n /**\n * @dev Returns a value that SHOULD be modified each time the account changes state.\n *\n * @return The current account state\n */\n function state() external view returns (uint256);\n\n /**\n * @dev Returns a magic value indicating whether a given signer is authorized to act on behalf\n * of the account.\n *\n * MUST return the bytes4 magic value 0x523e3260 if the given signer is valid.\n *\n * By default, the holder of the non-fungible token the account is bound to MUST be considered\n * a valid signer.\n *\n * Accounts MAY implement additional authorization logic which invalidates the holder as a\n * signer or grants signing permissions to other non-holder accounts.\n *\n * @param signer The address to check signing authorization for\n * @param context Additional data used to determine whether the signer is valid\n * @return magicValue Magic value indicating whether the signer is valid\n */\n function isValidSigner(address signer, bytes calldata context)\n external\n view\n returns (bytes4 magicValue);\n}\n\n" + }, + "contracts/interfaces/IERC6551Executable.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.13;\n\n/// @dev the ERC-165 identifier for this interface is `0x51945447`\ninterface IERC6551Executable {\n /**\n * @dev Executes a low-level operation if the caller is a valid signer on the account.\n *\n * Reverts and bubbles up error if operation fails.\n *\n * Accounts implementing this interface MUST accept the following operation parameter values:\n * - 0 = CALL\n * - 1 = DELEGATECALL\n * - 2 = CREATE\n * - 3 = CREATE2\n *\n * Accounts implementing this interface MAY support additional operations or restrict a signer's\n * ability to execute certain operations.\n *\n * @param to The target address of the operation\n * @param value The Ether value to be sent to the target\n * @param data The encoded operation calldata\n * @param operation A value indicating the type of operation to perform\n * @return The result of the operation\n */\n function execute(address to, uint256 value, bytes calldata data, uint8 operation)\n external\n payable\n returns (bytes memory);\n}\n" + }, + "contracts/interfaces/IERC6551Registry.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.13;\ninterface IERC6551Registry {\n /**\n * @dev The registry MUST emit the ERC6551AccountCreated event upon successful account creation.\n */\n event ERC6551AccountCreated(\n address account,\n address indexed implementation,\n bytes32 salt,\n uint256 chainId,\n address indexed tokenContract,\n uint256 indexed tokenId\n );\n\n /**\n * @dev The registry MUST revert with AccountCreationFailed error if the create2 operation fails.\n */\n error AccountCreationFailed();\n\n /**\n * @dev Creates a token bound account for a non-fungible token.\n *\n * If account has already been created, returns the account address without calling create2.\n *\n * Emits ERC6551AccountCreated event.\n *\n * @return account The address of the token bound account\n */\n function createAccount(\n address implementation,\n bytes32 salt,\n uint256 chainId,\n address tokenContract,\n uint256 tokenId\n ) external returns (address account);\n\n /**\n * @dev Returns the computed token bound account address for a non-fungible token.\n *\n * @return account The address of the token bound account\n */\n function account(\n address implementation,\n bytes32 salt,\n uint256 chainId,\n address tokenContract,\n uint256 tokenId\n ) external view returns (address account);\n}" + }, + "contracts/interfaces/ISmartAccount.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.13;\n\nimport {IERC6551Account} from \"../interfaces/IERC6551Account.sol\";\nimport {IERC6551Executable} from \"../interfaces/IERC6551Executable.sol\";\n\nimport {IERC165} from \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\nimport {IERC721Receiver} from \"@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol\";\nimport {IERC1155Receiver} from \"@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol\";\n\n/**\n * @title A smart contract account owned by a single ERC721 token\n */\ninterface ISmartAccount is\n IERC165,\n IERC6551Account,\n IERC6551Executable,\n IERC721Receiver,\n IERC1155Receiver\n{\n event PermissionUpdated(address owner, address caller, bool hasPermission);\n event ExecutionControllerUpdated(address owner, address controller);\n\n function isInitialized() external returns (bool);\n function initialize(address chargedParticles, address executionController) external;\n\n function handleTokenUpdate(\n bool isReceiving,\n address assetToken,\n uint256 assetAmount\n ) external;\n\n function handleNFTUpdate(\n bool isReceiving,\n address tokenContract,\n uint256 tokenId,\n uint256 tokenAmount\n ) external;\n\n function handleNFTBatchUpdate(\n bool isReceiving,\n address tokenContract,\n uint256[] calldata tokenIds,\n uint256[] calldata tokenAmounts\n ) external;\n}\n" + }, + "contracts/interfaces/ISmartAccountController.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.13;\n\nimport {IERC165} from \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\n\n/**\n * @title\n */\ninterface ISmartAccountController is IERC165 {\n function onExecute(\n address to,\n uint256 value,\n bytes calldata data,\n uint8 operation\n ) external returns (string memory revertReason);\n\n function onUpdateToken(\n bool isReceiving,\n uint256 chainId,\n address tokenContract,\n uint256 tokenId,\n address receivedAssetToken,\n uint256 receivedAssetAmount\n ) external;\n\n function onUpdateNFT(\n bool isReceiving,\n uint256 chainId,\n address tokenContract,\n uint256 tokenId,\n address receivedTokenContract,\n uint256 receivedTokenId,\n uint256 receivedTokenAmount\n ) external;\n\n function onUpdateNFTBatch(\n bool isReceiving,\n uint256 chainId,\n address tokenContract,\n uint256 tokenId,\n address receivedTokenContract,\n uint256[] calldata receivedTokenIds,\n uint256[] calldata receivedTokenAmounts\n ) external;\n}\n" + }, + "contracts/lib/ERC6551AccountLib.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/utils/Create2.sol\";\nimport \"./ERC6551BytecodeLib.sol\";\n\nlibrary ERC6551AccountLib {\n function computeAddress(\n address registry,\n address _implementation,\n bytes32 _salt,\n uint256 chainId,\n address tokenContract,\n uint256 tokenId\n ) internal pure returns (address) {\n bytes32 bytecodeHash = keccak256(\n ERC6551BytecodeLib.getCreationCode(\n _implementation, _salt, chainId, tokenContract, tokenId\n )\n );\n\n return Create2.computeAddress(_salt, bytecodeHash, registry);\n }\n\n function isERC6551Account(address account, address expectedImplementation, address registry)\n internal\n view\n returns (bool)\n {\n // invalid bytecode size\n if (account.code.length != 0xAD) return false;\n\n address _implementation = implementation(account);\n\n // implementation does not exist\n if (_implementation.code.length == 0) return false;\n\n // invalid implementation\n if (_implementation != expectedImplementation) return false;\n\n (bytes32 _salt, uint256 chainId, address tokenContract, uint256 tokenId) = context(account);\n\n return account\n == computeAddress(registry, _implementation, _salt, chainId, tokenContract, tokenId);\n }\n\n function implementation(address account) internal view returns (address _implementation) {\n assembly {\n // copy proxy implementation (0x14 bytes)\n extcodecopy(account, 0xC, 0xA, 0x14)\n _implementation := mload(0x00)\n }\n }\n\n function implementation() internal view returns (address _implementation) {\n return implementation(address(this));\n }\n\n function token(address account) internal view returns (uint256, address, uint256) {\n bytes memory encodedData = new bytes(0x60);\n\n assembly {\n // copy 0x60 bytes from end of context\n extcodecopy(account, add(encodedData, 0x20), 0x4d, 0x60)\n }\n\n return abi.decode(encodedData, (uint256, address, uint256));\n }\n\n function token() internal view returns (uint256, address, uint256) {\n return token(address(this));\n }\n\n function salt(address account) internal view returns (bytes32) {\n bytes memory encodedData = new bytes(0x20);\n\n assembly {\n // copy 0x20 bytes from beginning of context\n extcodecopy(account, add(encodedData, 0x20), 0x2d, 0x20)\n }\n\n return abi.decode(encodedData, (bytes32));\n }\n\n function salt() internal view returns (bytes32) {\n return salt(address(this));\n }\n\n function context(address account) internal view returns (bytes32, uint256, address, uint256) {\n bytes memory encodedData = new bytes(0x80);\n\n assembly {\n // copy full context (0x80 bytes)\n extcodecopy(account, add(encodedData, 0x20), 0x2D, 0x80)\n }\n\n return abi.decode(encodedData, (bytes32, uint256, address, uint256));\n }\n\n function context() internal view returns (bytes32, uint256, address, uint256) {\n return context(address(this));\n }\n}" + }, + "contracts/lib/ERC6551BytecodeLib.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nlibrary ERC6551BytecodeLib {\n /**\n * @dev Returns the creation code of the token bound account for a non-fungible token.\n *\n * @return result The creation code of the token bound account\n */\n function getCreationCode(\n address implementation,\n bytes32 salt,\n uint256 chainId,\n address tokenContract,\n uint256 tokenId\n ) internal pure returns (bytes memory result) {\n assembly {\n result := mload(0x40) // Grab the free memory pointer\n // Layout the variables and bytecode backwards\n mstore(add(result, 0xb7), tokenId)\n mstore(add(result, 0x97), shr(96, shl(96, tokenContract)))\n mstore(add(result, 0x77), chainId)\n mstore(add(result, 0x57), salt)\n mstore(add(result, 0x37), 0x5af43d82803e903d91602b57fd5bf3)\n mstore(add(result, 0x28), implementation)\n mstore(add(result, 0x14), 0x3d60ad80600a3d3981f3363d3d373d3d3d363d73)\n mstore(result, 0xb7) // Store the length\n mstore(0x40, add(result, 0xd7)) // Allocate the memory\n }\n }\n\n /**\n * @dev Returns the create2 address computed from `salt`, `bytecodeHash`, `deployer`.\n *\n * @return result The create2 address computed from `salt`, `bytecodeHash`, `deployer`\n */\n function computeAddress(bytes32 salt, bytes32 bytecodeHash, address deployer)\n internal\n pure\n returns (address result)\n {\n assembly {\n result := mload(0x40) // Grab the free memory pointer\n mstore8(result, 0xff)\n mstore(add(result, 0x35), bytecodeHash)\n mstore(add(result, 0x01), shl(96, deployer))\n mstore(add(result, 0x15), salt)\n result := keccak256(result, 0x55)\n }\n }\n}" + }, + "contracts/lib/NftTokenInfo.sol": { + "content": "// SPDX-License-Identifier: MIT\n\n// NftTokenInfo.sol -- Part of the Charged Particles Protocol\n// Copyright (c) 2021 Firma Lux, Inc. \n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in all\n// copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n// SOFTWARE.\n\npragma solidity ^0.8.13;\n\nimport {IERC165} from \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\nimport {IERC721} from \"@openzeppelin/contracts/token/ERC721/IERC721.sol\";\nimport {IERC1271} from \"@openzeppelin/contracts/interfaces/IERC1271.sol\";\n\nlibrary NftTokenInfo {\n bytes4 constant internal INTERFACE_SIGNATURE_ERC721 = 0x80ac58cd;\n bytes4 constant internal INTERFACE_SIGNATURE_ERC1155 = 0xd9b67a26;\n\n function isERC721(address contractAddress) internal view returns (bool) {\n return IERC165(contractAddress).supportsInterface(INTERFACE_SIGNATURE_ERC721);\n }\n\n function isERC1155(address contractAddress) internal view returns (bool) {\n return IERC165(contractAddress).supportsInterface(INTERFACE_SIGNATURE_ERC1155);\n }\n\n function getTokenUUID(address contractAddress, uint256 tokenId) internal pure returns (uint256) {\n return uint256(keccak256(abi.encodePacked(contractAddress, tokenId)));\n }\n\n function getTokenOwner(address contractAddress, uint256 tokenId) internal returns (address) {\n return _getTokenOwner(contractAddress, tokenId);\n }\n\n function isNFTOwnerOrOperator(address contractAddress, uint256 tokenId, address sender) internal returns (bool) {\n IERC721 tokenInterface = IERC721(contractAddress);\n address tokenOwner = _getTokenOwner(contractAddress, tokenId);\n return (sender == tokenOwner || tokenInterface.isApprovedForAll(tokenOwner, sender));\n }\n\n function _getTokenOwner(address contractAddress, uint256 tokenId) internal returns (address) {\n // solhint-disable-next-line\n (bool success, bytes memory returnData) = contractAddress.call(abi.encodeWithSelector(IERC721.ownerOf.selector, tokenId));\n if (success) {\n return abi.decode(returnData, (address));\n } else {\n return address(0x0);\n }\n }\n}\n" + }, + "contracts/lib/SmartAccountBase.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.13;\n\nimport {IERC165, ERC165} from \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\nimport {IERC721} from \"@openzeppelin/contracts/token/ERC721/IERC721.sol\";\nimport {IERC1271} from \"@openzeppelin/contracts/interfaces/IERC1271.sol\";\nimport {IERC721Receiver} from \"@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol\";\nimport {IERC1155Receiver} from \"@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol\";\nimport {SignatureChecker} from \"@openzeppelin/contracts/utils/cryptography/SignatureChecker.sol\";\n\nimport {IERC6551Account} from \"../interfaces/IERC6551Account.sol\";\nimport {IERC6551Executable} from \"../interfaces/IERC6551Executable.sol\";\nimport {ERC6551AccountLib} from \"./ERC6551AccountLib.sol\";\n\nimport {ISmartAccount} from \"../interfaces/ISmartAccount.sol\";\nimport {ISmartAccountController} from \"../interfaces/ISmartAccountController.sol\";\n\n// import \"hardhat/console.sol\";\n\nerror AlreadyInitialized();\nerror NotAuthorized();\nerror InvalidInput();\nerror OwnershipCycle();\n\n/**\n * @title A smart contract account owned by a single ERC721 token\n */\nabstract contract SmartAccountBase is ISmartAccount, ERC165 {\n address internal _chargedParticles;\n address internal _executionController;\n\n /// @dev mapping from owner => caller => has permissions\n mapping(address => mapping(address => bool)) internal _permissions;\n\n bool internal _initialized;\n constructor() {}\n\n function initialize(address chargedParticles, address executionController) external {\n if (_initialized) { revert AlreadyInitialized(); }\n _initialized = true;\n _chargedParticles = chargedParticles;\n _executionController = executionController;\n }\n\n /// @dev allows eth transfers by default, but allows account owner to override\n receive() external payable virtual override {}\n\n function isInitialized() external view virtual override returns (bool) {\n return _initialized;\n }\n\n function permissions(address _owner, address caller) public view virtual returns (bool) {\n return _permissions[_owner][caller];\n }\n\n function getChargedParticles() public view virtual returns (address) {\n return _chargedParticles;\n }\n\n function setChargedParticles(address chargedParticles) public virtual onlyOwner {\n if (chargedParticles == address(0)) { revert InvalidInput(); }\n _chargedParticles = chargedParticles;\n }\n\n function getExecutionController() public view virtual returns (address) {\n return _executionController;\n }\n\n function setExecutionController(address executionController) public virtual onlyOwner {\n _executionController = executionController;\n emit ExecutionControllerUpdated(msg.sender, executionController);\n }\n\n /// @dev Returns the EIP-155 chain ID, token contract address, and token ID for the token that\n /// owns this account.\n function token()\n public\n view\n virtual\n returns (\n uint256 chainId,\n address tokenContract,\n uint256 tokenId\n )\n {\n return ERC6551AccountLib.token();\n }\n\n /// @dev Returns the owner of the ERC-721 token which owns this account. By default, the owner\n /// of the token has full permissions on the account.\n function owner() public view virtual returns (address) {\n (uint256 chainId, address tokenContract, uint256 tokenId) = ERC6551AccountLib.token();\n if (chainId != block.chainid) { return address(0); }\n\n try IERC721(tokenContract).ownerOf(tokenId) returns (address _owner) {\n return _owner;\n } catch {\n return address(0);\n }\n }\n\n function isValidSigner(address signer, bytes calldata) external view virtual returns (bytes4) {\n if (_isValidSigner(signer)) {\n return IERC6551Account.isValidSigner.selector;\n }\n return bytes4(0);\n }\n\n function isValidSignature(bytes32 hash, bytes memory signature)\n external\n view\n virtual\n returns (bytes4 magicValue)\n {\n bool isValid = SignatureChecker.isValidSignatureNow(owner(), hash, signature);\n if (isValid) {\n return IERC1271.isValidSignature.selector;\n }\n return bytes4(0);\n }\n\n /// @dev grants a given caller execution permissions\n function setPermissions(address[] calldata callers, bool[] calldata newPermissions) public virtual {\n address _owner = owner();\n if (msg.sender != _owner) { revert NotAuthorized(); }\n\n uint256 length = callers.length;\n if (newPermissions.length != length) { revert InvalidInput(); }\n\n for (uint256 i = 0; i < length; i++) {\n _permissions[_owner][callers[i]] = newPermissions[i];\n emit PermissionUpdated(_owner, callers[i], newPermissions[i]);\n }\n }\n\n /// @dev Returns true if a given interfaceId is supported by this account. This method can be\n /// extended by an override.\n function supportsInterface(bytes4 interfaceId)\n public\n view\n virtual\n override(IERC165, ERC165)\n returns (bool)\n {\n return interfaceId == type(IERC6551Account).interfaceId\n || interfaceId == type(IERC6551Executable).interfaceId\n || interfaceId == type(ISmartAccount).interfaceId\n || super.supportsInterface(interfaceId);\n }\n\n /// @dev Allows ERC-721 tokens to be received so long as they do not cause an ownership cycle.\n /// This function can be overriden.\n function onERC721Received(\n address,\n address,\n uint256 receivedTokenId,\n bytes memory\n ) public view virtual override returns (bytes4) {\n (\n uint256 chainId,\n address tokenContract,\n uint256 tokenId\n ) = ERC6551AccountLib.token();\n\n if (chainId == block.chainid && tokenContract == msg.sender && tokenId == receivedTokenId) {\n revert OwnershipCycle();\n }\n return this.onERC721Received.selector;\n }\n\n /// @dev Allows ERC-1155 tokens to be received. This function can be overriden.\n function onERC1155Received(\n address,\n address,\n uint256,\n uint256,\n bytes memory\n ) public pure virtual override returns (bytes4) {\n return this.onERC1155Received.selector;\n }\n\n /// @dev Allows ERC-1155 token batches to be received. This function can be overriden.\n function onERC1155BatchReceived(\n address,\n address,\n uint256[] memory,\n uint256[] memory,\n bytes memory\n ) public pure virtual override returns (bytes4) {\n return this.onERC1155BatchReceived.selector;\n }\n\n /// @dev Executes a low-level call\n function _call(\n address to,\n uint256 value,\n bytes calldata data\n ) internal returns (bytes memory result) {\n bool success;\n // solhint-disable-next-line avoid-low-level-calls\n (success, result) = to.call{value: value}(data);\n\n if (!success) {\n assembly {\n revert(add(result, 32), mload(result))\n }\n }\n }\n\n function _onExecute(\n address to,\n uint256 value,\n bytes calldata data,\n uint8 operation\n ) internal {\n if (IERC165(_executionController).supportsInterface(type(ISmartAccountController).interfaceId)) {\n string memory revertReason = ISmartAccountController(_executionController).onExecute(to, value, data, operation);\n if (bytes(revertReason).length > 0) {\n revert(revertReason);\n }\n }\n }\n\n function _onUpdateToken(\n bool isReceiving,\n address assetToken,\n uint256 assetAmount\n ) internal {\n if (IERC165(_executionController).supportsInterface(type(ISmartAccountController).interfaceId)) {\n (uint256 chainId, address tokenContract, uint256 tokenId) = ERC6551AccountLib.token();\n ISmartAccountController(_executionController)\n .onUpdateToken(isReceiving, chainId, tokenContract, tokenId, assetToken, assetAmount);\n }\n }\n\n function _onUpdateNFT(\n bool isReceiving,\n address childTokenContract,\n uint256 childTokenId,\n uint256 childTokenAmount\n ) internal {\n if (IERC165(_executionController).supportsInterface(type(ISmartAccountController).interfaceId)) {\n (uint256 chainId, address tokenContract, uint256 tokenId) = ERC6551AccountLib.token();\n ISmartAccountController(_executionController)\n .onUpdateNFT(isReceiving, chainId, tokenContract, tokenId, childTokenContract, childTokenId, childTokenAmount);\n }\n }\n\n function _onUpdateNFTBatch(\n bool isReceiving,\n address childTokenContract,\n uint256[] calldata childTokenIds,\n uint256[] calldata childTokenAmounts\n ) internal {\n if (IERC165(_executionController).supportsInterface(type(ISmartAccountController).interfaceId)) {\n (uint256 chainId, address tokenContract, uint256 tokenId) = ERC6551AccountLib.token();\n ISmartAccountController(_executionController)\n .onUpdateNFTBatch(isReceiving, chainId, tokenContract, tokenId, childTokenContract, childTokenIds, childTokenAmounts);\n }\n }\n\n function _isValidSigner(address signer) internal view virtual returns (bool) {\n address ownerOf = owner();\n\n // Charged Particles always has permissions\n if (signer == _chargedParticles) { return true; }\n\n // authorize caller if owner has granted permissions\n if (_permissions[ownerOf][signer]) { return true; }\n\n // authorize token owner\n return signer == ownerOf;\n }\n\n /// @dev reverts if caller is not the owner of the NFT which owns the account\n modifier onlyOwner() {\n if (msg.sender != owner()) { revert NotAuthorized(); }\n _;\n }\n\n /// @dev reverts if caller is not authorized to execute on this account\n modifier onlyValidSigner() {\n if (!_isValidSigner(msg.sender)) { revert NotAuthorized(); }\n _;\n }\n}\n" + }, + "contracts/SmartAccount.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.13;\n\nimport {IERC165} from \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\nimport {SmartAccountBase, NotAuthorized, InvalidInput} from \"./lib/SmartAccountBase.sol\";\n\n/**\n * @title A smart contract account owned by a single ERC721 token\n */\ncontract SmartAccount is SmartAccountBase {\n uint256 public state;\n\n constructor() SmartAccountBase() {}\n\n\n /// @dev allows eth transfers by default\n receive() external payable virtual override {}\n\n /// @dev executes a low-level call against an account if the caller is authorized to make calls\n function execute(\n address to,\n uint256 value,\n bytes calldata data,\n uint8 operation\n )\n public\n payable\n virtual\n override\n onlyValidSigner\n returns (bytes memory)\n {\n require(operation == 0, \"Only call operations are supported\");\n ++state;\n\n // Perform custom checks/updates from within a custom controller\n _onExecute(to, value, data, operation);\n\n // Execute Call on Account\n return _call(to, value, data);\n }\n\n\n function handleTokenUpdate(\n bool isReceiving,\n address assetToken,\n uint256 assetAmount\n )\n public\n virtual\n override\n onlyValidSigner\n {\n // Perform custom checks/updates from within a custom controller\n _onUpdateToken(isReceiving, assetToken, assetAmount);\n }\n\n function handleNFTUpdate(\n bool isReceiving,\n address tokenContract,\n uint256 tokenId,\n uint256 tokenAmount\n )\n public\n virtual\n override\n onlyValidSigner\n {\n // Perform custom checks/updates from within a custom controller\n _onUpdateNFT(isReceiving, tokenContract, tokenId, tokenAmount);\n }\n\n function handleNFTBatchUpdate(\n bool isReceiving,\n address tokenContract,\n uint256[] calldata tokenIds,\n uint256[] calldata tokenAmounts\n )\n public\n virtual\n override\n onlyValidSigner\n {\n // Perform custom checks/updates from within a custom controller\n _onUpdateNFTBatch(isReceiving, tokenContract, tokenIds, tokenAmounts);\n }\n}\n" + }, + "contracts/tokens/BufficornZK.sol": { + "content": "// SPDX-License-Identifier: MIT\n// Written by: Rob Secord (https://twitter.com/robsecord)\n// Co-founder @ Charged Particles - Visit: https://charged.fi\n// Co-founder @ Taggr - Visit: https://taggr.io\n\npragma solidity ^0.8.13;\n\nimport {Ownable} from \"@openzeppelin/contracts/access/Ownable.sol\";\nimport {IERC165} from \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\nimport {ERC721, ERC721Enumerable} from \"@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol\";\nimport {Strings} from \"@openzeppelin/contracts/utils/Strings.sol\";\nimport {ISmartAccountController} from \"../interfaces/ISmartAccountController.sol\";\nimport {IDynamicTraits} from \"../interfaces/IDynamicTraits.sol\";\n\n/**\n * @dev todo...\n */\ncontract BufficornZK is ISmartAccountController, IDynamicTraits, Ownable, ERC721Enumerable {\n using Strings for uint256;\n\n // Base portion of the Token Metadata URI (format: base-uri/tokenId/traitsMap)\n string internal _tokenUriBase;\n\n // TokenId => Traits BitMap\n mapping (uint256 => uint256) internal _traitBits;\n\n // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n // Initialization\n\n constructor(string memory name, string memory symbol)\n ERC721(name, symbol) Ownable() {}\n\n\n // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n // Minting Logic\n\n // For minting container-NFTs that have no initial traits\n function mint(uint256 tokenId) external virtual {\n _mint(tokenId, 0);\n }\n\n // For minting child-NFTs that have initial fixed traits\n function mintWithTraits(uint256 tokenId, uint256 traits) external virtual {\n _mint(tokenId, traits);\n }\n\n\n // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n // Customizable Traits Logic\n\n function getTraits(uint256 tokenId) external view override returns (uint256) {\n return _traitBits[tokenId];\n }\n\n function hasTrait(uint256 tokenId, uint256 trait) external view override returns (bool) {\n uint256 bit = _traitBits[tokenId] & (1 << trait);\n return bit > 0;\n }\n\n function traitCount(uint256 tokenId) external view override returns (uint256 totalTraits) {\n uint256 map = _traitBits[tokenId];\n // Brian Kerninghan bit-counting method = O(log(n))\n while (map != 0) {\n map &= (map - 1);\n totalTraits += 1;\n }\n }\n\n function _addTraits(uint256 tokenId, uint256 traits) internal returns (uint256) {\n _traitBits[tokenId] |= traits;\n return _traitBits[tokenId];\n }\n\n function _removeTraits(uint256 tokenId, uint256 traits) internal returns (uint256) {\n uint256 mask = traits ^ (2 ** 256 - 1); // negate to find the traits to keep\n _traitBits[tokenId] &= mask;\n return _traitBits[tokenId];\n }\n\n\n // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n // Standard NFT Logic\n\n function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {\n _requireMinted(tokenId);\n string memory baseURI = _baseURI();\n return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString(), \"/\", _traitBits[tokenId].toString())) : \"\";\n }\n\n function setBaseURI(string memory newBase) external onlyOwner {\n _tokenUriBase = newBase;\n }\n\n function _baseURI() internal view virtual override returns (string memory) {\n return _tokenUriBase;\n }\n\n\n // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n // SmartAccount Controller Logic\n\n function onExecute(\n address,\n uint256,\n bytes calldata,\n uint8\n )\n external\n virtual\n override\n returns (string memory revertReason)\n {\n return \"\"; // success\n }\n\n function onUpdateToken(\n bool isReceiving,\n uint256, // this chain\n address, // this contract\n uint256 tokenId,\n address receivedAssetToken,\n uint256 receivedAssetAmount\n )\n external\n virtual\n override\n {\n // no-op\n }\n\n function onUpdateNFT(\n bool isReceiving,\n uint256, // this chain\n address, // this contract\n uint256 tokenId,\n address receivedTokenContract,\n uint256 receivedTokenId,\n uint256\n )\n external\n virtual\n override\n {\n if (IERC165(receivedTokenContract).supportsInterface(type(IDynamicTraits).interfaceId)) {\n uint256 newTraits = IDynamicTraits(receivedTokenContract).getTraits(receivedTokenId);\n if (isReceiving) {\n _addTraits(tokenId, newTraits);\n } else {\n _removeTraits(tokenId, newTraits);\n }\n }\n }\n\n function onUpdateNFTBatch(\n bool isReceiving,\n uint256, // this chain\n address, // this contract\n uint256 tokenId,\n address receivedTokenContract,\n uint256[] calldata receivedTokenIds,\n uint256[] calldata\n )\n external\n virtual\n override\n {\n uint256 i;\n uint256 t;\n uint256 n = receivedTokenIds.length;\n if (IERC165(receivedTokenContract).supportsInterface(type(IDynamicTraits).interfaceId)) {\n for (; i < n; i++) {\n t = IDynamicTraits(receivedTokenContract).getTraits(receivedTokenIds[i]);\n if (isReceiving) {\n _addTraits(tokenId, t);\n } else {\n _removeTraits(tokenId, t);\n }\n }\n }\n }\n\n\n // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n // Custom Interfaces\n\n /// @dev Returns true if a given interfaceId is supported by this account. This method can be\n /// extended by an override.\n function supportsInterface(bytes4 interfaceId)\n public\n view\n virtual\n override(IERC165, ERC721Enumerable)\n returns (bool)\n {\n return\n interfaceId == type(ISmartAccountController).interfaceId ||\n interfaceId == type(IDynamicTraits).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n\n // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n // Internal Functions\n\n function _mint(uint256 tokenId, uint256 traits) internal {\n // Note: Do NOT set traits when bridging a Bufficorn-NFT.\n // The \"traits\" param is ONLY used for minting Trait-NFTs\n // which can be minted from this contract, or another contract.\n // When bridging a Bufficorn, this contract will retain the last-known\n // state for a Bufficorns nested traits on zkSync.\n if (traits > 0) {\n _traitBits[tokenId] = traits;\n }\n _safeMint(_msgSender(), tokenId);\n }\n}\n" + } + }, + "settings": { + "optimizer": { + "enabled": true, + "runs": 200 + }, + "outputSelection": { + "*": { + "*": [ + "abi", + "evm.bytecode", + "evm.deployedBytecode", + "evm.methodIdentifiers", + "metadata", + "devdoc", + "userdoc", + "storageLayout", + "evm.gasEstimates" + ], + "": [ + "ast" + ] + } + }, + "metadata": { + "useLiteralContent": true + } + } +} \ No newline at end of file diff --git a/hardhat.config.ts b/hardhat.config.ts index bc73e7e..096f5c0 100644 --- a/hardhat.config.ts +++ b/hardhat.config.ts @@ -97,16 +97,6 @@ const config: HardhatUserConfig = { }, chainId: 5 }, - sepolia: { - url: `https://eth-sepolia.g.alchemy.com/v2/${process.env.ALCHEMY_SEPOLIA_API_KEY}`, - gasPrice: 'auto', - accounts: { - mnemonic: mnemonic.testnet, - initialIndex: 0, - count: 10, - }, - chainId: 11155111 - }, mainnet: { url: `https://eth-mainnet.g.alchemy.com/v2/${process.env.ALCHEMY_API_KEY}`, gasPrice: 'auto', @@ -116,6 +106,16 @@ const config: HardhatUserConfig = { count: 10, } }, + sepolia: { + url: `https://eth-sepolia.g.alchemy.com/v2/${process.env.ALCHEMY_API_KEY}`, + gasPrice: 'auto', + accounts: { + mnemonic: mnemonic.testnet, + initialIndex: 0, + count: 10, + }, + chainId: 11155111 + }, mumbai: { url: `https://polygon-mumbai.g.alchemy.io/v2/${process.env.ALCHEMY_MUMBAI_API_KEY}`, gasPrice: 10e9, @@ -142,6 +142,7 @@ const config: HardhatUserConfig = { goerli: process.env.ETHERSCAN_API_KEY ?? '', polygon: process.env.POLYGONSCAN_API_KEY ?? '', polygonMumbai: process.env.POLYGONSCAN_API_KEY ?? '', + sepolia: 'DRYVU1NAAUFZNK9KEEAXVUWVF9RQGUMEZR', } }, gasReporter: { diff --git a/yarn.lock b/yarn.lock index 565baf7..145ba69 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2,10 +2,10 @@ # yarn lockfile v1 -"@adraffy/ens-normalize@1.9.2": - version "1.9.2" - resolved "https://registry.yarnpkg.com/@adraffy/ens-normalize/-/ens-normalize-1.9.2.tgz#60111a5d9db45b2e5cbb6231b0bb8d97e8659316" - integrity sha512-0h+FrQDqe2Wn+IIGFkTCd4aAwTJ+7834Ek1COohCyV26AXhwQ7WQaz+4F/nLOeVl/3BtWHOHLPsq46V8YB46Eg== +"@adraffy/ens-normalize@1.10.1": + version "1.10.1" + resolved "https://registry.npmjs.org/@adraffy/ens-normalize/-/ens-normalize-1.10.1.tgz#63430d04bd8c5e74f8d7d049338f1cd9d4f02069" + integrity sha512-96Z2IP3mYmF1Xg2cDm8f1gWGf/HUVedQ3FMifV4kG/PQ4yEP51xDtRAEfhVNt5f/uzpNkZHwWQuUcu6D6K+Ekw== "@chainsafe/as-sha256@^0.3.1": version "0.3.1" @@ -421,16 +421,23 @@ tweetnacl "^1.0.3" tweetnacl-util "^0.15.1" -"@noble/hashes@1.1.2": - version "1.1.2" - resolved "https://registry.yarnpkg.com/@noble/hashes/-/hashes-1.1.2.tgz#e9e035b9b166ca0af657a7848eb2718f0f22f183" - integrity sha512-KYRCASVTv6aeUi1tsF8/vpyR7zpfs3FUzy2Jqm+MU+LmUKhQ0y2FpfwqkCcxSg2ua4GALJd8k2R76WxwZGbQpA== +"@noble/curves@1.2.0": + version "1.2.0" + resolved "https://registry.npmjs.org/@noble/curves/-/curves-1.2.0.tgz#92d7e12e4e49b23105a2555c6984d41733d65c35" + integrity sha512-oYclrNgRaM9SsBUBVbb8M6DTV7ZHRTKugureoYEncY5c65HOmRzvSiTE3y5CYaPYJA/GVkrhXEoF0M3Ya9PMnw== + dependencies: + "@noble/hashes" "1.3.2" "@noble/hashes@1.2.0", "@noble/hashes@~1.2.0": version "1.2.0" resolved "https://registry.yarnpkg.com/@noble/hashes/-/hashes-1.2.0.tgz#a3150eeb09cc7ab207ebf6d7b9ad311a9bdbed12" integrity sha512-FZfhjEDbT5GRswV3C6uvLPHMiVD6lQBmpoX5+eSiPaMTXte/IKqI5dykDxzZB/WBeK/CDuQRBWarPdi3FNY2zQ== +"@noble/hashes@1.3.2": + version "1.3.2" + resolved "https://registry.npmjs.org/@noble/hashes/-/hashes-1.3.2.tgz#6f26dbc8fbc7205873ce3cee2f690eba0d421b39" + integrity sha512-MVC8EAQp7MvEcm30KWENFjgR+Mkmf+D189XJTkFIlwohU5hcBbn1ZkKq7KVTi2Hme3PMGF390DaL52beVrIihQ== + "@noble/secp256k1@1.7.1", "@noble/secp256k1@~1.7.0": version "1.7.1" resolved "https://registry.yarnpkg.com/@noble/secp256k1/-/secp256k1-1.7.1.tgz#b251c70f824ce3ca7f8dc3df08d58f005cc0507c" @@ -909,7 +916,7 @@ "@types/node@18.15.13": version "18.15.13" - resolved "https://registry.yarnpkg.com/@types/node/-/node-18.15.13.tgz#f64277c341150c979e42b00e4ac289290c9df469" + resolved "https://registry.npmjs.org/@types/node/-/node-18.15.13.tgz#f64277c341150c979e42b00e4ac289290c9df469" integrity sha512-N+0kuo9KgrUQ1Sn/ifDXsvg0TTleP7rIy4zOBGECxAljqvqfqpTfzx0Q1NUedOixRMBfe2Whhb056a42cWs26Q== "@types/node@^10.0.3": @@ -1011,7 +1018,7 @@ aes-js@3.0.0: aes-js@4.0.0-beta.5: version "4.0.0-beta.5" - resolved "https://registry.yarnpkg.com/aes-js/-/aes-js-4.0.0-beta.5.tgz#8d2452c52adedebc3a3e28465d858c11ca315873" + resolved "https://registry.npmjs.org/aes-js/-/aes-js-4.0.0-beta.5.tgz#8d2452c52adedebc3a3e28465d858c11ca315873" integrity sha512-G965FqalsNyrPqgEGON7nIx1e/OVENSgiEIzyC63haUMuvNnwIgIjMs52hlTCKhkBny7A2ORNlfY9Zu+jmGk1Q== agent-base@6: @@ -2129,13 +2136,13 @@ ethers@^5.5.3, ethers@^5.7.1: "@ethersproject/wordlists" "5.7.0" ethers@^6.6.2: - version "6.6.2" - resolved "https://registry.yarnpkg.com/ethers/-/ethers-6.6.2.tgz#0b6131b5fa291fec69b7ae379cb6bb2405c505a7" - integrity sha512-vyWfVAj2g7xeZIivOqlbpt7PbS2MzvJkKgsncgn4A/1xZr8Q3BznBmEBRQyPXKCgHmX4PzRQLpnYG7jl/yutMg== + version "6.11.1" + resolved "https://registry.npmjs.org/ethers/-/ethers-6.11.1.tgz#96aae00b627c2e35f9b0a4d65c7ab658259ee6af" + integrity sha512-mxTAE6wqJQAbp5QAe/+o+rXOID7Nw91OZXvgpjDa1r4fAbq2Nu314oEZSbjoRLacuCzs7kUC3clEvkCQowffGg== dependencies: - "@adraffy/ens-normalize" "1.9.2" - "@noble/hashes" "1.1.2" - "@noble/secp256k1" "1.7.1" + "@adraffy/ens-normalize" "1.10.1" + "@noble/curves" "1.2.0" + "@noble/hashes" "1.3.2" "@types/node" "18.15.13" aes-js "4.0.0-beta.5" tslib "2.4.0" @@ -4681,7 +4688,7 @@ ts-node@>=8.0.0: tslib@2.4.0: version "2.4.0" - resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.4.0.tgz#7cecaa7f073ce680a05847aa77be941098f36dc3" + resolved "https://registry.npmjs.org/tslib/-/tslib-2.4.0.tgz#7cecaa7f073ce680a05847aa77be941098f36dc3" integrity sha512-d6xOpEDfsi2CZVlPQzGeux8XMwLT9hssAsaPYExaQMuYskwb+x1x7J371tWlbBdWHroy99KnVB6qIkUbs5X3UQ== tslib@^1.9.3: @@ -4974,7 +4981,7 @@ ws@7.4.6: ws@8.5.0: version "8.5.0" - resolved "https://registry.yarnpkg.com/ws/-/ws-8.5.0.tgz#bfb4be96600757fe5382de12c670dab984a1ed4f" + resolved "https://registry.npmjs.org/ws/-/ws-8.5.0.tgz#bfb4be96600757fe5382de12c670dab984a1ed4f" integrity sha512-BWX0SWVgLPzYwF8lTzEy1egjhS4S4OEAHfsO8o65WOVsrnSRGaSiUaa9e0ggGlkMTtBlmOpEXiie9RUcBO86qg== ws@^7.4.6: