From ffe2788c6dba464d8af437778658719082d1854f Mon Sep 17 00:00:00 2001 From: CounterFire2023 <136581895+CounterFire2023@users.noreply.github.com> Date: Thu, 22 Aug 2024 15:18:47 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9tokenclaim=E5=90=88=E7=BA=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build/contracts/TokenClaim.json | 44 +++------ contracts-dbg/Test1/TokenClaimTest.sol | 26 +++++ contracts-dbg/Test1/dbg.contract.json | 13 +++ contracts/activity/TokenClaim.sol | 42 ++++----- contracts/core/ClaimHistory.sol | 21 +++++ dbg.project.json | 13 +++ deployments/bsc_test/TokenClaim.json | 94 +++++++------------ ... => 8d4e816c22b2b125316667293671f05d.json} | 5 +- out/bsc_test_dev.json | 8 +- test/testBitTest.ts | 40 ++++++++ test/testTokenClaim.ts | 67 +++++++++---- 11 files changed, 241 insertions(+), 132 deletions(-) create mode 100644 contracts-dbg/Test1/TokenClaimTest.sol create mode 100644 contracts-dbg/Test1/dbg.contract.json create mode 100644 contracts/core/ClaimHistory.sol create mode 100644 dbg.project.json rename deployments/bsc_test/solcInputs/{ffd53ba855cb9016f19c9e71d2ab924e.json => 8d4e816c22b2b125316667293671f05d.json} (94%) create mode 100644 test/testBitTest.ts diff --git a/build/contracts/TokenClaim.json b/build/contracts/TokenClaim.json index 6fff5a7..40d7daa 100644 --- a/build/contracts/TokenClaim.json +++ b/build/contracts/TokenClaim.json @@ -79,7 +79,7 @@ { "indexed": false, "internalType": "address", - "name": "passport", + "name": "account", "type": "address" }, { @@ -91,7 +91,7 @@ { "indexed": false, "internalType": "uint256", - "name": "nonce", + "name": "bit", "type": "uint256" } ], @@ -218,19 +218,9 @@ "type": "address" }, { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "signTime", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "saltNonce", - "type": "uint256" + "internalType": "uint256[4]", + "name": "vals", + "type": "uint256[4]" }, { "internalType": "bytes", @@ -256,11 +246,11 @@ "type": "address" } ], - "name": "claimedAmount", + "name": "claimedBitMap", "outputs": [ { "internalType": "uint256", - "name": "amount", + "name": "claimedBit", "type": "uint256" } ], @@ -316,11 +306,6 @@ "name": "_token", "type": "address" }, - { - "internalType": "uint256", - "name": "_amount", - "type": "uint256" - }, { "internalType": "address", "name": "_contract", @@ -332,14 +317,9 @@ "type": "uint256" }, { - "internalType": "uint256", - "name": "_signTime", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_saltNonce", - "type": "uint256" + "internalType": "uint256[4]", + "name": "_vals", + "type": "uint256[4]" } ], "name": "getMessageHash", @@ -484,8 +464,8 @@ "type": "function" } ], - "bytecode": "0x60c03461011c57601f6113f538819003918201601f19168301916001600160401b038311848410176101215780849260809460405283398101031261011c5761004781610137565b61005360208301610137565b606061006160408501610137565b93015192600092835494604060018060a01b0319953387891617815581519760018060a01b039687948592833391167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08680a3600160025560ff1960035416600355600455610708600555466080523060a052168152600760205220911684825416179055169060065416176006556112a9908161014c82396080518181816107b80152610c8e015260a0518181816102bb01526107da0152f35b600080fd5b634e487b7160e01b600052604160045260246000fd5b51906001600160a01b038216820361011c5756fe6080604052600436101561001257600080fd5b6000803560e01c8062c4196e14610ccf5780630fb5a6b414610cb15780632b437d4814610c765780632b7ac3f314610c4d578063343685d1146106ca5780633f4ba83a1461063557806356715761146106175780635c975abb146105f45780636d04319414610594578063715018a61461053a5780637f9d3096146104ae5780638456cb59146104535780638da5cb5b1461042c57806397fc007c14610371578063c041136414610335578063c6d5813e146102ea578063da28b527146102a5578063de76cadb146101b05763f2fde38b146100ed57600080fd5b346101ad5760203660031901126101ad57610106610d37565b61010e610df3565b6001600160a01b039081169081156101595782546001600160a01b0319811683178455167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08380a380f35b60405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608490fd5b80fd5b50346101ad5760403660031901126101ad576101ca610d37565b6101d2610d52565b6101da610df3565b6001600160a01b039182168084526007602052604084205490929182169116811461025457816040917f75a33e8174368dc0792ac0a162a518ece06bebca5d2d915bf1a161b4fdc60cbf9385526007602052828520816bffffffffffffffffffffffff60a01b82541617905582519182526020820152a180f35b60405162461bcd60e51b8152602060048201526024808201527f546f6b656e436c61696d3a2045524332302077616c6c6574206e6f74206368616044820152631b99d95960e21b6064820152608490fd5b50346101ad57806003193601126101ad576040517f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168152602090f35b50346101ad5760403660031901126101ad576040602091610309610d37565b610311610d52565b6001600160a01b039182168352600885528383209116825283522054604051908152f35b50346101ad5760203660031901126101ad576020906001600160a01b03906040908261035f610d37565b16815260078452205416604051908152f35b50346101ad5760203660031901126101ad5761038b610d37565b610393610df3565b6001600160a01b031680156103db57600680546001600160a01b031916821790557f4635bfbeab18ad788a7fc2a516293118982d68d953206bd5f8c556890e72d7e58280a280f35b60405162461bcd60e51b815260206004820152602360248201527f546f6b656e436c61696d3a20616464726573732063616e206e6f74206265207a60448201526265726f60e81b6064820152608490fd5b50346101ad57806003193601126101ad57546040516001600160a01b039091168152602090f35b50346101ad57806003193601126101ad5761046c610df3565b610474610e4b565b600160ff1960035416176003557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586020604051338152a180f35b50346101ad5760203660031901126101ad576004356104cb610df3565b60055481111561050057806004557f91abcc2d6823e3a3f11d31b208dd3065d2c6a791f1c7c9fe96a42ce12897eac58280a280f35b60405162461bcd60e51b8152602060048201526012602482015271191d5c985d1a5bdb881d1bdbc81cda1bdc9d60721b6044820152606490fd5b50346101ad57806003193601126101ad57610553610df3565b80546001600160a01b03198116825581906001600160a01b03167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08280a380f35b50346101ad5760603660031901126101ad576105ae610d37565b6044359067ffffffffffffffff82116105f057366023830112156105f0576105e36105ed923690602481600401359101610dbc565b9060243590611003565b80f35b8280fd5b50346101ad57806003193601126101ad57602060ff600354166040519015158152f35b50346101ad57806003193601126101ad576020600554604051908152f35b50346101ad57806003193601126101ad5761064e610df3565b60035460ff81161561068e5760ff19166003557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa6020604051338152a180f35b60405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b6044820152606490fd5b50346101ad5760c03660031901126101ad576106e4610d37565b6106ec610d52565b9060a43567ffffffffffffffff8111610a2d5736602382011215610a2d5767ffffffffffffffff816004013511610a2d57366024826004013583010111610a2d5760ff60405182600401356024840182376020818460040135810160018152030190205416610bd757600454926107666064359485610e8f565b4211610b6c576002805414610b275760028055610781610e4b565b6001600160a01b03818116808752600760205260408720549095911615610ad75760443515610a925761082a9161080591608435917f0000000000000000000000000000000000000000000000000000000000000000907f000000000000000000000000000000000000000000000000000000000000000090604435908933610f86565b6006546001600160a01b03169061082436600486013560248701610dbc565b91611003565b60ff6040518260040135602484018237602081846004013581016001815203019020541615610a61575b5060018060a01b0316808352600860205260408320828452602052604083206108806044358254610e8f565b9055818352600760205260018060a01b036040842054166040519060208201906323b872dd60e01b8252602483015233604483015260443560648301526064825260a082019180831067ffffffffffffffff841117610a4d5760e0810183811067ffffffffffffffff821117610a3957604052602083527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c656460c08201525161095a92918691829182885af13d15610a31573d9061093c82610da0565b9161094a6040519384610d68565b82523d87602084013e5b85610eb2565b8051908115918215610a0a575b5050156109b257604051908152604435602082015260843560408201527fc5e576d85788400ff978578cc94a19ee7a30e8ee78d468f20ab2e305bef8411d60603392a3600160025580f35b60405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608490fd5b8192509060209181010312610a2d57602001518015158103610a2d573880610967565b8380fd5b606090610954565b634e487b7160e01b87526041600452602487fd5b634e487b7160e01b86526041600452602486fd5b6020604051828193600401356024820183376004013581016001815203019020600160ff1982541617905538610854565b60405162461bcd60e51b815260206004820152601a60248201527f546f6b656e436c61696d3a20616d6f756e74206973207a65726f0000000000006044820152606490fd5b60405162461bcd60e51b815260206004820152602260248201527f546f6b656e436c61696d3a20746f6b656e206973206e6f7420737570706f7274604482015261195960f21b6064820152608490fd5b60405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606490fd5b60405162461bcd60e51b815260206004820152603b60248201527f657870697265642c20706c656173652073656e6420616e6f746865722074726160448201527f6e73616374696f6e2077697468206e6577207369676e617475726500000000006064820152608490fd5b60405162461bcd60e51b815260206004820152604260248201527f7369676e617475726520757365642e20706c656173652073656e6420616e6f7460448201527f686572207472616e73616374696f6e2077697468206e6577207369676e617475606482015261726560f01b608482015260a490fd5b50346101ad57806003193601126101ad576006546040516001600160a01b039091168152602090f35b50346101ad57806003193601126101ad5760206040517f00000000000000000000000000000000000000000000000000000000000000008152f35b50346101ad57806003193601126101ad576020600454604051908152f35b50346101ad576101003660031901126101ad57610cea610d37565b90610cf3610d52565b604435916001600160a01b039081841684036101ad5760843591821682036101ad576020610d2f60e43560c43560a435866064358a8a8d610f86565b604051908152f35b600435906001600160a01b0382168203610d4d57565b600080fd5b602435906001600160a01b0382168203610d4d57565b90601f8019910116810190811067ffffffffffffffff821117610d8a57604052565b634e487b7160e01b600052604160045260246000fd5b67ffffffffffffffff8111610d8a57601f01601f191660200190565b929192610dc882610da0565b91610dd66040519384610d68565b829481845281830111610d4d578281602093846000960137010152565b6000546001600160a01b03163303610e0757565b606460405162461bcd60e51b815260206004820152602060248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152fd5b60ff60035416610e5757565b60405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b6044820152606490fd5b91908201809211610e9c57565b634e487b7160e01b600052601160045260246000fd5b91929015610f145750815115610ec6575090565b3b15610ecf5790565b60405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606490fd5b825190915015610f275750805190602001fd5b6040519062461bcd60e51b82528160208060048301528251908160248401526000935b828510610f6d575050604492506000838284010152601f80199101168101030190fd5b8481018201518686016044015293810193859350610f4a565b959390919694926040519660208801986bffffffffffffffffffffffff19809581809460601b168c5260601b1660348a015260601b166048880152605c87015260601b16607c850152609084015260b083015260d082015260d08152610100810181811067ffffffffffffffff821117610d8a5760405251902090565b906110459261103d917f19457468657265756d205369676e6564204d6573736167653a0a333200000000600052601c52603c6000206111ac565b929092611092565b6001600160a01b0390811691160361105957565b60405162461bcd60e51b8152602060048201526011602482015270696e76616c6964207369676e617475726560781b6044820152606490fd5b600581101561119657806110a35750565b600181036110f05760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e617475726500000000000000006044820152606490fd5b6002810361113d5760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e677468006044820152606490fd5b60031461114657565b60405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b6064820152608490fd5b634e487b7160e01b600052602160045260246000fd5b9060418151146000146111da576111d6916020820151906060604084015193015160001a906111e4565b9091565b5050600090600290565b9291907f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a083116112675791608094939160ff602094604051948552168484015260408301526060820152600093849182805260015afa1561125a5781516001600160a01b03811615611254579190565b50600190565b50604051903d90823e3d90fd5b5050505060009060039056fea26469706673582212203dc88b6df56100fd073b23bf6e2f3fe40401b7931cd0c5d7a149e861d3288f6064736f6c63430008130033", - "deployedBytecode": "0x6080604052600436101561001257600080fd5b6000803560e01c8062c4196e14610ccf5780630fb5a6b414610cb15780632b437d4814610c765780632b7ac3f314610c4d578063343685d1146106ca5780633f4ba83a1461063557806356715761146106175780635c975abb146105f45780636d04319414610594578063715018a61461053a5780637f9d3096146104ae5780638456cb59146104535780638da5cb5b1461042c57806397fc007c14610371578063c041136414610335578063c6d5813e146102ea578063da28b527146102a5578063de76cadb146101b05763f2fde38b146100ed57600080fd5b346101ad5760203660031901126101ad57610106610d37565b61010e610df3565b6001600160a01b039081169081156101595782546001600160a01b0319811683178455167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08380a380f35b60405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608490fd5b80fd5b50346101ad5760403660031901126101ad576101ca610d37565b6101d2610d52565b6101da610df3565b6001600160a01b039182168084526007602052604084205490929182169116811461025457816040917f75a33e8174368dc0792ac0a162a518ece06bebca5d2d915bf1a161b4fdc60cbf9385526007602052828520816bffffffffffffffffffffffff60a01b82541617905582519182526020820152a180f35b60405162461bcd60e51b8152602060048201526024808201527f546f6b656e436c61696d3a2045524332302077616c6c6574206e6f74206368616044820152631b99d95960e21b6064820152608490fd5b50346101ad57806003193601126101ad576040517f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168152602090f35b50346101ad5760403660031901126101ad576040602091610309610d37565b610311610d52565b6001600160a01b039182168352600885528383209116825283522054604051908152f35b50346101ad5760203660031901126101ad576020906001600160a01b03906040908261035f610d37565b16815260078452205416604051908152f35b50346101ad5760203660031901126101ad5761038b610d37565b610393610df3565b6001600160a01b031680156103db57600680546001600160a01b031916821790557f4635bfbeab18ad788a7fc2a516293118982d68d953206bd5f8c556890e72d7e58280a280f35b60405162461bcd60e51b815260206004820152602360248201527f546f6b656e436c61696d3a20616464726573732063616e206e6f74206265207a60448201526265726f60e81b6064820152608490fd5b50346101ad57806003193601126101ad57546040516001600160a01b039091168152602090f35b50346101ad57806003193601126101ad5761046c610df3565b610474610e4b565b600160ff1960035416176003557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586020604051338152a180f35b50346101ad5760203660031901126101ad576004356104cb610df3565b60055481111561050057806004557f91abcc2d6823e3a3f11d31b208dd3065d2c6a791f1c7c9fe96a42ce12897eac58280a280f35b60405162461bcd60e51b8152602060048201526012602482015271191d5c985d1a5bdb881d1bdbc81cda1bdc9d60721b6044820152606490fd5b50346101ad57806003193601126101ad57610553610df3565b80546001600160a01b03198116825581906001600160a01b03167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08280a380f35b50346101ad5760603660031901126101ad576105ae610d37565b6044359067ffffffffffffffff82116105f057366023830112156105f0576105e36105ed923690602481600401359101610dbc565b9060243590611003565b80f35b8280fd5b50346101ad57806003193601126101ad57602060ff600354166040519015158152f35b50346101ad57806003193601126101ad576020600554604051908152f35b50346101ad57806003193601126101ad5761064e610df3565b60035460ff81161561068e5760ff19166003557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa6020604051338152a180f35b60405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b6044820152606490fd5b50346101ad5760c03660031901126101ad576106e4610d37565b6106ec610d52565b9060a43567ffffffffffffffff8111610a2d5736602382011215610a2d5767ffffffffffffffff816004013511610a2d57366024826004013583010111610a2d5760ff60405182600401356024840182376020818460040135810160018152030190205416610bd757600454926107666064359485610e8f565b4211610b6c576002805414610b275760028055610781610e4b565b6001600160a01b03818116808752600760205260408720549095911615610ad75760443515610a925761082a9161080591608435917f0000000000000000000000000000000000000000000000000000000000000000907f000000000000000000000000000000000000000000000000000000000000000090604435908933610f86565b6006546001600160a01b03169061082436600486013560248701610dbc565b91611003565b60ff6040518260040135602484018237602081846004013581016001815203019020541615610a61575b5060018060a01b0316808352600860205260408320828452602052604083206108806044358254610e8f565b9055818352600760205260018060a01b036040842054166040519060208201906323b872dd60e01b8252602483015233604483015260443560648301526064825260a082019180831067ffffffffffffffff841117610a4d5760e0810183811067ffffffffffffffff821117610a3957604052602083527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c656460c08201525161095a92918691829182885af13d15610a31573d9061093c82610da0565b9161094a6040519384610d68565b82523d87602084013e5b85610eb2565b8051908115918215610a0a575b5050156109b257604051908152604435602082015260843560408201527fc5e576d85788400ff978578cc94a19ee7a30e8ee78d468f20ab2e305bef8411d60603392a3600160025580f35b60405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608490fd5b8192509060209181010312610a2d57602001518015158103610a2d573880610967565b8380fd5b606090610954565b634e487b7160e01b87526041600452602487fd5b634e487b7160e01b86526041600452602486fd5b6020604051828193600401356024820183376004013581016001815203019020600160ff1982541617905538610854565b60405162461bcd60e51b815260206004820152601a60248201527f546f6b656e436c61696d3a20616d6f756e74206973207a65726f0000000000006044820152606490fd5b60405162461bcd60e51b815260206004820152602260248201527f546f6b656e436c61696d3a20746f6b656e206973206e6f7420737570706f7274604482015261195960f21b6064820152608490fd5b60405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606490fd5b60405162461bcd60e51b815260206004820152603b60248201527f657870697265642c20706c656173652073656e6420616e6f746865722074726160448201527f6e73616374696f6e2077697468206e6577207369676e617475726500000000006064820152608490fd5b60405162461bcd60e51b815260206004820152604260248201527f7369676e617475726520757365642e20706c656173652073656e6420616e6f7460448201527f686572207472616e73616374696f6e2077697468206e6577207369676e617475606482015261726560f01b608482015260a490fd5b50346101ad57806003193601126101ad576006546040516001600160a01b039091168152602090f35b50346101ad57806003193601126101ad5760206040517f00000000000000000000000000000000000000000000000000000000000000008152f35b50346101ad57806003193601126101ad576020600454604051908152f35b50346101ad576101003660031901126101ad57610cea610d37565b90610cf3610d52565b604435916001600160a01b039081841684036101ad5760843591821682036101ad576020610d2f60e43560c43560a435866064358a8a8d610f86565b604051908152f35b600435906001600160a01b0382168203610d4d57565b600080fd5b602435906001600160a01b0382168203610d4d57565b90601f8019910116810190811067ffffffffffffffff821117610d8a57604052565b634e487b7160e01b600052604160045260246000fd5b67ffffffffffffffff8111610d8a57601f01601f191660200190565b929192610dc882610da0565b91610dd66040519384610d68565b829481845281830111610d4d578281602093846000960137010152565b6000546001600160a01b03163303610e0757565b606460405162461bcd60e51b815260206004820152602060248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152fd5b60ff60035416610e5757565b60405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b6044820152606490fd5b91908201809211610e9c57565b634e487b7160e01b600052601160045260246000fd5b91929015610f145750815115610ec6575090565b3b15610ecf5790565b60405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606490fd5b825190915015610f275750805190602001fd5b6040519062461bcd60e51b82528160208060048301528251908160248401526000935b828510610f6d575050604492506000838284010152601f80199101168101030190fd5b8481018201518686016044015293810193859350610f4a565b959390919694926040519660208801986bffffffffffffffffffffffff19809581809460601b168c5260601b1660348a015260601b166048880152605c87015260601b16607c850152609084015260b083015260d082015260d08152610100810181811067ffffffffffffffff821117610d8a5760405251902090565b906110459261103d917f19457468657265756d205369676e6564204d6573736167653a0a333200000000600052601c52603c6000206111ac565b929092611092565b6001600160a01b0390811691160361105957565b60405162461bcd60e51b8152602060048201526011602482015270696e76616c6964207369676e617475726560781b6044820152606490fd5b600581101561119657806110a35750565b600181036110f05760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e617475726500000000000000006044820152606490fd5b6002810361113d5760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e677468006044820152606490fd5b60031461114657565b60405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b6064820152608490fd5b634e487b7160e01b600052602160045260246000fd5b9060418151146000146111da576111d6916020820151906060604084015193015160001a906111e4565b9091565b5050600090600290565b9291907f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a083116112675791608094939160ff602094604051948552168484015260408301526060820152600093849182805260015afa1561125a5781516001600160a01b03811615611254579190565b50600190565b50604051903d90823e3d90fd5b5050505060009060039056fea26469706673582212203dc88b6df56100fd073b23bf6e2f3fe40401b7931cd0c5d7a149e861d3288f6064736f6c63430008130033", + "bytecode": "0x60c03461011c57601f61154338819003918201601f19168301916001600160401b038311848410176101215780849260809460405283398101031261011c5761004781610137565b61005360208301610137565b606061006160408501610137565b93015192600092835494604060018060a01b0319953387891617815581519760018060a01b039687948592833391167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08680a3600160025560ff1960035416600355600455610708600555466080523060a052168152600760205220911684825416179055169060065416176006556113f7908161014c823960805181818161046c0152610eb2015260a0518181816102c101526104420152f35b600080fd5b634e487b7160e01b600052604160045260246000fd5b51906001600160a01b038216820361011c5756fe608080604052600436101561001357600080fd5b60003560e01c9081630fb5a6b414610ed5575080632b437d4814610e9a5780632b7ac3f314610e715780633f4ba83a14610ddd5780634fcbaa1f14610d8c5780635671576114610d6e5780635c975abb14610d4b5780636d04319414610cf1578063715018a614610c985780637f9d309614610c0d5780638456cb5914610bb35780638da5cb5b14610b8a57806391c3d7a314610a9f57806397fc007c146109e5578063c0411364146109aa578063d718f2fe146102f0578063da28b527146102ab578063de76cadb146101b95763f2fde38b146100f057600080fd5b346101b45760203660031901126101b457610109610ef0565b610111610fdf565b6001600160a01b0390811690811561016057600054826001600160601b0360a01b821617600055167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0600080a3005b60405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608490fd5b600080fd5b346101b45760403660031901126101b4576101d2610ef0565b6101da610f06565b6101e2610fdf565b6001600160a01b0391821660008181526007602052604090205490929182169116811461025a57816040917f75a33e8174368dc0792ac0a162a518ece06bebca5d2d915bf1a161b4fdc60cbf93600052600760205282600020816001600160601b0360a01b82541617905582519182526020820152a1005b60405162461bcd60e51b8152602060048201526024808201527f546f6b656e436c61696d3a2045524332302077616c6c6574206e6f74206368616044820152631b99d95960e21b6064820152608490fd5b346101b45760003660031901126101b4576040517f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168152602090f35b346101b45760e03660031901126101b457610309610ef0565b610311610f06565b3660c4116101b45760c43567ffffffffffffffff8082116101b457366023830112156101b4578160040135116101b4573660248260040135830101116101b45760ff604051826004013560248401823760208184600401358101600181520301902054166109345760843560045481018091116107895742116108c957600280541461088457600280556103a3611037565b6001600160a01b03828116600090815260076020526040902054161561083457604435156107ef576001600160a01b0383811660009081526008602090815260408083209386168352929052205490606435821661079f576040516001600160601b03193360601b1660208201526001600160601b03198560601b1660348201526001600160601b03198460601b1660488201526001600160601b03197f000000000000000000000000000000000000000000000000000000000000000060601b16605c8201527f000000000000000000000000000000000000000000000000000000000000000060708201526070815261049d81610f1c565b6000905b6004821061071d5780516020909101206006546104db92506001600160a01b0316906104d536600486013560248701610fa8565b91611151565b60ff60405182600401356024840182376020818460040135810160018152030190205416156106ec575b5060018060a01b0383166000526008602052604060002060018060a01b03831660005260205260643517604060002055600760205261060060018060a01b03604060002054166000806040519260208401906323b872dd60e01b8252602485015233604485015260443560648501526064845261058184610f1c565b6040519361058e85610f4e565b60208086527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564908601525190826001600160a01b0388165af13d156106e4573d906105d882610f8c565b916105e66040519384610f6a565b82523d6000602084013e5b6001600160a01b03851661107b565b80519081159182156106c1575b50501561066957604080516001600160a01b03938416815260443560208201526064359181019190915291169033907fc5e576d85788400ff978578cc94a19ee7a30e8ee78d468f20ab2e305bef8411d90606090a36001600255005b60405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608490fd5b81925090602091810103126101b4576020015180151581036101b457838061060d565b6060906105f1565b6020604051828193600401356024820183376004013581016001815203019020600160ff1982541617905583610505565b610776602061076a92604051828101908660051b60440135825283815261074381610f4e565b604051958361075b889551809288808901910161112e565b8401915180938684019061112e565b01038084520182610f6a565b90600019811461078957600101906104a1565b634e487b7160e01b600052601160045260246000fd5b60405162461bcd60e51b815260206004820152602260248201527f546f6b656e436c61696d3a20636f6e646974696f6e20636865636b206661696c604482015261195960f21b6064820152608490fd5b60405162461bcd60e51b815260206004820152601a60248201527f546f6b656e436c61696d3a20616d6f756e74206973207a65726f0000000000006044820152606490fd5b60405162461bcd60e51b815260206004820152602260248201527f546f6b656e436c61696d3a20746f6b656e206973206e6f7420737570706f7274604482015261195960f21b6064820152608490fd5b60405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606490fd5b60405162461bcd60e51b815260206004820152603b60248201527f657870697265642c20706c656173652073656e6420616e6f746865722074726160448201527f6e73616374696f6e2077697468206e6577207369676e617475726500000000006064820152608490fd5b60405162461bcd60e51b815260206004820152604260248201527f7369676e617475726520757365642e20706c656173652073656e6420616e6f7460448201527f686572207472616e73616374696f6e2077697468206e6577207369676e617475606482015261726560f01b608482015260a490fd5b346101b45760203660031901126101b45760206001600160a01b03806109ce610ef0565b166000526007825260406000205416604051908152f35b346101b45760203660031901126101b4576109fe610ef0565b610a06610fdf565b6001600160a01b03168015610a4e57600680546001600160a01b031916821790557f4635bfbeab18ad788a7fc2a516293118982d68d953206bd5f8c556890e72d7e5600080a2005b60405162461bcd60e51b815260206004820152602360248201527f546f6b656e436c61696d3a20616464726573732063616e206e6f74206265207a60448201526265726f60e81b6064820152608490fd5b346101b4576101203660031901126101b457610ab9610ef0565b610ac1610f06565b6044356001600160a01b0380821682036101b45760643590811681036101b45736610124116101b457604051926001600160601b0319928380928160209860601b168888015260601b16603486015260601b16604884015260601b16605c820152608435607082015260708152610b3781610f1c565b60005b8260048210610b525790508151910120604051908152f35b610b789061076a9293604051828101908660051b60a40135825283815261074381610f4e565b90600019811461078957600101610b3a565b346101b45760003660031901126101b4576000546040516001600160a01b039091168152602090f35b346101b45760003660031901126101b457610bcc610fdf565b610bd4611037565b600160ff1960035416176003557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586020604051338152a1005b346101b45760203660031901126101b457600435610c29610fdf565b600554811115610c5e57806004557f91abcc2d6823e3a3f11d31b208dd3065d2c6a791f1c7c9fe96a42ce12897eac5600080a2005b60405162461bcd60e51b8152602060048201526012602482015271191d5c985d1a5bdb881d1bdbc81cda1bdc9d60721b6044820152606490fd5b346101b45760003660031901126101b457610cb1610fdf565b600080546001600160a01b0319811682556001600160a01b03167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08280a3005b346101b45760603660031901126101b457610d0a610ef0565b6044359067ffffffffffffffff82116101b457366023830112156101b457610d3f610d49923690602481600401359101610fa8565b9060243590611151565b005b346101b45760003660031901126101b457602060ff600354166040519015158152f35b346101b45760003660031901126101b4576020600554604051908152f35b346101b45760403660031901126101b457610da5610ef0565b610dad610f06565b9060018060a01b038091166000526008602052604060002091166000526020526020604060002054604051908152f35b346101b45760003660031901126101b457610df6610fdf565b60035460ff811615610e355760ff19166003557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa6020604051338152a1005b60405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b6044820152606490fd5b346101b45760003660031901126101b4576006546040516001600160a01b039091168152602090f35b346101b45760003660031901126101b45760206040517f00000000000000000000000000000000000000000000000000000000000000008152f35b346101b45760003660031901126101b4576020906004548152f35b600435906001600160a01b03821682036101b457565b602435906001600160a01b03821682036101b457565b60a0810190811067ffffffffffffffff821117610f3857604052565b634e487b7160e01b600052604160045260246000fd5b6040810190811067ffffffffffffffff821117610f3857604052565b90601f8019910116810190811067ffffffffffffffff821117610f3857604052565b67ffffffffffffffff8111610f3857601f01601f191660200190565b929192610fb482610f8c565b91610fc26040519384610f6a565b8294818452818301116101b4578281602093846000960137010152565b6000546001600160a01b03163303610ff357565b606460405162461bcd60e51b815260206004820152602060248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152fd5b60ff6003541661104357565b60405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b6044820152606490fd5b919290156110dd575081511561108f575090565b3b156110985790565b60405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606490fd5b8251909150156110f05750805190602001fd5b6044604051809262461bcd60e51b825260206004830152611120815180928160248601526020868601910161112e565b601f01601f19168101030190fd5b60005b8381106111415750506000910152565b8181015183820152602001611131565b906111939261118b917f19457468657265756d205369676e6564204d6573736167653a0a333200000000600052601c52603c6000206112fa565b9290926111e0565b6001600160a01b039081169116036111a757565b60405162461bcd60e51b8152602060048201526011602482015270696e76616c6964207369676e617475726560781b6044820152606490fd5b60058110156112e457806111f15750565b6001810361123e5760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e617475726500000000000000006044820152606490fd5b6002810361128b5760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e677468006044820152606490fd5b60031461129457565b60405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b6064820152608490fd5b634e487b7160e01b600052602160045260246000fd5b90604181511460001461132857611324916020820151906060604084015193015160001a90611332565b9091565b5050600090600290565b9291907f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a083116113b55791608094939160ff602094604051948552168484015260408301526060820152600093849182805260015afa156113a85781516001600160a01b038116156113a2579190565b50600190565b50604051903d90823e3d90fd5b5050505060009060039056fea2646970667358221220b87505206a54c1b11f892251a96926990a9357b3d1ee16fa1438bd24ca87e42464736f6c63430008130033", + "deployedBytecode": "0x608080604052600436101561001357600080fd5b60003560e01c9081630fb5a6b414610ed5575080632b437d4814610e9a5780632b7ac3f314610e715780633f4ba83a14610ddd5780634fcbaa1f14610d8c5780635671576114610d6e5780635c975abb14610d4b5780636d04319414610cf1578063715018a614610c985780637f9d309614610c0d5780638456cb5914610bb35780638da5cb5b14610b8a57806391c3d7a314610a9f57806397fc007c146109e5578063c0411364146109aa578063d718f2fe146102f0578063da28b527146102ab578063de76cadb146101b95763f2fde38b146100f057600080fd5b346101b45760203660031901126101b457610109610ef0565b610111610fdf565b6001600160a01b0390811690811561016057600054826001600160601b0360a01b821617600055167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0600080a3005b60405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608490fd5b600080fd5b346101b45760403660031901126101b4576101d2610ef0565b6101da610f06565b6101e2610fdf565b6001600160a01b0391821660008181526007602052604090205490929182169116811461025a57816040917f75a33e8174368dc0792ac0a162a518ece06bebca5d2d915bf1a161b4fdc60cbf93600052600760205282600020816001600160601b0360a01b82541617905582519182526020820152a1005b60405162461bcd60e51b8152602060048201526024808201527f546f6b656e436c61696d3a2045524332302077616c6c6574206e6f74206368616044820152631b99d95960e21b6064820152608490fd5b346101b45760003660031901126101b4576040517f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168152602090f35b346101b45760e03660031901126101b457610309610ef0565b610311610f06565b3660c4116101b45760c43567ffffffffffffffff8082116101b457366023830112156101b4578160040135116101b4573660248260040135830101116101b45760ff604051826004013560248401823760208184600401358101600181520301902054166109345760843560045481018091116107895742116108c957600280541461088457600280556103a3611037565b6001600160a01b03828116600090815260076020526040902054161561083457604435156107ef576001600160a01b0383811660009081526008602090815260408083209386168352929052205490606435821661079f576040516001600160601b03193360601b1660208201526001600160601b03198560601b1660348201526001600160601b03198460601b1660488201526001600160601b03197f000000000000000000000000000000000000000000000000000000000000000060601b16605c8201527f000000000000000000000000000000000000000000000000000000000000000060708201526070815261049d81610f1c565b6000905b6004821061071d5780516020909101206006546104db92506001600160a01b0316906104d536600486013560248701610fa8565b91611151565b60ff60405182600401356024840182376020818460040135810160018152030190205416156106ec575b5060018060a01b0383166000526008602052604060002060018060a01b03831660005260205260643517604060002055600760205261060060018060a01b03604060002054166000806040519260208401906323b872dd60e01b8252602485015233604485015260443560648501526064845261058184610f1c565b6040519361058e85610f4e565b60208086527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564908601525190826001600160a01b0388165af13d156106e4573d906105d882610f8c565b916105e66040519384610f6a565b82523d6000602084013e5b6001600160a01b03851661107b565b80519081159182156106c1575b50501561066957604080516001600160a01b03938416815260443560208201526064359181019190915291169033907fc5e576d85788400ff978578cc94a19ee7a30e8ee78d468f20ab2e305bef8411d90606090a36001600255005b60405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608490fd5b81925090602091810103126101b4576020015180151581036101b457838061060d565b6060906105f1565b6020604051828193600401356024820183376004013581016001815203019020600160ff1982541617905583610505565b610776602061076a92604051828101908660051b60440135825283815261074381610f4e565b604051958361075b889551809288808901910161112e565b8401915180938684019061112e565b01038084520182610f6a565b90600019811461078957600101906104a1565b634e487b7160e01b600052601160045260246000fd5b60405162461bcd60e51b815260206004820152602260248201527f546f6b656e436c61696d3a20636f6e646974696f6e20636865636b206661696c604482015261195960f21b6064820152608490fd5b60405162461bcd60e51b815260206004820152601a60248201527f546f6b656e436c61696d3a20616d6f756e74206973207a65726f0000000000006044820152606490fd5b60405162461bcd60e51b815260206004820152602260248201527f546f6b656e436c61696d3a20746f6b656e206973206e6f7420737570706f7274604482015261195960f21b6064820152608490fd5b60405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606490fd5b60405162461bcd60e51b815260206004820152603b60248201527f657870697265642c20706c656173652073656e6420616e6f746865722074726160448201527f6e73616374696f6e2077697468206e6577207369676e617475726500000000006064820152608490fd5b60405162461bcd60e51b815260206004820152604260248201527f7369676e617475726520757365642e20706c656173652073656e6420616e6f7460448201527f686572207472616e73616374696f6e2077697468206e6577207369676e617475606482015261726560f01b608482015260a490fd5b346101b45760203660031901126101b45760206001600160a01b03806109ce610ef0565b166000526007825260406000205416604051908152f35b346101b45760203660031901126101b4576109fe610ef0565b610a06610fdf565b6001600160a01b03168015610a4e57600680546001600160a01b031916821790557f4635bfbeab18ad788a7fc2a516293118982d68d953206bd5f8c556890e72d7e5600080a2005b60405162461bcd60e51b815260206004820152602360248201527f546f6b656e436c61696d3a20616464726573732063616e206e6f74206265207a60448201526265726f60e81b6064820152608490fd5b346101b4576101203660031901126101b457610ab9610ef0565b610ac1610f06565b6044356001600160a01b0380821682036101b45760643590811681036101b45736610124116101b457604051926001600160601b0319928380928160209860601b168888015260601b16603486015260601b16604884015260601b16605c820152608435607082015260708152610b3781610f1c565b60005b8260048210610b525790508151910120604051908152f35b610b789061076a9293604051828101908660051b60a40135825283815261074381610f4e565b90600019811461078957600101610b3a565b346101b45760003660031901126101b4576000546040516001600160a01b039091168152602090f35b346101b45760003660031901126101b457610bcc610fdf565b610bd4611037565b600160ff1960035416176003557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586020604051338152a1005b346101b45760203660031901126101b457600435610c29610fdf565b600554811115610c5e57806004557f91abcc2d6823e3a3f11d31b208dd3065d2c6a791f1c7c9fe96a42ce12897eac5600080a2005b60405162461bcd60e51b8152602060048201526012602482015271191d5c985d1a5bdb881d1bdbc81cda1bdc9d60721b6044820152606490fd5b346101b45760003660031901126101b457610cb1610fdf565b600080546001600160a01b0319811682556001600160a01b03167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08280a3005b346101b45760603660031901126101b457610d0a610ef0565b6044359067ffffffffffffffff82116101b457366023830112156101b457610d3f610d49923690602481600401359101610fa8565b9060243590611151565b005b346101b45760003660031901126101b457602060ff600354166040519015158152f35b346101b45760003660031901126101b4576020600554604051908152f35b346101b45760403660031901126101b457610da5610ef0565b610dad610f06565b9060018060a01b038091166000526008602052604060002091166000526020526020604060002054604051908152f35b346101b45760003660031901126101b457610df6610fdf565b60035460ff811615610e355760ff19166003557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa6020604051338152a1005b60405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b6044820152606490fd5b346101b45760003660031901126101b4576006546040516001600160a01b039091168152602090f35b346101b45760003660031901126101b45760206040517f00000000000000000000000000000000000000000000000000000000000000008152f35b346101b45760003660031901126101b4576020906004548152f35b600435906001600160a01b03821682036101b457565b602435906001600160a01b03821682036101b457565b60a0810190811067ffffffffffffffff821117610f3857604052565b634e487b7160e01b600052604160045260246000fd5b6040810190811067ffffffffffffffff821117610f3857604052565b90601f8019910116810190811067ffffffffffffffff821117610f3857604052565b67ffffffffffffffff8111610f3857601f01601f191660200190565b929192610fb482610f8c565b91610fc26040519384610f6a565b8294818452818301116101b4578281602093846000960137010152565b6000546001600160a01b03163303610ff357565b606460405162461bcd60e51b815260206004820152602060248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152fd5b60ff6003541661104357565b60405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b6044820152606490fd5b919290156110dd575081511561108f575090565b3b156110985790565b60405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606490fd5b8251909150156110f05750805190602001fd5b6044604051809262461bcd60e51b825260206004830152611120815180928160248601526020868601910161112e565b601f01601f19168101030190fd5b60005b8381106111415750506000910152565b8181015183820152602001611131565b906111939261118b917f19457468657265756d205369676e6564204d6573736167653a0a333200000000600052601c52603c6000206112fa565b9290926111e0565b6001600160a01b039081169116036111a757565b60405162461bcd60e51b8152602060048201526011602482015270696e76616c6964207369676e617475726560781b6044820152606490fd5b60058110156112e457806111f15750565b6001810361123e5760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e617475726500000000000000006044820152606490fd5b6002810361128b5760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e677468006044820152606490fd5b60031461129457565b60405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b6064820152608490fd5b634e487b7160e01b600052602160045260246000fd5b90604181511460001461132857611324916020820151906060604084015193015160001a90611332565b9091565b5050600090600290565b9291907f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a083116113b55791608094939160ff602094604051948552168484015260408301526060820152600093849182805260015afa156113a85781516001600160a01b038116156113a2579190565b50600190565b50604051903d90823e3d90fd5b5050505060009060039056fea2646970667358221220b87505206a54c1b11f892251a96926990a9357b3d1ee16fa1438bd24ca87e42464736f6c63430008130033", "linkReferences": {}, "deployedLinkReferences": {} } diff --git a/contracts-dbg/Test1/TokenClaimTest.sol b/contracts-dbg/Test1/TokenClaimTest.sol new file mode 100644 index 0000000..3ed77da --- /dev/null +++ b/contracts-dbg/Test1/TokenClaimTest.sol @@ -0,0 +1,26 @@ +// SPDX-License-Identifier: MIT +pragma solidity 0.8.19; + +contract TokenClaimTest { + event EvmPrint(string); + + constructor() { + emit EvmPrint("TokenClaim.constructor"); + + // Here you can either deploy your contracts via `new`, eg: + // Counter counter = new Counter(); + // counter.increment(); + + // or interact with an existing deployment by specifying a `fork` url in `dbg.project.json` + // eg: + // ICounter counter = ICounter(0x12345678.....) + // counter.increment(); + // + // If you have correct symbols (`artifacts`) for the deployed contract, you can step-into calls. + + uint256 abc = 123; + uint256 def = abc + 5; + + emit EvmPrint("DbgEntry return"); + } +} \ No newline at end of file diff --git a/contracts-dbg/Test1/dbg.contract.json b/contracts-dbg/Test1/dbg.contract.json new file mode 100644 index 0000000..3ad719c --- /dev/null +++ b/contracts-dbg/Test1/dbg.contract.json @@ -0,0 +1,13 @@ +{ + "entryPoint": "TokenClaimTest", + "solc": "0.8.26", + "sourceDirs": [ + "." + ], + "breakOnEntry": false, + "fork": { + "enable": false, + "url": "", + "blockNumber": 0 + } +} \ No newline at end of file diff --git a/contracts/activity/TokenClaim.sol b/contracts/activity/TokenClaim.sol index ebebc47..9067595 100644 --- a/contracts/activity/TokenClaim.sol +++ b/contracts/activity/TokenClaim.sol @@ -17,13 +17,13 @@ contract TokenClaim is HasSignature, ReentrancyGuard, Pausable, TimeChecker { mapping(address token => address wallet) public erc20Wallets; - // store user's claimed amount - mapping(address user => mapping(address token => uint256 amount)) public claimedAmount; + // store user's claimed status + mapping(address user => mapping(address token => uint256 claimedBit)) public claimedBitMap; event EventERC20Wallet(address erc20, address wallet); event EventVerifierUpdated(address indexed verifier); - event EventTokenClaimed(address indexed user, address indexed token, address passport, uint256 amount, uint256 nonce); + event EventTokenClaimed(address indexed user, address indexed token, address account, uint256 amount, uint256 bit); constructor(address _wallet, address _token, address _verifier, uint256 _duration) TimeChecker(_duration) { _CACHED_CHAIN_ID = block.chainid; @@ -68,60 +68,54 @@ contract TokenClaim is HasSignature, ReentrancyGuard, Pausable, TimeChecker { * @dev claim CEC with signature * @param account address which eligible to claim, only for event log * @param token address of token - * @param amount amount of token - * @param signTime time of signature - * @param saltNonce nonce of signature + * @param vals array of amount, bit, signTime, saltNonce * @param signature signature of claim */ function claim( address account, address token, - uint256 amount, - uint256 signTime, - uint256 saltNonce, + uint256[4] calldata vals, // amount, bit, signTime, saltNonce bytes calldata signature - ) external signatureValid(signature) timeValid(signTime) nonReentrant whenNotPaused { + ) external signatureValid(signature) timeValid(vals[2]) nonReentrant whenNotPaused { require(erc20Wallets[token] != address(0), "TokenClaim: token is not supported"); - require(amount > 0, "TokenClaim: amount is zero"); + require(vals[0] > 0, "TokenClaim: amount is zero"); + uint256 current = claimedBitMap[account][token]; + require(current & vals[1] == 0, "TokenClaim: condition check failed"); address user = _msgSender(); bytes32 criteriaMessageHash = getMessageHash( user, account, token, - amount, _CACHED_THIS, _CACHED_CHAIN_ID, - signTime, - saltNonce + vals ); checkSigner(verifier, criteriaMessageHash, signature); _useSignature(signature); - claimedAmount[account][token] += amount; - IERC20(token).safeTransferFrom(erc20Wallets[token], user, amount); - emit EventTokenClaimed(user, token, account, amount, saltNonce); + claimedBitMap[account][token] = current | vals[1]; + IERC20(token).safeTransferFrom(erc20Wallets[token], user, vals[0]); + emit EventTokenClaimed(user, token, account, vals[0], vals[1]); } function getMessageHash( address _user, address _account, address _token, - uint256 _amount, address _contract, uint256 _chainId, - uint256 _signTime, - uint256 _saltNonce + uint256[4] calldata _vals ) public pure returns (bytes32) { bytes memory encoded = abi.encodePacked( _user, _account, _token, - _amount, _contract, - _chainId, - _signTime, - _saltNonce + _chainId ); + for (uint256 i = 0; i < _vals.length; i++) { + encoded = bytes.concat(encoded, abi.encodePacked(_vals[i])); + } return keccak256(encoded); } } diff --git a/contracts/core/ClaimHistory.sol b/contracts/core/ClaimHistory.sol new file mode 100644 index 0000000..7105967 --- /dev/null +++ b/contracts/core/ClaimHistory.sol @@ -0,0 +1,21 @@ +// SPDX-License-Identifier: MIT +pragma solidity 0.8.19; + +contract ClaimHistory { + mapping(address user=> mapping(uint256 index => uint256 val)) private claimedBitMap; + + function isClaimed(address user, uint256 index) public view returns (bool) { + uint256 claimedWordIndex = index / 256; + uint256 claimedBitIndex = index % 256; + uint256 claimedWord = claimedBitMap[user][claimedWordIndex]; + uint256 mask = (1 << claimedBitIndex); + return claimedWord & mask == mask; + } + + function setClaimed(address user, uint256 index) internal { + uint256 claimedWordIndex = index / 256; + uint256 claimedBitIndex = index % 256; + claimedBitMap[user][claimedWordIndex] = claimedBitMap[user][claimedWordIndex] | (1 << claimedBitIndex); + } + +} diff --git a/dbg.project.json b/dbg.project.json new file mode 100644 index 0000000..132554d --- /dev/null +++ b/dbg.project.json @@ -0,0 +1,13 @@ +{ + "contractsDir": "contracts-dbg", + "selectedContract": "Test1", + "autoOpen": true, + "breakOnEntry": false, + "symbols": { + "hardhat": { + "projectPaths": [ + "/Users/zhl/Documents/workspace/crypto/contracts-imtbl" + ] + } + } +} \ No newline at end of file diff --git a/deployments/bsc_test/TokenClaim.json b/deployments/bsc_test/TokenClaim.json index 883a554..f852822 100644 --- a/deployments/bsc_test/TokenClaim.json +++ b/deployments/bsc_test/TokenClaim.json @@ -1,5 +1,5 @@ { - "address": "0x2C7221588D4FBac2585D71618CD540e74c7413B8", + "address": "0xC95bDFAaFBf79b435e4d2bF8d77842fc19e6fE56", "abi": [ { "inputs": [ @@ -77,7 +77,7 @@ { "indexed": false, "internalType": "address", - "name": "passport", + "name": "account", "type": "address" }, { @@ -89,7 +89,7 @@ { "indexed": false, "internalType": "uint256", - "name": "nonce", + "name": "bit", "type": "uint256" } ], @@ -216,19 +216,9 @@ "type": "address" }, { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "signTime", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "saltNonce", - "type": "uint256" + "internalType": "uint256[4]", + "name": "vals", + "type": "uint256[4]" }, { "internalType": "bytes", @@ -254,11 +244,11 @@ "type": "address" } ], - "name": "claimedAmount", + "name": "claimedBitMap", "outputs": [ { "internalType": "uint256", - "name": "amount", + "name": "claimedBit", "type": "uint256" } ], @@ -314,11 +304,6 @@ "name": "_token", "type": "address" }, - { - "internalType": "uint256", - "name": "_amount", - "type": "uint256" - }, { "internalType": "address", "name": "_contract", @@ -330,14 +315,9 @@ "type": "uint256" }, { - "internalType": "uint256", - "name": "_signTime", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_saltNonce", - "type": "uint256" + "internalType": "uint256[4]", + "name": "_vals", + "type": "uint256[4]" } ], "name": "getMessageHash", @@ -482,22 +462,22 @@ "type": "function" } ], - "transactionHash": "0xbce9733a10cd0fd73ff9537c721c04db10cda7b92c10ccbf93aa70524d86b039", + "transactionHash": "0x7b00d009ec2bcc90f1ebaa1cdcb25154dbfc7af1393b2034d152b60c7bcc03d5", "receipt": { "to": null, "from": "0x50A8e60041A206AcaA5F844a1104896224be6F39", - "contractAddress": "0x2C7221588D4FBac2585D71618CD540e74c7413B8", - "transactionIndex": 11, - "gasUsed": "1227415", - "logsBloom": "0x00000000000000000000000000000000000000000000000000800000000800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000020000000000000000000800000000000000000000000004000000400000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000400000000000000000000080000000000020000000000000000000000000000000000000020000000000000000000000000000", - "blockHash": "0x99ac9e140aed33b2a5449fbd67015d1ff0434161981b889136215c7008dbd984", - "transactionHash": "0xbce9733a10cd0fd73ff9537c721c04db10cda7b92c10ccbf93aa70524d86b039", + "contractAddress": "0xC95bDFAaFBf79b435e4d2bF8d77842fc19e6fE56", + "transactionIndex": 5, + "gasUsed": "1299107", + "logsBloom": "0x00000000000000000000000000000000000000000000000000800000000800000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000020000000000000000000800000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000080000000000060000000000000000000000000000000000000020000000004000000000000000000", + "blockHash": "0x36deafa4ea0e22d9eb9c9eb0b7608b59d2ff4daed6efe59455188c7c87a239a8", + "transactionHash": "0x7b00d009ec2bcc90f1ebaa1cdcb25154dbfc7af1393b2034d152b60c7bcc03d5", "logs": [ { - "transactionIndex": 11, - "blockNumber": 43110358, - "transactionHash": "0xbce9733a10cd0fd73ff9537c721c04db10cda7b92c10ccbf93aa70524d86b039", - "address": "0x2C7221588D4FBac2585D71618CD540e74c7413B8", + "transactionIndex": 5, + "blockNumber": 43167433, + "transactionHash": "0x7b00d009ec2bcc90f1ebaa1cdcb25154dbfc7af1393b2034d152b60c7bcc03d5", + "address": "0xC95bDFAaFBf79b435e4d2bF8d77842fc19e6fE56", "topics": [ "0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0", "0x0000000000000000000000000000000000000000000000000000000000000000", @@ -505,11 +485,11 @@ ], "data": "0x", "logIndex": 7, - "blockHash": "0x99ac9e140aed33b2a5449fbd67015d1ff0434161981b889136215c7008dbd984" + "blockHash": "0x36deafa4ea0e22d9eb9c9eb0b7608b59d2ff4daed6efe59455188c7c87a239a8" } ], - "blockNumber": 43110358, - "cumulativeGasUsed": "1765167", + "blockNumber": 43167433, + "cumulativeGasUsed": "1825472", "status": 1, "byzantium": true }, @@ -520,10 +500,10 @@ 3600 ], "numDeployments": 1, - "solcInputHash": "ffd53ba855cb9016f19c9e71d2ab924e", - "metadata": "{\"compiler\":{\"version\":\"0.8.19+commit.7dd6d404\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_wallet\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_token\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_verifier\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_duration\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"duration\",\"type\":\"uint256\"}],\"name\":\"DurationUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"erc20\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"wallet\",\"type\":\"address\"}],\"name\":\"EventERC20Wallet\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"user\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"passport\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"nonce\",\"type\":\"uint256\"}],\"name\":\"EventTokenClaimed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"verifier\",\"type\":\"address\"}],\"name\":\"EventVerifierUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"Paused\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"Unpaused\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"_CACHED_CHAIN_ID\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"_CACHED_THIS\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"signer\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"hash\",\"type\":\"bytes32\"},{\"internalType\":\"bytes\",\"name\":\"signature\",\"type\":\"bytes\"}],\"name\":\"checkSigner\",\"outputs\":[],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"signTime\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"saltNonce\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"signature\",\"type\":\"bytes\"}],\"name\":\"claim\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"user\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"}],\"name\":\"claimedAmount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"duration\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"}],\"name\":\"erc20Wallets\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"wallet\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_user\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_account\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_token\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"_contract\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_chainId\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_signTime\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_saltNonce\",\"type\":\"uint256\"}],\"name\":\"getMessageHash\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"minDuration\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"pause\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"paused\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"unpause\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"valNew\",\"type\":\"uint256\"}],\"name\":\"updateDuation\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"erc20\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"wallet\",\"type\":\"address\"}],\"name\":\"updateERC20Wallet\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_verifier\",\"type\":\"address\"}],\"name\":\"updateVerifier\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"verifier\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"events\":{\"Paused(address)\":{\"details\":\"Emitted when the pause is triggered by `account`.\"},\"Unpaused(address)\":{\"details\":\"Emitted when the pause is lifted by `account`.\"}},\"kind\":\"dev\",\"methods\":{\"claim(address,address,uint256,uint256,uint256,bytes)\":{\"details\":\"claim CEC with signature\",\"params\":{\"account\":\"address which eligible to claim, only for event log\",\"amount\":\"amount of token\",\"saltNonce\":\"nonce of signature\",\"signTime\":\"time of signature\",\"signature\":\"signature of claim\",\"token\":\"address of token\"}},\"owner()\":{\"details\":\"Returns the address of the current owner.\"},\"pause()\":{\"details\":\"update pause state\"},\"paused()\":{\"details\":\"Returns true if the contract is paused, and false otherwise.\"},\"renounceOwnership()\":{\"details\":\"Leaves the contract without owner. It will not be possible to call `onlyOwner` functions. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby disabling any functionality that is only available to the owner.\"},\"transferOwnership(address)\":{\"details\":\"Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner.\"},\"unpause()\":{\"details\":\"update unpause state\"},\"updateDuation(uint256)\":{\"details\":\"Change duration value\"},\"updateERC20Wallet(address,address)\":{\"details\":\"update ERC20 wallet\"},\"updateVerifier(address)\":{\"details\":\"update verifier address\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/activity/TokenClaim.sol\":\"TokenClaim\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[],\"viaIR\":true},\"sources\":{\"@openzeppelin/contracts/access/Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../utils/Context.sol\\\";\\n\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\n * the owner.\\n */\\nabstract contract Ownable is Context {\\n address private _owner;\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the deployer as the initial owner.\\n */\\n constructor() {\\n _transferOwnership(_msgSender());\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n _checkOwner();\\n _;\\n }\\n\\n /**\\n * @dev Returns the address of the current owner.\\n */\\n function owner() public view virtual returns (address) {\\n return _owner;\\n }\\n\\n /**\\n * @dev Throws if the sender is not the owner.\\n */\\n function _checkOwner() internal view virtual {\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby disabling any functionality that is only available to the owner.\\n */\\n function renounceOwnership() public virtual onlyOwner {\\n _transferOwnership(address(0));\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\n _transferOwnership(newOwner);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Internal function without access restriction.\\n */\\n function _transferOwnership(address newOwner) internal virtual {\\n address oldOwner = _owner;\\n _owner = newOwner;\\n emit OwnershipTransferred(oldOwner, newOwner);\\n }\\n}\\n\",\"keccak256\":\"0xba43b97fba0d32eb4254f6a5a297b39a19a247082a02d6e69349e071e2946218\",\"license\":\"MIT\"},\"@openzeppelin/contracts/security/Pausable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (security/Pausable.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../utils/Context.sol\\\";\\n\\n/**\\n * @dev Contract module which allows children to implement an emergency stop\\n * mechanism that can be triggered by an authorized account.\\n *\\n * This module is used through inheritance. It will make available the\\n * modifiers `whenNotPaused` and `whenPaused`, which can be applied to\\n * the functions of your contract. Note that they will not be pausable by\\n * simply including this module, only once the modifiers are put in place.\\n */\\nabstract contract Pausable is Context {\\n /**\\n * @dev Emitted when the pause is triggered by `account`.\\n */\\n event Paused(address account);\\n\\n /**\\n * @dev Emitted when the pause is lifted by `account`.\\n */\\n event Unpaused(address account);\\n\\n bool private _paused;\\n\\n /**\\n * @dev Initializes the contract in unpaused state.\\n */\\n constructor() {\\n _paused = false;\\n }\\n\\n /**\\n * @dev 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 return _paused;\\n }\\n\\n /**\\n * @dev Throws if the contract is paused.\\n */\\n function _requireNotPaused() internal view virtual {\\n require(!paused(), \\\"Pausable: paused\\\");\\n }\\n\\n /**\\n * @dev Throws if the contract is not paused.\\n */\\n function _requirePaused() internal view virtual {\\n require(paused(), \\\"Pausable: not paused\\\");\\n }\\n\\n /**\\n * @dev Triggers stopped state.\\n *\\n * Requirements:\\n *\\n * - The contract must not be paused.\\n */\\n function _pause() internal virtual whenNotPaused {\\n _paused = true;\\n emit Paused(_msgSender());\\n }\\n\\n /**\\n * @dev Returns to normal state.\\n *\\n * Requirements:\\n *\\n * - The contract must be paused.\\n */\\n function _unpause() internal virtual whenPaused {\\n _paused = false;\\n emit Unpaused(_msgSender());\\n }\\n}\\n\",\"keccak256\":\"0x0849d93b16c9940beb286a7864ed02724b248b93e0d80ef6355af5ef15c64773\",\"license\":\"MIT\"},\"@openzeppelin/contracts/security/ReentrancyGuard.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (security/ReentrancyGuard.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Contract module that helps prevent reentrant calls to a function.\\n *\\n * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier\\n * available, which can be applied to functions to make sure there are no nested\\n * (reentrant) calls to them.\\n *\\n * Note that because there is a single `nonReentrant` guard, functions marked as\\n * `nonReentrant` may not call one another. This can be worked around by making\\n * those functions `private`, and then adding `external` `nonReentrant` entry\\n * points to them.\\n *\\n * TIP: If you would like to learn more about reentrancy and alternative ways\\n * to protect against it, check out our blog post\\n * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].\\n */\\nabstract contract ReentrancyGuard {\\n // Booleans are more expensive than uint256 or any type that takes up a full\\n // word because each write operation emits an extra SLOAD to first read the\\n // slot's contents, replace the bits taken up by the boolean, and then write\\n // back. This is the compiler's defense against contract upgrades and\\n // pointer aliasing, and it cannot be disabled.\\n\\n // The values being non-zero value makes deployment a bit more expensive,\\n // but in exchange the refund on every call to nonReentrant will be lower in\\n // amount. Since refunds are capped to a percentage of the total\\n // transaction's gas, it is best to keep them low in cases like this one, to\\n // increase the likelihood of the full refund coming into effect.\\n uint256 private constant _NOT_ENTERED = 1;\\n uint256 private constant _ENTERED = 2;\\n\\n uint256 private _status;\\n\\n constructor() {\\n _status = _NOT_ENTERED;\\n }\\n\\n /**\\n * @dev Prevents a contract from calling itself, directly or indirectly.\\n * Calling a `nonReentrant` function from another `nonReentrant`\\n * function is not supported. It is possible to prevent this from happening\\n * by making the `nonReentrant` function external, and making it call a\\n * `private` function that does the actual work.\\n */\\n modifier nonReentrant() {\\n _nonReentrantBefore();\\n _;\\n _nonReentrantAfter();\\n }\\n\\n function _nonReentrantBefore() private {\\n // On the first call to nonReentrant, _status will be _NOT_ENTERED\\n require(_status != _ENTERED, \\\"ReentrancyGuard: reentrant call\\\");\\n\\n // Any calls to nonReentrant after this point will fail\\n _status = _ENTERED;\\n }\\n\\n function _nonReentrantAfter() private {\\n // By storing the original value once again, a refund is triggered (see\\n // https://eips.ethereum.org/EIPS/eip-2200)\\n _status = _NOT_ENTERED;\\n }\\n\\n /**\\n * @dev Returns true if the reentrancy guard is currently set to \\\"entered\\\", which indicates there is a\\n * `nonReentrant` function in the call stack.\\n */\\n function _reentrancyGuardEntered() internal view returns (bool) {\\n return _status == _ENTERED;\\n }\\n}\\n\",\"keccak256\":\"0xa535a5df777d44e945dd24aa43a11e44b024140fc340ad0dfe42acf4002aade1\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\n */\\ninterface IERC20 {\\n /**\\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\\n * another (`to`).\\n *\\n * Note that `value` may be zero.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 value);\\n\\n /**\\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\\n * a call to {approve}. `value` is the new allowance.\\n */\\n event Approval(address indexed owner, address indexed spender, uint256 value);\\n\\n /**\\n * @dev Returns the amount of tokens in existence.\\n */\\n function totalSupply() external view returns (uint256);\\n\\n /**\\n * @dev Returns the amount of tokens owned by `account`.\\n */\\n function balanceOf(address account) external view returns (uint256);\\n\\n /**\\n * @dev Moves `amount` tokens from the caller's account to `to`.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transfer(address to, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Returns the remaining number of tokens that `spender` will be\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\n * zero by default.\\n *\\n * This value changes when {approve} or {transferFrom} are called.\\n */\\n function allowance(address owner, address spender) external view returns (uint256);\\n\\n /**\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\n * that someone may use both the old and the new allowance by unfortunate\\n * transaction ordering. One possible solution to mitigate this race\\n * condition is to first reduce the spender's allowance to 0 and set the\\n * desired value afterwards:\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address spender, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Moves `amount` tokens from `from` to `to` using the\\n * allowance mechanism. `amount` is then deducted from the caller's\\n * allowance.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(address from, address to, uint256 amount) external returns (bool);\\n}\\n\",\"keccak256\":\"0x287b55befed2961a7eabd7d7b1b2839cbca8a5b80ef8dcbb25ed3d4c2002c305\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/extensions/IERC20Permit.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.4) (token/ERC20/extensions/IERC20Permit.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\\n *\\n * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by\\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\\n * need to send a transaction, and thus is not required to hold Ether at all.\\n *\\n * ==== Security Considerations\\n *\\n * There are two important considerations concerning the use of `permit`. The first is that a valid permit signature\\n * expresses an allowance, and it should not be assumed to convey additional meaning. In particular, it should not be\\n * considered as an intention to spend the allowance in any specific way. The second is that because permits have\\n * built-in replay protection and can be submitted by anyone, they can be frontrun. A protocol that uses permits should\\n * take this into consideration and allow a `permit` call to fail. Combining these two aspects, a pattern that may be\\n * generally recommended is:\\n *\\n * ```solidity\\n * function doThingWithPermit(..., uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public {\\n * try token.permit(msg.sender, address(this), value, deadline, v, r, s) {} catch {}\\n * doThing(..., value);\\n * }\\n *\\n * function doThing(..., uint256 value) public {\\n * token.safeTransferFrom(msg.sender, address(this), value);\\n * ...\\n * }\\n * ```\\n *\\n * Observe that: 1) `msg.sender` is used as the owner, leaving no ambiguity as to the signer intent, and 2) the use of\\n * `try/catch` allows the permit to fail and makes the code tolerant to frontrunning. (See also\\n * {SafeERC20-safeTransferFrom}).\\n *\\n * Additionally, note that smart contract wallets (such as Argent or Safe) are not able to produce permit signatures, so\\n * contracts should have entry points that don't rely on permit.\\n */\\ninterface IERC20Permit {\\n /**\\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\\n * given ``owner``'s signed approval.\\n *\\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\\n * ordering also apply here.\\n *\\n * Emits an {Approval} event.\\n *\\n * Requirements:\\n *\\n * - `spender` cannot be the zero address.\\n * - `deadline` must be a timestamp in the future.\\n * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`\\n * over the EIP712-formatted function arguments.\\n * - the signature must use ``owner``'s current nonce (see {nonces}).\\n *\\n * For more information on the signature format, see the\\n * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP\\n * section].\\n *\\n * CAUTION: See Security Considerations above.\\n */\\n function permit(\\n address owner,\\n address spender,\\n uint256 value,\\n uint256 deadline,\\n uint8 v,\\n bytes32 r,\\n bytes32 s\\n ) external;\\n\\n /**\\n * @dev Returns the current nonce for `owner`. This value must be\\n * included whenever a signature is generated for {permit}.\\n *\\n * Every successful call to {permit} increases ``owner``'s nonce by one. This\\n * prevents a signature from being used multiple times.\\n */\\n function nonces(address owner) external view returns (uint256);\\n\\n /**\\n * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.\\n */\\n // solhint-disable-next-line func-name-mixedcase\\n function DOMAIN_SEPARATOR() external view returns (bytes32);\\n}\\n\",\"keccak256\":\"0xb264c03a3442eb37a68ad620cefd1182766b58bee6cec40343480392d6b14d69\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.3) (token/ERC20/utils/SafeERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../IERC20.sol\\\";\\nimport \\\"../extensions/IERC20Permit.sol\\\";\\nimport \\\"../../../utils/Address.sol\\\";\\n\\n/**\\n * @title SafeERC20\\n * @dev Wrappers around ERC20 operations that throw on failure (when the token\\n * contract returns false). Tokens that return no value (and instead revert or\\n * throw on failure) are also supported, non-reverting calls are assumed to be\\n * successful.\\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\\n */\\nlibrary SafeERC20 {\\n using Address for address;\\n\\n /**\\n * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,\\n * non-reverting calls are assumed to be successful.\\n */\\n function safeTransfer(IERC20 token, address to, uint256 value) internal {\\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\\n }\\n\\n /**\\n * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the\\n * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.\\n */\\n function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {\\n _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));\\n }\\n\\n /**\\n * @dev Deprecated. This function has issues similar to the ones found in\\n * {IERC20-approve}, and its usage is discouraged.\\n *\\n * Whenever possible, use {safeIncreaseAllowance} and\\n * {safeDecreaseAllowance} instead.\\n */\\n function safeApprove(IERC20 token, address spender, uint256 value) internal {\\n // safeApprove should only be called when setting an initial allowance,\\n // or when resetting it to zero. To increase and decrease it, use\\n // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'\\n require(\\n (value == 0) || (token.allowance(address(this), spender) == 0),\\n \\\"SafeERC20: approve from non-zero to non-zero allowance\\\"\\n );\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));\\n }\\n\\n /**\\n * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,\\n * non-reverting calls are assumed to be successful.\\n */\\n function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {\\n uint256 oldAllowance = token.allowance(address(this), spender);\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance + value));\\n }\\n\\n /**\\n * @dev Decrease the calling contract's allowance toward `spender` by `value`. If `token` returns no value,\\n * non-reverting calls are assumed to be successful.\\n */\\n function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal {\\n unchecked {\\n uint256 oldAllowance = token.allowance(address(this), spender);\\n require(oldAllowance >= value, \\\"SafeERC20: decreased allowance below zero\\\");\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance - value));\\n }\\n }\\n\\n /**\\n * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,\\n * non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval\\n * to be set to zero before setting it to a non-zero value, such as USDT.\\n */\\n function forceApprove(IERC20 token, address spender, uint256 value) internal {\\n bytes memory approvalCall = abi.encodeWithSelector(token.approve.selector, spender, value);\\n\\n if (!_callOptionalReturnBool(token, approvalCall)) {\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, 0));\\n _callOptionalReturn(token, approvalCall);\\n }\\n }\\n\\n /**\\n * @dev Use a ERC-2612 signature to set the `owner` approval toward `spender` on `token`.\\n * Revert on invalid signature.\\n */\\n function safePermit(\\n IERC20Permit token,\\n address owner,\\n address spender,\\n uint256 value,\\n uint256 deadline,\\n uint8 v,\\n bytes32 r,\\n bytes32 s\\n ) internal {\\n uint256 nonceBefore = token.nonces(owner);\\n token.permit(owner, spender, value, deadline, v, r, s);\\n uint256 nonceAfter = token.nonces(owner);\\n require(nonceAfter == nonceBefore + 1, \\\"SafeERC20: permit did not succeed\\\");\\n }\\n\\n /**\\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\\n * on the return value: the return value is optional (but if data is returned, it must not be false).\\n * @param token The token targeted by the call.\\n * @param data The call data (encoded using abi.encode or one of its variants).\\n */\\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\\n // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that\\n // the target address contains contract code and also asserts for success in the low-level call.\\n\\n bytes memory returndata = address(token).functionCall(data, \\\"SafeERC20: low-level call failed\\\");\\n require(returndata.length == 0 || abi.decode(returndata, (bool)), \\\"SafeERC20: ERC20 operation did not succeed\\\");\\n }\\n\\n /**\\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\\n * on the return value: the return value is optional (but if data is returned, it must not be false).\\n * @param token The token targeted by the call.\\n * @param data The call data (encoded using abi.encode or one of its variants).\\n *\\n * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.\\n */\\n function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {\\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\\n // we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false\\n // and not revert is the subcall reverts.\\n\\n (bool success, bytes memory returndata) = address(token).call(data);\\n return\\n success && (returndata.length == 0 || abi.decode(returndata, (bool))) && Address.isContract(address(token));\\n }\\n}\\n\",\"keccak256\":\"0xabefac93435967b4d36a4fabcbdbb918d1f0b7ae3c3d85bc30923b326c927ed1\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary Address {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n *\\n * Furthermore, `isContract` will also return true if the target contract within\\n * the same transaction is already scheduled for destruction by `SELFDESTRUCT`,\\n * which only has an effect at the end of a transaction.\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\\n *\\n * _Available since v4.8._\\n */\\n function verifyCallResultFromTarget(\\n address target,\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n if (success) {\\n if (returndata.length == 0) {\\n // only check isContract if the call was successful and the return data is empty\\n // otherwise we already know that it was a contract\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n }\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason or using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n /// @solidity memory-safe-assembly\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x006dd67219697fe68d7fbfdea512e7c4cb64a43565ed86171d67e844982da6fa\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.4) (utils/Context.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract Context {\\n function _msgSender() internal view virtual returns (address) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes calldata) {\\n return msg.data;\\n }\\n\\n function _contextSuffixLength() internal view virtual returns (uint256) {\\n return 0;\\n }\\n}\\n\",\"keccak256\":\"0xa92e4fa126feb6907daa0513ddd816b2eb91f30a808de54f63c17d0e162c3439\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Strings.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Strings.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./math/Math.sol\\\";\\nimport \\\"./math/SignedMath.sol\\\";\\n\\n/**\\n * @dev String operations.\\n */\\nlibrary Strings {\\n bytes16 private constant _SYMBOLS = \\\"0123456789abcdef\\\";\\n uint8 private constant _ADDRESS_LENGTH = 20;\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\\n */\\n function toString(uint256 value) internal pure returns (string memory) {\\n unchecked {\\n uint256 length = Math.log10(value) + 1;\\n string memory buffer = new string(length);\\n uint256 ptr;\\n /// @solidity memory-safe-assembly\\n assembly {\\n ptr := add(buffer, add(32, length))\\n }\\n while (true) {\\n ptr--;\\n /// @solidity memory-safe-assembly\\n assembly {\\n mstore8(ptr, byte(mod(value, 10), _SYMBOLS))\\n }\\n value /= 10;\\n if (value == 0) break;\\n }\\n return buffer;\\n }\\n }\\n\\n /**\\n * @dev Converts a `int256` to its ASCII `string` decimal representation.\\n */\\n function toString(int256 value) internal pure returns (string memory) {\\n return string(abi.encodePacked(value < 0 ? \\\"-\\\" : \\\"\\\", toString(SignedMath.abs(value))));\\n }\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\\n */\\n function toHexString(uint256 value) internal pure returns (string memory) {\\n unchecked {\\n return toHexString(value, Math.log256(value) + 1);\\n }\\n }\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\\n */\\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\\n bytes memory buffer = new bytes(2 * length + 2);\\n buffer[0] = \\\"0\\\";\\n buffer[1] = \\\"x\\\";\\n for (uint256 i = 2 * length + 1; i > 1; --i) {\\n buffer[i] = _SYMBOLS[value & 0xf];\\n value >>= 4;\\n }\\n require(value == 0, \\\"Strings: hex length insufficient\\\");\\n return string(buffer);\\n }\\n\\n /**\\n * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.\\n */\\n function toHexString(address addr) internal pure returns (string memory) {\\n return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\\n }\\n\\n /**\\n * @dev Returns true if the two strings are equal.\\n */\\n function equal(string memory a, string memory b) internal pure returns (bool) {\\n return keccak256(bytes(a)) == keccak256(bytes(b));\\n }\\n}\\n\",\"keccak256\":\"0x3088eb2868e8d13d89d16670b5f8612c4ab9ff8956272837d8e90106c59c14a0\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/cryptography/ECDSA.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/cryptography/ECDSA.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../Strings.sol\\\";\\n\\n/**\\n * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.\\n *\\n * These functions can be used to verify that a message was signed by the holder\\n * of the private keys of a given address.\\n */\\nlibrary ECDSA {\\n enum RecoverError {\\n NoError,\\n InvalidSignature,\\n InvalidSignatureLength,\\n InvalidSignatureS,\\n InvalidSignatureV // Deprecated in v4.8\\n }\\n\\n function _throwError(RecoverError error) private pure {\\n if (error == RecoverError.NoError) {\\n return; // no error: do nothing\\n } else if (error == RecoverError.InvalidSignature) {\\n revert(\\\"ECDSA: invalid signature\\\");\\n } else if (error == RecoverError.InvalidSignatureLength) {\\n revert(\\\"ECDSA: invalid signature length\\\");\\n } else if (error == RecoverError.InvalidSignatureS) {\\n revert(\\\"ECDSA: invalid signature 's' value\\\");\\n }\\n }\\n\\n /**\\n * @dev Returns the address that signed a hashed message (`hash`) with\\n * `signature` or error string. This address can then be used for verification purposes.\\n *\\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\\n * this function rejects them by requiring the `s` value to be in the lower\\n * half order, and the `v` value to be either 27 or 28.\\n *\\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\\n * verification to be secure: it is possible to craft signatures that\\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\\n * this is by receiving a hash of the original message (which may otherwise\\n * be too long), and then calling {toEthSignedMessageHash} on it.\\n *\\n * Documentation for signature generation:\\n * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]\\n * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]\\n *\\n * _Available since v4.3._\\n */\\n function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) {\\n if (signature.length == 65) {\\n bytes32 r;\\n bytes32 s;\\n uint8 v;\\n // ecrecover takes the signature parameters, and the only way to get them\\n // currently is to use assembly.\\n /// @solidity memory-safe-assembly\\n assembly {\\n r := mload(add(signature, 0x20))\\n s := mload(add(signature, 0x40))\\n v := byte(0, mload(add(signature, 0x60)))\\n }\\n return tryRecover(hash, v, r, s);\\n } else {\\n return (address(0), RecoverError.InvalidSignatureLength);\\n }\\n }\\n\\n /**\\n * @dev Returns the address that signed a hashed message (`hash`) with\\n * `signature`. This address can then be used for verification purposes.\\n *\\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\\n * this function rejects them by requiring the `s` value to be in the lower\\n * half order, and the `v` value to be either 27 or 28.\\n *\\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\\n * verification to be secure: it is possible to craft signatures that\\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\\n * this is by receiving a hash of the original message (which may otherwise\\n * be too long), and then calling {toEthSignedMessageHash} on it.\\n */\\n function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {\\n (address recovered, RecoverError error) = tryRecover(hash, signature);\\n _throwError(error);\\n return recovered;\\n }\\n\\n /**\\n * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.\\n *\\n * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures]\\n *\\n * _Available since v4.3._\\n */\\n function tryRecover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address, RecoverError) {\\n bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff);\\n uint8 v = uint8((uint256(vs) >> 255) + 27);\\n return tryRecover(hash, v, r, s);\\n }\\n\\n /**\\n * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately.\\n *\\n * _Available since v4.2._\\n */\\n function recover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address) {\\n (address recovered, RecoverError error) = tryRecover(hash, r, vs);\\n _throwError(error);\\n return recovered;\\n }\\n\\n /**\\n * @dev Overload of {ECDSA-tryRecover} that receives the `v`,\\n * `r` and `s` signature fields separately.\\n *\\n * _Available since v4.3._\\n */\\n function tryRecover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) internal pure returns (address, RecoverError) {\\n // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature\\n // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines\\n // the valid range for s in (301): 0 < s < secp256k1n \\u00f7 2 + 1, and for v in (302): v \\u2208 {27, 28}. Most\\n // signatures from current libraries generate a unique signature with an s-value in the lower half order.\\n //\\n // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value\\n // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or\\n // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept\\n // these malleable signatures as well.\\n if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {\\n return (address(0), RecoverError.InvalidSignatureS);\\n }\\n\\n // If the signature is valid (and not malleable), return the signer address\\n address signer = ecrecover(hash, v, r, s);\\n if (signer == address(0)) {\\n return (address(0), RecoverError.InvalidSignature);\\n }\\n\\n return (signer, RecoverError.NoError);\\n }\\n\\n /**\\n * @dev Overload of {ECDSA-recover} that receives the `v`,\\n * `r` and `s` signature fields separately.\\n */\\n function recover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) internal pure returns (address) {\\n (address recovered, RecoverError error) = tryRecover(hash, v, r, s);\\n _throwError(error);\\n return recovered;\\n }\\n\\n /**\\n * @dev Returns an Ethereum Signed Message, created from a `hash`. This\\n * produces hash corresponding to the one signed with the\\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\\n * JSON-RPC method as part of EIP-191.\\n *\\n * See {recover}.\\n */\\n function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32 message) {\\n // 32 is the length in bytes of hash,\\n // enforced by the type signature above\\n /// @solidity memory-safe-assembly\\n assembly {\\n mstore(0x00, \\\"\\\\x19Ethereum Signed Message:\\\\n32\\\")\\n mstore(0x1c, hash)\\n message := keccak256(0x00, 0x3c)\\n }\\n }\\n\\n /**\\n * @dev Returns an Ethereum Signed Message, created from `s`. This\\n * produces hash corresponding to the one signed with the\\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\\n * JSON-RPC method as part of EIP-191.\\n *\\n * See {recover}.\\n */\\n function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) {\\n return keccak256(abi.encodePacked(\\\"\\\\x19Ethereum Signed Message:\\\\n\\\", Strings.toString(s.length), s));\\n }\\n\\n /**\\n * @dev Returns an Ethereum Signed Typed Data, created from a\\n * `domainSeparator` and a `structHash`. This produces hash corresponding\\n * to the one signed with the\\n * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`]\\n * JSON-RPC method as part of EIP-712.\\n *\\n * See {recover}.\\n */\\n function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32 data) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n let ptr := mload(0x40)\\n mstore(ptr, \\\"\\\\x19\\\\x01\\\")\\n mstore(add(ptr, 0x02), domainSeparator)\\n mstore(add(ptr, 0x22), structHash)\\n data := keccak256(ptr, 0x42)\\n }\\n }\\n\\n /**\\n * @dev Returns an Ethereum Signed Data with intended validator, created from a\\n * `validator` and `data` according to the version 0 of EIP-191.\\n *\\n * See {recover}.\\n */\\n function toDataWithIntendedValidatorHash(address validator, bytes memory data) internal pure returns (bytes32) {\\n return keccak256(abi.encodePacked(\\\"\\\\x19\\\\x00\\\", validator, data));\\n }\\n}\\n\",\"keccak256\":\"0x809bc3edb4bcbef8263fa616c1b60ee0004b50a8a1bfa164d8f57fd31f520c58\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/math/Math.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/math/Math.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Standard math utilities missing in the Solidity language.\\n */\\nlibrary Math {\\n enum Rounding {\\n Down, // Toward negative infinity\\n Up, // Toward infinity\\n Zero // Toward zero\\n }\\n\\n /**\\n * @dev Returns the largest of two numbers.\\n */\\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a > b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the smallest of two numbers.\\n */\\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a < b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the average of two numbers. The result is rounded towards\\n * zero.\\n */\\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\\n // (a + b) / 2 can overflow.\\n return (a & b) + (a ^ b) / 2;\\n }\\n\\n /**\\n * @dev Returns the ceiling of the division of two numbers.\\n *\\n * This differs from standard division with `/` in that it rounds up instead\\n * of rounding down.\\n */\\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\\n // (a + b - 1) / b can overflow on addition, so we distribute.\\n return a == 0 ? 0 : (a - 1) / b + 1;\\n }\\n\\n /**\\n * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\\n * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)\\n * with further edits by Uniswap Labs also under MIT license.\\n */\\n function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) {\\n unchecked {\\n // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use\\n // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256\\n // variables such that product = prod1 * 2^256 + prod0.\\n uint256 prod0; // Least significant 256 bits of the product\\n uint256 prod1; // Most significant 256 bits of the product\\n assembly {\\n let mm := mulmod(x, y, not(0))\\n prod0 := mul(x, y)\\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\\n }\\n\\n // Handle non-overflow cases, 256 by 256 division.\\n if (prod1 == 0) {\\n // Solidity will revert if denominator == 0, unlike the div opcode on its own.\\n // The surrounding unchecked block does not change this fact.\\n // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.\\n return prod0 / denominator;\\n }\\n\\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\\n require(denominator > prod1, \\\"Math: mulDiv overflow\\\");\\n\\n ///////////////////////////////////////////////\\n // 512 by 256 division.\\n ///////////////////////////////////////////////\\n\\n // Make division exact by subtracting the remainder from [prod1 prod0].\\n uint256 remainder;\\n assembly {\\n // Compute remainder using mulmod.\\n remainder := mulmod(x, y, denominator)\\n\\n // Subtract 256 bit number from 512 bit number.\\n prod1 := sub(prod1, gt(remainder, prod0))\\n prod0 := sub(prod0, remainder)\\n }\\n\\n // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.\\n // See https://cs.stackexchange.com/q/138556/92363.\\n\\n // Does not overflow because the denominator cannot be zero at this stage in the function.\\n uint256 twos = denominator & (~denominator + 1);\\n assembly {\\n // Divide denominator by twos.\\n denominator := div(denominator, twos)\\n\\n // Divide [prod1 prod0] by twos.\\n prod0 := div(prod0, twos)\\n\\n // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.\\n twos := add(div(sub(0, twos), twos), 1)\\n }\\n\\n // Shift in bits from prod1 into prod0.\\n prod0 |= prod1 * twos;\\n\\n // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such\\n // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for\\n // four bits. That is, denominator * inv = 1 mod 2^4.\\n uint256 inverse = (3 * denominator) ^ 2;\\n\\n // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works\\n // in modular arithmetic, doubling the correct bits in each step.\\n inverse *= 2 - denominator * inverse; // inverse mod 2^8\\n inverse *= 2 - denominator * inverse; // inverse mod 2^16\\n inverse *= 2 - denominator * inverse; // inverse mod 2^32\\n inverse *= 2 - denominator * inverse; // inverse mod 2^64\\n inverse *= 2 - denominator * inverse; // inverse mod 2^128\\n inverse *= 2 - denominator * inverse; // inverse mod 2^256\\n\\n // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.\\n // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is\\n // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1\\n // is no longer required.\\n result = prod0 * inverse;\\n return result;\\n }\\n }\\n\\n /**\\n * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.\\n */\\n function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) {\\n uint256 result = mulDiv(x, y, denominator);\\n if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {\\n result += 1;\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.\\n *\\n * Inspired by Henry S. Warren, Jr.'s \\\"Hacker's Delight\\\" (Chapter 11).\\n */\\n function sqrt(uint256 a) internal pure returns (uint256) {\\n if (a == 0) {\\n return 0;\\n }\\n\\n // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.\\n //\\n // We know that the \\\"msb\\\" (most significant bit) of our target number `a` is a power of 2 such that we have\\n // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\\n //\\n // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\\n // \\u2192 `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\\n // \\u2192 `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\\n //\\n // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\\n uint256 result = 1 << (log2(a) >> 1);\\n\\n // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,\\n // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at\\n // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision\\n // into the expected uint128 result.\\n unchecked {\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n return min(result, a / result);\\n }\\n }\\n\\n /**\\n * @notice Calculates sqrt(a), following the selected rounding direction.\\n */\\n function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = sqrt(a);\\n return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 2, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log2(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >> 128 > 0) {\\n value >>= 128;\\n result += 128;\\n }\\n if (value >> 64 > 0) {\\n value >>= 64;\\n result += 64;\\n }\\n if (value >> 32 > 0) {\\n value >>= 32;\\n result += 32;\\n }\\n if (value >> 16 > 0) {\\n value >>= 16;\\n result += 16;\\n }\\n if (value >> 8 > 0) {\\n value >>= 8;\\n result += 8;\\n }\\n if (value >> 4 > 0) {\\n value >>= 4;\\n result += 4;\\n }\\n if (value >> 2 > 0) {\\n value >>= 2;\\n result += 2;\\n }\\n if (value >> 1 > 0) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log2(value);\\n return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 10, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log10(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >= 10 ** 64) {\\n value /= 10 ** 64;\\n result += 64;\\n }\\n if (value >= 10 ** 32) {\\n value /= 10 ** 32;\\n result += 32;\\n }\\n if (value >= 10 ** 16) {\\n value /= 10 ** 16;\\n result += 16;\\n }\\n if (value >= 10 ** 8) {\\n value /= 10 ** 8;\\n result += 8;\\n }\\n if (value >= 10 ** 4) {\\n value /= 10 ** 4;\\n result += 4;\\n }\\n if (value >= 10 ** 2) {\\n value /= 10 ** 2;\\n result += 2;\\n }\\n if (value >= 10 ** 1) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log10(value);\\n return result + (rounding == Rounding.Up && 10 ** result < value ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 256, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n *\\n * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\\n */\\n function log256(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >> 128 > 0) {\\n value >>= 128;\\n result += 16;\\n }\\n if (value >> 64 > 0) {\\n value >>= 64;\\n result += 8;\\n }\\n if (value >> 32 > 0) {\\n value >>= 32;\\n result += 4;\\n }\\n if (value >> 16 > 0) {\\n value >>= 16;\\n result += 2;\\n }\\n if (value >> 8 > 0) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 256, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log256(value);\\n return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0);\\n }\\n }\\n}\\n\",\"keccak256\":\"0xe4455ac1eb7fc497bb7402579e7b4d64d928b846fce7d2b6fde06d366f21c2b3\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/math/SignedMath.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Standard signed math utilities missing in the Solidity language.\\n */\\nlibrary SignedMath {\\n /**\\n * @dev Returns the largest of two signed numbers.\\n */\\n function max(int256 a, int256 b) internal pure returns (int256) {\\n return a > b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the smallest of two signed numbers.\\n */\\n function min(int256 a, int256 b) internal pure returns (int256) {\\n return a < b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the average of two signed numbers without overflow.\\n * The result is rounded towards zero.\\n */\\n function average(int256 a, int256 b) internal pure returns (int256) {\\n // Formula from the book \\\"Hacker's Delight\\\"\\n int256 x = (a & b) + ((a ^ b) >> 1);\\n return x + (int256(uint256(x) >> 255) & (a ^ b));\\n }\\n\\n /**\\n * @dev Returns the absolute unsigned value of a signed value.\\n */\\n function abs(int256 n) internal pure returns (uint256) {\\n unchecked {\\n // must be unchecked in order to support `n = type(int256).min`\\n return uint256(n >= 0 ? n : -n);\\n }\\n }\\n}\\n\",\"keccak256\":\"0xf92515413956f529d95977adc9b0567d583c6203fc31ab1c23824c35187e3ddc\",\"license\":\"MIT\"},\"contracts/activity/TokenClaim.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity 0.8.19;\\n\\nimport {ReentrancyGuard} from \\\"@openzeppelin/contracts/security/ReentrancyGuard.sol\\\";\\nimport {Pausable} from \\\"@openzeppelin/contracts/security/Pausable.sol\\\";\\nimport {IERC20} from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport {SafeERC20} from \\\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\\\";\\nimport {HasSignature} from \\\"../core/HasSignature.sol\\\";\\nimport {TimeChecker} from \\\"../utils/TimeChecker.sol\\\";\\n\\ncontract TokenClaim is HasSignature, ReentrancyGuard, Pausable, TimeChecker {\\n using SafeERC20 for IERC20;\\n\\n uint256 public immutable _CACHED_CHAIN_ID;\\n address public immutable _CACHED_THIS;\\n address public verifier;\\n\\n mapping(address token => address wallet) public erc20Wallets;\\n\\n // store user's claimed amount\\n mapping(address user => mapping(address token => uint256 amount)) public claimedAmount;\\n\\n event EventERC20Wallet(address erc20, address wallet);\\n\\n event EventVerifierUpdated(address indexed verifier);\\n event EventTokenClaimed(address indexed user, address indexed token, address passport, uint256 amount, uint256 nonce);\\n\\n constructor(address _wallet, address _token, address _verifier, uint256 _duration) TimeChecker(_duration) {\\n _CACHED_CHAIN_ID = block.chainid;\\n _CACHED_THIS = address(this);\\n erc20Wallets[_token] = _wallet;\\n verifier = _verifier;\\n }\\n\\n /**\\n * @dev update verifier address\\n */\\n function updateVerifier(address _verifier) external onlyOwner {\\n require(_verifier != address(0), \\\"TokenClaim: address can not be zero\\\");\\n verifier = _verifier;\\n emit EventVerifierUpdated(_verifier);\\n }\\n\\n /**\\n * @dev update pause state\\n */\\n function pause() external onlyOwner {\\n _pause();\\n }\\n\\n /**\\n * @dev update unpause state\\n */\\n function unpause() external onlyOwner {\\n _unpause();\\n }\\n\\n /**\\n * @dev update ERC20 wallet\\n */\\n function updateERC20Wallet(address erc20, address wallet) external onlyOwner {\\n require(erc20Wallets[erc20] != wallet, \\\"TokenClaim: ERC20 wallet not changed\\\");\\n erc20Wallets[erc20] = wallet;\\n emit EventERC20Wallet(erc20, wallet);\\n }\\n\\n /**\\n * @dev claim CEC with signature\\n * @param account address which eligible to claim, only for event log\\n * @param token address of token\\n * @param amount amount of token\\n * @param signTime time of signature\\n * @param saltNonce nonce of signature\\n * @param signature signature of claim\\n */\\n\\n function claim(\\n address account,\\n address token,\\n uint256 amount,\\n uint256 signTime,\\n uint256 saltNonce,\\n bytes calldata signature\\n ) external signatureValid(signature) timeValid(signTime) nonReentrant whenNotPaused {\\n require(erc20Wallets[token] != address(0), \\\"TokenClaim: token is not supported\\\");\\n require(amount > 0, \\\"TokenClaim: amount is zero\\\");\\n address user = _msgSender();\\n bytes32 criteriaMessageHash = getMessageHash(\\n user,\\n account,\\n token,\\n amount,\\n _CACHED_THIS,\\n _CACHED_CHAIN_ID,\\n signTime,\\n saltNonce\\n );\\n checkSigner(verifier, criteriaMessageHash, signature);\\n _useSignature(signature);\\n claimedAmount[account][token] += amount;\\n IERC20(token).safeTransferFrom(erc20Wallets[token], user, amount);\\n emit EventTokenClaimed(user, token, account, amount, saltNonce);\\n }\\n\\n function getMessageHash(\\n address _user,\\n address _account,\\n address _token,\\n uint256 _amount,\\n address _contract,\\n uint256 _chainId,\\n uint256 _signTime,\\n uint256 _saltNonce\\n ) public pure returns (bytes32) {\\n bytes memory encoded = abi.encodePacked(\\n _user,\\n _account,\\n _token,\\n _amount,\\n _contract,\\n _chainId,\\n _signTime,\\n _saltNonce\\n );\\n return keccak256(encoded);\\n }\\n}\\n\",\"keccak256\":\"0xe17373f45cc96a0335dd91a2edc8c87b980f6cbc817469117e142cc747190dbb\",\"license\":\"MIT\"},\"contracts/core/HasSignature.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity 0.8.19;\\nimport {ECDSA} from \\\"@openzeppelin/contracts/utils/cryptography/ECDSA.sol\\\";\\nimport {Ownable} from \\\"@openzeppelin/contracts/access/Ownable.sol\\\";\\n\\ncontract HasSignature is Ownable {\\n mapping(bytes signature => bool status) private _usedSignatures;\\n\\n function checkSigner(\\n address signer,\\n bytes32 hash,\\n bytes memory signature\\n ) public pure {\\n bytes32 ethSignedMessageHash = ECDSA.toEthSignedMessageHash(hash);\\n\\n address recovered = ECDSA.recover(ethSignedMessageHash, signature);\\n require(recovered == signer, \\\"invalid signature\\\");\\n }\\n\\n modifier signatureValid(bytes calldata signature) {\\n require(\\n !_usedSignatures[signature],\\n \\\"signature used. please send another transaction with new signature\\\"\\n );\\n _;\\n }\\n\\n function _useSignature(bytes calldata signature) internal {\\n if (!_usedSignatures[signature]) {\\n _usedSignatures[signature] = true;\\n }\\n }\\n}\\n\",\"keccak256\":\"0x1999478f082b3dac416b579ea9385736e3015aa27ac7173c67555e21426ede51\",\"license\":\"MIT\"},\"contracts/utils/TimeChecker.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity 0.8.19;\\nimport {Ownable} from \\\"@openzeppelin/contracts/access/Ownable.sol\\\";\\n\\ncontract TimeChecker is Ownable {\\n uint256 public duration;\\n uint256 public minDuration;\\n\\n event DurationUpdated(uint256 indexed duration);\\n\\n constructor(uint256 _duration) {\\n duration = _duration;\\n minDuration = 30 minutes;\\n }\\n\\n /**\\n * @dev Check if the time is valid\\n */\\n modifier timeValid(uint256 time) {\\n require(\\n time + duration >= block.timestamp,\\n \\\"expired, please send another transaction with new signature\\\"\\n );\\n _;\\n }\\n\\n\\n /**\\n * @dev Change duration value\\n */\\n function updateDuation(uint256 valNew) external onlyOwner {\\n require(valNew > minDuration, \\\"duration too short\\\");\\n duration = valNew;\\n emit DurationUpdated(valNew);\\n }\\n}\\n\",\"keccak256\":\"0xeb1278f24da69d97bd3d0da549e0673fdfa0b319bf4ba2ed6b24fefa870f3af9\",\"license\":\"MIT\"}},\"version\":1}", - "bytecode": "0x60c03461011c57601f6113f538819003918201601f19168301916001600160401b038311848410176101215780849260809460405283398101031261011c5761004781610137565b61005360208301610137565b606061006160408501610137565b93015192600092835494604060018060a01b0319953387891617815581519760018060a01b039687948592833391167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08680a3600160025560ff1960035416600355600455610708600555466080523060a052168152600760205220911684825416179055169060065416176006556112a9908161014c82396080518181816107b80152610c8e015260a0518181816102bb01526107da0152f35b600080fd5b634e487b7160e01b600052604160045260246000fd5b51906001600160a01b038216820361011c5756fe6080604052600436101561001257600080fd5b6000803560e01c8062c4196e14610ccf5780630fb5a6b414610cb15780632b437d4814610c765780632b7ac3f314610c4d578063343685d1146106ca5780633f4ba83a1461063557806356715761146106175780635c975abb146105f45780636d04319414610594578063715018a61461053a5780637f9d3096146104ae5780638456cb59146104535780638da5cb5b1461042c57806397fc007c14610371578063c041136414610335578063c6d5813e146102ea578063da28b527146102a5578063de76cadb146101b05763f2fde38b146100ed57600080fd5b346101ad5760203660031901126101ad57610106610d37565b61010e610df3565b6001600160a01b039081169081156101595782546001600160a01b0319811683178455167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08380a380f35b60405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608490fd5b80fd5b50346101ad5760403660031901126101ad576101ca610d37565b6101d2610d52565b6101da610df3565b6001600160a01b039182168084526007602052604084205490929182169116811461025457816040917f75a33e8174368dc0792ac0a162a518ece06bebca5d2d915bf1a161b4fdc60cbf9385526007602052828520816bffffffffffffffffffffffff60a01b82541617905582519182526020820152a180f35b60405162461bcd60e51b8152602060048201526024808201527f546f6b656e436c61696d3a2045524332302077616c6c6574206e6f74206368616044820152631b99d95960e21b6064820152608490fd5b50346101ad57806003193601126101ad576040517f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168152602090f35b50346101ad5760403660031901126101ad576040602091610309610d37565b610311610d52565b6001600160a01b039182168352600885528383209116825283522054604051908152f35b50346101ad5760203660031901126101ad576020906001600160a01b03906040908261035f610d37565b16815260078452205416604051908152f35b50346101ad5760203660031901126101ad5761038b610d37565b610393610df3565b6001600160a01b031680156103db57600680546001600160a01b031916821790557f4635bfbeab18ad788a7fc2a516293118982d68d953206bd5f8c556890e72d7e58280a280f35b60405162461bcd60e51b815260206004820152602360248201527f546f6b656e436c61696d3a20616464726573732063616e206e6f74206265207a60448201526265726f60e81b6064820152608490fd5b50346101ad57806003193601126101ad57546040516001600160a01b039091168152602090f35b50346101ad57806003193601126101ad5761046c610df3565b610474610e4b565b600160ff1960035416176003557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586020604051338152a180f35b50346101ad5760203660031901126101ad576004356104cb610df3565b60055481111561050057806004557f91abcc2d6823e3a3f11d31b208dd3065d2c6a791f1c7c9fe96a42ce12897eac58280a280f35b60405162461bcd60e51b8152602060048201526012602482015271191d5c985d1a5bdb881d1bdbc81cda1bdc9d60721b6044820152606490fd5b50346101ad57806003193601126101ad57610553610df3565b80546001600160a01b03198116825581906001600160a01b03167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08280a380f35b50346101ad5760603660031901126101ad576105ae610d37565b6044359067ffffffffffffffff82116105f057366023830112156105f0576105e36105ed923690602481600401359101610dbc565b9060243590611003565b80f35b8280fd5b50346101ad57806003193601126101ad57602060ff600354166040519015158152f35b50346101ad57806003193601126101ad576020600554604051908152f35b50346101ad57806003193601126101ad5761064e610df3565b60035460ff81161561068e5760ff19166003557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa6020604051338152a180f35b60405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b6044820152606490fd5b50346101ad5760c03660031901126101ad576106e4610d37565b6106ec610d52565b9060a43567ffffffffffffffff8111610a2d5736602382011215610a2d5767ffffffffffffffff816004013511610a2d57366024826004013583010111610a2d5760ff60405182600401356024840182376020818460040135810160018152030190205416610bd757600454926107666064359485610e8f565b4211610b6c576002805414610b275760028055610781610e4b565b6001600160a01b03818116808752600760205260408720549095911615610ad75760443515610a925761082a9161080591608435917f0000000000000000000000000000000000000000000000000000000000000000907f000000000000000000000000000000000000000000000000000000000000000090604435908933610f86565b6006546001600160a01b03169061082436600486013560248701610dbc565b91611003565b60ff6040518260040135602484018237602081846004013581016001815203019020541615610a61575b5060018060a01b0316808352600860205260408320828452602052604083206108806044358254610e8f565b9055818352600760205260018060a01b036040842054166040519060208201906323b872dd60e01b8252602483015233604483015260443560648301526064825260a082019180831067ffffffffffffffff841117610a4d5760e0810183811067ffffffffffffffff821117610a3957604052602083527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c656460c08201525161095a92918691829182885af13d15610a31573d9061093c82610da0565b9161094a6040519384610d68565b82523d87602084013e5b85610eb2565b8051908115918215610a0a575b5050156109b257604051908152604435602082015260843560408201527fc5e576d85788400ff978578cc94a19ee7a30e8ee78d468f20ab2e305bef8411d60603392a3600160025580f35b60405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608490fd5b8192509060209181010312610a2d57602001518015158103610a2d573880610967565b8380fd5b606090610954565b634e487b7160e01b87526041600452602487fd5b634e487b7160e01b86526041600452602486fd5b6020604051828193600401356024820183376004013581016001815203019020600160ff1982541617905538610854565b60405162461bcd60e51b815260206004820152601a60248201527f546f6b656e436c61696d3a20616d6f756e74206973207a65726f0000000000006044820152606490fd5b60405162461bcd60e51b815260206004820152602260248201527f546f6b656e436c61696d3a20746f6b656e206973206e6f7420737570706f7274604482015261195960f21b6064820152608490fd5b60405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606490fd5b60405162461bcd60e51b815260206004820152603b60248201527f657870697265642c20706c656173652073656e6420616e6f746865722074726160448201527f6e73616374696f6e2077697468206e6577207369676e617475726500000000006064820152608490fd5b60405162461bcd60e51b815260206004820152604260248201527f7369676e617475726520757365642e20706c656173652073656e6420616e6f7460448201527f686572207472616e73616374696f6e2077697468206e6577207369676e617475606482015261726560f01b608482015260a490fd5b50346101ad57806003193601126101ad576006546040516001600160a01b039091168152602090f35b50346101ad57806003193601126101ad5760206040517f00000000000000000000000000000000000000000000000000000000000000008152f35b50346101ad57806003193601126101ad576020600454604051908152f35b50346101ad576101003660031901126101ad57610cea610d37565b90610cf3610d52565b604435916001600160a01b039081841684036101ad5760843591821682036101ad576020610d2f60e43560c43560a435866064358a8a8d610f86565b604051908152f35b600435906001600160a01b0382168203610d4d57565b600080fd5b602435906001600160a01b0382168203610d4d57565b90601f8019910116810190811067ffffffffffffffff821117610d8a57604052565b634e487b7160e01b600052604160045260246000fd5b67ffffffffffffffff8111610d8a57601f01601f191660200190565b929192610dc882610da0565b91610dd66040519384610d68565b829481845281830111610d4d578281602093846000960137010152565b6000546001600160a01b03163303610e0757565b606460405162461bcd60e51b815260206004820152602060248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152fd5b60ff60035416610e5757565b60405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b6044820152606490fd5b91908201809211610e9c57565b634e487b7160e01b600052601160045260246000fd5b91929015610f145750815115610ec6575090565b3b15610ecf5790565b60405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606490fd5b825190915015610f275750805190602001fd5b6040519062461bcd60e51b82528160208060048301528251908160248401526000935b828510610f6d575050604492506000838284010152601f80199101168101030190fd5b8481018201518686016044015293810193859350610f4a565b959390919694926040519660208801986bffffffffffffffffffffffff19809581809460601b168c5260601b1660348a015260601b166048880152605c87015260601b16607c850152609084015260b083015260d082015260d08152610100810181811067ffffffffffffffff821117610d8a5760405251902090565b906110459261103d917f19457468657265756d205369676e6564204d6573736167653a0a333200000000600052601c52603c6000206111ac565b929092611092565b6001600160a01b0390811691160361105957565b60405162461bcd60e51b8152602060048201526011602482015270696e76616c6964207369676e617475726560781b6044820152606490fd5b600581101561119657806110a35750565b600181036110f05760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e617475726500000000000000006044820152606490fd5b6002810361113d5760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e677468006044820152606490fd5b60031461114657565b60405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b6064820152608490fd5b634e487b7160e01b600052602160045260246000fd5b9060418151146000146111da576111d6916020820151906060604084015193015160001a906111e4565b9091565b5050600090600290565b9291907f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a083116112675791608094939160ff602094604051948552168484015260408301526060820152600093849182805260015afa1561125a5781516001600160a01b03811615611254579190565b50600190565b50604051903d90823e3d90fd5b5050505060009060039056fea26469706673582212203dc88b6df56100fd073b23bf6e2f3fe40401b7931cd0c5d7a149e861d3288f6064736f6c63430008130033", - "deployedBytecode": "0x6080604052600436101561001257600080fd5b6000803560e01c8062c4196e14610ccf5780630fb5a6b414610cb15780632b437d4814610c765780632b7ac3f314610c4d578063343685d1146106ca5780633f4ba83a1461063557806356715761146106175780635c975abb146105f45780636d04319414610594578063715018a61461053a5780637f9d3096146104ae5780638456cb59146104535780638da5cb5b1461042c57806397fc007c14610371578063c041136414610335578063c6d5813e146102ea578063da28b527146102a5578063de76cadb146101b05763f2fde38b146100ed57600080fd5b346101ad5760203660031901126101ad57610106610d37565b61010e610df3565b6001600160a01b039081169081156101595782546001600160a01b0319811683178455167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08380a380f35b60405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608490fd5b80fd5b50346101ad5760403660031901126101ad576101ca610d37565b6101d2610d52565b6101da610df3565b6001600160a01b039182168084526007602052604084205490929182169116811461025457816040917f75a33e8174368dc0792ac0a162a518ece06bebca5d2d915bf1a161b4fdc60cbf9385526007602052828520816bffffffffffffffffffffffff60a01b82541617905582519182526020820152a180f35b60405162461bcd60e51b8152602060048201526024808201527f546f6b656e436c61696d3a2045524332302077616c6c6574206e6f74206368616044820152631b99d95960e21b6064820152608490fd5b50346101ad57806003193601126101ad576040517f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168152602090f35b50346101ad5760403660031901126101ad576040602091610309610d37565b610311610d52565b6001600160a01b039182168352600885528383209116825283522054604051908152f35b50346101ad5760203660031901126101ad576020906001600160a01b03906040908261035f610d37565b16815260078452205416604051908152f35b50346101ad5760203660031901126101ad5761038b610d37565b610393610df3565b6001600160a01b031680156103db57600680546001600160a01b031916821790557f4635bfbeab18ad788a7fc2a516293118982d68d953206bd5f8c556890e72d7e58280a280f35b60405162461bcd60e51b815260206004820152602360248201527f546f6b656e436c61696d3a20616464726573732063616e206e6f74206265207a60448201526265726f60e81b6064820152608490fd5b50346101ad57806003193601126101ad57546040516001600160a01b039091168152602090f35b50346101ad57806003193601126101ad5761046c610df3565b610474610e4b565b600160ff1960035416176003557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586020604051338152a180f35b50346101ad5760203660031901126101ad576004356104cb610df3565b60055481111561050057806004557f91abcc2d6823e3a3f11d31b208dd3065d2c6a791f1c7c9fe96a42ce12897eac58280a280f35b60405162461bcd60e51b8152602060048201526012602482015271191d5c985d1a5bdb881d1bdbc81cda1bdc9d60721b6044820152606490fd5b50346101ad57806003193601126101ad57610553610df3565b80546001600160a01b03198116825581906001600160a01b03167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08280a380f35b50346101ad5760603660031901126101ad576105ae610d37565b6044359067ffffffffffffffff82116105f057366023830112156105f0576105e36105ed923690602481600401359101610dbc565b9060243590611003565b80f35b8280fd5b50346101ad57806003193601126101ad57602060ff600354166040519015158152f35b50346101ad57806003193601126101ad576020600554604051908152f35b50346101ad57806003193601126101ad5761064e610df3565b60035460ff81161561068e5760ff19166003557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa6020604051338152a180f35b60405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b6044820152606490fd5b50346101ad5760c03660031901126101ad576106e4610d37565b6106ec610d52565b9060a43567ffffffffffffffff8111610a2d5736602382011215610a2d5767ffffffffffffffff816004013511610a2d57366024826004013583010111610a2d5760ff60405182600401356024840182376020818460040135810160018152030190205416610bd757600454926107666064359485610e8f565b4211610b6c576002805414610b275760028055610781610e4b565b6001600160a01b03818116808752600760205260408720549095911615610ad75760443515610a925761082a9161080591608435917f0000000000000000000000000000000000000000000000000000000000000000907f000000000000000000000000000000000000000000000000000000000000000090604435908933610f86565b6006546001600160a01b03169061082436600486013560248701610dbc565b91611003565b60ff6040518260040135602484018237602081846004013581016001815203019020541615610a61575b5060018060a01b0316808352600860205260408320828452602052604083206108806044358254610e8f565b9055818352600760205260018060a01b036040842054166040519060208201906323b872dd60e01b8252602483015233604483015260443560648301526064825260a082019180831067ffffffffffffffff841117610a4d5760e0810183811067ffffffffffffffff821117610a3957604052602083527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c656460c08201525161095a92918691829182885af13d15610a31573d9061093c82610da0565b9161094a6040519384610d68565b82523d87602084013e5b85610eb2565b8051908115918215610a0a575b5050156109b257604051908152604435602082015260843560408201527fc5e576d85788400ff978578cc94a19ee7a30e8ee78d468f20ab2e305bef8411d60603392a3600160025580f35b60405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608490fd5b8192509060209181010312610a2d57602001518015158103610a2d573880610967565b8380fd5b606090610954565b634e487b7160e01b87526041600452602487fd5b634e487b7160e01b86526041600452602486fd5b6020604051828193600401356024820183376004013581016001815203019020600160ff1982541617905538610854565b60405162461bcd60e51b815260206004820152601a60248201527f546f6b656e436c61696d3a20616d6f756e74206973207a65726f0000000000006044820152606490fd5b60405162461bcd60e51b815260206004820152602260248201527f546f6b656e436c61696d3a20746f6b656e206973206e6f7420737570706f7274604482015261195960f21b6064820152608490fd5b60405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606490fd5b60405162461bcd60e51b815260206004820152603b60248201527f657870697265642c20706c656173652073656e6420616e6f746865722074726160448201527f6e73616374696f6e2077697468206e6577207369676e617475726500000000006064820152608490fd5b60405162461bcd60e51b815260206004820152604260248201527f7369676e617475726520757365642e20706c656173652073656e6420616e6f7460448201527f686572207472616e73616374696f6e2077697468206e6577207369676e617475606482015261726560f01b608482015260a490fd5b50346101ad57806003193601126101ad576006546040516001600160a01b039091168152602090f35b50346101ad57806003193601126101ad5760206040517f00000000000000000000000000000000000000000000000000000000000000008152f35b50346101ad57806003193601126101ad576020600454604051908152f35b50346101ad576101003660031901126101ad57610cea610d37565b90610cf3610d52565b604435916001600160a01b039081841684036101ad5760843591821682036101ad576020610d2f60e43560c43560a435866064358a8a8d610f86565b604051908152f35b600435906001600160a01b0382168203610d4d57565b600080fd5b602435906001600160a01b0382168203610d4d57565b90601f8019910116810190811067ffffffffffffffff821117610d8a57604052565b634e487b7160e01b600052604160045260246000fd5b67ffffffffffffffff8111610d8a57601f01601f191660200190565b929192610dc882610da0565b91610dd66040519384610d68565b829481845281830111610d4d578281602093846000960137010152565b6000546001600160a01b03163303610e0757565b606460405162461bcd60e51b815260206004820152602060248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152fd5b60ff60035416610e5757565b60405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b6044820152606490fd5b91908201809211610e9c57565b634e487b7160e01b600052601160045260246000fd5b91929015610f145750815115610ec6575090565b3b15610ecf5790565b60405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606490fd5b825190915015610f275750805190602001fd5b6040519062461bcd60e51b82528160208060048301528251908160248401526000935b828510610f6d575050604492506000838284010152601f80199101168101030190fd5b8481018201518686016044015293810193859350610f4a565b959390919694926040519660208801986bffffffffffffffffffffffff19809581809460601b168c5260601b1660348a015260601b166048880152605c87015260601b16607c850152609084015260b083015260d082015260d08152610100810181811067ffffffffffffffff821117610d8a5760405251902090565b906110459261103d917f19457468657265756d205369676e6564204d6573736167653a0a333200000000600052601c52603c6000206111ac565b929092611092565b6001600160a01b0390811691160361105957565b60405162461bcd60e51b8152602060048201526011602482015270696e76616c6964207369676e617475726560781b6044820152606490fd5b600581101561119657806110a35750565b600181036110f05760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e617475726500000000000000006044820152606490fd5b6002810361113d5760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e677468006044820152606490fd5b60031461114657565b60405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b6064820152608490fd5b634e487b7160e01b600052602160045260246000fd5b9060418151146000146111da576111d6916020820151906060604084015193015160001a906111e4565b9091565b5050600090600290565b9291907f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a083116112675791608094939160ff602094604051948552168484015260408301526060820152600093849182805260015afa1561125a5781516001600160a01b03811615611254579190565b50600190565b50604051903d90823e3d90fd5b5050505060009060039056fea26469706673582212203dc88b6df56100fd073b23bf6e2f3fe40401b7931cd0c5d7a149e861d3288f6064736f6c63430008130033", + "solcInputHash": "8d4e816c22b2b125316667293671f05d", + "metadata": "{\"compiler\":{\"version\":\"0.8.19+commit.7dd6d404\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_wallet\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_token\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_verifier\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_duration\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"duration\",\"type\":\"uint256\"}],\"name\":\"DurationUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"erc20\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"wallet\",\"type\":\"address\"}],\"name\":\"EventERC20Wallet\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"user\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"bit\",\"type\":\"uint256\"}],\"name\":\"EventTokenClaimed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"verifier\",\"type\":\"address\"}],\"name\":\"EventVerifierUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"Paused\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"Unpaused\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"_CACHED_CHAIN_ID\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"_CACHED_THIS\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"signer\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"hash\",\"type\":\"bytes32\"},{\"internalType\":\"bytes\",\"name\":\"signature\",\"type\":\"bytes\"}],\"name\":\"checkSigner\",\"outputs\":[],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"internalType\":\"uint256[4]\",\"name\":\"vals\",\"type\":\"uint256[4]\"},{\"internalType\":\"bytes\",\"name\":\"signature\",\"type\":\"bytes\"}],\"name\":\"claim\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"user\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"}],\"name\":\"claimedBitMap\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"claimedBit\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"duration\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"}],\"name\":\"erc20Wallets\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"wallet\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_user\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_account\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_token\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_contract\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_chainId\",\"type\":\"uint256\"},{\"internalType\":\"uint256[4]\",\"name\":\"_vals\",\"type\":\"uint256[4]\"}],\"name\":\"getMessageHash\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"minDuration\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"pause\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"paused\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"unpause\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"valNew\",\"type\":\"uint256\"}],\"name\":\"updateDuation\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"erc20\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"wallet\",\"type\":\"address\"}],\"name\":\"updateERC20Wallet\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_verifier\",\"type\":\"address\"}],\"name\":\"updateVerifier\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"verifier\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"events\":{\"Paused(address)\":{\"details\":\"Emitted when the pause is triggered by `account`.\"},\"Unpaused(address)\":{\"details\":\"Emitted when the pause is lifted by `account`.\"}},\"kind\":\"dev\",\"methods\":{\"claim(address,address,uint256[4],bytes)\":{\"details\":\"claim CEC with signature\",\"params\":{\"account\":\"address which eligible to claim, only for event log\",\"signature\":\"signature of claim\",\"token\":\"address of token\",\"vals\":\"array of amount, bit, signTime, saltNonce\"}},\"owner()\":{\"details\":\"Returns the address of the current owner.\"},\"pause()\":{\"details\":\"update pause state\"},\"paused()\":{\"details\":\"Returns true if the contract is paused, and false otherwise.\"},\"renounceOwnership()\":{\"details\":\"Leaves the contract without owner. It will not be possible to call `onlyOwner` functions. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby disabling any functionality that is only available to the owner.\"},\"transferOwnership(address)\":{\"details\":\"Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner.\"},\"unpause()\":{\"details\":\"update unpause state\"},\"updateDuation(uint256)\":{\"details\":\"Change duration value\"},\"updateERC20Wallet(address,address)\":{\"details\":\"update ERC20 wallet\"},\"updateVerifier(address)\":{\"details\":\"update verifier address\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/activity/TokenClaim.sol\":\"TokenClaim\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[],\"viaIR\":true},\"sources\":{\"@openzeppelin/contracts/access/Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../utils/Context.sol\\\";\\n\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\n * the owner.\\n */\\nabstract contract Ownable is Context {\\n address private _owner;\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the deployer as the initial owner.\\n */\\n constructor() {\\n _transferOwnership(_msgSender());\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n _checkOwner();\\n _;\\n }\\n\\n /**\\n * @dev Returns the address of the current owner.\\n */\\n function owner() public view virtual returns (address) {\\n return _owner;\\n }\\n\\n /**\\n * @dev Throws if the sender is not the owner.\\n */\\n function _checkOwner() internal view virtual {\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby disabling any functionality that is only available to the owner.\\n */\\n function renounceOwnership() public virtual onlyOwner {\\n _transferOwnership(address(0));\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\n _transferOwnership(newOwner);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Internal function without access restriction.\\n */\\n function _transferOwnership(address newOwner) internal virtual {\\n address oldOwner = _owner;\\n _owner = newOwner;\\n emit OwnershipTransferred(oldOwner, newOwner);\\n }\\n}\\n\",\"keccak256\":\"0xba43b97fba0d32eb4254f6a5a297b39a19a247082a02d6e69349e071e2946218\",\"license\":\"MIT\"},\"@openzeppelin/contracts/security/Pausable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (security/Pausable.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../utils/Context.sol\\\";\\n\\n/**\\n * @dev Contract module which allows children to implement an emergency stop\\n * mechanism that can be triggered by an authorized account.\\n *\\n * This module is used through inheritance. It will make available the\\n * modifiers `whenNotPaused` and `whenPaused`, which can be applied to\\n * the functions of your contract. Note that they will not be pausable by\\n * simply including this module, only once the modifiers are put in place.\\n */\\nabstract contract Pausable is Context {\\n /**\\n * @dev Emitted when the pause is triggered by `account`.\\n */\\n event Paused(address account);\\n\\n /**\\n * @dev Emitted when the pause is lifted by `account`.\\n */\\n event Unpaused(address account);\\n\\n bool private _paused;\\n\\n /**\\n * @dev Initializes the contract in unpaused state.\\n */\\n constructor() {\\n _paused = false;\\n }\\n\\n /**\\n * @dev 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 return _paused;\\n }\\n\\n /**\\n * @dev Throws if the contract is paused.\\n */\\n function _requireNotPaused() internal view virtual {\\n require(!paused(), \\\"Pausable: paused\\\");\\n }\\n\\n /**\\n * @dev Throws if the contract is not paused.\\n */\\n function _requirePaused() internal view virtual {\\n require(paused(), \\\"Pausable: not paused\\\");\\n }\\n\\n /**\\n * @dev Triggers stopped state.\\n *\\n * Requirements:\\n *\\n * - The contract must not be paused.\\n */\\n function _pause() internal virtual whenNotPaused {\\n _paused = true;\\n emit Paused(_msgSender());\\n }\\n\\n /**\\n * @dev Returns to normal state.\\n *\\n * Requirements:\\n *\\n * - The contract must be paused.\\n */\\n function _unpause() internal virtual whenPaused {\\n _paused = false;\\n emit Unpaused(_msgSender());\\n }\\n}\\n\",\"keccak256\":\"0x0849d93b16c9940beb286a7864ed02724b248b93e0d80ef6355af5ef15c64773\",\"license\":\"MIT\"},\"@openzeppelin/contracts/security/ReentrancyGuard.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (security/ReentrancyGuard.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Contract module that helps prevent reentrant calls to a function.\\n *\\n * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier\\n * available, which can be applied to functions to make sure there are no nested\\n * (reentrant) calls to them.\\n *\\n * Note that because there is a single `nonReentrant` guard, functions marked as\\n * `nonReentrant` may not call one another. This can be worked around by making\\n * those functions `private`, and then adding `external` `nonReentrant` entry\\n * points to them.\\n *\\n * TIP: If you would like to learn more about reentrancy and alternative ways\\n * to protect against it, check out our blog post\\n * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].\\n */\\nabstract contract ReentrancyGuard {\\n // Booleans are more expensive than uint256 or any type that takes up a full\\n // word because each write operation emits an extra SLOAD to first read the\\n // slot's contents, replace the bits taken up by the boolean, and then write\\n // back. This is the compiler's defense against contract upgrades and\\n // pointer aliasing, and it cannot be disabled.\\n\\n // The values being non-zero value makes deployment a bit more expensive,\\n // but in exchange the refund on every call to nonReentrant will be lower in\\n // amount. Since refunds are capped to a percentage of the total\\n // transaction's gas, it is best to keep them low in cases like this one, to\\n // increase the likelihood of the full refund coming into effect.\\n uint256 private constant _NOT_ENTERED = 1;\\n uint256 private constant _ENTERED = 2;\\n\\n uint256 private _status;\\n\\n constructor() {\\n _status = _NOT_ENTERED;\\n }\\n\\n /**\\n * @dev Prevents a contract from calling itself, directly or indirectly.\\n * Calling a `nonReentrant` function from another `nonReentrant`\\n * function is not supported. It is possible to prevent this from happening\\n * by making the `nonReentrant` function external, and making it call a\\n * `private` function that does the actual work.\\n */\\n modifier nonReentrant() {\\n _nonReentrantBefore();\\n _;\\n _nonReentrantAfter();\\n }\\n\\n function _nonReentrantBefore() private {\\n // On the first call to nonReentrant, _status will be _NOT_ENTERED\\n require(_status != _ENTERED, \\\"ReentrancyGuard: reentrant call\\\");\\n\\n // Any calls to nonReentrant after this point will fail\\n _status = _ENTERED;\\n }\\n\\n function _nonReentrantAfter() private {\\n // By storing the original value once again, a refund is triggered (see\\n // https://eips.ethereum.org/EIPS/eip-2200)\\n _status = _NOT_ENTERED;\\n }\\n\\n /**\\n * @dev Returns true if the reentrancy guard is currently set to \\\"entered\\\", which indicates there is a\\n * `nonReentrant` function in the call stack.\\n */\\n function _reentrancyGuardEntered() internal view returns (bool) {\\n return _status == _ENTERED;\\n }\\n}\\n\",\"keccak256\":\"0xa535a5df777d44e945dd24aa43a11e44b024140fc340ad0dfe42acf4002aade1\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\n */\\ninterface IERC20 {\\n /**\\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\\n * another (`to`).\\n *\\n * Note that `value` may be zero.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 value);\\n\\n /**\\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\\n * a call to {approve}. `value` is the new allowance.\\n */\\n event Approval(address indexed owner, address indexed spender, uint256 value);\\n\\n /**\\n * @dev Returns the amount of tokens in existence.\\n */\\n function totalSupply() external view returns (uint256);\\n\\n /**\\n * @dev Returns the amount of tokens owned by `account`.\\n */\\n function balanceOf(address account) external view returns (uint256);\\n\\n /**\\n * @dev Moves `amount` tokens from the caller's account to `to`.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transfer(address to, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Returns the remaining number of tokens that `spender` will be\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\n * zero by default.\\n *\\n * This value changes when {approve} or {transferFrom} are called.\\n */\\n function allowance(address owner, address spender) external view returns (uint256);\\n\\n /**\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\n * that someone may use both the old and the new allowance by unfortunate\\n * transaction ordering. One possible solution to mitigate this race\\n * condition is to first reduce the spender's allowance to 0 and set the\\n * desired value afterwards:\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address spender, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Moves `amount` tokens from `from` to `to` using the\\n * allowance mechanism. `amount` is then deducted from the caller's\\n * allowance.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(address from, address to, uint256 amount) external returns (bool);\\n}\\n\",\"keccak256\":\"0x287b55befed2961a7eabd7d7b1b2839cbca8a5b80ef8dcbb25ed3d4c2002c305\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/extensions/IERC20Permit.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.4) (token/ERC20/extensions/IERC20Permit.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\\n *\\n * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by\\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\\n * need to send a transaction, and thus is not required to hold Ether at all.\\n *\\n * ==== Security Considerations\\n *\\n * There are two important considerations concerning the use of `permit`. The first is that a valid permit signature\\n * expresses an allowance, and it should not be assumed to convey additional meaning. In particular, it should not be\\n * considered as an intention to spend the allowance in any specific way. The second is that because permits have\\n * built-in replay protection and can be submitted by anyone, they can be frontrun. A protocol that uses permits should\\n * take this into consideration and allow a `permit` call to fail. Combining these two aspects, a pattern that may be\\n * generally recommended is:\\n *\\n * ```solidity\\n * function doThingWithPermit(..., uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public {\\n * try token.permit(msg.sender, address(this), value, deadline, v, r, s) {} catch {}\\n * doThing(..., value);\\n * }\\n *\\n * function doThing(..., uint256 value) public {\\n * token.safeTransferFrom(msg.sender, address(this), value);\\n * ...\\n * }\\n * ```\\n *\\n * Observe that: 1) `msg.sender` is used as the owner, leaving no ambiguity as to the signer intent, and 2) the use of\\n * `try/catch` allows the permit to fail and makes the code tolerant to frontrunning. (See also\\n * {SafeERC20-safeTransferFrom}).\\n *\\n * Additionally, note that smart contract wallets (such as Argent or Safe) are not able to produce permit signatures, so\\n * contracts should have entry points that don't rely on permit.\\n */\\ninterface IERC20Permit {\\n /**\\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\\n * given ``owner``'s signed approval.\\n *\\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\\n * ordering also apply here.\\n *\\n * Emits an {Approval} event.\\n *\\n * Requirements:\\n *\\n * - `spender` cannot be the zero address.\\n * - `deadline` must be a timestamp in the future.\\n * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`\\n * over the EIP712-formatted function arguments.\\n * - the signature must use ``owner``'s current nonce (see {nonces}).\\n *\\n * For more information on the signature format, see the\\n * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP\\n * section].\\n *\\n * CAUTION: See Security Considerations above.\\n */\\n function permit(\\n address owner,\\n address spender,\\n uint256 value,\\n uint256 deadline,\\n uint8 v,\\n bytes32 r,\\n bytes32 s\\n ) external;\\n\\n /**\\n * @dev Returns the current nonce for `owner`. This value must be\\n * included whenever a signature is generated for {permit}.\\n *\\n * Every successful call to {permit} increases ``owner``'s nonce by one. This\\n * prevents a signature from being used multiple times.\\n */\\n function nonces(address owner) external view returns (uint256);\\n\\n /**\\n * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.\\n */\\n // solhint-disable-next-line func-name-mixedcase\\n function DOMAIN_SEPARATOR() external view returns (bytes32);\\n}\\n\",\"keccak256\":\"0xb264c03a3442eb37a68ad620cefd1182766b58bee6cec40343480392d6b14d69\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.3) (token/ERC20/utils/SafeERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../IERC20.sol\\\";\\nimport \\\"../extensions/IERC20Permit.sol\\\";\\nimport \\\"../../../utils/Address.sol\\\";\\n\\n/**\\n * @title SafeERC20\\n * @dev Wrappers around ERC20 operations that throw on failure (when the token\\n * contract returns false). Tokens that return no value (and instead revert or\\n * throw on failure) are also supported, non-reverting calls are assumed to be\\n * successful.\\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\\n */\\nlibrary SafeERC20 {\\n using Address for address;\\n\\n /**\\n * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,\\n * non-reverting calls are assumed to be successful.\\n */\\n function safeTransfer(IERC20 token, address to, uint256 value) internal {\\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\\n }\\n\\n /**\\n * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the\\n * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.\\n */\\n function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {\\n _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));\\n }\\n\\n /**\\n * @dev Deprecated. This function has issues similar to the ones found in\\n * {IERC20-approve}, and its usage is discouraged.\\n *\\n * Whenever possible, use {safeIncreaseAllowance} and\\n * {safeDecreaseAllowance} instead.\\n */\\n function safeApprove(IERC20 token, address spender, uint256 value) internal {\\n // safeApprove should only be called when setting an initial allowance,\\n // or when resetting it to zero. To increase and decrease it, use\\n // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'\\n require(\\n (value == 0) || (token.allowance(address(this), spender) == 0),\\n \\\"SafeERC20: approve from non-zero to non-zero allowance\\\"\\n );\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));\\n }\\n\\n /**\\n * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,\\n * non-reverting calls are assumed to be successful.\\n */\\n function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {\\n uint256 oldAllowance = token.allowance(address(this), spender);\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance + value));\\n }\\n\\n /**\\n * @dev Decrease the calling contract's allowance toward `spender` by `value`. If `token` returns no value,\\n * non-reverting calls are assumed to be successful.\\n */\\n function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal {\\n unchecked {\\n uint256 oldAllowance = token.allowance(address(this), spender);\\n require(oldAllowance >= value, \\\"SafeERC20: decreased allowance below zero\\\");\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance - value));\\n }\\n }\\n\\n /**\\n * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,\\n * non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval\\n * to be set to zero before setting it to a non-zero value, such as USDT.\\n */\\n function forceApprove(IERC20 token, address spender, uint256 value) internal {\\n bytes memory approvalCall = abi.encodeWithSelector(token.approve.selector, spender, value);\\n\\n if (!_callOptionalReturnBool(token, approvalCall)) {\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, 0));\\n _callOptionalReturn(token, approvalCall);\\n }\\n }\\n\\n /**\\n * @dev Use a ERC-2612 signature to set the `owner` approval toward `spender` on `token`.\\n * Revert on invalid signature.\\n */\\n function safePermit(\\n IERC20Permit token,\\n address owner,\\n address spender,\\n uint256 value,\\n uint256 deadline,\\n uint8 v,\\n bytes32 r,\\n bytes32 s\\n ) internal {\\n uint256 nonceBefore = token.nonces(owner);\\n token.permit(owner, spender, value, deadline, v, r, s);\\n uint256 nonceAfter = token.nonces(owner);\\n require(nonceAfter == nonceBefore + 1, \\\"SafeERC20: permit did not succeed\\\");\\n }\\n\\n /**\\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\\n * on the return value: the return value is optional (but if data is returned, it must not be false).\\n * @param token The token targeted by the call.\\n * @param data The call data (encoded using abi.encode or one of its variants).\\n */\\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\\n // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that\\n // the target address contains contract code and also asserts for success in the low-level call.\\n\\n bytes memory returndata = address(token).functionCall(data, \\\"SafeERC20: low-level call failed\\\");\\n require(returndata.length == 0 || abi.decode(returndata, (bool)), \\\"SafeERC20: ERC20 operation did not succeed\\\");\\n }\\n\\n /**\\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\\n * on the return value: the return value is optional (but if data is returned, it must not be false).\\n * @param token The token targeted by the call.\\n * @param data The call data (encoded using abi.encode or one of its variants).\\n *\\n * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.\\n */\\n function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {\\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\\n // we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false\\n // and not revert is the subcall reverts.\\n\\n (bool success, bytes memory returndata) = address(token).call(data);\\n return\\n success && (returndata.length == 0 || abi.decode(returndata, (bool))) && Address.isContract(address(token));\\n }\\n}\\n\",\"keccak256\":\"0xabefac93435967b4d36a4fabcbdbb918d1f0b7ae3c3d85bc30923b326c927ed1\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary Address {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n *\\n * Furthermore, `isContract` will also return true if the target contract within\\n * the same transaction is already scheduled for destruction by `SELFDESTRUCT`,\\n * which only has an effect at the end of a transaction.\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\\n *\\n * _Available since v4.8._\\n */\\n function verifyCallResultFromTarget(\\n address target,\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n if (success) {\\n if (returndata.length == 0) {\\n // only check isContract if the call was successful and the return data is empty\\n // otherwise we already know that it was a contract\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n }\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason or using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n /// @solidity memory-safe-assembly\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x006dd67219697fe68d7fbfdea512e7c4cb64a43565ed86171d67e844982da6fa\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.4) (utils/Context.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract Context {\\n function _msgSender() internal view virtual returns (address) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes calldata) {\\n return msg.data;\\n }\\n\\n function _contextSuffixLength() internal view virtual returns (uint256) {\\n return 0;\\n }\\n}\\n\",\"keccak256\":\"0xa92e4fa126feb6907daa0513ddd816b2eb91f30a808de54f63c17d0e162c3439\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Strings.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Strings.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./math/Math.sol\\\";\\nimport \\\"./math/SignedMath.sol\\\";\\n\\n/**\\n * @dev String operations.\\n */\\nlibrary Strings {\\n bytes16 private constant _SYMBOLS = \\\"0123456789abcdef\\\";\\n uint8 private constant _ADDRESS_LENGTH = 20;\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\\n */\\n function toString(uint256 value) internal pure returns (string memory) {\\n unchecked {\\n uint256 length = Math.log10(value) + 1;\\n string memory buffer = new string(length);\\n uint256 ptr;\\n /// @solidity memory-safe-assembly\\n assembly {\\n ptr := add(buffer, add(32, length))\\n }\\n while (true) {\\n ptr--;\\n /// @solidity memory-safe-assembly\\n assembly {\\n mstore8(ptr, byte(mod(value, 10), _SYMBOLS))\\n }\\n value /= 10;\\n if (value == 0) break;\\n }\\n return buffer;\\n }\\n }\\n\\n /**\\n * @dev Converts a `int256` to its ASCII `string` decimal representation.\\n */\\n function toString(int256 value) internal pure returns (string memory) {\\n return string(abi.encodePacked(value < 0 ? \\\"-\\\" : \\\"\\\", toString(SignedMath.abs(value))));\\n }\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\\n */\\n function toHexString(uint256 value) internal pure returns (string memory) {\\n unchecked {\\n return toHexString(value, Math.log256(value) + 1);\\n }\\n }\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\\n */\\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\\n bytes memory buffer = new bytes(2 * length + 2);\\n buffer[0] = \\\"0\\\";\\n buffer[1] = \\\"x\\\";\\n for (uint256 i = 2 * length + 1; i > 1; --i) {\\n buffer[i] = _SYMBOLS[value & 0xf];\\n value >>= 4;\\n }\\n require(value == 0, \\\"Strings: hex length insufficient\\\");\\n return string(buffer);\\n }\\n\\n /**\\n * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.\\n */\\n function toHexString(address addr) internal pure returns (string memory) {\\n return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\\n }\\n\\n /**\\n * @dev Returns true if the two strings are equal.\\n */\\n function equal(string memory a, string memory b) internal pure returns (bool) {\\n return keccak256(bytes(a)) == keccak256(bytes(b));\\n }\\n}\\n\",\"keccak256\":\"0x3088eb2868e8d13d89d16670b5f8612c4ab9ff8956272837d8e90106c59c14a0\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/cryptography/ECDSA.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/cryptography/ECDSA.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../Strings.sol\\\";\\n\\n/**\\n * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.\\n *\\n * These functions can be used to verify that a message was signed by the holder\\n * of the private keys of a given address.\\n */\\nlibrary ECDSA {\\n enum RecoverError {\\n NoError,\\n InvalidSignature,\\n InvalidSignatureLength,\\n InvalidSignatureS,\\n InvalidSignatureV // Deprecated in v4.8\\n }\\n\\n function _throwError(RecoverError error) private pure {\\n if (error == RecoverError.NoError) {\\n return; // no error: do nothing\\n } else if (error == RecoverError.InvalidSignature) {\\n revert(\\\"ECDSA: invalid signature\\\");\\n } else if (error == RecoverError.InvalidSignatureLength) {\\n revert(\\\"ECDSA: invalid signature length\\\");\\n } else if (error == RecoverError.InvalidSignatureS) {\\n revert(\\\"ECDSA: invalid signature 's' value\\\");\\n }\\n }\\n\\n /**\\n * @dev Returns the address that signed a hashed message (`hash`) with\\n * `signature` or error string. This address can then be used for verification purposes.\\n *\\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\\n * this function rejects them by requiring the `s` value to be in the lower\\n * half order, and the `v` value to be either 27 or 28.\\n *\\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\\n * verification to be secure: it is possible to craft signatures that\\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\\n * this is by receiving a hash of the original message (which may otherwise\\n * be too long), and then calling {toEthSignedMessageHash} on it.\\n *\\n * Documentation for signature generation:\\n * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]\\n * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]\\n *\\n * _Available since v4.3._\\n */\\n function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) {\\n if (signature.length == 65) {\\n bytes32 r;\\n bytes32 s;\\n uint8 v;\\n // ecrecover takes the signature parameters, and the only way to get them\\n // currently is to use assembly.\\n /// @solidity memory-safe-assembly\\n assembly {\\n r := mload(add(signature, 0x20))\\n s := mload(add(signature, 0x40))\\n v := byte(0, mload(add(signature, 0x60)))\\n }\\n return tryRecover(hash, v, r, s);\\n } else {\\n return (address(0), RecoverError.InvalidSignatureLength);\\n }\\n }\\n\\n /**\\n * @dev Returns the address that signed a hashed message (`hash`) with\\n * `signature`. This address can then be used for verification purposes.\\n *\\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\\n * this function rejects them by requiring the `s` value to be in the lower\\n * half order, and the `v` value to be either 27 or 28.\\n *\\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\\n * verification to be secure: it is possible to craft signatures that\\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\\n * this is by receiving a hash of the original message (which may otherwise\\n * be too long), and then calling {toEthSignedMessageHash} on it.\\n */\\n function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {\\n (address recovered, RecoverError error) = tryRecover(hash, signature);\\n _throwError(error);\\n return recovered;\\n }\\n\\n /**\\n * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.\\n *\\n * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures]\\n *\\n * _Available since v4.3._\\n */\\n function tryRecover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address, RecoverError) {\\n bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff);\\n uint8 v = uint8((uint256(vs) >> 255) + 27);\\n return tryRecover(hash, v, r, s);\\n }\\n\\n /**\\n * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately.\\n *\\n * _Available since v4.2._\\n */\\n function recover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address) {\\n (address recovered, RecoverError error) = tryRecover(hash, r, vs);\\n _throwError(error);\\n return recovered;\\n }\\n\\n /**\\n * @dev Overload of {ECDSA-tryRecover} that receives the `v`,\\n * `r` and `s` signature fields separately.\\n *\\n * _Available since v4.3._\\n */\\n function tryRecover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) internal pure returns (address, RecoverError) {\\n // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature\\n // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines\\n // the valid range for s in (301): 0 < s < secp256k1n \\u00f7 2 + 1, and for v in (302): v \\u2208 {27, 28}. Most\\n // signatures from current libraries generate a unique signature with an s-value in the lower half order.\\n //\\n // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value\\n // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or\\n // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept\\n // these malleable signatures as well.\\n if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {\\n return (address(0), RecoverError.InvalidSignatureS);\\n }\\n\\n // If the signature is valid (and not malleable), return the signer address\\n address signer = ecrecover(hash, v, r, s);\\n if (signer == address(0)) {\\n return (address(0), RecoverError.InvalidSignature);\\n }\\n\\n return (signer, RecoverError.NoError);\\n }\\n\\n /**\\n * @dev Overload of {ECDSA-recover} that receives the `v`,\\n * `r` and `s` signature fields separately.\\n */\\n function recover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) internal pure returns (address) {\\n (address recovered, RecoverError error) = tryRecover(hash, v, r, s);\\n _throwError(error);\\n return recovered;\\n }\\n\\n /**\\n * @dev Returns an Ethereum Signed Message, created from a `hash`. This\\n * produces hash corresponding to the one signed with the\\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\\n * JSON-RPC method as part of EIP-191.\\n *\\n * See {recover}.\\n */\\n function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32 message) {\\n // 32 is the length in bytes of hash,\\n // enforced by the type signature above\\n /// @solidity memory-safe-assembly\\n assembly {\\n mstore(0x00, \\\"\\\\x19Ethereum Signed Message:\\\\n32\\\")\\n mstore(0x1c, hash)\\n message := keccak256(0x00, 0x3c)\\n }\\n }\\n\\n /**\\n * @dev Returns an Ethereum Signed Message, created from `s`. This\\n * produces hash corresponding to the one signed with the\\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\\n * JSON-RPC method as part of EIP-191.\\n *\\n * See {recover}.\\n */\\n function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) {\\n return keccak256(abi.encodePacked(\\\"\\\\x19Ethereum Signed Message:\\\\n\\\", Strings.toString(s.length), s));\\n }\\n\\n /**\\n * @dev Returns an Ethereum Signed Typed Data, created from a\\n * `domainSeparator` and a `structHash`. This produces hash corresponding\\n * to the one signed with the\\n * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`]\\n * JSON-RPC method as part of EIP-712.\\n *\\n * See {recover}.\\n */\\n function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32 data) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n let ptr := mload(0x40)\\n mstore(ptr, \\\"\\\\x19\\\\x01\\\")\\n mstore(add(ptr, 0x02), domainSeparator)\\n mstore(add(ptr, 0x22), structHash)\\n data := keccak256(ptr, 0x42)\\n }\\n }\\n\\n /**\\n * @dev Returns an Ethereum Signed Data with intended validator, created from a\\n * `validator` and `data` according to the version 0 of EIP-191.\\n *\\n * See {recover}.\\n */\\n function toDataWithIntendedValidatorHash(address validator, bytes memory data) internal pure returns (bytes32) {\\n return keccak256(abi.encodePacked(\\\"\\\\x19\\\\x00\\\", validator, data));\\n }\\n}\\n\",\"keccak256\":\"0x809bc3edb4bcbef8263fa616c1b60ee0004b50a8a1bfa164d8f57fd31f520c58\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/math/Math.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/math/Math.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Standard math utilities missing in the Solidity language.\\n */\\nlibrary Math {\\n enum Rounding {\\n Down, // Toward negative infinity\\n Up, // Toward infinity\\n Zero // Toward zero\\n }\\n\\n /**\\n * @dev Returns the largest of two numbers.\\n */\\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a > b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the smallest of two numbers.\\n */\\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a < b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the average of two numbers. The result is rounded towards\\n * zero.\\n */\\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\\n // (a + b) / 2 can overflow.\\n return (a & b) + (a ^ b) / 2;\\n }\\n\\n /**\\n * @dev Returns the ceiling of the division of two numbers.\\n *\\n * This differs from standard division with `/` in that it rounds up instead\\n * of rounding down.\\n */\\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\\n // (a + b - 1) / b can overflow on addition, so we distribute.\\n return a == 0 ? 0 : (a - 1) / b + 1;\\n }\\n\\n /**\\n * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\\n * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)\\n * with further edits by Uniswap Labs also under MIT license.\\n */\\n function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) {\\n unchecked {\\n // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use\\n // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256\\n // variables such that product = prod1 * 2^256 + prod0.\\n uint256 prod0; // Least significant 256 bits of the product\\n uint256 prod1; // Most significant 256 bits of the product\\n assembly {\\n let mm := mulmod(x, y, not(0))\\n prod0 := mul(x, y)\\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\\n }\\n\\n // Handle non-overflow cases, 256 by 256 division.\\n if (prod1 == 0) {\\n // Solidity will revert if denominator == 0, unlike the div opcode on its own.\\n // The surrounding unchecked block does not change this fact.\\n // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.\\n return prod0 / denominator;\\n }\\n\\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\\n require(denominator > prod1, \\\"Math: mulDiv overflow\\\");\\n\\n ///////////////////////////////////////////////\\n // 512 by 256 division.\\n ///////////////////////////////////////////////\\n\\n // Make division exact by subtracting the remainder from [prod1 prod0].\\n uint256 remainder;\\n assembly {\\n // Compute remainder using mulmod.\\n remainder := mulmod(x, y, denominator)\\n\\n // Subtract 256 bit number from 512 bit number.\\n prod1 := sub(prod1, gt(remainder, prod0))\\n prod0 := sub(prod0, remainder)\\n }\\n\\n // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.\\n // See https://cs.stackexchange.com/q/138556/92363.\\n\\n // Does not overflow because the denominator cannot be zero at this stage in the function.\\n uint256 twos = denominator & (~denominator + 1);\\n assembly {\\n // Divide denominator by twos.\\n denominator := div(denominator, twos)\\n\\n // Divide [prod1 prod0] by twos.\\n prod0 := div(prod0, twos)\\n\\n // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.\\n twos := add(div(sub(0, twos), twos), 1)\\n }\\n\\n // Shift in bits from prod1 into prod0.\\n prod0 |= prod1 * twos;\\n\\n // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such\\n // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for\\n // four bits. That is, denominator * inv = 1 mod 2^4.\\n uint256 inverse = (3 * denominator) ^ 2;\\n\\n // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works\\n // in modular arithmetic, doubling the correct bits in each step.\\n inverse *= 2 - denominator * inverse; // inverse mod 2^8\\n inverse *= 2 - denominator * inverse; // inverse mod 2^16\\n inverse *= 2 - denominator * inverse; // inverse mod 2^32\\n inverse *= 2 - denominator * inverse; // inverse mod 2^64\\n inverse *= 2 - denominator * inverse; // inverse mod 2^128\\n inverse *= 2 - denominator * inverse; // inverse mod 2^256\\n\\n // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.\\n // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is\\n // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1\\n // is no longer required.\\n result = prod0 * inverse;\\n return result;\\n }\\n }\\n\\n /**\\n * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.\\n */\\n function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) {\\n uint256 result = mulDiv(x, y, denominator);\\n if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {\\n result += 1;\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.\\n *\\n * Inspired by Henry S. Warren, Jr.'s \\\"Hacker's Delight\\\" (Chapter 11).\\n */\\n function sqrt(uint256 a) internal pure returns (uint256) {\\n if (a == 0) {\\n return 0;\\n }\\n\\n // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.\\n //\\n // We know that the \\\"msb\\\" (most significant bit) of our target number `a` is a power of 2 such that we have\\n // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\\n //\\n // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\\n // \\u2192 `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\\n // \\u2192 `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\\n //\\n // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\\n uint256 result = 1 << (log2(a) >> 1);\\n\\n // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,\\n // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at\\n // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision\\n // into the expected uint128 result.\\n unchecked {\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n return min(result, a / result);\\n }\\n }\\n\\n /**\\n * @notice Calculates sqrt(a), following the selected rounding direction.\\n */\\n function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = sqrt(a);\\n return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 2, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log2(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >> 128 > 0) {\\n value >>= 128;\\n result += 128;\\n }\\n if (value >> 64 > 0) {\\n value >>= 64;\\n result += 64;\\n }\\n if (value >> 32 > 0) {\\n value >>= 32;\\n result += 32;\\n }\\n if (value >> 16 > 0) {\\n value >>= 16;\\n result += 16;\\n }\\n if (value >> 8 > 0) {\\n value >>= 8;\\n result += 8;\\n }\\n if (value >> 4 > 0) {\\n value >>= 4;\\n result += 4;\\n }\\n if (value >> 2 > 0) {\\n value >>= 2;\\n result += 2;\\n }\\n if (value >> 1 > 0) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log2(value);\\n return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 10, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log10(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >= 10 ** 64) {\\n value /= 10 ** 64;\\n result += 64;\\n }\\n if (value >= 10 ** 32) {\\n value /= 10 ** 32;\\n result += 32;\\n }\\n if (value >= 10 ** 16) {\\n value /= 10 ** 16;\\n result += 16;\\n }\\n if (value >= 10 ** 8) {\\n value /= 10 ** 8;\\n result += 8;\\n }\\n if (value >= 10 ** 4) {\\n value /= 10 ** 4;\\n result += 4;\\n }\\n if (value >= 10 ** 2) {\\n value /= 10 ** 2;\\n result += 2;\\n }\\n if (value >= 10 ** 1) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log10(value);\\n return result + (rounding == Rounding.Up && 10 ** result < value ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 256, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n *\\n * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\\n */\\n function log256(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >> 128 > 0) {\\n value >>= 128;\\n result += 16;\\n }\\n if (value >> 64 > 0) {\\n value >>= 64;\\n result += 8;\\n }\\n if (value >> 32 > 0) {\\n value >>= 32;\\n result += 4;\\n }\\n if (value >> 16 > 0) {\\n value >>= 16;\\n result += 2;\\n }\\n if (value >> 8 > 0) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 256, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log256(value);\\n return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0);\\n }\\n }\\n}\\n\",\"keccak256\":\"0xe4455ac1eb7fc497bb7402579e7b4d64d928b846fce7d2b6fde06d366f21c2b3\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/math/SignedMath.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Standard signed math utilities missing in the Solidity language.\\n */\\nlibrary SignedMath {\\n /**\\n * @dev Returns the largest of two signed numbers.\\n */\\n function max(int256 a, int256 b) internal pure returns (int256) {\\n return a > b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the smallest of two signed numbers.\\n */\\n function min(int256 a, int256 b) internal pure returns (int256) {\\n return a < b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the average of two signed numbers without overflow.\\n * The result is rounded towards zero.\\n */\\n function average(int256 a, int256 b) internal pure returns (int256) {\\n // Formula from the book \\\"Hacker's Delight\\\"\\n int256 x = (a & b) + ((a ^ b) >> 1);\\n return x + (int256(uint256(x) >> 255) & (a ^ b));\\n }\\n\\n /**\\n * @dev Returns the absolute unsigned value of a signed value.\\n */\\n function abs(int256 n) internal pure returns (uint256) {\\n unchecked {\\n // must be unchecked in order to support `n = type(int256).min`\\n return uint256(n >= 0 ? n : -n);\\n }\\n }\\n}\\n\",\"keccak256\":\"0xf92515413956f529d95977adc9b0567d583c6203fc31ab1c23824c35187e3ddc\",\"license\":\"MIT\"},\"contracts/activity/TokenClaim.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity 0.8.19;\\n\\nimport {ReentrancyGuard} from \\\"@openzeppelin/contracts/security/ReentrancyGuard.sol\\\";\\nimport {Pausable} from \\\"@openzeppelin/contracts/security/Pausable.sol\\\";\\nimport {IERC20} from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport {SafeERC20} from \\\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\\\";\\nimport {HasSignature} from \\\"../core/HasSignature.sol\\\";\\nimport {TimeChecker} from \\\"../utils/TimeChecker.sol\\\";\\n\\ncontract TokenClaim is HasSignature, ReentrancyGuard, Pausable, TimeChecker {\\n using SafeERC20 for IERC20;\\n\\n uint256 public immutable _CACHED_CHAIN_ID;\\n address public immutable _CACHED_THIS;\\n address public verifier;\\n\\n mapping(address token => address wallet) public erc20Wallets;\\n\\n // store user's claimed status\\n mapping(address user => mapping(address token => uint256 claimedBit)) public claimedBitMap;\\n\\n event EventERC20Wallet(address erc20, address wallet);\\n\\n event EventVerifierUpdated(address indexed verifier);\\n event EventTokenClaimed(address indexed user, address indexed token, address account, uint256 amount, uint256 bit);\\n\\n constructor(address _wallet, address _token, address _verifier, uint256 _duration) TimeChecker(_duration) {\\n _CACHED_CHAIN_ID = block.chainid;\\n _CACHED_THIS = address(this);\\n erc20Wallets[_token] = _wallet;\\n verifier = _verifier;\\n }\\n\\n /**\\n * @dev update verifier address\\n */\\n function updateVerifier(address _verifier) external onlyOwner {\\n require(_verifier != address(0), \\\"TokenClaim: address can not be zero\\\");\\n verifier = _verifier;\\n emit EventVerifierUpdated(_verifier);\\n }\\n\\n /**\\n * @dev update pause state\\n */\\n function pause() external onlyOwner {\\n _pause();\\n }\\n\\n /**\\n * @dev update unpause state\\n */\\n function unpause() external onlyOwner {\\n _unpause();\\n }\\n\\n /**\\n * @dev update ERC20 wallet\\n */\\n function updateERC20Wallet(address erc20, address wallet) external onlyOwner {\\n require(erc20Wallets[erc20] != wallet, \\\"TokenClaim: ERC20 wallet not changed\\\");\\n erc20Wallets[erc20] = wallet;\\n emit EventERC20Wallet(erc20, wallet);\\n }\\n\\n /**\\n * @dev claim CEC with signature\\n * @param account address which eligible to claim, only for event log\\n * @param token address of token\\n * @param vals array of amount, bit, signTime, saltNonce\\n * @param signature signature of claim\\n */\\n\\n function claim(\\n address account,\\n address token,\\n uint256[4] calldata vals, // amount, bit, signTime, saltNonce\\n bytes calldata signature\\n ) external signatureValid(signature) timeValid(vals[2]) nonReentrant whenNotPaused {\\n require(erc20Wallets[token] != address(0), \\\"TokenClaim: token is not supported\\\");\\n require(vals[0] > 0, \\\"TokenClaim: amount is zero\\\");\\n uint256 current = claimedBitMap[account][token];\\n require(current & vals[1] == 0, \\\"TokenClaim: condition check failed\\\");\\n address user = _msgSender();\\n bytes32 criteriaMessageHash = getMessageHash(\\n user,\\n account,\\n token,\\n _CACHED_THIS,\\n _CACHED_CHAIN_ID,\\n vals\\n );\\n checkSigner(verifier, criteriaMessageHash, signature);\\n _useSignature(signature);\\n claimedBitMap[account][token] = current | vals[1];\\n IERC20(token).safeTransferFrom(erc20Wallets[token], user, vals[0]);\\n emit EventTokenClaimed(user, token, account, vals[0], vals[1]);\\n }\\n\\n function getMessageHash(\\n address _user,\\n address _account,\\n address _token,\\n address _contract,\\n uint256 _chainId,\\n uint256[4] calldata _vals\\n ) public pure returns (bytes32) {\\n bytes memory encoded = abi.encodePacked(\\n _user,\\n _account,\\n _token,\\n _contract,\\n _chainId\\n );\\n for (uint256 i = 0; i < _vals.length; i++) {\\n encoded = bytes.concat(encoded, abi.encodePacked(_vals[i]));\\n }\\n return keccak256(encoded);\\n }\\n}\\n\",\"keccak256\":\"0x00f5205a161a46f58e11550d39bf0f6e6016ff22748b3330b785aa0de5c7f7dc\",\"license\":\"MIT\"},\"contracts/core/HasSignature.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity 0.8.19;\\nimport {ECDSA} from \\\"@openzeppelin/contracts/utils/cryptography/ECDSA.sol\\\";\\nimport {Ownable} from \\\"@openzeppelin/contracts/access/Ownable.sol\\\";\\n\\ncontract HasSignature is Ownable {\\n mapping(bytes signature => bool status) private _usedSignatures;\\n\\n function checkSigner(\\n address signer,\\n bytes32 hash,\\n bytes memory signature\\n ) public pure {\\n bytes32 ethSignedMessageHash = ECDSA.toEthSignedMessageHash(hash);\\n\\n address recovered = ECDSA.recover(ethSignedMessageHash, signature);\\n require(recovered == signer, \\\"invalid signature\\\");\\n }\\n\\n modifier signatureValid(bytes calldata signature) {\\n require(\\n !_usedSignatures[signature],\\n \\\"signature used. please send another transaction with new signature\\\"\\n );\\n _;\\n }\\n\\n function _useSignature(bytes calldata signature) internal {\\n if (!_usedSignatures[signature]) {\\n _usedSignatures[signature] = true;\\n }\\n }\\n}\\n\",\"keccak256\":\"0x1999478f082b3dac416b579ea9385736e3015aa27ac7173c67555e21426ede51\",\"license\":\"MIT\"},\"contracts/utils/TimeChecker.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity 0.8.19;\\nimport {Ownable} from \\\"@openzeppelin/contracts/access/Ownable.sol\\\";\\n\\ncontract TimeChecker is Ownable {\\n uint256 public duration;\\n uint256 public minDuration;\\n\\n event DurationUpdated(uint256 indexed duration);\\n\\n constructor(uint256 _duration) {\\n duration = _duration;\\n minDuration = 30 minutes;\\n }\\n\\n /**\\n * @dev Check if the time is valid\\n */\\n modifier timeValid(uint256 time) {\\n require(\\n time + duration >= block.timestamp,\\n \\\"expired, please send another transaction with new signature\\\"\\n );\\n _;\\n }\\n\\n\\n /**\\n * @dev Change duration value\\n */\\n function updateDuation(uint256 valNew) external onlyOwner {\\n require(valNew > minDuration, \\\"duration too short\\\");\\n duration = valNew;\\n emit DurationUpdated(valNew);\\n }\\n}\\n\",\"keccak256\":\"0xeb1278f24da69d97bd3d0da549e0673fdfa0b319bf4ba2ed6b24fefa870f3af9\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x60c03461011c57601f61154338819003918201601f19168301916001600160401b038311848410176101215780849260809460405283398101031261011c5761004781610137565b61005360208301610137565b606061006160408501610137565b93015192600092835494604060018060a01b0319953387891617815581519760018060a01b039687948592833391167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08680a3600160025560ff1960035416600355600455610708600555466080523060a052168152600760205220911684825416179055169060065416176006556113f7908161014c823960805181818161046c0152610eb2015260a0518181816102c101526104420152f35b600080fd5b634e487b7160e01b600052604160045260246000fd5b51906001600160a01b038216820361011c5756fe608080604052600436101561001357600080fd5b60003560e01c9081630fb5a6b414610ed5575080632b437d4814610e9a5780632b7ac3f314610e715780633f4ba83a14610ddd5780634fcbaa1f14610d8c5780635671576114610d6e5780635c975abb14610d4b5780636d04319414610cf1578063715018a614610c985780637f9d309614610c0d5780638456cb5914610bb35780638da5cb5b14610b8a57806391c3d7a314610a9f57806397fc007c146109e5578063c0411364146109aa578063d718f2fe146102f0578063da28b527146102ab578063de76cadb146101b95763f2fde38b146100f057600080fd5b346101b45760203660031901126101b457610109610ef0565b610111610fdf565b6001600160a01b0390811690811561016057600054826001600160601b0360a01b821617600055167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0600080a3005b60405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608490fd5b600080fd5b346101b45760403660031901126101b4576101d2610ef0565b6101da610f06565b6101e2610fdf565b6001600160a01b0391821660008181526007602052604090205490929182169116811461025a57816040917f75a33e8174368dc0792ac0a162a518ece06bebca5d2d915bf1a161b4fdc60cbf93600052600760205282600020816001600160601b0360a01b82541617905582519182526020820152a1005b60405162461bcd60e51b8152602060048201526024808201527f546f6b656e436c61696d3a2045524332302077616c6c6574206e6f74206368616044820152631b99d95960e21b6064820152608490fd5b346101b45760003660031901126101b4576040517f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168152602090f35b346101b45760e03660031901126101b457610309610ef0565b610311610f06565b3660c4116101b45760c43567ffffffffffffffff8082116101b457366023830112156101b4578160040135116101b4573660248260040135830101116101b45760ff604051826004013560248401823760208184600401358101600181520301902054166109345760843560045481018091116107895742116108c957600280541461088457600280556103a3611037565b6001600160a01b03828116600090815260076020526040902054161561083457604435156107ef576001600160a01b0383811660009081526008602090815260408083209386168352929052205490606435821661079f576040516001600160601b03193360601b1660208201526001600160601b03198560601b1660348201526001600160601b03198460601b1660488201526001600160601b03197f000000000000000000000000000000000000000000000000000000000000000060601b16605c8201527f000000000000000000000000000000000000000000000000000000000000000060708201526070815261049d81610f1c565b6000905b6004821061071d5780516020909101206006546104db92506001600160a01b0316906104d536600486013560248701610fa8565b91611151565b60ff60405182600401356024840182376020818460040135810160018152030190205416156106ec575b5060018060a01b0383166000526008602052604060002060018060a01b03831660005260205260643517604060002055600760205261060060018060a01b03604060002054166000806040519260208401906323b872dd60e01b8252602485015233604485015260443560648501526064845261058184610f1c565b6040519361058e85610f4e565b60208086527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564908601525190826001600160a01b0388165af13d156106e4573d906105d882610f8c565b916105e66040519384610f6a565b82523d6000602084013e5b6001600160a01b03851661107b565b80519081159182156106c1575b50501561066957604080516001600160a01b03938416815260443560208201526064359181019190915291169033907fc5e576d85788400ff978578cc94a19ee7a30e8ee78d468f20ab2e305bef8411d90606090a36001600255005b60405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608490fd5b81925090602091810103126101b4576020015180151581036101b457838061060d565b6060906105f1565b6020604051828193600401356024820183376004013581016001815203019020600160ff1982541617905583610505565b610776602061076a92604051828101908660051b60440135825283815261074381610f4e565b604051958361075b889551809288808901910161112e565b8401915180938684019061112e565b01038084520182610f6a565b90600019811461078957600101906104a1565b634e487b7160e01b600052601160045260246000fd5b60405162461bcd60e51b815260206004820152602260248201527f546f6b656e436c61696d3a20636f6e646974696f6e20636865636b206661696c604482015261195960f21b6064820152608490fd5b60405162461bcd60e51b815260206004820152601a60248201527f546f6b656e436c61696d3a20616d6f756e74206973207a65726f0000000000006044820152606490fd5b60405162461bcd60e51b815260206004820152602260248201527f546f6b656e436c61696d3a20746f6b656e206973206e6f7420737570706f7274604482015261195960f21b6064820152608490fd5b60405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606490fd5b60405162461bcd60e51b815260206004820152603b60248201527f657870697265642c20706c656173652073656e6420616e6f746865722074726160448201527f6e73616374696f6e2077697468206e6577207369676e617475726500000000006064820152608490fd5b60405162461bcd60e51b815260206004820152604260248201527f7369676e617475726520757365642e20706c656173652073656e6420616e6f7460448201527f686572207472616e73616374696f6e2077697468206e6577207369676e617475606482015261726560f01b608482015260a490fd5b346101b45760203660031901126101b45760206001600160a01b03806109ce610ef0565b166000526007825260406000205416604051908152f35b346101b45760203660031901126101b4576109fe610ef0565b610a06610fdf565b6001600160a01b03168015610a4e57600680546001600160a01b031916821790557f4635bfbeab18ad788a7fc2a516293118982d68d953206bd5f8c556890e72d7e5600080a2005b60405162461bcd60e51b815260206004820152602360248201527f546f6b656e436c61696d3a20616464726573732063616e206e6f74206265207a60448201526265726f60e81b6064820152608490fd5b346101b4576101203660031901126101b457610ab9610ef0565b610ac1610f06565b6044356001600160a01b0380821682036101b45760643590811681036101b45736610124116101b457604051926001600160601b0319928380928160209860601b168888015260601b16603486015260601b16604884015260601b16605c820152608435607082015260708152610b3781610f1c565b60005b8260048210610b525790508151910120604051908152f35b610b789061076a9293604051828101908660051b60a40135825283815261074381610f4e565b90600019811461078957600101610b3a565b346101b45760003660031901126101b4576000546040516001600160a01b039091168152602090f35b346101b45760003660031901126101b457610bcc610fdf565b610bd4611037565b600160ff1960035416176003557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586020604051338152a1005b346101b45760203660031901126101b457600435610c29610fdf565b600554811115610c5e57806004557f91abcc2d6823e3a3f11d31b208dd3065d2c6a791f1c7c9fe96a42ce12897eac5600080a2005b60405162461bcd60e51b8152602060048201526012602482015271191d5c985d1a5bdb881d1bdbc81cda1bdc9d60721b6044820152606490fd5b346101b45760003660031901126101b457610cb1610fdf565b600080546001600160a01b0319811682556001600160a01b03167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08280a3005b346101b45760603660031901126101b457610d0a610ef0565b6044359067ffffffffffffffff82116101b457366023830112156101b457610d3f610d49923690602481600401359101610fa8565b9060243590611151565b005b346101b45760003660031901126101b457602060ff600354166040519015158152f35b346101b45760003660031901126101b4576020600554604051908152f35b346101b45760403660031901126101b457610da5610ef0565b610dad610f06565b9060018060a01b038091166000526008602052604060002091166000526020526020604060002054604051908152f35b346101b45760003660031901126101b457610df6610fdf565b60035460ff811615610e355760ff19166003557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa6020604051338152a1005b60405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b6044820152606490fd5b346101b45760003660031901126101b4576006546040516001600160a01b039091168152602090f35b346101b45760003660031901126101b45760206040517f00000000000000000000000000000000000000000000000000000000000000008152f35b346101b45760003660031901126101b4576020906004548152f35b600435906001600160a01b03821682036101b457565b602435906001600160a01b03821682036101b457565b60a0810190811067ffffffffffffffff821117610f3857604052565b634e487b7160e01b600052604160045260246000fd5b6040810190811067ffffffffffffffff821117610f3857604052565b90601f8019910116810190811067ffffffffffffffff821117610f3857604052565b67ffffffffffffffff8111610f3857601f01601f191660200190565b929192610fb482610f8c565b91610fc26040519384610f6a565b8294818452818301116101b4578281602093846000960137010152565b6000546001600160a01b03163303610ff357565b606460405162461bcd60e51b815260206004820152602060248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152fd5b60ff6003541661104357565b60405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b6044820152606490fd5b919290156110dd575081511561108f575090565b3b156110985790565b60405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606490fd5b8251909150156110f05750805190602001fd5b6044604051809262461bcd60e51b825260206004830152611120815180928160248601526020868601910161112e565b601f01601f19168101030190fd5b60005b8381106111415750506000910152565b8181015183820152602001611131565b906111939261118b917f19457468657265756d205369676e6564204d6573736167653a0a333200000000600052601c52603c6000206112fa565b9290926111e0565b6001600160a01b039081169116036111a757565b60405162461bcd60e51b8152602060048201526011602482015270696e76616c6964207369676e617475726560781b6044820152606490fd5b60058110156112e457806111f15750565b6001810361123e5760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e617475726500000000000000006044820152606490fd5b6002810361128b5760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e677468006044820152606490fd5b60031461129457565b60405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b6064820152608490fd5b634e487b7160e01b600052602160045260246000fd5b90604181511460001461132857611324916020820151906060604084015193015160001a90611332565b9091565b5050600090600290565b9291907f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a083116113b55791608094939160ff602094604051948552168484015260408301526060820152600093849182805260015afa156113a85781516001600160a01b038116156113a2579190565b50600190565b50604051903d90823e3d90fd5b5050505060009060039056fea2646970667358221220b87505206a54c1b11f892251a96926990a9357b3d1ee16fa1438bd24ca87e42464736f6c63430008130033", + "deployedBytecode": "0x608080604052600436101561001357600080fd5b60003560e01c9081630fb5a6b414610ed5575080632b437d4814610e9a5780632b7ac3f314610e715780633f4ba83a14610ddd5780634fcbaa1f14610d8c5780635671576114610d6e5780635c975abb14610d4b5780636d04319414610cf1578063715018a614610c985780637f9d309614610c0d5780638456cb5914610bb35780638da5cb5b14610b8a57806391c3d7a314610a9f57806397fc007c146109e5578063c0411364146109aa578063d718f2fe146102f0578063da28b527146102ab578063de76cadb146101b95763f2fde38b146100f057600080fd5b346101b45760203660031901126101b457610109610ef0565b610111610fdf565b6001600160a01b0390811690811561016057600054826001600160601b0360a01b821617600055167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0600080a3005b60405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608490fd5b600080fd5b346101b45760403660031901126101b4576101d2610ef0565b6101da610f06565b6101e2610fdf565b6001600160a01b0391821660008181526007602052604090205490929182169116811461025a57816040917f75a33e8174368dc0792ac0a162a518ece06bebca5d2d915bf1a161b4fdc60cbf93600052600760205282600020816001600160601b0360a01b82541617905582519182526020820152a1005b60405162461bcd60e51b8152602060048201526024808201527f546f6b656e436c61696d3a2045524332302077616c6c6574206e6f74206368616044820152631b99d95960e21b6064820152608490fd5b346101b45760003660031901126101b4576040517f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168152602090f35b346101b45760e03660031901126101b457610309610ef0565b610311610f06565b3660c4116101b45760c43567ffffffffffffffff8082116101b457366023830112156101b4578160040135116101b4573660248260040135830101116101b45760ff604051826004013560248401823760208184600401358101600181520301902054166109345760843560045481018091116107895742116108c957600280541461088457600280556103a3611037565b6001600160a01b03828116600090815260076020526040902054161561083457604435156107ef576001600160a01b0383811660009081526008602090815260408083209386168352929052205490606435821661079f576040516001600160601b03193360601b1660208201526001600160601b03198560601b1660348201526001600160601b03198460601b1660488201526001600160601b03197f000000000000000000000000000000000000000000000000000000000000000060601b16605c8201527f000000000000000000000000000000000000000000000000000000000000000060708201526070815261049d81610f1c565b6000905b6004821061071d5780516020909101206006546104db92506001600160a01b0316906104d536600486013560248701610fa8565b91611151565b60ff60405182600401356024840182376020818460040135810160018152030190205416156106ec575b5060018060a01b0383166000526008602052604060002060018060a01b03831660005260205260643517604060002055600760205261060060018060a01b03604060002054166000806040519260208401906323b872dd60e01b8252602485015233604485015260443560648501526064845261058184610f1c565b6040519361058e85610f4e565b60208086527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564908601525190826001600160a01b0388165af13d156106e4573d906105d882610f8c565b916105e66040519384610f6a565b82523d6000602084013e5b6001600160a01b03851661107b565b80519081159182156106c1575b50501561066957604080516001600160a01b03938416815260443560208201526064359181019190915291169033907fc5e576d85788400ff978578cc94a19ee7a30e8ee78d468f20ab2e305bef8411d90606090a36001600255005b60405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608490fd5b81925090602091810103126101b4576020015180151581036101b457838061060d565b6060906105f1565b6020604051828193600401356024820183376004013581016001815203019020600160ff1982541617905583610505565b610776602061076a92604051828101908660051b60440135825283815261074381610f4e565b604051958361075b889551809288808901910161112e565b8401915180938684019061112e565b01038084520182610f6a565b90600019811461078957600101906104a1565b634e487b7160e01b600052601160045260246000fd5b60405162461bcd60e51b815260206004820152602260248201527f546f6b656e436c61696d3a20636f6e646974696f6e20636865636b206661696c604482015261195960f21b6064820152608490fd5b60405162461bcd60e51b815260206004820152601a60248201527f546f6b656e436c61696d3a20616d6f756e74206973207a65726f0000000000006044820152606490fd5b60405162461bcd60e51b815260206004820152602260248201527f546f6b656e436c61696d3a20746f6b656e206973206e6f7420737570706f7274604482015261195960f21b6064820152608490fd5b60405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606490fd5b60405162461bcd60e51b815260206004820152603b60248201527f657870697265642c20706c656173652073656e6420616e6f746865722074726160448201527f6e73616374696f6e2077697468206e6577207369676e617475726500000000006064820152608490fd5b60405162461bcd60e51b815260206004820152604260248201527f7369676e617475726520757365642e20706c656173652073656e6420616e6f7460448201527f686572207472616e73616374696f6e2077697468206e6577207369676e617475606482015261726560f01b608482015260a490fd5b346101b45760203660031901126101b45760206001600160a01b03806109ce610ef0565b166000526007825260406000205416604051908152f35b346101b45760203660031901126101b4576109fe610ef0565b610a06610fdf565b6001600160a01b03168015610a4e57600680546001600160a01b031916821790557f4635bfbeab18ad788a7fc2a516293118982d68d953206bd5f8c556890e72d7e5600080a2005b60405162461bcd60e51b815260206004820152602360248201527f546f6b656e436c61696d3a20616464726573732063616e206e6f74206265207a60448201526265726f60e81b6064820152608490fd5b346101b4576101203660031901126101b457610ab9610ef0565b610ac1610f06565b6044356001600160a01b0380821682036101b45760643590811681036101b45736610124116101b457604051926001600160601b0319928380928160209860601b168888015260601b16603486015260601b16604884015260601b16605c820152608435607082015260708152610b3781610f1c565b60005b8260048210610b525790508151910120604051908152f35b610b789061076a9293604051828101908660051b60a40135825283815261074381610f4e565b90600019811461078957600101610b3a565b346101b45760003660031901126101b4576000546040516001600160a01b039091168152602090f35b346101b45760003660031901126101b457610bcc610fdf565b610bd4611037565b600160ff1960035416176003557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586020604051338152a1005b346101b45760203660031901126101b457600435610c29610fdf565b600554811115610c5e57806004557f91abcc2d6823e3a3f11d31b208dd3065d2c6a791f1c7c9fe96a42ce12897eac5600080a2005b60405162461bcd60e51b8152602060048201526012602482015271191d5c985d1a5bdb881d1bdbc81cda1bdc9d60721b6044820152606490fd5b346101b45760003660031901126101b457610cb1610fdf565b600080546001600160a01b0319811682556001600160a01b03167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08280a3005b346101b45760603660031901126101b457610d0a610ef0565b6044359067ffffffffffffffff82116101b457366023830112156101b457610d3f610d49923690602481600401359101610fa8565b9060243590611151565b005b346101b45760003660031901126101b457602060ff600354166040519015158152f35b346101b45760003660031901126101b4576020600554604051908152f35b346101b45760403660031901126101b457610da5610ef0565b610dad610f06565b9060018060a01b038091166000526008602052604060002091166000526020526020604060002054604051908152f35b346101b45760003660031901126101b457610df6610fdf565b60035460ff811615610e355760ff19166003557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa6020604051338152a1005b60405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b6044820152606490fd5b346101b45760003660031901126101b4576006546040516001600160a01b039091168152602090f35b346101b45760003660031901126101b45760206040517f00000000000000000000000000000000000000000000000000000000000000008152f35b346101b45760003660031901126101b4576020906004548152f35b600435906001600160a01b03821682036101b457565b602435906001600160a01b03821682036101b457565b60a0810190811067ffffffffffffffff821117610f3857604052565b634e487b7160e01b600052604160045260246000fd5b6040810190811067ffffffffffffffff821117610f3857604052565b90601f8019910116810190811067ffffffffffffffff821117610f3857604052565b67ffffffffffffffff8111610f3857601f01601f191660200190565b929192610fb482610f8c565b91610fc26040519384610f6a565b8294818452818301116101b4578281602093846000960137010152565b6000546001600160a01b03163303610ff357565b606460405162461bcd60e51b815260206004820152602060248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152fd5b60ff6003541661104357565b60405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b6044820152606490fd5b919290156110dd575081511561108f575090565b3b156110985790565b60405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606490fd5b8251909150156110f05750805190602001fd5b6044604051809262461bcd60e51b825260206004830152611120815180928160248601526020868601910161112e565b601f01601f19168101030190fd5b60005b8381106111415750506000910152565b8181015183820152602001611131565b906111939261118b917f19457468657265756d205369676e6564204d6573736167653a0a333200000000600052601c52603c6000206112fa565b9290926111e0565b6001600160a01b039081169116036111a757565b60405162461bcd60e51b8152602060048201526011602482015270696e76616c6964207369676e617475726560781b6044820152606490fd5b60058110156112e457806111f15750565b6001810361123e5760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e617475726500000000000000006044820152606490fd5b6002810361128b5760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e677468006044820152606490fd5b60031461129457565b60405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b6064820152608490fd5b634e487b7160e01b600052602160045260246000fd5b90604181511460001461132857611324916020820151906060604084015193015160001a90611332565b9091565b5050600090600290565b9291907f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a083116113b55791608094939160ff602094604051948552168484015260408301526060820152600093849182805260015afa156113a85781516001600160a01b038116156113a2579190565b50600190565b50604051903d90823e3d90fd5b5050505060009060039056fea2646970667358221220b87505206a54c1b11f892251a96926990a9357b3d1ee16fa1438bd24ca87e42464736f6c63430008130033", "devdoc": { "events": { "Paused(address)": { @@ -535,15 +515,13 @@ }, "kind": "dev", "methods": { - "claim(address,address,uint256,uint256,uint256,bytes)": { + "claim(address,address,uint256[4],bytes)": { "details": "claim CEC with signature", "params": { "account": "address which eligible to claim, only for event log", - "amount": "amount of token", - "saltNonce": "nonce of signature", - "signTime": "time of signature", "signature": "signature of claim", - "token": "address of token" + "token": "address of token", + "vals": "array of amount, bit, signTime, saltNonce" } }, "owner()": { @@ -592,7 +570,7 @@ "type": "t_address" }, { - "astId": 3034, + "astId": 3174, "contract": "contracts/activity/TokenClaim.sol:TokenClaim", "label": "_usedSignatures", "offset": 0, @@ -616,7 +594,7 @@ "type": "t_bool" }, { - "astId": 3107, + "astId": 3247, "contract": "contracts/activity/TokenClaim.sol:TokenClaim", "label": "duration", "offset": 0, @@ -624,7 +602,7 @@ "type": "t_uint256" }, { - "astId": 3109, + "astId": 3249, "contract": "contracts/activity/TokenClaim.sol:TokenClaim", "label": "minDuration", "offset": 0, @@ -650,7 +628,7 @@ { "astId": 2743, "contract": "contracts/activity/TokenClaim.sol:TokenClaim", - "label": "claimedAmount", + "label": "claimedBitMap", "offset": 0, "slot": "8", "type": "t_mapping(t_address,t_mapping(t_address,t_uint256))" diff --git a/deployments/bsc_test/solcInputs/ffd53ba855cb9016f19c9e71d2ab924e.json b/deployments/bsc_test/solcInputs/8d4e816c22b2b125316667293671f05d.json similarity index 94% rename from deployments/bsc_test/solcInputs/ffd53ba855cb9016f19c9e71d2ab924e.json rename to deployments/bsc_test/solcInputs/8d4e816c22b2b125316667293671f05d.json index 4313b56..1d1376f 100644 --- a/deployments/bsc_test/solcInputs/ffd53ba855cb9016f19c9e71d2ab924e.json +++ b/deployments/bsc_test/solcInputs/8d4e816c22b2b125316667293671f05d.json @@ -38,7 +38,10 @@ "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Strings.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./math/Math.sol\";\nimport \"./math/SignedMath.sol\";\n\n/**\n * @dev String operations.\n */\nlibrary Strings {\n bytes16 private constant _SYMBOLS = \"0123456789abcdef\";\n uint8 private constant _ADDRESS_LENGTH = 20;\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\n */\n function toString(uint256 value) internal pure returns (string memory) {\n unchecked {\n uint256 length = Math.log10(value) + 1;\n string memory buffer = new string(length);\n uint256 ptr;\n /// @solidity memory-safe-assembly\n assembly {\n ptr := add(buffer, add(32, length))\n }\n while (true) {\n ptr--;\n /// @solidity memory-safe-assembly\n assembly {\n mstore8(ptr, byte(mod(value, 10), _SYMBOLS))\n }\n value /= 10;\n if (value == 0) break;\n }\n return buffer;\n }\n }\n\n /**\n * @dev Converts a `int256` to its ASCII `string` decimal representation.\n */\n function toString(int256 value) internal pure returns (string memory) {\n return string(abi.encodePacked(value < 0 ? \"-\" : \"\", toString(SignedMath.abs(value))));\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\n */\n function toHexString(uint256 value) internal pure returns (string memory) {\n unchecked {\n return toHexString(value, Math.log256(value) + 1);\n }\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\n */\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\n bytes memory buffer = new bytes(2 * length + 2);\n buffer[0] = \"0\";\n buffer[1] = \"x\";\n for (uint256 i = 2 * length + 1; i > 1; --i) {\n buffer[i] = _SYMBOLS[value & 0xf];\n value >>= 4;\n }\n require(value == 0, \"Strings: hex length insufficient\");\n return string(buffer);\n }\n\n /**\n * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.\n */\n function toHexString(address addr) internal pure returns (string memory) {\n return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\n }\n\n /**\n * @dev Returns true if the two strings are equal.\n */\n function equal(string memory a, string memory b) internal pure returns (bool) {\n return keccak256(bytes(a)) == keccak256(bytes(b));\n }\n}\n" }, "contracts/activity/TokenClaim.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.19;\n\nimport {ReentrancyGuard} from \"@openzeppelin/contracts/security/ReentrancyGuard.sol\";\nimport {Pausable} from \"@openzeppelin/contracts/security/Pausable.sol\";\nimport {IERC20} from \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport {SafeERC20} from \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\nimport {HasSignature} from \"../core/HasSignature.sol\";\nimport {TimeChecker} from \"../utils/TimeChecker.sol\";\n\ncontract TokenClaim is HasSignature, ReentrancyGuard, Pausable, TimeChecker {\n using SafeERC20 for IERC20;\n\n uint256 public immutable _CACHED_CHAIN_ID;\n address public immutable _CACHED_THIS;\n address public verifier;\n\n mapping(address token => address wallet) public erc20Wallets;\n\n // store user's claimed amount\n mapping(address user => mapping(address token => uint256 amount)) public claimedAmount;\n\n event EventERC20Wallet(address erc20, address wallet);\n\n event EventVerifierUpdated(address indexed verifier);\n event EventTokenClaimed(address indexed user, address indexed token, address passport, uint256 amount, uint256 nonce);\n\n constructor(address _wallet, address _token, address _verifier, uint256 _duration) TimeChecker(_duration) {\n _CACHED_CHAIN_ID = block.chainid;\n _CACHED_THIS = address(this);\n erc20Wallets[_token] = _wallet;\n verifier = _verifier;\n }\n\n /**\n * @dev update verifier address\n */\n function updateVerifier(address _verifier) external onlyOwner {\n require(_verifier != address(0), \"TokenClaim: address can not be zero\");\n verifier = _verifier;\n emit EventVerifierUpdated(_verifier);\n }\n\n /**\n * @dev update pause state\n */\n function pause() external onlyOwner {\n _pause();\n }\n\n /**\n * @dev update unpause state\n */\n function unpause() external onlyOwner {\n _unpause();\n }\n\n /**\n * @dev update ERC20 wallet\n */\n function updateERC20Wallet(address erc20, address wallet) external onlyOwner {\n require(erc20Wallets[erc20] != wallet, \"TokenClaim: ERC20 wallet not changed\");\n erc20Wallets[erc20] = wallet;\n emit EventERC20Wallet(erc20, wallet);\n }\n\n /**\n * @dev claim CEC with signature\n * @param account address which eligible to claim, only for event log\n * @param token address of token\n * @param amount amount of token\n * @param signTime time of signature\n * @param saltNonce nonce of signature\n * @param signature signature of claim\n */\n\n function claim(\n address account,\n address token,\n uint256 amount,\n uint256 signTime,\n uint256 saltNonce,\n bytes calldata signature\n ) external signatureValid(signature) timeValid(signTime) nonReentrant whenNotPaused {\n require(erc20Wallets[token] != address(0), \"TokenClaim: token is not supported\");\n require(amount > 0, \"TokenClaim: amount is zero\");\n address user = _msgSender();\n bytes32 criteriaMessageHash = getMessageHash(\n user,\n account,\n token,\n amount,\n _CACHED_THIS,\n _CACHED_CHAIN_ID,\n signTime,\n saltNonce\n );\n checkSigner(verifier, criteriaMessageHash, signature);\n _useSignature(signature);\n claimedAmount[account][token] += amount;\n IERC20(token).safeTransferFrom(erc20Wallets[token], user, amount);\n emit EventTokenClaimed(user, token, account, amount, saltNonce);\n }\n\n function getMessageHash(\n address _user,\n address _account,\n address _token,\n uint256 _amount,\n address _contract,\n uint256 _chainId,\n uint256 _signTime,\n uint256 _saltNonce\n ) public pure returns (bytes32) {\n bytes memory encoded = abi.encodePacked(\n _user,\n _account,\n _token,\n _amount,\n _contract,\n _chainId,\n _signTime,\n _saltNonce\n );\n return keccak256(encoded);\n }\n}\n" + "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.19;\n\nimport {ReentrancyGuard} from \"@openzeppelin/contracts/security/ReentrancyGuard.sol\";\nimport {Pausable} from \"@openzeppelin/contracts/security/Pausable.sol\";\nimport {IERC20} from \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport {SafeERC20} from \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\nimport {HasSignature} from \"../core/HasSignature.sol\";\nimport {TimeChecker} from \"../utils/TimeChecker.sol\";\n\ncontract TokenClaim is HasSignature, ReentrancyGuard, Pausable, TimeChecker {\n using SafeERC20 for IERC20;\n\n uint256 public immutable _CACHED_CHAIN_ID;\n address public immutable _CACHED_THIS;\n address public verifier;\n\n mapping(address token => address wallet) public erc20Wallets;\n\n // store user's claimed status\n mapping(address user => mapping(address token => uint256 claimedBit)) public claimedBitMap;\n\n event EventERC20Wallet(address erc20, address wallet);\n\n event EventVerifierUpdated(address indexed verifier);\n event EventTokenClaimed(address indexed user, address indexed token, address account, uint256 amount, uint256 bit);\n\n constructor(address _wallet, address _token, address _verifier, uint256 _duration) TimeChecker(_duration) {\n _CACHED_CHAIN_ID = block.chainid;\n _CACHED_THIS = address(this);\n erc20Wallets[_token] = _wallet;\n verifier = _verifier;\n }\n\n /**\n * @dev update verifier address\n */\n function updateVerifier(address _verifier) external onlyOwner {\n require(_verifier != address(0), \"TokenClaim: address can not be zero\");\n verifier = _verifier;\n emit EventVerifierUpdated(_verifier);\n }\n\n /**\n * @dev update pause state\n */\n function pause() external onlyOwner {\n _pause();\n }\n\n /**\n * @dev update unpause state\n */\n function unpause() external onlyOwner {\n _unpause();\n }\n\n /**\n * @dev update ERC20 wallet\n */\n function updateERC20Wallet(address erc20, address wallet) external onlyOwner {\n require(erc20Wallets[erc20] != wallet, \"TokenClaim: ERC20 wallet not changed\");\n erc20Wallets[erc20] = wallet;\n emit EventERC20Wallet(erc20, wallet);\n }\n\n /**\n * @dev claim CEC with signature\n * @param account address which eligible to claim, only for event log\n * @param token address of token\n * @param vals array of amount, bit, signTime, saltNonce\n * @param signature signature of claim\n */\n\n function claim(\n address account,\n address token,\n uint256[4] calldata vals, // amount, bit, signTime, saltNonce\n bytes calldata signature\n ) external signatureValid(signature) timeValid(vals[2]) nonReentrant whenNotPaused {\n require(erc20Wallets[token] != address(0), \"TokenClaim: token is not supported\");\n require(vals[0] > 0, \"TokenClaim: amount is zero\");\n uint256 current = claimedBitMap[account][token];\n require(current & vals[1] == 0, \"TokenClaim: condition check failed\");\n address user = _msgSender();\n bytes32 criteriaMessageHash = getMessageHash(\n user,\n account,\n token,\n _CACHED_THIS,\n _CACHED_CHAIN_ID,\n vals\n );\n checkSigner(verifier, criteriaMessageHash, signature);\n _useSignature(signature);\n claimedBitMap[account][token] = current | vals[1];\n IERC20(token).safeTransferFrom(erc20Wallets[token], user, vals[0]);\n emit EventTokenClaimed(user, token, account, vals[0], vals[1]);\n }\n\n function getMessageHash(\n address _user,\n address _account,\n address _token,\n address _contract,\n uint256 _chainId,\n uint256[4] calldata _vals\n ) public pure returns (bytes32) {\n bytes memory encoded = abi.encodePacked(\n _user,\n _account,\n _token,\n _contract,\n _chainId\n );\n for (uint256 i = 0; i < _vals.length; i++) {\n encoded = bytes.concat(encoded, abi.encodePacked(_vals[i]));\n }\n return keccak256(encoded);\n }\n}\n" + }, + "contracts/core/ClaimHistory.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.19;\n\ncontract ClaimHistory {\n mapping(address user=> mapping(uint256 index => uint256 val)) private claimedBitMap;\n\n function isClaimed(address user, uint256 index) public view returns (bool) {\n uint256 claimedWordIndex = index / 256;\n uint256 claimedBitIndex = index % 256;\n uint256 claimedWord = claimedBitMap[user][claimedWordIndex];\n uint256 mask = (1 << claimedBitIndex);\n return claimedWord & mask == mask;\n }\n\n function setClaimed(address user, uint256 index) internal {\n uint256 claimedWordIndex = index / 256;\n uint256 claimedBitIndex = index % 256;\n claimedBitMap[user][claimedWordIndex] = claimedBitMap[user][claimedWordIndex] | (1 << claimedBitIndex);\n }\n \n}\n" }, "contracts/core/HasSignature.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.19;\nimport {ECDSA} from \"@openzeppelin/contracts/utils/cryptography/ECDSA.sol\";\nimport {Ownable} from \"@openzeppelin/contracts/access/Ownable.sol\";\n\ncontract HasSignature is Ownable {\n mapping(bytes signature => bool status) private _usedSignatures;\n\n function checkSigner(\n address signer,\n bytes32 hash,\n bytes memory signature\n ) public pure {\n bytes32 ethSignedMessageHash = ECDSA.toEthSignedMessageHash(hash);\n\n address recovered = ECDSA.recover(ethSignedMessageHash, signature);\n require(recovered == signer, \"invalid signature\");\n }\n\n modifier signatureValid(bytes calldata signature) {\n require(\n !_usedSignatures[signature],\n \"signature used. please send another transaction with new signature\"\n );\n _;\n }\n\n function _useSignature(bytes calldata signature) internal {\n if (!_usedSignatures[signature]) {\n _usedSignatures[signature] = true;\n }\n }\n}\n" diff --git a/out/bsc_test_dev.json b/out/bsc_test_dev.json index 13c95ff..a5b43b4 100644 --- a/out/bsc_test_dev.json +++ b/out/bsc_test_dev.json @@ -17,10 +17,16 @@ "json": "assets/contracts/GameItemMall.json", "address": "0xaE08adb5278B107D2501e7c61907e41FEf3887D7" }, + { + "name": "TestCEC", + "type": "erc20", + "json": "assets/contracts/FT.json", + "address": "0xe34c5ea0c3083d11a735dc0609533b92130319f5" + }, { "name": "TokenClaim", "type": "logic", "json": "assets/contracts/TokenClaim.json", - "address": "0x2C7221588D4FBac2585D71618CD540e74c7413B8" + "address": "0xC95bDFAaFBf79b435e4d2bF8d77842fc19e6fE56" } ] \ No newline at end of file diff --git a/test/testBitTest.ts b/test/testBitTest.ts new file mode 100644 index 0000000..9fdb910 --- /dev/null +++ b/test/testBitTest.ts @@ -0,0 +1,40 @@ +import { expect } from 'chai' +import hre from "hardhat"; +import { + getBytes, + solidityPackedKeccak256, +} from 'ethers' +import { + loadFixture, +} from "@nomicfoundation/hardhat-toolbox/network-helpers"; + +describe('TestBit', function() { + async function deployOneContract() { + // Contracts are deployed using the first signer/account by default + const [owner, otherAccount] = await hre.ethers.getSigners(); + const verifier = owner.address; + + const TestBit = await hre.ethers.getContractFactory("TestBit"); + + const testBit = await TestBit.deploy( ); + const chainId = hre.network.config.chainId + + return { testBit, owner, otherAccount, verifier, chainId }; + } + describe("Deployment", function () { + it('should deploy TestBit', async function() { + const { testBit } = await loadFixture(deployOneContract); + + const idx = '0'; + const initVal = 0; + await testBit.setVal(idx, initVal); + const nextVal = 0 << 1 + await expect(testBit.checkVal(idx, nextVal)) + .to.emit(testBit, "ValueChecked") + .withArgs(0, nextVal | initVal); + }); + + }) + + +}) \ No newline at end of file diff --git a/test/testTokenClaim.ts b/test/testTokenClaim.ts index b58d7a9..93cda34 100644 --- a/test/testTokenClaim.ts +++ b/test/testTokenClaim.ts @@ -47,17 +47,18 @@ describe('TokenClaim', function() { it('should claim token success', async function() { const { claimer, ft, owner, chainId, otherAccount } = await loadFixture(deployOneContract); const amount = 100; - // @ts-ignore - // await ft.connect(owner).approve(claimer.target, '10000000000000000000000'); + const nonce = (Math.random() * 1000) | 0; const now = (Date.now() / 1000) | 0; - let localMsgHash = solidityPackedKeccak256(["address","address", "address", "uint256", "address", "uint256", "uint256", "uint256"], - [otherAccount.address, otherAccount.address, ft.target, amount, claimer.target, chainId, now, nonce]); + const bit = 1; + let localMsgHash = solidityPackedKeccak256(["address","address", "address", "address", "uint256","uint256", "uint256", "uint256", "uint256"], + [otherAccount.address, otherAccount.address, ft.target, claimer.target, chainId, amount, bit, now, nonce]); const signature = await owner.signMessage(getBytes(localMsgHash)); + const vals = [amount, bit, now, nonce]; // @ts-ignore - await expect(claimer.connect(otherAccount).claim(otherAccount.address, ft.target, amount, now, nonce, signature)) + await expect(claimer.connect(otherAccount).claim(otherAccount.address, ft.target, vals, signature)) .to.emit(claimer, "EventTokenClaimed") - .withArgs(otherAccount.address, ft.target, otherAccount.address, amount, nonce); + .withArgs(otherAccount.address, ft.target, otherAccount.address, amount, bit); expect(await ft.balanceOf(otherAccount.address)).to.equal(amount); }); @@ -66,13 +67,15 @@ describe('TokenClaim', function() { const amount = 100; const nonce = (Math.random() * 1000) | 0; const now = (Date.now() / 1000) | 0; - let localMsgHash = solidityPackedKeccak256(["address","address", "address", "uint256", "address", "uint256", "uint256", "uint256"], - [otherAccount.address, otherAccount.address, ft.target, amount, claimer.target, chainId, now, nonce]); + const bit = 1; + let localMsgHash = solidityPackedKeccak256(["address","address", "address", "address", "uint256","uint256", "uint256", "uint256", "uint256"], + [otherAccount.address, otherAccount.address, ft.target, claimer.target, chainId, amount, bit, now, nonce]); const signature = await owner.signMessage(getBytes(localMsgHash)); + const vals = [amount, bit, now, nonce]; //@ts-ignore - await claimer.connect(otherAccount).claim(otherAccount.address, ft.target, amount, now, nonce, signature) + await claimer.connect(otherAccount).claim(otherAccount.address, ft.target, vals, signature) // @ts-ignore - await expect(claimer.connect(otherAccount).claim(otherAccount.address, ft.target, amount, now, nonce, signature)).to.be.revertedWith("signature used. please send another transaction with new signature"); + await expect(claimer.connect(otherAccount).claim(otherAccount.address, ft.target, vals, signature)).to.be.revertedWith("signature used. please send another transaction with new signature"); }); it('should revert claim token for timeout', async function() { @@ -82,11 +85,13 @@ describe('TokenClaim', function() { // await ft.connect(owner).approve(claimer.target, '10000000000000000000000'); const nonce = (Math.random() * 1000) | 0; const now = (Date.now() / 1000 - 3601) | 0; - let localMsgHash = solidityPackedKeccak256(["address","address", "address", "uint256", "address", "uint256", "uint256", "uint256"], - [otherAccount.address, otherAccount.address, ft.target, amount, claimer.target, chainId, now, nonce]); + const bit = 1; + let localMsgHash = solidityPackedKeccak256(["address","address", "address", "address", "uint256","uint256", "uint256", "uint256", "uint256"], + [otherAccount.address, otherAccount.address, ft.target, claimer.target, chainId, amount, bit, now, nonce]); const signature = await owner.signMessage(getBytes(localMsgHash)); + const vals = [amount, bit, now, nonce]; // @ts-ignore - await expect(claimer.connect(otherAccount).claim(otherAccount.address, ft.target, amount, now, nonce, signature)).to.be.revertedWith("expired, please send another transaction with new signature"); + await expect(claimer.connect(otherAccount).claim(otherAccount.address, ft.target, vals, signature)).to.be.revertedWith("expired, please send another transaction with new signature"); }); it('should revert claim token for token not support', async function() { @@ -95,11 +100,41 @@ describe('TokenClaim', function() { const amount = 100; const nonce = (Math.random() * 1000) | 0; const now = (Date.now() / 1000) | 0; - let localMsgHash = solidityPackedKeccak256(["address","address", "address", "uint256", "address", "uint256", "uint256", "uint256"], - [otherAccount.address, otherAccount.address, ft.target, amount, claimer.target, chainId, now, nonce]); + const bit = 1; + let localMsgHash = solidityPackedKeccak256(["address","address", "address", "address", "uint256","uint256", "uint256", "uint256", "uint256"], + [otherAccount.address, otherAccount.address, ft.target, claimer.target, chainId, amount, bit, now, nonce]); const signature = await owner.signMessage(getBytes(localMsgHash)); + const vals = [amount, bit, now, nonce]; // @ts-ignore - await expect(claimer.connect(otherAccount).claim(otherAccount.address, ft.target, amount, now, nonce, signature)).to.be.revertedWith("TokenClaimer: token is not supported"); + await expect(claimer.connect(otherAccount).claim(otherAccount.address, ft.target, vals, signature)).to.be.revertedWith("TokenClaim: token is not supported"); + }); + it('should revert claim token for condition check failed', async function() { + const { claimer, ft, owner, chainId, otherAccount } = await loadFixture(deployOneContract); + const amount = 100; + const nonce = (Math.random() * 1000) | 0; + const now = (Date.now() / 1000) | 0; + let bit = 1; + let localMsgHash = solidityPackedKeccak256(["address","address", "address", "address", "uint256","uint256", "uint256", "uint256", "uint256"], + [otherAccount.address, otherAccount.address, ft.target, claimer.target, chainId, amount, bit, now, nonce]); + let signature = await owner.signMessage(getBytes(localMsgHash)); + let vals = [amount, bit, now, nonce]; + // @ts-ignore + await claimer.connect(otherAccount).claim(otherAccount.address, ft.target, vals, signature) + + bit = 1 << 2 ; + localMsgHash = solidityPackedKeccak256(["address","address", "address", "address", "uint256","uint256", "uint256", "uint256", "uint256"], + [otherAccount.address, otherAccount.address, ft.target, claimer.target, chainId, amount, bit, now, nonce]); + signature = await owner.signMessage(getBytes(localMsgHash)); + vals = [amount, bit, now, nonce]; + // @ts-ignore + await claimer.connect(otherAccount).claim(otherAccount.address, ft.target, vals, signature) + bit = 1 | 1 << 2 ; + localMsgHash = solidityPackedKeccak256(["address","address", "address", "address", "uint256","uint256", "uint256", "uint256", "uint256"], + [otherAccount.address, otherAccount.address, ft.target, claimer.target, chainId, amount, bit, now, nonce]); + signature = await owner.signMessage(getBytes(localMsgHash)); + vals = [amount, bit, now, nonce]; + // @ts-ignore + await expect(claimer.connect(otherAccount).claim(otherAccount.address, ft.target, vals, signature)).to.be.revertedWith("TokenClaim: condition check failed"); }); }) })