diff --git a/packages/bundler/localconfig/bundler.config.json b/packages/bundler/localconfig/bundler.config.json index c2e0617..be4446f 100644 --- a/packages/bundler/localconfig/bundler.config.json +++ b/packages/bundler/localconfig/bundler.config.json @@ -1,8 +1,8 @@ { "gasFactor": "1", "port": "3000", - "network": "https://jsonrpc.euphoria.aura.network", - "entryPoint": "0xfbC1a3AD32465bea6605d3bb7E6387caCa9337AC", + "network": "https://jsonrpc.serenity.aura.network", + "entryPoint": "0xa4FeCbA4F91F45f6094dF2117a657829588eBda6", "beneficiary": "0xa0E6E66a49b252C3e3eBb56b8f7D2344242F2F0d", "minBalance": "1", "mnemonic": "./localconfig/mnemonic.txt", diff --git a/packages/bundler/src/abi/swaprouter.json b/packages/bundler/src/abi/swaprouter.json new file mode 100644 index 0000000..6860f7a --- /dev/null +++ b/packages/bundler/src/abi/swaprouter.json @@ -0,0 +1,574 @@ +{ + "_format": "hh-sol-artifact-1", + "contractName": "SwapRouter", + "sourceName": "contracts/SwapRouter.sol", + "abi": [ + { + "inputs": [ + { + "internalType": "address", + "name": "_factory", + "type": "address" + }, + { + "internalType": "address", + "name": "_WETH9", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [], + "name": "WETH9", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "bytes", + "name": "path", + "type": "bytes" + }, + { + "internalType": "address", + "name": "recipient", + "type": "address" + }, + { + "internalType": "uint256", + "name": "deadline", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "amountIn", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "amountOutMinimum", + "type": "uint256" + } + ], + "internalType": "struct ISwapRouter.ExactInputParams", + "name": "params", + "type": "tuple" + } + ], + "name": "exactInput", + "outputs": [ + { + "internalType": "uint256", + "name": "amountOut", + "type": "uint256" + } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "address", + "name": "tokenIn", + "type": "address" + }, + { + "internalType": "address", + "name": "tokenOut", + "type": "address" + }, + { + "internalType": "uint24", + "name": "fee", + "type": "uint24" + }, + { + "internalType": "address", + "name": "recipient", + "type": "address" + }, + { + "internalType": "uint256", + "name": "deadline", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "amountIn", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "amountOutMinimum", + "type": "uint256" + }, + { + "internalType": "uint160", + "name": "sqrtPriceLimitX96", + "type": "uint160" + } + ], + "internalType": "struct ISwapRouter.ExactInputSingleParams", + "name": "params", + "type": "tuple" + } + ], + "name": "exactInputSingle", + "outputs": [ + { + "internalType": "uint256", + "name": "amountOut", + "type": "uint256" + } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "bytes", + "name": "path", + "type": "bytes" + }, + { + "internalType": "address", + "name": "recipient", + "type": "address" + }, + { + "internalType": "uint256", + "name": "deadline", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "amountOut", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "amountInMaximum", + "type": "uint256" + } + ], + "internalType": "struct ISwapRouter.ExactOutputParams", + "name": "params", + "type": "tuple" + } + ], + "name": "exactOutput", + "outputs": [ + { + "internalType": "uint256", + "name": "amountIn", + "type": "uint256" + } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "address", + "name": "tokenIn", + "type": "address" + }, + { + "internalType": "address", + "name": "tokenOut", + "type": "address" + }, + { + "internalType": "uint24", + "name": "fee", + "type": "uint24" + }, + { + "internalType": "address", + "name": "recipient", + "type": "address" + }, + { + "internalType": "uint256", + "name": "deadline", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "amountOut", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "amountInMaximum", + "type": "uint256" + }, + { + "internalType": "uint160", + "name": "sqrtPriceLimitX96", + "type": "uint160" + } + ], + "internalType": "struct ISwapRouter.ExactOutputSingleParams", + "name": "params", + "type": "tuple" + } + ], + "name": "exactOutputSingle", + "outputs": [ + { + "internalType": "uint256", + "name": "amountIn", + "type": "uint256" + } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [], + "name": "factory", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes[]", + "name": "data", + "type": "bytes[]" + } + ], + "name": "multicall", + "outputs": [ + { + "internalType": "bytes[]", + "name": "results", + "type": "bytes[]" + } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [], + "name": "refundETH", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "value", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "deadline", + "type": "uint256" + }, + { + "internalType": "uint8", + "name": "v", + "type": "uint8" + }, + { + "internalType": "bytes32", + "name": "r", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "s", + "type": "bytes32" + } + ], + "name": "selfPermit", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "nonce", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "expiry", + "type": "uint256" + }, + { + "internalType": "uint8", + "name": "v", + "type": "uint8" + }, + { + "internalType": "bytes32", + "name": "r", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "s", + "type": "bytes32" + } + ], + "name": "selfPermitAllowed", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "nonce", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "expiry", + "type": "uint256" + }, + { + "internalType": "uint8", + "name": "v", + "type": "uint8" + }, + { + "internalType": "bytes32", + "name": "r", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "s", + "type": "bytes32" + } + ], + "name": "selfPermitAllowedIfNecessary", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "value", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "deadline", + "type": "uint256" + }, + { + "internalType": "uint8", + "name": "v", + "type": "uint8" + }, + { + "internalType": "bytes32", + "name": "r", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "s", + "type": "bytes32" + } + ], + "name": "selfPermitIfNecessary", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amountMinimum", + "type": "uint256" + }, + { + "internalType": "address", + "name": "recipient", + "type": "address" + } + ], + "name": "sweepToken", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amountMinimum", + "type": "uint256" + }, + { + "internalType": "address", + "name": "recipient", + "type": "address" + }, + { + "internalType": "uint256", + "name": "feeBips", + "type": "uint256" + }, + { + "internalType": "address", + "name": "feeRecipient", + "type": "address" + } + ], + "name": "sweepTokenWithFee", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "int256", + "name": "amount0Delta", + "type": "int256" + }, + { + "internalType": "int256", + "name": "amount1Delta", + "type": "int256" + }, + { + "internalType": "bytes", + "name": "_data", + "type": "bytes" + } + ], + "name": "uniswapV3SwapCallback", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "amountMinimum", + "type": "uint256" + }, + { + "internalType": "address", + "name": "recipient", + "type": "address" + } + ], + "name": "unwrapWETH9", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "amountMinimum", + "type": "uint256" + }, + { + "internalType": "address", + "name": "recipient", + "type": "address" + }, + { + "internalType": "uint256", + "name": "feeBips", + "type": "uint256" + }, + { + "internalType": "address", + "name": "feeRecipient", + "type": "address" + } + ], + "name": "unwrapWETH9WithFee", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "stateMutability": "payable", + "type": "receive" + } + ], + "bytecode": "0x60c06040526000196000553480156200001757600080fd5b50604051620030b0380380620030b08339810160408190526200003a9162000076565b6001600160601b0319606092831b8116608052911b1660a052620000ad565b80516001600160a01b03811681146200007157600080fd5b919050565b6000806040838503121562000089578182fd5b620000948362000059565b9150620000a46020840162000059565b90509250929050565b60805160601c60a05160601c612fa762000109600039806101765280610604528061072e52806107c8528061080852806109325280611cc45280611d245280611da5525080610e47528061148d5280611ea75250612fa76000f3fe6080604052600436106101125760003560e01c8063c04b8d59116100a5578063df2ab5bb11610074578063f28c049811610059578063f28c049814610376578063f3995c6714610389578063fa461e331461039c5761023c565b8063df2ab5bb14610350578063e0e189a0146103635761023c565b8063c04b8d5914610302578063c2e3140a14610315578063c45a015514610328578063db3e21981461033d5761023c565b80634aa4a4fc116100e15780634aa4a4fc1461029a5780639b2c0a37146102bc578063a4a78f0c146102cf578063ac9650d8146102e25761023c565b806312210e8a14610241578063414bf3891461024b5780634659a4941461027457806349404b7c146102875761023c565b3661023c576040805133606081901b60208301527f206973204e6f742057455448390000000000000000000000000000000000000060348301528251602181840301815260419092019092529073ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000000000000000000000000000000000000000000001614610239576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b838110156101fe5781810151838201526020016101e6565b50505050905090810190601f16801561022b5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b50005b600080fd5b6102496103bc565b005b61025e610259366004612a79565b6103ce565b60405161026b9190612e72565b60405180910390f35b6102496102823660046127f7565b610540565b610249610295366004612b80565b610600565b3480156102a657600080fd5b506102af6107c6565b60405161026b9190612cb8565b6102496102ca366004612baf565b6107ea565b6102496102dd3660046127f7565b610a02565b6102f56102f0366004612857565b610ad7565b60405161026b9190612d2b565b61025e6103103660046129ce565b610c31565b6102496103233660046127f7565b610d90565b34801561033457600080fd5b506102af610e45565b61025e61034b366004612a79565b610e69565b61024961035e366004612758565b610ff9565b610249610371366004612799565b611116565b61025e610384366004612a95565b61127c565b6102496103973660046127f7565b6113b0565b3480156103a857600080fd5b506102496103b73660046128e9565b611448565b47156103cc576103cc334761158f565b565b60008160800135806103de6116dd565b111561044b57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f5472616e73616374696f6e20746f6f206f6c6400000000000000000000000000604482015290519081900360640190fd5b6104f160a08401356104636080860160608701612735565b610474610100870160e08801612735565b604080518082019091528061048c60208a018a612735565b61049c60608b0160408c01612b5d565b6104ac60408c0160208d01612735565b6040516020016104be93929190612c42565b60405160208183030381529060405281526020013373ffffffffffffffffffffffffffffffffffffffff168152506116e1565b91508260c0013582101561053a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161053190612df3565b60405180910390fd5b50919050565b604080517f8fcbaf0c00000000000000000000000000000000000000000000000000000000815233600482015230602482015260448101879052606481018690526001608482015260ff851660a482015260c4810184905260e48101839052905173ffffffffffffffffffffffffffffffffffffffff881691638fcbaf0c9161010480830192600092919082900301818387803b1580156105e057600080fd5b505af11580156105f4573d6000803e3d6000fd5b50505050505050505050565b60007f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b15801561068957600080fd5b505afa15801561069d573d6000803e3d6000fd5b505050506040513d60208110156106b357600080fd5b505190508281101561072657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f496e73756666696369656e742057455448390000000000000000000000000000604482015290519081900360640190fd5b80156107c1577f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff16632e1a7d4d826040518263ffffffff1660e01b815260040180828152602001915050600060405180830381600087803b15801561079f57600080fd5b505af11580156107b3573d6000803e3d6000fd5b505050506107c1828261158f565b505050565b7f000000000000000000000000000000000000000000000000000000000000000081565b6000821180156107fb575060648211155b61080457600080fd5b60007f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b15801561088d57600080fd5b505afa1580156108a1573d6000803e3d6000fd5b505050506040513d60208110156108b757600080fd5b505190508481101561092a57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f496e73756666696369656e742057455448390000000000000000000000000000604482015290519081900360640190fd5b80156109fb577f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff16632e1a7d4d826040518263ffffffff1660e01b815260040180828152602001915050600060405180830381600087803b1580156109a357600080fd5b505af11580156109b7573d6000803e3d6000fd5b5050505060006127106109d3858461186790919063ffffffff16565b816109da57fe5b04905080156109ed576109ed838261158f565b6109f98582840361158f565b505b5050505050565b604080517fdd62ed3e00000000000000000000000000000000000000000000000000000000815233600482015230602482015290517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff9173ffffffffffffffffffffffffffffffffffffffff89169163dd62ed3e91604480820192602092909190829003018186803b158015610a9757600080fd5b505afa158015610aab573d6000803e3d6000fd5b505050506040513d6020811015610ac157600080fd5b505110156109f9576109f9868686868686610540565b60608167ffffffffffffffff81118015610af057600080fd5b50604051908082528060200260200182016040528015610b2457816020015b6060815260200190600190039081610b0f5790505b50905060005b82811015610c2a5760008030868685818110610b4257fe5b9050602002810190610b549190612e7b565b604051610b62929190612ca8565b600060405180830381855af49150503d8060008114610b9d576040519150601f19603f3d011682016040523d82523d6000602084013e610ba2565b606091505b509150915081610c0857604481511015610bbb57600080fd5b60048101905080806020019051810190610bd59190612964565b6040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105319190612da9565b80848481518110610c1557fe5b60209081029190910101525050600101610b2a565b5092915050565b6000816040015180610c416116dd565b1115610cae57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f5472616e73616374696f6e20746f6f206f6c6400000000000000000000000000604482015290519081900360640190fd5b335b6000610cbf8560000151611891565b9050610d18856060015182610cd8578660200151610cda565b305b60006040518060400160405280610cf48b6000015161189d565b81526020018773ffffffffffffffffffffffffffffffffffffffff168152506116e1565b60608601528015610d38578451309250610d31906118ac565b8552610d45565b8460600151935050610d4b565b50610cb0565b8360800151831015610d89576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161053190612df3565b5050919050565b604080517fdd62ed3e0000000000000000000000000000000000000000000000000000000081523360048201523060248201529051869173ffffffffffffffffffffffffffffffffffffffff89169163dd62ed3e91604480820192602092909190829003018186803b158015610e0557600080fd5b505afa158015610e19573d6000803e3d6000fd5b505050506040513d6020811015610e2f57600080fd5b505110156109f9576109f98686868686866113b0565b7f000000000000000000000000000000000000000000000000000000000000000081565b6000816080013580610e796116dd565b1115610ee657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f5472616e73616374696f6e20746f6f206f6c6400000000000000000000000000604482015290519081900360640190fd5b610f8f60a0840135610efe6080860160608701612735565b610f0f610100870160e08801612735565b6040518060400160405280886020016020810190610f2d9190612735565b610f3d60608b0160408c01612b5d565b610f4a60208c018c612735565b604051602001610f5c93929190612c42565b60405160208183030381529060405281526020013373ffffffffffffffffffffffffffffffffffffffff168152506118e1565b91508260c00135821115610fcf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161053190612dbc565b507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff600055919050565b60008373ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b15801561106257600080fd5b505afa158015611076573d6000803e3d6000fd5b505050506040513d602081101561108c57600080fd5b50519050828110156110ff57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f496e73756666696369656e7420746f6b656e0000000000000000000000000000604482015290519081900360640190fd5b801561111057611110848383611a9d565b50505050565b600082118015611127575060648211155b61113057600080fd5b60008573ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b15801561119957600080fd5b505afa1580156111ad573d6000803e3d6000fd5b505050506040513d60208110156111c357600080fd5b505190508481101561123657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f496e73756666696369656e7420746f6b656e0000000000000000000000000000604482015290519081900360640190fd5b80156109f957600061271061124b8386611867565b8161125257fe5b049050801561126657611266878483611a9d565b6112738786838503611a9d565b50505050505050565b600081604001358061128c6116dd565b11156112f957604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f5472616e73616374696f6e20746f6f206f6c6400000000000000000000000000604482015290519081900360640190fd5b61136c60608401356113116040860160208701612735565b60408051808201909152600090806113298980612e7b565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250505090825250336020909101526118e1565b5060005491508260800135821115610fcf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161053190612dbc565b604080517fd505accf000000000000000000000000000000000000000000000000000000008152336004820152306024820152604481018790526064810186905260ff8516608482015260a4810184905260c48101839052905173ffffffffffffffffffffffffffffffffffffffff88169163d505accf9160e480830192600092919082900301818387803b1580156105e057600080fd5b60008413806114575750600083135b61146057600080fd5b600061146e82840184612acd565b905060008060006114828460000151611c72565b9250925092506114b47f0000000000000000000000000000000000000000000000000000000000000000848484611ca3565b5060008060008a136114f5578473ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161089611526565b8373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff16108a5b915091508115611545576115408587602001513384611cc2565b6105f4565b855161155090611891565b15611575578551611560906118ac565b865261156f81336000896118e1565b506105f4565b806000819055508394506105f48587602001513384611cc2565b6040805160008082526020820190925273ffffffffffffffffffffffffffffffffffffffff84169083906040518082805190602001908083835b6020831061160657805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe090920191602091820191016115c9565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d8060008114611668576040519150601f19603f3d011682016040523d82523d6000602084013e61166d565b606091505b50509050806107c157604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600360248201527f5354450000000000000000000000000000000000000000000000000000000000604482015290519081900360640190fd5b4290565b600073ffffffffffffffffffffffffffffffffffffffff8416611702573093505b60008060006117148560000151611c72565b9194509250905073ffffffffffffffffffffffffffffffffffffffff80831690841610600080611745868686611ea0565b73ffffffffffffffffffffffffffffffffffffffff1663128acb088b8561176b8f611ede565b73ffffffffffffffffffffffffffffffffffffffff8e161561178d578d6117b3565b876117ac5773fffd8963efd1fc6a506488495d951d5263988d256117b3565b6401000276a45b8d6040516020016117c49190612e2a565b6040516020818303038152906040526040518663ffffffff1660e01b81526004016117f3959493929190612cd9565b6040805180830381600087803b15801561180c57600080fd5b505af1158015611820573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061184491906128c6565b91509150826118535781611855565b805b6000039b9a5050505050505050505050565b60008215806118825750508181028183828161187f57fe5b04145b61188b57600080fd5b92915050565b8051604211155b919050565b606061188b826000602b611f10565b805160609061188b9083906017907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe901611f10565b600073ffffffffffffffffffffffffffffffffffffffff8416611902573093505b60008060006119148560000151611c72565b9194509250905073ffffffffffffffffffffffffffffffffffffffff80841690831610600080611945858786611ea0565b73ffffffffffffffffffffffffffffffffffffffff1663128acb088b8561196b8f611ede565b60000373ffffffffffffffffffffffffffffffffffffffff8e1615611990578d6119b6565b876119af5773fffd8963efd1fc6a506488495d951d5263988d256119b6565b6401000276a45b8d6040516020016119c79190612e2a565b6040516020818303038152906040526040518663ffffffff1660e01b81526004016119f6959493929190612cd9565b6040805180830381600087803b158015611a0f57600080fd5b505af1158015611a23573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a4791906128c6565b91509150600083611a5c578183600003611a62565b82826000035b909850905073ffffffffffffffffffffffffffffffffffffffff8a16611a8e578b8114611a8e57600080fd5b50505050505050949350505050565b6040805173ffffffffffffffffffffffffffffffffffffffff8481166024830152604480830185905283518084039091018152606490920183526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fa9059cbb000000000000000000000000000000000000000000000000000000001781529251825160009485949389169392918291908083835b60208310611b7257805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe09092019160209182019101611b35565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d8060008114611bd4576040519150601f19603f3d011682016040523d82523d6000602084013e611bd9565b606091505b5091509150818015611c07575080511580611c075750808060200190516020811015611c0457600080fd5b50515b6109fb57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600260248201527f5354000000000000000000000000000000000000000000000000000000000000604482015290519081900360640190fd5b60008080611c8084826120f7565b9250611c8d8460146121f7565b9050611c9a8460176120f7565b91509193909250565b6000611cb985611cb48686866122e7565b612364565b95945050505050565b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16148015611d1d5750804710155b15611e66577f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1663d0e30db0826040518263ffffffff1660e01b81526004016000604051808303818588803b158015611d8a57600080fd5b505af1158015611d9e573d6000803e3d6000fd5b50505050507f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1663a9059cbb83836040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b158015611e3457600080fd5b505af1158015611e48573d6000803e3d6000fd5b505050506040513d6020811015611e5e57600080fd5b506111109050565b73ffffffffffffffffffffffffffffffffffffffff8316301415611e9457611e8f848383611a9d565b611110565b61111084848484612394565b6000611ed67f0000000000000000000000000000000000000000000000000000000000000000611ed18686866122e7565b612571565b949350505050565b60007f80000000000000000000000000000000000000000000000000000000000000008210611f0c57600080fd5b5090565b60608182601f011015611f8457604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600e60248201527f736c6963655f6f766572666c6f77000000000000000000000000000000000000604482015290519081900360640190fd5b828284011015611ff557604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600e60248201527f736c6963655f6f766572666c6f77000000000000000000000000000000000000604482015290519081900360640190fd5b8183018451101561206757604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f736c6963655f6f75744f66426f756e6473000000000000000000000000000000604482015290519081900360640190fd5b60608215801561208657604051915060008252602082016040526120ee565b6040519150601f8416801560200281840101858101878315602002848b0101015b818310156120bf5780518352602092830192016120a7565b5050858452601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016604052505b50949350505050565b60008182601401101561216b57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f746f416464726573735f6f766572666c6f770000000000000000000000000000604482015290519081900360640190fd5b81601401835110156121de57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f746f416464726573735f6f75744f66426f756e64730000000000000000000000604482015290519081900360640190fd5b5001602001516c01000000000000000000000000900490565b60008182600301101561226b57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f746f55696e7432345f6f766572666c6f77000000000000000000000000000000604482015290519081900360640190fd5b81600301835110156122de57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f746f55696e7432345f6f75744f66426f756e6473000000000000000000000000604482015290519081900360640190fd5b50016003015190565b6122ef6126a7565b8273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161115612327579192915b506040805160608101825273ffffffffffffffffffffffffffffffffffffffff948516815292909316602083015262ffffff169181019190915290565b60006123708383612571565b90503373ffffffffffffffffffffffffffffffffffffffff82161461188b57600080fd5b6040805173ffffffffffffffffffffffffffffffffffffffff85811660248301528481166044830152606480830185905283518084039091018152608490920183526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f23b872dd00000000000000000000000000000000000000000000000000000000178152925182516000948594938a169392918291908083835b6020831061247157805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe09092019160209182019101612434565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d80600081146124d3576040519150601f19603f3d011682016040523d82523d6000602084013e6124d8565b606091505b5091509150818015612506575080511580612506575080806020019051602081101561250357600080fd5b50515b6109f957604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600360248201527f5354460000000000000000000000000000000000000000000000000000000000604482015290519081900360640190fd5b6000816020015173ffffffffffffffffffffffffffffffffffffffff16826000015173ffffffffffffffffffffffffffffffffffffffff16106125b357600080fd5b508051602080830151604093840151845173ffffffffffffffffffffffffffffffffffffffff94851681850152939091168385015262ffffff166060808401919091528351808403820181526080840185528051908301207fff0000000000000000000000000000000000000000000000000000000000000060a085015294901b7fffffffffffffffffffffffffffffffffffffffff0000000000000000000000001660a183015260b58201939093527fe34f199b19b2b4f47f68442619d555527d244f78a3297ea89325f843f87b8b5460d5808301919091528251808303909101815260f5909101909152805191012090565b604080516060810182526000808252602082018190529181019190915290565b803561189881612f75565b600082601f8301126126e2578081fd5b81356126f56126f082612f09565b612ee5565b818152846020838601011115612709578283fd5b816020850160208301379081016020019190915292915050565b6000610100828403121561053a578081fd5b600060208284031215612746578081fd5b813561275181612f75565b9392505050565b60008060006060848603121561276c578182fd5b833561277781612f75565b925060208401359150604084013561278e81612f75565b809150509250925092565b600080600080600060a086880312156127b0578081fd5b85356127bb81612f75565b94506020860135935060408601356127d281612f75565b92506060860135915060808601356127e981612f75565b809150509295509295909350565b60008060008060008060c0878903121561280f578081fd5b863561281a81612f75565b95506020870135945060408701359350606087013560ff8116811461283d578182fd5b9598949750929560808101359460a0909101359350915050565b60008060208385031215612869578182fd5b823567ffffffffffffffff80821115612880578384fd5b818501915085601f830112612893578384fd5b8135818111156128a1578485fd5b86602080830285010111156128b4578485fd5b60209290920196919550909350505050565b600080604083850312156128d8578182fd5b505080516020909101519092909150565b600080600080606085870312156128fe578182fd5b8435935060208501359250604085013567ffffffffffffffff80821115612923578384fd5b818701915087601f830112612936578384fd5b813581811115612944578485fd5b886020828501011115612955578485fd5b95989497505060200194505050565b600060208284031215612975578081fd5b815167ffffffffffffffff81111561298b578182fd5b8201601f8101841361299b578182fd5b80516129a96126f082612f09565b8181528560208385010111156129bd578384fd5b611cb9826020830160208601612f49565b6000602082840312156129df578081fd5b813567ffffffffffffffff808211156129f6578283fd5b9083019060a08286031215612a09578283fd5b60405160a081018181108382111715612a1e57fe5b604052823582811115612a2f578485fd5b612a3b878286016126d2565b825250612a4a602084016126c7565b602082015260408301356040820152606083013560608201526080830135608082015280935050505092915050565b60006101008284031215612a8b578081fd5b6127518383612723565b600060208284031215612aa6578081fd5b813567ffffffffffffffff811115612abc578182fd5b820160a08185031215612751578182fd5b600060208284031215612ade578081fd5b813567ffffffffffffffff80821115612af5578283fd5b9083019060408286031215612b08578283fd5b604051604081018181108382111715612b1d57fe5b604052823582811115612b2e578485fd5b612b3a878286016126d2565b82525060208301359250612b4d83612f75565b6020810192909252509392505050565b600060208284031215612b6e578081fd5b813562ffffff81168114612751578182fd5b60008060408385031215612b92578182fd5b823591506020830135612ba481612f75565b809150509250929050565b60008060008060808587031215612bc4578182fd5b843593506020850135612bd681612f75565b9250604085013591506060850135612bed81612f75565b939692955090935050565b60008151808452612c10816020860160208601612f49565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b606093841b7fffffffffffffffffffffffffffffffffffffffff000000000000000000000000908116825260e89390931b7fffffff0000000000000000000000000000000000000000000000000000000000166014820152921b166017820152602b0190565b6000828483379101908152919050565b73ffffffffffffffffffffffffffffffffffffffff91909116815260200190565b600073ffffffffffffffffffffffffffffffffffffffff8088168352861515602084015285604084015280851660608401525060a06080830152612d2060a0830184612bf8565b979650505050505050565b6000602080830181845280855180835260408601915060408482028701019250838701855b82811015612d9c577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc0888603018452612d8a858351612bf8565b94509285019290850190600101612d50565b5092979650505050505050565b6000602082526127516020830184612bf8565b60208082526012908201527f546f6f206d756368207265717565737465640000000000000000000000000000604082015260600190565b60208082526013908201527f546f6f206c6974746c6520726563656976656400000000000000000000000000604082015260600190565b600060208252825160406020840152612e466060840182612bf8565b905073ffffffffffffffffffffffffffffffffffffffff60208501511660408401528091505092915050565b90815260200190565b60008083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe1843603018112612eaf578283fd5b83018035915067ffffffffffffffff821115612ec9578283fd5b602001915036819003821315612ede57600080fd5b9250929050565b60405181810167ffffffffffffffff81118282101715612f0157fe5b604052919050565b600067ffffffffffffffff821115612f1d57fe5b50601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01660200190565b60005b83811015612f64578181015183820152602001612f4c565b838111156111105750506000910152565b73ffffffffffffffffffffffffffffffffffffffff81168114612f9757600080fd5b5056fea164736f6c6343000706000a", + "deployedBytecode": "0x6080604052600436106101125760003560e01c8063c04b8d59116100a5578063df2ab5bb11610074578063f28c049811610059578063f28c049814610376578063f3995c6714610389578063fa461e331461039c5761023c565b8063df2ab5bb14610350578063e0e189a0146103635761023c565b8063c04b8d5914610302578063c2e3140a14610315578063c45a015514610328578063db3e21981461033d5761023c565b80634aa4a4fc116100e15780634aa4a4fc1461029a5780639b2c0a37146102bc578063a4a78f0c146102cf578063ac9650d8146102e25761023c565b806312210e8a14610241578063414bf3891461024b5780634659a4941461027457806349404b7c146102875761023c565b3661023c576040805133606081901b60208301527f206973204e6f742057455448390000000000000000000000000000000000000060348301528251602181840301815260419092019092529073ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000000000000000000000000000000000000000000001614610239576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b838110156101fe5781810151838201526020016101e6565b50505050905090810190601f16801561022b5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b50005b600080fd5b6102496103bc565b005b61025e610259366004612a79565b6103ce565b60405161026b9190612e72565b60405180910390f35b6102496102823660046127f7565b610540565b610249610295366004612b80565b610600565b3480156102a657600080fd5b506102af6107c6565b60405161026b9190612cb8565b6102496102ca366004612baf565b6107ea565b6102496102dd3660046127f7565b610a02565b6102f56102f0366004612857565b610ad7565b60405161026b9190612d2b565b61025e6103103660046129ce565b610c31565b6102496103233660046127f7565b610d90565b34801561033457600080fd5b506102af610e45565b61025e61034b366004612a79565b610e69565b61024961035e366004612758565b610ff9565b610249610371366004612799565b611116565b61025e610384366004612a95565b61127c565b6102496103973660046127f7565b6113b0565b3480156103a857600080fd5b506102496103b73660046128e9565b611448565b47156103cc576103cc334761158f565b565b60008160800135806103de6116dd565b111561044b57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f5472616e73616374696f6e20746f6f206f6c6400000000000000000000000000604482015290519081900360640190fd5b6104f160a08401356104636080860160608701612735565b610474610100870160e08801612735565b604080518082019091528061048c60208a018a612735565b61049c60608b0160408c01612b5d565b6104ac60408c0160208d01612735565b6040516020016104be93929190612c42565b60405160208183030381529060405281526020013373ffffffffffffffffffffffffffffffffffffffff168152506116e1565b91508260c0013582101561053a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161053190612df3565b60405180910390fd5b50919050565b604080517f8fcbaf0c00000000000000000000000000000000000000000000000000000000815233600482015230602482015260448101879052606481018690526001608482015260ff851660a482015260c4810184905260e48101839052905173ffffffffffffffffffffffffffffffffffffffff881691638fcbaf0c9161010480830192600092919082900301818387803b1580156105e057600080fd5b505af11580156105f4573d6000803e3d6000fd5b50505050505050505050565b60007f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b15801561068957600080fd5b505afa15801561069d573d6000803e3d6000fd5b505050506040513d60208110156106b357600080fd5b505190508281101561072657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f496e73756666696369656e742057455448390000000000000000000000000000604482015290519081900360640190fd5b80156107c1577f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff16632e1a7d4d826040518263ffffffff1660e01b815260040180828152602001915050600060405180830381600087803b15801561079f57600080fd5b505af11580156107b3573d6000803e3d6000fd5b505050506107c1828261158f565b505050565b7f000000000000000000000000000000000000000000000000000000000000000081565b6000821180156107fb575060648211155b61080457600080fd5b60007f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b15801561088d57600080fd5b505afa1580156108a1573d6000803e3d6000fd5b505050506040513d60208110156108b757600080fd5b505190508481101561092a57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f496e73756666696369656e742057455448390000000000000000000000000000604482015290519081900360640190fd5b80156109fb577f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff16632e1a7d4d826040518263ffffffff1660e01b815260040180828152602001915050600060405180830381600087803b1580156109a357600080fd5b505af11580156109b7573d6000803e3d6000fd5b5050505060006127106109d3858461186790919063ffffffff16565b816109da57fe5b04905080156109ed576109ed838261158f565b6109f98582840361158f565b505b5050505050565b604080517fdd62ed3e00000000000000000000000000000000000000000000000000000000815233600482015230602482015290517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff9173ffffffffffffffffffffffffffffffffffffffff89169163dd62ed3e91604480820192602092909190829003018186803b158015610a9757600080fd5b505afa158015610aab573d6000803e3d6000fd5b505050506040513d6020811015610ac157600080fd5b505110156109f9576109f9868686868686610540565b60608167ffffffffffffffff81118015610af057600080fd5b50604051908082528060200260200182016040528015610b2457816020015b6060815260200190600190039081610b0f5790505b50905060005b82811015610c2a5760008030868685818110610b4257fe5b9050602002810190610b549190612e7b565b604051610b62929190612ca8565b600060405180830381855af49150503d8060008114610b9d576040519150601f19603f3d011682016040523d82523d6000602084013e610ba2565b606091505b509150915081610c0857604481511015610bbb57600080fd5b60048101905080806020019051810190610bd59190612964565b6040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105319190612da9565b80848481518110610c1557fe5b60209081029190910101525050600101610b2a565b5092915050565b6000816040015180610c416116dd565b1115610cae57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f5472616e73616374696f6e20746f6f206f6c6400000000000000000000000000604482015290519081900360640190fd5b335b6000610cbf8560000151611891565b9050610d18856060015182610cd8578660200151610cda565b305b60006040518060400160405280610cf48b6000015161189d565b81526020018773ffffffffffffffffffffffffffffffffffffffff168152506116e1565b60608601528015610d38578451309250610d31906118ac565b8552610d45565b8460600151935050610d4b565b50610cb0565b8360800151831015610d89576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161053190612df3565b5050919050565b604080517fdd62ed3e0000000000000000000000000000000000000000000000000000000081523360048201523060248201529051869173ffffffffffffffffffffffffffffffffffffffff89169163dd62ed3e91604480820192602092909190829003018186803b158015610e0557600080fd5b505afa158015610e19573d6000803e3d6000fd5b505050506040513d6020811015610e2f57600080fd5b505110156109f9576109f98686868686866113b0565b7f000000000000000000000000000000000000000000000000000000000000000081565b6000816080013580610e796116dd565b1115610ee657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f5472616e73616374696f6e20746f6f206f6c6400000000000000000000000000604482015290519081900360640190fd5b610f8f60a0840135610efe6080860160608701612735565b610f0f610100870160e08801612735565b6040518060400160405280886020016020810190610f2d9190612735565b610f3d60608b0160408c01612b5d565b610f4a60208c018c612735565b604051602001610f5c93929190612c42565b60405160208183030381529060405281526020013373ffffffffffffffffffffffffffffffffffffffff168152506118e1565b91508260c00135821115610fcf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161053190612dbc565b507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff600055919050565b60008373ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b15801561106257600080fd5b505afa158015611076573d6000803e3d6000fd5b505050506040513d602081101561108c57600080fd5b50519050828110156110ff57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f496e73756666696369656e7420746f6b656e0000000000000000000000000000604482015290519081900360640190fd5b801561111057611110848383611a9d565b50505050565b600082118015611127575060648211155b61113057600080fd5b60008573ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b15801561119957600080fd5b505afa1580156111ad573d6000803e3d6000fd5b505050506040513d60208110156111c357600080fd5b505190508481101561123657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f496e73756666696369656e7420746f6b656e0000000000000000000000000000604482015290519081900360640190fd5b80156109f957600061271061124b8386611867565b8161125257fe5b049050801561126657611266878483611a9d565b6112738786838503611a9d565b50505050505050565b600081604001358061128c6116dd565b11156112f957604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f5472616e73616374696f6e20746f6f206f6c6400000000000000000000000000604482015290519081900360640190fd5b61136c60608401356113116040860160208701612735565b60408051808201909152600090806113298980612e7b565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250505090825250336020909101526118e1565b5060005491508260800135821115610fcf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161053190612dbc565b604080517fd505accf000000000000000000000000000000000000000000000000000000008152336004820152306024820152604481018790526064810186905260ff8516608482015260a4810184905260c48101839052905173ffffffffffffffffffffffffffffffffffffffff88169163d505accf9160e480830192600092919082900301818387803b1580156105e057600080fd5b60008413806114575750600083135b61146057600080fd5b600061146e82840184612acd565b905060008060006114828460000151611c72565b9250925092506114b47f0000000000000000000000000000000000000000000000000000000000000000848484611ca3565b5060008060008a136114f5578473ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161089611526565b8373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff16108a5b915091508115611545576115408587602001513384611cc2565b6105f4565b855161155090611891565b15611575578551611560906118ac565b865261156f81336000896118e1565b506105f4565b806000819055508394506105f48587602001513384611cc2565b6040805160008082526020820190925273ffffffffffffffffffffffffffffffffffffffff84169083906040518082805190602001908083835b6020831061160657805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe090920191602091820191016115c9565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d8060008114611668576040519150601f19603f3d011682016040523d82523d6000602084013e61166d565b606091505b50509050806107c157604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600360248201527f5354450000000000000000000000000000000000000000000000000000000000604482015290519081900360640190fd5b4290565b600073ffffffffffffffffffffffffffffffffffffffff8416611702573093505b60008060006117148560000151611c72565b9194509250905073ffffffffffffffffffffffffffffffffffffffff80831690841610600080611745868686611ea0565b73ffffffffffffffffffffffffffffffffffffffff1663128acb088b8561176b8f611ede565b73ffffffffffffffffffffffffffffffffffffffff8e161561178d578d6117b3565b876117ac5773fffd8963efd1fc6a506488495d951d5263988d256117b3565b6401000276a45b8d6040516020016117c49190612e2a565b6040516020818303038152906040526040518663ffffffff1660e01b81526004016117f3959493929190612cd9565b6040805180830381600087803b15801561180c57600080fd5b505af1158015611820573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061184491906128c6565b91509150826118535781611855565b805b6000039b9a5050505050505050505050565b60008215806118825750508181028183828161187f57fe5b04145b61188b57600080fd5b92915050565b8051604211155b919050565b606061188b826000602b611f10565b805160609061188b9083906017907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe901611f10565b600073ffffffffffffffffffffffffffffffffffffffff8416611902573093505b60008060006119148560000151611c72565b9194509250905073ffffffffffffffffffffffffffffffffffffffff80841690831610600080611945858786611ea0565b73ffffffffffffffffffffffffffffffffffffffff1663128acb088b8561196b8f611ede565b60000373ffffffffffffffffffffffffffffffffffffffff8e1615611990578d6119b6565b876119af5773fffd8963efd1fc6a506488495d951d5263988d256119b6565b6401000276a45b8d6040516020016119c79190612e2a565b6040516020818303038152906040526040518663ffffffff1660e01b81526004016119f6959493929190612cd9565b6040805180830381600087803b158015611a0f57600080fd5b505af1158015611a23573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a4791906128c6565b91509150600083611a5c578183600003611a62565b82826000035b909850905073ffffffffffffffffffffffffffffffffffffffff8a16611a8e578b8114611a8e57600080fd5b50505050505050949350505050565b6040805173ffffffffffffffffffffffffffffffffffffffff8481166024830152604480830185905283518084039091018152606490920183526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fa9059cbb000000000000000000000000000000000000000000000000000000001781529251825160009485949389169392918291908083835b60208310611b7257805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe09092019160209182019101611b35565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d8060008114611bd4576040519150601f19603f3d011682016040523d82523d6000602084013e611bd9565b606091505b5091509150818015611c07575080511580611c075750808060200190516020811015611c0457600080fd5b50515b6109fb57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600260248201527f5354000000000000000000000000000000000000000000000000000000000000604482015290519081900360640190fd5b60008080611c8084826120f7565b9250611c8d8460146121f7565b9050611c9a8460176120f7565b91509193909250565b6000611cb985611cb48686866122e7565b612364565b95945050505050565b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16148015611d1d5750804710155b15611e66577f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1663d0e30db0826040518263ffffffff1660e01b81526004016000604051808303818588803b158015611d8a57600080fd5b505af1158015611d9e573d6000803e3d6000fd5b50505050507f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1663a9059cbb83836040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b158015611e3457600080fd5b505af1158015611e48573d6000803e3d6000fd5b505050506040513d6020811015611e5e57600080fd5b506111109050565b73ffffffffffffffffffffffffffffffffffffffff8316301415611e9457611e8f848383611a9d565b611110565b61111084848484612394565b6000611ed67f0000000000000000000000000000000000000000000000000000000000000000611ed18686866122e7565b612571565b949350505050565b60007f80000000000000000000000000000000000000000000000000000000000000008210611f0c57600080fd5b5090565b60608182601f011015611f8457604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600e60248201527f736c6963655f6f766572666c6f77000000000000000000000000000000000000604482015290519081900360640190fd5b828284011015611ff557604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600e60248201527f736c6963655f6f766572666c6f77000000000000000000000000000000000000604482015290519081900360640190fd5b8183018451101561206757604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f736c6963655f6f75744f66426f756e6473000000000000000000000000000000604482015290519081900360640190fd5b60608215801561208657604051915060008252602082016040526120ee565b6040519150601f8416801560200281840101858101878315602002848b0101015b818310156120bf5780518352602092830192016120a7565b5050858452601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016604052505b50949350505050565b60008182601401101561216b57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f746f416464726573735f6f766572666c6f770000000000000000000000000000604482015290519081900360640190fd5b81601401835110156121de57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f746f416464726573735f6f75744f66426f756e64730000000000000000000000604482015290519081900360640190fd5b5001602001516c01000000000000000000000000900490565b60008182600301101561226b57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f746f55696e7432345f6f766572666c6f77000000000000000000000000000000604482015290519081900360640190fd5b81600301835110156122de57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f746f55696e7432345f6f75744f66426f756e6473000000000000000000000000604482015290519081900360640190fd5b50016003015190565b6122ef6126a7565b8273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161115612327579192915b506040805160608101825273ffffffffffffffffffffffffffffffffffffffff948516815292909316602083015262ffffff169181019190915290565b60006123708383612571565b90503373ffffffffffffffffffffffffffffffffffffffff82161461188b57600080fd5b6040805173ffffffffffffffffffffffffffffffffffffffff85811660248301528481166044830152606480830185905283518084039091018152608490920183526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f23b872dd00000000000000000000000000000000000000000000000000000000178152925182516000948594938a169392918291908083835b6020831061247157805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe09092019160209182019101612434565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d80600081146124d3576040519150601f19603f3d011682016040523d82523d6000602084013e6124d8565b606091505b5091509150818015612506575080511580612506575080806020019051602081101561250357600080fd5b50515b6109f957604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600360248201527f5354460000000000000000000000000000000000000000000000000000000000604482015290519081900360640190fd5b6000816020015173ffffffffffffffffffffffffffffffffffffffff16826000015173ffffffffffffffffffffffffffffffffffffffff16106125b357600080fd5b508051602080830151604093840151845173ffffffffffffffffffffffffffffffffffffffff94851681850152939091168385015262ffffff166060808401919091528351808403820181526080840185528051908301207fff0000000000000000000000000000000000000000000000000000000000000060a085015294901b7fffffffffffffffffffffffffffffffffffffffff0000000000000000000000001660a183015260b58201939093527fe34f199b19b2b4f47f68442619d555527d244f78a3297ea89325f843f87b8b5460d5808301919091528251808303909101815260f5909101909152805191012090565b604080516060810182526000808252602082018190529181019190915290565b803561189881612f75565b600082601f8301126126e2578081fd5b81356126f56126f082612f09565b612ee5565b818152846020838601011115612709578283fd5b816020850160208301379081016020019190915292915050565b6000610100828403121561053a578081fd5b600060208284031215612746578081fd5b813561275181612f75565b9392505050565b60008060006060848603121561276c578182fd5b833561277781612f75565b925060208401359150604084013561278e81612f75565b809150509250925092565b600080600080600060a086880312156127b0578081fd5b85356127bb81612f75565b94506020860135935060408601356127d281612f75565b92506060860135915060808601356127e981612f75565b809150509295509295909350565b60008060008060008060c0878903121561280f578081fd5b863561281a81612f75565b95506020870135945060408701359350606087013560ff8116811461283d578182fd5b9598949750929560808101359460a0909101359350915050565b60008060208385031215612869578182fd5b823567ffffffffffffffff80821115612880578384fd5b818501915085601f830112612893578384fd5b8135818111156128a1578485fd5b86602080830285010111156128b4578485fd5b60209290920196919550909350505050565b600080604083850312156128d8578182fd5b505080516020909101519092909150565b600080600080606085870312156128fe578182fd5b8435935060208501359250604085013567ffffffffffffffff80821115612923578384fd5b818701915087601f830112612936578384fd5b813581811115612944578485fd5b886020828501011115612955578485fd5b95989497505060200194505050565b600060208284031215612975578081fd5b815167ffffffffffffffff81111561298b578182fd5b8201601f8101841361299b578182fd5b80516129a96126f082612f09565b8181528560208385010111156129bd578384fd5b611cb9826020830160208601612f49565b6000602082840312156129df578081fd5b813567ffffffffffffffff808211156129f6578283fd5b9083019060a08286031215612a09578283fd5b60405160a081018181108382111715612a1e57fe5b604052823582811115612a2f578485fd5b612a3b878286016126d2565b825250612a4a602084016126c7565b602082015260408301356040820152606083013560608201526080830135608082015280935050505092915050565b60006101008284031215612a8b578081fd5b6127518383612723565b600060208284031215612aa6578081fd5b813567ffffffffffffffff811115612abc578182fd5b820160a08185031215612751578182fd5b600060208284031215612ade578081fd5b813567ffffffffffffffff80821115612af5578283fd5b9083019060408286031215612b08578283fd5b604051604081018181108382111715612b1d57fe5b604052823582811115612b2e578485fd5b612b3a878286016126d2565b82525060208301359250612b4d83612f75565b6020810192909252509392505050565b600060208284031215612b6e578081fd5b813562ffffff81168114612751578182fd5b60008060408385031215612b92578182fd5b823591506020830135612ba481612f75565b809150509250929050565b60008060008060808587031215612bc4578182fd5b843593506020850135612bd681612f75565b9250604085013591506060850135612bed81612f75565b939692955090935050565b60008151808452612c10816020860160208601612f49565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b606093841b7fffffffffffffffffffffffffffffffffffffffff000000000000000000000000908116825260e89390931b7fffffff0000000000000000000000000000000000000000000000000000000000166014820152921b166017820152602b0190565b6000828483379101908152919050565b73ffffffffffffffffffffffffffffffffffffffff91909116815260200190565b600073ffffffffffffffffffffffffffffffffffffffff8088168352861515602084015285604084015280851660608401525060a06080830152612d2060a0830184612bf8565b979650505050505050565b6000602080830181845280855180835260408601915060408482028701019250838701855b82811015612d9c577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc0888603018452612d8a858351612bf8565b94509285019290850190600101612d50565b5092979650505050505050565b6000602082526127516020830184612bf8565b60208082526012908201527f546f6f206d756368207265717565737465640000000000000000000000000000604082015260600190565b60208082526013908201527f546f6f206c6974746c6520726563656976656400000000000000000000000000604082015260600190565b600060208252825160406020840152612e466060840182612bf8565b905073ffffffffffffffffffffffffffffffffffffffff60208501511660408401528091505092915050565b90815260200190565b60008083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe1843603018112612eaf578283fd5b83018035915067ffffffffffffffff821115612ec9578283fd5b602001915036819003821315612ede57600080fd5b9250929050565b60405181810167ffffffffffffffff81118282101715612f0157fe5b604052919050565b600067ffffffffffffffff821115612f1d57fe5b50601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01660200190565b60005b83811015612f64578181015183820152602001612f4c565b838111156111105750506000910152565b73ffffffffffffffffffffffffffffffffffffffff81168114612f9757600080fd5b5056fea164736f6c6343000706000a", + "linkReferences": {}, + "deployedLinkReferences": {} +} diff --git a/packages/bundler/src/abi/waura.json b/packages/bundler/src/abi/waura.json new file mode 100644 index 0000000..8c09f09 --- /dev/null +++ b/packages/bundler/src/abi/waura.json @@ -0,0 +1,145 @@ +[ + { "type": "constructor", "inputs": [], "stateMutability": "nonpayable" }, + { + "name": "Approval", + "type": "event", + "inputs": [ + { "name": "owner", "type": "address", "indexed": true, "internalType": "address" }, + { "name": "spender", "type": "address", "indexed": true, "internalType": "address" }, + { "name": "value", "type": "uint256", "indexed": false, "internalType": "uint256" } + ], + "anonymous": false + }, + { + "name": "Deposit", + "type": "event", + "inputs": [ + { "name": "dst", "type": "address", "indexed": true, "internalType": "address" }, + { "name": "wad", "type": "uint256", "indexed": false, "internalType": "uint256" } + ], + "anonymous": false + }, + { + "name": "Transfer", + "type": "event", + "inputs": [ + { "name": "from", "type": "address", "indexed": true, "internalType": "address" }, + { "name": "to", "type": "address", "indexed": true, "internalType": "address" }, + { "name": "value", "type": "uint256", "indexed": false, "internalType": "uint256" } + ], + "anonymous": false + }, + { + "name": "Withdrawal", + "type": "event", + "inputs": [ + { "name": "src", "type": "address", "indexed": true, "internalType": "address" }, + { "name": "wad", "type": "uint256", "indexed": false, "internalType": "uint256" } + ], + "anonymous": false + }, + { + "name": "allowance", + "type": "function", + "inputs": [ + { "name": "owner", "type": "address", "internalType": "address" }, + { "name": "spender", "type": "address", "internalType": "address" } + ], + "outputs": [{ "name": "", "type": "uint256", "internalType": "uint256" }], + "stateMutability": "view" + }, + { + "name": "approve", + "type": "function", + "inputs": [ + { "name": "spender", "type": "address", "internalType": "address" }, + { "name": "amount", "type": "uint256", "internalType": "uint256" } + ], + "outputs": [{ "name": "", "type": "bool", "internalType": "bool" }], + "stateMutability": "nonpayable" + }, + { + "name": "balanceOf", + "type": "function", + "inputs": [{ "name": "account", "type": "address", "internalType": "address" }], + "outputs": [{ "name": "", "type": "uint256", "internalType": "uint256" }], + "stateMutability": "view" + }, + { + "name": "decimals", + "type": "function", + "inputs": [], + "outputs": [{ "name": "", "type": "uint8", "internalType": "uint8" }], + "stateMutability": "view" + }, + { + "name": "decreaseAllowance", + "type": "function", + "inputs": [ + { "name": "spender", "type": "address", "internalType": "address" }, + { "name": "subtractedValue", "type": "uint256", "internalType": "uint256" } + ], + "outputs": [{ "name": "", "type": "bool", "internalType": "bool" }], + "stateMutability": "nonpayable" + }, + { "name": "deposit", "type": "function", "inputs": [], "outputs": [], "stateMutability": "payable" }, + { + "name": "increaseAllowance", + "type": "function", + "inputs": [ + { "name": "spender", "type": "address", "internalType": "address" }, + { "name": "addedValue", "type": "uint256", "internalType": "uint256" } + ], + "outputs": [{ "name": "", "type": "bool", "internalType": "bool" }], + "stateMutability": "nonpayable" + }, + { + "name": "name", + "type": "function", + "inputs": [], + "outputs": [{ "name": "", "type": "string", "internalType": "string" }], + "stateMutability": "view" + }, + { + "name": "symbol", + "type": "function", + "inputs": [], + "outputs": [{ "name": "", "type": "string", "internalType": "string" }], + "stateMutability": "view" + }, + { + "name": "totalSupply", + "type": "function", + "inputs": [], + "outputs": [{ "name": "", "type": "uint256", "internalType": "uint256" }], + "stateMutability": "view" + }, + { + "name": "transfer", + "type": "function", + "inputs": [ + { "name": "recipient", "type": "address", "internalType": "address" }, + { "name": "amount", "type": "uint256", "internalType": "uint256" } + ], + "outputs": [{ "name": "", "type": "bool", "internalType": "bool" }], + "stateMutability": "nonpayable" + }, + { + "name": "transferFrom", + "type": "function", + "inputs": [ + { "name": "sender", "type": "address", "internalType": "address" }, + { "name": "recipient", "type": "address", "internalType": "address" }, + { "name": "amount", "type": "uint256", "internalType": "uint256" } + ], + "outputs": [{ "name": "", "type": "bool", "internalType": "bool" }], + "stateMutability": "nonpayable" + }, + { + "name": "withdraw", + "type": "function", + "inputs": [{ "name": "wad", "type": "uint256", "internalType": "uint256" }], + "outputs": [], + "stateMutability": "nonpayable" + } +] diff --git a/packages/bundler/test/Bundler.test.ts b/packages/bundler/test/Bundler.test.ts index d073b9e..604b9cb 100644 --- a/packages/bundler/test/Bundler.test.ts +++ b/packages/bundler/test/Bundler.test.ts @@ -1,5 +1,5 @@ -import { JsonRpcProvider } from '@ethersproject/providers' -import { Signer, Wallet, ethers } from 'ethers' +import { JsonRpcProvider, TransactionRequest } from '@ethersproject/providers' +import { Signer, Wallet, ethers, utils } from 'ethers' import { IEntryPoint, SimpleAccount, @@ -15,12 +15,12 @@ import { import axios from 'axios' import { ValidationManager } from '@account-abstraction/validation-manager' import { UserOpMethodHandler } from '../src/UserOpMethodHandler' -import { arrayify, hexlify, parseEther } from 'ethers/lib/utils' +import { arrayify, hexlify, parseEther, keccak256, getCreate2Address, defaultAbiCoder } from 'ethers/lib/utils' import { ecsign, toRpcSig, keccak256 as keccak256_buffer } from 'ethereumjs-util' - -import { getUserOpHash } from '@account-abstraction/utils' - +import { getUserOpHash, sleep } from '@account-abstraction/utils' import { packUserOp, resolveHexlify } from '../../utils' +import swaprouterjson from '../src/abi/swaprouter.json' +import wauraAbiJson from '../src/abi/waura.json' describe('BundlerSendOP', function () { let provider: JsonRpcProvider @@ -35,49 +35,115 @@ describe('BundlerSendOP', function () { let entryPointSimulation: IEntryPointSimulations let smartAccountFactoryAddress: string let smartAccountFactory: SimpleAccountFactory + const rpcUrl = process.env.NETWORK_RPC || '' + const chainId = process.env.CHAIN_ID || '6321' const key = 1 before(async function () { - provider = new ethers.providers.JsonRpcProvider('https://jsonrpc.euphoria.aura.network') + provider = new ethers.providers.JsonRpcProvider(process.env.NETWORK_RPC) const mnemonic = process.env.MNEMONIC_TEST || '' wallet = ethers.Wallet.fromMnemonic(mnemonic) signer = wallet.connect(provider) - owner = '0x7875b83FEDF0d9FB12Fcb7D4351bE1FCE19a3ef7' - entryPointAddress = '0xfbC1a3AD32465bea6605d3bb7E6387caCa9337AC' + owner = process.env.OWNER || '' + entryPointAddress = process.env.ENTRYPOINT_ADDRESS || '' entryPoint = IEntryPoint__factory.connect(entryPointAddress, signer) - // smartAccountFactoryAddress = '0xa30F7A54b5f1102a01F6A590947BBBc6232F60C6' - // smartAccountFactory = SimpleAccountFactory__factory.connect(smartAccountFactoryAddress, signer) - // const res = await smartAccountFactory.createAccount(owner, '2432342342324234324234324234243223218') - // console.log('res', res) - smartAccountAddress = '0x4db902bd293768785c193c475f015da6135b2277' + smartAccountFactoryAddress = process.env.SAFACTORY_ADDRESS || '' + smartAccountFactory = SimpleAccountFactory__factory.connect(smartAccountFactoryAddress, signer) + const createAccountRes = await smartAccountFactory.createAccount(owner, '2432342342324234324234324234243223218') + let res = await createAccountRes.wait() + smartAccountAddress = await getSAAddress(res, rpcUrl) smartAccount = SimpleAccount__factory.connect(smartAccountAddress, provider) - }) - it('op should be sent success', async function () { // prefund SA - if ((await provider.getBalance(smartAccountAddress)) < parseEther('0.2')) { + if ((await provider.getBalance(smartAccountAddress)) < parseEther('0.1')) { console.log('prefund account') - const res = await signer.sendTransaction({ to: smartAccountAddress, value: parseEther('0.5') }) - console.log('prefund SA res', res) + const res = await signer.sendTransaction({ to: smartAccountAddress, value: parseEther('0.3') }) + await res.wait() // deposit to EntryPoint await entryPoint.depositTo(smartAccountAddress, { value: parseEther('0.1') }) } + }) + + it('op swap should be sent success', async function () { + const params = { + tokenIn: '0x3e40f60fcbef03198e845a8bb2ca7734dda6369c', + tokenOut: '0x36572D4A569316f9841f8094d9BC343F18f5659a', + fee: 3000, // Example fee tier + recipient: smartAccountAddress, + deadline: Math.floor(Date.now() / 1000) + 60, // 1 minutes from now + amountIn: ethers.utils.parseUnits('0.1', 18), // 1 tokenIn + amountOutMinimum: 0, // Example value + sqrtPriceLimitX96: 0, // Example value, usually 0 for no limit + } + + const wauraInterface = new ethers.utils.Interface(wauraAbiJson) + const approveCallData = wauraInterface.encodeFunctionData('approve', [ + '0x728f272ba72BaB7757D1d12054770edfF6c8d1AE', + params.amountIn, + ]) + + const res = await sendOp([params.tokenIn, 0, approveCallData]) + console.log('Approve res', res) + + const routerInterface = new ethers.utils.Interface(swaprouterjson.abi) + const swapCallData = routerInterface.encodeFunctionData('exactInputSingle', [params]) + const res1 = await sendOp(['0x728f272ba72BaB7757D1d12054770edfF6c8d1AE', 0, swapCallData], 1) + console.log('Swap res', res1) + }) + + it('op transfer should be sent success', async function () { + const res = await sendOp(['0xF4FC193579bCdA3172Fb7C49610e831b033D8d10', '10000000000000000', '0x']) + console.log('transfer res', res) + }) + + it('Should deploy Smart account success', async () => { + // const salt = generateRandomString(20, '0123456789') + const salt = ethers.utils.keccak256(ethers.utils.toUtf8Bytes('luongdeptrai1')) + // utils.AbiCoder. + console.log('salt', salt) + console.log('owner', owner) + const createAccountRes = await smartAccountFactory.createAccount(owner, salt) + let res = await createAccountRes.wait() + const smartAccountAddress = getSAAddress(res, rpcUrl) + console.log('smartAccountAddress', smartAccountAddress) + + // const create2Address = calculateCreate2Address( + // smartAccountFactoryAddress, + // salt, + // SimpleAccountFactory__factory.bytecode + // ) + // console.log('create2Address', create2Address) + + const initCode = ethers.utils.defaultAbiCoder.encode( + ['address', 'bytes'], + [smartAccountFactoryAddress, createAccountRes.data] + ) + try { + const getRes = await entryPoint.getSenderAddress(initCode, { gasLimit: 10000000 }) + res = await getRes.wait() + console.log('res', res) + } catch (err) { + console.log('err', err) + } + }) - // sendUserOperation is async, even in auto-mining. need to wait for it. - const receivedAddr = '0xF4FC193579bCdA3172Fb7C49610e831b033D8d10' - const amount = '10000000000000000' // amount to send to RECEIVER_ADDR - const callData = smartAccount.interface.encodeFunctionData('execute', [receivedAddr, amount, '0x']) - if (callData === undefined) { + async function sendOp(params: any[], nonceIncre: number = 0) { + const executeCallData = smartAccount.interface.encodeFunctionData('execute', params) + if (executeCallData === undefined) { return } - const sequenceNumber = await smartAccount.getNonce() + console.log('nonceIncre', nonceIncre) + let sequenceNumber = await smartAccount.getNonce() + sequenceNumber = sequenceNumber.add(nonceIncre) + console.log('sequenceNumber', sequenceNumber) const nonce = await entryPoint.getNonce(smartAccountAddress, sequenceNumber) + console.log('nonce', nonce) let op: UserOperation = { - sender: smartAccount.address, + sender: smartAccountAddress, nonce, - callData, + callData: executeCallData, callGasLimit: 500000, verificationGasLimit: 200000, preVerificationGas: 50000, @@ -100,12 +166,12 @@ describe('BundlerSendOP', function () { signature, } } - const signedOp = await signUserOp(op, wallet, entryPointAddress, 6321) + const signedOp = await signUserOp(op, wallet, entryPointAddress, chainId) const hexlifiedOp = await resolveHexlify(signedOp) const options = { method: 'POST', - url: 'http://localhost:3000/rpc', + url: process.env.BUNDLER_URL, headers: { accept: 'application/json', 'content-type': 'application/json', @@ -125,8 +191,39 @@ describe('BundlerSendOP', function () { .catch(function (error) { console.log('BundlerTest error', error) }) - console.log('res', res) - let preDeposit = await entryPoint.balanceOf(smartAccountAddress) - console.log('preDeposit', preDeposit) - }) + + return res + } }) + +async function getSAAddress(createAccountRes: ethers.ContractReceipt, rpcUrl: string): Promise { + const debugTxResult = await axios.post(rpcUrl, { + method: 'debug_traceTransaction', + params: [ + createAccountRes.transactionHash, + { + tracer: 'callTracer', + }, + ], + id: 1, + jsonrpc: '2.0', + }) + return debugTxResult.data.result.output.replace('000000000000000000000000', '') +} + +function generateRandomString(length: number, charset: string): string { + // const charset = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789' + let result = '' + const charactersLength = charset.length + + for (let i = 0; i < length; i++) { + const randomIndex = Math.floor(Math.random() * charactersLength) + result += charset.charAt(randomIndex) + } + + return result +} + +function calculateCreate2Address(factoryAddress: string, salt: string, smartAccountBytecode: string) { + return getCreate2Address(factoryAddress, salt, ethers.utils.keccak256(smartAccountBytecode)) +}