diff --git a/broadcast/012_DeploySponsorPaymaster.s.sol/11155111/README.md b/broadcast/012_DeploySponsorPaymaster.s.sol/11155111/README.md
new file mode 100644
index 0000000..5a1c910
--- /dev/null
+++ b/broadcast/012_DeploySponsorPaymaster.s.sol/11155111/README.md
@@ -0,0 +1,3 @@
+- This chain used cast send to deploy so there's no corresponding run json
+- Ran command in `script/cmd/DeploySponsorPaymaster` and `script/cmd/DeploySponsorPaymasterProxy`
+- tx hash: 0x491d547fd404d78e1dbc5205942ea9b404c99b8443d7538fc1c114900007b8db, 0x916f34178d7a8522a932c46c4e0829c4210058969be0f7a2837d4fa1c4784763
\ No newline at end of file
diff --git a/broadcast/012_DeploySponsorPaymaster.s.sol/421614/run-1727119759.json b/broadcast/012_DeploySponsorPaymaster.s.sol/421614/run-1727119759.json
new file mode 100644
index 0000000..27cb5b0
--- /dev/null
+++ b/broadcast/012_DeploySponsorPaymaster.s.sol/421614/run-1727119759.json
@@ -0,0 +1,65 @@
+{
+ "transactions": [
+ {
+ "hash": "0x1b5e47a9e8bd8ec553aaf853987e48bf128dc05003a11af7f5c1464055c8d358",
+ "transactionType": "CREATE2",
+ "contractName": "SponsorPaymaster",
+ "contractAddress": "0x36058cc257967db1912fc276f9cbec072cd572cb",
+ "function": null,
+ "arguments": [
+ "0x0000000071727De22E5E9d8BAf0edAc6f37da032"
+ ],
+ "transaction": {
+ "from": "0x74cbcd3857aab24977b6ab6212f34eb381fcd976",
+ "to": "0x4e59b44847b379578588920ca78fbf26c0b4956c",
+ "gas": "0x26cb0a",
+ "value": "0x0",
+ "input": "0x000000000000000000000000000000000000000000000000000000000000000060c034620000d057601f62001d8538819003918201601f19168301916001600160401b03831184841017620000d557808492602094604052833981010312620000d057516001600160a01b0381168103620000d0573060805260a05262000065620000eb565b6200006f620000eb565b604051611bfa90816200018b82396080518181816105a50152610826015260a0518181816101f7015281816102bc01528181610a5b01528181610dc501528181610e1901528181610ea901528181610f2e015281816113ea01526115960152f35b600080fd5b634e487b7160e01b600052604160045260246000fd5b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a00805460ff8160401c1662000178576001600160401b036002600160401b0319828216016200013957505050565b6001600160401b031990911681179091556040519081527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d290602090a1565b60405163f92ee8a960e01b8152600490fdfe60806040526004361015610023575b361561001957600080fd5b6100216113d6565b005b60003560e01c80630396cb60146101b3578063205c2878146101ae5780633f4ba83a146101a957806343e3b518146101a45780634f1ef2861461019f57806350a4b3f61461019a57806352b7512c1461019557806352d1902d146101905780635c975abb1461018b578063715018a6146101865780637c627b21146101815780638456cb591461017c5780638969e0f9146101775780638da5cb5b14610172578063946d92041461016d57806394d4ad6014610168578063ad3cb1cc14610163578063b0d691fe1461015e578063bb9fe6bf14610159578063c23a5cea14610154578063c399ec881461014f578063d0e30db01461014a578063d42f2f3514610145578063d88c13e0146101405763f2fde38b0361000e57611112565b611082565b610fc4565b610fa8565b610f01565b610e70565b610df4565b610daf565b610d57565b610c9e565b610b54565b610b1e565b610a02565b610993565b610946565b6108ae565b61087e565b610813565b6107aa565b6106ea565b610552565b6103ea565b610320565b610283565b6101cb565b63ffffffff8116036101c657565b600080fd5b6000602036600319011261026f576004356101e5816101b8565b6101ed6114c3565b6101f56114fc565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316908290823b1561026b57602463ffffffff916040519485938492621cb65b60e51b845216600483015234905af180156102665761025a575080f35b61026390610490565b80f35b61113f565b5080fd5b80fd5b6001600160a01b038116036101c657565b346101c6576000604036600319011261026f576004356102a281610272565b6102aa6114c3565b6102b26114fc565b6001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000811691839190833b1561031c5760449083604051958694859363040b850f60e31b855216600484015260243560248401525af180156102665761025a575080f35b8280fd5b346101c65760003660031901126101c6576103396114c3565b610341611527565b610349611527565b600080516020611b8583398151915260ff1981541690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa6020604051338152a1005b9181601f840112156101c6578235916001600160401b0383116101c6576020808501948460051b0101116101c657565b60206003198201126101c657600435906001600160401b0382116101c6576103e69160040161038c565b9091565b346101c6576103f8366103bc565b906104016114c3565b6104096114fc565b60005b82811061041557005b610420818484611161565b3561042a81610272565b6001600160a01b039061043e908216611748565b1561044c575060010161040c565b6104596024928585611161565b359061046482610272565b604051630a07962b60e11b815291166004820152fd5b634e487b7160e01b600052604160045260246000fd5b6001600160401b0381116104a357604052565b61047a565b60a081019081106001600160401b038211176104a357604052565b61010081019081106001600160401b038211176104a357604052565b90601f801991011681019081106001600160401b038211176104a357604052565b6001600160401b0381116104a357601f01601f191660200190565b92919261052782610500565b9161053560405193846104df565b8294818452818301116101c6578281602093846000960137010152565b60403660031901126101c657600480359061056c82610272565b6024356001600160401b0381116101c657366023820112156101c65761059b903690602481850135910161051b565b6001600160a01b037f000000000000000000000000000000000000000000000000000000000000000081163081149081156106af575b5061069e5790602083926105e36114c3565b6040516352d1902d60e01b8152938491829088165afa6000928161066d575b50610630575050604051634c9c8ce360e01b81526001600160a01b0390921690820190815281906020010390fd5b8383600080516020611b6583398151915284036106515761002183836117bf565b604051632a87526960e21b815290810184815281906020010390fd5b61069091935060203d602011610697575b61068881836104df565b810190611553565b9138610602565b503d61067e565b60405163703e46dd60e11b81528390fd5b905081600080516020611b6583398151915254161415386105d1565b90816101209103126101c65790565b65ffffffffffff8116036101c657565b346101c65760a03660031901126101c6576004356001600160401b0381116101c65761071a9036906004016106cb565b602435906001600160801b039081831683036101c65760443591821682036101c6576020926107629260643591610750836106da565b6084359361075d856106da565b6111d2565b604051908152f35b919082519283825260005b848110610796575050826000602080949584010152601f8019910116010190565b602081830181015184830182015201610775565b346101c65760603660031901126101c6576004356001600160401b0381116101c6576107f56107e06108099236906004016106cb565b6107e86114fc565b6107f0611594565b611603565b60405192839260408452604084019061076a565b9060208301520390f35b346101c65760003660031901126101c6577f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316300361086c576020604051600080516020611b658339815191528152f35b60405163703e46dd60e11b8152600490fd5b346101c65760003660031901126101c657602060ff600080516020611b8583398151915254166040519015158152f35b346101c65760008060031936011261026f576108c86114c3565b600080516020611b4583398151915280546001600160a01b0319811690915581906001600160a01b03167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08280a380f35b9181601f840112156101c6578235916001600160401b0383116101c657602083818601950101116101c657565b346101c65760803660031901126101c657600360043510156101c6576024356001600160401b0381116101c657610981903690600401610919565b505061098b6114fc565b610021611594565b346101c65760003660031901126101c6576109ac6114c3565b6109b46114fc565b6109bc6114fc565b600080516020611b85833981519152600160ff198254161790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586020604051338152a1005b346101c65760008060031936011261026f57806080604051610a23816104a8565b8281526020810183905260408082018490526060820184905291019190915251632943e70960e11b815230600482015260a0816024817f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03165afa90811561026657610aeb9291610aef575b5060405191829182919091608065ffffffffffff8160a0840195805185526020810151151560208601526001600160701b03604082015116604086015263ffffffff6060820151166060860152015116910152565b0390f35b610b11915060a03d60a011610b17575b610b0981836104df565b81019061127e565b38610a96565b503d610aff565b346101c65760003660031901126101c657600080516020611b45833981519152546040516001600160a01b039091168152602090f35b346101c65760403660031901126101c657600435610b7181610272565b6001600160401b03906024358281116101c657610b9290369060040161038c565b90600080516020611ba5833981519152549360ff8560401c1615941680159081610c96575b6001149081610c8c575b159081610c83575b50610c7157600080516020611ba5833981519152805467ffffffffffffffff19166001179055610bfd9284610c4c576112f1565b610c0357005b600080516020611ba5833981519152805460ff60401b19169055604051600181527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d290602090a1005b600080516020611ba5833981519152805460ff60401b1916600160401b1790556112f1565b60405163f92ee8a960e01b8152600490fd5b90501538610bc9565b303b159150610bc1565b859150610bb7565b346101c65760203660031901126101c6576004356001600160401b0381116101c657610cd9610cd360c0923690600401610919565b90611382565b9283926040979697519788966001600160801b03809216885216602087015265ffffffffffff809216604087015216606085015260a060808501528160a0850152848401376000828201840152601f01601f19168101030190f35b60405190602082018281106001600160401b038211176104a35760405260008252565b346101c65760003660031901126101c65760405160408101908082106001600160401b038311176104a357610aeb9160405260058152640352e302e360dc1b602082015260405191829160208352602083019061076a565b346101c65760003660031901126101c6576040517f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168152602090f35b346101c65760008060031936011261026f57610e0e6114c3565b610e166114fc565b807f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316803b15610e6d57819060046040518094819363bb9fe6bf60e01b83525af180156102665761025a575080f35b50fd5b346101c6576000602036600319011261026f57600435610e8f81610272565b610e976114c3565b610e9f6114fc565b6001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000811691839190833b1561031c5760249083604051958694859363611d2e7560e11b85521660048401525af180156102665761025a575080f35b346101c65760008060031936011261026f576040516370a0823160e01b81523060048201526020816024817f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03165afa908115610266578291610f71575b604051828152602090f35b90506020813d602011610fa0575b81610f8c602093836104df565b8101031261026b57610aeb91505138610f66565b3d9150610f7f565b60003660031901126101c657610fbc6114fc565b6100216113e8565b346101c65760008060031936011261026f5760405180916032549081835260208093018092603283527f11df491316f14931039edfd4f8964c9a443b862f02d4c7611d18c2bc4e6ff69790835b81811061106e57505050846110279103856104df565b60405193838594850191818652518092526040850193925b82811061104e57505050500390f35b83516001600160a01b03168552869550938101939281019260010161103f565b825484529286019260019283019201611011565b346101c657611090366103bc565b906110996114c3565b6110a16114fc565b60005b8281106110ad57005b6110b8818484611161565b356110c281610272565b6001600160a01b03906110d6908216611952565b156110e457506001016110a4565b6110f16024928585611161565b35906110fc82610272565b60405163281c4e0360e11b815291166004820152fd5b346101c65760203660031901126101c65761002160043561113281610272565b61113a6114c3565b61144f565b6040513d6000823e3d90fd5b634e487b7160e01b600052603260045260246000fd5b91908110156111715760051b0190565b61114b565b9593909161119360c096939998949960e0895260e089019061076a565b6001600160801b0391821660208901529816604087015260608601526001600160a01b0316608085015265ffffffffffff91821660a085015216910152565b9092611278929461126a91604060c06111ed82870187611562565b9081845191823720956112036060820182611562565b908185519182372083519760018060a01b0383351660208a01526020830135858a015260608901526080880152608081013560a088015260a081013582880152013560e086015260e08552611257856104c3565b519586946020860198309246928b611176565b03601f1981018352826104df565b51902090565b908160a09103126101c65760405190611296826104a8565b80518252602081015180151581036101c65760208301526040810151906001600160701b03821682036101c657608091604084015260608101516112d9816101b8565b606084015201516112e9816106da565b608082015290565b611315906112fd6118a2565b6113056118a2565b61130d6118a2565b61113a6118a2565b61131d6118a2565b6113256118a2565b600080516020611b85833981519152805460ff1916905560005b82811061134b57505050565b611356818484611161565b3561136081610272565b6001600160a01b0390611374908216611748565b1561044c575060010161133f565b816024116101c657601481013560801c92826034116101c657602482013560801c92806074116101c6576034830135916113bb836106da565b607460548501356113cb816106da565b939401916073190190565b6113de6114fc565b6113e66113e8565b565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316803b156101c65760006024916040519283809263b760faf960e01b825230600483015234905af18015610266576114465750565b6113e690610490565b6001600160a01b039081169081156114aa57600080516020611b4583398151915280546001600160a01b031981168417909155167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0600080a3565b604051631e4fbdf760e01b815260006004820152602490fd5b600080516020611b45833981519152546001600160a01b031633036114e457565b60405163118cdaa760e01b8152336004820152602490fd5b60ff600080516020611b85833981519152541661151557565b60405163d93c066560e01b8152600490fd5b60ff600080516020611b8583398151915254161561154157565b604051638dfc202b60e01b8152600490fd5b908160209103126101c6575190565b903590601e19813603018212156101c657018035906001600160401b0382116101c6576020019181360383136101c657565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031633036115c657565b60405162461bcd60e51b815260206004820152601560248201527414d95b99195c881b9bdd08115b9d1c9e541bda5b9d605a1b6044820152606490fd5b61163461162e9161166761161d610cd360e0840184611562565b9882989591849a959395369161051b565b966111d2565b916000927f19457468657265756d205369676e6564204d6573736167653a0a3332000000008452601c52603c8320611866565b5060048193929310156116fd5715918215926116de575b50506116b45760a09190911b65ffffffffffff60a01b1660d09190911b6001600160d01b031916175b906116b0610d34565b9190565b60a09190911b65ffffffffffff60a01b1660d09190911b6001600160d01b031916176001176116a7565b6001600160a01b0316815260336020526040902054159050388061167e565b634e487b7160e01b82526021600452602482fd5b6032548110156111715760326000527f11df491316f14931039edfd4f8964c9a443b862f02d4c7611d18c2bc4e6ff6970190600090565b806000526033602052604060002054156000146117b957603254600160401b8110156104a35760018101806032558110156111715781907f11df491316f14931039edfd4f8964c9a443b862f02d4c7611d18c2bc4e6ff6970155603254906000526033602052604060002055600190565b50600090565b90813b1561184557600080516020611b6583398151915280546001600160a01b0319166001600160a01b0384169081179091557fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b600080a280511561182a5761182791611a14565b50565b50503461183357565b60405163b398979f60e01b8152600490fd5b604051634c9c8ce360e01b81526001600160a01b0383166004820152602490fd5b81519190604183036118975761189092506020820151906060604084015193015160001a90611a5d565b9192909190565b505060009160029190565b60ff600080516020611ba58339815191525460401c16156118bf57565b604051631afcd79f60e31b8152600490fd5b6000198101919082116118e057565b634e487b7160e01b600052601160045260246000fd5b603254801561193c5760001981019080821015611171577f11df491316f14931039edfd4f8964c9a443b862f02d4c7611d18c2bc4e6ff696600091603283520155603255565b634e487b7160e01b600052603160045260246000fd5b6000818152603360205260408120549091908015611a0f5760001981018181116119fb57906119ab92916119876032546118d1565b908181036119b1575b50505061199b6118f6565b6000526033602052604060002090565b55600190565b61199b6119d9916119d16119c76119f295611711565b90549060031b1c90565b928391611711565b90919082549060031b91821b91600019901b1916179055565b55388080611990565b634e487b7160e01b84526011600452602484fd5b505090565b600080611a5293602081519101845af43d15611a55573d91611a3583610500565b92611a4360405194856104df565b83523d6000602085013e611ae1565b90565b606091611ae1565b91907f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a08411611ad557926020929160ff608095604051948552168484015260408301526060820152600092839182805260015afa156102665780516001600160a01b03811615611acc57918190565b50809160019190565b50505060009160039190565b90611b085750805115611af657805190602001fd5b604051630a12f52160e11b8152600490fd5b81511580611b3b575b611b19575090565b604051639996b31560e01b81526001600160a01b039091166004820152602490fd5b50803b15611b1156fe9016d09d72d40fdae2fd8ceac6b6234c7706214fd39c1cd1e609a0528c199300360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbccd5ed15c6e187e77e9aee88184c21f4f2182ab5827cb3b7e07fbedcd63f03300f0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a00a2646970667358221220f33a68b38cd2ce9bbc7c2aa9a21093d5557781e432c6b0d905096bc36d3bccac64736f6c634300081800330000000000000000000000000000000071727de22e5e9d8baf0edac6f37da032",
+ "nonce": "0x4",
+ "chainId": "0x66eee"
+ },
+ "additionalContracts": [],
+ "isFixedGasLimit": false
+ }
+ ],
+ "receipts": [
+ {
+ "status": "0x1",
+ "cumulativeGasUsed": "0x1e21ea",
+ "logs": [
+ {
+ "address": "0x36058cc257967db1912fc276f9cbec072cd572cb",
+ "topics": [
+ "0xc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d2"
+ ],
+ "data": "0x000000000000000000000000000000000000000000000000ffffffffffffffff",
+ "blockHash": "0x7f1ddde3c1d72ab900a2157840727c3467e25d1c683125cdf889f93921c2c8ef",
+ "blockNumber": "0x4f9bae8",
+ "transactionHash": "0x1b5e47a9e8bd8ec553aaf853987e48bf128dc05003a11af7f5c1464055c8d358",
+ "transactionIndex": "0x2",
+ "logIndex": "0x1",
+ "removed": false
+ }
+ ],
+ "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000800000000000000000000000080000000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000004000000000000000000000000000",
+ "type": "0x2",
+ "transactionHash": "0x1b5e47a9e8bd8ec553aaf853987e48bf128dc05003a11af7f5c1464055c8d358",
+ "transactionIndex": "0x2",
+ "blockHash": "0x7f1ddde3c1d72ab900a2157840727c3467e25d1c683125cdf889f93921c2c8ef",
+ "blockNumber": "0x4f9bae8",
+ "gasUsed": "0x1cdf52",
+ "effectiveGasPrice": "0x5f5e100",
+ "from": "0x74cbcd3857aab24977b6ab6212f34eb381fcd976",
+ "to": "0x4e59b44847b379578588920ca78fbf26c0b4956c",
+ "contractAddress": null,
+ "gasUsedForL1": "0x400c8",
+ "l1BlockNumber": "0x66f2d7"
+ }
+ ],
+ "libraries": [],
+ "pending": [],
+ "returns": {},
+ "timestamp": 1727119759,
+ "chain": 421614,
+ "commit": "e53fec2"
+}
\ No newline at end of file
diff --git a/broadcast/012_DeploySponsorPaymaster.s.sol/421614/run-1727120414.json b/broadcast/012_DeploySponsorPaymaster.s.sol/421614/run-1727120414.json
new file mode 100644
index 0000000..ed00c96
--- /dev/null
+++ b/broadcast/012_DeploySponsorPaymaster.s.sol/421614/run-1727120414.json
@@ -0,0 +1,95 @@
+{
+ "transactions": [
+ {
+ "hash": "0x318a1a912cc7de29777cadb9b951410f96deb304500e32231e13dbcb37a1fbb3",
+ "transactionType": "CREATE2",
+ "contractName": "ERC1967Proxy",
+ "contractAddress": "0x03df76c8c30a88f424cf3cbbc36a1ca02763103b",
+ "function": null,
+ "arguments": [
+ "0x36058Cc257967db1912FC276F9CBEC072CD572cb",
+ "0x946d92040000000000000000000000007e99c7725463a858c34d0fd69a09b11fd75087cc00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000000"
+ ],
+ "transaction": {
+ "from": "0x74cbcd3857aab24977b6ab6212f34eb381fcd976",
+ "to": "0x4e59b44847b379578588920ca78fbf26c0b4956c",
+ "gas": "0x43eff",
+ "value": "0x0",
+ "input": "0x000000000000000000000000000000000000000000000000000000000000000060806040526102d38038038061001481610194565b92833981019060408183031261018f5780516001600160a01b03811680820361018f5760208381015190936001600160401b03821161018f570184601f8201121561018f5780519061006d610068836101cf565b610194565b9582875285838301011161018f57849060005b83811061017b57505060009186010152813b15610163577f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc80546001600160a01b03191682179055604051907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b600080a28351156101455750600080848461012c96519101845af4903d1561013c573d61011c610068826101cf565b908152600081943d92013e6101ea565b505b6040516085908161024e8239f35b606092506101ea565b9250505034610154575061012e565b63b398979f60e01b8152600490fd5b60249060405190634c9c8ce360e01b82526004820152fd5b818101830151888201840152869201610080565b600080fd5b6040519190601f01601f191682016001600160401b038111838210176101b957604052565b634e487b7160e01b600052604160045260246000fd5b6001600160401b0381116101b957601f01601f191660200190565b9061021157508051156101ff57805190602001fd5b604051630a12f52160e11b8152600490fd5b81511580610244575b610222575090565b604051639996b31560e01b81526001600160a01b039091166004820152602490fd5b50803b1561021a56fe60806040527f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc54600090819081906001600160a01b0316368280378136915af43d82803e15604b573d90f35b3d90fdfea26469706673582212202b867e05fada64e8389ea34fca4e9048d8dde9af33f4fdd783dd16f9ba5fcf9c64736f6c6343000818003300000000000000000000000036058cc257967db1912fc276f9cbec072cd572cb00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000064946d92040000000000000000000000007e99c7725463a858c34d0fd69a09b11fd75087cc0000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
+ "nonce": "0x5",
+ "chainId": "0x66eee"
+ },
+ "additionalContracts": [],
+ "isFixedGasLimit": false
+ }
+ ],
+ "receipts": [
+ {
+ "status": "0x1",
+ "cumulativeGasUsed": "0x3f4d3",
+ "logs": [
+ {
+ "address": "0x03df76c8c30a88f424cf3cbbc36a1ca02763103b",
+ "topics": [
+ "0xbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b",
+ "0x00000000000000000000000036058cc257967db1912fc276f9cbec072cd572cb"
+ ],
+ "data": "0x",
+ "blockHash": "0x0ce37c294e74f38aa98f3e00ccfee25599ca133100c96d1109fc0251e106ac43",
+ "blockNumber": "0x4f9c4c8",
+ "transactionHash": "0x318a1a912cc7de29777cadb9b951410f96deb304500e32231e13dbcb37a1fbb3",
+ "transactionIndex": "0x2",
+ "logIndex": "0x1",
+ "removed": false
+ },
+ {
+ "address": "0x03df76c8c30a88f424cf3cbbc36a1ca02763103b",
+ "topics": [
+ "0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0",
+ "0x0000000000000000000000000000000000000000000000000000000000000000",
+ "0x0000000000000000000000007e99c7725463a858c34d0fd69a09b11fd75087cc"
+ ],
+ "data": "0x",
+ "blockHash": "0x0ce37c294e74f38aa98f3e00ccfee25599ca133100c96d1109fc0251e106ac43",
+ "blockNumber": "0x4f9c4c8",
+ "transactionHash": "0x318a1a912cc7de29777cadb9b951410f96deb304500e32231e13dbcb37a1fbb3",
+ "transactionIndex": "0x2",
+ "logIndex": "0x2",
+ "removed": false
+ },
+ {
+ "address": "0x03df76c8c30a88f424cf3cbbc36a1ca02763103b",
+ "topics": [
+ "0xc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d2"
+ ],
+ "data": "0x0000000000000000000000000000000000000000000000000000000000000001",
+ "blockHash": "0x0ce37c294e74f38aa98f3e00ccfee25599ca133100c96d1109fc0251e106ac43",
+ "blockNumber": "0x4f9c4c8",
+ "transactionHash": "0x318a1a912cc7de29777cadb9b951410f96deb304500e32231e13dbcb37a1fbb3",
+ "transactionIndex": "0x2",
+ "logIndex": "0x3",
+ "removed": false
+ }
+ ],
+ "logsBloom": "0x0000000000000000000000000000000040000000000000000080000040400000000000000000000000000000000000000000000000000000000000000000000000000000000000000004000000000200000100000000000000000400000000000000000002000000000000000000080000000000000000000000000000000040000000000000000000080000000000000000000000008000000000000000000000000000000000000000000000000400000000000000000000000000000000000000002008000000000000000000000000020000000c000000000000000020000000000008000000000000000000000000000000000000000000000000000000",
+ "type": "0x2",
+ "transactionHash": "0x318a1a912cc7de29777cadb9b951410f96deb304500e32231e13dbcb37a1fbb3",
+ "transactionIndex": "0x2",
+ "blockHash": "0x0ce37c294e74f38aa98f3e00ccfee25599ca133100c96d1109fc0251e106ac43",
+ "blockNumber": "0x4f9c4c8",
+ "gasUsed": "0x32448",
+ "effectiveGasPrice": "0x5f5e100",
+ "from": "0x74cbcd3857aab24977b6ab6212f34eb381fcd976",
+ "to": "0x4e59b44847b379578588920ca78fbf26c0b4956c",
+ "contractAddress": null,
+ "gasUsedForL1": "0x82fc",
+ "l1BlockNumber": "0x66f304"
+ }
+ ],
+ "libraries": [],
+ "pending": [],
+ "returns": {},
+ "timestamp": 1727120414,
+ "chain": 421614,
+ "commit": "e53fec2"
+}
\ No newline at end of file
diff --git a/broadcast/012_DeploySponsorPaymaster.s.sol/421614/run-latest.json b/broadcast/012_DeploySponsorPaymaster.s.sol/421614/run-latest.json
new file mode 100644
index 0000000..ed00c96
--- /dev/null
+++ b/broadcast/012_DeploySponsorPaymaster.s.sol/421614/run-latest.json
@@ -0,0 +1,95 @@
+{
+ "transactions": [
+ {
+ "hash": "0x318a1a912cc7de29777cadb9b951410f96deb304500e32231e13dbcb37a1fbb3",
+ "transactionType": "CREATE2",
+ "contractName": "ERC1967Proxy",
+ "contractAddress": "0x03df76c8c30a88f424cf3cbbc36a1ca02763103b",
+ "function": null,
+ "arguments": [
+ "0x36058Cc257967db1912FC276F9CBEC072CD572cb",
+ "0x946d92040000000000000000000000007e99c7725463a858c34d0fd69a09b11fd75087cc00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000000"
+ ],
+ "transaction": {
+ "from": "0x74cbcd3857aab24977b6ab6212f34eb381fcd976",
+ "to": "0x4e59b44847b379578588920ca78fbf26c0b4956c",
+ "gas": "0x43eff",
+ "value": "0x0",
+ "input": "0x000000000000000000000000000000000000000000000000000000000000000060806040526102d38038038061001481610194565b92833981019060408183031261018f5780516001600160a01b03811680820361018f5760208381015190936001600160401b03821161018f570184601f8201121561018f5780519061006d610068836101cf565b610194565b9582875285838301011161018f57849060005b83811061017b57505060009186010152813b15610163577f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc80546001600160a01b03191682179055604051907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b600080a28351156101455750600080848461012c96519101845af4903d1561013c573d61011c610068826101cf565b908152600081943d92013e6101ea565b505b6040516085908161024e8239f35b606092506101ea565b9250505034610154575061012e565b63b398979f60e01b8152600490fd5b60249060405190634c9c8ce360e01b82526004820152fd5b818101830151888201840152869201610080565b600080fd5b6040519190601f01601f191682016001600160401b038111838210176101b957604052565b634e487b7160e01b600052604160045260246000fd5b6001600160401b0381116101b957601f01601f191660200190565b9061021157508051156101ff57805190602001fd5b604051630a12f52160e11b8152600490fd5b81511580610244575b610222575090565b604051639996b31560e01b81526001600160a01b039091166004820152602490fd5b50803b1561021a56fe60806040527f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc54600090819081906001600160a01b0316368280378136915af43d82803e15604b573d90f35b3d90fdfea26469706673582212202b867e05fada64e8389ea34fca4e9048d8dde9af33f4fdd783dd16f9ba5fcf9c64736f6c6343000818003300000000000000000000000036058cc257967db1912fc276f9cbec072cd572cb00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000064946d92040000000000000000000000007e99c7725463a858c34d0fd69a09b11fd75087cc0000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
+ "nonce": "0x5",
+ "chainId": "0x66eee"
+ },
+ "additionalContracts": [],
+ "isFixedGasLimit": false
+ }
+ ],
+ "receipts": [
+ {
+ "status": "0x1",
+ "cumulativeGasUsed": "0x3f4d3",
+ "logs": [
+ {
+ "address": "0x03df76c8c30a88f424cf3cbbc36a1ca02763103b",
+ "topics": [
+ "0xbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b",
+ "0x00000000000000000000000036058cc257967db1912fc276f9cbec072cd572cb"
+ ],
+ "data": "0x",
+ "blockHash": "0x0ce37c294e74f38aa98f3e00ccfee25599ca133100c96d1109fc0251e106ac43",
+ "blockNumber": "0x4f9c4c8",
+ "transactionHash": "0x318a1a912cc7de29777cadb9b951410f96deb304500e32231e13dbcb37a1fbb3",
+ "transactionIndex": "0x2",
+ "logIndex": "0x1",
+ "removed": false
+ },
+ {
+ "address": "0x03df76c8c30a88f424cf3cbbc36a1ca02763103b",
+ "topics": [
+ "0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0",
+ "0x0000000000000000000000000000000000000000000000000000000000000000",
+ "0x0000000000000000000000007e99c7725463a858c34d0fd69a09b11fd75087cc"
+ ],
+ "data": "0x",
+ "blockHash": "0x0ce37c294e74f38aa98f3e00ccfee25599ca133100c96d1109fc0251e106ac43",
+ "blockNumber": "0x4f9c4c8",
+ "transactionHash": "0x318a1a912cc7de29777cadb9b951410f96deb304500e32231e13dbcb37a1fbb3",
+ "transactionIndex": "0x2",
+ "logIndex": "0x2",
+ "removed": false
+ },
+ {
+ "address": "0x03df76c8c30a88f424cf3cbbc36a1ca02763103b",
+ "topics": [
+ "0xc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d2"
+ ],
+ "data": "0x0000000000000000000000000000000000000000000000000000000000000001",
+ "blockHash": "0x0ce37c294e74f38aa98f3e00ccfee25599ca133100c96d1109fc0251e106ac43",
+ "blockNumber": "0x4f9c4c8",
+ "transactionHash": "0x318a1a912cc7de29777cadb9b951410f96deb304500e32231e13dbcb37a1fbb3",
+ "transactionIndex": "0x2",
+ "logIndex": "0x3",
+ "removed": false
+ }
+ ],
+ "logsBloom": "0x0000000000000000000000000000000040000000000000000080000040400000000000000000000000000000000000000000000000000000000000000000000000000000000000000004000000000200000100000000000000000400000000000000000002000000000000000000080000000000000000000000000000000040000000000000000000080000000000000000000000008000000000000000000000000000000000000000000000000400000000000000000000000000000000000000002008000000000000000000000000020000000c000000000000000020000000000008000000000000000000000000000000000000000000000000000000",
+ "type": "0x2",
+ "transactionHash": "0x318a1a912cc7de29777cadb9b951410f96deb304500e32231e13dbcb37a1fbb3",
+ "transactionIndex": "0x2",
+ "blockHash": "0x0ce37c294e74f38aa98f3e00ccfee25599ca133100c96d1109fc0251e106ac43",
+ "blockNumber": "0x4f9c4c8",
+ "gasUsed": "0x32448",
+ "effectiveGasPrice": "0x5f5e100",
+ "from": "0x74cbcd3857aab24977b6ab6212f34eb381fcd976",
+ "to": "0x4e59b44847b379578588920ca78fbf26c0b4956c",
+ "contractAddress": null,
+ "gasUsedForL1": "0x82fc",
+ "l1BlockNumber": "0x66f304"
+ }
+ ],
+ "libraries": [],
+ "pending": [],
+ "returns": {},
+ "timestamp": 1727120414,
+ "chain": 421614,
+ "commit": "e53fec2"
+}
\ No newline at end of file
diff --git a/broadcast/012_DeploySponsorPaymaster.s.sol/80002/README.md b/broadcast/012_DeploySponsorPaymaster.s.sol/80002/README.md
new file mode 100644
index 0000000..5f49a7b
--- /dev/null
+++ b/broadcast/012_DeploySponsorPaymaster.s.sol/80002/README.md
@@ -0,0 +1,3 @@
+- This chain used cast send to deploy so there's no corresponding run json
+- Ran command in `script/cmd/DeploySponsorPaymaster` and `script/cmd/DeploySponsorPaymasterProxy`
+- tx hash: 0x4a6b2a5517a8c765e3edc51a4eea363eef99b8c320bcd01042cd176118a8026b, 0xbe739f09f80df75fd48805d15bfb604da724234d0c8d35008ab014643235ccc9
\ No newline at end of file
diff --git a/script/012_DeploySponsorPaymaster.s.sol b/script/012_DeploySponsorPaymaster.s.sol
new file mode 100644
index 0000000..8b888f3
--- /dev/null
+++ b/script/012_DeploySponsorPaymaster.s.sol
@@ -0,0 +1,60 @@
+/*
+ * Copyright 2024 Circle Internet Group, Inc. All rights reserved.
+
+ * SPDX-License-Identifier: GPL-3.0-or-later
+
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+pragma solidity 0.8.24;
+
+import {SponsorPaymaster} from "../src/paymaster/v1/permissioned/SponsorPaymaster.sol";
+
+import {IEntryPoint} from "@account-abstraction/contracts/interfaces/IEntryPoint.sol";
+import {ERC1967Proxy} from "@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol";
+import {Script} from "forge-std/src/Script.sol";
+import {console} from "forge-std/src/console.sol";
+
+contract DeploySponsorPaymaster is Script {
+ address payable constant EXPECTED_PAYMASTER_ADDRESS = payable(address(0x36058Cc257967db1912FC276F9CBEC072CD572cb));
+ address payable constant EXPECTED_PAYMASTER_PROXY_ADDRESS =
+ payable(address(0x03dF76C8c30A88f424CF3CBBC36A1Ca02763103b));
+
+ function run() public {
+ address entryPoint = vm.envAddress("ENTRY_POINT");
+
+ vm.startBroadcast(vm.envUint("DEPLOYER_PRIVATE_KEY"));
+
+ SponsorPaymaster paymaster;
+ if (EXPECTED_PAYMASTER_ADDRESS.code.length == 0) {
+ paymaster = new SponsorPaymaster{salt: 0}(IEntryPoint(entryPoint));
+ } else {
+ paymaster = SponsorPaymaster(EXPECTED_PAYMASTER_ADDRESS);
+ }
+ console.log("Paymaster address: %s", address(paymaster));
+
+ ERC1967Proxy proxy;
+ if (EXPECTED_PAYMASTER_PROXY_ADDRESS.code.length == 0) {
+ address[] memory verifySigners = new address[](0);
+ address paymasterOwner = vm.envAddress("PAYMASTER_OWNER");
+ bytes memory data = abi.encodeCall(paymaster.initialize, (paymasterOwner, verifySigners));
+
+ proxy = new ERC1967Proxy{salt: 0}(address(paymaster), data);
+ } else {
+ proxy = ERC1967Proxy(EXPECTED_PAYMASTER_PROXY_ADDRESS);
+ }
+ console.log("Proxy address: %s", address(proxy));
+
+ vm.stopBroadcast();
+ }
+}
diff --git a/script/cmd/DeploySponsorPaymaster b/script/cmd/DeploySponsorPaymaster
new file mode 100644
index 0000000..a038988
--- /dev/null
+++ b/script/cmd/DeploySponsorPaymaster
@@ -0,0 +1 @@
+cast send --rpc-url $RPC_URL --private-key $PRIVATE_KEY 0x4e59b44847b379578588920cA78FbF26c0B4956C 0x000000000000000000000000000000000000000000000000000000000000000060c034620000d057601f62001d8538819003918201601f19168301916001600160401b03831184841017620000d557808492602094604052833981010312620000d057516001600160a01b0381168103620000d0573060805260a05262000065620000eb565b6200006f620000eb565b604051611bfa90816200018b82396080518181816105a50152610826015260a0518181816101f7015281816102bc01528181610a5b01528181610dc501528181610e1901528181610ea901528181610f2e015281816113ea01526115960152f35b600080fd5b634e487b7160e01b600052604160045260246000fd5b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a00805460ff8160401c1662000178576001600160401b036002600160401b0319828216016200013957505050565b6001600160401b031990911681179091556040519081527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d290602090a1565b60405163f92ee8a960e01b8152600490fdfe60806040526004361015610023575b361561001957600080fd5b6100216113d6565b005b60003560e01c80630396cb60146101b3578063205c2878146101ae5780633f4ba83a146101a957806343e3b518146101a45780634f1ef2861461019f57806350a4b3f61461019a57806352b7512c1461019557806352d1902d146101905780635c975abb1461018b578063715018a6146101865780637c627b21146101815780638456cb591461017c5780638969e0f9146101775780638da5cb5b14610172578063946d92041461016d57806394d4ad6014610168578063ad3cb1cc14610163578063b0d691fe1461015e578063bb9fe6bf14610159578063c23a5cea14610154578063c399ec881461014f578063d0e30db01461014a578063d42f2f3514610145578063d88c13e0146101405763f2fde38b0361000e57611112565b611082565b610fc4565b610fa8565b610f01565b610e70565b610df4565b610daf565b610d57565b610c9e565b610b54565b610b1e565b610a02565b610993565b610946565b6108ae565b61087e565b610813565b6107aa565b6106ea565b610552565b6103ea565b610320565b610283565b6101cb565b63ffffffff8116036101c657565b600080fd5b6000602036600319011261026f576004356101e5816101b8565b6101ed6114c3565b6101f56114fc565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316908290823b1561026b57602463ffffffff916040519485938492621cb65b60e51b845216600483015234905af180156102665761025a575080f35b61026390610490565b80f35b61113f565b5080fd5b80fd5b6001600160a01b038116036101c657565b346101c6576000604036600319011261026f576004356102a281610272565b6102aa6114c3565b6102b26114fc565b6001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000811691839190833b1561031c5760449083604051958694859363040b850f60e31b855216600484015260243560248401525af180156102665761025a575080f35b8280fd5b346101c65760003660031901126101c6576103396114c3565b610341611527565b610349611527565b600080516020611b8583398151915260ff1981541690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa6020604051338152a1005b9181601f840112156101c6578235916001600160401b0383116101c6576020808501948460051b0101116101c657565b60206003198201126101c657600435906001600160401b0382116101c6576103e69160040161038c565b9091565b346101c6576103f8366103bc565b906104016114c3565b6104096114fc565b60005b82811061041557005b610420818484611161565b3561042a81610272565b6001600160a01b039061043e908216611748565b1561044c575060010161040c565b6104596024928585611161565b359061046482610272565b604051630a07962b60e11b815291166004820152fd5b634e487b7160e01b600052604160045260246000fd5b6001600160401b0381116104a357604052565b61047a565b60a081019081106001600160401b038211176104a357604052565b61010081019081106001600160401b038211176104a357604052565b90601f801991011681019081106001600160401b038211176104a357604052565b6001600160401b0381116104a357601f01601f191660200190565b92919261052782610500565b9161053560405193846104df565b8294818452818301116101c6578281602093846000960137010152565b60403660031901126101c657600480359061056c82610272565b6024356001600160401b0381116101c657366023820112156101c65761059b903690602481850135910161051b565b6001600160a01b037f000000000000000000000000000000000000000000000000000000000000000081163081149081156106af575b5061069e5790602083926105e36114c3565b6040516352d1902d60e01b8152938491829088165afa6000928161066d575b50610630575050604051634c9c8ce360e01b81526001600160a01b0390921690820190815281906020010390fd5b8383600080516020611b6583398151915284036106515761002183836117bf565b604051632a87526960e21b815290810184815281906020010390fd5b61069091935060203d602011610697575b61068881836104df565b810190611553565b9138610602565b503d61067e565b60405163703e46dd60e11b81528390fd5b905081600080516020611b6583398151915254161415386105d1565b90816101209103126101c65790565b65ffffffffffff8116036101c657565b346101c65760a03660031901126101c6576004356001600160401b0381116101c65761071a9036906004016106cb565b602435906001600160801b039081831683036101c65760443591821682036101c6576020926107629260643591610750836106da565b6084359361075d856106da565b6111d2565b604051908152f35b919082519283825260005b848110610796575050826000602080949584010152601f8019910116010190565b602081830181015184830182015201610775565b346101c65760603660031901126101c6576004356001600160401b0381116101c6576107f56107e06108099236906004016106cb565b6107e86114fc565b6107f0611594565b611603565b60405192839260408452604084019061076a565b9060208301520390f35b346101c65760003660031901126101c6577f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316300361086c576020604051600080516020611b658339815191528152f35b60405163703e46dd60e11b8152600490fd5b346101c65760003660031901126101c657602060ff600080516020611b8583398151915254166040519015158152f35b346101c65760008060031936011261026f576108c86114c3565b600080516020611b4583398151915280546001600160a01b0319811690915581906001600160a01b03167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08280a380f35b9181601f840112156101c6578235916001600160401b0383116101c657602083818601950101116101c657565b346101c65760803660031901126101c657600360043510156101c6576024356001600160401b0381116101c657610981903690600401610919565b505061098b6114fc565b610021611594565b346101c65760003660031901126101c6576109ac6114c3565b6109b46114fc565b6109bc6114fc565b600080516020611b85833981519152600160ff198254161790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586020604051338152a1005b346101c65760008060031936011261026f57806080604051610a23816104a8565b8281526020810183905260408082018490526060820184905291019190915251632943e70960e11b815230600482015260a0816024817f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03165afa90811561026657610aeb9291610aef575b5060405191829182919091608065ffffffffffff8160a0840195805185526020810151151560208601526001600160701b03604082015116604086015263ffffffff6060820151166060860152015116910152565b0390f35b610b11915060a03d60a011610b17575b610b0981836104df565b81019061127e565b38610a96565b503d610aff565b346101c65760003660031901126101c657600080516020611b45833981519152546040516001600160a01b039091168152602090f35b346101c65760403660031901126101c657600435610b7181610272565b6001600160401b03906024358281116101c657610b9290369060040161038c565b90600080516020611ba5833981519152549360ff8560401c1615941680159081610c96575b6001149081610c8c575b159081610c83575b50610c7157600080516020611ba5833981519152805467ffffffffffffffff19166001179055610bfd9284610c4c576112f1565b610c0357005b600080516020611ba5833981519152805460ff60401b19169055604051600181527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d290602090a1005b600080516020611ba5833981519152805460ff60401b1916600160401b1790556112f1565b60405163f92ee8a960e01b8152600490fd5b90501538610bc9565b303b159150610bc1565b859150610bb7565b346101c65760203660031901126101c6576004356001600160401b0381116101c657610cd9610cd360c0923690600401610919565b90611382565b9283926040979697519788966001600160801b03809216885216602087015265ffffffffffff809216604087015216606085015260a060808501528160a0850152848401376000828201840152601f01601f19168101030190f35b60405190602082018281106001600160401b038211176104a35760405260008252565b346101c65760003660031901126101c65760405160408101908082106001600160401b038311176104a357610aeb9160405260058152640352e302e360dc1b602082015260405191829160208352602083019061076a565b346101c65760003660031901126101c6576040517f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168152602090f35b346101c65760008060031936011261026f57610e0e6114c3565b610e166114fc565b807f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316803b15610e6d57819060046040518094819363bb9fe6bf60e01b83525af180156102665761025a575080f35b50fd5b346101c6576000602036600319011261026f57600435610e8f81610272565b610e976114c3565b610e9f6114fc565b6001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000811691839190833b1561031c5760249083604051958694859363611d2e7560e11b85521660048401525af180156102665761025a575080f35b346101c65760008060031936011261026f576040516370a0823160e01b81523060048201526020816024817f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03165afa908115610266578291610f71575b604051828152602090f35b90506020813d602011610fa0575b81610f8c602093836104df565b8101031261026b57610aeb91505138610f66565b3d9150610f7f565b60003660031901126101c657610fbc6114fc565b6100216113e8565b346101c65760008060031936011261026f5760405180916032549081835260208093018092603283527f11df491316f14931039edfd4f8964c9a443b862f02d4c7611d18c2bc4e6ff69790835b81811061106e57505050846110279103856104df565b60405193838594850191818652518092526040850193925b82811061104e57505050500390f35b83516001600160a01b03168552869550938101939281019260010161103f565b825484529286019260019283019201611011565b346101c657611090366103bc565b906110996114c3565b6110a16114fc565b60005b8281106110ad57005b6110b8818484611161565b356110c281610272565b6001600160a01b03906110d6908216611952565b156110e457506001016110a4565b6110f16024928585611161565b35906110fc82610272565b60405163281c4e0360e11b815291166004820152fd5b346101c65760203660031901126101c65761002160043561113281610272565b61113a6114c3565b61144f565b6040513d6000823e3d90fd5b634e487b7160e01b600052603260045260246000fd5b91908110156111715760051b0190565b61114b565b9593909161119360c096939998949960e0895260e089019061076a565b6001600160801b0391821660208901529816604087015260608601526001600160a01b0316608085015265ffffffffffff91821660a085015216910152565b9092611278929461126a91604060c06111ed82870187611562565b9081845191823720956112036060820182611562565b908185519182372083519760018060a01b0383351660208a01526020830135858a015260608901526080880152608081013560a088015260a081013582880152013560e086015260e08552611257856104c3565b519586946020860198309246928b611176565b03601f1981018352826104df565b51902090565b908160a09103126101c65760405190611296826104a8565b80518252602081015180151581036101c65760208301526040810151906001600160701b03821682036101c657608091604084015260608101516112d9816101b8565b606084015201516112e9816106da565b608082015290565b611315906112fd6118a2565b6113056118a2565b61130d6118a2565b61113a6118a2565b61131d6118a2565b6113256118a2565b600080516020611b85833981519152805460ff1916905560005b82811061134b57505050565b611356818484611161565b3561136081610272565b6001600160a01b0390611374908216611748565b1561044c575060010161133f565b816024116101c657601481013560801c92826034116101c657602482013560801c92806074116101c6576034830135916113bb836106da565b607460548501356113cb816106da565b939401916073190190565b6113de6114fc565b6113e66113e8565b565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316803b156101c65760006024916040519283809263b760faf960e01b825230600483015234905af18015610266576114465750565b6113e690610490565b6001600160a01b039081169081156114aa57600080516020611b4583398151915280546001600160a01b031981168417909155167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0600080a3565b604051631e4fbdf760e01b815260006004820152602490fd5b600080516020611b45833981519152546001600160a01b031633036114e457565b60405163118cdaa760e01b8152336004820152602490fd5b60ff600080516020611b85833981519152541661151557565b60405163d93c066560e01b8152600490fd5b60ff600080516020611b8583398151915254161561154157565b604051638dfc202b60e01b8152600490fd5b908160209103126101c6575190565b903590601e19813603018212156101c657018035906001600160401b0382116101c6576020019181360383136101c657565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031633036115c657565b60405162461bcd60e51b815260206004820152601560248201527414d95b99195c881b9bdd08115b9d1c9e541bda5b9d605a1b6044820152606490fd5b61163461162e9161166761161d610cd360e0840184611562565b9882989591849a959395369161051b565b966111d2565b916000927f19457468657265756d205369676e6564204d6573736167653a0a3332000000008452601c52603c8320611866565b5060048193929310156116fd5715918215926116de575b50506116b45760a09190911b65ffffffffffff60a01b1660d09190911b6001600160d01b031916175b906116b0610d34565b9190565b60a09190911b65ffffffffffff60a01b1660d09190911b6001600160d01b031916176001176116a7565b6001600160a01b0316815260336020526040902054159050388061167e565b634e487b7160e01b82526021600452602482fd5b6032548110156111715760326000527f11df491316f14931039edfd4f8964c9a443b862f02d4c7611d18c2bc4e6ff6970190600090565b806000526033602052604060002054156000146117b957603254600160401b8110156104a35760018101806032558110156111715781907f11df491316f14931039edfd4f8964c9a443b862f02d4c7611d18c2bc4e6ff6970155603254906000526033602052604060002055600190565b50600090565b90813b1561184557600080516020611b6583398151915280546001600160a01b0319166001600160a01b0384169081179091557fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b600080a280511561182a5761182791611a14565b50565b50503461183357565b60405163b398979f60e01b8152600490fd5b604051634c9c8ce360e01b81526001600160a01b0383166004820152602490fd5b81519190604183036118975761189092506020820151906060604084015193015160001a90611a5d565b9192909190565b505060009160029190565b60ff600080516020611ba58339815191525460401c16156118bf57565b604051631afcd79f60e31b8152600490fd5b6000198101919082116118e057565b634e487b7160e01b600052601160045260246000fd5b603254801561193c5760001981019080821015611171577f11df491316f14931039edfd4f8964c9a443b862f02d4c7611d18c2bc4e6ff696600091603283520155603255565b634e487b7160e01b600052603160045260246000fd5b6000818152603360205260408120549091908015611a0f5760001981018181116119fb57906119ab92916119876032546118d1565b908181036119b1575b50505061199b6118f6565b6000526033602052604060002090565b55600190565b61199b6119d9916119d16119c76119f295611711565b90549060031b1c90565b928391611711565b90919082549060031b91821b91600019901b1916179055565b55388080611990565b634e487b7160e01b84526011600452602484fd5b505090565b600080611a5293602081519101845af43d15611a55573d91611a3583610500565b92611a4360405194856104df565b83523d6000602085013e611ae1565b90565b606091611ae1565b91907f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a08411611ad557926020929160ff608095604051948552168484015260408301526060820152600092839182805260015afa156102665780516001600160a01b03811615611acc57918190565b50809160019190565b50505060009160039190565b90611b085750805115611af657805190602001fd5b604051630a12f52160e11b8152600490fd5b81511580611b3b575b611b19575090565b604051639996b31560e01b81526001600160a01b039091166004820152602490fd5b50803b15611b1156fe9016d09d72d40fdae2fd8ceac6b6234c7706214fd39c1cd1e609a0528c199300360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbccd5ed15c6e187e77e9aee88184c21f4f2182ab5827cb3b7e07fbedcd63f03300f0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a00a2646970667358221220f33a68b38cd2ce9bbc7c2aa9a21093d5557781e432c6b0d905096bc36d3bccac64736f6c634300081800330000000000000000000000000000000071727de22e5e9d8baf0edac6f37da032
\ No newline at end of file
diff --git a/script/cmd/DeploySponsorPaymasterProxy b/script/cmd/DeploySponsorPaymasterProxy
new file mode 100644
index 0000000..0d4d205
--- /dev/null
+++ b/script/cmd/DeploySponsorPaymasterProxy
@@ -0,0 +1 @@
+cast send --rpc-url $RPC_URL --private-key $PRIVATE_KEY 0x4e59b44847b379578588920cA78FbF26c0B4956C 0x000000000000000000000000000000000000000000000000000000000000000060806040526102d38038038061001481610194565b92833981019060408183031261018f5780516001600160a01b03811680820361018f5760208381015190936001600160401b03821161018f570184601f8201121561018f5780519061006d610068836101cf565b610194565b9582875285838301011161018f57849060005b83811061017b57505060009186010152813b15610163577f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc80546001600160a01b03191682179055604051907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b600080a28351156101455750600080848461012c96519101845af4903d1561013c573d61011c610068826101cf565b908152600081943d92013e6101ea565b505b6040516085908161024e8239f35b606092506101ea565b9250505034610154575061012e565b63b398979f60e01b8152600490fd5b60249060405190634c9c8ce360e01b82526004820152fd5b818101830151888201840152869201610080565b600080fd5b6040519190601f01601f191682016001600160401b038111838210176101b957604052565b634e487b7160e01b600052604160045260246000fd5b6001600160401b0381116101b957601f01601f191660200190565b9061021157508051156101ff57805190602001fd5b604051630a12f52160e11b8152600490fd5b81511580610244575b610222575090565b604051639996b31560e01b81526001600160a01b039091166004820152602490fd5b50803b1561021a56fe60806040527f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc54600090819081906001600160a01b0316368280378136915af43d82803e15604b573d90f35b3d90fdfea26469706673582212202b867e05fada64e8389ea34fca4e9048d8dde9af33f4fdd783dd16f9ba5fcf9c64736f6c6343000818003300000000000000000000000036058cc257967db1912fc276f9cbec072cd572cb00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000064946d92040000000000000000000000007e99c7725463a858c34d0fd69a09b11fd75087cc0000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
\ No newline at end of file
diff --git a/script/verify/SponsorPaymaster.json b/script/verify/SponsorPaymaster.json
new file mode 100644
index 0000000..25cf7f5
--- /dev/null
+++ b/script/verify/SponsorPaymaster.json
@@ -0,0 +1 @@
+{"language":"Solidity","sources":{"src/paymaster/v1/permissioned/SponsorPaymaster.sol":{"content":"/*\n * Copyright 2024 Circle Internet Group, Inc. All rights reserved.\n\n * SPDX-License-Identifier: GPL-3.0-or-later\n\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see .\n */\npragma solidity 0.8.24;\n\n/* solhint-disable reason-string */\n\nimport \"../../../utils/PaymasterUtils.sol\";\n\nimport \"../../BasePaymaster.sol\";\nimport {_packValidationData} from \"@account-abstraction/contracts/core/Helpers.sol\";\nimport \"@account-abstraction/contracts/interfaces/IEntryPoint.sol\";\nimport \"@account-abstraction/contracts/interfaces/IPaymaster.sol\";\nimport \"@openzeppelin/contracts/utils/cryptography/ECDSA.sol\";\nimport {MessageHashUtils} from \"@openzeppelin/contracts/utils/cryptography/MessageHashUtils.sol\";\nimport {EnumerableSet} from \"@openzeppelin/contracts/utils/structs/EnumerableSet.sol\";\n\n/**\n * For sponsor mode, a signature is required from Circle. The purpose of signature is mostly used to allow Circle\n * to offer the gasless experience (free for end user) or other services.\n * In this mode, the paymaster uses external service to decide whether to pay for the UserOp.\n * The calling user must pass the UserOp to that external signer first, which performs whatever\n * off-chain verification before signing the UserOp.\n * The off-chain service could enable the user to pay for the gas cost with a credit card, subscription, or free, etc.\n * The paymaster verifies the external signer has signed the request in method _validatePaymasterUserOp().\n * getHash() returns a hash we're going to sign off-chain and validate on-chain.\n * Note that this signature is NOT a replacement for the account-specific signature:\n * - the paymaster checks a signature to agree to pay for gas.\n * - the account checks a signature prove identity and account ownership.\n * Since this contract is upgrable, we do not allow use either selfdestruct or delegatecall to prevent a malicious actor\n * from\n * attacking the logic contract.\n */\ncontract SponsorPaymaster is BasePaymaster {\n using EnumerableSet for EnumerableSet.AddressSet;\n using UserOperationLib for PackedUserOperation;\n using PaymasterUtils for PackedUserOperation;\n using MessageHashUtils for bytes32;\n\n error VerifyingSignerAlreadyExists(address verifyingSigner);\n error VerifyingSignerDoesNotExist(address verifyingSigner);\n\n // trusted offline signers\n EnumerableSet.AddressSet private verifyingSigners;\n\n // constants still work for upgradable contracts because the compiler does not reserve storage slot\n // and every occurrence is replaced by the respective constant expression\n uint256 private constant PAYMASTER_VALIDATION_GAS_OFFSET = 20;\n uint256 private constant PAYMASTER_POSTOP_GAS_OFFSET = 36;\n uint256 private constant TIMESTAMP_START = 52;\n uint256 private constant SIGNATURE_START = 116;\n\n /// @custom:oz-upgrades-unsafe-allow constructor\n // for immutable values in implementations\n constructor(IEntryPoint _newEntryPoint) BasePaymaster(_newEntryPoint) {\n // lock the implementation contract so it can only be called from proxies\n _disableInitializers();\n }\n\n function initialize(address _newOwner, address[] calldata _verifyingSigners) public initializer {\n __BasePaymaster_init(_newOwner);\n\n uint256 length = _verifyingSigners.length;\n for (uint256 i = 0; i < length; i++) {\n if (!verifyingSigners.add(_verifyingSigners[i])) {\n revert VerifyingSignerAlreadyExists(_verifyingSigners[i]);\n }\n }\n }\n\n /**\n * Verify our external signer has signed this request.\n * The \"paymasterAndData\" is expected to be the paymaster and a signature over the entire request params.\n * paymasterAndData[:20] : address(this)\n * paymasterAndData[20:36] : paymasterVerificationGasLimit\n * paymasterAndData[36:52] : paymasterPostOpGasLimit\n * paymasterAndData[52:116] : abi.encode(validUntil, validAfter)\n * paymasterAndData[116:] : signature\n */\n function _validatePaymasterUserOp(PackedUserOperation calldata userOp, bytes32 userOpHash, uint256 maxCost)\n internal\n view\n override\n returns (bytes memory context, uint256 validationData)\n {\n // unused\n (userOpHash, maxCost);\n\n (\n uint128 paymasterVerificationGasLimit,\n uint128 paymasterPostOpGasLimit,\n uint48 validUntil,\n uint48 validAfter,\n bytes memory signature\n ) = parsePaymasterAndData(userOp.paymasterAndData);\n\n // calculate hash and check sig if applicable\n bytes32 hash = getHash(userOp, paymasterVerificationGasLimit, paymasterPostOpGasLimit, validUntil, validAfter)\n .toEthSignedMessageHash();\n\n // try recover the signer and verify if signer is a valid verifying signer\n // don't revert on signature failure: return SIG_VALIDATION_FAILED\n (address recovered, ECDSA.RecoverError error,) = ECDSA.tryRecover(hash, signature);\n if (error != ECDSA.RecoverError.NoError || !verifyingSigners.contains(recovered)) {\n return (\"\", _packValidationData(true, validUntil, validAfter));\n }\n\n // no need for other on-chain validation: entire UserOp should have been checked\n // by the external service prior to signing it.\n // no context returned because of no postOp activity\n return (\"\", _packValidationData(false, validUntil, validAfter));\n }\n\n /**\n * paymasterAndData[:20] : address(this)\n * paymasterAndData[20:36] : paymasterVerificationGasLimit\n * paymasterAndData[36:52] : paymasterPostOpGasLimit\n * paymasterAndData[52:116] : abi.encode(validUntil, validAfter)\n * paymasterAndData[116:] : signature\n */\n function parsePaymasterAndData(bytes calldata paymasterAndData)\n public\n pure\n returns (\n uint128 paymasterVerificationGasLimit,\n uint128 paymasterPostOpGasLimit,\n uint48 validUntil,\n uint48 validAfter,\n bytes calldata signature\n )\n {\n // slice the packed bytes\n paymasterVerificationGasLimit =\n uint128(bytes16(paymasterAndData[PAYMASTER_VALIDATION_GAS_OFFSET:PAYMASTER_POSTOP_GAS_OFFSET]));\n paymasterPostOpGasLimit = uint128(bytes16(paymasterAndData[PAYMASTER_POSTOP_GAS_OFFSET:TIMESTAMP_START]));\n (validUntil, validAfter) = abi.decode(paymasterAndData[TIMESTAMP_START:SIGNATURE_START], (uint48, uint48));\n signature = paymasterAndData[SIGNATURE_START:];\n }\n\n /**\n * return the hash we're going to sign off-chain (and validate on-chain)\n * this method is called by the off-chain service, to sign the request.\n * it is called on-chain from the validatePaymasterUserOp, to validate the signature.\n * note that this signature covers all fields of the UserOperation and paymaster gas fields, except the\n * \"paymasterAndData\",\n * which will carry the signature itself.\n * struct PackedUserOperation {\n * address sender;\n * uint256 nonce;\n * bytes initCode;\n * bytes callData;\n * bytes32 accountGasLimits;\n * uint256 preVerificationGas;\n * bytes32 gasFees;\n * bytes paymasterAndData;\n * bytes signature;\n * }\n */\n function getHash(\n PackedUserOperation calldata userOp,\n uint128 paymasterVerificationGasLimit,\n uint128 paymasterPostOpGasLimit,\n uint48 validUntil,\n uint48 validAfter\n ) public view returns (bytes32) {\n // can't use userOp.hash(), since it contains also the paymasterAndData itself.\n // EP manages nonce via NonceManager so senderNonce is redundant\n return keccak256(\n abi.encode(\n userOp.packUpToPaymasterAndData(),\n paymasterVerificationGasLimit,\n paymasterPostOpGasLimit,\n block.chainid,\n address(this),\n validUntil,\n validAfter\n )\n );\n }\n\n // add new verifying signers\n function addVerifyingSigners(address[] calldata _newVerifyingSigners) external onlyOwner whenNotPaused {\n uint256 length = _newVerifyingSigners.length;\n for (uint256 i = 0; i < length; i++) {\n if (!verifyingSigners.add(_newVerifyingSigners[i])) {\n revert VerifyingSignerAlreadyExists(_newVerifyingSigners[i]);\n }\n }\n }\n\n // remove existing verifying signers\n function removeVerifyingSigners(address[] calldata _verifyingSigners) external onlyOwner whenNotPaused {\n uint256 length = _verifyingSigners.length;\n for (uint256 i = 0; i < length; i++) {\n if (!verifyingSigners.remove(_verifyingSigners[i])) {\n revert VerifyingSignerDoesNotExist(_verifyingSigners[i]);\n }\n }\n }\n\n // get all verifying signers\n function getAllSigners() external view returns (address[] memory) {\n return verifyingSigners.values();\n }\n}\n"},"src/utils/PaymasterUtils.sol":{"content":"/*\n * Copyright 2024 Circle Internet Group, Inc. All rights reserved.\n\n * SPDX-License-Identifier: GPL-3.0-or-later\n\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see .\n */\npragma solidity 0.8.24;\n\n/* solhint-disable reason-string */\n/* solhint-disable no-inline-assembly */\n\nimport {UserOperationLib} from \"@account-abstraction/contracts/core/UserOperationLib.sol\";\nimport {PackedUserOperation} from \"@account-abstraction/contracts/interfaces/PackedUserOperation.sol\";\n\nenum ChargeMode {\n GAS_ONLY, // paymaster will charge a network fee\n FREE, // paymaster will sponsor the transaction\n FEE_ONLY, // paymaster will charge a flat fee for its service\n FEE_AND_GAS // paymaster will charge both flat fee and network fee\n\n}\n\n/**\n * @dev In chainlink feed aggregator, ETH (Ξ) pairs (quote is Ξ) have 18 decimal of precisions, e.g. USDC/ETH;\n * Non-ETH (quote is not Ξ) pairs have 8 decimals of precisions, e.g. ETH/USDC.\n * For ETH/USDC,\n * 1. let ethToUSDCFxRate = latestRoundData.answer / 10**feedDecimals;\n * 2. let usdcCost = maxETHToBuy * ethToUSDCFxRate;\n * 3. let usdcCostInSubunits = usdcCost * 10**usdcDecimals\n * Now let's use the above formula to calculate the USDC token cost.\n * Let's assume ETH/USDC's latestRoundData.answer\n * (https://etherscan.io/address/0x5f4eC3Df9cbd43714FE2740f5E3616155c5b8419#readContract) is 211331000000 (note the link\n * is actually for ETH/USD),\n * let's also get maxETHToBuy (requiredPrefund) from https://aascan.org/, or you can calculate from totalGasLimit *\n * maxFeePerGas,\n * let's assume maxETHToBuy(requiredPrefund) is Ξ0.015 (15000000000000000), then apply step 1 ~ 3,\n * 1. ethToUSDCFxRate = 211331000000 / 10**8 = 2113.31;\n * 2. usdcCost = 0.015 * 2113.31 = 31.69965\n * 3. usdcCostInSubunits = 31.69965 * (10**6) = 31699650\n *\n * fxRate will be provided from an offchain price oracle that's aggregated from different exchanges.\n * For more details, please refer to https://docs.chain.link/data-feeds/price-feeds/addresses/?network=ethereum\n */\nlibrary PaymasterUtils {\n using UserOperationLib for PackedUserOperation;\n\n /**\n * struct PackedUserOperation {\n * address sender;\n * uint256 nonce;\n * bytes initCode;\n * bytes callData;\n * bytes32 accountGasLimits;\n * uint256 preVerificationGas;\n * bytes32 gasFees;\n * bytes paymasterAndData;\n * bytes signature;\n * }\n */\n function packUpToPaymasterAndData(PackedUserOperation calldata userOp) internal pure returns (bytes memory ret) {\n address sender = userOp.getSender();\n uint256 nonce = userOp.nonce;\n bytes32 hashInitCode = calldataKeccak(userOp.initCode);\n bytes32 hashCallData = calldataKeccak(userOp.callData);\n bytes32 accountGasLimits = userOp.accountGasLimits;\n uint256 preVerificationGas = userOp.preVerificationGas;\n bytes32 gasFees = userOp.gasFees;\n return abi.encode(sender, nonce, hashInitCode, hashCallData, accountGasLimits, preVerificationGas, gasFees);\n }\n\n /**\n * Keccak function over calldata.\n * @dev copy calldata into memory, do keccak and drop allocated memory. This is more efficient than letting solidity\n * do it.\n */\n function calldataKeccak(bytes calldata data) internal pure returns (bytes32 ret) {\n assembly {\n let mem := mload(0x40)\n let len := data.length\n calldatacopy(mem, data.offset, len)\n ret := keccak256(mem, len)\n }\n }\n}\n"},"src/paymaster/BasePaymaster.sol":{"content":"/*\n * Copyright 2024 Circle Internet Group, Inc. All rights reserved.\n\n * SPDX-License-Identifier: GPL-3.0-or-later\n\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see .\n */\npragma solidity 0.8.24;\n\nimport {IEntryPoint} from \"@account-abstraction/contracts/interfaces/IEntryPoint.sol\";\nimport {IPaymaster} from \"@account-abstraction/contracts/interfaces/IPaymaster.sol\";\n\nimport {IStakeManager} from \"@account-abstraction/contracts/interfaces/IStakeManager.sol\";\nimport {PackedUserOperation} from \"@account-abstraction/contracts/interfaces/PackedUserOperation.sol\";\nimport {OwnableUpgradeable} from \"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\";\nimport {Initializable} from \"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\";\nimport {UUPSUpgradeable} from \"@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol\";\nimport {PausableUpgradeable} from \"@openzeppelin/contracts-upgradeable/utils/PausableUpgradeable.sol\";\n\n/**\n * The paymaster must also have a deposit, which the entry point will charge UserOperation costs from.\n * The deposit (for paying gas fees) is separate from the stake (which is locked).\n * Note that this signature is NOT a replacement for the account-specific signature:\n * - the paymaster checks a signature to agree to pay for gas.\n * - the account checks a signature prove identity and account ownership.\n * Since this contract is upgradable, we do not allow use either selfdestruct or delegatecall to prevent a malicious\n * actor from\n * destroying the logic contract.\n */\nabstract contract BasePaymaster is\n IPaymaster,\n Initializable,\n UUPSUpgradeable,\n OwnableUpgradeable,\n PausableUpgradeable\n{\n // global entry point\n IEntryPoint public immutable entryPoint;\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[50] private __gap;\n\n /// @inheritdoc UUPSUpgradeable\n // The {_authorizeUpgrade} function must be overridden to include access restriction to the upgrade mechanism.\n // Authorize the owner to upgrade the contract.\n function _authorizeUpgrade(address newImplementation) internal override onlyOwner {}\n\n /// @custom:oz-upgrades-unsafe-allow constructor\n // for immutable values in implementations\n constructor(IEntryPoint _newEntryPoint) {\n entryPoint = _newEntryPoint;\n // lock the implementation contract so it can only be called from proxies\n _disableInitializers();\n }\n\n function __BasePaymaster_init(address _newOwner) internal onlyInitializing {\n __UUPSUpgradeable_init();\n __Ownable_init(_newOwner);\n __Pausable_init();\n }\n\n /// @inheritdoc IPaymaster\n function validatePaymasterUserOp(PackedUserOperation calldata userOp, bytes32 userOpHash, uint256 maxCost)\n external\n override\n whenNotPaused\n returns (bytes memory context, uint256 validationData)\n {\n _requireFromEntryPoint();\n return _validatePaymasterUserOp(userOp, userOpHash, maxCost);\n }\n\n function _validatePaymasterUserOp(PackedUserOperation calldata userOp, bytes32 userOpHash, uint256 maxCost)\n internal\n virtual\n returns (bytes memory context, uint256 validationData);\n\n /// @inheritdoc IPaymaster\n function postOp(PostOpMode mode, bytes calldata context, uint256 actualGasCost, uint256 actualUserOpFeePerGas)\n external\n override\n whenNotPaused\n {\n _requireFromEntryPoint();\n _postOp(mode, context, actualGasCost, actualUserOpFeePerGas);\n }\n\n function _postOp(PostOpMode mode, bytes calldata context, uint256 actualGasCost, uint256 actualUserOpFeePerGas)\n internal\n virtual\n {}\n\n /**\n * add a deposit for this paymaster, used for paying for transaction fees\n */\n function deposit() public payable whenNotPaused {\n entryPoint.depositTo{value: msg.value}(address(this));\n }\n\n /**\n * return current paymaster's deposit on the entryPoint.\n */\n function getDeposit() public view returns (uint256) {\n return entryPoint.balanceOf(address(this));\n }\n\n /**\n * return current paymaster's full deposit&stake information on the entryPoint.\n */\n function getDepositInfo() public view returns (IStakeManager.DepositInfo memory info) {\n return entryPoint.getDepositInfo(address(this));\n }\n\n /**\n * add stake for this paymaster.\n * This method can also carry eth value to add to the current stake.\n * @param unstakeDelaySec - the unstake delay for this paymaster. Can only be increased.\n */\n function addStake(uint32 unstakeDelaySec) public payable onlyOwner whenNotPaused {\n entryPoint.addStake{value: msg.value}(unstakeDelaySec);\n }\n\n /**\n * unlock the stake, in order to withdraw it.\n * The paymaster can't serve requests once unlocked, until it calls addStake again\n */\n function unlockStake() public onlyOwner whenNotPaused {\n entryPoint.unlockStake();\n }\n\n /**\n * withdraw the entire paymaster's stake.\n * stake must be unlocked first (and then wait for the unstakeDelay to be over)\n * @param withdrawAddress the address to send withdrawn value.\n */\n function withdrawStake(address payable withdrawAddress) public onlyOwner whenNotPaused {\n entryPoint.withdrawStake(withdrawAddress);\n }\n\n /// validate the call is made from a valid entrypoint\n function _requireFromEntryPoint() internal view {\n require(msg.sender == address(entryPoint), \"Sender not EntryPoint\");\n }\n\n function pause() public onlyOwner whenNotPaused {\n _pause();\n }\n\n function unpause() public onlyOwner whenPaused {\n _unpause();\n }\n\n function withdrawTo(address payable withdrawAddress, uint256 amount) public onlyOwner whenNotPaused {\n entryPoint.withdrawTo(withdrawAddress, amount);\n }\n\n /**\n * automatically deposit received native token to entrypoint\n */\n receive() external payable whenNotPaused {\n entryPoint.depositTo{value: msg.value}(address(this));\n }\n}\n"},"lib/account-abstraction/contracts/core/Helpers.sol":{"content":"// SPDX-License-Identifier: GPL-3.0\npragma solidity ^0.8.23;\n\n/* solhint-disable no-inline-assembly */\n\n\n /*\n * For simulation purposes, validateUserOp (and validatePaymasterUserOp)\n * must return this value in case of signature failure, instead of revert.\n */\nuint256 constant SIG_VALIDATION_FAILED = 1;\n\n\n/*\n * For simulation purposes, validateUserOp (and validatePaymasterUserOp)\n * return this value on success.\n */\nuint256 constant SIG_VALIDATION_SUCCESS = 0;\n\n\n/**\n * Returned data from validateUserOp.\n * validateUserOp returns a uint256, which is created by `_packedValidationData` and\n * parsed by `_parseValidationData`.\n * @param aggregator - address(0) - The account validated the signature by itself.\n * address(1) - The account failed to validate the signature.\n * otherwise - This is an address of a signature aggregator that must\n * be used to validate the signature.\n * @param validAfter - This UserOp is valid only after this timestamp.\n * @param validaUntil - This UserOp is valid only up to this timestamp.\n */\nstruct ValidationData {\n address aggregator;\n uint48 validAfter;\n uint48 validUntil;\n}\n\n/**\n * Extract sigFailed, validAfter, validUntil.\n * Also convert zero validUntil to type(uint48).max.\n * @param validationData - The packed validation data.\n */\nfunction _parseValidationData(\n uint256 validationData\n) pure returns (ValidationData memory data) {\n address aggregator = address(uint160(validationData));\n uint48 validUntil = uint48(validationData >> 160);\n if (validUntil == 0) {\n validUntil = type(uint48).max;\n }\n uint48 validAfter = uint48(validationData >> (48 + 160));\n return ValidationData(aggregator, validAfter, validUntil);\n}\n\n/**\n * Helper to pack the return value for validateUserOp.\n * @param data - The ValidationData to pack.\n */\nfunction _packValidationData(\n ValidationData memory data\n) pure returns (uint256) {\n return\n uint160(data.aggregator) |\n (uint256(data.validUntil) << 160) |\n (uint256(data.validAfter) << (160 + 48));\n}\n\n/**\n * Helper to pack the return value for validateUserOp, when not using an aggregator.\n * @param sigFailed - True for signature failure, false for success.\n * @param validUntil - Last timestamp this UserOperation is valid (or zero for infinite).\n * @param validAfter - First timestamp this UserOperation is valid.\n */\nfunction _packValidationData(\n bool sigFailed,\n uint48 validUntil,\n uint48 validAfter\n) pure returns (uint256) {\n return\n (sigFailed ? 1 : 0) |\n (uint256(validUntil) << 160) |\n (uint256(validAfter) << (160 + 48));\n}\n\n/**\n * keccak function over calldata.\n * @dev copy calldata into memory, do keccak and drop allocated memory. Strangely, this is more efficient than letting solidity do it.\n */\n function calldataKeccak(bytes calldata data) pure returns (bytes32 ret) {\n assembly (\"memory-safe\") {\n let mem := mload(0x40)\n let len := data.length\n calldatacopy(mem, data.offset, len)\n ret := keccak256(mem, len)\n }\n }\n\n\n/**\n * The minimum of two numbers.\n * @param a - First number.\n * @param b - Second number.\n */\n function min(uint256 a, uint256 b) pure returns (uint256) {\n return a < b ? a : b;\n }\n"},"lib/account-abstraction/contracts/interfaces/IEntryPoint.sol":{"content":"/**\n ** Account-Abstraction (EIP-4337) singleton EntryPoint implementation.\n ** Only one instance required on each chain.\n **/\n// SPDX-License-Identifier: GPL-3.0\npragma solidity >=0.7.5;\n\n/* solhint-disable avoid-low-level-calls */\n/* solhint-disable no-inline-assembly */\n/* solhint-disable reason-string */\n\nimport \"./PackedUserOperation.sol\";\nimport \"./IStakeManager.sol\";\nimport \"./IAggregator.sol\";\nimport \"./INonceManager.sol\";\n\ninterface IEntryPoint is IStakeManager, INonceManager {\n /***\n * An event emitted after each successful request.\n * @param userOpHash - Unique identifier for the request (hash its entire content, except signature).\n * @param sender - The account that generates this request.\n * @param paymaster - If non-null, the paymaster that pays for this request.\n * @param nonce - The nonce value from the request.\n * @param success - True if the sender transaction succeeded, false if reverted.\n * @param actualGasCost - Actual amount paid (by account or paymaster) for this UserOperation.\n * @param actualGasUsed - Total gas used by this UserOperation (including preVerification, creation,\n * validation and execution).\n */\n event UserOperationEvent(\n bytes32 indexed userOpHash,\n address indexed sender,\n address indexed paymaster,\n uint256 nonce,\n bool success,\n uint256 actualGasCost,\n uint256 actualGasUsed\n );\n\n /**\n * Account \"sender\" was deployed.\n * @param userOpHash - The userOp that deployed this account. UserOperationEvent will follow.\n * @param sender - The account that is deployed\n * @param factory - The factory used to deploy this account (in the initCode)\n * @param paymaster - The paymaster used by this UserOp\n */\n event AccountDeployed(\n bytes32 indexed userOpHash,\n address indexed sender,\n address factory,\n address paymaster\n );\n\n /**\n * An event emitted if the UserOperation \"callData\" reverted with non-zero length.\n * @param userOpHash - The request unique identifier.\n * @param sender - The sender of this request.\n * @param nonce - The nonce used in the request.\n * @param revertReason - The return bytes from the (reverted) call to \"callData\".\n */\n event UserOperationRevertReason(\n bytes32 indexed userOpHash,\n address indexed sender,\n uint256 nonce,\n bytes revertReason\n );\n\n /**\n * An event emitted if the UserOperation Paymaster's \"postOp\" call reverted with non-zero length.\n * @param userOpHash - The request unique identifier.\n * @param sender - The sender of this request.\n * @param nonce - The nonce used in the request.\n * @param revertReason - The return bytes from the (reverted) call to \"callData\".\n */\n event PostOpRevertReason(\n bytes32 indexed userOpHash,\n address indexed sender,\n uint256 nonce,\n bytes revertReason\n );\n\n /**\n * UserOp consumed more than prefund. The UserOperation is reverted, and no refund is made.\n * @param userOpHash - The request unique identifier.\n * @param sender - The sender of this request.\n * @param nonce - The nonce used in the request.\n */\n event UserOperationPrefundTooLow(\n bytes32 indexed userOpHash,\n address indexed sender,\n uint256 nonce\n );\n\n /**\n * An event emitted by handleOps(), before starting the execution loop.\n * Any event emitted before this event, is part of the validation.\n */\n event BeforeExecution();\n\n /**\n * Signature aggregator used by the following UserOperationEvents within this bundle.\n * @param aggregator - The aggregator used for the following UserOperationEvents.\n */\n event SignatureAggregatorChanged(address indexed aggregator);\n\n /**\n * A custom revert error of handleOps, to identify the offending op.\n * Should be caught in off-chain handleOps simulation and not happen on-chain.\n * Useful for mitigating DoS attempts against batchers or for troubleshooting of factory/account/paymaster reverts.\n * NOTE: If simulateValidation passes successfully, there should be no reason for handleOps to fail on it.\n * @param opIndex - Index into the array of ops to the failed one (in simulateValidation, this is always zero).\n * @param reason - Revert reason. The string starts with a unique code \"AAmn\",\n * where \"m\" is \"1\" for factory, \"2\" for account and \"3\" for paymaster issues,\n * so a failure can be attributed to the correct entity.\n */\n error FailedOp(uint256 opIndex, string reason);\n\n /**\n * A custom revert error of handleOps, to report a revert by account or paymaster.\n * @param opIndex - Index into the array of ops to the failed one (in simulateValidation, this is always zero).\n * @param reason - Revert reason. see FailedOp(uint256,string), above\n * @param inner - data from inner cought revert reason\n * @dev note that inner is truncated to 2048 bytes\n */\n error FailedOpWithRevert(uint256 opIndex, string reason, bytes inner);\n\n error PostOpReverted(bytes returnData);\n\n /**\n * Error case when a signature aggregator fails to verify the aggregated signature it had created.\n * @param aggregator The aggregator that failed to verify the signature\n */\n error SignatureValidationFailed(address aggregator);\n\n // Return value of getSenderAddress.\n error SenderAddressResult(address sender);\n\n // UserOps handled, per aggregator.\n struct UserOpsPerAggregator {\n PackedUserOperation[] userOps;\n // Aggregator address\n IAggregator aggregator;\n // Aggregated signature\n bytes signature;\n }\n\n /**\n * Execute a batch of UserOperations.\n * No signature aggregator is used.\n * If any account requires an aggregator (that is, it returned an aggregator when\n * performing simulateValidation), then handleAggregatedOps() must be used instead.\n * @param ops - The operations to execute.\n * @param beneficiary - The address to receive the fees.\n */\n function handleOps(\n PackedUserOperation[] calldata ops,\n address payable beneficiary\n ) external;\n\n /**\n * Execute a batch of UserOperation with Aggregators\n * @param opsPerAggregator - The operations to execute, grouped by aggregator (or address(0) for no-aggregator accounts).\n * @param beneficiary - The address to receive the fees.\n */\n function handleAggregatedOps(\n UserOpsPerAggregator[] calldata opsPerAggregator,\n address payable beneficiary\n ) external;\n\n /**\n * Generate a request Id - unique identifier for this request.\n * The request ID is a hash over the content of the userOp (except the signature), the entrypoint and the chainid.\n * @param userOp - The user operation to generate the request ID for.\n * @return hash the hash of this UserOperation\n */\n function getUserOpHash(\n PackedUserOperation calldata userOp\n ) external view returns (bytes32);\n\n /**\n * Gas and return values during simulation.\n * @param preOpGas - The gas used for validation (including preValidationGas)\n * @param prefund - The required prefund for this operation\n * @param accountValidationData - returned validationData from account.\n * @param paymasterValidationData - return validationData from paymaster.\n * @param paymasterContext - Returned by validatePaymasterUserOp (to be passed into postOp)\n */\n struct ReturnInfo {\n uint256 preOpGas;\n uint256 prefund;\n uint256 accountValidationData;\n uint256 paymasterValidationData;\n bytes paymasterContext;\n }\n\n /**\n * Returned aggregated signature info:\n * The aggregator returned by the account, and its current stake.\n */\n struct AggregatorStakeInfo {\n address aggregator;\n StakeInfo stakeInfo;\n }\n\n /**\n * Get counterfactual sender address.\n * Calculate the sender contract address that will be generated by the initCode and salt in the UserOperation.\n * This method always revert, and returns the address in SenderAddressResult error\n * @param initCode - The constructor code to be passed into the UserOperation.\n */\n function getSenderAddress(bytes memory initCode) external;\n\n error DelegateAndRevert(bool success, bytes ret);\n\n /**\n * Helper method for dry-run testing.\n * @dev calling this method, the EntryPoint will make a delegatecall to the given data, and report (via revert) the result.\n * The method always revert, so is only useful off-chain for dry run calls, in cases where state-override to replace\n * actual EntryPoint code is less convenient.\n * @param target a target contract to make a delegatecall from entrypoint\n * @param data data to pass to target in a delegatecall\n */\n function delegateAndRevert(address target, bytes calldata data) external;\n}\n"},"lib/account-abstraction/contracts/interfaces/IPaymaster.sol":{"content":"// SPDX-License-Identifier: GPL-3.0\npragma solidity >=0.7.5;\n\nimport \"./PackedUserOperation.sol\";\n\n/**\n * The interface exposed by a paymaster contract, who agrees to pay the gas for user's operations.\n * A paymaster must hold a stake to cover the required entrypoint stake and also the gas for the transaction.\n */\ninterface IPaymaster {\n enum PostOpMode {\n // User op succeeded.\n opSucceeded,\n // User op reverted. Still has to pay for gas.\n opReverted,\n // Only used internally in the EntryPoint (cleanup after postOp reverts). Never calling paymaster with this value\n postOpReverted\n }\n\n /**\n * Payment validation: check if paymaster agrees to pay.\n * Must verify sender is the entryPoint.\n * Revert to reject this request.\n * Note that bundlers will reject this method if it changes the state, unless the paymaster is trusted (whitelisted).\n * The paymaster pre-pays using its deposit, and receive back a refund after the postOp method returns.\n * @param userOp - The user operation.\n * @param userOpHash - Hash of the user's request data.\n * @param maxCost - The maximum cost of this transaction (based on maximum gas and gas price from userOp).\n * @return context - Value to send to a postOp. Zero length to signify postOp is not required.\n * @return validationData - Signature and time-range of this operation, encoded the same as the return\n * value of validateUserOperation.\n * <20-byte> sigAuthorizer - 0 for valid signature, 1 to mark signature failure,\n * other values are invalid for paymaster.\n * <6-byte> validUntil - last timestamp this operation is valid. 0 for \"indefinite\"\n * <6-byte> validAfter - first timestamp this operation is valid\n * Note that the validation code cannot use block.timestamp (or block.number) directly.\n */\n function validatePaymasterUserOp(\n PackedUserOperation calldata userOp,\n bytes32 userOpHash,\n uint256 maxCost\n ) external returns (bytes memory context, uint256 validationData);\n\n /**\n * Post-operation handler.\n * Must verify sender is the entryPoint.\n * @param mode - Enum with the following options:\n * opSucceeded - User operation succeeded.\n * opReverted - User op reverted. The paymaster still has to pay for gas.\n * postOpReverted - never passed in a call to postOp().\n * @param context - The context value returned by validatePaymasterUserOp\n * @param actualGasCost - Actual gas used so far (without this postOp call).\n * @param actualUserOpFeePerGas - the gas price this UserOp pays. This value is based on the UserOp's maxFeePerGas\n * and maxPriorityFee (and basefee)\n * It is not the same as tx.gasprice, which is what the bundler pays.\n */\n function postOp(\n PostOpMode mode,\n bytes calldata context,\n uint256 actualGasCost,\n uint256 actualUserOpFeePerGas\n ) external;\n}\n"},"lib/openzeppelin-contracts/contracts/utils/cryptography/ECDSA.sol":{"content":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/cryptography/ECDSA.sol)\n\npragma solidity ^0.8.20;\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 }\n\n /**\n * @dev The signature derives the `address(0)`.\n */\n error ECDSAInvalidSignature();\n\n /**\n * @dev The signature has an invalid length.\n */\n error ECDSAInvalidSignatureLength(uint256 length);\n\n /**\n * @dev The signature has an S value that is in the upper half order.\n */\n error ECDSAInvalidSignatureS(bytes32 s);\n\n /**\n * @dev Returns the address that signed a hashed message (`hash`) with `signature` or an error. This will not\n * return address(0) without also returning an error description. Errors are documented using an enum (error type)\n * and a bytes32 providing additional information about the error.\n *\n * If no error is returned, then the address can be used for verification purposes.\n *\n * The `ecrecover` EVM precompile 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 {MessageHashUtils-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 function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError, bytes32) {\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, bytes32(signature.length));\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 precompile 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 {MessageHashUtils-toEthSignedMessageHash} on it.\n */\n function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {\n (address recovered, RecoverError error, bytes32 errorArg) = tryRecover(hash, signature);\n _throwError(error, errorArg);\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 function tryRecover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address, RecoverError, bytes32) {\n unchecked {\n bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff);\n // We do not check for an overflow here since the shift operation results in 0 or 1.\n uint8 v = uint8((uint256(vs) >> 255) + 27);\n return tryRecover(hash, v, r, s);\n }\n }\n\n /**\n * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately.\n */\n function recover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address) {\n (address recovered, RecoverError error, bytes32 errorArg) = tryRecover(hash, r, vs);\n _throwError(error, errorArg);\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 function tryRecover(\n bytes32 hash,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) internal pure returns (address, RecoverError, bytes32) {\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, s);\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, bytes32(0));\n }\n\n return (signer, RecoverError.NoError, bytes32(0));\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, bytes32 errorArg) = tryRecover(hash, v, r, s);\n _throwError(error, errorArg);\n return recovered;\n }\n\n /**\n * @dev Optionally reverts with the corresponding custom error according to the `error` argument provided.\n */\n function _throwError(RecoverError error, bytes32 errorArg) private pure {\n if (error == RecoverError.NoError) {\n return; // no error: do nothing\n } else if (error == RecoverError.InvalidSignature) {\n revert ECDSAInvalidSignature();\n } else if (error == RecoverError.InvalidSignatureLength) {\n revert ECDSAInvalidSignatureLength(uint256(errorArg));\n } else if (error == RecoverError.InvalidSignatureS) {\n revert ECDSAInvalidSignatureS(errorArg);\n }\n }\n}\n"},"lib/openzeppelin-contracts/contracts/utils/cryptography/MessageHashUtils.sol":{"content":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/cryptography/MessageHashUtils.sol)\n\npragma solidity ^0.8.20;\n\nimport {Strings} from \"../Strings.sol\";\n\n/**\n * @dev Signature message hash utilities for producing digests to be consumed by {ECDSA} recovery or signing.\n *\n * The library provides methods for generating a hash of a message that conforms to the\n * https://eips.ethereum.org/EIPS/eip-191[EIP 191] and https://eips.ethereum.org/EIPS/eip-712[EIP 712]\n * specifications.\n */\nlibrary MessageHashUtils {\n /**\n * @dev Returns the keccak256 digest of an EIP-191 signed data with version\n * `0x45` (`personal_sign` messages).\n *\n * The digest is calculated by prefixing a bytes32 `messageHash` with\n * `\"\\x19Ethereum Signed Message:\\n32\"` and hashing the result. It corresponds with the\n * hash signed when using the https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`] JSON-RPC method.\n *\n * NOTE: The `messageHash` parameter is intended to be the result of hashing a raw message with\n * keccak256, although any bytes32 value can be safely used because the final digest will\n * be re-hashed.\n *\n * See {ECDSA-recover}.\n */\n function toEthSignedMessageHash(bytes32 messageHash) internal pure returns (bytes32 digest) {\n /// @solidity memory-safe-assembly\n assembly {\n mstore(0x00, \"\\x19Ethereum Signed Message:\\n32\") // 32 is the bytes-length of messageHash\n mstore(0x1c, messageHash) // 0x1c (28) is the length of the prefix\n digest := keccak256(0x00, 0x3c) // 0x3c is the length of the prefix (0x1c) + messageHash (0x20)\n }\n }\n\n /**\n * @dev Returns the keccak256 digest of an EIP-191 signed data with version\n * `0x45` (`personal_sign` messages).\n *\n * The digest is calculated by prefixing an arbitrary `message` with\n * `\"\\x19Ethereum Signed Message:\\n\" + len(message)` and hashing the result. It corresponds with the\n * hash signed when using the https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`] JSON-RPC method.\n *\n * See {ECDSA-recover}.\n */\n function toEthSignedMessageHash(bytes memory message) internal pure returns (bytes32) {\n return\n keccak256(bytes.concat(\"\\x19Ethereum Signed Message:\\n\", bytes(Strings.toString(message.length)), message));\n }\n\n /**\n * @dev Returns the keccak256 digest of an EIP-191 signed data with version\n * `0x00` (data with intended validator).\n *\n * The digest is calculated by prefixing an arbitrary `data` with `\"\\x19\\x00\"` and the intended\n * `validator` address. Then hashing the result.\n *\n * See {ECDSA-recover}.\n */\n function toDataWithIntendedValidatorHash(address validator, bytes memory data) internal pure returns (bytes32) {\n return keccak256(abi.encodePacked(hex\"19_00\", validator, data));\n }\n\n /**\n * @dev Returns the keccak256 digest of an EIP-712 typed data (EIP-191 version `0x01`).\n *\n * The digest is calculated from a `domainSeparator` and a `structHash`, by prefixing them with\n * `\\x19\\x01` and hashing the result. It corresponds to the hash signed by the\n * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`] JSON-RPC method as part of EIP-712.\n *\n * See {ECDSA-recover}.\n */\n function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32 digest) {\n /// @solidity memory-safe-assembly\n assembly {\n let ptr := mload(0x40)\n mstore(ptr, hex\"19_01\")\n mstore(add(ptr, 0x02), domainSeparator)\n mstore(add(ptr, 0x22), structHash)\n digest := keccak256(ptr, 0x42)\n }\n }\n}\n"},"lib/openzeppelin-contracts/contracts/utils/structs/EnumerableSet.sol":{"content":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/structs/EnumerableSet.sol)\n// This file was procedurally generated from scripts/generate/templates/EnumerableSet.js.\n\npragma solidity ^0.8.20;\n\n/**\n * @dev Library for managing\n * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive\n * types.\n *\n * Sets have the following properties:\n *\n * - Elements are added, removed, and checked for existence in constant time\n * (O(1)).\n * - Elements are enumerated in O(n). No guarantees are made on the ordering.\n *\n * ```solidity\n * contract Example {\n * // Add the library methods\n * using EnumerableSet for EnumerableSet.AddressSet;\n *\n * // Declare a set state variable\n * EnumerableSet.AddressSet private mySet;\n * }\n * ```\n *\n * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)\n * and `uint256` (`UintSet`) are supported.\n *\n * [WARNING]\n * ====\n * Trying to delete such a structure from storage will likely result in data corruption, rendering the structure\n * unusable.\n * See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info.\n *\n * In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an\n * array of EnumerableSet.\n * ====\n */\nlibrary EnumerableSet {\n // To implement this library for multiple types with as little code\n // repetition as possible, we write it in terms of a generic Set type with\n // bytes32 values.\n // The Set implementation uses private functions, and user-facing\n // implementations (such as AddressSet) are just wrappers around the\n // underlying Set.\n // This means that we can only create new EnumerableSets for types that fit\n // in bytes32.\n\n struct Set {\n // Storage of set values\n bytes32[] _values;\n // Position is the index of the value in the `values` array plus 1.\n // Position 0 is used to mean a value is not in the set.\n mapping(bytes32 value => uint256) _positions;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function _add(Set storage set, bytes32 value) private returns (bool) {\n if (!_contains(set, value)) {\n set._values.push(value);\n // The value is stored at length-1, but we add 1 to all indexes\n // and use 0 as a sentinel value\n set._positions[value] = set._values.length;\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function _remove(Set storage set, bytes32 value) private returns (bool) {\n // We cache the value's position to prevent multiple reads from the same storage slot\n uint256 position = set._positions[value];\n\n if (position != 0) {\n // Equivalent to contains(set, value)\n // To delete an element from the _values array in O(1), we swap the element to delete with the last one in\n // the array, and then remove the last element (sometimes called as 'swap and pop').\n // This modifies the order of the array, as noted in {at}.\n\n uint256 valueIndex = position - 1;\n uint256 lastIndex = set._values.length - 1;\n\n if (valueIndex != lastIndex) {\n bytes32 lastValue = set._values[lastIndex];\n\n // Move the lastValue to the index where the value to delete is\n set._values[valueIndex] = lastValue;\n // Update the tracked position of the lastValue (that was just moved)\n set._positions[lastValue] = position;\n }\n\n // Delete the slot where the moved value was stored\n set._values.pop();\n\n // Delete the tracked position for the deleted slot\n delete set._positions[value];\n\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function _contains(Set storage set, bytes32 value) private view returns (bool) {\n return set._positions[value] != 0;\n }\n\n /**\n * @dev Returns the number of values on the set. O(1).\n */\n function _length(Set storage set) private view returns (uint256) {\n return set._values.length;\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function _at(Set storage set, uint256 index) private view returns (bytes32) {\n return set._values[index];\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function _values(Set storage set) private view returns (bytes32[] memory) {\n return set._values;\n }\n\n // Bytes32Set\n\n struct Bytes32Set {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {\n return _add(set._inner, value);\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {\n return _remove(set._inner, value);\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {\n return _contains(set._inner, value);\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(Bytes32Set storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {\n return _at(set._inner, index);\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(Bytes32Set storage set) internal view returns (bytes32[] memory) {\n bytes32[] memory store = _values(set._inner);\n bytes32[] memory result;\n\n /// @solidity memory-safe-assembly\n assembly {\n result := store\n }\n\n return result;\n }\n\n // AddressSet\n\n struct AddressSet {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(AddressSet storage set, address value) internal returns (bool) {\n return _add(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(AddressSet storage set, address value) internal returns (bool) {\n return _remove(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(AddressSet storage set, address value) internal view returns (bool) {\n return _contains(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(AddressSet storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(AddressSet storage set, uint256 index) internal view returns (address) {\n return address(uint160(uint256(_at(set._inner, index))));\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(AddressSet storage set) internal view returns (address[] memory) {\n bytes32[] memory store = _values(set._inner);\n address[] memory result;\n\n /// @solidity memory-safe-assembly\n assembly {\n result := store\n }\n\n return result;\n }\n\n // UintSet\n\n struct UintSet {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(UintSet storage set, uint256 value) internal returns (bool) {\n return _add(set._inner, bytes32(value));\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(UintSet storage set, uint256 value) internal returns (bool) {\n return _remove(set._inner, bytes32(value));\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(UintSet storage set, uint256 value) internal view returns (bool) {\n return _contains(set._inner, bytes32(value));\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(UintSet storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(UintSet storage set, uint256 index) internal view returns (uint256) {\n return uint256(_at(set._inner, index));\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(UintSet storage set) internal view returns (uint256[] memory) {\n bytes32[] memory store = _values(set._inner);\n uint256[] memory result;\n\n /// @solidity memory-safe-assembly\n assembly {\n result := store\n }\n\n return result;\n }\n}\n"},"lib/account-abstraction/contracts/core/UserOperationLib.sol":{"content":"// SPDX-License-Identifier: GPL-3.0\npragma solidity ^0.8.23;\n\n/* solhint-disable no-inline-assembly */\n\nimport \"../interfaces/PackedUserOperation.sol\";\nimport {calldataKeccak, min} from \"./Helpers.sol\";\n\n/**\n * Utility functions helpful when working with UserOperation structs.\n */\nlibrary UserOperationLib {\n\n uint256 public constant PAYMASTER_VALIDATION_GAS_OFFSET = 20;\n uint256 public constant PAYMASTER_POSTOP_GAS_OFFSET = 36;\n uint256 public constant PAYMASTER_DATA_OFFSET = 52;\n /**\n * Get sender from user operation data.\n * @param userOp - The user operation data.\n */\n function getSender(\n PackedUserOperation calldata userOp\n ) internal pure returns (address) {\n address data;\n //read sender from userOp, which is first userOp member (saves 800 gas...)\n assembly {\n data := calldataload(userOp)\n }\n return address(uint160(data));\n }\n\n /**\n * Relayer/block builder might submit the TX with higher priorityFee,\n * but the user should not pay above what he signed for.\n * @param userOp - The user operation data.\n */\n function gasPrice(\n PackedUserOperation calldata userOp\n ) internal view returns (uint256) {\n unchecked {\n (uint256 maxPriorityFeePerGas, uint256 maxFeePerGas) = unpackUints(userOp.gasFees);\n if (maxFeePerGas == maxPriorityFeePerGas) {\n //legacy mode (for networks that don't support basefee opcode)\n return maxFeePerGas;\n }\n return min(maxFeePerGas, maxPriorityFeePerGas + block.basefee);\n }\n }\n\n /**\n * Pack the user operation data into bytes for hashing.\n * @param userOp - The user operation data.\n */\n function encode(\n PackedUserOperation calldata userOp\n ) internal pure returns (bytes memory ret) {\n address sender = getSender(userOp);\n uint256 nonce = userOp.nonce;\n bytes32 hashInitCode = calldataKeccak(userOp.initCode);\n bytes32 hashCallData = calldataKeccak(userOp.callData);\n bytes32 accountGasLimits = userOp.accountGasLimits;\n uint256 preVerificationGas = userOp.preVerificationGas;\n bytes32 gasFees = userOp.gasFees;\n bytes32 hashPaymasterAndData = calldataKeccak(userOp.paymasterAndData);\n\n return abi.encode(\n sender, nonce,\n hashInitCode, hashCallData,\n accountGasLimits, preVerificationGas, gasFees,\n hashPaymasterAndData\n );\n }\n\n function unpackUints(\n bytes32 packed\n ) internal pure returns (uint256 high128, uint256 low128) {\n return (uint128(bytes16(packed)), uint128(uint256(packed)));\n }\n\n //unpack just the high 128-bits from a packed value\n function unpackHigh128(bytes32 packed) internal pure returns (uint256) {\n return uint256(packed) >> 128;\n }\n\n // unpack just the low 128-bits from a packed value\n function unpackLow128(bytes32 packed) internal pure returns (uint256) {\n return uint128(uint256(packed));\n }\n\n function unpackMaxPriorityFeePerGas(PackedUserOperation calldata userOp)\n internal pure returns (uint256) {\n return unpackHigh128(userOp.gasFees);\n }\n\n function unpackMaxFeePerGas(PackedUserOperation calldata userOp)\n internal pure returns (uint256) {\n return unpackLow128(userOp.gasFees);\n }\n\n function unpackVerificationGasLimit(PackedUserOperation calldata userOp)\n internal pure returns (uint256) {\n return unpackHigh128(userOp.accountGasLimits);\n }\n\n function unpackCallGasLimit(PackedUserOperation calldata userOp)\n internal pure returns (uint256) {\n return unpackLow128(userOp.accountGasLimits);\n }\n\n function unpackPaymasterVerificationGasLimit(PackedUserOperation calldata userOp)\n internal pure returns (uint256) {\n return uint128(bytes16(userOp.paymasterAndData[PAYMASTER_VALIDATION_GAS_OFFSET : PAYMASTER_POSTOP_GAS_OFFSET]));\n }\n\n function unpackPostOpGasLimit(PackedUserOperation calldata userOp)\n internal pure returns (uint256) {\n return uint128(bytes16(userOp.paymasterAndData[PAYMASTER_POSTOP_GAS_OFFSET : PAYMASTER_DATA_OFFSET]));\n }\n\n function unpackPaymasterStaticFields(\n bytes calldata paymasterAndData\n ) internal pure returns (address paymaster, uint256 validationGasLimit, uint256 postOpGasLimit) {\n return (\n address(bytes20(paymasterAndData[: PAYMASTER_VALIDATION_GAS_OFFSET])),\n uint128(bytes16(paymasterAndData[PAYMASTER_VALIDATION_GAS_OFFSET : PAYMASTER_POSTOP_GAS_OFFSET])),\n uint128(bytes16(paymasterAndData[PAYMASTER_POSTOP_GAS_OFFSET : PAYMASTER_DATA_OFFSET]))\n );\n }\n\n /**\n * Hash the user operation data.\n * @param userOp - The user operation data.\n */\n function hash(\n PackedUserOperation calldata userOp\n ) internal pure returns (bytes32) {\n return keccak256(encode(userOp));\n }\n}\n"},"lib/account-abstraction/contracts/interfaces/PackedUserOperation.sol":{"content":"// SPDX-License-Identifier: GPL-3.0\npragma solidity >=0.7.5;\n\n/**\n * User Operation struct\n * @param sender - The sender account of this request.\n * @param nonce - Unique value the sender uses to verify it is not a replay.\n * @param initCode - If set, the account contract will be created by this constructor/\n * @param callData - The method call to execute on this account.\n * @param accountGasLimits - Packed gas limits for validateUserOp and gas limit passed to the callData method call.\n * @param preVerificationGas - Gas not calculated by the handleOps method, but added to the gas paid.\n * Covers batch overhead.\n * @param gasFees - packed gas fields maxPriorityFeePerGas and maxFeePerGas - Same as EIP-1559 gas parameters.\n * @param paymasterAndData - If set, this field holds the paymaster address, verification gas limit, postOp gas limit and paymaster-specific extra data\n * The paymaster will pay for the transaction instead of the sender.\n * @param signature - Sender-verified signature over the entire request, the EntryPoint address and the chain ID.\n */\nstruct PackedUserOperation {\n address sender;\n uint256 nonce;\n bytes initCode;\n bytes callData;\n bytes32 accountGasLimits;\n uint256 preVerificationGas;\n bytes32 gasFees;\n bytes paymasterAndData;\n bytes signature;\n}\n"},"lib/account-abstraction/contracts/interfaces/IStakeManager.sol":{"content":"// SPDX-License-Identifier: GPL-3.0-only\npragma solidity >=0.7.5;\n\n/**\n * Manage deposits and stakes.\n * Deposit is just a balance used to pay for UserOperations (either by a paymaster or an account).\n * Stake is value locked for at least \"unstakeDelay\" by the staked entity.\n */\ninterface IStakeManager {\n event Deposited(address indexed account, uint256 totalDeposit);\n\n event Withdrawn(\n address indexed account,\n address withdrawAddress,\n uint256 amount\n );\n\n // Emitted when stake or unstake delay are modified.\n event StakeLocked(\n address indexed account,\n uint256 totalStaked,\n uint256 unstakeDelaySec\n );\n\n // Emitted once a stake is scheduled for withdrawal.\n event StakeUnlocked(address indexed account, uint256 withdrawTime);\n\n event StakeWithdrawn(\n address indexed account,\n address withdrawAddress,\n uint256 amount\n );\n\n /**\n * @param deposit - The entity's deposit.\n * @param staked - True if this entity is staked.\n * @param stake - Actual amount of ether staked for this entity.\n * @param unstakeDelaySec - Minimum delay to withdraw the stake.\n * @param withdrawTime - First block timestamp where 'withdrawStake' will be callable, or zero if already locked.\n * @dev Sizes were chosen so that deposit fits into one cell (used during handleOp)\n * and the rest fit into a 2nd cell (used during stake/unstake)\n * - 112 bit allows for 10^15 eth\n * - 48 bit for full timestamp\n * - 32 bit allows 150 years for unstake delay\n */\n struct DepositInfo {\n uint256 deposit;\n bool staked;\n uint112 stake;\n uint32 unstakeDelaySec;\n uint48 withdrawTime;\n }\n\n // API struct used by getStakeInfo and simulateValidation.\n struct StakeInfo {\n uint256 stake;\n uint256 unstakeDelaySec;\n }\n\n /**\n * Get deposit info.\n * @param account - The account to query.\n * @return info - Full deposit information of given account.\n */\n function getDepositInfo(\n address account\n ) external view returns (DepositInfo memory info);\n\n /**\n * Get account balance.\n * @param account - The account to query.\n * @return - The deposit (for gas payment) of the account.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * Add to the deposit of the given account.\n * @param account - The account to add to.\n */\n function depositTo(address account) external payable;\n\n /**\n * Add to the account's stake - amount and delay\n * any pending unstake is first cancelled.\n * @param _unstakeDelaySec - The new lock duration before the deposit can be withdrawn.\n */\n function addStake(uint32 _unstakeDelaySec) external payable;\n\n /**\n * Attempt to unlock the stake.\n * The value can be withdrawn (using withdrawStake) after the unstake delay.\n */\n function unlockStake() external;\n\n /**\n * Withdraw from the (unlocked) stake.\n * Must first call unlockStake and wait for the unstakeDelay to pass.\n * @param withdrawAddress - The address to send withdrawn value.\n */\n function withdrawStake(address payable withdrawAddress) external;\n\n /**\n * Withdraw from the deposit.\n * @param withdrawAddress - The address to send withdrawn value.\n * @param withdrawAmount - The amount to withdraw.\n */\n function withdrawTo(\n address payable withdrawAddress,\n uint256 withdrawAmount\n ) external;\n}\n"},"lib/openzeppelin-contracts-upgradeable/contracts/access/OwnableUpgradeable.sol":{"content":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (access/Ownable.sol)\n\npragma solidity ^0.8.20;\n\nimport {ContextUpgradeable} from \"../utils/ContextUpgradeable.sol\";\nimport {Initializable} from \"../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Contract module which provides a basic access control mechanism, where\n * there is an account (an owner) that can be granted exclusive access to\n * specific functions.\n *\n * The initial owner is set to the address provided by the deployer. This can\n * later be changed with {transferOwnership}.\n *\n * This module is used through inheritance. It will make available the modifier\n * `onlyOwner`, which can be applied to your functions to restrict their use to\n * the owner.\n */\nabstract contract OwnableUpgradeable is Initializable, ContextUpgradeable {\n /// @custom:storage-location erc7201:openzeppelin.storage.Ownable\n struct OwnableStorage {\n address _owner;\n }\n\n // keccak256(abi.encode(uint256(keccak256(\"openzeppelin.storage.Ownable\")) - 1)) & ~bytes32(uint256(0xff))\n bytes32 private constant OwnableStorageLocation = 0x9016d09d72d40fdae2fd8ceac6b6234c7706214fd39c1cd1e609a0528c199300;\n\n function _getOwnableStorage() private pure returns (OwnableStorage storage $) {\n assembly {\n $.slot := OwnableStorageLocation\n }\n }\n\n /**\n * @dev The caller account is not authorized to perform an operation.\n */\n error OwnableUnauthorizedAccount(address account);\n\n /**\n * @dev The owner is not a valid owner account. (eg. `address(0)`)\n */\n error OwnableInvalidOwner(address owner);\n\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n\n /**\n * @dev Initializes the contract setting the address provided by the deployer as the initial owner.\n */\n function __Ownable_init(address initialOwner) internal onlyInitializing {\n __Ownable_init_unchained(initialOwner);\n }\n\n function __Ownable_init_unchained(address initialOwner) internal onlyInitializing {\n if (initialOwner == address(0)) {\n revert OwnableInvalidOwner(address(0));\n }\n _transferOwnership(initialOwner);\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 OwnableStorage storage $ = _getOwnableStorage();\n return $._owner;\n }\n\n /**\n * @dev Throws if the sender is not the owner.\n */\n function _checkOwner() internal view virtual {\n if (owner() != _msgSender()) {\n revert OwnableUnauthorizedAccount(_msgSender());\n }\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 if (newOwner == address(0)) {\n revert OwnableInvalidOwner(address(0));\n }\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 OwnableStorage storage $ = _getOwnableStorage();\n address oldOwner = $._owner;\n $._owner = newOwner;\n emit OwnershipTransferred(oldOwner, newOwner);\n }\n}\n"},"lib/openzeppelin-contracts-upgradeable/contracts/proxy/utils/Initializable.sol":{"content":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (proxy/utils/Initializable.sol)\n\npragma solidity ^0.8.20;\n\n/**\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\n * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\n *\n * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be\n * reused. This mechanism prevents re-execution of each \"step\" but allows the creation of new initialization steps in\n * case an upgrade adds a module that needs to be initialized.\n *\n * For example:\n *\n * [.hljs-theme-light.nopadding]\n * ```solidity\n * contract MyToken is ERC20Upgradeable {\n * function initialize() initializer public {\n * __ERC20_init(\"MyToken\", \"MTK\");\n * }\n * }\n *\n * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {\n * function initializeV2() reinitializer(2) public {\n * __ERC20Permit_init(\"MyToken\");\n * }\n * }\n * ```\n *\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\n *\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\n *\n * [CAUTION]\n * ====\n * Avoid leaving a contract uninitialized.\n *\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\n * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke\n * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:\n *\n * [.hljs-theme-light.nopadding]\n * ```\n * /// @custom:oz-upgrades-unsafe-allow constructor\n * constructor() {\n * _disableInitializers();\n * }\n * ```\n * ====\n */\nabstract contract Initializable {\n /**\n * @dev Storage of the initializable contract.\n *\n * It's implemented on a custom ERC-7201 namespace to reduce the risk of storage collisions\n * when using with upgradeable contracts.\n *\n * @custom:storage-location erc7201:openzeppelin.storage.Initializable\n */\n struct InitializableStorage {\n /**\n * @dev Indicates that the contract has been initialized.\n */\n uint64 _initialized;\n /**\n * @dev Indicates that the contract is in the process of being initialized.\n */\n bool _initializing;\n }\n\n // keccak256(abi.encode(uint256(keccak256(\"openzeppelin.storage.Initializable\")) - 1)) & ~bytes32(uint256(0xff))\n bytes32 private constant INITIALIZABLE_STORAGE = 0xf0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a00;\n\n /**\n * @dev The contract is already initialized.\n */\n error InvalidInitialization();\n\n /**\n * @dev The contract is not initializing.\n */\n error NotInitializing();\n\n /**\n * @dev Triggered when the contract has been initialized or reinitialized.\n */\n event Initialized(uint64 version);\n\n /**\n * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,\n * `onlyInitializing` functions can be used to initialize parent contracts.\n *\n * Similar to `reinitializer(1)`, except that in the context of a constructor an `initializer` may be invoked any\n * number of times. This behavior in the constructor can be useful during testing and is not expected to be used in\n * production.\n *\n * Emits an {Initialized} event.\n */\n modifier initializer() {\n // solhint-disable-next-line var-name-mixedcase\n InitializableStorage storage $ = _getInitializableStorage();\n\n // Cache values to avoid duplicated sloads\n bool isTopLevelCall = !$._initializing;\n uint64 initialized = $._initialized;\n\n // Allowed calls:\n // - initialSetup: the contract is not in the initializing state and no previous version was\n // initialized\n // - construction: the contract is initialized at version 1 (no reininitialization) and the\n // current contract is just being deployed\n bool initialSetup = initialized == 0 && isTopLevelCall;\n bool construction = initialized == 1 && address(this).code.length == 0;\n\n if (!initialSetup && !construction) {\n revert InvalidInitialization();\n }\n $._initialized = 1;\n if (isTopLevelCall) {\n $._initializing = true;\n }\n _;\n if (isTopLevelCall) {\n $._initializing = false;\n emit Initialized(1);\n }\n }\n\n /**\n * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the\n * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be\n * used to initialize parent contracts.\n *\n * A reinitializer may be used after the original initialization step. This is essential to configure modules that\n * are added through upgrades and that require initialization.\n *\n * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`\n * cannot be nested. If one is invoked in the context of another, execution will revert.\n *\n * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in\n * a contract, executing them in the right order is up to the developer or operator.\n *\n * WARNING: Setting the version to 2**64 - 1 will prevent any future reinitialization.\n *\n * Emits an {Initialized} event.\n */\n modifier reinitializer(uint64 version) {\n // solhint-disable-next-line var-name-mixedcase\n InitializableStorage storage $ = _getInitializableStorage();\n\n if ($._initializing || $._initialized >= version) {\n revert InvalidInitialization();\n }\n $._initialized = version;\n $._initializing = true;\n _;\n $._initializing = false;\n emit Initialized(version);\n }\n\n /**\n * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\n * {initializer} and {reinitializer} modifiers, directly or indirectly.\n */\n modifier onlyInitializing() {\n _checkInitializing();\n _;\n }\n\n /**\n * @dev Reverts if the contract is not in an initializing state. See {onlyInitializing}.\n */\n function _checkInitializing() internal view virtual {\n if (!_isInitializing()) {\n revert NotInitializing();\n }\n }\n\n /**\n * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.\n * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized\n * to any version. It is recommended to use this to lock implementation contracts that are designed to be called\n * through proxies.\n *\n * Emits an {Initialized} event the first time it is successfully executed.\n */\n function _disableInitializers() internal virtual {\n // solhint-disable-next-line var-name-mixedcase\n InitializableStorage storage $ = _getInitializableStorage();\n\n if ($._initializing) {\n revert InvalidInitialization();\n }\n if ($._initialized != type(uint64).max) {\n $._initialized = type(uint64).max;\n emit Initialized(type(uint64).max);\n }\n }\n\n /**\n * @dev Returns the highest version that has been initialized. See {reinitializer}.\n */\n function _getInitializedVersion() internal view returns (uint64) {\n return _getInitializableStorage()._initialized;\n }\n\n /**\n * @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}.\n */\n function _isInitializing() internal view returns (bool) {\n return _getInitializableStorage()._initializing;\n }\n\n /**\n * @dev Returns a pointer to the storage namespace.\n */\n // solhint-disable-next-line var-name-mixedcase\n function _getInitializableStorage() private pure returns (InitializableStorage storage $) {\n assembly {\n $.slot := INITIALIZABLE_STORAGE\n }\n }\n}\n"},"lib/openzeppelin-contracts-upgradeable/contracts/proxy/utils/UUPSUpgradeable.sol":{"content":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (proxy/utils/UUPSUpgradeable.sol)\n\npragma solidity ^0.8.20;\n\nimport {IERC1822Proxiable} from \"@openzeppelin/contracts/interfaces/draft-IERC1822.sol\";\nimport {ERC1967Utils} from \"@openzeppelin/contracts/proxy/ERC1967/ERC1967Utils.sol\";\nimport {Initializable} from \"./Initializable.sol\";\n\n/**\n * @dev An upgradeability mechanism designed for UUPS proxies. The functions included here can perform an upgrade of an\n * {ERC1967Proxy}, when this contract is set as the implementation behind such a proxy.\n *\n * A security mechanism ensures that an upgrade does not turn off upgradeability accidentally, although this risk is\n * reinstated if the upgrade retains upgradeability but removes the security mechanism, e.g. by replacing\n * `UUPSUpgradeable` with a custom implementation of upgrades.\n *\n * The {_authorizeUpgrade} function must be overridden to include access restriction to the upgrade mechanism.\n */\nabstract contract UUPSUpgradeable is Initializable, IERC1822Proxiable {\n /// @custom:oz-upgrades-unsafe-allow state-variable-immutable\n address private immutable __self = address(this);\n\n /**\n * @dev The version of the upgrade interface of the contract. If this getter is missing, both `upgradeTo(address)`\n * and `upgradeToAndCall(address,bytes)` are present, and `upgradeTo` must be used if no function should be called,\n * while `upgradeToAndCall` will invoke the `receive` function if the second argument is the empty byte string.\n * If the getter returns `\"5.0.0\"`, only `upgradeToAndCall(address,bytes)` is present, and the second argument must\n * be the empty byte string if no function should be called, making it impossible to invoke the `receive` function\n * during an upgrade.\n */\n string public constant UPGRADE_INTERFACE_VERSION = \"5.0.0\";\n\n /**\n * @dev The call is from an unauthorized context.\n */\n error UUPSUnauthorizedCallContext();\n\n /**\n * @dev The storage `slot` is unsupported as a UUID.\n */\n error UUPSUnsupportedProxiableUUID(bytes32 slot);\n\n /**\n * @dev Check that the execution is being performed through a delegatecall call and that the execution context is\n * a proxy contract with an implementation (as defined in ERC1967) pointing to self. This should only be the case\n * for UUPS and transparent proxies that are using the current contract as their implementation. Execution of a\n * function through ERC1167 minimal proxies (clones) would not normally pass this test, but is not guaranteed to\n * fail.\n */\n modifier onlyProxy() {\n _checkProxy();\n _;\n }\n\n /**\n * @dev Check that the execution is not being performed through a delegate call. This allows a function to be\n * callable on the implementing contract but not through proxies.\n */\n modifier notDelegated() {\n _checkNotDelegated();\n _;\n }\n\n function __UUPSUpgradeable_init() internal onlyInitializing {\n }\n\n function __UUPSUpgradeable_init_unchained() internal onlyInitializing {\n }\n /**\n * @dev Implementation of the ERC1822 {proxiableUUID} function. This returns the storage slot used by the\n * implementation. It is used to validate the implementation's compatibility when performing an upgrade.\n *\n * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks\n * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this\n * function revert if invoked through a proxy. This is guaranteed by the `notDelegated` modifier.\n */\n function proxiableUUID() external view virtual notDelegated returns (bytes32) {\n return ERC1967Utils.IMPLEMENTATION_SLOT;\n }\n\n /**\n * @dev Upgrade the implementation of the proxy to `newImplementation`, and subsequently execute the function call\n * encoded in `data`.\n *\n * Calls {_authorizeUpgrade}.\n *\n * Emits an {Upgraded} event.\n *\n * @custom:oz-upgrades-unsafe-allow-reachable delegatecall\n */\n function upgradeToAndCall(address newImplementation, bytes memory data) public payable virtual onlyProxy {\n _authorizeUpgrade(newImplementation);\n _upgradeToAndCallUUPS(newImplementation, data);\n }\n\n /**\n * @dev Reverts if the execution is not performed via delegatecall or the execution\n * context is not of a proxy with an ERC1967-compliant implementation pointing to self.\n * See {_onlyProxy}.\n */\n function _checkProxy() internal view virtual {\n if (\n address(this) == __self || // Must be called through delegatecall\n ERC1967Utils.getImplementation() != __self // Must be called through an active proxy\n ) {\n revert UUPSUnauthorizedCallContext();\n }\n }\n\n /**\n * @dev Reverts if the execution is performed via delegatecall.\n * See {notDelegated}.\n */\n function _checkNotDelegated() internal view virtual {\n if (address(this) != __self) {\n // Must not be called through delegatecall\n revert UUPSUnauthorizedCallContext();\n }\n }\n\n /**\n * @dev Function that should revert when `msg.sender` is not authorized to upgrade the contract. Called by\n * {upgradeToAndCall}.\n *\n * Normally, this function will use an xref:access.adoc[access control] modifier such as {Ownable-onlyOwner}.\n *\n * ```solidity\n * function _authorizeUpgrade(address) internal onlyOwner {}\n * ```\n */\n function _authorizeUpgrade(address newImplementation) internal virtual;\n\n /**\n * @dev Performs an implementation upgrade with a security check for UUPS proxies, and additional setup call.\n *\n * As a security check, {proxiableUUID} is invoked in the new implementation, and the return value\n * is expected to be the implementation slot in ERC1967.\n *\n * Emits an {IERC1967-Upgraded} event.\n */\n function _upgradeToAndCallUUPS(address newImplementation, bytes memory data) private {\n try IERC1822Proxiable(newImplementation).proxiableUUID() returns (bytes32 slot) {\n if (slot != ERC1967Utils.IMPLEMENTATION_SLOT) {\n revert UUPSUnsupportedProxiableUUID(slot);\n }\n ERC1967Utils.upgradeToAndCall(newImplementation, data);\n } catch {\n // The implementation is not UUPS\n revert ERC1967Utils.ERC1967InvalidImplementation(newImplementation);\n }\n }\n}\n"},"lib/openzeppelin-contracts-upgradeable/contracts/utils/PausableUpgradeable.sol":{"content":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/Pausable.sol)\n\npragma solidity ^0.8.20;\n\nimport {ContextUpgradeable} from \"../utils/ContextUpgradeable.sol\";\nimport {Initializable} from \"../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Contract module which allows children to implement an emergency stop\n * mechanism that can be triggered by an authorized account.\n *\n * This module is used through inheritance. It will make available the\n * modifiers `whenNotPaused` and `whenPaused`, which can be applied to\n * the functions of your contract. Note that they will not be pausable by\n * simply including this module, only once the modifiers are put in place.\n */\nabstract contract PausableUpgradeable is Initializable, ContextUpgradeable {\n /// @custom:storage-location erc7201:openzeppelin.storage.Pausable\n struct PausableStorage {\n bool _paused;\n }\n\n // keccak256(abi.encode(uint256(keccak256(\"openzeppelin.storage.Pausable\")) - 1)) & ~bytes32(uint256(0xff))\n bytes32 private constant PausableStorageLocation = 0xcd5ed15c6e187e77e9aee88184c21f4f2182ab5827cb3b7e07fbedcd63f03300;\n\n function _getPausableStorage() private pure returns (PausableStorage storage $) {\n assembly {\n $.slot := PausableStorageLocation\n }\n }\n\n /**\n * @dev Emitted when the pause is triggered by `account`.\n */\n event Paused(address account);\n\n /**\n * @dev Emitted when the pause is lifted by `account`.\n */\n event Unpaused(address account);\n\n /**\n * @dev The operation failed because the contract is paused.\n */\n error EnforcedPause();\n\n /**\n * @dev The operation failed because the contract is not paused.\n */\n error ExpectedPause();\n\n /**\n * @dev Initializes the contract in unpaused state.\n */\n function __Pausable_init() internal onlyInitializing {\n __Pausable_init_unchained();\n }\n\n function __Pausable_init_unchained() internal onlyInitializing {\n PausableStorage storage $ = _getPausableStorage();\n $._paused = false;\n }\n\n /**\n * @dev Modifier to make a function callable only when the contract is not paused.\n *\n * Requirements:\n *\n * - The contract must not be paused.\n */\n modifier whenNotPaused() {\n _requireNotPaused();\n _;\n }\n\n /**\n * @dev Modifier to make a function callable only when the contract is paused.\n *\n * Requirements:\n *\n * - The contract must be paused.\n */\n modifier whenPaused() {\n _requirePaused();\n _;\n }\n\n /**\n * @dev Returns true if the contract is paused, and false otherwise.\n */\n function paused() public view virtual returns (bool) {\n PausableStorage storage $ = _getPausableStorage();\n return $._paused;\n }\n\n /**\n * @dev Throws if the contract is paused.\n */\n function _requireNotPaused() internal view virtual {\n if (paused()) {\n revert EnforcedPause();\n }\n }\n\n /**\n * @dev Throws if the contract is not paused.\n */\n function _requirePaused() internal view virtual {\n if (!paused()) {\n revert ExpectedPause();\n }\n }\n\n /**\n * @dev Triggers stopped state.\n *\n * Requirements:\n *\n * - The contract must not be paused.\n */\n function _pause() internal virtual whenNotPaused {\n PausableStorage storage $ = _getPausableStorage();\n $._paused = true;\n emit Paused(_msgSender());\n }\n\n /**\n * @dev Returns to normal state.\n *\n * Requirements:\n *\n * - The contract must be paused.\n */\n function _unpause() internal virtual whenPaused {\n PausableStorage storage $ = _getPausableStorage();\n $._paused = false;\n emit Unpaused(_msgSender());\n }\n}\n"},"lib/account-abstraction/contracts/interfaces/IAggregator.sol":{"content":"// SPDX-License-Identifier: GPL-3.0\npragma solidity >=0.7.5;\n\nimport \"./PackedUserOperation.sol\";\n\n/**\n * Aggregated Signatures validator.\n */\ninterface IAggregator {\n /**\n * Validate aggregated signature.\n * Revert if the aggregated signature does not match the given list of operations.\n * @param userOps - Array of UserOperations to validate the signature for.\n * @param signature - The aggregated signature.\n */\n function validateSignatures(\n PackedUserOperation[] calldata userOps,\n bytes calldata signature\n ) external view;\n\n /**\n * Validate signature of a single userOp.\n * This method should be called by bundler after EntryPointSimulation.simulateValidation() returns\n * the aggregator this account uses.\n * First it validates the signature over the userOp. Then it returns data to be used when creating the handleOps.\n * @param userOp - The userOperation received from the user.\n * @return sigForUserOp - The value to put into the signature field of the userOp when calling handleOps.\n * (usually empty, unless account and aggregator support some kind of \"multisig\".\n */\n function validateUserOpSignature(\n PackedUserOperation calldata userOp\n ) external view returns (bytes memory sigForUserOp);\n\n /**\n * Aggregate multiple signatures into a single value.\n * This method is called off-chain to calculate the signature to pass with handleOps()\n * bundler MAY use optimized custom code perform this aggregation.\n * @param userOps - Array of UserOperations to collect the signatures from.\n * @return aggregatedSignature - The aggregated signature.\n */\n function aggregateSignatures(\n PackedUserOperation[] calldata userOps\n ) external view returns (bytes memory aggregatedSignature);\n}\n"},"lib/account-abstraction/contracts/interfaces/INonceManager.sol":{"content":"// SPDX-License-Identifier: GPL-3.0\npragma solidity >=0.7.5;\n\ninterface INonceManager {\n\n /**\n * Return the next nonce for this sender.\n * Within a given key, the nonce values are sequenced (starting with zero, and incremented by one on each userop)\n * But UserOp with different keys can come with arbitrary order.\n *\n * @param sender the account address\n * @param key the high 192 bit of the nonce\n * @return nonce a full nonce to pass for next UserOp with this sender.\n */\n function getNonce(address sender, uint192 key)\n external view returns (uint256 nonce);\n\n /**\n * Manually increment the nonce of the sender.\n * This method is exposed just for completeness..\n * Account does NOT need to call it, neither during validation, nor elsewhere,\n * as the EntryPoint will update the nonce regardless.\n * Possible use-case is call it with various keys to \"initialize\" their nonces to one, so that future\n * UserOperations will not pay extra for the first transaction with a given key.\n */\n function incrementNonce(uint192 key) external;\n}\n"},"lib/openzeppelin-contracts/contracts/utils/Strings.sol":{"content":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/Strings.sol)\n\npragma solidity ^0.8.20;\n\nimport {Math} from \"./math/Math.sol\";\nimport {SignedMath} from \"./math/SignedMath.sol\";\n\n/**\n * @dev String operations.\n */\nlibrary Strings {\n bytes16 private constant HEX_DIGITS = \"0123456789abcdef\";\n uint8 private constant ADDRESS_LENGTH = 20;\n\n /**\n * @dev The `value` string doesn't fit in the specified `length`.\n */\n error StringsInsufficientHexLength(uint256 value, uint256 length);\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), HEX_DIGITS))\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 toStringSigned(int256 value) internal pure returns (string memory) {\n return string.concat(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 uint256 localValue = value;\n bytes memory buffer = new bytes(2 * length + 2);\n buffer[0] = \"0\";\n buffer[1] = \"x\";\n for (uint256 i = 2 * length + 1; i > 1; --i) {\n buffer[i] = HEX_DIGITS[localValue & 0xf];\n localValue >>= 4;\n }\n if (localValue != 0) {\n revert StringsInsufficientHexLength(value, length);\n }\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\n * 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 bytes(a).length == bytes(b).length && keccak256(bytes(a)) == keccak256(bytes(b));\n }\n}\n"},"lib/openzeppelin-contracts-upgradeable/contracts/utils/ContextUpgradeable.sol":{"content":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol)\n\npragma solidity ^0.8.20;\nimport {Initializable} from \"../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract ContextUpgradeable is Initializable {\n function __Context_init() internal onlyInitializing {\n }\n\n function __Context_init_unchained() internal onlyInitializing {\n }\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n\n function _contextSuffixLength() internal view virtual returns (uint256) {\n return 0;\n }\n}\n"},"lib/openzeppelin-contracts/contracts/interfaces/draft-IERC1822.sol":{"content":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/draft-IERC1822.sol)\n\npragma solidity ^0.8.20;\n\n/**\n * @dev ERC1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified\n * proxy whose upgrades are fully controlled by the current implementation.\n */\ninterface IERC1822Proxiable {\n /**\n * @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation\n * address.\n *\n * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks\n * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this\n * function revert if invoked through a proxy.\n */\n function proxiableUUID() external view returns (bytes32);\n}\n"},"lib/openzeppelin-contracts/contracts/proxy/ERC1967/ERC1967Utils.sol":{"content":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (proxy/ERC1967/ERC1967Utils.sol)\n\npragma solidity ^0.8.20;\n\nimport {IBeacon} from \"../beacon/IBeacon.sol\";\nimport {Address} from \"../../utils/Address.sol\";\nimport {StorageSlot} from \"../../utils/StorageSlot.sol\";\n\n/**\n * @dev This abstract contract provides getters and event emitting update functions for\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots.\n */\nlibrary ERC1967Utils {\n // We re-declare ERC-1967 events here because they can't be used directly from IERC1967.\n // This will be fixed in Solidity 0.8.21. At that point we should remove these events.\n /**\n * @dev Emitted when the implementation is upgraded.\n */\n event Upgraded(address indexed implementation);\n\n /**\n * @dev Emitted when the admin account has changed.\n */\n event AdminChanged(address previousAdmin, address newAdmin);\n\n /**\n * @dev Emitted when the beacon is changed.\n */\n event BeaconUpgraded(address indexed beacon);\n\n /**\n * @dev Storage slot with the address of the current implementation.\n * This is the keccak-256 hash of \"eip1967.proxy.implementation\" subtracted by 1.\n */\n // solhint-disable-next-line private-vars-leading-underscore\n bytes32 internal constant IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\n\n /**\n * @dev The `implementation` of the proxy is invalid.\n */\n error ERC1967InvalidImplementation(address implementation);\n\n /**\n * @dev The `admin` of the proxy is invalid.\n */\n error ERC1967InvalidAdmin(address admin);\n\n /**\n * @dev The `beacon` of the proxy is invalid.\n */\n error ERC1967InvalidBeacon(address beacon);\n\n /**\n * @dev An upgrade function sees `msg.value > 0` that may be lost.\n */\n error ERC1967NonPayable();\n\n /**\n * @dev Returns the current implementation address.\n */\n function getImplementation() internal view returns (address) {\n return StorageSlot.getAddressSlot(IMPLEMENTATION_SLOT).value;\n }\n\n /**\n * @dev Stores a new address in the EIP1967 implementation slot.\n */\n function _setImplementation(address newImplementation) private {\n if (newImplementation.code.length == 0) {\n revert ERC1967InvalidImplementation(newImplementation);\n }\n StorageSlot.getAddressSlot(IMPLEMENTATION_SLOT).value = newImplementation;\n }\n\n /**\n * @dev Performs implementation upgrade with additional setup call if data is nonempty.\n * This function is payable only if the setup call is performed, otherwise `msg.value` is rejected\n * to avoid stuck value in the contract.\n *\n * Emits an {IERC1967-Upgraded} event.\n */\n function upgradeToAndCall(address newImplementation, bytes memory data) internal {\n _setImplementation(newImplementation);\n emit Upgraded(newImplementation);\n\n if (data.length > 0) {\n Address.functionDelegateCall(newImplementation, data);\n } else {\n _checkNonPayable();\n }\n }\n\n /**\n * @dev Storage slot with the admin of the contract.\n * This is the keccak-256 hash of \"eip1967.proxy.admin\" subtracted by 1.\n */\n // solhint-disable-next-line private-vars-leading-underscore\n bytes32 internal constant ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\n\n /**\n * @dev Returns the current admin.\n *\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using\n * the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\n * `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`\n */\n function getAdmin() internal view returns (address) {\n return StorageSlot.getAddressSlot(ADMIN_SLOT).value;\n }\n\n /**\n * @dev Stores a new address in the EIP1967 admin slot.\n */\n function _setAdmin(address newAdmin) private {\n if (newAdmin == address(0)) {\n revert ERC1967InvalidAdmin(address(0));\n }\n StorageSlot.getAddressSlot(ADMIN_SLOT).value = newAdmin;\n }\n\n /**\n * @dev Changes the admin of the proxy.\n *\n * Emits an {IERC1967-AdminChanged} event.\n */\n function changeAdmin(address newAdmin) internal {\n emit AdminChanged(getAdmin(), newAdmin);\n _setAdmin(newAdmin);\n }\n\n /**\n * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy.\n * This is the keccak-256 hash of \"eip1967.proxy.beacon\" subtracted by 1.\n */\n // solhint-disable-next-line private-vars-leading-underscore\n bytes32 internal constant BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50;\n\n /**\n * @dev Returns the current beacon.\n */\n function getBeacon() internal view returns (address) {\n return StorageSlot.getAddressSlot(BEACON_SLOT).value;\n }\n\n /**\n * @dev Stores a new beacon in the EIP1967 beacon slot.\n */\n function _setBeacon(address newBeacon) private {\n if (newBeacon.code.length == 0) {\n revert ERC1967InvalidBeacon(newBeacon);\n }\n\n StorageSlot.getAddressSlot(BEACON_SLOT).value = newBeacon;\n\n address beaconImplementation = IBeacon(newBeacon).implementation();\n if (beaconImplementation.code.length == 0) {\n revert ERC1967InvalidImplementation(beaconImplementation);\n }\n }\n\n /**\n * @dev Change the beacon and trigger a setup call if data is nonempty.\n * This function is payable only if the setup call is performed, otherwise `msg.value` is rejected\n * to avoid stuck value in the contract.\n *\n * Emits an {IERC1967-BeaconUpgraded} event.\n *\n * CAUTION: Invoking this function has no effect on an instance of {BeaconProxy} since v5, since\n * it uses an immutable beacon without looking at the value of the ERC-1967 beacon slot for\n * efficiency.\n */\n function upgradeBeaconToAndCall(address newBeacon, bytes memory data) internal {\n _setBeacon(newBeacon);\n emit BeaconUpgraded(newBeacon);\n\n if (data.length > 0) {\n Address.functionDelegateCall(IBeacon(newBeacon).implementation(), data);\n } else {\n _checkNonPayable();\n }\n }\n\n /**\n * @dev Reverts if `msg.value` is not zero. It can be used to avoid `msg.value` stuck in the contract\n * if an upgrade doesn't perform an initialization call.\n */\n function _checkNonPayable() private {\n if (msg.value > 0) {\n revert ERC1967NonPayable();\n }\n }\n}\n"},"lib/openzeppelin-contracts/contracts/utils/math/Math.sol":{"content":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/math/Math.sol)\n\npragma solidity ^0.8.20;\n\n/**\n * @dev Standard math utilities missing in the Solidity language.\n */\nlibrary Math {\n /**\n * @dev Muldiv operation overflow.\n */\n error MathOverflowedMulDiv();\n\n enum Rounding {\n Floor, // Toward negative infinity\n Ceil, // Toward positive infinity\n Trunc, // Toward zero\n Expand // Away from zero\n }\n\n /**\n * @dev Returns the addition of two unsigned integers, with an overflow flag.\n */\n function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n unchecked {\n uint256 c = a + b;\n if (c < a) return (false, 0);\n return (true, c);\n }\n }\n\n /**\n * @dev Returns the subtraction of two unsigned integers, with an overflow flag.\n */\n function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n unchecked {\n if (b > a) return (false, 0);\n return (true, a - b);\n }\n }\n\n /**\n * @dev Returns the multiplication of two unsigned integers, with an overflow flag.\n */\n function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n unchecked {\n // Gas optimization: this is cheaper than requiring 'a' not being zero, but the\n // benefit is lost if 'b' is also tested.\n // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522\n if (a == 0) return (true, 0);\n uint256 c = a * b;\n if (c / a != b) return (false, 0);\n return (true, c);\n }\n }\n\n /**\n * @dev Returns the division of two unsigned integers, with a division by zero flag.\n */\n function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n unchecked {\n if (b == 0) return (false, 0);\n return (true, a / b);\n }\n }\n\n /**\n * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.\n */\n function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n unchecked {\n if (b == 0) return (false, 0);\n return (true, a % b);\n }\n }\n\n /**\n * @dev Returns the 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 towards infinity instead\n * of rounding towards zero.\n */\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\n if (b == 0) {\n // Guarantee the same behavior as in a regular Solidity division.\n return a / b;\n }\n\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\n * denominator == 0.\n * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv) with further edits by\n * 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 = x * y; // 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 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 if (denominator <= prod1) {\n revert MathOverflowedMulDiv();\n }\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.\n // Always >= 1. See https://cs.stackexchange.com/q/138556/92363.\n\n uint256 twos = denominator & (0 - denominator);\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\n // works 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 (unsignedRoundsUp(rounding) && 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\n * towards zero.\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 + (unsignedRoundsUp(rounding) && result * result < a ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 2 of a positive value rounded towards zero.\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 + (unsignedRoundsUp(rounding) && 1 << result < value ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 10 of a positive value rounded towards zero.\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 + (unsignedRoundsUp(rounding) && 10 ** result < value ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 256 of a positive value rounded towards zero.\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 + (unsignedRoundsUp(rounding) && 1 << (result << 3) < value ? 1 : 0);\n }\n }\n\n /**\n * @dev Returns whether a provided rounding mode is considered rounding up for unsigned integers.\n */\n function unsignedRoundsUp(Rounding rounding) internal pure returns (bool) {\n return uint8(rounding) % 2 == 1;\n }\n}\n"},"lib/openzeppelin-contracts/contracts/utils/math/SignedMath.sol":{"content":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/math/SignedMath.sol)\n\npragma solidity ^0.8.20;\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"},"lib/openzeppelin-contracts/contracts/proxy/beacon/IBeacon.sol":{"content":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (proxy/beacon/IBeacon.sol)\n\npragma solidity ^0.8.20;\n\n/**\n * @dev This is the interface that {BeaconProxy} expects of its beacon.\n */\ninterface IBeacon {\n /**\n * @dev Must return an address that can be used as a delegate call target.\n *\n * {UpgradeableBeacon} will check that this address is a contract.\n */\n function implementation() external view returns (address);\n}\n"},"lib/openzeppelin-contracts/contracts/utils/Address.sol":{"content":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/Address.sol)\n\npragma solidity ^0.8.20;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n /**\n * @dev The ETH balance of the account is not enough to perform the operation.\n */\n error AddressInsufficientBalance(address account);\n\n /**\n * @dev There's no code at `target` (it is not a contract).\n */\n error AddressEmptyCode(address target);\n\n /**\n * @dev A call to an address target failed. The target may have reverted.\n */\n error FailedInnerCall();\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.20/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n if (address(this).balance < amount) {\n revert AddressInsufficientBalance(address(this));\n }\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n if (!success) {\n revert FailedInnerCall();\n }\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 or custom error, it is bubbled\n * up by this function (like regular Solidity function calls). However, if\n * the call reverted with no returned reason, this function reverts with a\n * {FailedInnerCall} error.\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 function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0);\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 function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\n if (address(this).balance < value) {\n revert AddressInsufficientBalance(address(this));\n }\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResultFromTarget(target, success, returndata);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResultFromTarget(target, success, returndata);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResultFromTarget(target, success, returndata);\n }\n\n /**\n * @dev Tool to verify that a low level call to smart-contract was successful, and reverts if the target\n * was not a contract or bubbling up the revert reason (falling back to {FailedInnerCall}) in case of an\n * unsuccessful call.\n */\n function verifyCallResultFromTarget(\n address target,\n bool success,\n bytes memory returndata\n ) internal view returns (bytes memory) {\n if (!success) {\n _revert(returndata);\n } else {\n // only check if target is a contract if the call was successful and the return data is empty\n // otherwise we already know that it was a contract\n if (returndata.length == 0 && target.code.length == 0) {\n revert AddressEmptyCode(target);\n }\n return returndata;\n }\n }\n\n /**\n * @dev Tool to verify that a low level call was successful, and reverts if it wasn't, either by bubbling the\n * revert reason or with a default {FailedInnerCall} error.\n */\n function verifyCallResult(bool success, bytes memory returndata) internal pure returns (bytes memory) {\n if (!success) {\n _revert(returndata);\n } else {\n return returndata;\n }\n }\n\n /**\n * @dev Reverts with returndata if present. Otherwise reverts with {FailedInnerCall}.\n */\n function _revert(bytes memory returndata) 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 FailedInnerCall();\n }\n }\n}\n"},"lib/openzeppelin-contracts/contracts/utils/StorageSlot.sol":{"content":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/StorageSlot.sol)\n// This file was procedurally generated from scripts/generate/templates/StorageSlot.js.\n\npragma solidity ^0.8.20;\n\n/**\n * @dev Library for reading and writing primitive types to specific storage slots.\n *\n * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.\n * This library helps with reading and writing to such slots without the need for inline assembly.\n *\n * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.\n *\n * Example usage to set ERC1967 implementation slot:\n * ```solidity\n * contract ERC1967 {\n * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\n *\n * function _getImplementation() internal view returns (address) {\n * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\n * }\n *\n * function _setImplementation(address newImplementation) internal {\n * require(newImplementation.code.length > 0);\n * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\n * }\n * }\n * ```\n */\nlibrary StorageSlot {\n struct AddressSlot {\n address value;\n }\n\n struct BooleanSlot {\n bool value;\n }\n\n struct Bytes32Slot {\n bytes32 value;\n }\n\n struct Uint256Slot {\n uint256 value;\n }\n\n struct StringSlot {\n string value;\n }\n\n struct BytesSlot {\n bytes value;\n }\n\n /**\n * @dev Returns an `AddressSlot` with member `value` located at `slot`.\n */\n function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `BooleanSlot` with member `value` located at `slot`.\n */\n function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.\n */\n function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `Uint256Slot` with member `value` located at `slot`.\n */\n function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `StringSlot` with member `value` located at `slot`.\n */\n function getStringSlot(bytes32 slot) internal pure returns (StringSlot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `StringSlot` representation of the string storage pointer `store`.\n */\n function getStringSlot(string storage store) internal pure returns (StringSlot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := store.slot\n }\n }\n\n /**\n * @dev Returns an `BytesSlot` with member `value` located at `slot`.\n */\n function getBytesSlot(bytes32 slot) internal pure returns (BytesSlot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `BytesSlot` representation of the bytes storage pointer `store`.\n */\n function getBytesSlot(bytes storage store) internal pure returns (BytesSlot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := store.slot\n }\n }\n}\n"}},"settings":{"remappings":["@account-abstraction/=lib/account-abstraction/","@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/","@openzeppelin/contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/contracts/","ds-test/=lib/forge-std/lib/ds-test/src/","eth-gas-reporter/=node_modules/eth-gas-reporter/","forge-std/=lib/forge-std/","hardhat/=node_modules/hardhat/","@modular-account/=lib/modular-account/src/","@solady/=lib/solady/src/","@fcl/=lib/FreshCryptoLib/solidity/src/","@p256-verifier/=lib/p256-verifier/src/","@webauthn-sol/=lib/webauthn-sol/src/","@modular-account-libs/=lib/modular-account-libs/src/","FreshCryptoLib/=lib/FreshCryptoLib/solidity/src/","account-abstraction/=lib/account-abstraction/contracts/","erc4626-tests/=lib/openzeppelin-contracts-upgradeable/lib/erc4626-tests/","modular-account-libs/=lib/modular-account-libs/src/","openzeppelin-contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/","openzeppelin-contracts/=lib/openzeppelin-contracts/","p256-verifier/=lib/p256-verifier/","solady/=lib/solady/src/"],"optimizer":{"enabled":true,"runs":200},"metadata":{"useLiteralContent":false,"bytecodeHash":"ipfs","appendCBOR":true},"outputSelection":{"*":{"*":["abi","evm.bytecode","evm.deployedBytecode","evm.methodIdentifiers","metadata"]}},"evmVersion":"paris","viaIR":true,"libraries":{}}}
diff --git a/script/verify/SponsorPaymasterProxy.json b/script/verify/SponsorPaymasterProxy.json
new file mode 100644
index 0000000..32fb4f1
--- /dev/null
+++ b/script/verify/SponsorPaymasterProxy.json
@@ -0,0 +1 @@
+{"language":"Solidity","sources":{"lib/openzeppelin-contracts/contracts/proxy/ERC1967/ERC1967Proxy.sol":{"content":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (proxy/ERC1967/ERC1967Proxy.sol)\n\npragma solidity ^0.8.20;\n\nimport {Proxy} from \"../Proxy.sol\";\nimport {ERC1967Utils} from \"./ERC1967Utils.sol\";\n\n/**\n * @dev This contract implements an upgradeable proxy. It is upgradeable because calls are delegated to an\n * implementation address that can be changed. This address is stored in storage in the location specified by\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967], so that it doesn't conflict with the storage layout of the\n * implementation behind the proxy.\n */\ncontract ERC1967Proxy is Proxy {\n /**\n * @dev Initializes the upgradeable proxy with an initial implementation specified by `implementation`.\n *\n * If `_data` is nonempty, it's used as data in a delegate call to `implementation`. This will typically be an\n * encoded function call, and allows initializing the storage of the proxy like a Solidity constructor.\n *\n * Requirements:\n *\n * - If `data` is empty, `msg.value` must be zero.\n */\n constructor(address implementation, bytes memory _data) payable {\n ERC1967Utils.upgradeToAndCall(implementation, _data);\n }\n\n /**\n * @dev Returns the current implementation address.\n *\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using\n * the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\n * `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`\n */\n function _implementation() internal view virtual override returns (address) {\n return ERC1967Utils.getImplementation();\n }\n}\n"},"lib/openzeppelin-contracts/contracts/proxy/Proxy.sol":{"content":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (proxy/Proxy.sol)\n\npragma solidity ^0.8.20;\n\n/**\n * @dev This abstract contract provides a fallback function that delegates all calls to another contract using the EVM\n * instruction `delegatecall`. We refer to the second contract as the _implementation_ behind the proxy, and it has to\n * be specified by overriding the virtual {_implementation} function.\n *\n * Additionally, delegation to the implementation can be triggered manually through the {_fallback} function, or to a\n * different contract through the {_delegate} function.\n *\n * The success and return data of the delegated call will be returned back to the caller of the proxy.\n */\nabstract contract Proxy {\n /**\n * @dev Delegates the current call to `implementation`.\n *\n * This function does not return to its internal call site, it will return directly to the external caller.\n */\n function _delegate(address implementation) internal virtual {\n assembly {\n // Copy msg.data. We take full control of memory in this inline assembly\n // block because it will not return to Solidity code. We overwrite the\n // Solidity scratch pad at memory position 0.\n calldatacopy(0, 0, calldatasize())\n\n // Call the implementation.\n // out and outsize are 0 because we don't know the size yet.\n let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)\n\n // Copy the returned data.\n returndatacopy(0, 0, returndatasize())\n\n switch result\n // delegatecall returns 0 on error.\n case 0 {\n revert(0, returndatasize())\n }\n default {\n return(0, returndatasize())\n }\n }\n }\n\n /**\n * @dev This is a virtual function that should be overridden so it returns the address to which the fallback\n * function and {_fallback} should delegate.\n */\n function _implementation() internal view virtual returns (address);\n\n /**\n * @dev Delegates the current call to the address returned by `_implementation()`.\n *\n * This function does not return to its internal call site, it will return directly to the external caller.\n */\n function _fallback() internal virtual {\n _delegate(_implementation());\n }\n\n /**\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other\n * function in the contract matches the call data.\n */\n fallback() external payable virtual {\n _fallback();\n }\n}\n"},"lib/openzeppelin-contracts/contracts/proxy/ERC1967/ERC1967Utils.sol":{"content":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (proxy/ERC1967/ERC1967Utils.sol)\n\npragma solidity ^0.8.20;\n\nimport {IBeacon} from \"../beacon/IBeacon.sol\";\nimport {Address} from \"../../utils/Address.sol\";\nimport {StorageSlot} from \"../../utils/StorageSlot.sol\";\n\n/**\n * @dev This abstract contract provides getters and event emitting update functions for\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots.\n */\nlibrary ERC1967Utils {\n // We re-declare ERC-1967 events here because they can't be used directly from IERC1967.\n // This will be fixed in Solidity 0.8.21. At that point we should remove these events.\n /**\n * @dev Emitted when the implementation is upgraded.\n */\n event Upgraded(address indexed implementation);\n\n /**\n * @dev Emitted when the admin account has changed.\n */\n event AdminChanged(address previousAdmin, address newAdmin);\n\n /**\n * @dev Emitted when the beacon is changed.\n */\n event BeaconUpgraded(address indexed beacon);\n\n /**\n * @dev Storage slot with the address of the current implementation.\n * This is the keccak-256 hash of \"eip1967.proxy.implementation\" subtracted by 1.\n */\n // solhint-disable-next-line private-vars-leading-underscore\n bytes32 internal constant IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\n\n /**\n * @dev The `implementation` of the proxy is invalid.\n */\n error ERC1967InvalidImplementation(address implementation);\n\n /**\n * @dev The `admin` of the proxy is invalid.\n */\n error ERC1967InvalidAdmin(address admin);\n\n /**\n * @dev The `beacon` of the proxy is invalid.\n */\n error ERC1967InvalidBeacon(address beacon);\n\n /**\n * @dev An upgrade function sees `msg.value > 0` that may be lost.\n */\n error ERC1967NonPayable();\n\n /**\n * @dev Returns the current implementation address.\n */\n function getImplementation() internal view returns (address) {\n return StorageSlot.getAddressSlot(IMPLEMENTATION_SLOT).value;\n }\n\n /**\n * @dev Stores a new address in the EIP1967 implementation slot.\n */\n function _setImplementation(address newImplementation) private {\n if (newImplementation.code.length == 0) {\n revert ERC1967InvalidImplementation(newImplementation);\n }\n StorageSlot.getAddressSlot(IMPLEMENTATION_SLOT).value = newImplementation;\n }\n\n /**\n * @dev Performs implementation upgrade with additional setup call if data is nonempty.\n * This function is payable only if the setup call is performed, otherwise `msg.value` is rejected\n * to avoid stuck value in the contract.\n *\n * Emits an {IERC1967-Upgraded} event.\n */\n function upgradeToAndCall(address newImplementation, bytes memory data) internal {\n _setImplementation(newImplementation);\n emit Upgraded(newImplementation);\n\n if (data.length > 0) {\n Address.functionDelegateCall(newImplementation, data);\n } else {\n _checkNonPayable();\n }\n }\n\n /**\n * @dev Storage slot with the admin of the contract.\n * This is the keccak-256 hash of \"eip1967.proxy.admin\" subtracted by 1.\n */\n // solhint-disable-next-line private-vars-leading-underscore\n bytes32 internal constant ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\n\n /**\n * @dev Returns the current admin.\n *\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using\n * the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\n * `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`\n */\n function getAdmin() internal view returns (address) {\n return StorageSlot.getAddressSlot(ADMIN_SLOT).value;\n }\n\n /**\n * @dev Stores a new address in the EIP1967 admin slot.\n */\n function _setAdmin(address newAdmin) private {\n if (newAdmin == address(0)) {\n revert ERC1967InvalidAdmin(address(0));\n }\n StorageSlot.getAddressSlot(ADMIN_SLOT).value = newAdmin;\n }\n\n /**\n * @dev Changes the admin of the proxy.\n *\n * Emits an {IERC1967-AdminChanged} event.\n */\n function changeAdmin(address newAdmin) internal {\n emit AdminChanged(getAdmin(), newAdmin);\n _setAdmin(newAdmin);\n }\n\n /**\n * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy.\n * This is the keccak-256 hash of \"eip1967.proxy.beacon\" subtracted by 1.\n */\n // solhint-disable-next-line private-vars-leading-underscore\n bytes32 internal constant BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50;\n\n /**\n * @dev Returns the current beacon.\n */\n function getBeacon() internal view returns (address) {\n return StorageSlot.getAddressSlot(BEACON_SLOT).value;\n }\n\n /**\n * @dev Stores a new beacon in the EIP1967 beacon slot.\n */\n function _setBeacon(address newBeacon) private {\n if (newBeacon.code.length == 0) {\n revert ERC1967InvalidBeacon(newBeacon);\n }\n\n StorageSlot.getAddressSlot(BEACON_SLOT).value = newBeacon;\n\n address beaconImplementation = IBeacon(newBeacon).implementation();\n if (beaconImplementation.code.length == 0) {\n revert ERC1967InvalidImplementation(beaconImplementation);\n }\n }\n\n /**\n * @dev Change the beacon and trigger a setup call if data is nonempty.\n * This function is payable only if the setup call is performed, otherwise `msg.value` is rejected\n * to avoid stuck value in the contract.\n *\n * Emits an {IERC1967-BeaconUpgraded} event.\n *\n * CAUTION: Invoking this function has no effect on an instance of {BeaconProxy} since v5, since\n * it uses an immutable beacon without looking at the value of the ERC-1967 beacon slot for\n * efficiency.\n */\n function upgradeBeaconToAndCall(address newBeacon, bytes memory data) internal {\n _setBeacon(newBeacon);\n emit BeaconUpgraded(newBeacon);\n\n if (data.length > 0) {\n Address.functionDelegateCall(IBeacon(newBeacon).implementation(), data);\n } else {\n _checkNonPayable();\n }\n }\n\n /**\n * @dev Reverts if `msg.value` is not zero. It can be used to avoid `msg.value` stuck in the contract\n * if an upgrade doesn't perform an initialization call.\n */\n function _checkNonPayable() private {\n if (msg.value > 0) {\n revert ERC1967NonPayable();\n }\n }\n}\n"},"lib/openzeppelin-contracts/contracts/proxy/beacon/IBeacon.sol":{"content":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (proxy/beacon/IBeacon.sol)\n\npragma solidity ^0.8.20;\n\n/**\n * @dev This is the interface that {BeaconProxy} expects of its beacon.\n */\ninterface IBeacon {\n /**\n * @dev Must return an address that can be used as a delegate call target.\n *\n * {UpgradeableBeacon} will check that this address is a contract.\n */\n function implementation() external view returns (address);\n}\n"},"lib/openzeppelin-contracts/contracts/utils/Address.sol":{"content":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/Address.sol)\n\npragma solidity ^0.8.20;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n /**\n * @dev The ETH balance of the account is not enough to perform the operation.\n */\n error AddressInsufficientBalance(address account);\n\n /**\n * @dev There's no code at `target` (it is not a contract).\n */\n error AddressEmptyCode(address target);\n\n /**\n * @dev A call to an address target failed. The target may have reverted.\n */\n error FailedInnerCall();\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.20/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n if (address(this).balance < amount) {\n revert AddressInsufficientBalance(address(this));\n }\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n if (!success) {\n revert FailedInnerCall();\n }\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 or custom error, it is bubbled\n * up by this function (like regular Solidity function calls). However, if\n * the call reverted with no returned reason, this function reverts with a\n * {FailedInnerCall} error.\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 function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0);\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 function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\n if (address(this).balance < value) {\n revert AddressInsufficientBalance(address(this));\n }\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResultFromTarget(target, success, returndata);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResultFromTarget(target, success, returndata);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResultFromTarget(target, success, returndata);\n }\n\n /**\n * @dev Tool to verify that a low level call to smart-contract was successful, and reverts if the target\n * was not a contract or bubbling up the revert reason (falling back to {FailedInnerCall}) in case of an\n * unsuccessful call.\n */\n function verifyCallResultFromTarget(\n address target,\n bool success,\n bytes memory returndata\n ) internal view returns (bytes memory) {\n if (!success) {\n _revert(returndata);\n } else {\n // only check if target is a contract if the call was successful and the return data is empty\n // otherwise we already know that it was a contract\n if (returndata.length == 0 && target.code.length == 0) {\n revert AddressEmptyCode(target);\n }\n return returndata;\n }\n }\n\n /**\n * @dev Tool to verify that a low level call was successful, and reverts if it wasn't, either by bubbling the\n * revert reason or with a default {FailedInnerCall} error.\n */\n function verifyCallResult(bool success, bytes memory returndata) internal pure returns (bytes memory) {\n if (!success) {\n _revert(returndata);\n } else {\n return returndata;\n }\n }\n\n /**\n * @dev Reverts with returndata if present. Otherwise reverts with {FailedInnerCall}.\n */\n function _revert(bytes memory returndata) 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 FailedInnerCall();\n }\n }\n}\n"},"lib/openzeppelin-contracts/contracts/utils/StorageSlot.sol":{"content":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/StorageSlot.sol)\n// This file was procedurally generated from scripts/generate/templates/StorageSlot.js.\n\npragma solidity ^0.8.20;\n\n/**\n * @dev Library for reading and writing primitive types to specific storage slots.\n *\n * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.\n * This library helps with reading and writing to such slots without the need for inline assembly.\n *\n * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.\n *\n * Example usage to set ERC1967 implementation slot:\n * ```solidity\n * contract ERC1967 {\n * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\n *\n * function _getImplementation() internal view returns (address) {\n * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\n * }\n *\n * function _setImplementation(address newImplementation) internal {\n * require(newImplementation.code.length > 0);\n * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\n * }\n * }\n * ```\n */\nlibrary StorageSlot {\n struct AddressSlot {\n address value;\n }\n\n struct BooleanSlot {\n bool value;\n }\n\n struct Bytes32Slot {\n bytes32 value;\n }\n\n struct Uint256Slot {\n uint256 value;\n }\n\n struct StringSlot {\n string value;\n }\n\n struct BytesSlot {\n bytes value;\n }\n\n /**\n * @dev Returns an `AddressSlot` with member `value` located at `slot`.\n */\n function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `BooleanSlot` with member `value` located at `slot`.\n */\n function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.\n */\n function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `Uint256Slot` with member `value` located at `slot`.\n */\n function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `StringSlot` with member `value` located at `slot`.\n */\n function getStringSlot(bytes32 slot) internal pure returns (StringSlot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `StringSlot` representation of the string storage pointer `store`.\n */\n function getStringSlot(string storage store) internal pure returns (StringSlot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := store.slot\n }\n }\n\n /**\n * @dev Returns an `BytesSlot` with member `value` located at `slot`.\n */\n function getBytesSlot(bytes32 slot) internal pure returns (BytesSlot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `BytesSlot` representation of the bytes storage pointer `store`.\n */\n function getBytesSlot(bytes storage store) internal pure returns (BytesSlot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := store.slot\n }\n }\n}\n"}},"settings":{"remappings":["@account-abstraction/=lib/account-abstraction/","@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/","@openzeppelin/contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/contracts/","ds-test/=lib/forge-std/lib/ds-test/src/","eth-gas-reporter/=node_modules/eth-gas-reporter/","forge-std/=lib/forge-std/","hardhat/=node_modules/hardhat/","@modular-account/=lib/modular-account/src/","@solady/=lib/solady/src/","@fcl/=lib/FreshCryptoLib/solidity/src/","@p256-verifier/=lib/p256-verifier/src/","@webauthn-sol/=lib/webauthn-sol/src/","@modular-account-libs/=lib/modular-account-libs/src/","FreshCryptoLib/=lib/FreshCryptoLib/solidity/src/","account-abstraction/=lib/account-abstraction/contracts/","erc4626-tests/=lib/openzeppelin-contracts-upgradeable/lib/erc4626-tests/","modular-account-libs/=lib/modular-account-libs/src/","openzeppelin-contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/","openzeppelin-contracts/=lib/openzeppelin-contracts/","p256-verifier/=lib/p256-verifier/","solady/=lib/solady/src/"],"optimizer":{"enabled":true,"runs":200},"metadata":{"useLiteralContent":false,"bytecodeHash":"ipfs","appendCBOR":true},"outputSelection":{"*":{"*":["abi","evm.bytecode","evm.deployedBytecode","evm.methodIdentifiers","metadata"]}},"evmVersion":"paris","viaIR":true,"libraries":{}}}