From cedeb46d0cac7dae88ba52117f6fb057e37ad217 Mon Sep 17 00:00:00 2001 From: cherry <60910788+cherry-yl-sh@users.noreply.github.com> Date: Mon, 13 May 2024 21:19:28 +0800 Subject: [PATCH] V1.0 main (#22) * optimize get API * add GetSupportStrategy * change response * add Support gas * add userop convert * add userop gasCompute * add paymaster_generator impl change swagger * update * update * support get token price * fix debug * fix debug * optimize gas compute * update API * update API * update API * update API * fix bug * fix bug * fix bug * fix bug * generatePaymasterData * add GetCoinPrice * update PackUserOp * update PackUserOp * update PackUserOp * update PackUserOp * update PackUserOp * update PackUserOp * update PackUserOp * update PackUserOp * feat: change call methods function * feat: split string * update PackUserOp * fix packOp bug * fix packOp bug * fix packOp bug * fix packOp bug * fix sign bug * fix sign bug * fix sign bug * fix sign bug * fix sign bug * fix sign bug * change paymasterAddress * change paymasterAddress * change paymasterAddress * v1.0 init * v1.0 init * init * v1.0 add abi * optimize * optimize * optimize * optimize * optimize * optimize * optimize * optimize * optimize * optimize * optimize * optimize * optimize * optimize * optimize * add verifying paymaster * fix start error * optimize * optimize catalog * optimize catalog * add Starknet demo * optimize * optimize * optimize * optimize * optimize * optimize * add Estimate userOp Gas API * add Estimate userOp Gas API * add Estimate userOp Gas API * optimize * optimize * optimize * optimize Gas Compute * optimize Gas Compute * optimize Gas Compute * optimize Gas Compute getBasicPreVerificationGas * optimize Gas Compute getPreVerificationGas * optimize Gas Compute getPreVerificationGas * optimize Gas Compute getPreVerificationGas * optimize Gas Compute getPreVerificationGas * optimize Gas Compute getPreVerificationGas * optimize Gas Compute getPreVerificationGas * optimize Gas Compute getPreVerificationGas * go mod tidy * fix init * fix init * fix init * optimize gas * optimize gas * optimize gas * optimize gas * update * update * update * update * update * update string * update string * update * update * update * update * add test * add test * add gas Price * optimize gas * optimize gas * fix test * fix test * fix test * fix init error * fix dep * fix version issue * fix bug * optimize test * optimize test * optimize test * optimize test * optimize test * optimize test * optimize test * optimize code * optimize code * optimize code * skip test in Github action * fix test * fix test * fix test * fix test * fix test * fix test * config files cp to image * upgrade base image * fix comment * fix comment * fix comment * fix comment * fix comment * Update coverage.yml * fix comment * fix comment * fix comment * fix comment --------- Co-authored-by: 0xRory <0x1rory@gmail.com> Co-authored-by: devops <993921@qq.com> --- .dockerignore | 2 +- .github/workflows/coverage.yml | 4 +- .gitignore | 4 +- Dockerfile | 3 +- Makefile | 5 + cmd/server/api_test.go | 86 + cmd/server/main.go | 33 +- common/data_utils/data_util.go | 41 + .../eth_entrypoint_v06.go | 2262 ++++++++++++++ .../simulate_op_revert.go | 75 + .../eth_entrypoint_v07.go | 2521 ++++++++++++++++ .../contract/erc20/erc_20.go | 759 +++++ .../contract/l1_gas_oracle/l1_gas_oracle.go | 1211 ++++++++ .../paymater_verifying_erc20_v06.go | 857 ++++++ .../paymaster_verifying_erc20_v07.go | 855 ++++++ .../simulate_entrypoint.go | 2632 +++++++++++++++++ .../ethereum_contract/ethereum_client_test.go | 99 + .../paymaster_abi/abi_type.go | 60 + .../paymaster_abi/entrypoint_v06_abi.json | 938 ++++++ .../paymaster_abi/entrypoint_v07_abi.json | 996 +++++++ .../paymaster_abi/erc20_abi.json | 222 ++ .../paymaster_abi/erc721_abi.json | 332 +++ .../paymaster_abi/l1_gas_oracle_abi.json | 289 ++ .../simulate_entrypoint_abi.json | 1312 ++++++++ .../v06_erc20_verifying_paymaster_abi.json | 468 +++ .../v07_erc20_verifying_paymaster_abi.json | 540 ++++ common/global_const/basic_strategy_code.go | 19 + common/global_const/common_const.go | 92 + common/{types => global_const}/currency.go | 2 +- common/global_const/entrypoint_tag.go | 8 + common/global_const/eoa.go | 32 + common/global_const/network.go | 33 + common/global_const/pay_type.go | 9 + common/global_const/token.go | 29 + common/model/api_request.go | 47 +- common/model/api_response.go | 69 +- common/model/client_credential.go | 5 - common/model/env.go | 26 + common/model/gas.go | 75 + common/model/secret_config.go | 12 + common/model/strategy.go | 73 +- common/model/user_operation.go | 15 - common/network/arbitrum/arbitrum_test.go | 40 + common/network/arbitrum/nodeinterface.go | 83 + common/network/base_network_executor.go | 4 + common/network/ethereum_adaptable_executor.go | 556 ++++ .../ethereum_adaptable_executor_test.go | 367 +++ common/network/pre_verification_gas_test.go | 30 + .../starknet/starknet_executor_test.go | 25 + common/network/starknet_executor.go | 17 + common/paymaster_data/paymaster_data.go | 47 + .../paymaster_data_generate.go | 73 + common/price_compoent/price_util.go | 91 + common/price_compoent/price_util_test.go | 53 + common/types/chain.go | 22 - common/types/token.go | 8 - common/user_op/user_op_test.go | 54 + common/user_op/user_operation.go | 381 +++ common/utils/util.go | 192 +- common/utils/util_test.go | 56 +- conf/conf.go | 62 - conf/env.go | 51 - {conf => config}/appsettings.yaml | 0 config/basic_config.go | 199 ++ config/basic_config.json | 145 + config/basic_strategy_config.go | 107 + config/basic_strategy_config.json | 172 ++ config/config.go | 7 + config/config_test.go | 60 + config/secret_config.go | 56 + docs/docs.go | 134 +- docs/swagger.json | 134 +- docs/swagger.yaml | 98 +- envirment/app_config.go | 86 + {conf => envirment}/jwt.go | 4 +- gas_executor/gas_computor.go | 282 ++ gas_executor/gas_computor_test.go | 282 ++ gas_executor/gas_validate.go | 62 + gas_executor/pre_vertification_gas.go | 125 + go.mod | 103 +- go.sum | 269 +- rpc_server/api/health.go | 6 +- rpc_server/api/v1/get_support_entrypoint.go | 42 - rpc_server/api/v1/get_support_strategy.go | 43 - rpc_server/api/v1/paymaster.go | 191 ++ rpc_server/api/v1/try_pay_user_operation.go | 46 - rpc_server/middlewares/auth.go | 6 +- rpc_server/middlewares/rate_limit.go | 3 + rpc_server/middlewares/rate_limit_test.go | 31 +- rpc_server/middlewares/recovery.go | 4 +- rpc_server/routers/boot.go | 31 +- rpc_server/routers/router_test.go | 8 - rpc_server/routers/routers_map.go | 13 +- service/chain_service/chain_config.go | 39 - service/chain_service/chain_service.go | 78 +- service/chain_service/chain_service_test.go | 134 + service/chain_service/chain_test.go | 30 - .../dashboard_service/dashboard_service.go | 52 +- .../dashboard_service_test.go | 12 + service/gas_service/gas_computor.go | 28 - service/gas_service/gas_computor_test.go | 1 - service/gas_service/gas_wei_generator.go | 1 - service/operator/get_estimate_user_op_gas.go | 27 + .../get_support_entry_point_execute.go | 20 +- .../get_support_entry_point_execute_test.go | 1 - .../operator/get_support_strategy_execute.go | 9 - .../get_support_strategy_execute_test.go | 1 - service/operator/operator_test.go | 215 ++ service/operator/try_pay_user_op_execute.go | 180 +- .../operator/try_pay_user_op_execute_test.go | 25 - service/pay_service/pay_service.go | 19 + service/service.go | 1 - service/validator_service/basic_validator.go | 53 +- .../validator_service/user_op_validator.go | 1 - validator/chain/chain_validator.go | 10 - .../chain/ethereum/ethereum_validator.go | 24 - validator/eip/eip_4844/4844_validator.go | 1 - validator/other/eoa_enabled_validator.go | 1 - 118 files changed, 21908 insertions(+), 1168 deletions(-) create mode 100644 cmd/server/api_test.go create mode 100644 common/data_utils/data_util.go create mode 100644 common/ethereum_contract/contract/contract_entrypoint_v06/eth_entrypoint_v06.go create mode 100644 common/ethereum_contract/contract/contract_entrypoint_v06/simulate_op_revert.go create mode 100644 common/ethereum_contract/contract/contract_entrypoint_v07/eth_entrypoint_v07.go create mode 100644 common/ethereum_contract/contract/erc20/erc_20.go create mode 100644 common/ethereum_contract/contract/l1_gas_oracle/l1_gas_oracle.go create mode 100644 common/ethereum_contract/contract/paymaster_verifying_erc20_v06/paymater_verifying_erc20_v06.go create mode 100644 common/ethereum_contract/contract/paymaster_verifying_erc20_v07/paymaster_verifying_erc20_v07.go create mode 100644 common/ethereum_contract/contract/simulate_entrypoint/simulate_entrypoint.go create mode 100644 common/ethereum_contract/ethereum_client_test.go create mode 100644 common/ethereum_contract/paymaster_abi/abi_type.go create mode 100644 common/ethereum_contract/paymaster_abi/entrypoint_v06_abi.json create mode 100644 common/ethereum_contract/paymaster_abi/entrypoint_v07_abi.json create mode 100644 common/ethereum_contract/paymaster_abi/erc20_abi.json create mode 100644 common/ethereum_contract/paymaster_abi/erc721_abi.json create mode 100644 common/ethereum_contract/paymaster_abi/l1_gas_oracle_abi.json create mode 100644 common/ethereum_contract/paymaster_abi/simulate_entrypoint_abi.json create mode 100644 common/ethereum_contract/paymaster_abi/v06_erc20_verifying_paymaster_abi.json create mode 100644 common/ethereum_contract/paymaster_abi/v07_erc20_verifying_paymaster_abi.json create mode 100644 common/global_const/basic_strategy_code.go create mode 100644 common/global_const/common_const.go rename common/{types => global_const}/currency.go (72%) create mode 100644 common/global_const/entrypoint_tag.go create mode 100644 common/global_const/eoa.go create mode 100644 common/global_const/network.go create mode 100644 common/global_const/pay_type.go create mode 100644 common/global_const/token.go delete mode 100644 common/model/client_credential.go create mode 100644 common/model/env.go create mode 100644 common/model/gas.go create mode 100644 common/model/secret_config.go delete mode 100644 common/model/user_operation.go create mode 100644 common/network/arbitrum/arbitrum_test.go create mode 100644 common/network/arbitrum/nodeinterface.go create mode 100644 common/network/base_network_executor.go create mode 100644 common/network/ethereum_adaptable_executor.go create mode 100644 common/network/ethereum_adaptable_executor_test.go create mode 100644 common/network/pre_verification_gas_test.go create mode 100644 common/network/starknet/starknet_executor_test.go create mode 100644 common/network/starknet_executor.go create mode 100644 common/paymaster_data/paymaster_data.go create mode 100644 common/paymaster_pay_type/paymaster_data_generate.go create mode 100644 common/price_compoent/price_util.go create mode 100644 common/price_compoent/price_util_test.go delete mode 100644 common/types/chain.go delete mode 100644 common/types/token.go create mode 100644 common/user_op/user_op_test.go create mode 100644 common/user_op/user_operation.go delete mode 100644 conf/conf.go delete mode 100644 conf/env.go rename {conf => config}/appsettings.yaml (100%) create mode 100644 config/basic_config.go create mode 100644 config/basic_config.json create mode 100644 config/basic_strategy_config.go create mode 100644 config/basic_strategy_config.json create mode 100644 config/config.go create mode 100644 config/config_test.go create mode 100644 config/secret_config.go create mode 100644 envirment/app_config.go rename {conf => envirment}/jwt.go (87%) create mode 100644 gas_executor/gas_computor.go create mode 100644 gas_executor/gas_computor_test.go create mode 100644 gas_executor/gas_validate.go create mode 100644 gas_executor/pre_vertification_gas.go delete mode 100644 rpc_server/api/v1/get_support_entrypoint.go delete mode 100644 rpc_server/api/v1/get_support_strategy.go create mode 100644 rpc_server/api/v1/paymaster.go delete mode 100644 rpc_server/api/v1/try_pay_user_operation.go delete mode 100644 rpc_server/routers/router_test.go delete mode 100644 service/chain_service/chain_config.go create mode 100644 service/chain_service/chain_service_test.go delete mode 100644 service/chain_service/chain_test.go create mode 100644 service/dashboard_service/dashboard_service_test.go delete mode 100644 service/gas_service/gas_computor.go delete mode 100644 service/gas_service/gas_computor_test.go delete mode 100644 service/gas_service/gas_wei_generator.go create mode 100644 service/operator/get_estimate_user_op_gas.go delete mode 100644 service/operator/get_support_entry_point_execute_test.go delete mode 100644 service/operator/get_support_strategy_execute.go delete mode 100644 service/operator/get_support_strategy_execute_test.go create mode 100644 service/operator/operator_test.go delete mode 100644 service/operator/try_pay_user_op_execute_test.go delete mode 100644 service/service.go delete mode 100644 service/validator_service/user_op_validator.go delete mode 100644 validator/chain/chain_validator.go delete mode 100644 validator/chain/ethereum/ethereum_validator.go delete mode 100644 validator/eip/eip_4844/4844_validator.go delete mode 100644 validator/other/eoa_enabled_validator.go diff --git a/.dockerignore b/.dockerignore index d581c29d..5953a05f 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1 +1 @@ -conf/appsettings.yaml +config/appsettings.yaml diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index 43fd7267..5e023742 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -14,12 +14,12 @@ jobs: - name: Set up Go uses: actions/setup-go@v4 with: - go-version: '1.22.0' + go-version: '1.22.3' - name: Build run: go build -v ./... - name: Audit run: go install golang.org/x/vuln/cmd/govulncheck@latest && govulncheck ./... - name: Test - run: go test -v ./... + run: go test -v ./... -test.short name: Building And Testing diff --git a/.gitignore b/.gitignore index 86951d3e..82f1937b 100644 --- a/.gitignore +++ b/.gitignore @@ -20,11 +20,13 @@ # Go workspace file go.work +.env + .idea .vscode/ build/ -config/*.json vendor conf/appsettings.*.yaml +config/secret_*.json diff --git a/Dockerfile b/Dockerfile index abfb935d..115cba68 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,5 @@ ## build -FROM golang:1.22.1-alpine3.19 AS build-env +FROM golang:1.22.3-alpine3.19 AS build-env RUN apk add build-base @@ -20,6 +20,7 @@ RUN mkdir -p /ep && mkdir -p /ep/log WORKDIR /ep COPY --from=build-env /go/src/app /ep/ +COPY --from=build-env /go/src/app/config/*.json /ep/config/ ENV PATH $PATH:/aa diff --git a/Makefile b/Makefile index e69de29b..8b77e671 100644 --- a/Makefile +++ b/Makefile @@ -0,0 +1,5 @@ +##generate-verifyingPaymaster-v06-pkg: +# abigen --abi=./common/ethereum_contract/paymaster_abi/simulate_entrypoint_abi.json --pkg=contract --out=./common/ethereum_contract/contract/simulate_entrypoint/simulate_entrypoint.go +## +## + diff --git a/cmd/server/api_test.go b/cmd/server/api_test.go new file mode 100644 index 00000000..f6c8107d --- /dev/null +++ b/cmd/server/api_test.go @@ -0,0 +1,86 @@ +package main + +import ( + "bytes" + "encoding/json" + "github.com/gin-gonic/gin" + "github.com/sirupsen/logrus" + "golang.org/x/xerrors" + "net/http" + "net/http/httptest" + "testing" +) + +func APITestCall(engine *gin.Engine, method, url string, body any, response any, apiToken string) (*http.Response, error) { + bodyBytes, err := json.Marshal(body) + logrus.Debug("bodyBytes: ", string(bodyBytes)) + if err != nil { + return nil, xerrors.Errorf("ERROR Marshal ", err) + } + w := httptest.NewRecorder() + w.Header().Set("Content-Type", "application/json") + w.Header().Set("Authorization", "Bearer "+apiToken) + w.Header().Set("Accept", "application/json") + req, _ := http.NewRequest(method, url, bytes.NewReader(bodyBytes)) + engine.ServeHTTP(w, req) + + logrus.Debug(req) + if w.Code != 200 { + return w.Result(), xerrors.Errorf("ERROR Code ", w.Result().Status) + } + if w.Body == nil { + return w.Result(), xerrors.Errorf("ERROR Body is nil") + } + err = json.Unmarshal(w.Body.Bytes(), response) + if err != nil { + return w.Result(), xerrors.Errorf("ERROR Unmarshal ", err) + } + //logrus.Debugf("Response: %s", w.Body) + return w.Result(), nil +} + +func TestAPI(t *testing.T) { + if testing.Short() { + t.Skip("skipping test in short mode.") + } + + initEngine("../../config/basic_strategy_config.json", "../../config/basic_config.json", "../../config/secret_config.json") + tests := []struct { + name string + test func(t *testing.T) + }{ + { + "TestHealthz", + func(t *testing.T) { + var rssponse map[string]any + _, err := APITestCall(Engine, "GET", "/api/healthz", nil, &rssponse, "") + if err != nil { + t.Error(err) + return + } + t.Logf("Response: %v", rssponse) + }, + }, + + //TODO fix this test + // + //{ + // name: "TestAuth", + // test: func(t *testing.T) { + // request := model.ClientCredential{ + // ApiKey: "String", + // } + // var response map[string]any + // _, err := APITestCall(Engine, "POST", "/api/auth", &request, &response, "") + // if err != nil { + // t.Error(err) + // return + // } + // }, + //}, + } + for _, tt := range tests { + t.Run(tt.name, tt.test) + } + +} diff --git a/cmd/server/main.go b/cmd/server/main.go index b47f0c89..4c29167f 100644 --- a/cmd/server/main.go +++ b/cmd/server/main.go @@ -1,12 +1,21 @@ package main import ( + "AAStarCommunity/EthPaymaster_BackService/config" + "AAStarCommunity/EthPaymaster_BackService/envirment" "AAStarCommunity/EthPaymaster_BackService/rpc_server/routers" "flag" + "github.com/gin-gonic/gin" + "github.com/sirupsen/logrus" "os" "strings" ) +const ( + strategyPath = "./config/basic_strategy_config.json" + basicConfigPath = "./config/basic_config.json" +) + var aPort = flag.String("port", "", "Port") // runMode running mode @@ -29,6 +38,8 @@ func runMode() string { return *aPort } +var Engine *gin.Engine + // @contact.name AAStar Support // @contact.url https://aastar.xyz // @securityDefinitions.apikey JWT @@ -37,6 +48,26 @@ func runMode() string { // @description Type 'Bearer \' to correctly set the AccessToken // @BasePath /api func main() { + secretPath := os.Getenv("secret_config_path") + if secretPath == "" { + secretPath = "./config/secret_config.json" + } + initEngine(strategyPath, basicConfigPath, secretPath) port := runMode() - _ = routers.SetRouters().Run(port) + os.Getenv("secret_config_path") + _ = Engine.Run(port) +} + +func initEngine(strategyPath string, basicConfigPath string, secretPath string) { + + logrus.Infof("secretPath: %s", secretPath) + config.InitConfig(strategyPath, basicConfigPath, secretPath) + if envirment.Environment.IsDevelopment() { + logrus.SetLevel(logrus.DebugLevel) + } else { + logrus.SetLevel(logrus.InfoLevel) + } + logrus.Infof("Environment: %s", envirment.Environment.Name) + logrus.Infof("Debugger: %v", envirment.Environment.Debugger) + Engine = routers.SetRouters() } diff --git a/common/data_utils/data_util.go b/common/data_utils/data_util.go new file mode 100644 index 00000000..a3fdf318 --- /dev/null +++ b/common/data_utils/data_util.go @@ -0,0 +1,41 @@ +package data_utils + +import ( + "AAStarCommunity/EthPaymaster_BackService/common/global_const" + "AAStarCommunity/EthPaymaster_BackService/common/model" + "AAStarCommunity/EthPaymaster_BackService/common/network" + "AAStarCommunity/EthPaymaster_BackService/common/paymaster_data" + "AAStarCommunity/EthPaymaster_BackService/common/user_op" + "github.com/sirupsen/logrus" +) + +func GetUserOpWithPaymasterAndDataForSimulate(op user_op.UserOpInput, strategy *model.Strategy, paymasterDataInput *paymaster_data.PaymasterDataInput, gasPriceResult *model.GasPrice) (*user_op.UserOpInput, error) { + executor := network.GetEthereumExecutor(strategy.GetNewWork()) + op.MaxFeePerGas = gasPriceResult.MaxFeePerGas + op.MaxPriorityFeePerGas = gasPriceResult.MaxPriorityFeePerGas + logrus.Debug("MaxFeePerGas", op.MaxFeePerGas) + logrus.Debug("MaxPriorityFeePerGas", op.MaxPriorityFeePerGas) + paymasterDataInput.PaymasterPostOpGasLimit = global_const.DummyPaymasterPostoperativelyBigint + paymasterDataInput.PaymasterVerificationGasLimit = global_const.DummyPaymasterOversimplificationBigint + op.AccountGasLimits = user_op.DummyAccountGasLimits + op.GasFees = user_op.DummyGasFees + if op.PreVerificationGas == nil { + op.PreVerificationGas = global_const.DummyReverificationsBigint + } + if op.VerificationGasLimit == nil { + op.VerificationGasLimit = global_const.DummyVerificationGasLimit + } + if op.Signature == nil { + op.Signature = global_const.DummySignatureByte + } + if op.CallGasLimit == nil { + op.CallGasLimit = global_const.DummyCallGasLimit + } + + paymasterData, err := executor.GetPaymasterData(&op, strategy, paymasterDataInput) + if err != nil { + return nil, err + } + op.PaymasterAndData = paymasterData + return &op, nil +} diff --git a/common/ethereum_contract/contract/contract_entrypoint_v06/eth_entrypoint_v06.go b/common/ethereum_contract/contract/contract_entrypoint_v06/eth_entrypoint_v06.go new file mode 100644 index 00000000..67a4ba31 --- /dev/null +++ b/common/ethereum_contract/contract/contract_entrypoint_v06/eth_entrypoint_v06.go @@ -0,0 +1,2262 @@ +// Code generated - DO NOT EDIT. +// This file is a generated binding and any manual changes will be lost. + +package contract_entrypoint_v06 + +import ( + "errors" + "math/big" + "strings" + + ethereum "github.com/ethereum/go-ethereum" + "github.com/ethereum/go-ethereum/accounts/abi" + "github.com/ethereum/go-ethereum/accounts/abi/bind" + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/core/types" + "github.com/ethereum/go-ethereum/event" +) + +// Reference imports to suppress errors if they are not otherwise used. +var ( + _ = errors.New + _ = big.NewInt + _ = strings.NewReader + _ = ethereum.NotFound + _ = bind.Bind + _ = common.Big1 + _ = types.BloomLookup + _ = event.NewSubscription + _ = abi.ConvertType +) + +// EntryPointMemoryUserOp is an auto generated low-level Go binding around an user-defined struct. +type EntryPointMemoryUserOp struct { + Sender common.Address + Nonce *big.Int + CallGasLimit *big.Int + VerificationGasLimit *big.Int + PreVerificationGas *big.Int + Paymaster common.Address + MaxFeePerGas *big.Int + MaxPriorityFeePerGas *big.Int +} + +// EntryPointUserOpInfo is an auto generated low-level Go binding around an user-defined struct. +type EntryPointUserOpInfo struct { + MUserOp EntryPointMemoryUserOp + UserOpHash [32]byte + Prefund *big.Int + ContextOffset *big.Int + PreOpGas *big.Int +} + +// IEntryPointUserOpsPerAggregator is an auto generated low-level Go binding around an user-defined struct. +type IEntryPointUserOpsPerAggregator struct { + UserOps []UserOperation + Aggregator common.Address + Signature []byte +} + +// IStakeManagerDepositInfo is an auto generated low-level Go binding around an user-defined struct. +type IStakeManagerDepositInfo struct { + Deposit *big.Int + Staked bool + Stake *big.Int + UnstakeDelaySec uint32 + WithdrawTime *big.Int +} + +// UserOperation is an auto generated low-level Go binding around an user-defined struct. +type UserOperation struct { + Sender common.Address + Nonce *big.Int + InitCode []byte + CallData []byte + CallGasLimit *big.Int + VerificationGasLimit *big.Int + PreVerificationGas *big.Int + MaxFeePerGas *big.Int + MaxPriorityFeePerGas *big.Int + PaymasterAndData []byte + Signature []byte +} + +// ContractMetaData contains all meta data concerning the Contract contract. +var ContractMetaData = &bind.MetaData{ + ABI: "[{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"preOpGas\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"paid\",\"type\":\"uint256\"},{\"internalType\":\"uint48\",\"name\":\"validAfter\",\"type\":\"uint48\"},{\"internalType\":\"uint48\",\"name\":\"validUntil\",\"type\":\"uint48\"},{\"internalType\":\"bool\",\"name\":\"targetSuccess\",\"type\":\"bool\"},{\"internalType\":\"bytes\",\"name\":\"targetResult\",\"type\":\"bytes\"}],\"name\":\"ExecutionResult\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"opIndex\",\"type\":\"uint256\"},{\"internalType\":\"string\",\"name\":\"reason\",\"type\":\"string\"}],\"name\":\"FailedOp\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"}],\"name\":\"SenderAddressResult\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"aggregator\",\"type\":\"address\"}],\"name\":\"SignatureValidationFailed\",\"type\":\"error\"},{\"inputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"preOpGas\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"prefund\",\"type\":\"uint256\"},{\"internalType\":\"bool\",\"name\":\"sigFailed\",\"type\":\"bool\"},{\"internalType\":\"uint48\",\"name\":\"validAfter\",\"type\":\"uint48\"},{\"internalType\":\"uint48\",\"name\":\"validUntil\",\"type\":\"uint48\"},{\"internalType\":\"bytes\",\"name\":\"paymasterContext\",\"type\":\"bytes\"}],\"internalType\":\"structIEntryPoint.ReturnInfo\",\"name\":\"returnInfo\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"stake\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"unstakeDelaySec\",\"type\":\"uint256\"}],\"internalType\":\"structIStakeManager.StakeInfo\",\"name\":\"senderInfo\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"stake\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"unstakeDelaySec\",\"type\":\"uint256\"}],\"internalType\":\"structIStakeManager.StakeInfo\",\"name\":\"factoryInfo\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"stake\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"unstakeDelaySec\",\"type\":\"uint256\"}],\"internalType\":\"structIStakeManager.StakeInfo\",\"name\":\"paymasterInfo\",\"type\":\"tuple\"}],\"name\":\"ValidationResult\",\"type\":\"error\"},{\"inputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"preOpGas\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"prefund\",\"type\":\"uint256\"},{\"internalType\":\"bool\",\"name\":\"sigFailed\",\"type\":\"bool\"},{\"internalType\":\"uint48\",\"name\":\"validAfter\",\"type\":\"uint48\"},{\"internalType\":\"uint48\",\"name\":\"validUntil\",\"type\":\"uint48\"},{\"internalType\":\"bytes\",\"name\":\"paymasterContext\",\"type\":\"bytes\"}],\"internalType\":\"structIEntryPoint.ReturnInfo\",\"name\":\"returnInfo\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"stake\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"unstakeDelaySec\",\"type\":\"uint256\"}],\"internalType\":\"structIStakeManager.StakeInfo\",\"name\":\"senderInfo\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"stake\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"unstakeDelaySec\",\"type\":\"uint256\"}],\"internalType\":\"structIStakeManager.StakeInfo\",\"name\":\"factoryInfo\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"stake\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"unstakeDelaySec\",\"type\":\"uint256\"}],\"internalType\":\"structIStakeManager.StakeInfo\",\"name\":\"paymasterInfo\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"aggregator\",\"type\":\"address\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"stake\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"unstakeDelaySec\",\"type\":\"uint256\"}],\"internalType\":\"structIStakeManager.StakeInfo\",\"name\":\"stakeInfo\",\"type\":\"tuple\"}],\"internalType\":\"structIEntryPoint.AggregatorStakeInfo\",\"name\":\"aggregatorInfo\",\"type\":\"tuple\"}],\"name\":\"ValidationResultWithAggregation\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"userOpHash\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"factory\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"paymaster\",\"type\":\"address\"}],\"name\":\"AccountDeployed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[],\"name\":\"BeforeExecution\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"totalDeposit\",\"type\":\"uint256\"}],\"name\":\"Deposited\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"aggregator\",\"type\":\"address\"}],\"name\":\"SignatureAggregatorChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"totalStaked\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"unstakeDelaySec\",\"type\":\"uint256\"}],\"name\":\"StakeLocked\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"withdrawTime\",\"type\":\"uint256\"}],\"name\":\"StakeUnlocked\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"withdrawAddress\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"StakeWithdrawn\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"userOpHash\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"paymaster\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"nonce\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"success\",\"type\":\"bool\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"actualGasCost\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"actualGasUsed\",\"type\":\"uint256\"}],\"name\":\"UserOperationEvent\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"userOpHash\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"nonce\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"revertReason\",\"type\":\"bytes\"}],\"name\":\"UserOperationRevertReason\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"withdrawAddress\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"Withdrawn\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"SIG_VALIDATION_FAILED\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"initCode\",\"type\":\"bytes\"},{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"paymasterAndData\",\"type\":\"bytes\"}],\"name\":\"_validateSenderAndPaymaster\",\"outputs\":[],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint32\",\"name\":\"unstakeDelaySec\",\"type\":\"uint32\"}],\"name\":\"addStake\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"balanceOf\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"depositTo\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"deposits\",\"outputs\":[{\"internalType\":\"uint112\",\"name\":\"deposit\",\"type\":\"uint112\"},{\"internalType\":\"bool\",\"name\":\"staked\",\"type\":\"bool\"},{\"internalType\":\"uint112\",\"name\":\"stake\",\"type\":\"uint112\"},{\"internalType\":\"uint32\",\"name\":\"unstakeDelaySec\",\"type\":\"uint32\"},{\"internalType\":\"uint48\",\"name\":\"withdrawTime\",\"type\":\"uint48\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"getDepositInfo\",\"outputs\":[{\"components\":[{\"internalType\":\"uint112\",\"name\":\"deposit\",\"type\":\"uint112\"},{\"internalType\":\"bool\",\"name\":\"staked\",\"type\":\"bool\"},{\"internalType\":\"uint112\",\"name\":\"stake\",\"type\":\"uint112\"},{\"internalType\":\"uint32\",\"name\":\"unstakeDelaySec\",\"type\":\"uint32\"},{\"internalType\":\"uint48\",\"name\":\"withdrawTime\",\"type\":\"uint48\"}],\"internalType\":\"structIStakeManager.DepositInfo\",\"name\":\"info\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"internalType\":\"uint192\",\"name\":\"key\",\"type\":\"uint192\"}],\"name\":\"getNonce\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"nonce\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"initCode\",\"type\":\"bytes\"}],\"name\":\"getSenderAddress\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"nonce\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"initCode\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"callData\",\"type\":\"bytes\"},{\"internalType\":\"uint256\",\"name\":\"callGasLimit\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"verificationGasLimit\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"preVerificationGas\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"maxFeePerGas\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"maxPriorityFeePerGas\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"paymasterAndData\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"signature\",\"type\":\"bytes\"}],\"internalType\":\"structUserOperation\",\"name\":\"userOp\",\"type\":\"tuple\"}],\"name\":\"getUserOpHash\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"nonce\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"initCode\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"callData\",\"type\":\"bytes\"},{\"internalType\":\"uint256\",\"name\":\"callGasLimit\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"verificationGasLimit\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"preVerificationGas\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"maxFeePerGas\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"maxPriorityFeePerGas\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"paymasterAndData\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"signature\",\"type\":\"bytes\"}],\"internalType\":\"structUserOperation[]\",\"name\":\"userOps\",\"type\":\"tuple[]\"},{\"internalType\":\"contractIAggregator\",\"name\":\"aggregator\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"signature\",\"type\":\"bytes\"}],\"internalType\":\"structIEntryPoint.UserOpsPerAggregator[]\",\"name\":\"opsPerAggregator\",\"type\":\"tuple[]\"},{\"internalType\":\"addresspayable\",\"name\":\"beneficiary\",\"type\":\"address\"}],\"name\":\"handleAggregatedOps\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"nonce\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"initCode\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"callData\",\"type\":\"bytes\"},{\"internalType\":\"uint256\",\"name\":\"callGasLimit\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"verificationGasLimit\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"preVerificationGas\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"maxFeePerGas\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"maxPriorityFeePerGas\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"paymasterAndData\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"signature\",\"type\":\"bytes\"}],\"internalType\":\"structUserOperation[]\",\"name\":\"ops\",\"type\":\"tuple[]\"},{\"internalType\":\"addresspayable\",\"name\":\"beneficiary\",\"type\":\"address\"}],\"name\":\"handleOps\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint192\",\"name\":\"key\",\"type\":\"uint192\"}],\"name\":\"incrementNonce\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"callData\",\"type\":\"bytes\"},{\"components\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"nonce\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"callGasLimit\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"verificationGasLimit\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"preVerificationGas\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"paymaster\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"maxFeePerGas\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"maxPriorityFeePerGas\",\"type\":\"uint256\"}],\"internalType\":\"structEntryPoint.MemoryUserOp\",\"name\":\"mUserOp\",\"type\":\"tuple\"},{\"internalType\":\"bytes32\",\"name\":\"userOpHash\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"prefund\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"contextOffset\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"preOpGas\",\"type\":\"uint256\"}],\"internalType\":\"structEntryPoint.UserOpInfo\",\"name\":\"opInfo\",\"type\":\"tuple\"},{\"internalType\":\"bytes\",\"name\":\"context\",\"type\":\"bytes\"}],\"name\":\"innerHandleOp\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"actualGasCost\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"uint192\",\"name\":\"\",\"type\":\"uint192\"}],\"name\":\"nonceSequenceNumber\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"nonce\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"initCode\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"callData\",\"type\":\"bytes\"},{\"internalType\":\"uint256\",\"name\":\"callGasLimit\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"verificationGasLimit\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"preVerificationGas\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"maxFeePerGas\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"maxPriorityFeePerGas\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"paymasterAndData\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"signature\",\"type\":\"bytes\"}],\"internalType\":\"structUserOperation\",\"name\":\"op\",\"type\":\"tuple\"},{\"internalType\":\"address\",\"name\":\"target\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"targetCallData\",\"type\":\"bytes\"}],\"name\":\"simulateHandleOp\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"nonce\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"initCode\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"callData\",\"type\":\"bytes\"},{\"internalType\":\"uint256\",\"name\":\"callGasLimit\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"verificationGasLimit\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"preVerificationGas\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"maxFeePerGas\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"maxPriorityFeePerGas\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"paymasterAndData\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"signature\",\"type\":\"bytes\"}],\"internalType\":\"structUserOperation\",\"name\":\"userOp\",\"type\":\"tuple\"}],\"name\":\"simulateValidation\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"unlockStake\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"addresspayable\",\"name\":\"withdrawAddress\",\"type\":\"address\"}],\"name\":\"withdrawStake\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"addresspayable\",\"name\":\"withdrawAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"withdrawAmount\",\"type\":\"uint256\"}],\"name\":\"withdrawTo\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}]", +} + +// ContractABI is the input ABI used to generate the binding from. +// Deprecated: Use ContractMetaData.ABI instead. +var ContractABI = ContractMetaData.ABI + +// Contract is an auto generated Go binding around an Ethereum contract. +type Contract struct { + ContractCaller // Read-only binding to the contract + ContractTransactor // Write-only binding to the contract + ContractFilterer // Log filterer for contract events +} + +// ContractCaller is an auto generated read-only Go binding around an Ethereum contract. +type ContractCaller struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// ContractTransactor is an auto generated write-only Go binding around an Ethereum contract. +type ContractTransactor struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// ContractFilterer is an auto generated log filtering Go binding around an Ethereum contract events. +type ContractFilterer struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// ContractSession is an auto generated Go binding around an Ethereum contract, +// with pre-set call and transact options. +type ContractSession struct { + Contract *Contract // Generic contract binding to set the session for + CallOpts bind.CallOpts // Call options to use throughout this session + TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session +} + +// ContractCallerSession is an auto generated read-only Go binding around an Ethereum contract, +// with pre-set call options. +type ContractCallerSession struct { + Contract *ContractCaller // Generic contract caller binding to set the session for + CallOpts bind.CallOpts // Call options to use throughout this session +} + +// ContractTransactorSession is an auto generated write-only Go binding around an Ethereum contract, +// with pre-set transact options. +type ContractTransactorSession struct { + Contract *ContractTransactor // Generic contract transactor binding to set the session for + TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session +} + +// ContractRaw is an auto generated low-level Go binding around an Ethereum contract. +type ContractRaw struct { + Contract *Contract // Generic contract binding to access the raw methods on +} + +// ContractCallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract. +type ContractCallerRaw struct { + Contract *ContractCaller // Generic read-only contract binding to access the raw methods on +} + +// ContractTransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract. +type ContractTransactorRaw struct { + Contract *ContractTransactor // Generic write-only contract binding to access the raw methods on +} + +// NewContract creates a new instance of Contract, bound to a specific deployed contract. +func NewContract(address common.Address, backend bind.ContractBackend) (*Contract, error) { + contract, err := bindContract(address, backend, backend, backend) + if err != nil { + return nil, err + } + return &Contract{ContractCaller: ContractCaller{contract: contract}, ContractTransactor: ContractTransactor{contract: contract}, ContractFilterer: ContractFilterer{contract: contract}}, nil +} + +// NewContractCaller creates a new read-only instance of Contract, bound to a specific deployed contract. +func NewContractCaller(address common.Address, caller bind.ContractCaller) (*ContractCaller, error) { + contract, err := bindContract(address, caller, nil, nil) + if err != nil { + return nil, err + } + return &ContractCaller{contract: contract}, nil +} + +// NewContractTransactor creates a new write-only instance of Contract, bound to a specific deployed contract. +func NewContractTransactor(address common.Address, transactor bind.ContractTransactor) (*ContractTransactor, error) { + contract, err := bindContract(address, nil, transactor, nil) + if err != nil { + return nil, err + } + return &ContractTransactor{contract: contract}, nil +} + +// NewContractFilterer creates a new log filterer instance of Contract, bound to a specific deployed contract. +func NewContractFilterer(address common.Address, filterer bind.ContractFilterer) (*ContractFilterer, error) { + contract, err := bindContract(address, nil, nil, filterer) + if err != nil { + return nil, err + } + return &ContractFilterer{contract: contract}, nil +} + +// bindContract binds a generic wrapper to an already deployed contract. +func bindContract(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) { + parsed, err := ContractMetaData.GetAbi() + if err != nil { + return nil, err + } + return bind.NewBoundContract(address, *parsed, caller, transactor, filterer), nil +} + +// Call invokes the (constant) contract method with params as input values and +// sets the output to result. The result type might be a single field for simple +// returns, a slice of interfaces for anonymous returns and a struct for named +// returns. +func (_Contract *ContractRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { + return _Contract.Contract.ContractCaller.contract.Call(opts, result, method, params...) +} + +// Transfer initiates a plain transaction to move funds to the contract, calling +// its default method if one is available. +func (_Contract *ContractRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _Contract.Contract.ContractTransactor.contract.Transfer(opts) +} + +// Transact invokes the (paid) contract method with params as input values. +func (_Contract *ContractRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _Contract.Contract.ContractTransactor.contract.Transact(opts, method, params...) +} + +// Call invokes the (constant) contract method with params as input values and +// sets the output to result. The result type might be a single field for simple +// returns, a slice of interfaces for anonymous returns and a struct for named +// returns. +func (_Contract *ContractCallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { + return _Contract.Contract.contract.Call(opts, result, method, params...) +} + +// Transfer initiates a plain transaction to move funds to the contract, calling +// its default method if one is available. +func (_Contract *ContractTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _Contract.Contract.contract.Transfer(opts) +} + +// Transact invokes the (paid) contract method with params as input values. +func (_Contract *ContractTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _Contract.Contract.contract.Transact(opts, method, params...) +} + +// SIGVALIDATIONFAILED is a free data retrieval call binding the contract method 0x8f41ec5a. +// +// Solidity: function SIG_VALIDATION_FAILED() view returns(uint256) +func (_Contract *ContractCaller) SIGVALIDATIONFAILED(opts *bind.CallOpts) (*big.Int, error) { + var out []interface{} + err := _Contract.contract.Call(opts, &out, "SIG_VALIDATION_FAILED") + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// SIGVALIDATIONFAILED is a free data retrieval call binding the contract method 0x8f41ec5a. +// +// Solidity: function SIG_VALIDATION_FAILED() view returns(uint256) +func (_Contract *ContractSession) SIGVALIDATIONFAILED() (*big.Int, error) { + return _Contract.Contract.SIGVALIDATIONFAILED(&_Contract.CallOpts) +} + +// SIGVALIDATIONFAILED is a free data retrieval call binding the contract method 0x8f41ec5a. +// +// Solidity: function SIG_VALIDATION_FAILED() view returns(uint256) +func (_Contract *ContractCallerSession) SIGVALIDATIONFAILED() (*big.Int, error) { + return _Contract.Contract.SIGVALIDATIONFAILED(&_Contract.CallOpts) +} + +// ValidateSenderAndPaymaster is a free data retrieval call binding the contract method 0x957122ab. +// +// Solidity: function _validateSenderAndPaymaster(bytes initCode, address sender, bytes paymasterAndData) view returns() +func (_Contract *ContractCaller) ValidateSenderAndPaymaster(opts *bind.CallOpts, initCode []byte, sender common.Address, paymasterAndData []byte) error { + var out []interface{} + err := _Contract.contract.Call(opts, &out, "_validateSenderAndPaymaster", initCode, sender, paymasterAndData) + + if err != nil { + return err + } + + return err + +} + +// ValidateSenderAndPaymaster is a free data retrieval call binding the contract method 0x957122ab. +// +// Solidity: function _validateSenderAndPaymaster(bytes initCode, address sender, bytes paymasterAndData) view returns() +func (_Contract *ContractSession) ValidateSenderAndPaymaster(initCode []byte, sender common.Address, paymasterAndData []byte) error { + return _Contract.Contract.ValidateSenderAndPaymaster(&_Contract.CallOpts, initCode, sender, paymasterAndData) +} + +// ValidateSenderAndPaymaster is a free data retrieval call binding the contract method 0x957122ab. +// +// Solidity: function _validateSenderAndPaymaster(bytes initCode, address sender, bytes paymasterAndData) view returns() +func (_Contract *ContractCallerSession) ValidateSenderAndPaymaster(initCode []byte, sender common.Address, paymasterAndData []byte) error { + return _Contract.Contract.ValidateSenderAndPaymaster(&_Contract.CallOpts, initCode, sender, paymasterAndData) +} + +// BalanceOf is a free data retrieval call binding the contract method 0x70a08231. +// +// Solidity: function balanceOf(address account) view returns(uint256) +func (_Contract *ContractCaller) BalanceOf(opts *bind.CallOpts, account common.Address) (*big.Int, error) { + var out []interface{} + err := _Contract.contract.Call(opts, &out, "balanceOf", account) + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// BalanceOf is a free data retrieval call binding the contract method 0x70a08231. +// +// Solidity: function balanceOf(address account) view returns(uint256) +func (_Contract *ContractSession) BalanceOf(account common.Address) (*big.Int, error) { + return _Contract.Contract.BalanceOf(&_Contract.CallOpts, account) +} + +// BalanceOf is a free data retrieval call binding the contract method 0x70a08231. +// +// Solidity: function balanceOf(address account) view returns(uint256) +func (_Contract *ContractCallerSession) BalanceOf(account common.Address) (*big.Int, error) { + return _Contract.Contract.BalanceOf(&_Contract.CallOpts, account) +} + +// Deposits is a free data retrieval call binding the contract method 0xfc7e286d. +// +// Solidity: function deposits(address ) view returns(uint112 deposit, bool staked, uint112 stake, uint32 unstakeDelaySec, uint48 withdrawTime) +func (_Contract *ContractCaller) Deposits(opts *bind.CallOpts, arg0 common.Address) (struct { + Deposit *big.Int + Staked bool + Stake *big.Int + UnstakeDelaySec uint32 + WithdrawTime *big.Int +}, error) { + var out []interface{} + err := _Contract.contract.Call(opts, &out, "deposits", arg0) + + outstruct := new(struct { + Deposit *big.Int + Staked bool + Stake *big.Int + UnstakeDelaySec uint32 + WithdrawTime *big.Int + }) + if err != nil { + return *outstruct, err + } + + outstruct.Deposit = *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + outstruct.Staked = *abi.ConvertType(out[1], new(bool)).(*bool) + outstruct.Stake = *abi.ConvertType(out[2], new(*big.Int)).(**big.Int) + outstruct.UnstakeDelaySec = *abi.ConvertType(out[3], new(uint32)).(*uint32) + outstruct.WithdrawTime = *abi.ConvertType(out[4], new(*big.Int)).(**big.Int) + + return *outstruct, err + +} + +// Deposits is a free data retrieval call binding the contract method 0xfc7e286d. +// +// Solidity: function deposits(address ) view returns(uint112 deposit, bool staked, uint112 stake, uint32 unstakeDelaySec, uint48 withdrawTime) +func (_Contract *ContractSession) Deposits(arg0 common.Address) (struct { + Deposit *big.Int + Staked bool + Stake *big.Int + UnstakeDelaySec uint32 + WithdrawTime *big.Int +}, error) { + return _Contract.Contract.Deposits(&_Contract.CallOpts, arg0) +} + +// Deposits is a free data retrieval call binding the contract method 0xfc7e286d. +// +// Solidity: function deposits(address ) view returns(uint112 deposit, bool staked, uint112 stake, uint32 unstakeDelaySec, uint48 withdrawTime) +func (_Contract *ContractCallerSession) Deposits(arg0 common.Address) (struct { + Deposit *big.Int + Staked bool + Stake *big.Int + UnstakeDelaySec uint32 + WithdrawTime *big.Int +}, error) { + return _Contract.Contract.Deposits(&_Contract.CallOpts, arg0) +} + +// GetDepositInfo is a free data retrieval call binding the contract method 0x5287ce12. +// +// Solidity: function getDepositInfo(address account) view returns((uint112,bool,uint112,uint32,uint48) info) +func (_Contract *ContractCaller) GetDepositInfo(opts *bind.CallOpts, account common.Address) (IStakeManagerDepositInfo, error) { + var out []interface{} + err := _Contract.contract.Call(opts, &out, "getDepositInfo", account) + + if err != nil { + return *new(IStakeManagerDepositInfo), err + } + + out0 := *abi.ConvertType(out[0], new(IStakeManagerDepositInfo)).(*IStakeManagerDepositInfo) + + return out0, err + +} + +// GetDepositInfo is a free data retrieval call binding the contract method 0x5287ce12. +// +// Solidity: function getDepositInfo(address account) view returns((uint112,bool,uint112,uint32,uint48) info) +func (_Contract *ContractSession) GetDepositInfo(account common.Address) (IStakeManagerDepositInfo, error) { + return _Contract.Contract.GetDepositInfo(&_Contract.CallOpts, account) +} + +// GetDepositInfo is a free data retrieval call binding the contract method 0x5287ce12. +// +// Solidity: function getDepositInfo(address account) view returns((uint112,bool,uint112,uint32,uint48) info) +func (_Contract *ContractCallerSession) GetDepositInfo(account common.Address) (IStakeManagerDepositInfo, error) { + return _Contract.Contract.GetDepositInfo(&_Contract.CallOpts, account) +} + +// GetNonce is a free data retrieval call binding the contract method 0x35567e1a. +// +// Solidity: function getNonce(address sender, uint192 key) view returns(uint256 nonce) +func (_Contract *ContractCaller) GetNonce(opts *bind.CallOpts, sender common.Address, key *big.Int) (*big.Int, error) { + var out []interface{} + err := _Contract.contract.Call(opts, &out, "getNonce", sender, key) + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// GetNonce is a free data retrieval call binding the contract method 0x35567e1a. +// +// Solidity: function getNonce(address sender, uint192 key) view returns(uint256 nonce) +func (_Contract *ContractSession) GetNonce(sender common.Address, key *big.Int) (*big.Int, error) { + return _Contract.Contract.GetNonce(&_Contract.CallOpts, sender, key) +} + +// GetNonce is a free data retrieval call binding the contract method 0x35567e1a. +// +// Solidity: function getNonce(address sender, uint192 key) view returns(uint256 nonce) +func (_Contract *ContractCallerSession) GetNonce(sender common.Address, key *big.Int) (*big.Int, error) { + return _Contract.Contract.GetNonce(&_Contract.CallOpts, sender, key) +} + +// GetUserOpHash is a free data retrieval call binding the contract method 0xa6193531. +// +// Solidity: function getUserOpHash((address,uint256,bytes,bytes,uint256,uint256,uint256,uint256,uint256,bytes,bytes) userOp) view returns(bytes32) +func (_Contract *ContractCaller) GetUserOpHash(opts *bind.CallOpts, userOp UserOperation) ([32]byte, error) { + var out []interface{} + err := _Contract.contract.Call(opts, &out, "getUserOpHash", userOp) + + if err != nil { + return *new([32]byte), err + } + + out0 := *abi.ConvertType(out[0], new([32]byte)).(*[32]byte) + + return out0, err + +} + +// GetUserOpHash is a free data retrieval call binding the contract method 0xa6193531. +// +// Solidity: function getUserOpHash((address,uint256,bytes,bytes,uint256,uint256,uint256,uint256,uint256,bytes,bytes) userOp) view returns(bytes32) +func (_Contract *ContractSession) GetUserOpHash(userOp UserOperation) ([32]byte, error) { + return _Contract.Contract.GetUserOpHash(&_Contract.CallOpts, userOp) +} + +// GetUserOpHash is a free data retrieval call binding the contract method 0xa6193531. +// +// Solidity: function getUserOpHash((address,uint256,bytes,bytes,uint256,uint256,uint256,uint256,uint256,bytes,bytes) userOp) view returns(bytes32) +func (_Contract *ContractCallerSession) GetUserOpHash(userOp UserOperation) ([32]byte, error) { + return _Contract.Contract.GetUserOpHash(&_Contract.CallOpts, userOp) +} + +// NonceSequenceNumber is a free data retrieval call binding the contract method 0x1b2e01b8. +// +// Solidity: function nonceSequenceNumber(address , uint192 ) view returns(uint256) +func (_Contract *ContractCaller) NonceSequenceNumber(opts *bind.CallOpts, arg0 common.Address, arg1 *big.Int) (*big.Int, error) { + var out []interface{} + err := _Contract.contract.Call(opts, &out, "nonceSequenceNumber", arg0, arg1) + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// NonceSequenceNumber is a free data retrieval call binding the contract method 0x1b2e01b8. +// +// Solidity: function nonceSequenceNumber(address , uint192 ) view returns(uint256) +func (_Contract *ContractSession) NonceSequenceNumber(arg0 common.Address, arg1 *big.Int) (*big.Int, error) { + return _Contract.Contract.NonceSequenceNumber(&_Contract.CallOpts, arg0, arg1) +} + +// NonceSequenceNumber is a free data retrieval call binding the contract method 0x1b2e01b8. +// +// Solidity: function nonceSequenceNumber(address , uint192 ) view returns(uint256) +func (_Contract *ContractCallerSession) NonceSequenceNumber(arg0 common.Address, arg1 *big.Int) (*big.Int, error) { + return _Contract.Contract.NonceSequenceNumber(&_Contract.CallOpts, arg0, arg1) +} + +// AddStake is a paid mutator transaction binding the contract method 0x0396cb60. +// +// Solidity: function addStake(uint32 unstakeDelaySec) payable returns() +func (_Contract *ContractTransactor) AddStake(opts *bind.TransactOpts, unstakeDelaySec uint32) (*types.Transaction, error) { + return _Contract.contract.Transact(opts, "addStake", unstakeDelaySec) +} + +// AddStake is a paid mutator transaction binding the contract method 0x0396cb60. +// +// Solidity: function addStake(uint32 unstakeDelaySec) payable returns() +func (_Contract *ContractSession) AddStake(unstakeDelaySec uint32) (*types.Transaction, error) { + return _Contract.Contract.AddStake(&_Contract.TransactOpts, unstakeDelaySec) +} + +// AddStake is a paid mutator transaction binding the contract method 0x0396cb60. +// +// Solidity: function addStake(uint32 unstakeDelaySec) payable returns() +func (_Contract *ContractTransactorSession) AddStake(unstakeDelaySec uint32) (*types.Transaction, error) { + return _Contract.Contract.AddStake(&_Contract.TransactOpts, unstakeDelaySec) +} + +// DepositTo is a paid mutator transaction binding the contract method 0xb760faf9. +// +// Solidity: function depositTo(address account) payable returns() +func (_Contract *ContractTransactor) DepositTo(opts *bind.TransactOpts, account common.Address) (*types.Transaction, error) { + return _Contract.contract.Transact(opts, "depositTo", account) +} + +// DepositTo is a paid mutator transaction binding the contract method 0xb760faf9. +// +// Solidity: function depositTo(address account) payable returns() +func (_Contract *ContractSession) DepositTo(account common.Address) (*types.Transaction, error) { + return _Contract.Contract.DepositTo(&_Contract.TransactOpts, account) +} + +// DepositTo is a paid mutator transaction binding the contract method 0xb760faf9. +// +// Solidity: function depositTo(address account) payable returns() +func (_Contract *ContractTransactorSession) DepositTo(account common.Address) (*types.Transaction, error) { + return _Contract.Contract.DepositTo(&_Contract.TransactOpts, account) +} + +// GetSenderAddress is a paid mutator transaction binding the contract method 0x9b249f69. +// +// Solidity: function getSenderAddress(bytes initCode) returns() +func (_Contract *ContractTransactor) GetSenderAddress(opts *bind.TransactOpts, initCode []byte) (*types.Transaction, error) { + return _Contract.contract.Transact(opts, "getSenderAddress", initCode) +} + +// GetSenderAddress is a paid mutator transaction binding the contract method 0x9b249f69. +// +// Solidity: function getSenderAddress(bytes initCode) returns() +func (_Contract *ContractSession) GetSenderAddress(initCode []byte) (*types.Transaction, error) { + return _Contract.Contract.GetSenderAddress(&_Contract.TransactOpts, initCode) +} + +// GetSenderAddress is a paid mutator transaction binding the contract method 0x9b249f69. +// +// Solidity: function getSenderAddress(bytes initCode) returns() +func (_Contract *ContractTransactorSession) GetSenderAddress(initCode []byte) (*types.Transaction, error) { + return _Contract.Contract.GetSenderAddress(&_Contract.TransactOpts, initCode) +} + +// HandleAggregatedOps is a paid mutator transaction binding the contract method 0x4b1d7cf5. +// +// Solidity: function handleAggregatedOps(((address,uint256,bytes,bytes,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],address,bytes)[] opsPerAggregator, address beneficiary) returns() +func (_Contract *ContractTransactor) HandleAggregatedOps(opts *bind.TransactOpts, opsPerAggregator []IEntryPointUserOpsPerAggregator, beneficiary common.Address) (*types.Transaction, error) { + return _Contract.contract.Transact(opts, "handleAggregatedOps", opsPerAggregator, beneficiary) +} + +// HandleAggregatedOps is a paid mutator transaction binding the contract method 0x4b1d7cf5. +// +// Solidity: function handleAggregatedOps(((address,uint256,bytes,bytes,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],address,bytes)[] opsPerAggregator, address beneficiary) returns() +func (_Contract *ContractSession) HandleAggregatedOps(opsPerAggregator []IEntryPointUserOpsPerAggregator, beneficiary common.Address) (*types.Transaction, error) { + return _Contract.Contract.HandleAggregatedOps(&_Contract.TransactOpts, opsPerAggregator, beneficiary) +} + +// HandleAggregatedOps is a paid mutator transaction binding the contract method 0x4b1d7cf5. +// +// Solidity: function handleAggregatedOps(((address,uint256,bytes,bytes,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],address,bytes)[] opsPerAggregator, address beneficiary) returns() +func (_Contract *ContractTransactorSession) HandleAggregatedOps(opsPerAggregator []IEntryPointUserOpsPerAggregator, beneficiary common.Address) (*types.Transaction, error) { + return _Contract.Contract.HandleAggregatedOps(&_Contract.TransactOpts, opsPerAggregator, beneficiary) +} + +// HandleOps is a paid mutator transaction binding the contract method 0x1fad948c. +// +// Solidity: function handleOps((address,uint256,bytes,bytes,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[] ops, address beneficiary) returns() +func (_Contract *ContractTransactor) HandleOps(opts *bind.TransactOpts, ops []UserOperation, beneficiary common.Address) (*types.Transaction, error) { + return _Contract.contract.Transact(opts, "handleOps", ops, beneficiary) +} + +// HandleOps is a paid mutator transaction binding the contract method 0x1fad948c. +// +// Solidity: function handleOps((address,uint256,bytes,bytes,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[] ops, address beneficiary) returns() +func (_Contract *ContractSession) HandleOps(ops []UserOperation, beneficiary common.Address) (*types.Transaction, error) { + return _Contract.Contract.HandleOps(&_Contract.TransactOpts, ops, beneficiary) +} + +// HandleOps is a paid mutator transaction binding the contract method 0x1fad948c. +// +// Solidity: function handleOps((address,uint256,bytes,bytes,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[] ops, address beneficiary) returns() +func (_Contract *ContractTransactorSession) HandleOps(ops []UserOperation, beneficiary common.Address) (*types.Transaction, error) { + return _Contract.Contract.HandleOps(&_Contract.TransactOpts, ops, beneficiary) +} + +// IncrementNonce is a paid mutator transaction binding the contract method 0x0bd28e3b. +// +// Solidity: function incrementNonce(uint192 key) returns() +func (_Contract *ContractTransactor) IncrementNonce(opts *bind.TransactOpts, key *big.Int) (*types.Transaction, error) { + return _Contract.contract.Transact(opts, "incrementNonce", key) +} + +// IncrementNonce is a paid mutator transaction binding the contract method 0x0bd28e3b. +// +// Solidity: function incrementNonce(uint192 key) returns() +func (_Contract *ContractSession) IncrementNonce(key *big.Int) (*types.Transaction, error) { + return _Contract.Contract.IncrementNonce(&_Contract.TransactOpts, key) +} + +// IncrementNonce is a paid mutator transaction binding the contract method 0x0bd28e3b. +// +// Solidity: function incrementNonce(uint192 key) returns() +func (_Contract *ContractTransactorSession) IncrementNonce(key *big.Int) (*types.Transaction, error) { + return _Contract.Contract.IncrementNonce(&_Contract.TransactOpts, key) +} + +// InnerHandleOp is a paid mutator transaction binding the contract method 0x1d732756. +// +// Solidity: function innerHandleOp(bytes callData, ((address,uint256,uint256,uint256,uint256,address,uint256,uint256),bytes32,uint256,uint256,uint256) opInfo, bytes context) returns(uint256 actualGasCost) +func (_Contract *ContractTransactor) InnerHandleOp(opts *bind.TransactOpts, callData []byte, opInfo EntryPointUserOpInfo, context []byte) (*types.Transaction, error) { + return _Contract.contract.Transact(opts, "innerHandleOp", callData, opInfo, context) +} + +// InnerHandleOp is a paid mutator transaction binding the contract method 0x1d732756. +// +// Solidity: function innerHandleOp(bytes callData, ((address,uint256,uint256,uint256,uint256,address,uint256,uint256),bytes32,uint256,uint256,uint256) opInfo, bytes context) returns(uint256 actualGasCost) +func (_Contract *ContractSession) InnerHandleOp(callData []byte, opInfo EntryPointUserOpInfo, context []byte) (*types.Transaction, error) { + return _Contract.Contract.InnerHandleOp(&_Contract.TransactOpts, callData, opInfo, context) +} + +// InnerHandleOp is a paid mutator transaction binding the contract method 0x1d732756. +// +// Solidity: function innerHandleOp(bytes callData, ((address,uint256,uint256,uint256,uint256,address,uint256,uint256),bytes32,uint256,uint256,uint256) opInfo, bytes context) returns(uint256 actualGasCost) +func (_Contract *ContractTransactorSession) InnerHandleOp(callData []byte, opInfo EntryPointUserOpInfo, context []byte) (*types.Transaction, error) { + return _Contract.Contract.InnerHandleOp(&_Contract.TransactOpts, callData, opInfo, context) +} + +// SimulateHandleOp is a paid mutator transaction binding the contract method 0xd6383f94. +// +// Solidity: function simulateHandleOp((address,uint256,bytes,bytes,uint256,uint256,uint256,uint256,uint256,bytes,bytes) op, address target, bytes targetCallData) returns() +func (_Contract *ContractTransactor) SimulateHandleOp(opts *bind.TransactOpts, op UserOperation, target common.Address, targetCallData []byte) (*types.Transaction, error) { + return _Contract.contract.Transact(opts, "simulateHandleOp", op, target, targetCallData) +} + +// SimulateHandleOp is a paid mutator transaction binding the contract method 0xd6383f94. +// +// Solidity: function simulateHandleOp((address,uint256,bytes,bytes,uint256,uint256,uint256,uint256,uint256,bytes,bytes) op, address target, bytes targetCallData) returns() +func (_Contract *ContractSession) SimulateHandleOp(op UserOperation, target common.Address, targetCallData []byte) (*types.Transaction, error) { + return _Contract.Contract.SimulateHandleOp(&_Contract.TransactOpts, op, target, targetCallData) +} + +// SimulateHandleOp is a paid mutator transaction binding the contract method 0xd6383f94. +// +// Solidity: function simulateHandleOp((address,uint256,bytes,bytes,uint256,uint256,uint256,uint256,uint256,bytes,bytes) op, address target, bytes targetCallData) returns() +func (_Contract *ContractTransactorSession) SimulateHandleOp(op UserOperation, target common.Address, targetCallData []byte) (*types.Transaction, error) { + return _Contract.Contract.SimulateHandleOp(&_Contract.TransactOpts, op, target, targetCallData) +} + +// SimulateValidation is a paid mutator transaction binding the contract method 0xee219423. +// +// Solidity: function simulateValidation((address,uint256,bytes,bytes,uint256,uint256,uint256,uint256,uint256,bytes,bytes) userOp) returns() +func (_Contract *ContractTransactor) SimulateValidation(opts *bind.TransactOpts, userOp UserOperation) (*types.Transaction, error) { + return _Contract.contract.Transact(opts, "simulateValidation", userOp) +} + +// SimulateValidation is a paid mutator transaction binding the contract method 0xee219423. +// +// Solidity: function simulateValidation((address,uint256,bytes,bytes,uint256,uint256,uint256,uint256,uint256,bytes,bytes) userOp) returns() +func (_Contract *ContractSession) SimulateValidation(userOp UserOperation) (*types.Transaction, error) { + return _Contract.Contract.SimulateValidation(&_Contract.TransactOpts, userOp) +} + +// SimulateValidation is a paid mutator transaction binding the contract method 0xee219423. +// +// Solidity: function simulateValidation((address,uint256,bytes,bytes,uint256,uint256,uint256,uint256,uint256,bytes,bytes) userOp) returns() +func (_Contract *ContractTransactorSession) SimulateValidation(userOp UserOperation) (*types.Transaction, error) { + return _Contract.Contract.SimulateValidation(&_Contract.TransactOpts, userOp) +} + +// UnlockStake is a paid mutator transaction binding the contract method 0xbb9fe6bf. +// +// Solidity: function unlockStake() returns() +func (_Contract *ContractTransactor) UnlockStake(opts *bind.TransactOpts) (*types.Transaction, error) { + return _Contract.contract.Transact(opts, "unlockStake") +} + +// UnlockStake is a paid mutator transaction binding the contract method 0xbb9fe6bf. +// +// Solidity: function unlockStake() returns() +func (_Contract *ContractSession) UnlockStake() (*types.Transaction, error) { + return _Contract.Contract.UnlockStake(&_Contract.TransactOpts) +} + +// UnlockStake is a paid mutator transaction binding the contract method 0xbb9fe6bf. +// +// Solidity: function unlockStake() returns() +func (_Contract *ContractTransactorSession) UnlockStake() (*types.Transaction, error) { + return _Contract.Contract.UnlockStake(&_Contract.TransactOpts) +} + +// WithdrawStake is a paid mutator transaction binding the contract method 0xc23a5cea. +// +// Solidity: function withdrawStake(address withdrawAddress) returns() +func (_Contract *ContractTransactor) WithdrawStake(opts *bind.TransactOpts, withdrawAddress common.Address) (*types.Transaction, error) { + return _Contract.contract.Transact(opts, "withdrawStake", withdrawAddress) +} + +// WithdrawStake is a paid mutator transaction binding the contract method 0xc23a5cea. +// +// Solidity: function withdrawStake(address withdrawAddress) returns() +func (_Contract *ContractSession) WithdrawStake(withdrawAddress common.Address) (*types.Transaction, error) { + return _Contract.Contract.WithdrawStake(&_Contract.TransactOpts, withdrawAddress) +} + +// WithdrawStake is a paid mutator transaction binding the contract method 0xc23a5cea. +// +// Solidity: function withdrawStake(address withdrawAddress) returns() +func (_Contract *ContractTransactorSession) WithdrawStake(withdrawAddress common.Address) (*types.Transaction, error) { + return _Contract.Contract.WithdrawStake(&_Contract.TransactOpts, withdrawAddress) +} + +// WithdrawTo is a paid mutator transaction binding the contract method 0x205c2878. +// +// Solidity: function withdrawTo(address withdrawAddress, uint256 withdrawAmount) returns() +func (_Contract *ContractTransactor) WithdrawTo(opts *bind.TransactOpts, withdrawAddress common.Address, withdrawAmount *big.Int) (*types.Transaction, error) { + return _Contract.contract.Transact(opts, "withdrawTo", withdrawAddress, withdrawAmount) +} + +// WithdrawTo is a paid mutator transaction binding the contract method 0x205c2878. +// +// Solidity: function withdrawTo(address withdrawAddress, uint256 withdrawAmount) returns() +func (_Contract *ContractSession) WithdrawTo(withdrawAddress common.Address, withdrawAmount *big.Int) (*types.Transaction, error) { + return _Contract.Contract.WithdrawTo(&_Contract.TransactOpts, withdrawAddress, withdrawAmount) +} + +// WithdrawTo is a paid mutator transaction binding the contract method 0x205c2878. +// +// Solidity: function withdrawTo(address withdrawAddress, uint256 withdrawAmount) returns() +func (_Contract *ContractTransactorSession) WithdrawTo(withdrawAddress common.Address, withdrawAmount *big.Int) (*types.Transaction, error) { + return _Contract.Contract.WithdrawTo(&_Contract.TransactOpts, withdrawAddress, withdrawAmount) +} + +// Receive is a paid mutator transaction binding the contract receive function. +// +// Solidity: receive() payable returns() +func (_Contract *ContractTransactor) Receive(opts *bind.TransactOpts) (*types.Transaction, error) { + return _Contract.contract.RawTransact(opts, nil) // calldata is disallowed for receive function +} + +// Receive is a paid mutator transaction binding the contract receive function. +// +// Solidity: receive() payable returns() +func (_Contract *ContractSession) Receive() (*types.Transaction, error) { + return _Contract.Contract.Receive(&_Contract.TransactOpts) +} + +// Receive is a paid mutator transaction binding the contract receive function. +// +// Solidity: receive() payable returns() +func (_Contract *ContractTransactorSession) Receive() (*types.Transaction, error) { + return _Contract.Contract.Receive(&_Contract.TransactOpts) +} + +// ContractAccountDeployedIterator is returned from FilterAccountDeployed and is used to iterate over the raw logs and unpacked data for AccountDeployed events raised by the Contract contract. +type ContractAccountDeployedIterator struct { + Event *ContractAccountDeployed // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *ContractAccountDeployedIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(ContractAccountDeployed) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(ContractAccountDeployed) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *ContractAccountDeployedIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *ContractAccountDeployedIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// ContractAccountDeployed represents a AccountDeployed event raised by the Contract contract. +type ContractAccountDeployed struct { + UserOpHash [32]byte + Sender common.Address + Factory common.Address + Paymaster common.Address + Raw types.Log // Blockchain specific contextual infos +} + +// FilterAccountDeployed is a free log retrieval operation binding the contract event 0xd51a9c61267aa6196961883ecf5ff2da6619c37dac0fa92122513fb32c032d2d. +// +// Solidity: event AccountDeployed(bytes32 indexed userOpHash, address indexed sender, address factory, address paymaster) +func (_Contract *ContractFilterer) FilterAccountDeployed(opts *bind.FilterOpts, userOpHash [][32]byte, sender []common.Address) (*ContractAccountDeployedIterator, error) { + + var userOpHashRule []interface{} + for _, userOpHashItem := range userOpHash { + userOpHashRule = append(userOpHashRule, userOpHashItem) + } + var senderRule []interface{} + for _, senderItem := range sender { + senderRule = append(senderRule, senderItem) + } + + logs, sub, err := _Contract.contract.FilterLogs(opts, "AccountDeployed", userOpHashRule, senderRule) + if err != nil { + return nil, err + } + return &ContractAccountDeployedIterator{contract: _Contract.contract, event: "AccountDeployed", logs: logs, sub: sub}, nil +} + +// WatchAccountDeployed is a free log subscription operation binding the contract event 0xd51a9c61267aa6196961883ecf5ff2da6619c37dac0fa92122513fb32c032d2d. +// +// Solidity: event AccountDeployed(bytes32 indexed userOpHash, address indexed sender, address factory, address paymaster) +func (_Contract *ContractFilterer) WatchAccountDeployed(opts *bind.WatchOpts, sink chan<- *ContractAccountDeployed, userOpHash [][32]byte, sender []common.Address) (event.Subscription, error) { + + var userOpHashRule []interface{} + for _, userOpHashItem := range userOpHash { + userOpHashRule = append(userOpHashRule, userOpHashItem) + } + var senderRule []interface{} + for _, senderItem := range sender { + senderRule = append(senderRule, senderItem) + } + + logs, sub, err := _Contract.contract.WatchLogs(opts, "AccountDeployed", userOpHashRule, senderRule) + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(ContractAccountDeployed) + if err := _Contract.contract.UnpackLog(event, "AccountDeployed", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseAccountDeployed is a log parse operation binding the contract event 0xd51a9c61267aa6196961883ecf5ff2da6619c37dac0fa92122513fb32c032d2d. +// +// Solidity: event AccountDeployed(bytes32 indexed userOpHash, address indexed sender, address factory, address paymaster) +func (_Contract *ContractFilterer) ParseAccountDeployed(log types.Log) (*ContractAccountDeployed, error) { + event := new(ContractAccountDeployed) + if err := _Contract.contract.UnpackLog(event, "AccountDeployed", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// ContractBeforeExecutionIterator is returned from FilterBeforeExecution and is used to iterate over the raw logs and unpacked data for BeforeExecution events raised by the Contract contract. +type ContractBeforeExecutionIterator struct { + Event *ContractBeforeExecution // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *ContractBeforeExecutionIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(ContractBeforeExecution) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(ContractBeforeExecution) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *ContractBeforeExecutionIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *ContractBeforeExecutionIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// ContractBeforeExecution represents a BeforeExecution event raised by the Contract contract. +type ContractBeforeExecution struct { + Raw types.Log // Blockchain specific contextual infos +} + +// FilterBeforeExecution is a free log retrieval operation binding the contract event 0xbb47ee3e183a558b1a2ff0874b079f3fc5478b7454eacf2bfc5af2ff5878f972. +// +// Solidity: event BeforeExecution() +func (_Contract *ContractFilterer) FilterBeforeExecution(opts *bind.FilterOpts) (*ContractBeforeExecutionIterator, error) { + + logs, sub, err := _Contract.contract.FilterLogs(opts, "BeforeExecution") + if err != nil { + return nil, err + } + return &ContractBeforeExecutionIterator{contract: _Contract.contract, event: "BeforeExecution", logs: logs, sub: sub}, nil +} + +// WatchBeforeExecution is a free log subscription operation binding the contract event 0xbb47ee3e183a558b1a2ff0874b079f3fc5478b7454eacf2bfc5af2ff5878f972. +// +// Solidity: event BeforeExecution() +func (_Contract *ContractFilterer) WatchBeforeExecution(opts *bind.WatchOpts, sink chan<- *ContractBeforeExecution) (event.Subscription, error) { + + logs, sub, err := _Contract.contract.WatchLogs(opts, "BeforeExecution") + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(ContractBeforeExecution) + if err := _Contract.contract.UnpackLog(event, "BeforeExecution", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseBeforeExecution is a log parse operation binding the contract event 0xbb47ee3e183a558b1a2ff0874b079f3fc5478b7454eacf2bfc5af2ff5878f972. +// +// Solidity: event BeforeExecution() +func (_Contract *ContractFilterer) ParseBeforeExecution(log types.Log) (*ContractBeforeExecution, error) { + event := new(ContractBeforeExecution) + if err := _Contract.contract.UnpackLog(event, "BeforeExecution", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// ContractDepositedIterator is returned from FilterDeposited and is used to iterate over the raw logs and unpacked data for Deposited events raised by the Contract contract. +type ContractDepositedIterator struct { + Event *ContractDeposited // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *ContractDepositedIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(ContractDeposited) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(ContractDeposited) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *ContractDepositedIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *ContractDepositedIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// ContractDeposited represents a Deposited event raised by the Contract contract. +type ContractDeposited struct { + Account common.Address + TotalDeposit *big.Int + Raw types.Log // Blockchain specific contextual infos +} + +// FilterDeposited is a free log retrieval operation binding the contract event 0x2da466a7b24304f47e87fa2e1e5a81b9831ce54fec19055ce277ca2f39ba42c4. +// +// Solidity: event Deposited(address indexed account, uint256 totalDeposit) +func (_Contract *ContractFilterer) FilterDeposited(opts *bind.FilterOpts, account []common.Address) (*ContractDepositedIterator, error) { + + var accountRule []interface{} + for _, accountItem := range account { + accountRule = append(accountRule, accountItem) + } + + logs, sub, err := _Contract.contract.FilterLogs(opts, "Deposited", accountRule) + if err != nil { + return nil, err + } + return &ContractDepositedIterator{contract: _Contract.contract, event: "Deposited", logs: logs, sub: sub}, nil +} + +// WatchDeposited is a free log subscription operation binding the contract event 0x2da466a7b24304f47e87fa2e1e5a81b9831ce54fec19055ce277ca2f39ba42c4. +// +// Solidity: event Deposited(address indexed account, uint256 totalDeposit) +func (_Contract *ContractFilterer) WatchDeposited(opts *bind.WatchOpts, sink chan<- *ContractDeposited, account []common.Address) (event.Subscription, error) { + + var accountRule []interface{} + for _, accountItem := range account { + accountRule = append(accountRule, accountItem) + } + + logs, sub, err := _Contract.contract.WatchLogs(opts, "Deposited", accountRule) + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(ContractDeposited) + if err := _Contract.contract.UnpackLog(event, "Deposited", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseDeposited is a log parse operation binding the contract event 0x2da466a7b24304f47e87fa2e1e5a81b9831ce54fec19055ce277ca2f39ba42c4. +// +// Solidity: event Deposited(address indexed account, uint256 totalDeposit) +func (_Contract *ContractFilterer) ParseDeposited(log types.Log) (*ContractDeposited, error) { + event := new(ContractDeposited) + if err := _Contract.contract.UnpackLog(event, "Deposited", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// ContractSignatureAggregatorChangedIterator is returned from FilterSignatureAggregatorChanged and is used to iterate over the raw logs and unpacked data for SignatureAggregatorChanged events raised by the Contract contract. +type ContractSignatureAggregatorChangedIterator struct { + Event *ContractSignatureAggregatorChanged // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *ContractSignatureAggregatorChangedIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(ContractSignatureAggregatorChanged) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(ContractSignatureAggregatorChanged) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *ContractSignatureAggregatorChangedIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *ContractSignatureAggregatorChangedIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// ContractSignatureAggregatorChanged represents a SignatureAggregatorChanged event raised by the Contract contract. +type ContractSignatureAggregatorChanged struct { + Aggregator common.Address + Raw types.Log // Blockchain specific contextual infos +} + +// FilterSignatureAggregatorChanged is a free log retrieval operation binding the contract event 0x575ff3acadd5ab348fe1855e217e0f3678f8d767d7494c9f9fefbee2e17cca4d. +// +// Solidity: event SignatureAggregatorChanged(address indexed aggregator) +func (_Contract *ContractFilterer) FilterSignatureAggregatorChanged(opts *bind.FilterOpts, aggregator []common.Address) (*ContractSignatureAggregatorChangedIterator, error) { + + var aggregatorRule []interface{} + for _, aggregatorItem := range aggregator { + aggregatorRule = append(aggregatorRule, aggregatorItem) + } + + logs, sub, err := _Contract.contract.FilterLogs(opts, "SignatureAggregatorChanged", aggregatorRule) + if err != nil { + return nil, err + } + return &ContractSignatureAggregatorChangedIterator{contract: _Contract.contract, event: "SignatureAggregatorChanged", logs: logs, sub: sub}, nil +} + +// WatchSignatureAggregatorChanged is a free log subscription operation binding the contract event 0x575ff3acadd5ab348fe1855e217e0f3678f8d767d7494c9f9fefbee2e17cca4d. +// +// Solidity: event SignatureAggregatorChanged(address indexed aggregator) +func (_Contract *ContractFilterer) WatchSignatureAggregatorChanged(opts *bind.WatchOpts, sink chan<- *ContractSignatureAggregatorChanged, aggregator []common.Address) (event.Subscription, error) { + + var aggregatorRule []interface{} + for _, aggregatorItem := range aggregator { + aggregatorRule = append(aggregatorRule, aggregatorItem) + } + + logs, sub, err := _Contract.contract.WatchLogs(opts, "SignatureAggregatorChanged", aggregatorRule) + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(ContractSignatureAggregatorChanged) + if err := _Contract.contract.UnpackLog(event, "SignatureAggregatorChanged", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseSignatureAggregatorChanged is a log parse operation binding the contract event 0x575ff3acadd5ab348fe1855e217e0f3678f8d767d7494c9f9fefbee2e17cca4d. +// +// Solidity: event SignatureAggregatorChanged(address indexed aggregator) +func (_Contract *ContractFilterer) ParseSignatureAggregatorChanged(log types.Log) (*ContractSignatureAggregatorChanged, error) { + event := new(ContractSignatureAggregatorChanged) + if err := _Contract.contract.UnpackLog(event, "SignatureAggregatorChanged", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// ContractStakeLockedIterator is returned from FilterStakeLocked and is used to iterate over the raw logs and unpacked data for StakeLocked events raised by the Contract contract. +type ContractStakeLockedIterator struct { + Event *ContractStakeLocked // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *ContractStakeLockedIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(ContractStakeLocked) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(ContractStakeLocked) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *ContractStakeLockedIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *ContractStakeLockedIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// ContractStakeLocked represents a StakeLocked event raised by the Contract contract. +type ContractStakeLocked struct { + Account common.Address + TotalStaked *big.Int + UnstakeDelaySec *big.Int + Raw types.Log // Blockchain specific contextual infos +} + +// FilterStakeLocked is a free log retrieval operation binding the contract event 0xa5ae833d0bb1dcd632d98a8b70973e8516812898e19bf27b70071ebc8dc52c01. +// +// Solidity: event StakeLocked(address indexed account, uint256 totalStaked, uint256 unstakeDelaySec) +func (_Contract *ContractFilterer) FilterStakeLocked(opts *bind.FilterOpts, account []common.Address) (*ContractStakeLockedIterator, error) { + + var accountRule []interface{} + for _, accountItem := range account { + accountRule = append(accountRule, accountItem) + } + + logs, sub, err := _Contract.contract.FilterLogs(opts, "StakeLocked", accountRule) + if err != nil { + return nil, err + } + return &ContractStakeLockedIterator{contract: _Contract.contract, event: "StakeLocked", logs: logs, sub: sub}, nil +} + +// WatchStakeLocked is a free log subscription operation binding the contract event 0xa5ae833d0bb1dcd632d98a8b70973e8516812898e19bf27b70071ebc8dc52c01. +// +// Solidity: event StakeLocked(address indexed account, uint256 totalStaked, uint256 unstakeDelaySec) +func (_Contract *ContractFilterer) WatchStakeLocked(opts *bind.WatchOpts, sink chan<- *ContractStakeLocked, account []common.Address) (event.Subscription, error) { + + var accountRule []interface{} + for _, accountItem := range account { + accountRule = append(accountRule, accountItem) + } + + logs, sub, err := _Contract.contract.WatchLogs(opts, "StakeLocked", accountRule) + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(ContractStakeLocked) + if err := _Contract.contract.UnpackLog(event, "StakeLocked", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseStakeLocked is a log parse operation binding the contract event 0xa5ae833d0bb1dcd632d98a8b70973e8516812898e19bf27b70071ebc8dc52c01. +// +// Solidity: event StakeLocked(address indexed account, uint256 totalStaked, uint256 unstakeDelaySec) +func (_Contract *ContractFilterer) ParseStakeLocked(log types.Log) (*ContractStakeLocked, error) { + event := new(ContractStakeLocked) + if err := _Contract.contract.UnpackLog(event, "StakeLocked", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// ContractStakeUnlockedIterator is returned from FilterStakeUnlocked and is used to iterate over the raw logs and unpacked data for StakeUnlocked events raised by the Contract contract. +type ContractStakeUnlockedIterator struct { + Event *ContractStakeUnlocked // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *ContractStakeUnlockedIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(ContractStakeUnlocked) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(ContractStakeUnlocked) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *ContractStakeUnlockedIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *ContractStakeUnlockedIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// ContractStakeUnlocked represents a StakeUnlocked event raised by the Contract contract. +type ContractStakeUnlocked struct { + Account common.Address + WithdrawTime *big.Int + Raw types.Log // Blockchain specific contextual infos +} + +// FilterStakeUnlocked is a free log retrieval operation binding the contract event 0xfa9b3c14cc825c412c9ed81b3ba365a5b459439403f18829e572ed53a4180f0a. +// +// Solidity: event StakeUnlocked(address indexed account, uint256 withdrawTime) +func (_Contract *ContractFilterer) FilterStakeUnlocked(opts *bind.FilterOpts, account []common.Address) (*ContractStakeUnlockedIterator, error) { + + var accountRule []interface{} + for _, accountItem := range account { + accountRule = append(accountRule, accountItem) + } + + logs, sub, err := _Contract.contract.FilterLogs(opts, "StakeUnlocked", accountRule) + if err != nil { + return nil, err + } + return &ContractStakeUnlockedIterator{contract: _Contract.contract, event: "StakeUnlocked", logs: logs, sub: sub}, nil +} + +// WatchStakeUnlocked is a free log subscription operation binding the contract event 0xfa9b3c14cc825c412c9ed81b3ba365a5b459439403f18829e572ed53a4180f0a. +// +// Solidity: event StakeUnlocked(address indexed account, uint256 withdrawTime) +func (_Contract *ContractFilterer) WatchStakeUnlocked(opts *bind.WatchOpts, sink chan<- *ContractStakeUnlocked, account []common.Address) (event.Subscription, error) { + + var accountRule []interface{} + for _, accountItem := range account { + accountRule = append(accountRule, accountItem) + } + + logs, sub, err := _Contract.contract.WatchLogs(opts, "StakeUnlocked", accountRule) + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(ContractStakeUnlocked) + if err := _Contract.contract.UnpackLog(event, "StakeUnlocked", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseStakeUnlocked is a log parse operation binding the contract event 0xfa9b3c14cc825c412c9ed81b3ba365a5b459439403f18829e572ed53a4180f0a. +// +// Solidity: event StakeUnlocked(address indexed account, uint256 withdrawTime) +func (_Contract *ContractFilterer) ParseStakeUnlocked(log types.Log) (*ContractStakeUnlocked, error) { + event := new(ContractStakeUnlocked) + if err := _Contract.contract.UnpackLog(event, "StakeUnlocked", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// ContractStakeWithdrawnIterator is returned from FilterStakeWithdrawn and is used to iterate over the raw logs and unpacked data for StakeWithdrawn events raised by the Contract contract. +type ContractStakeWithdrawnIterator struct { + Event *ContractStakeWithdrawn // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *ContractStakeWithdrawnIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(ContractStakeWithdrawn) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(ContractStakeWithdrawn) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *ContractStakeWithdrawnIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *ContractStakeWithdrawnIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// ContractStakeWithdrawn represents a StakeWithdrawn event raised by the Contract contract. +type ContractStakeWithdrawn struct { + Account common.Address + WithdrawAddress common.Address + Amount *big.Int + Raw types.Log // Blockchain specific contextual infos +} + +// FilterStakeWithdrawn is a free log retrieval operation binding the contract event 0xb7c918e0e249f999e965cafeb6c664271b3f4317d296461500e71da39f0cbda3. +// +// Solidity: event StakeWithdrawn(address indexed account, address withdrawAddress, uint256 amount) +func (_Contract *ContractFilterer) FilterStakeWithdrawn(opts *bind.FilterOpts, account []common.Address) (*ContractStakeWithdrawnIterator, error) { + + var accountRule []interface{} + for _, accountItem := range account { + accountRule = append(accountRule, accountItem) + } + + logs, sub, err := _Contract.contract.FilterLogs(opts, "StakeWithdrawn", accountRule) + if err != nil { + return nil, err + } + return &ContractStakeWithdrawnIterator{contract: _Contract.contract, event: "StakeWithdrawn", logs: logs, sub: sub}, nil +} + +// WatchStakeWithdrawn is a free log subscription operation binding the contract event 0xb7c918e0e249f999e965cafeb6c664271b3f4317d296461500e71da39f0cbda3. +// +// Solidity: event StakeWithdrawn(address indexed account, address withdrawAddress, uint256 amount) +func (_Contract *ContractFilterer) WatchStakeWithdrawn(opts *bind.WatchOpts, sink chan<- *ContractStakeWithdrawn, account []common.Address) (event.Subscription, error) { + + var accountRule []interface{} + for _, accountItem := range account { + accountRule = append(accountRule, accountItem) + } + + logs, sub, err := _Contract.contract.WatchLogs(opts, "StakeWithdrawn", accountRule) + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(ContractStakeWithdrawn) + if err := _Contract.contract.UnpackLog(event, "StakeWithdrawn", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseStakeWithdrawn is a log parse operation binding the contract event 0xb7c918e0e249f999e965cafeb6c664271b3f4317d296461500e71da39f0cbda3. +// +// Solidity: event StakeWithdrawn(address indexed account, address withdrawAddress, uint256 amount) +func (_Contract *ContractFilterer) ParseStakeWithdrawn(log types.Log) (*ContractStakeWithdrawn, error) { + event := new(ContractStakeWithdrawn) + if err := _Contract.contract.UnpackLog(event, "StakeWithdrawn", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// ContractUserOperationEventIterator is returned from FilterUserOperationEvent and is used to iterate over the raw logs and unpacked data for UserOperationEvent events raised by the Contract contract. +type ContractUserOperationEventIterator struct { + Event *ContractUserOperationEvent // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *ContractUserOperationEventIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(ContractUserOperationEvent) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(ContractUserOperationEvent) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *ContractUserOperationEventIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *ContractUserOperationEventIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// ContractUserOperationEvent represents a UserOperationEvent event raised by the Contract contract. +type ContractUserOperationEvent struct { + UserOpHash [32]byte + Sender common.Address + Paymaster common.Address + Nonce *big.Int + Success bool + ActualGasCost *big.Int + ActualGasUsed *big.Int + Raw types.Log // Blockchain specific contextual infos +} + +// FilterUserOperationEvent is a free log retrieval operation binding the contract event 0x49628fd1471006c1482da88028e9ce4dbb080b815c9b0344d39e5a8e6ec1419f. +// +// Solidity: event UserOperationEvent(bytes32 indexed userOpHash, address indexed sender, address indexed paymaster, uint256 nonce, bool success, uint256 actualGasCost, uint256 actualGasUsed) +func (_Contract *ContractFilterer) FilterUserOperationEvent(opts *bind.FilterOpts, userOpHash [][32]byte, sender []common.Address, paymaster []common.Address) (*ContractUserOperationEventIterator, error) { + + var userOpHashRule []interface{} + for _, userOpHashItem := range userOpHash { + userOpHashRule = append(userOpHashRule, userOpHashItem) + } + var senderRule []interface{} + for _, senderItem := range sender { + senderRule = append(senderRule, senderItem) + } + var paymasterRule []interface{} + for _, paymasterItem := range paymaster { + paymasterRule = append(paymasterRule, paymasterItem) + } + + logs, sub, err := _Contract.contract.FilterLogs(opts, "UserOperationEvent", userOpHashRule, senderRule, paymasterRule) + if err != nil { + return nil, err + } + return &ContractUserOperationEventIterator{contract: _Contract.contract, event: "UserOperationEvent", logs: logs, sub: sub}, nil +} + +// WatchUserOperationEvent is a free log subscription operation binding the contract event 0x49628fd1471006c1482da88028e9ce4dbb080b815c9b0344d39e5a8e6ec1419f. +// +// Solidity: event UserOperationEvent(bytes32 indexed userOpHash, address indexed sender, address indexed paymaster, uint256 nonce, bool success, uint256 actualGasCost, uint256 actualGasUsed) +func (_Contract *ContractFilterer) WatchUserOperationEvent(opts *bind.WatchOpts, sink chan<- *ContractUserOperationEvent, userOpHash [][32]byte, sender []common.Address, paymaster []common.Address) (event.Subscription, error) { + + var userOpHashRule []interface{} + for _, userOpHashItem := range userOpHash { + userOpHashRule = append(userOpHashRule, userOpHashItem) + } + var senderRule []interface{} + for _, senderItem := range sender { + senderRule = append(senderRule, senderItem) + } + var paymasterRule []interface{} + for _, paymasterItem := range paymaster { + paymasterRule = append(paymasterRule, paymasterItem) + } + + logs, sub, err := _Contract.contract.WatchLogs(opts, "UserOperationEvent", userOpHashRule, senderRule, paymasterRule) + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(ContractUserOperationEvent) + if err := _Contract.contract.UnpackLog(event, "UserOperationEvent", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseUserOperationEvent is a log parse operation binding the contract event 0x49628fd1471006c1482da88028e9ce4dbb080b815c9b0344d39e5a8e6ec1419f. +// +// Solidity: event UserOperationEvent(bytes32 indexed userOpHash, address indexed sender, address indexed paymaster, uint256 nonce, bool success, uint256 actualGasCost, uint256 actualGasUsed) +func (_Contract *ContractFilterer) ParseUserOperationEvent(log types.Log) (*ContractUserOperationEvent, error) { + event := new(ContractUserOperationEvent) + if err := _Contract.contract.UnpackLog(event, "UserOperationEvent", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// ContractUserOperationRevertReasonIterator is returned from FilterUserOperationRevertReason and is used to iterate over the raw logs and unpacked data for UserOperationRevertReason events raised by the Contract contract. +type ContractUserOperationRevertReasonIterator struct { + Event *ContractUserOperationRevertReason // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *ContractUserOperationRevertReasonIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(ContractUserOperationRevertReason) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(ContractUserOperationRevertReason) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *ContractUserOperationRevertReasonIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *ContractUserOperationRevertReasonIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// ContractUserOperationRevertReason represents a UserOperationRevertReason event raised by the Contract contract. +type ContractUserOperationRevertReason struct { + UserOpHash [32]byte + Sender common.Address + Nonce *big.Int + RevertReason []byte + Raw types.Log // Blockchain specific contextual infos +} + +// FilterUserOperationRevertReason is a free log retrieval operation binding the contract event 0x1c4fada7374c0a9ee8841fc38afe82932dc0f8e69012e927f061a8bae611a201. +// +// Solidity: event UserOperationRevertReason(bytes32 indexed userOpHash, address indexed sender, uint256 nonce, bytes revertReason) +func (_Contract *ContractFilterer) FilterUserOperationRevertReason(opts *bind.FilterOpts, userOpHash [][32]byte, sender []common.Address) (*ContractUserOperationRevertReasonIterator, error) { + + var userOpHashRule []interface{} + for _, userOpHashItem := range userOpHash { + userOpHashRule = append(userOpHashRule, userOpHashItem) + } + var senderRule []interface{} + for _, senderItem := range sender { + senderRule = append(senderRule, senderItem) + } + + logs, sub, err := _Contract.contract.FilterLogs(opts, "UserOperationRevertReason", userOpHashRule, senderRule) + if err != nil { + return nil, err + } + return &ContractUserOperationRevertReasonIterator{contract: _Contract.contract, event: "UserOperationRevertReason", logs: logs, sub: sub}, nil +} + +// WatchUserOperationRevertReason is a free log subscription operation binding the contract event 0x1c4fada7374c0a9ee8841fc38afe82932dc0f8e69012e927f061a8bae611a201. +// +// Solidity: event UserOperationRevertReason(bytes32 indexed userOpHash, address indexed sender, uint256 nonce, bytes revertReason) +func (_Contract *ContractFilterer) WatchUserOperationRevertReason(opts *bind.WatchOpts, sink chan<- *ContractUserOperationRevertReason, userOpHash [][32]byte, sender []common.Address) (event.Subscription, error) { + + var userOpHashRule []interface{} + for _, userOpHashItem := range userOpHash { + userOpHashRule = append(userOpHashRule, userOpHashItem) + } + var senderRule []interface{} + for _, senderItem := range sender { + senderRule = append(senderRule, senderItem) + } + + logs, sub, err := _Contract.contract.WatchLogs(opts, "UserOperationRevertReason", userOpHashRule, senderRule) + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(ContractUserOperationRevertReason) + if err := _Contract.contract.UnpackLog(event, "UserOperationRevertReason", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseUserOperationRevertReason is a log parse operation binding the contract event 0x1c4fada7374c0a9ee8841fc38afe82932dc0f8e69012e927f061a8bae611a201. +// +// Solidity: event UserOperationRevertReason(bytes32 indexed userOpHash, address indexed sender, uint256 nonce, bytes revertReason) +func (_Contract *ContractFilterer) ParseUserOperationRevertReason(log types.Log) (*ContractUserOperationRevertReason, error) { + event := new(ContractUserOperationRevertReason) + if err := _Contract.contract.UnpackLog(event, "UserOperationRevertReason", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// ContractWithdrawnIterator is returned from FilterWithdrawn and is used to iterate over the raw logs and unpacked data for Withdrawn events raised by the Contract contract. +type ContractWithdrawnIterator struct { + Event *ContractWithdrawn // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *ContractWithdrawnIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(ContractWithdrawn) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(ContractWithdrawn) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *ContractWithdrawnIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *ContractWithdrawnIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// ContractWithdrawn represents a Withdrawn event raised by the Contract contract. +type ContractWithdrawn struct { + Account common.Address + WithdrawAddress common.Address + Amount *big.Int + Raw types.Log // Blockchain specific contextual infos +} + +// FilterWithdrawn is a free log retrieval operation binding the contract event 0xd1c19fbcd4551a5edfb66d43d2e337c04837afda3482b42bdf569a8fccdae5fb. +// +// Solidity: event Withdrawn(address indexed account, address withdrawAddress, uint256 amount) +func (_Contract *ContractFilterer) FilterWithdrawn(opts *bind.FilterOpts, account []common.Address) (*ContractWithdrawnIterator, error) { + + var accountRule []interface{} + for _, accountItem := range account { + accountRule = append(accountRule, accountItem) + } + + logs, sub, err := _Contract.contract.FilterLogs(opts, "Withdrawn", accountRule) + if err != nil { + return nil, err + } + return &ContractWithdrawnIterator{contract: _Contract.contract, event: "Withdrawn", logs: logs, sub: sub}, nil +} + +// WatchWithdrawn is a free log subscription operation binding the contract event 0xd1c19fbcd4551a5edfb66d43d2e337c04837afda3482b42bdf569a8fccdae5fb. +// +// Solidity: event Withdrawn(address indexed account, address withdrawAddress, uint256 amount) +func (_Contract *ContractFilterer) WatchWithdrawn(opts *bind.WatchOpts, sink chan<- *ContractWithdrawn, account []common.Address) (event.Subscription, error) { + + var accountRule []interface{} + for _, accountItem := range account { + accountRule = append(accountRule, accountItem) + } + + logs, sub, err := _Contract.contract.WatchLogs(opts, "Withdrawn", accountRule) + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(ContractWithdrawn) + if err := _Contract.contract.UnpackLog(event, "Withdrawn", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseWithdrawn is a log parse operation binding the contract event 0xd1c19fbcd4551a5edfb66d43d2e337c04837afda3482b42bdf569a8fccdae5fb. +// +// Solidity: event Withdrawn(address indexed account, address withdrawAddress, uint256 amount) +func (_Contract *ContractFilterer) ParseWithdrawn(log types.Log) (*ContractWithdrawn, error) { + event := new(ContractWithdrawn) + if err := _Contract.contract.UnpackLog(event, "Withdrawn", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} diff --git a/common/ethereum_contract/contract/contract_entrypoint_v06/simulate_op_revert.go b/common/ethereum_contract/contract/contract_entrypoint_v06/simulate_op_revert.go new file mode 100644 index 00000000..d06915c9 --- /dev/null +++ b/common/ethereum_contract/contract/contract_entrypoint_v06/simulate_op_revert.go @@ -0,0 +1,75 @@ +package contract_entrypoint_v06 + +import ( + "AAStarCommunity/EthPaymaster_BackService/common/ethereum_contract/paymaster_abi" + "AAStarCommunity/EthPaymaster_BackService/common/utils" + "errors" + "fmt" + "github.com/ethereum/go-ethereum/accounts/abi" + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/rpc" + "github.com/sirupsen/logrus" + "golang.org/x/xerrors" + "math/big" +) + +type ExecutionResultRevert struct { + PreOpGas *big.Int + Paid *big.Int + ValidAfter *big.Int + ValidUntil *big.Int + TargetSuccess bool + TargetResult []byte +} + +func ExecutionResult() abi.Error { + return abi.NewError("ExecutionResult", abi.Arguments{ + {Name: "preOpGas", Type: paymaster_abi.Uint256Type}, + {Name: "paid", Type: paymaster_abi.Uint256Type}, + {Name: "validAfter", Type: paymaster_abi.Uint48Type}, + {Name: "validUntil", Type: paymaster_abi.Uint48Type}, + {Name: "targetSuccess", Type: paymaster_abi.BooleanType}, + {Name: "targetResult", Type: paymaster_abi.BytesType}, + }) +} + +func NewExecutionResult(inputError error, abi *abi.ABI) (*ExecutionResultRevert, error) { + + var rpcErr rpc.DataError + ok := errors.As(inputError, &rpcErr) + if !ok { + return nil, xerrors.Errorf("ExecutionResult: cannot assert type: error is not of type rpc.DataError") + } + + data, ok := rpcErr.ErrorData().(string) + + logrus.Debug("data: ", data) + if !ok { + return nil, xerrors.Errorf("ExecutionResult: cannot assert type: data is not of type string") + } + + sim := ExecutionResult() + revert, upPackerr := sim.Unpack(common.Hex2Bytes(data[2:])) + if upPackerr != nil { + // is another ERROR + errstr, parseErr := utils.ParseCallError(inputError, abi) + return nil, fmt.Errorf("executionResult err: [%s] parErr [%s]", errstr, parseErr) + } + + args, ok := revert.([]any) + if !ok { + return nil, xerrors.Errorf("executionResult: cannot assert type: args is not of type []any") + } + if len(args) != 6 { + return nil, xerrors.Errorf("executionResult: invalid args length: expected 6, got %d", len(args)) + } + + return &ExecutionResultRevert{ + PreOpGas: args[0].(*big.Int), + Paid: args[1].(*big.Int), + ValidAfter: args[2].(*big.Int), + ValidUntil: args[3].(*big.Int), + TargetSuccess: args[4].(bool), + TargetResult: args[5].([]byte), + }, nil +} diff --git a/common/ethereum_contract/contract/contract_entrypoint_v07/eth_entrypoint_v07.go b/common/ethereum_contract/contract/contract_entrypoint_v07/eth_entrypoint_v07.go new file mode 100644 index 00000000..607b9b03 --- /dev/null +++ b/common/ethereum_contract/contract/contract_entrypoint_v07/eth_entrypoint_v07.go @@ -0,0 +1,2521 @@ +// Code generated - DO NOT EDIT. +// This file is a generated binding and any manual changes will be lost. + +package contract_entrypoint_v07 + +import ( + "errors" + "math/big" + "strings" + + ethereum "github.com/ethereum/go-ethereum" + "github.com/ethereum/go-ethereum/accounts/abi" + "github.com/ethereum/go-ethereum/accounts/abi/bind" + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/core/types" + "github.com/ethereum/go-ethereum/event" +) + +// Reference imports to suppress errors if they are not otherwise used. +var ( + _ = errors.New + _ = big.NewInt + _ = strings.NewReader + _ = ethereum.NotFound + _ = bind.Bind + _ = common.Big1 + _ = types.BloomLookup + _ = event.NewSubscription + _ = abi.ConvertType +) + +// EntryPointMemoryUserOp is an auto generated low-level Go binding around an user-defined struct. +type EntryPointMemoryUserOp struct { + Sender common.Address + Nonce *big.Int + VerificationGasLimit *big.Int + CallGasLimit *big.Int + PaymasterVerificationGasLimit *big.Int + PaymasterPostOpGasLimit *big.Int + PreVerificationGas *big.Int + Paymaster common.Address + MaxFeePerGas *big.Int + MaxPriorityFeePerGas *big.Int +} + +// EntryPointUserOpInfo is an auto generated low-level Go binding around an user-defined struct. +type EntryPointUserOpInfo struct { + MUserOp EntryPointMemoryUserOp + UserOpHash [32]byte + Prefund *big.Int + ContextOffset *big.Int + PreOpGas *big.Int +} + +// IEntryPointUserOpsPerAggregator is an auto generated low-level Go binding around an user-defined struct. +type IEntryPointUserOpsPerAggregator struct { + UserOps []PackedUserOperation + Aggregator common.Address + Signature []byte +} + +// IStakeManagerDepositInfo is an auto generated low-level Go binding around an user-defined struct. +type IStakeManagerDepositInfo struct { + Deposit *big.Int + Staked bool + Stake *big.Int + UnstakeDelaySec uint32 + WithdrawTime *big.Int +} + +// PackedUserOperation is an auto generated low-level Go binding around an user-defined struct. +type PackedUserOperation struct { + Sender common.Address + Nonce *big.Int + InitCode []byte + CallData []byte + AccountGasLimits [32]byte + PreVerificationGas *big.Int + GasFees [32]byte + PaymasterAndData []byte + Signature []byte +} + +// ContractMetaData contains all meta data concerning the Contract contract. +var ContractMetaData = &bind.MetaData{ + ABI: "[{\"inputs\":[{\"internalType\":\"bool\",\"name\":\"success\",\"type\":\"bool\"},{\"internalType\":\"bytes\",\"name\":\"ret\",\"type\":\"bytes\"}],\"name\":\"DelegateAndRevert\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"opIndex\",\"type\":\"uint256\"},{\"internalType\":\"string\",\"name\":\"reason\",\"type\":\"string\"}],\"name\":\"FailedOp\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"opIndex\",\"type\":\"uint256\"},{\"internalType\":\"string\",\"name\":\"reason\",\"type\":\"string\"},{\"internalType\":\"bytes\",\"name\":\"inner\",\"type\":\"bytes\"}],\"name\":\"FailedOpWithRevert\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"returnData\",\"type\":\"bytes\"}],\"name\":\"PostOpReverted\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ReentrancyGuardReentrantCall\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"}],\"name\":\"SenderAddressResult\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"aggregator\",\"type\":\"address\"}],\"name\":\"SignatureValidationFailed\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"userOpHash\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"factory\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"paymaster\",\"type\":\"address\"}],\"name\":\"AccountDeployed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[],\"name\":\"BeforeExecution\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"totalDeposit\",\"type\":\"uint256\"}],\"name\":\"Deposited\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"userOpHash\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"nonce\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"revertReason\",\"type\":\"bytes\"}],\"name\":\"PostOpRevertReason\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"aggregator\",\"type\":\"address\"}],\"name\":\"SignatureAggregatorChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"totalStaked\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"unstakeDelaySec\",\"type\":\"uint256\"}],\"name\":\"StakeLocked\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"withdrawTime\",\"type\":\"uint256\"}],\"name\":\"StakeUnlocked\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"withdrawAddress\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"StakeWithdrawn\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"userOpHash\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"paymaster\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"nonce\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"success\",\"type\":\"bool\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"actualGasCost\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"actualGasUsed\",\"type\":\"uint256\"}],\"name\":\"UserOperationEvent\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"userOpHash\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"nonce\",\"type\":\"uint256\"}],\"name\":\"UserOperationPrefundTooLow\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"userOpHash\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"nonce\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"revertReason\",\"type\":\"bytes\"}],\"name\":\"UserOperationRevertReason\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"withdrawAddress\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"Withdrawn\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"uint32\",\"name\":\"unstakeDelaySec\",\"type\":\"uint32\"}],\"name\":\"addStake\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"balanceOf\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"target\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"delegateAndRevert\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"depositTo\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"deposits\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"deposit\",\"type\":\"uint256\"},{\"internalType\":\"bool\",\"name\":\"staked\",\"type\":\"bool\"},{\"internalType\":\"uint112\",\"name\":\"stake\",\"type\":\"uint112\"},{\"internalType\":\"uint32\",\"name\":\"unstakeDelaySec\",\"type\":\"uint32\"},{\"internalType\":\"uint48\",\"name\":\"withdrawTime\",\"type\":\"uint48\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"getDepositInfo\",\"outputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"deposit\",\"type\":\"uint256\"},{\"internalType\":\"bool\",\"name\":\"staked\",\"type\":\"bool\"},{\"internalType\":\"uint112\",\"name\":\"stake\",\"type\":\"uint112\"},{\"internalType\":\"uint32\",\"name\":\"unstakeDelaySec\",\"type\":\"uint32\"},{\"internalType\":\"uint48\",\"name\":\"withdrawTime\",\"type\":\"uint48\"}],\"internalType\":\"structIStakeManager.DepositInfo\",\"name\":\"info\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"internalType\":\"uint192\",\"name\":\"key\",\"type\":\"uint192\"}],\"name\":\"getNonce\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"nonce\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"initCode\",\"type\":\"bytes\"}],\"name\":\"getSenderAddress\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"nonce\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"initCode\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"callData\",\"type\":\"bytes\"},{\"internalType\":\"bytes32\",\"name\":\"accountGasLimits\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"preVerificationGas\",\"type\":\"uint256\"},{\"internalType\":\"bytes32\",\"name\":\"gasFees\",\"type\":\"bytes32\"},{\"internalType\":\"bytes\",\"name\":\"paymasterAndData\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"signature\",\"type\":\"bytes\"}],\"internalType\":\"structPackedUserOperation\",\"name\":\"userOp\",\"type\":\"tuple\"}],\"name\":\"getUserOpHash\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"nonce\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"initCode\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"callData\",\"type\":\"bytes\"},{\"internalType\":\"bytes32\",\"name\":\"accountGasLimits\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"preVerificationGas\",\"type\":\"uint256\"},{\"internalType\":\"bytes32\",\"name\":\"gasFees\",\"type\":\"bytes32\"},{\"internalType\":\"bytes\",\"name\":\"paymasterAndData\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"signature\",\"type\":\"bytes\"}],\"internalType\":\"structPackedUserOperation[]\",\"name\":\"userOps\",\"type\":\"tuple[]\"},{\"internalType\":\"contractIAggregator\",\"name\":\"aggregator\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"signature\",\"type\":\"bytes\"}],\"internalType\":\"structIEntryPoint.UserOpsPerAggregator[]\",\"name\":\"opsPerAggregator\",\"type\":\"tuple[]\"},{\"internalType\":\"addresspayable\",\"name\":\"beneficiary\",\"type\":\"address\"}],\"name\":\"handleAggregatedOps\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"nonce\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"initCode\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"callData\",\"type\":\"bytes\"},{\"internalType\":\"bytes32\",\"name\":\"accountGasLimits\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"preVerificationGas\",\"type\":\"uint256\"},{\"internalType\":\"bytes32\",\"name\":\"gasFees\",\"type\":\"bytes32\"},{\"internalType\":\"bytes\",\"name\":\"paymasterAndData\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"signature\",\"type\":\"bytes\"}],\"internalType\":\"structPackedUserOperation[]\",\"name\":\"ops\",\"type\":\"tuple[]\"},{\"internalType\":\"addresspayable\",\"name\":\"beneficiary\",\"type\":\"address\"}],\"name\":\"handleOps\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint192\",\"name\":\"key\",\"type\":\"uint192\"}],\"name\":\"incrementNonce\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"callData\",\"type\":\"bytes\"},{\"components\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"nonce\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"verificationGasLimit\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"callGasLimit\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"paymasterVerificationGasLimit\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"paymasterPostOpGasLimit\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"preVerificationGas\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"paymaster\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"maxFeePerGas\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"maxPriorityFeePerGas\",\"type\":\"uint256\"}],\"internalType\":\"structEntryPoint.MemoryUserOp\",\"name\":\"mUserOp\",\"type\":\"tuple\"},{\"internalType\":\"bytes32\",\"name\":\"userOpHash\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"prefund\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"contextOffset\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"preOpGas\",\"type\":\"uint256\"}],\"internalType\":\"structEntryPoint.UserOpInfo\",\"name\":\"opInfo\",\"type\":\"tuple\"},{\"internalType\":\"bytes\",\"name\":\"context\",\"type\":\"bytes\"}],\"name\":\"innerHandleOp\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"actualGasCost\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"uint192\",\"name\":\"\",\"type\":\"uint192\"}],\"name\":\"nonceSequenceNumber\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"interfaceId\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"unlockStake\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"addresspayable\",\"name\":\"withdrawAddress\",\"type\":\"address\"}],\"name\":\"withdrawStake\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"addresspayable\",\"name\":\"withdrawAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"withdrawAmount\",\"type\":\"uint256\"}],\"name\":\"withdrawTo\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}]", +} + +// ContractABI is the input ABI used to generate the binding from. +// Deprecated: Use ContractMetaData.ABI instead. +var ContractABI = ContractMetaData.ABI + +// Contract is an auto generated Go binding around an Ethereum contract. +type Contract struct { + ContractCaller // Read-only binding to the contract + ContractTransactor // Write-only binding to the contract + ContractFilterer // Log filterer for contract events +} + +// ContractCaller is an auto generated read-only Go binding around an Ethereum contract. +type ContractCaller struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// ContractTransactor is an auto generated write-only Go binding around an Ethereum contract. +type ContractTransactor struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// ContractFilterer is an auto generated log filtering Go binding around an Ethereum contract events. +type ContractFilterer struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// ContractSession is an auto generated Go binding around an Ethereum contract, +// with pre-set call and transact options. +type ContractSession struct { + Contract *Contract // Generic contract binding to set the session for + CallOpts bind.CallOpts // Call options to use throughout this session + TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session +} + +// ContractCallerSession is an auto generated read-only Go binding around an Ethereum contract, +// with pre-set call options. +type ContractCallerSession struct { + Contract *ContractCaller // Generic contract caller binding to set the session for + CallOpts bind.CallOpts // Call options to use throughout this session +} + +// ContractTransactorSession is an auto generated write-only Go binding around an Ethereum contract, +// with pre-set transact options. +type ContractTransactorSession struct { + Contract *ContractTransactor // Generic contract transactor binding to set the session for + TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session +} + +// ContractRaw is an auto generated low-level Go binding around an Ethereum contract. +type ContractRaw struct { + Contract *Contract // Generic contract binding to access the raw methods on +} + +// ContractCallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract. +type ContractCallerRaw struct { + Contract *ContractCaller // Generic read-only contract binding to access the raw methods on +} + +// ContractTransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract. +type ContractTransactorRaw struct { + Contract *ContractTransactor // Generic write-only contract binding to access the raw methods on +} + +// NewContract creates a new instance of Contract, bound to a specific deployed contract. +func NewContract(address common.Address, backend bind.ContractBackend) (*Contract, error) { + contract, err := bindContract(address, backend, backend, backend) + if err != nil { + return nil, err + } + return &Contract{ContractCaller: ContractCaller{contract: contract}, ContractTransactor: ContractTransactor{contract: contract}, ContractFilterer: ContractFilterer{contract: contract}}, nil +} + +// NewContractCaller creates a new read-only instance of Contract, bound to a specific deployed contract. +func NewContractCaller(address common.Address, caller bind.ContractCaller) (*ContractCaller, error) { + contract, err := bindContract(address, caller, nil, nil) + if err != nil { + return nil, err + } + return &ContractCaller{contract: contract}, nil +} + +// NewContractTransactor creates a new write-only instance of Contract, bound to a specific deployed contract. +func NewContractTransactor(address common.Address, transactor bind.ContractTransactor) (*ContractTransactor, error) { + contract, err := bindContract(address, nil, transactor, nil) + if err != nil { + return nil, err + } + return &ContractTransactor{contract: contract}, nil +} + +// NewContractFilterer creates a new log filterer instance of Contract, bound to a specific deployed contract. +func NewContractFilterer(address common.Address, filterer bind.ContractFilterer) (*ContractFilterer, error) { + contract, err := bindContract(address, nil, nil, filterer) + if err != nil { + return nil, err + } + return &ContractFilterer{contract: contract}, nil +} + +// bindContract binds a generic wrapper to an already deployed contract. +func bindContract(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) { + parsed, err := ContractMetaData.GetAbi() + if err != nil { + return nil, err + } + return bind.NewBoundContract(address, *parsed, caller, transactor, filterer), nil +} + +// Call invokes the (constant) contract method with params as input values and +// sets the output to result. The result type might be a single field for simple +// returns, a slice of interfaces for anonymous returns and a struct for named +// returns. +func (_Contract *ContractRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { + return _Contract.Contract.ContractCaller.contract.Call(opts, result, method, params...) +} + +// Transfer initiates a plain transaction to move funds to the contract, calling +// its default method if one is available. +func (_Contract *ContractRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _Contract.Contract.ContractTransactor.contract.Transfer(opts) +} + +// Transact invokes the (paid) contract method with params as input values. +func (_Contract *ContractRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _Contract.Contract.ContractTransactor.contract.Transact(opts, method, params...) +} + +// Call invokes the (constant) contract method with params as input values and +// sets the output to result. The result type might be a single field for simple +// returns, a slice of interfaces for anonymous returns and a struct for named +// returns. +func (_Contract *ContractCallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { + return _Contract.Contract.contract.Call(opts, result, method, params...) +} + +// Transfer initiates a plain transaction to move funds to the contract, calling +// its default method if one is available. +func (_Contract *ContractTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _Contract.Contract.contract.Transfer(opts) +} + +// Transact invokes the (paid) contract method with params as input values. +func (_Contract *ContractTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _Contract.Contract.contract.Transact(opts, method, params...) +} + +// BalanceOf is a free data retrieval call binding the contract method 0x70a08231. +// +// Solidity: function balanceOf(address account) view returns(uint256) +func (_Contract *ContractCaller) BalanceOf(opts *bind.CallOpts, account common.Address) (*big.Int, error) { + var out []interface{} + err := _Contract.contract.Call(opts, &out, "balanceOf", account) + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// BalanceOf is a free data retrieval call binding the contract method 0x70a08231. +// +// Solidity: function balanceOf(address account) view returns(uint256) +func (_Contract *ContractSession) BalanceOf(account common.Address) (*big.Int, error) { + return _Contract.Contract.BalanceOf(&_Contract.CallOpts, account) +} + +// BalanceOf is a free data retrieval call binding the contract method 0x70a08231. +// +// Solidity: function balanceOf(address account) view returns(uint256) +func (_Contract *ContractCallerSession) BalanceOf(account common.Address) (*big.Int, error) { + return _Contract.Contract.BalanceOf(&_Contract.CallOpts, account) +} + +// Deposits is a free data retrieval call binding the contract method 0xfc7e286d. +// +// Solidity: function deposits(address ) view returns(uint256 deposit, bool staked, uint112 stake, uint32 unstakeDelaySec, uint48 withdrawTime) +func (_Contract *ContractCaller) Deposits(opts *bind.CallOpts, arg0 common.Address) (struct { + Deposit *big.Int + Staked bool + Stake *big.Int + UnstakeDelaySec uint32 + WithdrawTime *big.Int +}, error) { + var out []interface{} + err := _Contract.contract.Call(opts, &out, "deposits", arg0) + + outstruct := new(struct { + Deposit *big.Int + Staked bool + Stake *big.Int + UnstakeDelaySec uint32 + WithdrawTime *big.Int + }) + if err != nil { + return *outstruct, err + } + + outstruct.Deposit = *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + outstruct.Staked = *abi.ConvertType(out[1], new(bool)).(*bool) + outstruct.Stake = *abi.ConvertType(out[2], new(*big.Int)).(**big.Int) + outstruct.UnstakeDelaySec = *abi.ConvertType(out[3], new(uint32)).(*uint32) + outstruct.WithdrawTime = *abi.ConvertType(out[4], new(*big.Int)).(**big.Int) + + return *outstruct, err + +} + +// Deposits is a free data retrieval call binding the contract method 0xfc7e286d. +// +// Solidity: function deposits(address ) view returns(uint256 deposit, bool staked, uint112 stake, uint32 unstakeDelaySec, uint48 withdrawTime) +func (_Contract *ContractSession) Deposits(arg0 common.Address) (struct { + Deposit *big.Int + Staked bool + Stake *big.Int + UnstakeDelaySec uint32 + WithdrawTime *big.Int +}, error) { + return _Contract.Contract.Deposits(&_Contract.CallOpts, arg0) +} + +// Deposits is a free data retrieval call binding the contract method 0xfc7e286d. +// +// Solidity: function deposits(address ) view returns(uint256 deposit, bool staked, uint112 stake, uint32 unstakeDelaySec, uint48 withdrawTime) +func (_Contract *ContractCallerSession) Deposits(arg0 common.Address) (struct { + Deposit *big.Int + Staked bool + Stake *big.Int + UnstakeDelaySec uint32 + WithdrawTime *big.Int +}, error) { + return _Contract.Contract.Deposits(&_Contract.CallOpts, arg0) +} + +// GetDepositInfo is a free data retrieval call binding the contract method 0x5287ce12. +// +// Solidity: function getDepositInfo(address account) view returns((uint256,bool,uint112,uint32,uint48) info) +func (_Contract *ContractCaller) GetDepositInfo(opts *bind.CallOpts, account common.Address) (IStakeManagerDepositInfo, error) { + var out []interface{} + err := _Contract.contract.Call(opts, &out, "getDepositInfo", account) + + if err != nil { + return *new(IStakeManagerDepositInfo), err + } + + out0 := *abi.ConvertType(out[0], new(IStakeManagerDepositInfo)).(*IStakeManagerDepositInfo) + + return out0, err + +} + +// GetDepositInfo is a free data retrieval call binding the contract method 0x5287ce12. +// +// Solidity: function getDepositInfo(address account) view returns((uint256,bool,uint112,uint32,uint48) info) +func (_Contract *ContractSession) GetDepositInfo(account common.Address) (IStakeManagerDepositInfo, error) { + return _Contract.Contract.GetDepositInfo(&_Contract.CallOpts, account) +} + +// GetDepositInfo is a free data retrieval call binding the contract method 0x5287ce12. +// +// Solidity: function getDepositInfo(address account) view returns((uint256,bool,uint112,uint32,uint48) info) +func (_Contract *ContractCallerSession) GetDepositInfo(account common.Address) (IStakeManagerDepositInfo, error) { + return _Contract.Contract.GetDepositInfo(&_Contract.CallOpts, account) +} + +// GetNonce is a free data retrieval call binding the contract method 0x35567e1a. +// +// Solidity: function getNonce(address sender, uint192 key) view returns(uint256 nonce) +func (_Contract *ContractCaller) GetNonce(opts *bind.CallOpts, sender common.Address, key *big.Int) (*big.Int, error) { + var out []interface{} + err := _Contract.contract.Call(opts, &out, "getNonce", sender, key) + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// GetNonce is a free data retrieval call binding the contract method 0x35567e1a. +// +// Solidity: function getNonce(address sender, uint192 key) view returns(uint256 nonce) +func (_Contract *ContractSession) GetNonce(sender common.Address, key *big.Int) (*big.Int, error) { + return _Contract.Contract.GetNonce(&_Contract.CallOpts, sender, key) +} + +// GetNonce is a free data retrieval call binding the contract method 0x35567e1a. +// +// Solidity: function getNonce(address sender, uint192 key) view returns(uint256 nonce) +func (_Contract *ContractCallerSession) GetNonce(sender common.Address, key *big.Int) (*big.Int, error) { + return _Contract.Contract.GetNonce(&_Contract.CallOpts, sender, key) +} + +// GetUserOpHash is a free data retrieval call binding the contract method 0x22cdde4c. +// +// Solidity: function getUserOpHash((address,uint256,bytes,bytes,bytes32,uint256,bytes32,bytes,bytes) userOp) view returns(bytes32) +func (_Contract *ContractCaller) GetUserOpHash(opts *bind.CallOpts, userOp PackedUserOperation) ([32]byte, error) { + var out []interface{} + err := _Contract.contract.Call(opts, &out, "getUserOpHash", userOp) + + if err != nil { + return *new([32]byte), err + } + + out0 := *abi.ConvertType(out[0], new([32]byte)).(*[32]byte) + + return out0, err + +} + +// GetUserOpHash is a free data retrieval call binding the contract method 0x22cdde4c. +// +// Solidity: function getUserOpHash((address,uint256,bytes,bytes,bytes32,uint256,bytes32,bytes,bytes) userOp) view returns(bytes32) +func (_Contract *ContractSession) GetUserOpHash(userOp PackedUserOperation) ([32]byte, error) { + return _Contract.Contract.GetUserOpHash(&_Contract.CallOpts, userOp) +} + +// GetUserOpHash is a free data retrieval call binding the contract method 0x22cdde4c. +// +// Solidity: function getUserOpHash((address,uint256,bytes,bytes,bytes32,uint256,bytes32,bytes,bytes) userOp) view returns(bytes32) +func (_Contract *ContractCallerSession) GetUserOpHash(userOp PackedUserOperation) ([32]byte, error) { + return _Contract.Contract.GetUserOpHash(&_Contract.CallOpts, userOp) +} + +// NonceSequenceNumber is a free data retrieval call binding the contract method 0x1b2e01b8. +// +// Solidity: function nonceSequenceNumber(address , uint192 ) view returns(uint256) +func (_Contract *ContractCaller) NonceSequenceNumber(opts *bind.CallOpts, arg0 common.Address, arg1 *big.Int) (*big.Int, error) { + var out []interface{} + err := _Contract.contract.Call(opts, &out, "nonceSequenceNumber", arg0, arg1) + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// NonceSequenceNumber is a free data retrieval call binding the contract method 0x1b2e01b8. +// +// Solidity: function nonceSequenceNumber(address , uint192 ) view returns(uint256) +func (_Contract *ContractSession) NonceSequenceNumber(arg0 common.Address, arg1 *big.Int) (*big.Int, error) { + return _Contract.Contract.NonceSequenceNumber(&_Contract.CallOpts, arg0, arg1) +} + +// NonceSequenceNumber is a free data retrieval call binding the contract method 0x1b2e01b8. +// +// Solidity: function nonceSequenceNumber(address , uint192 ) view returns(uint256) +func (_Contract *ContractCallerSession) NonceSequenceNumber(arg0 common.Address, arg1 *big.Int) (*big.Int, error) { + return _Contract.Contract.NonceSequenceNumber(&_Contract.CallOpts, arg0, arg1) +} + +// SupportsInterface is a free data retrieval call binding the contract method 0x01ffc9a7. +// +// Solidity: function supportsInterface(bytes4 interfaceId) view returns(bool) +func (_Contract *ContractCaller) SupportsInterface(opts *bind.CallOpts, interfaceId [4]byte) (bool, error) { + var out []interface{} + err := _Contract.contract.Call(opts, &out, "supportsInterface", interfaceId) + + if err != nil { + return *new(bool), err + } + + out0 := *abi.ConvertType(out[0], new(bool)).(*bool) + + return out0, err + +} + +// SupportsInterface is a free data retrieval call binding the contract method 0x01ffc9a7. +// +// Solidity: function supportsInterface(bytes4 interfaceId) view returns(bool) +func (_Contract *ContractSession) SupportsInterface(interfaceId [4]byte) (bool, error) { + return _Contract.Contract.SupportsInterface(&_Contract.CallOpts, interfaceId) +} + +// SupportsInterface is a free data retrieval call binding the contract method 0x01ffc9a7. +// +// Solidity: function supportsInterface(bytes4 interfaceId) view returns(bool) +func (_Contract *ContractCallerSession) SupportsInterface(interfaceId [4]byte) (bool, error) { + return _Contract.Contract.SupportsInterface(&_Contract.CallOpts, interfaceId) +} + +// AddStake is a paid mutator transaction binding the contract method 0x0396cb60. +// +// Solidity: function addStake(uint32 unstakeDelaySec) payable returns() +func (_Contract *ContractTransactor) AddStake(opts *bind.TransactOpts, unstakeDelaySec uint32) (*types.Transaction, error) { + return _Contract.contract.Transact(opts, "addStake", unstakeDelaySec) +} + +// AddStake is a paid mutator transaction binding the contract method 0x0396cb60. +// +// Solidity: function addStake(uint32 unstakeDelaySec) payable returns() +func (_Contract *ContractSession) AddStake(unstakeDelaySec uint32) (*types.Transaction, error) { + return _Contract.Contract.AddStake(&_Contract.TransactOpts, unstakeDelaySec) +} + +// AddStake is a paid mutator transaction binding the contract method 0x0396cb60. +// +// Solidity: function addStake(uint32 unstakeDelaySec) payable returns() +func (_Contract *ContractTransactorSession) AddStake(unstakeDelaySec uint32) (*types.Transaction, error) { + return _Contract.Contract.AddStake(&_Contract.TransactOpts, unstakeDelaySec) +} + +// DelegateAndRevert is a paid mutator transaction binding the contract method 0x850aaf62. +// +// Solidity: function delegateAndRevert(address target, bytes data) returns() +func (_Contract *ContractTransactor) DelegateAndRevert(opts *bind.TransactOpts, target common.Address, data []byte) (*types.Transaction, error) { + return _Contract.contract.Transact(opts, "delegateAndRevert", target, data) +} + +// DelegateAndRevert is a paid mutator transaction binding the contract method 0x850aaf62. +// +// Solidity: function delegateAndRevert(address target, bytes data) returns() +func (_Contract *ContractSession) DelegateAndRevert(target common.Address, data []byte) (*types.Transaction, error) { + return _Contract.Contract.DelegateAndRevert(&_Contract.TransactOpts, target, data) +} + +// DelegateAndRevert is a paid mutator transaction binding the contract method 0x850aaf62. +// +// Solidity: function delegateAndRevert(address target, bytes data) returns() +func (_Contract *ContractTransactorSession) DelegateAndRevert(target common.Address, data []byte) (*types.Transaction, error) { + return _Contract.Contract.DelegateAndRevert(&_Contract.TransactOpts, target, data) +} + +// DepositTo is a paid mutator transaction binding the contract method 0xb760faf9. +// +// Solidity: function depositTo(address account) payable returns() +func (_Contract *ContractTransactor) DepositTo(opts *bind.TransactOpts, account common.Address) (*types.Transaction, error) { + return _Contract.contract.Transact(opts, "depositTo", account) +} + +// DepositTo is a paid mutator transaction binding the contract method 0xb760faf9. +// +// Solidity: function depositTo(address account) payable returns() +func (_Contract *ContractSession) DepositTo(account common.Address) (*types.Transaction, error) { + return _Contract.Contract.DepositTo(&_Contract.TransactOpts, account) +} + +// DepositTo is a paid mutator transaction binding the contract method 0xb760faf9. +// +// Solidity: function depositTo(address account) payable returns() +func (_Contract *ContractTransactorSession) DepositTo(account common.Address) (*types.Transaction, error) { + return _Contract.Contract.DepositTo(&_Contract.TransactOpts, account) +} + +// GetSenderAddress is a paid mutator transaction binding the contract method 0x9b249f69. +// +// Solidity: function getSenderAddress(bytes initCode) returns() +func (_Contract *ContractTransactor) GetSenderAddress(opts *bind.TransactOpts, initCode []byte) (*types.Transaction, error) { + return _Contract.contract.Transact(opts, "getSenderAddress", initCode) +} + +// GetSenderAddress is a paid mutator transaction binding the contract method 0x9b249f69. +// +// Solidity: function getSenderAddress(bytes initCode) returns() +func (_Contract *ContractSession) GetSenderAddress(initCode []byte) (*types.Transaction, error) { + return _Contract.Contract.GetSenderAddress(&_Contract.TransactOpts, initCode) +} + +// GetSenderAddress is a paid mutator transaction binding the contract method 0x9b249f69. +// +// Solidity: function getSenderAddress(bytes initCode) returns() +func (_Contract *ContractTransactorSession) GetSenderAddress(initCode []byte) (*types.Transaction, error) { + return _Contract.Contract.GetSenderAddress(&_Contract.TransactOpts, initCode) +} + +// HandleAggregatedOps is a paid mutator transaction binding the contract method 0xdbed18e0. +// +// Solidity: function handleAggregatedOps(((address,uint256,bytes,bytes,bytes32,uint256,bytes32,bytes,bytes)[],address,bytes)[] opsPerAggregator, address beneficiary) returns() +func (_Contract *ContractTransactor) HandleAggregatedOps(opts *bind.TransactOpts, opsPerAggregator []IEntryPointUserOpsPerAggregator, beneficiary common.Address) (*types.Transaction, error) { + return _Contract.contract.Transact(opts, "handleAggregatedOps", opsPerAggregator, beneficiary) +} + +// HandleAggregatedOps is a paid mutator transaction binding the contract method 0xdbed18e0. +// +// Solidity: function handleAggregatedOps(((address,uint256,bytes,bytes,bytes32,uint256,bytes32,bytes,bytes)[],address,bytes)[] opsPerAggregator, address beneficiary) returns() +func (_Contract *ContractSession) HandleAggregatedOps(opsPerAggregator []IEntryPointUserOpsPerAggregator, beneficiary common.Address) (*types.Transaction, error) { + return _Contract.Contract.HandleAggregatedOps(&_Contract.TransactOpts, opsPerAggregator, beneficiary) +} + +// HandleAggregatedOps is a paid mutator transaction binding the contract method 0xdbed18e0. +// +// Solidity: function handleAggregatedOps(((address,uint256,bytes,bytes,bytes32,uint256,bytes32,bytes,bytes)[],address,bytes)[] opsPerAggregator, address beneficiary) returns() +func (_Contract *ContractTransactorSession) HandleAggregatedOps(opsPerAggregator []IEntryPointUserOpsPerAggregator, beneficiary common.Address) (*types.Transaction, error) { + return _Contract.Contract.HandleAggregatedOps(&_Contract.TransactOpts, opsPerAggregator, beneficiary) +} + +// HandleOps is a paid mutator transaction binding the contract method 0x765e827f. +// +// Solidity: function handleOps((address,uint256,bytes,bytes,bytes32,uint256,bytes32,bytes,bytes)[] ops, address beneficiary) returns() +func (_Contract *ContractTransactor) HandleOps(opts *bind.TransactOpts, ops []PackedUserOperation, beneficiary common.Address) (*types.Transaction, error) { + return _Contract.contract.Transact(opts, "handleOps", ops, beneficiary) +} + +// HandleOps is a paid mutator transaction binding the contract method 0x765e827f. +// +// Solidity: function handleOps((address,uint256,bytes,bytes,bytes32,uint256,bytes32,bytes,bytes)[] ops, address beneficiary) returns() +func (_Contract *ContractSession) HandleOps(ops []PackedUserOperation, beneficiary common.Address) (*types.Transaction, error) { + return _Contract.Contract.HandleOps(&_Contract.TransactOpts, ops, beneficiary) +} + +// HandleOps is a paid mutator transaction binding the contract method 0x765e827f. +// +// Solidity: function handleOps((address,uint256,bytes,bytes,bytes32,uint256,bytes32,bytes,bytes)[] ops, address beneficiary) returns() +func (_Contract *ContractTransactorSession) HandleOps(ops []PackedUserOperation, beneficiary common.Address) (*types.Transaction, error) { + return _Contract.Contract.HandleOps(&_Contract.TransactOpts, ops, beneficiary) +} + +// IncrementNonce is a paid mutator transaction binding the contract method 0x0bd28e3b. +// +// Solidity: function incrementNonce(uint192 key) returns() +func (_Contract *ContractTransactor) IncrementNonce(opts *bind.TransactOpts, key *big.Int) (*types.Transaction, error) { + return _Contract.contract.Transact(opts, "incrementNonce", key) +} + +// IncrementNonce is a paid mutator transaction binding the contract method 0x0bd28e3b. +// +// Solidity: function incrementNonce(uint192 key) returns() +func (_Contract *ContractSession) IncrementNonce(key *big.Int) (*types.Transaction, error) { + return _Contract.Contract.IncrementNonce(&_Contract.TransactOpts, key) +} + +// IncrementNonce is a paid mutator transaction binding the contract method 0x0bd28e3b. +// +// Solidity: function incrementNonce(uint192 key) returns() +func (_Contract *ContractTransactorSession) IncrementNonce(key *big.Int) (*types.Transaction, error) { + return _Contract.Contract.IncrementNonce(&_Contract.TransactOpts, key) +} + +// InnerHandleOp is a paid mutator transaction binding the contract method 0x0042dc53. +// +// Solidity: function innerHandleOp(bytes callData, ((address,uint256,uint256,uint256,uint256,uint256,uint256,address,uint256,uint256),bytes32,uint256,uint256,uint256) opInfo, bytes context) returns(uint256 actualGasCost) +func (_Contract *ContractTransactor) InnerHandleOp(opts *bind.TransactOpts, callData []byte, opInfo EntryPointUserOpInfo, context []byte) (*types.Transaction, error) { + return _Contract.contract.Transact(opts, "innerHandleOp", callData, opInfo, context) +} + +// InnerHandleOp is a paid mutator transaction binding the contract method 0x0042dc53. +// +// Solidity: function innerHandleOp(bytes callData, ((address,uint256,uint256,uint256,uint256,uint256,uint256,address,uint256,uint256),bytes32,uint256,uint256,uint256) opInfo, bytes context) returns(uint256 actualGasCost) +func (_Contract *ContractSession) InnerHandleOp(callData []byte, opInfo EntryPointUserOpInfo, context []byte) (*types.Transaction, error) { + return _Contract.Contract.InnerHandleOp(&_Contract.TransactOpts, callData, opInfo, context) +} + +// InnerHandleOp is a paid mutator transaction binding the contract method 0x0042dc53. +// +// Solidity: function innerHandleOp(bytes callData, ((address,uint256,uint256,uint256,uint256,uint256,uint256,address,uint256,uint256),bytes32,uint256,uint256,uint256) opInfo, bytes context) returns(uint256 actualGasCost) +func (_Contract *ContractTransactorSession) InnerHandleOp(callData []byte, opInfo EntryPointUserOpInfo, context []byte) (*types.Transaction, error) { + return _Contract.Contract.InnerHandleOp(&_Contract.TransactOpts, callData, opInfo, context) +} + +// UnlockStake is a paid mutator transaction binding the contract method 0xbb9fe6bf. +// +// Solidity: function unlockStake() returns() +func (_Contract *ContractTransactor) UnlockStake(opts *bind.TransactOpts) (*types.Transaction, error) { + return _Contract.contract.Transact(opts, "unlockStake") +} + +// UnlockStake is a paid mutator transaction binding the contract method 0xbb9fe6bf. +// +// Solidity: function unlockStake() returns() +func (_Contract *ContractSession) UnlockStake() (*types.Transaction, error) { + return _Contract.Contract.UnlockStake(&_Contract.TransactOpts) +} + +// UnlockStake is a paid mutator transaction binding the contract method 0xbb9fe6bf. +// +// Solidity: function unlockStake() returns() +func (_Contract *ContractTransactorSession) UnlockStake() (*types.Transaction, error) { + return _Contract.Contract.UnlockStake(&_Contract.TransactOpts) +} + +// WithdrawStake is a paid mutator transaction binding the contract method 0xc23a5cea. +// +// Solidity: function withdrawStake(address withdrawAddress) returns() +func (_Contract *ContractTransactor) WithdrawStake(opts *bind.TransactOpts, withdrawAddress common.Address) (*types.Transaction, error) { + return _Contract.contract.Transact(opts, "withdrawStake", withdrawAddress) +} + +// WithdrawStake is a paid mutator transaction binding the contract method 0xc23a5cea. +// +// Solidity: function withdrawStake(address withdrawAddress) returns() +func (_Contract *ContractSession) WithdrawStake(withdrawAddress common.Address) (*types.Transaction, error) { + return _Contract.Contract.WithdrawStake(&_Contract.TransactOpts, withdrawAddress) +} + +// WithdrawStake is a paid mutator transaction binding the contract method 0xc23a5cea. +// +// Solidity: function withdrawStake(address withdrawAddress) returns() +func (_Contract *ContractTransactorSession) WithdrawStake(withdrawAddress common.Address) (*types.Transaction, error) { + return _Contract.Contract.WithdrawStake(&_Contract.TransactOpts, withdrawAddress) +} + +// WithdrawTo is a paid mutator transaction binding the contract method 0x205c2878. +// +// Solidity: function withdrawTo(address withdrawAddress, uint256 withdrawAmount) returns() +func (_Contract *ContractTransactor) WithdrawTo(opts *bind.TransactOpts, withdrawAddress common.Address, withdrawAmount *big.Int) (*types.Transaction, error) { + return _Contract.contract.Transact(opts, "withdrawTo", withdrawAddress, withdrawAmount) +} + +// WithdrawTo is a paid mutator transaction binding the contract method 0x205c2878. +// +// Solidity: function withdrawTo(address withdrawAddress, uint256 withdrawAmount) returns() +func (_Contract *ContractSession) WithdrawTo(withdrawAddress common.Address, withdrawAmount *big.Int) (*types.Transaction, error) { + return _Contract.Contract.WithdrawTo(&_Contract.TransactOpts, withdrawAddress, withdrawAmount) +} + +// WithdrawTo is a paid mutator transaction binding the contract method 0x205c2878. +// +// Solidity: function withdrawTo(address withdrawAddress, uint256 withdrawAmount) returns() +func (_Contract *ContractTransactorSession) WithdrawTo(withdrawAddress common.Address, withdrawAmount *big.Int) (*types.Transaction, error) { + return _Contract.Contract.WithdrawTo(&_Contract.TransactOpts, withdrawAddress, withdrawAmount) +} + +// Receive is a paid mutator transaction binding the contract receive function. +// +// Solidity: receive() payable returns() +func (_Contract *ContractTransactor) Receive(opts *bind.TransactOpts) (*types.Transaction, error) { + return _Contract.contract.RawTransact(opts, nil) // calldata is disallowed for receive function +} + +// Receive is a paid mutator transaction binding the contract receive function. +// +// Solidity: receive() payable returns() +func (_Contract *ContractSession) Receive() (*types.Transaction, error) { + return _Contract.Contract.Receive(&_Contract.TransactOpts) +} + +// Receive is a paid mutator transaction binding the contract receive function. +// +// Solidity: receive() payable returns() +func (_Contract *ContractTransactorSession) Receive() (*types.Transaction, error) { + return _Contract.Contract.Receive(&_Contract.TransactOpts) +} + +// ContractAccountDeployedIterator is returned from FilterAccountDeployed and is used to iterate over the raw logs and unpacked data for AccountDeployed events raised by the Contract contract. +type ContractAccountDeployedIterator struct { + Event *ContractAccountDeployed // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *ContractAccountDeployedIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(ContractAccountDeployed) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(ContractAccountDeployed) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *ContractAccountDeployedIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *ContractAccountDeployedIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// ContractAccountDeployed represents a AccountDeployed event raised by the Contract contract. +type ContractAccountDeployed struct { + UserOpHash [32]byte + Sender common.Address + Factory common.Address + Paymaster common.Address + Raw types.Log // Blockchain specific contextual infos +} + +// FilterAccountDeployed is a free log retrieval operation binding the contract event 0xd51a9c61267aa6196961883ecf5ff2da6619c37dac0fa92122513fb32c032d2d. +// +// Solidity: event AccountDeployed(bytes32 indexed userOpHash, address indexed sender, address factory, address paymaster) +func (_Contract *ContractFilterer) FilterAccountDeployed(opts *bind.FilterOpts, userOpHash [][32]byte, sender []common.Address) (*ContractAccountDeployedIterator, error) { + + var userOpHashRule []interface{} + for _, userOpHashItem := range userOpHash { + userOpHashRule = append(userOpHashRule, userOpHashItem) + } + var senderRule []interface{} + for _, senderItem := range sender { + senderRule = append(senderRule, senderItem) + } + + logs, sub, err := _Contract.contract.FilterLogs(opts, "AccountDeployed", userOpHashRule, senderRule) + if err != nil { + return nil, err + } + return &ContractAccountDeployedIterator{contract: _Contract.contract, event: "AccountDeployed", logs: logs, sub: sub}, nil +} + +// WatchAccountDeployed is a free log subscription operation binding the contract event 0xd51a9c61267aa6196961883ecf5ff2da6619c37dac0fa92122513fb32c032d2d. +// +// Solidity: event AccountDeployed(bytes32 indexed userOpHash, address indexed sender, address factory, address paymaster) +func (_Contract *ContractFilterer) WatchAccountDeployed(opts *bind.WatchOpts, sink chan<- *ContractAccountDeployed, userOpHash [][32]byte, sender []common.Address) (event.Subscription, error) { + + var userOpHashRule []interface{} + for _, userOpHashItem := range userOpHash { + userOpHashRule = append(userOpHashRule, userOpHashItem) + } + var senderRule []interface{} + for _, senderItem := range sender { + senderRule = append(senderRule, senderItem) + } + + logs, sub, err := _Contract.contract.WatchLogs(opts, "AccountDeployed", userOpHashRule, senderRule) + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(ContractAccountDeployed) + if err := _Contract.contract.UnpackLog(event, "AccountDeployed", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseAccountDeployed is a log parse operation binding the contract event 0xd51a9c61267aa6196961883ecf5ff2da6619c37dac0fa92122513fb32c032d2d. +// +// Solidity: event AccountDeployed(bytes32 indexed userOpHash, address indexed sender, address factory, address paymaster) +func (_Contract *ContractFilterer) ParseAccountDeployed(log types.Log) (*ContractAccountDeployed, error) { + event := new(ContractAccountDeployed) + if err := _Contract.contract.UnpackLog(event, "AccountDeployed", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// ContractBeforeExecutionIterator is returned from FilterBeforeExecution and is used to iterate over the raw logs and unpacked data for BeforeExecution events raised by the Contract contract. +type ContractBeforeExecutionIterator struct { + Event *ContractBeforeExecution // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *ContractBeforeExecutionIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(ContractBeforeExecution) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(ContractBeforeExecution) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *ContractBeforeExecutionIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *ContractBeforeExecutionIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// ContractBeforeExecution represents a BeforeExecution event raised by the Contract contract. +type ContractBeforeExecution struct { + Raw types.Log // Blockchain specific contextual infos +} + +// FilterBeforeExecution is a free log retrieval operation binding the contract event 0xbb47ee3e183a558b1a2ff0874b079f3fc5478b7454eacf2bfc5af2ff5878f972. +// +// Solidity: event BeforeExecution() +func (_Contract *ContractFilterer) FilterBeforeExecution(opts *bind.FilterOpts) (*ContractBeforeExecutionIterator, error) { + + logs, sub, err := _Contract.contract.FilterLogs(opts, "BeforeExecution") + if err != nil { + return nil, err + } + return &ContractBeforeExecutionIterator{contract: _Contract.contract, event: "BeforeExecution", logs: logs, sub: sub}, nil +} + +// WatchBeforeExecution is a free log subscription operation binding the contract event 0xbb47ee3e183a558b1a2ff0874b079f3fc5478b7454eacf2bfc5af2ff5878f972. +// +// Solidity: event BeforeExecution() +func (_Contract *ContractFilterer) WatchBeforeExecution(opts *bind.WatchOpts, sink chan<- *ContractBeforeExecution) (event.Subscription, error) { + + logs, sub, err := _Contract.contract.WatchLogs(opts, "BeforeExecution") + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(ContractBeforeExecution) + if err := _Contract.contract.UnpackLog(event, "BeforeExecution", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseBeforeExecution is a log parse operation binding the contract event 0xbb47ee3e183a558b1a2ff0874b079f3fc5478b7454eacf2bfc5af2ff5878f972. +// +// Solidity: event BeforeExecution() +func (_Contract *ContractFilterer) ParseBeforeExecution(log types.Log) (*ContractBeforeExecution, error) { + event := new(ContractBeforeExecution) + if err := _Contract.contract.UnpackLog(event, "BeforeExecution", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// ContractDepositedIterator is returned from FilterDeposited and is used to iterate over the raw logs and unpacked data for Deposited events raised by the Contract contract. +type ContractDepositedIterator struct { + Event *ContractDeposited // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *ContractDepositedIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(ContractDeposited) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(ContractDeposited) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *ContractDepositedIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *ContractDepositedIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// ContractDeposited represents a Deposited event raised by the Contract contract. +type ContractDeposited struct { + Account common.Address + TotalDeposit *big.Int + Raw types.Log // Blockchain specific contextual infos +} + +// FilterDeposited is a free log retrieval operation binding the contract event 0x2da466a7b24304f47e87fa2e1e5a81b9831ce54fec19055ce277ca2f39ba42c4. +// +// Solidity: event Deposited(address indexed account, uint256 totalDeposit) +func (_Contract *ContractFilterer) FilterDeposited(opts *bind.FilterOpts, account []common.Address) (*ContractDepositedIterator, error) { + + var accountRule []interface{} + for _, accountItem := range account { + accountRule = append(accountRule, accountItem) + } + + logs, sub, err := _Contract.contract.FilterLogs(opts, "Deposited", accountRule) + if err != nil { + return nil, err + } + return &ContractDepositedIterator{contract: _Contract.contract, event: "Deposited", logs: logs, sub: sub}, nil +} + +// WatchDeposited is a free log subscription operation binding the contract event 0x2da466a7b24304f47e87fa2e1e5a81b9831ce54fec19055ce277ca2f39ba42c4. +// +// Solidity: event Deposited(address indexed account, uint256 totalDeposit) +func (_Contract *ContractFilterer) WatchDeposited(opts *bind.WatchOpts, sink chan<- *ContractDeposited, account []common.Address) (event.Subscription, error) { + + var accountRule []interface{} + for _, accountItem := range account { + accountRule = append(accountRule, accountItem) + } + + logs, sub, err := _Contract.contract.WatchLogs(opts, "Deposited", accountRule) + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(ContractDeposited) + if err := _Contract.contract.UnpackLog(event, "Deposited", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseDeposited is a log parse operation binding the contract event 0x2da466a7b24304f47e87fa2e1e5a81b9831ce54fec19055ce277ca2f39ba42c4. +// +// Solidity: event Deposited(address indexed account, uint256 totalDeposit) +func (_Contract *ContractFilterer) ParseDeposited(log types.Log) (*ContractDeposited, error) { + event := new(ContractDeposited) + if err := _Contract.contract.UnpackLog(event, "Deposited", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// ContractPostOpRevertReasonIterator is returned from FilterPostOpRevertReason and is used to iterate over the raw logs and unpacked data for PostOpRevertReason events raised by the Contract contract. +type ContractPostOpRevertReasonIterator struct { + Event *ContractPostOpRevertReason // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *ContractPostOpRevertReasonIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(ContractPostOpRevertReason) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(ContractPostOpRevertReason) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *ContractPostOpRevertReasonIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *ContractPostOpRevertReasonIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// ContractPostOpRevertReason represents a PostOpRevertReason event raised by the Contract contract. +type ContractPostOpRevertReason struct { + UserOpHash [32]byte + Sender common.Address + Nonce *big.Int + RevertReason []byte + Raw types.Log // Blockchain specific contextual infos +} + +// FilterPostOpRevertReason is a free log retrieval operation binding the contract event 0xf62676f440ff169a3a9afdbf812e89e7f95975ee8e5c31214ffdef631c5f4792. +// +// Solidity: event PostOpRevertReason(bytes32 indexed userOpHash, address indexed sender, uint256 nonce, bytes revertReason) +func (_Contract *ContractFilterer) FilterPostOpRevertReason(opts *bind.FilterOpts, userOpHash [][32]byte, sender []common.Address) (*ContractPostOpRevertReasonIterator, error) { + + var userOpHashRule []interface{} + for _, userOpHashItem := range userOpHash { + userOpHashRule = append(userOpHashRule, userOpHashItem) + } + var senderRule []interface{} + for _, senderItem := range sender { + senderRule = append(senderRule, senderItem) + } + + logs, sub, err := _Contract.contract.FilterLogs(opts, "PostOpRevertReason", userOpHashRule, senderRule) + if err != nil { + return nil, err + } + return &ContractPostOpRevertReasonIterator{contract: _Contract.contract, event: "PostOpRevertReason", logs: logs, sub: sub}, nil +} + +// WatchPostOpRevertReason is a free log subscription operation binding the contract event 0xf62676f440ff169a3a9afdbf812e89e7f95975ee8e5c31214ffdef631c5f4792. +// +// Solidity: event PostOpRevertReason(bytes32 indexed userOpHash, address indexed sender, uint256 nonce, bytes revertReason) +func (_Contract *ContractFilterer) WatchPostOpRevertReason(opts *bind.WatchOpts, sink chan<- *ContractPostOpRevertReason, userOpHash [][32]byte, sender []common.Address) (event.Subscription, error) { + + var userOpHashRule []interface{} + for _, userOpHashItem := range userOpHash { + userOpHashRule = append(userOpHashRule, userOpHashItem) + } + var senderRule []interface{} + for _, senderItem := range sender { + senderRule = append(senderRule, senderItem) + } + + logs, sub, err := _Contract.contract.WatchLogs(opts, "PostOpRevertReason", userOpHashRule, senderRule) + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(ContractPostOpRevertReason) + if err := _Contract.contract.UnpackLog(event, "PostOpRevertReason", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParsePostOpRevertReason is a log parse operation binding the contract event 0xf62676f440ff169a3a9afdbf812e89e7f95975ee8e5c31214ffdef631c5f4792. +// +// Solidity: event PostOpRevertReason(bytes32 indexed userOpHash, address indexed sender, uint256 nonce, bytes revertReason) +func (_Contract *ContractFilterer) ParsePostOpRevertReason(log types.Log) (*ContractPostOpRevertReason, error) { + event := new(ContractPostOpRevertReason) + if err := _Contract.contract.UnpackLog(event, "PostOpRevertReason", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// ContractSignatureAggregatorChangedIterator is returned from FilterSignatureAggregatorChanged and is used to iterate over the raw logs and unpacked data for SignatureAggregatorChanged events raised by the Contract contract. +type ContractSignatureAggregatorChangedIterator struct { + Event *ContractSignatureAggregatorChanged // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *ContractSignatureAggregatorChangedIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(ContractSignatureAggregatorChanged) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(ContractSignatureAggregatorChanged) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *ContractSignatureAggregatorChangedIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *ContractSignatureAggregatorChangedIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// ContractSignatureAggregatorChanged represents a SignatureAggregatorChanged event raised by the Contract contract. +type ContractSignatureAggregatorChanged struct { + Aggregator common.Address + Raw types.Log // Blockchain specific contextual infos +} + +// FilterSignatureAggregatorChanged is a free log retrieval operation binding the contract event 0x575ff3acadd5ab348fe1855e217e0f3678f8d767d7494c9f9fefbee2e17cca4d. +// +// Solidity: event SignatureAggregatorChanged(address indexed aggregator) +func (_Contract *ContractFilterer) FilterSignatureAggregatorChanged(opts *bind.FilterOpts, aggregator []common.Address) (*ContractSignatureAggregatorChangedIterator, error) { + + var aggregatorRule []interface{} + for _, aggregatorItem := range aggregator { + aggregatorRule = append(aggregatorRule, aggregatorItem) + } + + logs, sub, err := _Contract.contract.FilterLogs(opts, "SignatureAggregatorChanged", aggregatorRule) + if err != nil { + return nil, err + } + return &ContractSignatureAggregatorChangedIterator{contract: _Contract.contract, event: "SignatureAggregatorChanged", logs: logs, sub: sub}, nil +} + +// WatchSignatureAggregatorChanged is a free log subscription operation binding the contract event 0x575ff3acadd5ab348fe1855e217e0f3678f8d767d7494c9f9fefbee2e17cca4d. +// +// Solidity: event SignatureAggregatorChanged(address indexed aggregator) +func (_Contract *ContractFilterer) WatchSignatureAggregatorChanged(opts *bind.WatchOpts, sink chan<- *ContractSignatureAggregatorChanged, aggregator []common.Address) (event.Subscription, error) { + + var aggregatorRule []interface{} + for _, aggregatorItem := range aggregator { + aggregatorRule = append(aggregatorRule, aggregatorItem) + } + + logs, sub, err := _Contract.contract.WatchLogs(opts, "SignatureAggregatorChanged", aggregatorRule) + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(ContractSignatureAggregatorChanged) + if err := _Contract.contract.UnpackLog(event, "SignatureAggregatorChanged", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseSignatureAggregatorChanged is a log parse operation binding the contract event 0x575ff3acadd5ab348fe1855e217e0f3678f8d767d7494c9f9fefbee2e17cca4d. +// +// Solidity: event SignatureAggregatorChanged(address indexed aggregator) +func (_Contract *ContractFilterer) ParseSignatureAggregatorChanged(log types.Log) (*ContractSignatureAggregatorChanged, error) { + event := new(ContractSignatureAggregatorChanged) + if err := _Contract.contract.UnpackLog(event, "SignatureAggregatorChanged", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// ContractStakeLockedIterator is returned from FilterStakeLocked and is used to iterate over the raw logs and unpacked data for StakeLocked events raised by the Contract contract. +type ContractStakeLockedIterator struct { + Event *ContractStakeLocked // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *ContractStakeLockedIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(ContractStakeLocked) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(ContractStakeLocked) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *ContractStakeLockedIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *ContractStakeLockedIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// ContractStakeLocked represents a StakeLocked event raised by the Contract contract. +type ContractStakeLocked struct { + Account common.Address + TotalStaked *big.Int + UnstakeDelaySec *big.Int + Raw types.Log // Blockchain specific contextual infos +} + +// FilterStakeLocked is a free log retrieval operation binding the contract event 0xa5ae833d0bb1dcd632d98a8b70973e8516812898e19bf27b70071ebc8dc52c01. +// +// Solidity: event StakeLocked(address indexed account, uint256 totalStaked, uint256 unstakeDelaySec) +func (_Contract *ContractFilterer) FilterStakeLocked(opts *bind.FilterOpts, account []common.Address) (*ContractStakeLockedIterator, error) { + + var accountRule []interface{} + for _, accountItem := range account { + accountRule = append(accountRule, accountItem) + } + + logs, sub, err := _Contract.contract.FilterLogs(opts, "StakeLocked", accountRule) + if err != nil { + return nil, err + } + return &ContractStakeLockedIterator{contract: _Contract.contract, event: "StakeLocked", logs: logs, sub: sub}, nil +} + +// WatchStakeLocked is a free log subscription operation binding the contract event 0xa5ae833d0bb1dcd632d98a8b70973e8516812898e19bf27b70071ebc8dc52c01. +// +// Solidity: event StakeLocked(address indexed account, uint256 totalStaked, uint256 unstakeDelaySec) +func (_Contract *ContractFilterer) WatchStakeLocked(opts *bind.WatchOpts, sink chan<- *ContractStakeLocked, account []common.Address) (event.Subscription, error) { + + var accountRule []interface{} + for _, accountItem := range account { + accountRule = append(accountRule, accountItem) + } + + logs, sub, err := _Contract.contract.WatchLogs(opts, "StakeLocked", accountRule) + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(ContractStakeLocked) + if err := _Contract.contract.UnpackLog(event, "StakeLocked", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseStakeLocked is a log parse operation binding the contract event 0xa5ae833d0bb1dcd632d98a8b70973e8516812898e19bf27b70071ebc8dc52c01. +// +// Solidity: event StakeLocked(address indexed account, uint256 totalStaked, uint256 unstakeDelaySec) +func (_Contract *ContractFilterer) ParseStakeLocked(log types.Log) (*ContractStakeLocked, error) { + event := new(ContractStakeLocked) + if err := _Contract.contract.UnpackLog(event, "StakeLocked", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// ContractStakeUnlockedIterator is returned from FilterStakeUnlocked and is used to iterate over the raw logs and unpacked data for StakeUnlocked events raised by the Contract contract. +type ContractStakeUnlockedIterator struct { + Event *ContractStakeUnlocked // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *ContractStakeUnlockedIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(ContractStakeUnlocked) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(ContractStakeUnlocked) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *ContractStakeUnlockedIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *ContractStakeUnlockedIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// ContractStakeUnlocked represents a StakeUnlocked event raised by the Contract contract. +type ContractStakeUnlocked struct { + Account common.Address + WithdrawTime *big.Int + Raw types.Log // Blockchain specific contextual infos +} + +// FilterStakeUnlocked is a free log retrieval operation binding the contract event 0xfa9b3c14cc825c412c9ed81b3ba365a5b459439403f18829e572ed53a4180f0a. +// +// Solidity: event StakeUnlocked(address indexed account, uint256 withdrawTime) +func (_Contract *ContractFilterer) FilterStakeUnlocked(opts *bind.FilterOpts, account []common.Address) (*ContractStakeUnlockedIterator, error) { + + var accountRule []interface{} + for _, accountItem := range account { + accountRule = append(accountRule, accountItem) + } + + logs, sub, err := _Contract.contract.FilterLogs(opts, "StakeUnlocked", accountRule) + if err != nil { + return nil, err + } + return &ContractStakeUnlockedIterator{contract: _Contract.contract, event: "StakeUnlocked", logs: logs, sub: sub}, nil +} + +// WatchStakeUnlocked is a free log subscription operation binding the contract event 0xfa9b3c14cc825c412c9ed81b3ba365a5b459439403f18829e572ed53a4180f0a. +// +// Solidity: event StakeUnlocked(address indexed account, uint256 withdrawTime) +func (_Contract *ContractFilterer) WatchStakeUnlocked(opts *bind.WatchOpts, sink chan<- *ContractStakeUnlocked, account []common.Address) (event.Subscription, error) { + + var accountRule []interface{} + for _, accountItem := range account { + accountRule = append(accountRule, accountItem) + } + + logs, sub, err := _Contract.contract.WatchLogs(opts, "StakeUnlocked", accountRule) + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(ContractStakeUnlocked) + if err := _Contract.contract.UnpackLog(event, "StakeUnlocked", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseStakeUnlocked is a log parse operation binding the contract event 0xfa9b3c14cc825c412c9ed81b3ba365a5b459439403f18829e572ed53a4180f0a. +// +// Solidity: event StakeUnlocked(address indexed account, uint256 withdrawTime) +func (_Contract *ContractFilterer) ParseStakeUnlocked(log types.Log) (*ContractStakeUnlocked, error) { + event := new(ContractStakeUnlocked) + if err := _Contract.contract.UnpackLog(event, "StakeUnlocked", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// ContractStakeWithdrawnIterator is returned from FilterStakeWithdrawn and is used to iterate over the raw logs and unpacked data for StakeWithdrawn events raised by the Contract contract. +type ContractStakeWithdrawnIterator struct { + Event *ContractStakeWithdrawn // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *ContractStakeWithdrawnIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(ContractStakeWithdrawn) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(ContractStakeWithdrawn) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *ContractStakeWithdrawnIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *ContractStakeWithdrawnIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// ContractStakeWithdrawn represents a StakeWithdrawn event raised by the Contract contract. +type ContractStakeWithdrawn struct { + Account common.Address + WithdrawAddress common.Address + Amount *big.Int + Raw types.Log // Blockchain specific contextual infos +} + +// FilterStakeWithdrawn is a free log retrieval operation binding the contract event 0xb7c918e0e249f999e965cafeb6c664271b3f4317d296461500e71da39f0cbda3. +// +// Solidity: event StakeWithdrawn(address indexed account, address withdrawAddress, uint256 amount) +func (_Contract *ContractFilterer) FilterStakeWithdrawn(opts *bind.FilterOpts, account []common.Address) (*ContractStakeWithdrawnIterator, error) { + + var accountRule []interface{} + for _, accountItem := range account { + accountRule = append(accountRule, accountItem) + } + + logs, sub, err := _Contract.contract.FilterLogs(opts, "StakeWithdrawn", accountRule) + if err != nil { + return nil, err + } + return &ContractStakeWithdrawnIterator{contract: _Contract.contract, event: "StakeWithdrawn", logs: logs, sub: sub}, nil +} + +// WatchStakeWithdrawn is a free log subscription operation binding the contract event 0xb7c918e0e249f999e965cafeb6c664271b3f4317d296461500e71da39f0cbda3. +// +// Solidity: event StakeWithdrawn(address indexed account, address withdrawAddress, uint256 amount) +func (_Contract *ContractFilterer) WatchStakeWithdrawn(opts *bind.WatchOpts, sink chan<- *ContractStakeWithdrawn, account []common.Address) (event.Subscription, error) { + + var accountRule []interface{} + for _, accountItem := range account { + accountRule = append(accountRule, accountItem) + } + + logs, sub, err := _Contract.contract.WatchLogs(opts, "StakeWithdrawn", accountRule) + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(ContractStakeWithdrawn) + if err := _Contract.contract.UnpackLog(event, "StakeWithdrawn", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseStakeWithdrawn is a log parse operation binding the contract event 0xb7c918e0e249f999e965cafeb6c664271b3f4317d296461500e71da39f0cbda3. +// +// Solidity: event StakeWithdrawn(address indexed account, address withdrawAddress, uint256 amount) +func (_Contract *ContractFilterer) ParseStakeWithdrawn(log types.Log) (*ContractStakeWithdrawn, error) { + event := new(ContractStakeWithdrawn) + if err := _Contract.contract.UnpackLog(event, "StakeWithdrawn", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// ContractUserOperationEventIterator is returned from FilterUserOperationEvent and is used to iterate over the raw logs and unpacked data for UserOperationEvent events raised by the Contract contract. +type ContractUserOperationEventIterator struct { + Event *ContractUserOperationEvent // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *ContractUserOperationEventIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(ContractUserOperationEvent) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(ContractUserOperationEvent) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *ContractUserOperationEventIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *ContractUserOperationEventIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// ContractUserOperationEvent represents a UserOperationEvent event raised by the Contract contract. +type ContractUserOperationEvent struct { + UserOpHash [32]byte + Sender common.Address + Paymaster common.Address + Nonce *big.Int + Success bool + ActualGasCost *big.Int + ActualGasUsed *big.Int + Raw types.Log // Blockchain specific contextual infos +} + +// FilterUserOperationEvent is a free log retrieval operation binding the contract event 0x49628fd1471006c1482da88028e9ce4dbb080b815c9b0344d39e5a8e6ec1419f. +// +// Solidity: event UserOperationEvent(bytes32 indexed userOpHash, address indexed sender, address indexed paymaster, uint256 nonce, bool success, uint256 actualGasCost, uint256 actualGasUsed) +func (_Contract *ContractFilterer) FilterUserOperationEvent(opts *bind.FilterOpts, userOpHash [][32]byte, sender []common.Address, paymaster []common.Address) (*ContractUserOperationEventIterator, error) { + + var userOpHashRule []interface{} + for _, userOpHashItem := range userOpHash { + userOpHashRule = append(userOpHashRule, userOpHashItem) + } + var senderRule []interface{} + for _, senderItem := range sender { + senderRule = append(senderRule, senderItem) + } + var paymasterRule []interface{} + for _, paymasterItem := range paymaster { + paymasterRule = append(paymasterRule, paymasterItem) + } + + logs, sub, err := _Contract.contract.FilterLogs(opts, "UserOperationEvent", userOpHashRule, senderRule, paymasterRule) + if err != nil { + return nil, err + } + return &ContractUserOperationEventIterator{contract: _Contract.contract, event: "UserOperationEvent", logs: logs, sub: sub}, nil +} + +// WatchUserOperationEvent is a free log subscription operation binding the contract event 0x49628fd1471006c1482da88028e9ce4dbb080b815c9b0344d39e5a8e6ec1419f. +// +// Solidity: event UserOperationEvent(bytes32 indexed userOpHash, address indexed sender, address indexed paymaster, uint256 nonce, bool success, uint256 actualGasCost, uint256 actualGasUsed) +func (_Contract *ContractFilterer) WatchUserOperationEvent(opts *bind.WatchOpts, sink chan<- *ContractUserOperationEvent, userOpHash [][32]byte, sender []common.Address, paymaster []common.Address) (event.Subscription, error) { + + var userOpHashRule []interface{} + for _, userOpHashItem := range userOpHash { + userOpHashRule = append(userOpHashRule, userOpHashItem) + } + var senderRule []interface{} + for _, senderItem := range sender { + senderRule = append(senderRule, senderItem) + } + var paymasterRule []interface{} + for _, paymasterItem := range paymaster { + paymasterRule = append(paymasterRule, paymasterItem) + } + + logs, sub, err := _Contract.contract.WatchLogs(opts, "UserOperationEvent", userOpHashRule, senderRule, paymasterRule) + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(ContractUserOperationEvent) + if err := _Contract.contract.UnpackLog(event, "UserOperationEvent", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseUserOperationEvent is a log parse operation binding the contract event 0x49628fd1471006c1482da88028e9ce4dbb080b815c9b0344d39e5a8e6ec1419f. +// +// Solidity: event UserOperationEvent(bytes32 indexed userOpHash, address indexed sender, address indexed paymaster, uint256 nonce, bool success, uint256 actualGasCost, uint256 actualGasUsed) +func (_Contract *ContractFilterer) ParseUserOperationEvent(log types.Log) (*ContractUserOperationEvent, error) { + event := new(ContractUserOperationEvent) + if err := _Contract.contract.UnpackLog(event, "UserOperationEvent", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// ContractUserOperationPrefundTooLowIterator is returned from FilterUserOperationPrefundTooLow and is used to iterate over the raw logs and unpacked data for UserOperationPrefundTooLow events raised by the Contract contract. +type ContractUserOperationPrefundTooLowIterator struct { + Event *ContractUserOperationPrefundTooLow // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *ContractUserOperationPrefundTooLowIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(ContractUserOperationPrefundTooLow) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(ContractUserOperationPrefundTooLow) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *ContractUserOperationPrefundTooLowIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *ContractUserOperationPrefundTooLowIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// ContractUserOperationPrefundTooLow represents a UserOperationPrefundTooLow event raised by the Contract contract. +type ContractUserOperationPrefundTooLow struct { + UserOpHash [32]byte + Sender common.Address + Nonce *big.Int + Raw types.Log // Blockchain specific contextual infos +} + +// FilterUserOperationPrefundTooLow is a free log retrieval operation binding the contract event 0x67b4fa9642f42120bf031f3051d1824b0fe25627945b27b8a6a65d5761d5482e. +// +// Solidity: event UserOperationPrefundTooLow(bytes32 indexed userOpHash, address indexed sender, uint256 nonce) +func (_Contract *ContractFilterer) FilterUserOperationPrefundTooLow(opts *bind.FilterOpts, userOpHash [][32]byte, sender []common.Address) (*ContractUserOperationPrefundTooLowIterator, error) { + + var userOpHashRule []interface{} + for _, userOpHashItem := range userOpHash { + userOpHashRule = append(userOpHashRule, userOpHashItem) + } + var senderRule []interface{} + for _, senderItem := range sender { + senderRule = append(senderRule, senderItem) + } + + logs, sub, err := _Contract.contract.FilterLogs(opts, "UserOperationPrefundTooLow", userOpHashRule, senderRule) + if err != nil { + return nil, err + } + return &ContractUserOperationPrefundTooLowIterator{contract: _Contract.contract, event: "UserOperationPrefundTooLow", logs: logs, sub: sub}, nil +} + +// WatchUserOperationPrefundTooLow is a free log subscription operation binding the contract event 0x67b4fa9642f42120bf031f3051d1824b0fe25627945b27b8a6a65d5761d5482e. +// +// Solidity: event UserOperationPrefundTooLow(bytes32 indexed userOpHash, address indexed sender, uint256 nonce) +func (_Contract *ContractFilterer) WatchUserOperationPrefundTooLow(opts *bind.WatchOpts, sink chan<- *ContractUserOperationPrefundTooLow, userOpHash [][32]byte, sender []common.Address) (event.Subscription, error) { + + var userOpHashRule []interface{} + for _, userOpHashItem := range userOpHash { + userOpHashRule = append(userOpHashRule, userOpHashItem) + } + var senderRule []interface{} + for _, senderItem := range sender { + senderRule = append(senderRule, senderItem) + } + + logs, sub, err := _Contract.contract.WatchLogs(opts, "UserOperationPrefundTooLow", userOpHashRule, senderRule) + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(ContractUserOperationPrefundTooLow) + if err := _Contract.contract.UnpackLog(event, "UserOperationPrefundTooLow", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseUserOperationPrefundTooLow is a log parse operation binding the contract event 0x67b4fa9642f42120bf031f3051d1824b0fe25627945b27b8a6a65d5761d5482e. +// +// Solidity: event UserOperationPrefundTooLow(bytes32 indexed userOpHash, address indexed sender, uint256 nonce) +func (_Contract *ContractFilterer) ParseUserOperationPrefundTooLow(log types.Log) (*ContractUserOperationPrefundTooLow, error) { + event := new(ContractUserOperationPrefundTooLow) + if err := _Contract.contract.UnpackLog(event, "UserOperationPrefundTooLow", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// ContractUserOperationRevertReasonIterator is returned from FilterUserOperationRevertReason and is used to iterate over the raw logs and unpacked data for UserOperationRevertReason events raised by the Contract contract. +type ContractUserOperationRevertReasonIterator struct { + Event *ContractUserOperationRevertReason // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *ContractUserOperationRevertReasonIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(ContractUserOperationRevertReason) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(ContractUserOperationRevertReason) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *ContractUserOperationRevertReasonIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *ContractUserOperationRevertReasonIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// ContractUserOperationRevertReason represents a UserOperationRevertReason event raised by the Contract contract. +type ContractUserOperationRevertReason struct { + UserOpHash [32]byte + Sender common.Address + Nonce *big.Int + RevertReason []byte + Raw types.Log // Blockchain specific contextual infos +} + +// FilterUserOperationRevertReason is a free log retrieval operation binding the contract event 0x1c4fada7374c0a9ee8841fc38afe82932dc0f8e69012e927f061a8bae611a201. +// +// Solidity: event UserOperationRevertReason(bytes32 indexed userOpHash, address indexed sender, uint256 nonce, bytes revertReason) +func (_Contract *ContractFilterer) FilterUserOperationRevertReason(opts *bind.FilterOpts, userOpHash [][32]byte, sender []common.Address) (*ContractUserOperationRevertReasonIterator, error) { + + var userOpHashRule []interface{} + for _, userOpHashItem := range userOpHash { + userOpHashRule = append(userOpHashRule, userOpHashItem) + } + var senderRule []interface{} + for _, senderItem := range sender { + senderRule = append(senderRule, senderItem) + } + + logs, sub, err := _Contract.contract.FilterLogs(opts, "UserOperationRevertReason", userOpHashRule, senderRule) + if err != nil { + return nil, err + } + return &ContractUserOperationRevertReasonIterator{contract: _Contract.contract, event: "UserOperationRevertReason", logs: logs, sub: sub}, nil +} + +// WatchUserOperationRevertReason is a free log subscription operation binding the contract event 0x1c4fada7374c0a9ee8841fc38afe82932dc0f8e69012e927f061a8bae611a201. +// +// Solidity: event UserOperationRevertReason(bytes32 indexed userOpHash, address indexed sender, uint256 nonce, bytes revertReason) +func (_Contract *ContractFilterer) WatchUserOperationRevertReason(opts *bind.WatchOpts, sink chan<- *ContractUserOperationRevertReason, userOpHash [][32]byte, sender []common.Address) (event.Subscription, error) { + + var userOpHashRule []interface{} + for _, userOpHashItem := range userOpHash { + userOpHashRule = append(userOpHashRule, userOpHashItem) + } + var senderRule []interface{} + for _, senderItem := range sender { + senderRule = append(senderRule, senderItem) + } + + logs, sub, err := _Contract.contract.WatchLogs(opts, "UserOperationRevertReason", userOpHashRule, senderRule) + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(ContractUserOperationRevertReason) + if err := _Contract.contract.UnpackLog(event, "UserOperationRevertReason", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseUserOperationRevertReason is a log parse operation binding the contract event 0x1c4fada7374c0a9ee8841fc38afe82932dc0f8e69012e927f061a8bae611a201. +// +// Solidity: event UserOperationRevertReason(bytes32 indexed userOpHash, address indexed sender, uint256 nonce, bytes revertReason) +func (_Contract *ContractFilterer) ParseUserOperationRevertReason(log types.Log) (*ContractUserOperationRevertReason, error) { + event := new(ContractUserOperationRevertReason) + if err := _Contract.contract.UnpackLog(event, "UserOperationRevertReason", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// ContractWithdrawnIterator is returned from FilterWithdrawn and is used to iterate over the raw logs and unpacked data for Withdrawn events raised by the Contract contract. +type ContractWithdrawnIterator struct { + Event *ContractWithdrawn // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *ContractWithdrawnIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(ContractWithdrawn) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(ContractWithdrawn) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *ContractWithdrawnIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *ContractWithdrawnIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// ContractWithdrawn represents a Withdrawn event raised by the Contract contract. +type ContractWithdrawn struct { + Account common.Address + WithdrawAddress common.Address + Amount *big.Int + Raw types.Log // Blockchain specific contextual infos +} + +// FilterWithdrawn is a free log retrieval operation binding the contract event 0xd1c19fbcd4551a5edfb66d43d2e337c04837afda3482b42bdf569a8fccdae5fb. +// +// Solidity: event Withdrawn(address indexed account, address withdrawAddress, uint256 amount) +func (_Contract *ContractFilterer) FilterWithdrawn(opts *bind.FilterOpts, account []common.Address) (*ContractWithdrawnIterator, error) { + + var accountRule []interface{} + for _, accountItem := range account { + accountRule = append(accountRule, accountItem) + } + + logs, sub, err := _Contract.contract.FilterLogs(opts, "Withdrawn", accountRule) + if err != nil { + return nil, err + } + return &ContractWithdrawnIterator{contract: _Contract.contract, event: "Withdrawn", logs: logs, sub: sub}, nil +} + +// WatchWithdrawn is a free log subscription operation binding the contract event 0xd1c19fbcd4551a5edfb66d43d2e337c04837afda3482b42bdf569a8fccdae5fb. +// +// Solidity: event Withdrawn(address indexed account, address withdrawAddress, uint256 amount) +func (_Contract *ContractFilterer) WatchWithdrawn(opts *bind.WatchOpts, sink chan<- *ContractWithdrawn, account []common.Address) (event.Subscription, error) { + + var accountRule []interface{} + for _, accountItem := range account { + accountRule = append(accountRule, accountItem) + } + + logs, sub, err := _Contract.contract.WatchLogs(opts, "Withdrawn", accountRule) + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(ContractWithdrawn) + if err := _Contract.contract.UnpackLog(event, "Withdrawn", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseWithdrawn is a log parse operation binding the contract event 0xd1c19fbcd4551a5edfb66d43d2e337c04837afda3482b42bdf569a8fccdae5fb. +// +// Solidity: event Withdrawn(address indexed account, address withdrawAddress, uint256 amount) +func (_Contract *ContractFilterer) ParseWithdrawn(log types.Log) (*ContractWithdrawn, error) { + event := new(ContractWithdrawn) + if err := _Contract.contract.UnpackLog(event, "Withdrawn", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} diff --git a/common/ethereum_contract/contract/erc20/erc_20.go b/common/ethereum_contract/contract/erc20/erc_20.go new file mode 100644 index 00000000..0f3da341 --- /dev/null +++ b/common/ethereum_contract/contract/erc20/erc_20.go @@ -0,0 +1,759 @@ +// Code generated - DO NOT EDIT. +// This file is a generated binding and any manual changes will be lost. + +package contract_erc20 + +import ( + "errors" + "math/big" + "strings" + + ethereum "github.com/ethereum/go-ethereum" + "github.com/ethereum/go-ethereum/accounts/abi" + "github.com/ethereum/go-ethereum/accounts/abi/bind" + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/core/types" + "github.com/ethereum/go-ethereum/event" +) + +// Reference imports to suppress errors if they are not otherwise used. +var ( + _ = errors.New + _ = big.NewInt + _ = strings.NewReader + _ = ethereum.NotFound + _ = bind.Bind + _ = common.Big1 + _ = types.BloomLookup + _ = event.NewSubscription + _ = abi.ConvertType +) + +// ContractMetaData contains all meta data concerning the Contract contract. +var ContractMetaData = &bind.MetaData{ + ABI: "[{\"constant\":true,\"inputs\":[],\"name\":\"name\",\"outputs\":[{\"name\":\"\",\"type\":\"string\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"_spender\",\"type\":\"address\"},{\"name\":\"_value\",\"type\":\"uint256\"}],\"name\":\"approve\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"totalSupply\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"_from\",\"type\":\"address\"},{\"name\":\"_to\",\"type\":\"address\"},{\"name\":\"_value\",\"type\":\"uint256\"}],\"name\":\"transferFrom\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"decimals\",\"outputs\":[{\"name\":\"\",\"type\":\"uint8\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"_owner\",\"type\":\"address\"}],\"name\":\"balanceOf\",\"outputs\":[{\"name\":\"balance\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"symbol\",\"outputs\":[{\"name\":\"\",\"type\":\"string\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"_to\",\"type\":\"address\"},{\"name\":\"_value\",\"type\":\"uint256\"}],\"name\":\"transfer\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"_owner\",\"type\":\"address\"},{\"name\":\"_spender\",\"type\":\"address\"}],\"name\":\"allowance\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"payable\":true,\"stateMutability\":\"payable\",\"type\":\"fallback\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":true,\"name\":\"spender\",\"type\":\"address\"},{\"indexed\":false,\"name\":\"value\",\"type\":\"uint256\"}],\"name\":\"Approval\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"name\":\"from\",\"type\":\"address\"},{\"indexed\":true,\"name\":\"to\",\"type\":\"address\"},{\"indexed\":false,\"name\":\"value\",\"type\":\"uint256\"}],\"name\":\"Transfer\",\"type\":\"event\"}]", +} + +// ContractABI is the input ABI used to generate the binding from. +// Deprecated: Use ContractMetaData.ABI instead. +var ContractABI = ContractMetaData.ABI + +// Contract is an auto generated Go binding around an Ethereum contract. +type Contract struct { + ContractCaller // Read-only binding to the contract + ContractTransactor // Write-only binding to the contract + ContractFilterer // Log filterer for contract events +} + +// ContractCaller is an auto generated read-only Go binding around an Ethereum contract. +type ContractCaller struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// ContractTransactor is an auto generated write-only Go binding around an Ethereum contract. +type ContractTransactor struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// ContractFilterer is an auto generated log filtering Go binding around an Ethereum contract events. +type ContractFilterer struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// ContractSession is an auto generated Go binding around an Ethereum contract, +// with pre-set call and transact options. +type ContractSession struct { + Contract *Contract // Generic contract binding to set the session for + CallOpts bind.CallOpts // Call options to use throughout this session + TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session +} + +// ContractCallerSession is an auto generated read-only Go binding around an Ethereum contract, +// with pre-set call options. +type ContractCallerSession struct { + Contract *ContractCaller // Generic contract caller binding to set the session for + CallOpts bind.CallOpts // Call options to use throughout this session +} + +// ContractTransactorSession is an auto generated write-only Go binding around an Ethereum contract, +// with pre-set transact options. +type ContractTransactorSession struct { + Contract *ContractTransactor // Generic contract transactor binding to set the session for + TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session +} + +// ContractRaw is an auto generated low-level Go binding around an Ethereum contract. +type ContractRaw struct { + Contract *Contract // Generic contract binding to access the raw methods on +} + +// ContractCallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract. +type ContractCallerRaw struct { + Contract *ContractCaller // Generic read-only contract binding to access the raw methods on +} + +// ContractTransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract. +type ContractTransactorRaw struct { + Contract *ContractTransactor // Generic write-only contract binding to access the raw methods on +} + +// NewContract creates a new instance of Contract, bound to a specific deployed contract. +func NewContract(address common.Address, backend bind.ContractBackend) (*Contract, error) { + contract, err := bindContract(address, backend, backend, backend) + if err != nil { + return nil, err + } + return &Contract{ContractCaller: ContractCaller{contract: contract}, ContractTransactor: ContractTransactor{contract: contract}, ContractFilterer: ContractFilterer{contract: contract}}, nil +} + +// NewContractCaller creates a new read-only instance of Contract, bound to a specific deployed contract. +func NewContractCaller(address common.Address, caller bind.ContractCaller) (*ContractCaller, error) { + contract, err := bindContract(address, caller, nil, nil) + if err != nil { + return nil, err + } + return &ContractCaller{contract: contract}, nil +} + +// NewContractTransactor creates a new write-only instance of Contract, bound to a specific deployed contract. +func NewContractTransactor(address common.Address, transactor bind.ContractTransactor) (*ContractTransactor, error) { + contract, err := bindContract(address, nil, transactor, nil) + if err != nil { + return nil, err + } + return &ContractTransactor{contract: contract}, nil +} + +// NewContractFilterer creates a new log filterer instance of Contract, bound to a specific deployed contract. +func NewContractFilterer(address common.Address, filterer bind.ContractFilterer) (*ContractFilterer, error) { + contract, err := bindContract(address, nil, nil, filterer) + if err != nil { + return nil, err + } + return &ContractFilterer{contract: contract}, nil +} + +// bindContract binds a generic wrapper to an already deployed contract. +func bindContract(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) { + parsed, err := ContractMetaData.GetAbi() + if err != nil { + return nil, err + } + return bind.NewBoundContract(address, *parsed, caller, transactor, filterer), nil +} + +// Call invokes the (constant) contract method with params as input values and +// sets the output to result. The result type might be a single field for simple +// returns, a slice of interfaces for anonymous returns and a struct for named +// returns. +func (_Contract *ContractRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { + return _Contract.Contract.ContractCaller.contract.Call(opts, result, method, params...) +} + +// Transfer initiates a plain transaction to move funds to the contract, calling +// its default method if one is available. +func (_Contract *ContractRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _Contract.Contract.ContractTransactor.contract.Transfer(opts) +} + +// Transact invokes the (paid) contract method with params as input values. +func (_Contract *ContractRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _Contract.Contract.ContractTransactor.contract.Transact(opts, method, params...) +} + +// Call invokes the (constant) contract method with params as input values and +// sets the output to result. The result type might be a single field for simple +// returns, a slice of interfaces for anonymous returns and a struct for named +// returns. +func (_Contract *ContractCallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { + return _Contract.Contract.contract.Call(opts, result, method, params...) +} + +// Transfer initiates a plain transaction to move funds to the contract, calling +// its default method if one is available. +func (_Contract *ContractTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _Contract.Contract.contract.Transfer(opts) +} + +// Transact invokes the (paid) contract method with params as input values. +func (_Contract *ContractTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _Contract.Contract.contract.Transact(opts, method, params...) +} + +// Allowance is a free data retrieval call binding the contract method 0xdd62ed3e. +// +// Solidity: function allowance(address _owner, address _spender) view returns(uint256) +func (_Contract *ContractCaller) Allowance(opts *bind.CallOpts, _owner common.Address, _spender common.Address) (*big.Int, error) { + var out []interface{} + err := _Contract.contract.Call(opts, &out, "allowance", _owner, _spender) + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// Allowance is a free data retrieval call binding the contract method 0xdd62ed3e. +// +// Solidity: function allowance(address _owner, address _spender) view returns(uint256) +func (_Contract *ContractSession) Allowance(_owner common.Address, _spender common.Address) (*big.Int, error) { + return _Contract.Contract.Allowance(&_Contract.CallOpts, _owner, _spender) +} + +// Allowance is a free data retrieval call binding the contract method 0xdd62ed3e. +// +// Solidity: function allowance(address _owner, address _spender) view returns(uint256) +func (_Contract *ContractCallerSession) Allowance(_owner common.Address, _spender common.Address) (*big.Int, error) { + return _Contract.Contract.Allowance(&_Contract.CallOpts, _owner, _spender) +} + +// BalanceOf is a free data retrieval call binding the contract method 0x70a08231. +// +// Solidity: function balanceOf(address _owner) view returns(uint256 balance) +func (_Contract *ContractCaller) BalanceOf(opts *bind.CallOpts, _owner common.Address) (*big.Int, error) { + var out []interface{} + err := _Contract.contract.Call(opts, &out, "balanceOf", _owner) + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// BalanceOf is a free data retrieval call binding the contract method 0x70a08231. +// +// Solidity: function balanceOf(address _owner) view returns(uint256 balance) +func (_Contract *ContractSession) BalanceOf(_owner common.Address) (*big.Int, error) { + return _Contract.Contract.BalanceOf(&_Contract.CallOpts, _owner) +} + +// BalanceOf is a free data retrieval call binding the contract method 0x70a08231. +// +// Solidity: function balanceOf(address _owner) view returns(uint256 balance) +func (_Contract *ContractCallerSession) BalanceOf(_owner common.Address) (*big.Int, error) { + return _Contract.Contract.BalanceOf(&_Contract.CallOpts, _owner) +} + +// Decimals is a free data retrieval call binding the contract method 0x313ce567. +// +// Solidity: function decimals() view returns(uint8) +func (_Contract *ContractCaller) Decimals(opts *bind.CallOpts) (uint8, error) { + var out []interface{} + err := _Contract.contract.Call(opts, &out, "decimals") + + if err != nil { + return *new(uint8), err + } + + out0 := *abi.ConvertType(out[0], new(uint8)).(*uint8) + + return out0, err + +} + +// Decimals is a free data retrieval call binding the contract method 0x313ce567. +// +// Solidity: function decimals() view returns(uint8) +func (_Contract *ContractSession) Decimals() (uint8, error) { + return _Contract.Contract.Decimals(&_Contract.CallOpts) +} + +// Decimals is a free data retrieval call binding the contract method 0x313ce567. +// +// Solidity: function decimals() view returns(uint8) +func (_Contract *ContractCallerSession) Decimals() (uint8, error) { + return _Contract.Contract.Decimals(&_Contract.CallOpts) +} + +// Name is a free data retrieval call binding the contract method 0x06fdde03. +// +// Solidity: function name() view returns(string) +func (_Contract *ContractCaller) Name(opts *bind.CallOpts) (string, error) { + var out []interface{} + err := _Contract.contract.Call(opts, &out, "name") + + if err != nil { + return *new(string), err + } + + out0 := *abi.ConvertType(out[0], new(string)).(*string) + + return out0, err + +} + +// Name is a free data retrieval call binding the contract method 0x06fdde03. +// +// Solidity: function name() view returns(string) +func (_Contract *ContractSession) Name() (string, error) { + return _Contract.Contract.Name(&_Contract.CallOpts) +} + +// Name is a free data retrieval call binding the contract method 0x06fdde03. +// +// Solidity: function name() view returns(string) +func (_Contract *ContractCallerSession) Name() (string, error) { + return _Contract.Contract.Name(&_Contract.CallOpts) +} + +// Symbol is a free data retrieval call binding the contract method 0x95d89b41. +// +// Solidity: function symbol() view returns(string) +func (_Contract *ContractCaller) Symbol(opts *bind.CallOpts) (string, error) { + var out []interface{} + err := _Contract.contract.Call(opts, &out, "symbol") + + if err != nil { + return *new(string), err + } + + out0 := *abi.ConvertType(out[0], new(string)).(*string) + + return out0, err + +} + +// Symbol is a free data retrieval call binding the contract method 0x95d89b41. +// +// Solidity: function symbol() view returns(string) +func (_Contract *ContractSession) Symbol() (string, error) { + return _Contract.Contract.Symbol(&_Contract.CallOpts) +} + +// Symbol is a free data retrieval call binding the contract method 0x95d89b41. +// +// Solidity: function symbol() view returns(string) +func (_Contract *ContractCallerSession) Symbol() (string, error) { + return _Contract.Contract.Symbol(&_Contract.CallOpts) +} + +// TotalSupply is a free data retrieval call binding the contract method 0x18160ddd. +// +// Solidity: function totalSupply() view returns(uint256) +func (_Contract *ContractCaller) TotalSupply(opts *bind.CallOpts) (*big.Int, error) { + var out []interface{} + err := _Contract.contract.Call(opts, &out, "totalSupply") + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// TotalSupply is a free data retrieval call binding the contract method 0x18160ddd. +// +// Solidity: function totalSupply() view returns(uint256) +func (_Contract *ContractSession) TotalSupply() (*big.Int, error) { + return _Contract.Contract.TotalSupply(&_Contract.CallOpts) +} + +// TotalSupply is a free data retrieval call binding the contract method 0x18160ddd. +// +// Solidity: function totalSupply() view returns(uint256) +func (_Contract *ContractCallerSession) TotalSupply() (*big.Int, error) { + return _Contract.Contract.TotalSupply(&_Contract.CallOpts) +} + +// Approve is a paid mutator transaction binding the contract method 0x095ea7b3. +// +// Solidity: function approve(address _spender, uint256 _value) returns(bool) +func (_Contract *ContractTransactor) Approve(opts *bind.TransactOpts, _spender common.Address, _value *big.Int) (*types.Transaction, error) { + return _Contract.contract.Transact(opts, "approve", _spender, _value) +} + +// Approve is a paid mutator transaction binding the contract method 0x095ea7b3. +// +// Solidity: function approve(address _spender, uint256 _value) returns(bool) +func (_Contract *ContractSession) Approve(_spender common.Address, _value *big.Int) (*types.Transaction, error) { + return _Contract.Contract.Approve(&_Contract.TransactOpts, _spender, _value) +} + +// Approve is a paid mutator transaction binding the contract method 0x095ea7b3. +// +// Solidity: function approve(address _spender, uint256 _value) returns(bool) +func (_Contract *ContractTransactorSession) Approve(_spender common.Address, _value *big.Int) (*types.Transaction, error) { + return _Contract.Contract.Approve(&_Contract.TransactOpts, _spender, _value) +} + +// Transfer is a paid mutator transaction binding the contract method 0xa9059cbb. +// +// Solidity: function transfer(address _to, uint256 _value) returns(bool) +func (_Contract *ContractTransactor) Transfer(opts *bind.TransactOpts, _to common.Address, _value *big.Int) (*types.Transaction, error) { + return _Contract.contract.Transact(opts, "transfer", _to, _value) +} + +// Transfer is a paid mutator transaction binding the contract method 0xa9059cbb. +// +// Solidity: function transfer(address _to, uint256 _value) returns(bool) +func (_Contract *ContractSession) Transfer(_to common.Address, _value *big.Int) (*types.Transaction, error) { + return _Contract.Contract.Transfer(&_Contract.TransactOpts, _to, _value) +} + +// Transfer is a paid mutator transaction binding the contract method 0xa9059cbb. +// +// Solidity: function transfer(address _to, uint256 _value) returns(bool) +func (_Contract *ContractTransactorSession) Transfer(_to common.Address, _value *big.Int) (*types.Transaction, error) { + return _Contract.Contract.Transfer(&_Contract.TransactOpts, _to, _value) +} + +// TransferFrom is a paid mutator transaction binding the contract method 0x23b872dd. +// +// Solidity: function transferFrom(address _from, address _to, uint256 _value) returns(bool) +func (_Contract *ContractTransactor) TransferFrom(opts *bind.TransactOpts, _from common.Address, _to common.Address, _value *big.Int) (*types.Transaction, error) { + return _Contract.contract.Transact(opts, "transferFrom", _from, _to, _value) +} + +// TransferFrom is a paid mutator transaction binding the contract method 0x23b872dd. +// +// Solidity: function transferFrom(address _from, address _to, uint256 _value) returns(bool) +func (_Contract *ContractSession) TransferFrom(_from common.Address, _to common.Address, _value *big.Int) (*types.Transaction, error) { + return _Contract.Contract.TransferFrom(&_Contract.TransactOpts, _from, _to, _value) +} + +// TransferFrom is a paid mutator transaction binding the contract method 0x23b872dd. +// +// Solidity: function transferFrom(address _from, address _to, uint256 _value) returns(bool) +func (_Contract *ContractTransactorSession) TransferFrom(_from common.Address, _to common.Address, _value *big.Int) (*types.Transaction, error) { + return _Contract.Contract.TransferFrom(&_Contract.TransactOpts, _from, _to, _value) +} + +// Fallback is a paid mutator transaction binding the contract fallback function. +// +// Solidity: fallback() payable returns() +func (_Contract *ContractTransactor) Fallback(opts *bind.TransactOpts, calldata []byte) (*types.Transaction, error) { + return _Contract.contract.RawTransact(opts, calldata) +} + +// Fallback is a paid mutator transaction binding the contract fallback function. +// +// Solidity: fallback() payable returns() +func (_Contract *ContractSession) Fallback(calldata []byte) (*types.Transaction, error) { + return _Contract.Contract.Fallback(&_Contract.TransactOpts, calldata) +} + +// Fallback is a paid mutator transaction binding the contract fallback function. +// +// Solidity: fallback() payable returns() +func (_Contract *ContractTransactorSession) Fallback(calldata []byte) (*types.Transaction, error) { + return _Contract.Contract.Fallback(&_Contract.TransactOpts, calldata) +} + +// ContractApprovalIterator is returned from FilterApproval and is used to iterate over the raw logs and unpacked data for Approval events raised by the Contract contract. +type ContractApprovalIterator struct { + Event *ContractApproval // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *ContractApprovalIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(ContractApproval) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(ContractApproval) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *ContractApprovalIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *ContractApprovalIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// ContractApproval represents a Approval event raised by the Contract contract. +type ContractApproval struct { + Owner common.Address + Spender common.Address + Value *big.Int + Raw types.Log // Blockchain specific contextual infos +} + +// FilterApproval is a free log retrieval operation binding the contract event 0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925. +// +// Solidity: event Approval(address indexed owner, address indexed spender, uint256 value) +func (_Contract *ContractFilterer) FilterApproval(opts *bind.FilterOpts, owner []common.Address, spender []common.Address) (*ContractApprovalIterator, error) { + + var ownerRule []interface{} + for _, ownerItem := range owner { + ownerRule = append(ownerRule, ownerItem) + } + var spenderRule []interface{} + for _, spenderItem := range spender { + spenderRule = append(spenderRule, spenderItem) + } + + logs, sub, err := _Contract.contract.FilterLogs(opts, "Approval", ownerRule, spenderRule) + if err != nil { + return nil, err + } + return &ContractApprovalIterator{contract: _Contract.contract, event: "Approval", logs: logs, sub: sub}, nil +} + +// WatchApproval is a free log subscription operation binding the contract event 0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925. +// +// Solidity: event Approval(address indexed owner, address indexed spender, uint256 value) +func (_Contract *ContractFilterer) WatchApproval(opts *bind.WatchOpts, sink chan<- *ContractApproval, owner []common.Address, spender []common.Address) (event.Subscription, error) { + + var ownerRule []interface{} + for _, ownerItem := range owner { + ownerRule = append(ownerRule, ownerItem) + } + var spenderRule []interface{} + for _, spenderItem := range spender { + spenderRule = append(spenderRule, spenderItem) + } + + logs, sub, err := _Contract.contract.WatchLogs(opts, "Approval", ownerRule, spenderRule) + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(ContractApproval) + if err := _Contract.contract.UnpackLog(event, "Approval", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseApproval is a log parse operation binding the contract event 0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925. +// +// Solidity: event Approval(address indexed owner, address indexed spender, uint256 value) +func (_Contract *ContractFilterer) ParseApproval(log types.Log) (*ContractApproval, error) { + event := new(ContractApproval) + if err := _Contract.contract.UnpackLog(event, "Approval", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// ContractTransferIterator is returned from FilterTransfer and is used to iterate over the raw logs and unpacked data for Transfer events raised by the Contract contract. +type ContractTransferIterator struct { + Event *ContractTransfer // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *ContractTransferIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(ContractTransfer) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(ContractTransfer) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *ContractTransferIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *ContractTransferIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// ContractTransfer represents a Transfer event raised by the Contract contract. +type ContractTransfer struct { + From common.Address + To common.Address + Value *big.Int + Raw types.Log // Blockchain specific contextual infos +} + +// FilterTransfer is a free log retrieval operation binding the contract event 0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef. +// +// Solidity: event Transfer(address indexed from, address indexed to, uint256 value) +func (_Contract *ContractFilterer) FilterTransfer(opts *bind.FilterOpts, from []common.Address, to []common.Address) (*ContractTransferIterator, error) { + + var fromRule []interface{} + for _, fromItem := range from { + fromRule = append(fromRule, fromItem) + } + var toRule []interface{} + for _, toItem := range to { + toRule = append(toRule, toItem) + } + + logs, sub, err := _Contract.contract.FilterLogs(opts, "Transfer", fromRule, toRule) + if err != nil { + return nil, err + } + return &ContractTransferIterator{contract: _Contract.contract, event: "Transfer", logs: logs, sub: sub}, nil +} + +// WatchTransfer is a free log subscription operation binding the contract event 0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef. +// +// Solidity: event Transfer(address indexed from, address indexed to, uint256 value) +func (_Contract *ContractFilterer) WatchTransfer(opts *bind.WatchOpts, sink chan<- *ContractTransfer, from []common.Address, to []common.Address) (event.Subscription, error) { + + var fromRule []interface{} + for _, fromItem := range from { + fromRule = append(fromRule, fromItem) + } + var toRule []interface{} + for _, toItem := range to { + toRule = append(toRule, toItem) + } + + logs, sub, err := _Contract.contract.WatchLogs(opts, "Transfer", fromRule, toRule) + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(ContractTransfer) + if err := _Contract.contract.UnpackLog(event, "Transfer", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseTransfer is a log parse operation binding the contract event 0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef. +// +// Solidity: event Transfer(address indexed from, address indexed to, uint256 value) +func (_Contract *ContractFilterer) ParseTransfer(log types.Log) (*ContractTransfer, error) { + event := new(ContractTransfer) + if err := _Contract.contract.UnpackLog(event, "Transfer", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} diff --git a/common/ethereum_contract/contract/l1_gas_oracle/l1_gas_oracle.go b/common/ethereum_contract/contract/l1_gas_oracle/l1_gas_oracle.go new file mode 100644 index 00000000..4f8d50b6 --- /dev/null +++ b/common/ethereum_contract/contract/l1_gas_oracle/l1_gas_oracle.go @@ -0,0 +1,1211 @@ +package l1_gas_oracle + +import ( + "errors" + "math/big" + "strings" + + ethereum "github.com/ethereum/go-ethereum" + "github.com/ethereum/go-ethereum/accounts/abi" + "github.com/ethereum/go-ethereum/accounts/abi/bind" + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/core/types" + "github.com/ethereum/go-ethereum/event" +) + +// Reference imports to suppress errors if they are not otherwise used. +var ( + _ = errors.New + _ = big.NewInt + _ = strings.NewReader + _ = ethereum.NotFound + _ = bind.Bind + _ = common.Big1 + _ = types.BloomLookup + _ = event.NewSubscription + _ = abi.ConvertType +) + +// ContractMetaData contains all meta data concerning the Contract contract. +var ContractMetaData = &bind.MetaData{ + ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_owner\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"l1BaseFee\",\"type\":\"uint256\"}],\"name\":\"L1BaseFeeUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"overhead\",\"type\":\"uint256\"}],\"name\":\"OverheadUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_oldOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"scalar\",\"type\":\"uint256\"}],\"name\":\"ScalarUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"_oldWhitelist\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"_newWhitelist\",\"type\":\"address\"}],\"name\":\"UpdateWhitelist\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"_data\",\"type\":\"bytes\"}],\"name\":\"getL1Fee\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"_data\",\"type\":\"bytes\"}],\"name\":\"getL1GasUsed\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"l1BaseFee\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"overhead\",\"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\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"scalar\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_l1BaseFee\",\"type\":\"uint256\"}],\"name\":\"setL1BaseFee\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_overhead\",\"type\":\"uint256\"}],\"name\":\"setOverhead\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_scalar\",\"type\":\"uint256\"}],\"name\":\"setScalar\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_newWhitelist\",\"type\":\"address\"}],\"name\":\"updateWhitelist\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"whitelist\",\"outputs\":[{\"internalType\":\"contractIWhitelist\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"}]", +} + +// ContractABI is the input ABI used to generate the binding from. +// Deprecated: Use ContractMetaData.ABI instead. +var ContractABI = ContractMetaData.ABI + +// Contract is an auto generated Go binding around an Ethereum contract. +type Contract struct { + ContractCaller // Read-only binding to the contract + ContractTransactor // Write-only binding to the contract + ContractFilterer // Log filterer for contract events +} + +// ContractCaller is an auto generated read-only Go binding around an Ethereum contract. +type ContractCaller struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// ContractTransactor is an auto generated write-only Go binding around an Ethereum contract. +type ContractTransactor struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// ContractFilterer is an auto generated log filtering Go binding around an Ethereum contract events. +type ContractFilterer struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// ContractSession is an auto generated Go binding around an Ethereum contract, +// with pre-set call and transact options. +type ContractSession struct { + Contract *Contract // Generic contract binding to set the session for + CallOpts bind.CallOpts // Call options to use throughout this session + TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session +} + +// ContractCallerSession is an auto generated read-only Go binding around an Ethereum contract, +// with pre-set call options. +type ContractCallerSession struct { + Contract *ContractCaller // Generic contract caller binding to set the session for + CallOpts bind.CallOpts // Call options to use throughout this session +} + +// ContractTransactorSession is an auto generated write-only Go binding around an Ethereum contract, +// with pre-set transact options. +type ContractTransactorSession struct { + Contract *ContractTransactor // Generic contract transactor binding to set the session for + TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session +} + +// ContractRaw is an auto generated low-level Go binding around an Ethereum contract. +type ContractRaw struct { + Contract *Contract // Generic contract binding to access the raw methods on +} + +// ContractCallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract. +type ContractCallerRaw struct { + Contract *ContractCaller // Generic read-only contract binding to access the raw methods on +} + +// ContractTransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract. +type ContractTransactorRaw struct { + Contract *ContractTransactor // Generic write-only contract binding to access the raw methods on +} + +// NewContract creates a new instance of Contract, bound to a specific deployed contract. +func NewContract(address common.Address, backend bind.ContractBackend) (*Contract, error) { + contract, err := bindContract(address, backend, backend, backend) + if err != nil { + return nil, err + } + return &Contract{ContractCaller: ContractCaller{contract: contract}, ContractTransactor: ContractTransactor{contract: contract}, ContractFilterer: ContractFilterer{contract: contract}}, nil +} + +// NewContractCaller creates a new read-only instance of Contract, bound to a specific deployed contract. +func NewContractCaller(address common.Address, caller bind.ContractCaller) (*ContractCaller, error) { + contract, err := bindContract(address, caller, nil, nil) + if err != nil { + return nil, err + } + return &ContractCaller{contract: contract}, nil +} + +// NewContractTransactor creates a new write-only instance of Contract, bound to a specific deployed contract. +func NewContractTransactor(address common.Address, transactor bind.ContractTransactor) (*ContractTransactor, error) { + contract, err := bindContract(address, nil, transactor, nil) + if err != nil { + return nil, err + } + return &ContractTransactor{contract: contract}, nil +} + +// NewContractFilterer creates a new log filterer instance of Contract, bound to a specific deployed contract. +func NewContractFilterer(address common.Address, filterer bind.ContractFilterer) (*ContractFilterer, error) { + contract, err := bindContract(address, nil, nil, filterer) + if err != nil { + return nil, err + } + return &ContractFilterer{contract: contract}, nil +} + +// bindContract binds a generic wrapper to an already deployed contract. +func bindContract(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) { + parsed, err := ContractMetaData.GetAbi() + if err != nil { + return nil, err + } + return bind.NewBoundContract(address, *parsed, caller, transactor, filterer), nil +} + +// Call invokes the (constant) contract method with params as input values and +// sets the output to result. The result type might be a single field for simple +// returns, a slice of interfaces for anonymous returns and a struct for named +// returns. +func (_Contract *ContractRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { + return _Contract.Contract.ContractCaller.contract.Call(opts, result, method, params...) +} + +// Transfer initiates a plain transaction to move funds to the contract, calling +// its default method if one is available. +func (_Contract *ContractRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _Contract.Contract.ContractTransactor.contract.Transfer(opts) +} + +// Transact invokes the (paid) contract method with params as input values. +func (_Contract *ContractRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _Contract.Contract.ContractTransactor.contract.Transact(opts, method, params...) +} + +// Call invokes the (constant) contract method with params as input values and +// sets the output to result. The result type might be a single field for simple +// returns, a slice of interfaces for anonymous returns and a struct for named +// returns. +func (_Contract *ContractCallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { + return _Contract.Contract.contract.Call(opts, result, method, params...) +} + +// Transfer initiates a plain transaction to move funds to the contract, calling +// its default method if one is available. +func (_Contract *ContractTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _Contract.Contract.contract.Transfer(opts) +} + +// Transact invokes the (paid) contract method with params as input values. +func (_Contract *ContractTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _Contract.Contract.contract.Transact(opts, method, params...) +} + +// GetL1Fee is a free data retrieval call binding the contract method 0x49948e0e. +// +// Solidity: function getL1Fee(bytes _data) view returns(uint256) +func (_Contract *ContractCaller) GetL1Fee(opts *bind.CallOpts, _data []byte) (*big.Int, error) { + var out []interface{} + err := _Contract.contract.Call(opts, &out, "getL1Fee", _data) + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// GetL1Fee is a free data retrieval call binding the contract method 0x49948e0e. +// +// Solidity: function getL1Fee(bytes _data) view returns(uint256) +func (_Contract *ContractSession) GetL1Fee(_data []byte) (*big.Int, error) { + return _Contract.Contract.GetL1Fee(&_Contract.CallOpts, _data) +} + +// GetL1Fee is a free data retrieval call binding the contract method 0x49948e0e. +// +// Solidity: function getL1Fee(bytes _data) view returns(uint256) +func (_Contract *ContractCallerSession) GetL1Fee(_data []byte) (*big.Int, error) { + return _Contract.Contract.GetL1Fee(&_Contract.CallOpts, _data) +} + +// GetL1GasUsed is a free data retrieval call binding the contract method 0xde26c4a1. +// Computes the amount of L1 gas used for a transaction. Adds the overhead which represents the per-transaction gas overhead of posting the transaction and state roots to L1. Adds 74 bytes of padding to account for the fact that the input does not have a signature. +// Solidity: function getL1GasUsed(bytes _data) view returns(uint256) +func (_Contract *ContractCaller) GetL1GasUsed(opts *bind.CallOpts, _data []byte) (*big.Int, error) { + var out []interface{} + err := _Contract.contract.Call(opts, &out, "getL1GasUsed", _data) + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// GetL1GasUsed is a free data retrieval call binding the contract method 0xde26c4a1. +// +// Solidity: function getL1GasUsed(bytes _data) view returns(uint256) +func (_Contract *ContractSession) GetL1GasUsed(_data []byte) (*big.Int, error) { + return _Contract.Contract.GetL1GasUsed(&_Contract.CallOpts, _data) +} + +// GetL1GasUsed is a free data retrieval call binding the contract method 0xde26c4a1. +// +// Solidity: function getL1GasUsed(bytes _data) view returns(uint256) +func (_Contract *ContractCallerSession) GetL1GasUsed(_data []byte) (*big.Int, error) { + return _Contract.Contract.GetL1GasUsed(&_Contract.CallOpts, _data) +} + +// L1BaseFee is a free data retrieval call binding the contract method 0x519b4bd3. +// +// Solidity: function l1BaseFee() view returns(uint256) +func (_Contract *ContractCaller) L1BaseFee(opts *bind.CallOpts) (*big.Int, error) { + var out []interface{} + err := _Contract.contract.Call(opts, &out, "l1BaseFee") + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// L1BaseFee is a free data retrieval call binding the contract method 0x519b4bd3. +// +// Solidity: function l1BaseFee() view returns(uint256) +func (_Contract *ContractSession) L1BaseFee() (*big.Int, error) { + return _Contract.Contract.L1BaseFee(&_Contract.CallOpts) +} + +// L1BaseFee is a free data retrieval call binding the contract method 0x519b4bd3. +// +// Solidity: function l1BaseFee() view returns(uint256) +func (_Contract *ContractCallerSession) L1BaseFee() (*big.Int, error) { + return _Contract.Contract.L1BaseFee(&_Contract.CallOpts) +} + +// Overhead is a free data retrieval call binding the contract method 0x0c18c162. +// +// Solidity: function overhead() view returns(uint256) +func (_Contract *ContractCaller) Overhead(opts *bind.CallOpts) (*big.Int, error) { + var out []interface{} + err := _Contract.contract.Call(opts, &out, "overhead") + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// Overhead is a free data retrieval call binding the contract method 0x0c18c162. +// +// Solidity: function overhead() view returns(uint256) +func (_Contract *ContractSession) Overhead() (*big.Int, error) { + return _Contract.Contract.Overhead(&_Contract.CallOpts) +} + +// Overhead is a free data retrieval call binding the contract method 0x0c18c162. +// +// Solidity: function overhead() view returns(uint256) +func (_Contract *ContractCallerSession) Overhead() (*big.Int, error) { + return _Contract.Contract.Overhead(&_Contract.CallOpts) +} + +// Owner is a free data retrieval call binding the contract method 0x8da5cb5b. +// +// Solidity: function owner() view returns(address) +func (_Contract *ContractCaller) Owner(opts *bind.CallOpts) (common.Address, error) { + var out []interface{} + err := _Contract.contract.Call(opts, &out, "owner") + + if err != nil { + return *new(common.Address), err + } + + out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) + + return out0, err + +} + +// Owner is a free data retrieval call binding the contract method 0x8da5cb5b. +// +// Solidity: function owner() view returns(address) +func (_Contract *ContractSession) Owner() (common.Address, error) { + return _Contract.Contract.Owner(&_Contract.CallOpts) +} + +// Owner is a free data retrieval call binding the contract method 0x8da5cb5b. +// +// Solidity: function owner() view returns(address) +func (_Contract *ContractCallerSession) Owner() (common.Address, error) { + return _Contract.Contract.Owner(&_Contract.CallOpts) +} + +// Scalar is a free data retrieval call binding the contract method 0xf45e65d8. +// +// Solidity: function scalar() view returns(uint256) +func (_Contract *ContractCaller) Scalar(opts *bind.CallOpts) (*big.Int, error) { + var out []interface{} + err := _Contract.contract.Call(opts, &out, "scalar") + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// Scalar is a free data retrieval call binding the contract method 0xf45e65d8. +// +// Solidity: function scalar() view returns(uint256) +func (_Contract *ContractSession) Scalar() (*big.Int, error) { + return _Contract.Contract.Scalar(&_Contract.CallOpts) +} + +// Scalar is a free data retrieval call binding the contract method 0xf45e65d8. +// +// Solidity: function scalar() view returns(uint256) +func (_Contract *ContractCallerSession) Scalar() (*big.Int, error) { + return _Contract.Contract.Scalar(&_Contract.CallOpts) +} + +// Whitelist is a free data retrieval call binding the contract method 0x93e59dc1. +// +// Solidity: function whitelist() view returns(address) +func (_Contract *ContractCaller) Whitelist(opts *bind.CallOpts) (common.Address, error) { + var out []interface{} + err := _Contract.contract.Call(opts, &out, "whitelist") + + if err != nil { + return *new(common.Address), err + } + + out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) + + return out0, err + +} + +// Whitelist is a free data retrieval call binding the contract method 0x93e59dc1. +// +// Solidity: function whitelist() view returns(address) +func (_Contract *ContractSession) Whitelist() (common.Address, error) { + return _Contract.Contract.Whitelist(&_Contract.CallOpts) +} + +// Whitelist is a free data retrieval call binding the contract method 0x93e59dc1. +// +// Solidity: function whitelist() view returns(address) +func (_Contract *ContractCallerSession) Whitelist() (common.Address, error) { + return _Contract.Contract.Whitelist(&_Contract.CallOpts) +} + +// RenounceOwnership is a paid mutator transaction binding the contract method 0x715018a6. +// +// Solidity: function renounceOwnership() returns() +func (_Contract *ContractTransactor) RenounceOwnership(opts *bind.TransactOpts) (*types.Transaction, error) { + return _Contract.contract.Transact(opts, "renounceOwnership") +} + +// RenounceOwnership is a paid mutator transaction binding the contract method 0x715018a6. +// +// Solidity: function renounceOwnership() returns() +func (_Contract *ContractSession) RenounceOwnership() (*types.Transaction, error) { + return _Contract.Contract.RenounceOwnership(&_Contract.TransactOpts) +} + +// RenounceOwnership is a paid mutator transaction binding the contract method 0x715018a6. +// +// Solidity: function renounceOwnership() returns() +func (_Contract *ContractTransactorSession) RenounceOwnership() (*types.Transaction, error) { + return _Contract.Contract.RenounceOwnership(&_Contract.TransactOpts) +} + +// SetL1BaseFee is a paid mutator transaction binding the contract method 0xbede39b5. +// +// Solidity: function setL1BaseFee(uint256 _l1BaseFee) returns() +func (_Contract *ContractTransactor) SetL1BaseFee(opts *bind.TransactOpts, _l1BaseFee *big.Int) (*types.Transaction, error) { + return _Contract.contract.Transact(opts, "setL1BaseFee", _l1BaseFee) +} + +// SetL1BaseFee is a paid mutator transaction binding the contract method 0xbede39b5. +// +// Solidity: function setL1BaseFee(uint256 _l1BaseFee) returns() +func (_Contract *ContractSession) SetL1BaseFee(_l1BaseFee *big.Int) (*types.Transaction, error) { + return _Contract.Contract.SetL1BaseFee(&_Contract.TransactOpts, _l1BaseFee) +} + +// SetL1BaseFee is a paid mutator transaction binding the contract method 0xbede39b5. +// +// Solidity: function setL1BaseFee(uint256 _l1BaseFee) returns() +func (_Contract *ContractTransactorSession) SetL1BaseFee(_l1BaseFee *big.Int) (*types.Transaction, error) { + return _Contract.Contract.SetL1BaseFee(&_Contract.TransactOpts, _l1BaseFee) +} + +// SetOverhead is a paid mutator transaction binding the contract method 0x3577afc5. +// +// Solidity: function setOverhead(uint256 _overhead) returns() +func (_Contract *ContractTransactor) SetOverhead(opts *bind.TransactOpts, _overhead *big.Int) (*types.Transaction, error) { + return _Contract.contract.Transact(opts, "setOverhead", _overhead) +} + +// SetOverhead is a paid mutator transaction binding the contract method 0x3577afc5. +// +// Solidity: function setOverhead(uint256 _overhead) returns() +func (_Contract *ContractSession) SetOverhead(_overhead *big.Int) (*types.Transaction, error) { + return _Contract.Contract.SetOverhead(&_Contract.TransactOpts, _overhead) +} + +// SetOverhead is a paid mutator transaction binding the contract method 0x3577afc5. +// +// Solidity: function setOverhead(uint256 _overhead) returns() +func (_Contract *ContractTransactorSession) SetOverhead(_overhead *big.Int) (*types.Transaction, error) { + return _Contract.Contract.SetOverhead(&_Contract.TransactOpts, _overhead) +} + +// SetScalar is a paid mutator transaction binding the contract method 0x70465597. +// +// Solidity: function setScalar(uint256 _scalar) returns() +func (_Contract *ContractTransactor) SetScalar(opts *bind.TransactOpts, _scalar *big.Int) (*types.Transaction, error) { + return _Contract.contract.Transact(opts, "setScalar", _scalar) +} + +// SetScalar is a paid mutator transaction binding the contract method 0x70465597. +// +// Solidity: function setScalar(uint256 _scalar) returns() +func (_Contract *ContractSession) SetScalar(_scalar *big.Int) (*types.Transaction, error) { + return _Contract.Contract.SetScalar(&_Contract.TransactOpts, _scalar) +} + +// SetScalar is a paid mutator transaction binding the contract method 0x70465597. +// +// Solidity: function setScalar(uint256 _scalar) returns() +func (_Contract *ContractTransactorSession) SetScalar(_scalar *big.Int) (*types.Transaction, error) { + return _Contract.Contract.SetScalar(&_Contract.TransactOpts, _scalar) +} + +// TransferOwnership is a paid mutator transaction binding the contract method 0xf2fde38b. +// +// Solidity: function transferOwnership(address _newOwner) returns() +func (_Contract *ContractTransactor) TransferOwnership(opts *bind.TransactOpts, _newOwner common.Address) (*types.Transaction, error) { + return _Contract.contract.Transact(opts, "transferOwnership", _newOwner) +} + +// TransferOwnership is a paid mutator transaction binding the contract method 0xf2fde38b. +// +// Solidity: function transferOwnership(address _newOwner) returns() +func (_Contract *ContractSession) TransferOwnership(_newOwner common.Address) (*types.Transaction, error) { + return _Contract.Contract.TransferOwnership(&_Contract.TransactOpts, _newOwner) +} + +// TransferOwnership is a paid mutator transaction binding the contract method 0xf2fde38b. +// +// Solidity: function transferOwnership(address _newOwner) returns() +func (_Contract *ContractTransactorSession) TransferOwnership(_newOwner common.Address) (*types.Transaction, error) { + return _Contract.Contract.TransferOwnership(&_Contract.TransactOpts, _newOwner) +} + +// UpdateWhitelist is a paid mutator transaction binding the contract method 0x3d0f963e. +// +// Solidity: function updateWhitelist(address _newWhitelist) returns() +func (_Contract *ContractTransactor) UpdateWhitelist(opts *bind.TransactOpts, _newWhitelist common.Address) (*types.Transaction, error) { + return _Contract.contract.Transact(opts, "updateWhitelist", _newWhitelist) +} + +// UpdateWhitelist is a paid mutator transaction binding the contract method 0x3d0f963e. +// +// Solidity: function updateWhitelist(address _newWhitelist) returns() +func (_Contract *ContractSession) UpdateWhitelist(_newWhitelist common.Address) (*types.Transaction, error) { + return _Contract.Contract.UpdateWhitelist(&_Contract.TransactOpts, _newWhitelist) +} + +// UpdateWhitelist is a paid mutator transaction binding the contract method 0x3d0f963e. +// +// Solidity: function updateWhitelist(address _newWhitelist) returns() +func (_Contract *ContractTransactorSession) UpdateWhitelist(_newWhitelist common.Address) (*types.Transaction, error) { + return _Contract.Contract.UpdateWhitelist(&_Contract.TransactOpts, _newWhitelist) +} + +// ContractL1BaseFeeUpdatedIterator is returned from FilterL1BaseFeeUpdated and is used to iterate over the raw logs and unpacked data for L1BaseFeeUpdated events raised by the Contract contract. +type ContractL1BaseFeeUpdatedIterator struct { + Event *ContractL1BaseFeeUpdated // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *ContractL1BaseFeeUpdatedIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(ContractL1BaseFeeUpdated) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(ContractL1BaseFeeUpdated) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *ContractL1BaseFeeUpdatedIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *ContractL1BaseFeeUpdatedIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// ContractL1BaseFeeUpdated represents a L1BaseFeeUpdated event raised by the Contract contract. +type ContractL1BaseFeeUpdated struct { + L1BaseFee *big.Int + Raw types.Log // Blockchain specific contextual infos +} + +// FilterL1BaseFeeUpdated is a free log retrieval operation binding the contract event 0x351fb23757bb5ea0546c85b7996ddd7155f96b939ebaa5ff7bc49c75f27f2c44. +// +// Solidity: event L1BaseFeeUpdated(uint256 l1BaseFee) +func (_Contract *ContractFilterer) FilterL1BaseFeeUpdated(opts *bind.FilterOpts) (*ContractL1BaseFeeUpdatedIterator, error) { + + logs, sub, err := _Contract.contract.FilterLogs(opts, "L1BaseFeeUpdated") + if err != nil { + return nil, err + } + return &ContractL1BaseFeeUpdatedIterator{contract: _Contract.contract, event: "L1BaseFeeUpdated", logs: logs, sub: sub}, nil +} + +// WatchL1BaseFeeUpdated is a free log subscription operation binding the contract event 0x351fb23757bb5ea0546c85b7996ddd7155f96b939ebaa5ff7bc49c75f27f2c44. +// +// Solidity: event L1BaseFeeUpdated(uint256 l1BaseFee) +func (_Contract *ContractFilterer) WatchL1BaseFeeUpdated(opts *bind.WatchOpts, sink chan<- *ContractL1BaseFeeUpdated) (event.Subscription, error) { + + logs, sub, err := _Contract.contract.WatchLogs(opts, "L1BaseFeeUpdated") + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(ContractL1BaseFeeUpdated) + if err := _Contract.contract.UnpackLog(event, "L1BaseFeeUpdated", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseL1BaseFeeUpdated is a log parse operation binding the contract event 0x351fb23757bb5ea0546c85b7996ddd7155f96b939ebaa5ff7bc49c75f27f2c44. +// +// Solidity: event L1BaseFeeUpdated(uint256 l1BaseFee) +func (_Contract *ContractFilterer) ParseL1BaseFeeUpdated(log types.Log) (*ContractL1BaseFeeUpdated, error) { + event := new(ContractL1BaseFeeUpdated) + if err := _Contract.contract.UnpackLog(event, "L1BaseFeeUpdated", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// ContractOverheadUpdatedIterator is returned from FilterOverheadUpdated and is used to iterate over the raw logs and unpacked data for OverheadUpdated events raised by the Contract contract. +type ContractOverheadUpdatedIterator struct { + Event *ContractOverheadUpdated // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *ContractOverheadUpdatedIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(ContractOverheadUpdated) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(ContractOverheadUpdated) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *ContractOverheadUpdatedIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *ContractOverheadUpdatedIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// ContractOverheadUpdated represents a OverheadUpdated event raised by the Contract contract. +type ContractOverheadUpdated struct { + Overhead *big.Int + Raw types.Log // Blockchain specific contextual infos +} + +// FilterOverheadUpdated is a free log retrieval operation binding the contract event 0x32740b35c0ea213650f60d44366b4fb211c9033b50714e4a1d34e65d5beb9bb4. +// +// Solidity: event OverheadUpdated(uint256 overhead) +func (_Contract *ContractFilterer) FilterOverheadUpdated(opts *bind.FilterOpts) (*ContractOverheadUpdatedIterator, error) { + + logs, sub, err := _Contract.contract.FilterLogs(opts, "OverheadUpdated") + if err != nil { + return nil, err + } + return &ContractOverheadUpdatedIterator{contract: _Contract.contract, event: "OverheadUpdated", logs: logs, sub: sub}, nil +} + +// WatchOverheadUpdated is a free log subscription operation binding the contract event 0x32740b35c0ea213650f60d44366b4fb211c9033b50714e4a1d34e65d5beb9bb4. +// +// Solidity: event OverheadUpdated(uint256 overhead) +func (_Contract *ContractFilterer) WatchOverheadUpdated(opts *bind.WatchOpts, sink chan<- *ContractOverheadUpdated) (event.Subscription, error) { + + logs, sub, err := _Contract.contract.WatchLogs(opts, "OverheadUpdated") + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(ContractOverheadUpdated) + if err := _Contract.contract.UnpackLog(event, "OverheadUpdated", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseOverheadUpdated is a log parse operation binding the contract event 0x32740b35c0ea213650f60d44366b4fb211c9033b50714e4a1d34e65d5beb9bb4. +// +// Solidity: event OverheadUpdated(uint256 overhead) +func (_Contract *ContractFilterer) ParseOverheadUpdated(log types.Log) (*ContractOverheadUpdated, error) { + event := new(ContractOverheadUpdated) + if err := _Contract.contract.UnpackLog(event, "OverheadUpdated", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// ContractOwnershipTransferredIterator is returned from FilterOwnershipTransferred and is used to iterate over the raw logs and unpacked data for OwnershipTransferred events raised by the Contract contract. +type ContractOwnershipTransferredIterator struct { + Event *ContractOwnershipTransferred // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *ContractOwnershipTransferredIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(ContractOwnershipTransferred) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(ContractOwnershipTransferred) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *ContractOwnershipTransferredIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *ContractOwnershipTransferredIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// ContractOwnershipTransferred represents a OwnershipTransferred event raised by the Contract contract. +type ContractOwnershipTransferred struct { + OldOwner common.Address + NewOwner common.Address + Raw types.Log // Blockchain specific contextual infos +} + +// FilterOwnershipTransferred is a free log retrieval operation binding the contract event 0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0. +// +// Solidity: event OwnershipTransferred(address indexed _oldOwner, address indexed _newOwner) +func (_Contract *ContractFilterer) FilterOwnershipTransferred(opts *bind.FilterOpts, _oldOwner []common.Address, _newOwner []common.Address) (*ContractOwnershipTransferredIterator, error) { + + var _oldOwnerRule []interface{} + for _, _oldOwnerItem := range _oldOwner { + _oldOwnerRule = append(_oldOwnerRule, _oldOwnerItem) + } + var _newOwnerRule []interface{} + for _, _newOwnerItem := range _newOwner { + _newOwnerRule = append(_newOwnerRule, _newOwnerItem) + } + + logs, sub, err := _Contract.contract.FilterLogs(opts, "OwnershipTransferred", _oldOwnerRule, _newOwnerRule) + if err != nil { + return nil, err + } + return &ContractOwnershipTransferredIterator{contract: _Contract.contract, event: "OwnershipTransferred", logs: logs, sub: sub}, nil +} + +// WatchOwnershipTransferred is a free log subscription operation binding the contract event 0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0. +// +// Solidity: event OwnershipTransferred(address indexed _oldOwner, address indexed _newOwner) +func (_Contract *ContractFilterer) WatchOwnershipTransferred(opts *bind.WatchOpts, sink chan<- *ContractOwnershipTransferred, _oldOwner []common.Address, _newOwner []common.Address) (event.Subscription, error) { + + var _oldOwnerRule []interface{} + for _, _oldOwnerItem := range _oldOwner { + _oldOwnerRule = append(_oldOwnerRule, _oldOwnerItem) + } + var _newOwnerRule []interface{} + for _, _newOwnerItem := range _newOwner { + _newOwnerRule = append(_newOwnerRule, _newOwnerItem) + } + + logs, sub, err := _Contract.contract.WatchLogs(opts, "OwnershipTransferred", _oldOwnerRule, _newOwnerRule) + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(ContractOwnershipTransferred) + if err := _Contract.contract.UnpackLog(event, "OwnershipTransferred", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseOwnershipTransferred is a log parse operation binding the contract event 0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0. +// +// Solidity: event OwnershipTransferred(address indexed _oldOwner, address indexed _newOwner) +func (_Contract *ContractFilterer) ParseOwnershipTransferred(log types.Log) (*ContractOwnershipTransferred, error) { + event := new(ContractOwnershipTransferred) + if err := _Contract.contract.UnpackLog(event, "OwnershipTransferred", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// ContractScalarUpdatedIterator is returned from FilterScalarUpdated and is used to iterate over the raw logs and unpacked data for ScalarUpdated events raised by the Contract contract. +type ContractScalarUpdatedIterator struct { + Event *ContractScalarUpdated // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *ContractScalarUpdatedIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(ContractScalarUpdated) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(ContractScalarUpdated) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *ContractScalarUpdatedIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *ContractScalarUpdatedIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// ContractScalarUpdated represents a ScalarUpdated event raised by the Contract contract. +type ContractScalarUpdated struct { + Scalar *big.Int + Raw types.Log // Blockchain specific contextual infos +} + +// FilterScalarUpdated is a free log retrieval operation binding the contract event 0x3336cd9708eaf2769a0f0dc0679f30e80f15dcd88d1921b5a16858e8b85c591a. +// +// Solidity: event ScalarUpdated(uint256 scalar) +func (_Contract *ContractFilterer) FilterScalarUpdated(opts *bind.FilterOpts) (*ContractScalarUpdatedIterator, error) { + + logs, sub, err := _Contract.contract.FilterLogs(opts, "ScalarUpdated") + if err != nil { + return nil, err + } + return &ContractScalarUpdatedIterator{contract: _Contract.contract, event: "ScalarUpdated", logs: logs, sub: sub}, nil +} + +// WatchScalarUpdated is a free log subscription operation binding the contract event 0x3336cd9708eaf2769a0f0dc0679f30e80f15dcd88d1921b5a16858e8b85c591a. +// +// Solidity: event ScalarUpdated(uint256 scalar) +func (_Contract *ContractFilterer) WatchScalarUpdated(opts *bind.WatchOpts, sink chan<- *ContractScalarUpdated) (event.Subscription, error) { + + logs, sub, err := _Contract.contract.WatchLogs(opts, "ScalarUpdated") + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(ContractScalarUpdated) + if err := _Contract.contract.UnpackLog(event, "ScalarUpdated", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseScalarUpdated is a log parse operation binding the contract event 0x3336cd9708eaf2769a0f0dc0679f30e80f15dcd88d1921b5a16858e8b85c591a. +// +// Solidity: event ScalarUpdated(uint256 scalar) +func (_Contract *ContractFilterer) ParseScalarUpdated(log types.Log) (*ContractScalarUpdated, error) { + event := new(ContractScalarUpdated) + if err := _Contract.contract.UnpackLog(event, "ScalarUpdated", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// ContractUpdateWhitelistIterator is returned from FilterUpdateWhitelist and is used to iterate over the raw logs and unpacked data for UpdateWhitelist events raised by the Contract contract. +type ContractUpdateWhitelistIterator struct { + Event *ContractUpdateWhitelist // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *ContractUpdateWhitelistIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(ContractUpdateWhitelist) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(ContractUpdateWhitelist) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *ContractUpdateWhitelistIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *ContractUpdateWhitelistIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// ContractUpdateWhitelist represents a UpdateWhitelist event raised by the Contract contract. +type ContractUpdateWhitelist struct { + OldWhitelist common.Address + NewWhitelist common.Address + Raw types.Log // Blockchain specific contextual infos +} + +// FilterUpdateWhitelist is a free log retrieval operation binding the contract event 0x22d1c35fe072d2e42c3c8f9bd4a0d34aa84a0101d020a62517b33fdb3174e5f7. +// +// Solidity: event UpdateWhitelist(address _oldWhitelist, address _newWhitelist) +func (_Contract *ContractFilterer) FilterUpdateWhitelist(opts *bind.FilterOpts) (*ContractUpdateWhitelistIterator, error) { + + logs, sub, err := _Contract.contract.FilterLogs(opts, "UpdateWhitelist") + if err != nil { + return nil, err + } + return &ContractUpdateWhitelistIterator{contract: _Contract.contract, event: "UpdateWhitelist", logs: logs, sub: sub}, nil +} + +// WatchUpdateWhitelist is a free log subscription operation binding the contract event 0x22d1c35fe072d2e42c3c8f9bd4a0d34aa84a0101d020a62517b33fdb3174e5f7. +// +// Solidity: event UpdateWhitelist(address _oldWhitelist, address _newWhitelist) +func (_Contract *ContractFilterer) WatchUpdateWhitelist(opts *bind.WatchOpts, sink chan<- *ContractUpdateWhitelist) (event.Subscription, error) { + + logs, sub, err := _Contract.contract.WatchLogs(opts, "UpdateWhitelist") + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(ContractUpdateWhitelist) + if err := _Contract.contract.UnpackLog(event, "UpdateWhitelist", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseUpdateWhitelist is a log parse operation binding the contract event 0x22d1c35fe072d2e42c3c8f9bd4a0d34aa84a0101d020a62517b33fdb3174e5f7. +// +// Solidity: event UpdateWhitelist(address _oldWhitelist, address _newWhitelist) +func (_Contract *ContractFilterer) ParseUpdateWhitelist(log types.Log) (*ContractUpdateWhitelist, error) { + event := new(ContractUpdateWhitelist) + if err := _Contract.contract.UnpackLog(event, "UpdateWhitelist", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} diff --git a/common/ethereum_contract/contract/paymaster_verifying_erc20_v06/paymater_verifying_erc20_v06.go b/common/ethereum_contract/contract/paymaster_verifying_erc20_v06/paymater_verifying_erc20_v06.go new file mode 100644 index 00000000..c7752cb6 --- /dev/null +++ b/common/ethereum_contract/contract/paymaster_verifying_erc20_v06/paymater_verifying_erc20_v06.go @@ -0,0 +1,857 @@ +// Code generated - DO NOT EDIT. +// This file is a generated binding and any manual changes will be lost. + +package paymaster_verifying_erc20_v06 + +import ( + "errors" + "math/big" + "strings" + + ethereum "github.com/ethereum/go-ethereum" + "github.com/ethereum/go-ethereum/accounts/abi" + "github.com/ethereum/go-ethereum/accounts/abi/bind" + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/core/types" + "github.com/ethereum/go-ethereum/event" +) + +// Reference imports to suppress errors if they are not otherwise used. +var ( + _ = errors.New + _ = big.NewInt + _ = strings.NewReader + _ = ethereum.NotFound + _ = bind.Bind + _ = common.Big1 + _ = types.BloomLookup + _ = event.NewSubscription + _ = abi.ConvertType +) + +// UserOperation is an auto generated low-level Go binding around an user-defined struct. +type UserOperation struct { + Sender common.Address + Nonce *big.Int + InitCode []byte + CallData []byte + CallGasLimit *big.Int + VerificationGasLimit *big.Int + PreVerificationGas *big.Int + MaxFeePerGas *big.Int + MaxPriorityFeePerGas *big.Int + PaymasterAndData []byte + Signature []byte +} + +// ContractMetaData contains all meta data concerning the Contract contract. +var ContractMetaData = &bind.MetaData{ + ABI: "[{\"inputs\":[{\"internalType\":\"contractIEntryPoint\",\"name\":\"_entryPoint\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_owner\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"POST_OP_GAS\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint32\",\"name\":\"unstakeDelaySec\",\"type\":\"uint32\"}],\"name\":\"addStake\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"deposit\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"entryPoint\",\"outputs\":[{\"internalType\":\"contractIEntryPoint\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getDeposit\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"nonce\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"initCode\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"callData\",\"type\":\"bytes\"},{\"internalType\":\"uint256\",\"name\":\"callGasLimit\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"verificationGasLimit\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"preVerificationGas\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"maxFeePerGas\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"maxPriorityFeePerGas\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"paymasterAndData\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"signature\",\"type\":\"bytes\"}],\"internalType\":\"structUserOperation\",\"name\":\"userOp\",\"type\":\"tuple\"},{\"internalType\":\"uint48\",\"name\":\"validUntil\",\"type\":\"uint48\"},{\"internalType\":\"uint48\",\"name\":\"validAfter\",\"type\":\"uint48\"},{\"internalType\":\"address\",\"name\":\"erc20Token\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"exchangeRate\",\"type\":\"uint256\"}],\"name\":\"getHash\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"paymasterAndData\",\"type\":\"bytes\"}],\"name\":\"parsePaymasterAndData\",\"outputs\":[{\"internalType\":\"uint48\",\"name\":\"validUntil\",\"type\":\"uint48\"},{\"internalType\":\"uint48\",\"name\":\"validAfter\",\"type\":\"uint48\"},{\"internalType\":\"address\",\"name\":\"erc20Token\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"exchangeRate\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"signature\",\"type\":\"bytes\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"enumIPaymaster.PostOpMode\",\"name\":\"mode\",\"type\":\"uint8\"},{\"internalType\":\"bytes\",\"name\":\"context\",\"type\":\"bytes\"},{\"internalType\":\"uint256\",\"name\":\"actualGasCost\",\"type\":\"uint256\"}],\"name\":\"postOp\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_vault\",\"type\":\"address\"}],\"name\":\"setVault\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_verifier\",\"type\":\"address\"}],\"name\":\"setVerifier\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"unlockStake\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"nonce\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"initCode\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"callData\",\"type\":\"bytes\"},{\"internalType\":\"uint256\",\"name\":\"callGasLimit\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"verificationGasLimit\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"preVerificationGas\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"maxFeePerGas\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"maxPriorityFeePerGas\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"paymasterAndData\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"signature\",\"type\":\"bytes\"}],\"internalType\":\"structUserOperation\",\"name\":\"userOp\",\"type\":\"tuple\"},{\"internalType\":\"bytes32\",\"name\":\"userOpHash\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"maxCost\",\"type\":\"uint256\"}],\"name\":\"validatePaymasterUserOp\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"context\",\"type\":\"bytes\"},{\"internalType\":\"uint256\",\"name\":\"validationData\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"vault\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"verifier\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"addresspayable\",\"name\":\"withdrawAddress\",\"type\":\"address\"}],\"name\":\"withdrawStake\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"addresspayable\",\"name\":\"withdrawAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"withdrawTo\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]", +} + +// ContractABI is the input ABI used to generate the binding from. +// Deprecated: Use ContractMetaData.ABI instead. +var ContractABI = ContractMetaData.ABI + +// Contract is an auto generated Go binding around an Ethereum contract. +type Contract struct { + ContractCaller // Read-only binding to the contract + ContractTransactor // Write-only binding to the contract + ContractFilterer // Log filterer for contract events +} + +// ContractCaller is an auto generated read-only Go binding around an Ethereum contract. +type ContractCaller struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// ContractTransactor is an auto generated write-only Go binding around an Ethereum contract. +type ContractTransactor struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// ContractFilterer is an auto generated log filtering Go binding around an Ethereum contract events. +type ContractFilterer struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// ContractSession is an auto generated Go binding around an Ethereum contract, +// with pre-set call and transact options. +type ContractSession struct { + Contract *Contract // Generic contract binding to set the session for + CallOpts bind.CallOpts // Call options to use throughout this session + TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session +} + +// ContractCallerSession is an auto generated read-only Go binding around an Ethereum contract, +// with pre-set call options. +type ContractCallerSession struct { + Contract *ContractCaller // Generic contract caller binding to set the session for + CallOpts bind.CallOpts // Call options to use throughout this session +} + +// ContractTransactorSession is an auto generated write-only Go binding around an Ethereum contract, +// with pre-set transact options. +type ContractTransactorSession struct { + Contract *ContractTransactor // Generic contract transactor binding to set the session for + TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session +} + +// ContractRaw is an auto generated low-level Go binding around an Ethereum contract. +type ContractRaw struct { + Contract *Contract // Generic contract binding to access the raw methods on +} + +// ContractCallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract. +type ContractCallerRaw struct { + Contract *ContractCaller // Generic read-only contract binding to access the raw methods on +} + +// ContractTransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract. +type ContractTransactorRaw struct { + Contract *ContractTransactor // Generic write-only contract binding to access the raw methods on +} + +// NewContract creates a new instance of Contract, bound to a specific deployed contract. +func NewContract(address common.Address, backend bind.ContractBackend) (*Contract, error) { + contract, err := bindContract(address, backend, backend, backend) + if err != nil { + return nil, err + } + return &Contract{ContractCaller: ContractCaller{contract: contract}, ContractTransactor: ContractTransactor{contract: contract}, ContractFilterer: ContractFilterer{contract: contract}}, nil +} + +// NewContractCaller creates a new read-only instance of Contract, bound to a specific deployed contract. +func NewContractCaller(address common.Address, caller bind.ContractCaller) (*ContractCaller, error) { + contract, err := bindContract(address, caller, nil, nil) + if err != nil { + return nil, err + } + return &ContractCaller{contract: contract}, nil +} + +// NewContractTransactor creates a new write-only instance of Contract, bound to a specific deployed contract. +func NewContractTransactor(address common.Address, transactor bind.ContractTransactor) (*ContractTransactor, error) { + contract, err := bindContract(address, nil, transactor, nil) + if err != nil { + return nil, err + } + return &ContractTransactor{contract: contract}, nil +} + +// NewContractFilterer creates a new log filterer instance of Contract, bound to a specific deployed contract. +func NewContractFilterer(address common.Address, filterer bind.ContractFilterer) (*ContractFilterer, error) { + contract, err := bindContract(address, nil, nil, filterer) + if err != nil { + return nil, err + } + return &ContractFilterer{contract: contract}, nil +} + +// bindContract binds a generic wrapper to an already deployed contract. +func bindContract(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) { + parsed, err := ContractMetaData.GetAbi() + if err != nil { + return nil, err + } + return bind.NewBoundContract(address, *parsed, caller, transactor, filterer), nil +} + +// Call invokes the (constant) contract method with params as input values and +// sets the output to result. The result type might be a single field for simple +// returns, a slice of interfaces for anonymous returns and a struct for named +// returns. +func (_Contract *ContractRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { + return _Contract.Contract.ContractCaller.contract.Call(opts, result, method, params...) +} + +// Transfer initiates a plain transaction to move funds to the contract, calling +// its default method if one is available. +func (_Contract *ContractRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _Contract.Contract.ContractTransactor.contract.Transfer(opts) +} + +// Transact invokes the (paid) contract method with params as input values. +func (_Contract *ContractRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _Contract.Contract.ContractTransactor.contract.Transact(opts, method, params...) +} + +// Call invokes the (constant) contract method with params as input values and +// sets the output to result. The result type might be a single field for simple +// returns, a slice of interfaces for anonymous returns and a struct for named +// returns. +func (_Contract *ContractCallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { + return _Contract.Contract.contract.Call(opts, result, method, params...) +} + +// Transfer initiates a plain transaction to move funds to the contract, calling +// its default method if one is available. +func (_Contract *ContractTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _Contract.Contract.contract.Transfer(opts) +} + +// Transact invokes the (paid) contract method with params as input values. +func (_Contract *ContractTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _Contract.Contract.contract.Transact(opts, method, params...) +} + +// POSTOPGAS is a free data retrieval call binding the contract method 0xb8202d8f. +// +// Solidity: function POST_OP_GAS() view returns(uint256) +func (_Contract *ContractCaller) POSTOPGAS(opts *bind.CallOpts) (*big.Int, error) { + var out []interface{} + err := _Contract.contract.Call(opts, &out, "POST_OP_GAS") + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// POSTOPGAS is a free data retrieval call binding the contract method 0xb8202d8f. +// +// Solidity: function POST_OP_GAS() view returns(uint256) +func (_Contract *ContractSession) POSTOPGAS() (*big.Int, error) { + return _Contract.Contract.POSTOPGAS(&_Contract.CallOpts) +} + +// POSTOPGAS is a free data retrieval call binding the contract method 0xb8202d8f. +// +// Solidity: function POST_OP_GAS() view returns(uint256) +func (_Contract *ContractCallerSession) POSTOPGAS() (*big.Int, error) { + return _Contract.Contract.POSTOPGAS(&_Contract.CallOpts) +} + +// EntryPoint is a free data retrieval call binding the contract method 0xb0d691fe. +// +// Solidity: function entryPoint() view returns(address) +func (_Contract *ContractCaller) EntryPoint(opts *bind.CallOpts) (common.Address, error) { + var out []interface{} + err := _Contract.contract.Call(opts, &out, "entryPoint") + + if err != nil { + return *new(common.Address), err + } + + out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) + + return out0, err + +} + +// EntryPoint is a free data retrieval call binding the contract method 0xb0d691fe. +// +// Solidity: function entryPoint() view returns(address) +func (_Contract *ContractSession) EntryPoint() (common.Address, error) { + return _Contract.Contract.EntryPoint(&_Contract.CallOpts) +} + +// EntryPoint is a free data retrieval call binding the contract method 0xb0d691fe. +// +// Solidity: function entryPoint() view returns(address) +func (_Contract *ContractCallerSession) EntryPoint() (common.Address, error) { + return _Contract.Contract.EntryPoint(&_Contract.CallOpts) +} + +// GetDeposit is a free data retrieval call binding the contract method 0xc399ec88. +// +// Solidity: function getDeposit() view returns(uint256) +func (_Contract *ContractCaller) GetDeposit(opts *bind.CallOpts) (*big.Int, error) { + var out []interface{} + err := _Contract.contract.Call(opts, &out, "getDeposit") + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// GetDeposit is a free data retrieval call binding the contract method 0xc399ec88. +// +// Solidity: function getDeposit() view returns(uint256) +func (_Contract *ContractSession) GetDeposit() (*big.Int, error) { + return _Contract.Contract.GetDeposit(&_Contract.CallOpts) +} + +// GetDeposit is a free data retrieval call binding the contract method 0xc399ec88. +// +// Solidity: function getDeposit() view returns(uint256) +func (_Contract *ContractCallerSession) GetDeposit() (*big.Int, error) { + return _Contract.Contract.GetDeposit(&_Contract.CallOpts) +} + +// GetHash is a free data retrieval call binding the contract method 0x290da2ad. +// +// Solidity: function getHash((address,uint256,bytes,bytes,uint256,uint256,uint256,uint256,uint256,bytes,bytes) userOp, uint48 validUntil, uint48 validAfter, address erc20Token, uint256 exchangeRate) view returns(bytes32) +func (_Contract *ContractCaller) GetHash(opts *bind.CallOpts, userOp UserOperation, validUntil *big.Int, validAfter *big.Int, erc20Token common.Address, exchangeRate *big.Int) ([32]byte, error) { + var out []interface{} + err := _Contract.contract.Call(opts, &out, "getHash", userOp, validUntil, validAfter, erc20Token, exchangeRate) + + if err != nil { + return *new([32]byte), err + } + + out0 := *abi.ConvertType(out[0], new([32]byte)).(*[32]byte) + + return out0, err + +} + +// GetHash is a free data retrieval call binding the contract method 0x290da2ad. +// +// Solidity: function getHash((address,uint256,bytes,bytes,uint256,uint256,uint256,uint256,uint256,bytes,bytes) userOp, uint48 validUntil, uint48 validAfter, address erc20Token, uint256 exchangeRate) view returns(bytes32) +func (_Contract *ContractSession) GetHash(userOp UserOperation, validUntil *big.Int, validAfter *big.Int, erc20Token common.Address, exchangeRate *big.Int) ([32]byte, error) { + return _Contract.Contract.GetHash(&_Contract.CallOpts, userOp, validUntil, validAfter, erc20Token, exchangeRate) +} + +// GetHash is a free data retrieval call binding the contract method 0x290da2ad. +// +// Solidity: function getHash((address,uint256,bytes,bytes,uint256,uint256,uint256,uint256,uint256,bytes,bytes) userOp, uint48 validUntil, uint48 validAfter, address erc20Token, uint256 exchangeRate) view returns(bytes32) +func (_Contract *ContractCallerSession) GetHash(userOp UserOperation, validUntil *big.Int, validAfter *big.Int, erc20Token common.Address, exchangeRate *big.Int) ([32]byte, error) { + return _Contract.Contract.GetHash(&_Contract.CallOpts, userOp, validUntil, validAfter, erc20Token, exchangeRate) +} + +// Owner is a free data retrieval call binding the contract method 0x8da5cb5b. +// +// Solidity: function owner() view returns(address) +func (_Contract *ContractCaller) Owner(opts *bind.CallOpts) (common.Address, error) { + var out []interface{} + err := _Contract.contract.Call(opts, &out, "owner") + + if err != nil { + return *new(common.Address), err + } + + out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) + + return out0, err + +} + +// Owner is a free data retrieval call binding the contract method 0x8da5cb5b. +// +// Solidity: function owner() view returns(address) +func (_Contract *ContractSession) Owner() (common.Address, error) { + return _Contract.Contract.Owner(&_Contract.CallOpts) +} + +// Owner is a free data retrieval call binding the contract method 0x8da5cb5b. +// +// Solidity: function owner() view returns(address) +func (_Contract *ContractCallerSession) Owner() (common.Address, error) { + return _Contract.Contract.Owner(&_Contract.CallOpts) +} + +// ParsePaymasterAndData is a free data retrieval call binding the contract method 0x94d4ad60. +// +// Solidity: function parsePaymasterAndData(bytes paymasterAndData) pure returns(uint48 validUntil, uint48 validAfter, address erc20Token, uint256 exchangeRate, bytes signature) +func (_Contract *ContractCaller) ParsePaymasterAndData(opts *bind.CallOpts, paymasterAndData []byte) (struct { + ValidUntil *big.Int + ValidAfter *big.Int + Erc20Token common.Address + ExchangeRate *big.Int + Signature []byte +}, error) { + var out []interface{} + err := _Contract.contract.Call(opts, &out, "parsePaymasterAndData", paymasterAndData) + + outstruct := new(struct { + ValidUntil *big.Int + ValidAfter *big.Int + Erc20Token common.Address + ExchangeRate *big.Int + Signature []byte + }) + if err != nil { + return *outstruct, err + } + + outstruct.ValidUntil = *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + outstruct.ValidAfter = *abi.ConvertType(out[1], new(*big.Int)).(**big.Int) + outstruct.Erc20Token = *abi.ConvertType(out[2], new(common.Address)).(*common.Address) + outstruct.ExchangeRate = *abi.ConvertType(out[3], new(*big.Int)).(**big.Int) + outstruct.Signature = *abi.ConvertType(out[4], new([]byte)).(*[]byte) + + return *outstruct, err + +} + +// ParsePaymasterAndData is a free data retrieval call binding the contract method 0x94d4ad60. +// +// Solidity: function parsePaymasterAndData(bytes paymasterAndData) pure returns(uint48 validUntil, uint48 validAfter, address erc20Token, uint256 exchangeRate, bytes signature) +func (_Contract *ContractSession) ParsePaymasterAndData(paymasterAndData []byte) (struct { + ValidUntil *big.Int + ValidAfter *big.Int + Erc20Token common.Address + ExchangeRate *big.Int + Signature []byte +}, error) { + return _Contract.Contract.ParsePaymasterAndData(&_Contract.CallOpts, paymasterAndData) +} + +// ParsePaymasterAndData is a free data retrieval call binding the contract method 0x94d4ad60. +// +// Solidity: function parsePaymasterAndData(bytes paymasterAndData) pure returns(uint48 validUntil, uint48 validAfter, address erc20Token, uint256 exchangeRate, bytes signature) +func (_Contract *ContractCallerSession) ParsePaymasterAndData(paymasterAndData []byte) (struct { + ValidUntil *big.Int + ValidAfter *big.Int + Erc20Token common.Address + ExchangeRate *big.Int + Signature []byte +}, error) { + return _Contract.Contract.ParsePaymasterAndData(&_Contract.CallOpts, paymasterAndData) +} + +// Vault is a free data retrieval call binding the contract method 0xfbfa77cf. +// +// Solidity: function vault() view returns(address) +func (_Contract *ContractCaller) Vault(opts *bind.CallOpts) (common.Address, error) { + var out []interface{} + err := _Contract.contract.Call(opts, &out, "vault") + + if err != nil { + return *new(common.Address), err + } + + out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) + + return out0, err + +} + +// Vault is a free data retrieval call binding the contract method 0xfbfa77cf. +// +// Solidity: function vault() view returns(address) +func (_Contract *ContractSession) Vault() (common.Address, error) { + return _Contract.Contract.Vault(&_Contract.CallOpts) +} + +// Vault is a free data retrieval call binding the contract method 0xfbfa77cf. +// +// Solidity: function vault() view returns(address) +func (_Contract *ContractCallerSession) Vault() (common.Address, error) { + return _Contract.Contract.Vault(&_Contract.CallOpts) +} + +// Verifier is a free data retrieval call binding the contract method 0x2b7ac3f3. +// +// Solidity: function verifier() view returns(address) +func (_Contract *ContractCaller) Verifier(opts *bind.CallOpts) (common.Address, error) { + var out []interface{} + err := _Contract.contract.Call(opts, &out, "verifier") + + if err != nil { + return *new(common.Address), err + } + + out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) + + return out0, err + +} + +// Verifier is a free data retrieval call binding the contract method 0x2b7ac3f3. +// +// Solidity: function verifier() view returns(address) +func (_Contract *ContractSession) Verifier() (common.Address, error) { + return _Contract.Contract.Verifier(&_Contract.CallOpts) +} + +// Verifier is a free data retrieval call binding the contract method 0x2b7ac3f3. +// +// Solidity: function verifier() view returns(address) +func (_Contract *ContractCallerSession) Verifier() (common.Address, error) { + return _Contract.Contract.Verifier(&_Contract.CallOpts) +} + +// AddStake is a paid mutator transaction binding the contract method 0x0396cb60. +// +// Solidity: function addStake(uint32 unstakeDelaySec) payable returns() +func (_Contract *ContractTransactor) AddStake(opts *bind.TransactOpts, unstakeDelaySec uint32) (*types.Transaction, error) { + return _Contract.contract.Transact(opts, "addStake", unstakeDelaySec) +} + +// AddStake is a paid mutator transaction binding the contract method 0x0396cb60. +// +// Solidity: function addStake(uint32 unstakeDelaySec) payable returns() +func (_Contract *ContractSession) AddStake(unstakeDelaySec uint32) (*types.Transaction, error) { + return _Contract.Contract.AddStake(&_Contract.TransactOpts, unstakeDelaySec) +} + +// AddStake is a paid mutator transaction binding the contract method 0x0396cb60. +// +// Solidity: function addStake(uint32 unstakeDelaySec) payable returns() +func (_Contract *ContractTransactorSession) AddStake(unstakeDelaySec uint32) (*types.Transaction, error) { + return _Contract.Contract.AddStake(&_Contract.TransactOpts, unstakeDelaySec) +} + +// Deposit is a paid mutator transaction binding the contract method 0xd0e30db0. +// +// Solidity: function deposit() payable returns() +func (_Contract *ContractTransactor) Deposit(opts *bind.TransactOpts) (*types.Transaction, error) { + return _Contract.contract.Transact(opts, "deposit") +} + +// Deposit is a paid mutator transaction binding the contract method 0xd0e30db0. +// +// Solidity: function deposit() payable returns() +func (_Contract *ContractSession) Deposit() (*types.Transaction, error) { + return _Contract.Contract.Deposit(&_Contract.TransactOpts) +} + +// Deposit is a paid mutator transaction binding the contract method 0xd0e30db0. +// +// Solidity: function deposit() payable returns() +func (_Contract *ContractTransactorSession) Deposit() (*types.Transaction, error) { + return _Contract.Contract.Deposit(&_Contract.TransactOpts) +} + +// PostOp is a paid mutator transaction binding the contract method 0xa9a23409. +// +// Solidity: function postOp(uint8 mode, bytes context, uint256 actualGasCost) returns() +func (_Contract *ContractTransactor) PostOp(opts *bind.TransactOpts, mode uint8, context []byte, actualGasCost *big.Int) (*types.Transaction, error) { + return _Contract.contract.Transact(opts, "postOp", mode, context, actualGasCost) +} + +// PostOp is a paid mutator transaction binding the contract method 0xa9a23409. +// +// Solidity: function postOp(uint8 mode, bytes context, uint256 actualGasCost) returns() +func (_Contract *ContractSession) PostOp(mode uint8, context []byte, actualGasCost *big.Int) (*types.Transaction, error) { + return _Contract.Contract.PostOp(&_Contract.TransactOpts, mode, context, actualGasCost) +} + +// PostOp is a paid mutator transaction binding the contract method 0xa9a23409. +// +// Solidity: function postOp(uint8 mode, bytes context, uint256 actualGasCost) returns() +func (_Contract *ContractTransactorSession) PostOp(mode uint8, context []byte, actualGasCost *big.Int) (*types.Transaction, error) { + return _Contract.Contract.PostOp(&_Contract.TransactOpts, mode, context, actualGasCost) +} + +// RenounceOwnership is a paid mutator transaction binding the contract method 0x715018a6. +// +// Solidity: function renounceOwnership() returns() +func (_Contract *ContractTransactor) RenounceOwnership(opts *bind.TransactOpts) (*types.Transaction, error) { + return _Contract.contract.Transact(opts, "renounceOwnership") +} + +// RenounceOwnership is a paid mutator transaction binding the contract method 0x715018a6. +// +// Solidity: function renounceOwnership() returns() +func (_Contract *ContractSession) RenounceOwnership() (*types.Transaction, error) { + return _Contract.Contract.RenounceOwnership(&_Contract.TransactOpts) +} + +// RenounceOwnership is a paid mutator transaction binding the contract method 0x715018a6. +// +// Solidity: function renounceOwnership() returns() +func (_Contract *ContractTransactorSession) RenounceOwnership() (*types.Transaction, error) { + return _Contract.Contract.RenounceOwnership(&_Contract.TransactOpts) +} + +// SetVault is a paid mutator transaction binding the contract method 0x6817031b. +// +// Solidity: function setVault(address _vault) returns() +func (_Contract *ContractTransactor) SetVault(opts *bind.TransactOpts, _vault common.Address) (*types.Transaction, error) { + return _Contract.contract.Transact(opts, "setVault", _vault) +} + +// SetVault is a paid mutator transaction binding the contract method 0x6817031b. +// +// Solidity: function setVault(address _vault) returns() +func (_Contract *ContractSession) SetVault(_vault common.Address) (*types.Transaction, error) { + return _Contract.Contract.SetVault(&_Contract.TransactOpts, _vault) +} + +// SetVault is a paid mutator transaction binding the contract method 0x6817031b. +// +// Solidity: function setVault(address _vault) returns() +func (_Contract *ContractTransactorSession) SetVault(_vault common.Address) (*types.Transaction, error) { + return _Contract.Contract.SetVault(&_Contract.TransactOpts, _vault) +} + +// SetVerifier is a paid mutator transaction binding the contract method 0x5437988d. +// +// Solidity: function setVerifier(address _verifier) returns() +func (_Contract *ContractTransactor) SetVerifier(opts *bind.TransactOpts, _verifier common.Address) (*types.Transaction, error) { + return _Contract.contract.Transact(opts, "setVerifier", _verifier) +} + +// SetVerifier is a paid mutator transaction binding the contract method 0x5437988d. +// +// Solidity: function setVerifier(address _verifier) returns() +func (_Contract *ContractSession) SetVerifier(_verifier common.Address) (*types.Transaction, error) { + return _Contract.Contract.SetVerifier(&_Contract.TransactOpts, _verifier) +} + +// SetVerifier is a paid mutator transaction binding the contract method 0x5437988d. +// +// Solidity: function setVerifier(address _verifier) returns() +func (_Contract *ContractTransactorSession) SetVerifier(_verifier common.Address) (*types.Transaction, error) { + return _Contract.Contract.SetVerifier(&_Contract.TransactOpts, _verifier) +} + +// TransferOwnership is a paid mutator transaction binding the contract method 0xf2fde38b. +// +// Solidity: function transferOwnership(address newOwner) returns() +func (_Contract *ContractTransactor) TransferOwnership(opts *bind.TransactOpts, newOwner common.Address) (*types.Transaction, error) { + return _Contract.contract.Transact(opts, "transferOwnership", newOwner) +} + +// TransferOwnership is a paid mutator transaction binding the contract method 0xf2fde38b. +// +// Solidity: function transferOwnership(address newOwner) returns() +func (_Contract *ContractSession) TransferOwnership(newOwner common.Address) (*types.Transaction, error) { + return _Contract.Contract.TransferOwnership(&_Contract.TransactOpts, newOwner) +} + +// TransferOwnership is a paid mutator transaction binding the contract method 0xf2fde38b. +// +// Solidity: function transferOwnership(address newOwner) returns() +func (_Contract *ContractTransactorSession) TransferOwnership(newOwner common.Address) (*types.Transaction, error) { + return _Contract.Contract.TransferOwnership(&_Contract.TransactOpts, newOwner) +} + +// UnlockStake is a paid mutator transaction binding the contract method 0xbb9fe6bf. +// +// Solidity: function unlockStake() returns() +func (_Contract *ContractTransactor) UnlockStake(opts *bind.TransactOpts) (*types.Transaction, error) { + return _Contract.contract.Transact(opts, "unlockStake") +} + +// UnlockStake is a paid mutator transaction binding the contract method 0xbb9fe6bf. +// +// Solidity: function unlockStake() returns() +func (_Contract *ContractSession) UnlockStake() (*types.Transaction, error) { + return _Contract.Contract.UnlockStake(&_Contract.TransactOpts) +} + +// UnlockStake is a paid mutator transaction binding the contract method 0xbb9fe6bf. +// +// Solidity: function unlockStake() returns() +func (_Contract *ContractTransactorSession) UnlockStake() (*types.Transaction, error) { + return _Contract.Contract.UnlockStake(&_Contract.TransactOpts) +} + +// ValidatePaymasterUserOp is a paid mutator transaction binding the contract method 0xf465c77e. +// +// Solidity: function validatePaymasterUserOp((address,uint256,bytes,bytes,uint256,uint256,uint256,uint256,uint256,bytes,bytes) userOp, bytes32 userOpHash, uint256 maxCost) returns(bytes context, uint256 validationData) +func (_Contract *ContractTransactor) ValidatePaymasterUserOp(opts *bind.TransactOpts, userOp UserOperation, userOpHash [32]byte, maxCost *big.Int) (*types.Transaction, error) { + return _Contract.contract.Transact(opts, "validatePaymasterUserOp", userOp, userOpHash, maxCost) +} + +// ValidatePaymasterUserOp is a paid mutator transaction binding the contract method 0xf465c77e. +// +// Solidity: function validatePaymasterUserOp((address,uint256,bytes,bytes,uint256,uint256,uint256,uint256,uint256,bytes,bytes) userOp, bytes32 userOpHash, uint256 maxCost) returns(bytes context, uint256 validationData) +func (_Contract *ContractSession) ValidatePaymasterUserOp(userOp UserOperation, userOpHash [32]byte, maxCost *big.Int) (*types.Transaction, error) { + return _Contract.Contract.ValidatePaymasterUserOp(&_Contract.TransactOpts, userOp, userOpHash, maxCost) +} + +// ValidatePaymasterUserOp is a paid mutator transaction binding the contract method 0xf465c77e. +// +// Solidity: function validatePaymasterUserOp((address,uint256,bytes,bytes,uint256,uint256,uint256,uint256,uint256,bytes,bytes) userOp, bytes32 userOpHash, uint256 maxCost) returns(bytes context, uint256 validationData) +func (_Contract *ContractTransactorSession) ValidatePaymasterUserOp(userOp UserOperation, userOpHash [32]byte, maxCost *big.Int) (*types.Transaction, error) { + return _Contract.Contract.ValidatePaymasterUserOp(&_Contract.TransactOpts, userOp, userOpHash, maxCost) +} + +// WithdrawStake is a paid mutator transaction binding the contract method 0xc23a5cea. +// +// Solidity: function withdrawStake(address withdrawAddress) returns() +func (_Contract *ContractTransactor) WithdrawStake(opts *bind.TransactOpts, withdrawAddress common.Address) (*types.Transaction, error) { + return _Contract.contract.Transact(opts, "withdrawStake", withdrawAddress) +} + +// WithdrawStake is a paid mutator transaction binding the contract method 0xc23a5cea. +// +// Solidity: function withdrawStake(address withdrawAddress) returns() +func (_Contract *ContractSession) WithdrawStake(withdrawAddress common.Address) (*types.Transaction, error) { + return _Contract.Contract.WithdrawStake(&_Contract.TransactOpts, withdrawAddress) +} + +// WithdrawStake is a paid mutator transaction binding the contract method 0xc23a5cea. +// +// Solidity: function withdrawStake(address withdrawAddress) returns() +func (_Contract *ContractTransactorSession) WithdrawStake(withdrawAddress common.Address) (*types.Transaction, error) { + return _Contract.Contract.WithdrawStake(&_Contract.TransactOpts, withdrawAddress) +} + +// WithdrawTo is a paid mutator transaction binding the contract method 0x205c2878. +// +// Solidity: function withdrawTo(address withdrawAddress, uint256 amount) returns() +func (_Contract *ContractTransactor) WithdrawTo(opts *bind.TransactOpts, withdrawAddress common.Address, amount *big.Int) (*types.Transaction, error) { + return _Contract.contract.Transact(opts, "withdrawTo", withdrawAddress, amount) +} + +// WithdrawTo is a paid mutator transaction binding the contract method 0x205c2878. +// +// Solidity: function withdrawTo(address withdrawAddress, uint256 amount) returns() +func (_Contract *ContractSession) WithdrawTo(withdrawAddress common.Address, amount *big.Int) (*types.Transaction, error) { + return _Contract.Contract.WithdrawTo(&_Contract.TransactOpts, withdrawAddress, amount) +} + +// WithdrawTo is a paid mutator transaction binding the contract method 0x205c2878. +// +// Solidity: function withdrawTo(address withdrawAddress, uint256 amount) returns() +func (_Contract *ContractTransactorSession) WithdrawTo(withdrawAddress common.Address, amount *big.Int) (*types.Transaction, error) { + return _Contract.Contract.WithdrawTo(&_Contract.TransactOpts, withdrawAddress, amount) +} + +// ContractOwnershipTransferredIterator is returned from FilterOwnershipTransferred and is used to iterate over the raw logs and unpacked data for OwnershipTransferred events raised by the Contract contract. +type ContractOwnershipTransferredIterator struct { + Event *ContractOwnershipTransferred // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *ContractOwnershipTransferredIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(ContractOwnershipTransferred) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(ContractOwnershipTransferred) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *ContractOwnershipTransferredIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *ContractOwnershipTransferredIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// ContractOwnershipTransferred represents a OwnershipTransferred event raised by the Contract contract. +type ContractOwnershipTransferred struct { + PreviousOwner common.Address + NewOwner common.Address + Raw types.Log // Blockchain specific contextual infos +} + +// FilterOwnershipTransferred is a free log retrieval operation binding the contract event 0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0. +// +// Solidity: event OwnershipTransferred(address indexed previousOwner, address indexed newOwner) +func (_Contract *ContractFilterer) FilterOwnershipTransferred(opts *bind.FilterOpts, previousOwner []common.Address, newOwner []common.Address) (*ContractOwnershipTransferredIterator, error) { + + var previousOwnerRule []interface{} + for _, previousOwnerItem := range previousOwner { + previousOwnerRule = append(previousOwnerRule, previousOwnerItem) + } + var newOwnerRule []interface{} + for _, newOwnerItem := range newOwner { + newOwnerRule = append(newOwnerRule, newOwnerItem) + } + + logs, sub, err := _Contract.contract.FilterLogs(opts, "OwnershipTransferred", previousOwnerRule, newOwnerRule) + if err != nil { + return nil, err + } + return &ContractOwnershipTransferredIterator{contract: _Contract.contract, event: "OwnershipTransferred", logs: logs, sub: sub}, nil +} + +// WatchOwnershipTransferred is a free log subscription operation binding the contract event 0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0. +// +// Solidity: event OwnershipTransferred(address indexed previousOwner, address indexed newOwner) +func (_Contract *ContractFilterer) WatchOwnershipTransferred(opts *bind.WatchOpts, sink chan<- *ContractOwnershipTransferred, previousOwner []common.Address, newOwner []common.Address) (event.Subscription, error) { + + var previousOwnerRule []interface{} + for _, previousOwnerItem := range previousOwner { + previousOwnerRule = append(previousOwnerRule, previousOwnerItem) + } + var newOwnerRule []interface{} + for _, newOwnerItem := range newOwner { + newOwnerRule = append(newOwnerRule, newOwnerItem) + } + + logs, sub, err := _Contract.contract.WatchLogs(opts, "OwnershipTransferred", previousOwnerRule, newOwnerRule) + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(ContractOwnershipTransferred) + if err := _Contract.contract.UnpackLog(event, "OwnershipTransferred", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseOwnershipTransferred is a log parse operation binding the contract event 0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0. +// +// Solidity: event OwnershipTransferred(address indexed previousOwner, address indexed newOwner) +func (_Contract *ContractFilterer) ParseOwnershipTransferred(log types.Log) (*ContractOwnershipTransferred, error) { + event := new(ContractOwnershipTransferred) + if err := _Contract.contract.UnpackLog(event, "OwnershipTransferred", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} diff --git a/common/ethereum_contract/contract/paymaster_verifying_erc20_v07/paymaster_verifying_erc20_v07.go b/common/ethereum_contract/contract/paymaster_verifying_erc20_v07/paymaster_verifying_erc20_v07.go new file mode 100644 index 00000000..1305c34d --- /dev/null +++ b/common/ethereum_contract/contract/paymaster_verifying_erc20_v07/paymaster_verifying_erc20_v07.go @@ -0,0 +1,855 @@ +// Code generated - DO NOT EDIT. +// This file is a generated binding and any manual changes will be lost. + +package paymaster_verifying_erc20_v07 + +import ( + "errors" + "math/big" + "strings" + + ethereum "github.com/ethereum/go-ethereum" + "github.com/ethereum/go-ethereum/accounts/abi" + "github.com/ethereum/go-ethereum/accounts/abi/bind" + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/core/types" + "github.com/ethereum/go-ethereum/event" +) + +// Reference imports to suppress errors if they are not otherwise used. +var ( + _ = errors.New + _ = big.NewInt + _ = strings.NewReader + _ = ethereum.NotFound + _ = bind.Bind + _ = common.Big1 + _ = types.BloomLookup + _ = event.NewSubscription + _ = abi.ConvertType +) + +// PackedUserOperation is an auto generated low-level Go binding around an user-defined struct. +type PackedUserOperation struct { + Sender common.Address + Nonce *big.Int + InitCode []byte + CallData []byte + AccountGasLimits [32]byte + PreVerificationGas *big.Int + GasFees [32]byte + PaymasterAndData []byte + Signature []byte +} + +// ContractMetaData contains all meta data concerning the Contract contract. +var ContractMetaData = &bind.MetaData{ + ABI: "[{\"inputs\":[{\"internalType\":\"contractIEntryPoint\",\"name\":\"_entryPoint\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_owner\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"target\",\"type\":\"address\"}],\"name\":\"AddressEmptyCode\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"AddressInsufficientBalance\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ECDSAInvalidSignature\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"length\",\"type\":\"uint256\"}],\"name\":\"ECDSAInvalidSignatureLength\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"s\",\"type\":\"bytes32\"}],\"name\":\"ECDSAInvalidSignatureS\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"FailedInnerCall\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"}],\"name\":\"OwnableInvalidOwner\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"OwnableUnauthorizedAccount\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"}],\"name\":\"SafeERC20FailedOperation\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"POST_OP_GAS\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint32\",\"name\":\"unstakeDelaySec\",\"type\":\"uint32\"}],\"name\":\"addStake\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"deposit\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"entryPoint\",\"outputs\":[{\"internalType\":\"contractIEntryPoint\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getDeposit\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"nonce\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"initCode\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"callData\",\"type\":\"bytes\"},{\"internalType\":\"bytes32\",\"name\":\"accountGasLimits\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"preVerificationGas\",\"type\":\"uint256\"},{\"internalType\":\"bytes32\",\"name\":\"gasFees\",\"type\":\"bytes32\"},{\"internalType\":\"bytes\",\"name\":\"paymasterAndData\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"signature\",\"type\":\"bytes\"}],\"internalType\":\"structPackedUserOperation\",\"name\":\"userOp\",\"type\":\"tuple\"},{\"internalType\":\"uint48\",\"name\":\"validUntil\",\"type\":\"uint48\"},{\"internalType\":\"uint48\",\"name\":\"validAfter\",\"type\":\"uint48\"},{\"internalType\":\"address\",\"name\":\"erc20Token\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"exchangeRate\",\"type\":\"uint256\"}],\"name\":\"getHash\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"paymasterAndData\",\"type\":\"bytes\"}],\"name\":\"parsePaymasterAndData\",\"outputs\":[{\"internalType\":\"uint48\",\"name\":\"validUntil\",\"type\":\"uint48\"},{\"internalType\":\"uint48\",\"name\":\"validAfter\",\"type\":\"uint48\"},{\"internalType\":\"address\",\"name\":\"erc20Token\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"exchangeRate\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"signature\",\"type\":\"bytes\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"enumIPaymaster.PostOpMode\",\"name\":\"mode\",\"type\":\"uint8\"},{\"internalType\":\"bytes\",\"name\":\"context\",\"type\":\"bytes\"},{\"internalType\":\"uint256\",\"name\":\"actualGasCost\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"actualUserOpFeePerGas\",\"type\":\"uint256\"}],\"name\":\"postOp\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_vault\",\"type\":\"address\"}],\"name\":\"setVault\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_verifier\",\"type\":\"address\"}],\"name\":\"setVerifier\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"unlockStake\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"nonce\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"initCode\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"callData\",\"type\":\"bytes\"},{\"internalType\":\"bytes32\",\"name\":\"accountGasLimits\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"preVerificationGas\",\"type\":\"uint256\"},{\"internalType\":\"bytes32\",\"name\":\"gasFees\",\"type\":\"bytes32\"},{\"internalType\":\"bytes\",\"name\":\"paymasterAndData\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"signature\",\"type\":\"bytes\"}],\"internalType\":\"structPackedUserOperation\",\"name\":\"userOp\",\"type\":\"tuple\"},{\"internalType\":\"bytes32\",\"name\":\"userOpHash\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"maxCost\",\"type\":\"uint256\"}],\"name\":\"validatePaymasterUserOp\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"context\",\"type\":\"bytes\"},{\"internalType\":\"uint256\",\"name\":\"validationData\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"vault\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"verifier\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"addresspayable\",\"name\":\"withdrawAddress\",\"type\":\"address\"}],\"name\":\"withdrawStake\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"addresspayable\",\"name\":\"withdrawAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"withdrawTo\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]", +} + +// ContractABI is the input ABI used to generate the binding from. +// Deprecated: Use ContractMetaData.ABI instead. +var ContractABI = ContractMetaData.ABI + +// Contract is an auto generated Go binding around an Ethereum contract. +type Contract struct { + ContractCaller // Read-only binding to the contract + ContractTransactor // Write-only binding to the contract + ContractFilterer // Log filterer for contract events +} + +// ContractCaller is an auto generated read-only Go binding around an Ethereum contract. +type ContractCaller struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// ContractTransactor is an auto generated write-only Go binding around an Ethereum contract. +type ContractTransactor struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// ContractFilterer is an auto generated log filtering Go binding around an Ethereum contract events. +type ContractFilterer struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// ContractSession is an auto generated Go binding around an Ethereum contract, +// with pre-set call and transact options. +type ContractSession struct { + Contract *Contract // Generic contract binding to set the session for + CallOpts bind.CallOpts // Call options to use throughout this session + TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session +} + +// ContractCallerSession is an auto generated read-only Go binding around an Ethereum contract, +// with pre-set call options. +type ContractCallerSession struct { + Contract *ContractCaller // Generic contract caller binding to set the session for + CallOpts bind.CallOpts // Call options to use throughout this session +} + +// ContractTransactorSession is an auto generated write-only Go binding around an Ethereum contract, +// with pre-set transact options. +type ContractTransactorSession struct { + Contract *ContractTransactor // Generic contract transactor binding to set the session for + TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session +} + +// ContractRaw is an auto generated low-level Go binding around an Ethereum contract. +type ContractRaw struct { + Contract *Contract // Generic contract binding to access the raw methods on +} + +// ContractCallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract. +type ContractCallerRaw struct { + Contract *ContractCaller // Generic read-only contract binding to access the raw methods on +} + +// ContractTransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract. +type ContractTransactorRaw struct { + Contract *ContractTransactor // Generic write-only contract binding to access the raw methods on +} + +// NewContract creates a new instance of Contract, bound to a specific deployed contract. +func NewContract(address common.Address, backend bind.ContractBackend) (*Contract, error) { + contract, err := bindContract(address, backend, backend, backend) + if err != nil { + return nil, err + } + return &Contract{ContractCaller: ContractCaller{contract: contract}, ContractTransactor: ContractTransactor{contract: contract}, ContractFilterer: ContractFilterer{contract: contract}}, nil +} + +// NewContractCaller creates a new read-only instance of Contract, bound to a specific deployed contract. +func NewContractCaller(address common.Address, caller bind.ContractCaller) (*ContractCaller, error) { + contract, err := bindContract(address, caller, nil, nil) + if err != nil { + return nil, err + } + return &ContractCaller{contract: contract}, nil +} + +// NewContractTransactor creates a new write-only instance of Contract, bound to a specific deployed contract. +func NewContractTransactor(address common.Address, transactor bind.ContractTransactor) (*ContractTransactor, error) { + contract, err := bindContract(address, nil, transactor, nil) + if err != nil { + return nil, err + } + return &ContractTransactor{contract: contract}, nil +} + +// NewContractFilterer creates a new log filterer instance of Contract, bound to a specific deployed contract. +func NewContractFilterer(address common.Address, filterer bind.ContractFilterer) (*ContractFilterer, error) { + contract, err := bindContract(address, nil, nil, filterer) + if err != nil { + return nil, err + } + return &ContractFilterer{contract: contract}, nil +} + +// bindContract binds a generic wrapper to an already deployed contract. +func bindContract(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) { + parsed, err := ContractMetaData.GetAbi() + if err != nil { + return nil, err + } + return bind.NewBoundContract(address, *parsed, caller, transactor, filterer), nil +} + +// Call invokes the (constant) contract method with params as input values and +// sets the output to result. The result type might be a single field for simple +// returns, a slice of interfaces for anonymous returns and a struct for named +// returns. +func (_Contract *ContractRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { + return _Contract.Contract.ContractCaller.contract.Call(opts, result, method, params...) +} + +// Transfer initiates a plain transaction to move funds to the contract, calling +// its default method if one is available. +func (_Contract *ContractRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _Contract.Contract.ContractTransactor.contract.Transfer(opts) +} + +// Transact invokes the (paid) contract method with params as input values. +func (_Contract *ContractRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _Contract.Contract.ContractTransactor.contract.Transact(opts, method, params...) +} + +// Call invokes the (constant) contract method with params as input values and +// sets the output to result. The result type might be a single field for simple +// returns, a slice of interfaces for anonymous returns and a struct for named +// returns. +func (_Contract *ContractCallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { + return _Contract.Contract.contract.Call(opts, result, method, params...) +} + +// Transfer initiates a plain transaction to move funds to the contract, calling +// its default method if one is available. +func (_Contract *ContractTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _Contract.Contract.contract.Transfer(opts) +} + +// Transact invokes the (paid) contract method with params as input values. +func (_Contract *ContractTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _Contract.Contract.contract.Transact(opts, method, params...) +} + +// POSTOPGAS is a free data retrieval call binding the contract method 0xb8202d8f. +// +// Solidity: function POST_OP_GAS() view returns(uint256) +func (_Contract *ContractCaller) POSTOPGAS(opts *bind.CallOpts) (*big.Int, error) { + var out []interface{} + err := _Contract.contract.Call(opts, &out, "POST_OP_GAS") + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// POSTOPGAS is a free data retrieval call binding the contract method 0xb8202d8f. +// +// Solidity: function POST_OP_GAS() view returns(uint256) +func (_Contract *ContractSession) POSTOPGAS() (*big.Int, error) { + return _Contract.Contract.POSTOPGAS(&_Contract.CallOpts) +} + +// POSTOPGAS is a free data retrieval call binding the contract method 0xb8202d8f. +// +// Solidity: function POST_OP_GAS() view returns(uint256) +func (_Contract *ContractCallerSession) POSTOPGAS() (*big.Int, error) { + return _Contract.Contract.POSTOPGAS(&_Contract.CallOpts) +} + +// EntryPoint is a free data retrieval call binding the contract method 0xb0d691fe. +// +// Solidity: function entryPoint() view returns(address) +func (_Contract *ContractCaller) EntryPoint(opts *bind.CallOpts) (common.Address, error) { + var out []interface{} + err := _Contract.contract.Call(opts, &out, "entryPoint") + + if err != nil { + return *new(common.Address), err + } + + out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) + + return out0, err + +} + +// EntryPoint is a free data retrieval call binding the contract method 0xb0d691fe. +// +// Solidity: function entryPoint() view returns(address) +func (_Contract *ContractSession) EntryPoint() (common.Address, error) { + return _Contract.Contract.EntryPoint(&_Contract.CallOpts) +} + +// EntryPoint is a free data retrieval call binding the contract method 0xb0d691fe. +// +// Solidity: function entryPoint() view returns(address) +func (_Contract *ContractCallerSession) EntryPoint() (common.Address, error) { + return _Contract.Contract.EntryPoint(&_Contract.CallOpts) +} + +// GetDeposit is a free data retrieval call binding the contract method 0xc399ec88. +// +// Solidity: function getDeposit() view returns(uint256) +func (_Contract *ContractCaller) GetDeposit(opts *bind.CallOpts) (*big.Int, error) { + var out []interface{} + err := _Contract.contract.Call(opts, &out, "getDeposit") + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// GetDeposit is a free data retrieval call binding the contract method 0xc399ec88. +// +// Solidity: function getDeposit() view returns(uint256) +func (_Contract *ContractSession) GetDeposit() (*big.Int, error) { + return _Contract.Contract.GetDeposit(&_Contract.CallOpts) +} + +// GetDeposit is a free data retrieval call binding the contract method 0xc399ec88. +// +// Solidity: function getDeposit() view returns(uint256) +func (_Contract *ContractCallerSession) GetDeposit() (*big.Int, error) { + return _Contract.Contract.GetDeposit(&_Contract.CallOpts) +} + +// GetHash is a free data retrieval call binding the contract method 0xe38e46f2. +// +// Solidity: function getHash((address,uint256,bytes,bytes,bytes32,uint256,bytes32,bytes,bytes) userOp, uint48 validUntil, uint48 validAfter, address erc20Token, uint256 exchangeRate) view returns(bytes32) +func (_Contract *ContractCaller) GetHash(opts *bind.CallOpts, userOp PackedUserOperation, validUntil *big.Int, validAfter *big.Int, erc20Token common.Address, exchangeRate *big.Int) ([32]byte, error) { + var out []interface{} + err := _Contract.contract.Call(opts, &out, "getHash", userOp, validUntil, validAfter, erc20Token, exchangeRate) + + if err != nil { + return *new([32]byte), err + } + + out0 := *abi.ConvertType(out[0], new([32]byte)).(*[32]byte) + + return out0, err + +} + +// GetHash is a free data retrieval call binding the contract method 0xe38e46f2. +// +// Solidity: function getHash((address,uint256,bytes,bytes,bytes32,uint256,bytes32,bytes,bytes) userOp, uint48 validUntil, uint48 validAfter, address erc20Token, uint256 exchangeRate) view returns(bytes32) +func (_Contract *ContractSession) GetHash(userOp PackedUserOperation, validUntil *big.Int, validAfter *big.Int, erc20Token common.Address, exchangeRate *big.Int) ([32]byte, error) { + return _Contract.Contract.GetHash(&_Contract.CallOpts, userOp, validUntil, validAfter, erc20Token, exchangeRate) +} + +// GetHash is a free data retrieval call binding the contract method 0xe38e46f2. +// +// Solidity: function getHash((address,uint256,bytes,bytes,bytes32,uint256,bytes32,bytes,bytes) userOp, uint48 validUntil, uint48 validAfter, address erc20Token, uint256 exchangeRate) view returns(bytes32) +func (_Contract *ContractCallerSession) GetHash(userOp PackedUserOperation, validUntil *big.Int, validAfter *big.Int, erc20Token common.Address, exchangeRate *big.Int) ([32]byte, error) { + return _Contract.Contract.GetHash(&_Contract.CallOpts, userOp, validUntil, validAfter, erc20Token, exchangeRate) +} + +// Owner is a free data retrieval call binding the contract method 0x8da5cb5b. +// +// Solidity: function owner() view returns(address) +func (_Contract *ContractCaller) Owner(opts *bind.CallOpts) (common.Address, error) { + var out []interface{} + err := _Contract.contract.Call(opts, &out, "owner") + + if err != nil { + return *new(common.Address), err + } + + out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) + + return out0, err + +} + +// Owner is a free data retrieval call binding the contract method 0x8da5cb5b. +// +// Solidity: function owner() view returns(address) +func (_Contract *ContractSession) Owner() (common.Address, error) { + return _Contract.Contract.Owner(&_Contract.CallOpts) +} + +// Owner is a free data retrieval call binding the contract method 0x8da5cb5b. +// +// Solidity: function owner() view returns(address) +func (_Contract *ContractCallerSession) Owner() (common.Address, error) { + return _Contract.Contract.Owner(&_Contract.CallOpts) +} + +// ParsePaymasterAndData is a free data retrieval call binding the contract method 0x94d4ad60. +// +// Solidity: function parsePaymasterAndData(bytes paymasterAndData) pure returns(uint48 validUntil, uint48 validAfter, address erc20Token, uint256 exchangeRate, bytes signature) +func (_Contract *ContractCaller) ParsePaymasterAndData(opts *bind.CallOpts, paymasterAndData []byte) (struct { + ValidUntil *big.Int + ValidAfter *big.Int + Erc20Token common.Address + ExchangeRate *big.Int + Signature []byte +}, error) { + var out []interface{} + err := _Contract.contract.Call(opts, &out, "parsePaymasterAndData", paymasterAndData) + + outstruct := new(struct { + ValidUntil *big.Int + ValidAfter *big.Int + Erc20Token common.Address + ExchangeRate *big.Int + Signature []byte + }) + if err != nil { + return *outstruct, err + } + + outstruct.ValidUntil = *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + outstruct.ValidAfter = *abi.ConvertType(out[1], new(*big.Int)).(**big.Int) + outstruct.Erc20Token = *abi.ConvertType(out[2], new(common.Address)).(*common.Address) + outstruct.ExchangeRate = *abi.ConvertType(out[3], new(*big.Int)).(**big.Int) + outstruct.Signature = *abi.ConvertType(out[4], new([]byte)).(*[]byte) + + return *outstruct, err + +} + +// ParsePaymasterAndData is a free data retrieval call binding the contract method 0x94d4ad60. +// +// Solidity: function parsePaymasterAndData(bytes paymasterAndData) pure returns(uint48 validUntil, uint48 validAfter, address erc20Token, uint256 exchangeRate, bytes signature) +func (_Contract *ContractSession) ParsePaymasterAndData(paymasterAndData []byte) (struct { + ValidUntil *big.Int + ValidAfter *big.Int + Erc20Token common.Address + ExchangeRate *big.Int + Signature []byte +}, error) { + return _Contract.Contract.ParsePaymasterAndData(&_Contract.CallOpts, paymasterAndData) +} + +// ParsePaymasterAndData is a free data retrieval call binding the contract method 0x94d4ad60. +// +// Solidity: function parsePaymasterAndData(bytes paymasterAndData) pure returns(uint48 validUntil, uint48 validAfter, address erc20Token, uint256 exchangeRate, bytes signature) +func (_Contract *ContractCallerSession) ParsePaymasterAndData(paymasterAndData []byte) (struct { + ValidUntil *big.Int + ValidAfter *big.Int + Erc20Token common.Address + ExchangeRate *big.Int + Signature []byte +}, error) { + return _Contract.Contract.ParsePaymasterAndData(&_Contract.CallOpts, paymasterAndData) +} + +// Vault is a free data retrieval call binding the contract method 0xfbfa77cf. +// +// Solidity: function vault() view returns(address) +func (_Contract *ContractCaller) Vault(opts *bind.CallOpts) (common.Address, error) { + var out []interface{} + err := _Contract.contract.Call(opts, &out, "vault") + + if err != nil { + return *new(common.Address), err + } + + out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) + + return out0, err + +} + +// Vault is a free data retrieval call binding the contract method 0xfbfa77cf. +// +// Solidity: function vault() view returns(address) +func (_Contract *ContractSession) Vault() (common.Address, error) { + return _Contract.Contract.Vault(&_Contract.CallOpts) +} + +// Vault is a free data retrieval call binding the contract method 0xfbfa77cf. +// +// Solidity: function vault() view returns(address) +func (_Contract *ContractCallerSession) Vault() (common.Address, error) { + return _Contract.Contract.Vault(&_Contract.CallOpts) +} + +// Verifier is a free data retrieval call binding the contract method 0x2b7ac3f3. +// +// Solidity: function verifier() view returns(address) +func (_Contract *ContractCaller) Verifier(opts *bind.CallOpts) (common.Address, error) { + var out []interface{} + err := _Contract.contract.Call(opts, &out, "verifier") + + if err != nil { + return *new(common.Address), err + } + + out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) + + return out0, err + +} + +// Verifier is a free data retrieval call binding the contract method 0x2b7ac3f3. +// +// Solidity: function verifier() view returns(address) +func (_Contract *ContractSession) Verifier() (common.Address, error) { + return _Contract.Contract.Verifier(&_Contract.CallOpts) +} + +// Verifier is a free data retrieval call binding the contract method 0x2b7ac3f3. +// +// Solidity: function verifier() view returns(address) +func (_Contract *ContractCallerSession) Verifier() (common.Address, error) { + return _Contract.Contract.Verifier(&_Contract.CallOpts) +} + +// AddStake is a paid mutator transaction binding the contract method 0x0396cb60. +// +// Solidity: function addStake(uint32 unstakeDelaySec) payable returns() +func (_Contract *ContractTransactor) AddStake(opts *bind.TransactOpts, unstakeDelaySec uint32) (*types.Transaction, error) { + return _Contract.contract.Transact(opts, "addStake", unstakeDelaySec) +} + +// AddStake is a paid mutator transaction binding the contract method 0x0396cb60. +// +// Solidity: function addStake(uint32 unstakeDelaySec) payable returns() +func (_Contract *ContractSession) AddStake(unstakeDelaySec uint32) (*types.Transaction, error) { + return _Contract.Contract.AddStake(&_Contract.TransactOpts, unstakeDelaySec) +} + +// AddStake is a paid mutator transaction binding the contract method 0x0396cb60. +// +// Solidity: function addStake(uint32 unstakeDelaySec) payable returns() +func (_Contract *ContractTransactorSession) AddStake(unstakeDelaySec uint32) (*types.Transaction, error) { + return _Contract.Contract.AddStake(&_Contract.TransactOpts, unstakeDelaySec) +} + +// Deposit is a paid mutator transaction binding the contract method 0xd0e30db0. +// +// Solidity: function deposit() payable returns() +func (_Contract *ContractTransactor) Deposit(opts *bind.TransactOpts) (*types.Transaction, error) { + return _Contract.contract.Transact(opts, "deposit") +} + +// Deposit is a paid mutator transaction binding the contract method 0xd0e30db0. +// +// Solidity: function deposit() payable returns() +func (_Contract *ContractSession) Deposit() (*types.Transaction, error) { + return _Contract.Contract.Deposit(&_Contract.TransactOpts) +} + +// Deposit is a paid mutator transaction binding the contract method 0xd0e30db0. +// +// Solidity: function deposit() payable returns() +func (_Contract *ContractTransactorSession) Deposit() (*types.Transaction, error) { + return _Contract.Contract.Deposit(&_Contract.TransactOpts) +} + +// PostOp is a paid mutator transaction binding the contract method 0x7c627b21. +// +// Solidity: function postOp(uint8 mode, bytes context, uint256 actualGasCost, uint256 actualUserOpFeePerGas) returns() +func (_Contract *ContractTransactor) PostOp(opts *bind.TransactOpts, mode uint8, context []byte, actualGasCost *big.Int, actualUserOpFeePerGas *big.Int) (*types.Transaction, error) { + return _Contract.contract.Transact(opts, "postOp", mode, context, actualGasCost, actualUserOpFeePerGas) +} + +// PostOp is a paid mutator transaction binding the contract method 0x7c627b21. +// +// Solidity: function postOp(uint8 mode, bytes context, uint256 actualGasCost, uint256 actualUserOpFeePerGas) returns() +func (_Contract *ContractSession) PostOp(mode uint8, context []byte, actualGasCost *big.Int, actualUserOpFeePerGas *big.Int) (*types.Transaction, error) { + return _Contract.Contract.PostOp(&_Contract.TransactOpts, mode, context, actualGasCost, actualUserOpFeePerGas) +} + +// PostOp is a paid mutator transaction binding the contract method 0x7c627b21. +// +// Solidity: function postOp(uint8 mode, bytes context, uint256 actualGasCost, uint256 actualUserOpFeePerGas) returns() +func (_Contract *ContractTransactorSession) PostOp(mode uint8, context []byte, actualGasCost *big.Int, actualUserOpFeePerGas *big.Int) (*types.Transaction, error) { + return _Contract.Contract.PostOp(&_Contract.TransactOpts, mode, context, actualGasCost, actualUserOpFeePerGas) +} + +// RenounceOwnership is a paid mutator transaction binding the contract method 0x715018a6. +// +// Solidity: function renounceOwnership() returns() +func (_Contract *ContractTransactor) RenounceOwnership(opts *bind.TransactOpts) (*types.Transaction, error) { + return _Contract.contract.Transact(opts, "renounceOwnership") +} + +// RenounceOwnership is a paid mutator transaction binding the contract method 0x715018a6. +// +// Solidity: function renounceOwnership() returns() +func (_Contract *ContractSession) RenounceOwnership() (*types.Transaction, error) { + return _Contract.Contract.RenounceOwnership(&_Contract.TransactOpts) +} + +// RenounceOwnership is a paid mutator transaction binding the contract method 0x715018a6. +// +// Solidity: function renounceOwnership() returns() +func (_Contract *ContractTransactorSession) RenounceOwnership() (*types.Transaction, error) { + return _Contract.Contract.RenounceOwnership(&_Contract.TransactOpts) +} + +// SetVault is a paid mutator transaction binding the contract method 0x6817031b. +// +// Solidity: function setVault(address _vault) returns() +func (_Contract *ContractTransactor) SetVault(opts *bind.TransactOpts, _vault common.Address) (*types.Transaction, error) { + return _Contract.contract.Transact(opts, "setVault", _vault) +} + +// SetVault is a paid mutator transaction binding the contract method 0x6817031b. +// +// Solidity: function setVault(address _vault) returns() +func (_Contract *ContractSession) SetVault(_vault common.Address) (*types.Transaction, error) { + return _Contract.Contract.SetVault(&_Contract.TransactOpts, _vault) +} + +// SetVault is a paid mutator transaction binding the contract method 0x6817031b. +// +// Solidity: function setVault(address _vault) returns() +func (_Contract *ContractTransactorSession) SetVault(_vault common.Address) (*types.Transaction, error) { + return _Contract.Contract.SetVault(&_Contract.TransactOpts, _vault) +} + +// SetVerifier is a paid mutator transaction binding the contract method 0x5437988d. +// +// Solidity: function setVerifier(address _verifier) returns() +func (_Contract *ContractTransactor) SetVerifier(opts *bind.TransactOpts, _verifier common.Address) (*types.Transaction, error) { + return _Contract.contract.Transact(opts, "setVerifier", _verifier) +} + +// SetVerifier is a paid mutator transaction binding the contract method 0x5437988d. +// +// Solidity: function setVerifier(address _verifier) returns() +func (_Contract *ContractSession) SetVerifier(_verifier common.Address) (*types.Transaction, error) { + return _Contract.Contract.SetVerifier(&_Contract.TransactOpts, _verifier) +} + +// SetVerifier is a paid mutator transaction binding the contract method 0x5437988d. +// +// Solidity: function setVerifier(address _verifier) returns() +func (_Contract *ContractTransactorSession) SetVerifier(_verifier common.Address) (*types.Transaction, error) { + return _Contract.Contract.SetVerifier(&_Contract.TransactOpts, _verifier) +} + +// TransferOwnership is a paid mutator transaction binding the contract method 0xf2fde38b. +// +// Solidity: function transferOwnership(address newOwner) returns() +func (_Contract *ContractTransactor) TransferOwnership(opts *bind.TransactOpts, newOwner common.Address) (*types.Transaction, error) { + return _Contract.contract.Transact(opts, "transferOwnership", newOwner) +} + +// TransferOwnership is a paid mutator transaction binding the contract method 0xf2fde38b. +// +// Solidity: function transferOwnership(address newOwner) returns() +func (_Contract *ContractSession) TransferOwnership(newOwner common.Address) (*types.Transaction, error) { + return _Contract.Contract.TransferOwnership(&_Contract.TransactOpts, newOwner) +} + +// TransferOwnership is a paid mutator transaction binding the contract method 0xf2fde38b. +// +// Solidity: function transferOwnership(address newOwner) returns() +func (_Contract *ContractTransactorSession) TransferOwnership(newOwner common.Address) (*types.Transaction, error) { + return _Contract.Contract.TransferOwnership(&_Contract.TransactOpts, newOwner) +} + +// UnlockStake is a paid mutator transaction binding the contract method 0xbb9fe6bf. +// +// Solidity: function unlockStake() returns() +func (_Contract *ContractTransactor) UnlockStake(opts *bind.TransactOpts) (*types.Transaction, error) { + return _Contract.contract.Transact(opts, "unlockStake") +} + +// UnlockStake is a paid mutator transaction binding the contract method 0xbb9fe6bf. +// +// Solidity: function unlockStake() returns() +func (_Contract *ContractSession) UnlockStake() (*types.Transaction, error) { + return _Contract.Contract.UnlockStake(&_Contract.TransactOpts) +} + +// UnlockStake is a paid mutator transaction binding the contract method 0xbb9fe6bf. +// +// Solidity: function unlockStake() returns() +func (_Contract *ContractTransactorSession) UnlockStake() (*types.Transaction, error) { + return _Contract.Contract.UnlockStake(&_Contract.TransactOpts) +} + +// ValidatePaymasterUserOp is a paid mutator transaction binding the contract method 0x52b7512c. +// +// Solidity: function validatePaymasterUserOp((address,uint256,bytes,bytes,bytes32,uint256,bytes32,bytes,bytes) userOp, bytes32 userOpHash, uint256 maxCost) returns(bytes context, uint256 validationData) +func (_Contract *ContractTransactor) ValidatePaymasterUserOp(opts *bind.TransactOpts, userOp PackedUserOperation, userOpHash [32]byte, maxCost *big.Int) (*types.Transaction, error) { + return _Contract.contract.Transact(opts, "validatePaymasterUserOp", userOp, userOpHash, maxCost) +} + +// ValidatePaymasterUserOp is a paid mutator transaction binding the contract method 0x52b7512c. +// +// Solidity: function validatePaymasterUserOp((address,uint256,bytes,bytes,bytes32,uint256,bytes32,bytes,bytes) userOp, bytes32 userOpHash, uint256 maxCost) returns(bytes context, uint256 validationData) +func (_Contract *ContractSession) ValidatePaymasterUserOp(userOp PackedUserOperation, userOpHash [32]byte, maxCost *big.Int) (*types.Transaction, error) { + return _Contract.Contract.ValidatePaymasterUserOp(&_Contract.TransactOpts, userOp, userOpHash, maxCost) +} + +// ValidatePaymasterUserOp is a paid mutator transaction binding the contract method 0x52b7512c. +// +// Solidity: function validatePaymasterUserOp((address,uint256,bytes,bytes,bytes32,uint256,bytes32,bytes,bytes) userOp, bytes32 userOpHash, uint256 maxCost) returns(bytes context, uint256 validationData) +func (_Contract *ContractTransactorSession) ValidatePaymasterUserOp(userOp PackedUserOperation, userOpHash [32]byte, maxCost *big.Int) (*types.Transaction, error) { + return _Contract.Contract.ValidatePaymasterUserOp(&_Contract.TransactOpts, userOp, userOpHash, maxCost) +} + +// WithdrawStake is a paid mutator transaction binding the contract method 0xc23a5cea. +// +// Solidity: function withdrawStake(address withdrawAddress) returns() +func (_Contract *ContractTransactor) WithdrawStake(opts *bind.TransactOpts, withdrawAddress common.Address) (*types.Transaction, error) { + return _Contract.contract.Transact(opts, "withdrawStake", withdrawAddress) +} + +// WithdrawStake is a paid mutator transaction binding the contract method 0xc23a5cea. +// +// Solidity: function withdrawStake(address withdrawAddress) returns() +func (_Contract *ContractSession) WithdrawStake(withdrawAddress common.Address) (*types.Transaction, error) { + return _Contract.Contract.WithdrawStake(&_Contract.TransactOpts, withdrawAddress) +} + +// WithdrawStake is a paid mutator transaction binding the contract method 0xc23a5cea. +// +// Solidity: function withdrawStake(address withdrawAddress) returns() +func (_Contract *ContractTransactorSession) WithdrawStake(withdrawAddress common.Address) (*types.Transaction, error) { + return _Contract.Contract.WithdrawStake(&_Contract.TransactOpts, withdrawAddress) +} + +// WithdrawTo is a paid mutator transaction binding the contract method 0x205c2878. +// +// Solidity: function withdrawTo(address withdrawAddress, uint256 amount) returns() +func (_Contract *ContractTransactor) WithdrawTo(opts *bind.TransactOpts, withdrawAddress common.Address, amount *big.Int) (*types.Transaction, error) { + return _Contract.contract.Transact(opts, "withdrawTo", withdrawAddress, amount) +} + +// WithdrawTo is a paid mutator transaction binding the contract method 0x205c2878. +// +// Solidity: function withdrawTo(address withdrawAddress, uint256 amount) returns() +func (_Contract *ContractSession) WithdrawTo(withdrawAddress common.Address, amount *big.Int) (*types.Transaction, error) { + return _Contract.Contract.WithdrawTo(&_Contract.TransactOpts, withdrawAddress, amount) +} + +// WithdrawTo is a paid mutator transaction binding the contract method 0x205c2878. +// +// Solidity: function withdrawTo(address withdrawAddress, uint256 amount) returns() +func (_Contract *ContractTransactorSession) WithdrawTo(withdrawAddress common.Address, amount *big.Int) (*types.Transaction, error) { + return _Contract.Contract.WithdrawTo(&_Contract.TransactOpts, withdrawAddress, amount) +} + +// ContractOwnershipTransferredIterator is returned from FilterOwnershipTransferred and is used to iterate over the raw logs and unpacked data for OwnershipTransferred events raised by the Contract contract. +type ContractOwnershipTransferredIterator struct { + Event *ContractOwnershipTransferred // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *ContractOwnershipTransferredIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(ContractOwnershipTransferred) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(ContractOwnershipTransferred) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *ContractOwnershipTransferredIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *ContractOwnershipTransferredIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// ContractOwnershipTransferred represents a OwnershipTransferred event raised by the Contract contract. +type ContractOwnershipTransferred struct { + PreviousOwner common.Address + NewOwner common.Address + Raw types.Log // Blockchain specific contextual infos +} + +// FilterOwnershipTransferred is a free log retrieval operation binding the contract event 0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0. +// +// Solidity: event OwnershipTransferred(address indexed previousOwner, address indexed newOwner) +func (_Contract *ContractFilterer) FilterOwnershipTransferred(opts *bind.FilterOpts, previousOwner []common.Address, newOwner []common.Address) (*ContractOwnershipTransferredIterator, error) { + + var previousOwnerRule []interface{} + for _, previousOwnerItem := range previousOwner { + previousOwnerRule = append(previousOwnerRule, previousOwnerItem) + } + var newOwnerRule []interface{} + for _, newOwnerItem := range newOwner { + newOwnerRule = append(newOwnerRule, newOwnerItem) + } + + logs, sub, err := _Contract.contract.FilterLogs(opts, "OwnershipTransferred", previousOwnerRule, newOwnerRule) + if err != nil { + return nil, err + } + return &ContractOwnershipTransferredIterator{contract: _Contract.contract, event: "OwnershipTransferred", logs: logs, sub: sub}, nil +} + +// WatchOwnershipTransferred is a free log subscription operation binding the contract event 0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0. +// +// Solidity: event OwnershipTransferred(address indexed previousOwner, address indexed newOwner) +func (_Contract *ContractFilterer) WatchOwnershipTransferred(opts *bind.WatchOpts, sink chan<- *ContractOwnershipTransferred, previousOwner []common.Address, newOwner []common.Address) (event.Subscription, error) { + + var previousOwnerRule []interface{} + for _, previousOwnerItem := range previousOwner { + previousOwnerRule = append(previousOwnerRule, previousOwnerItem) + } + var newOwnerRule []interface{} + for _, newOwnerItem := range newOwner { + newOwnerRule = append(newOwnerRule, newOwnerItem) + } + + logs, sub, err := _Contract.contract.WatchLogs(opts, "OwnershipTransferred", previousOwnerRule, newOwnerRule) + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(ContractOwnershipTransferred) + if err := _Contract.contract.UnpackLog(event, "OwnershipTransferred", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseOwnershipTransferred is a log parse operation binding the contract event 0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0. +// +// Solidity: event OwnershipTransferred(address indexed previousOwner, address indexed newOwner) +func (_Contract *ContractFilterer) ParseOwnershipTransferred(log types.Log) (*ContractOwnershipTransferred, error) { + event := new(ContractOwnershipTransferred) + if err := _Contract.contract.UnpackLog(event, "OwnershipTransferred", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} diff --git a/common/ethereum_contract/contract/simulate_entrypoint/simulate_entrypoint.go b/common/ethereum_contract/contract/simulate_entrypoint/simulate_entrypoint.go new file mode 100644 index 00000000..03a79ad7 --- /dev/null +++ b/common/ethereum_contract/contract/simulate_entrypoint/simulate_entrypoint.go @@ -0,0 +1,2632 @@ +// Code generated - DO NOT EDIT. +// This file is a generated binding and any manual changes will be lost. + +package simulate_entrypoint + +import ( + "errors" + "math/big" + "strings" + + ethereum "github.com/ethereum/go-ethereum" + "github.com/ethereum/go-ethereum/accounts/abi" + "github.com/ethereum/go-ethereum/accounts/abi/bind" + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/core/types" + "github.com/ethereum/go-ethereum/event" +) + +// Reference imports to suppress errors if they are not otherwise used. +var ( + _ = errors.New + _ = big.NewInt + _ = strings.NewReader + _ = ethereum.NotFound + _ = bind.Bind + _ = common.Big1 + _ = types.BloomLookup + _ = event.NewSubscription + _ = abi.ConvertType +) + +// EntryPointMemoryUserOp is an auto generated low-level Go binding around an user-defined struct. +type EntryPointMemoryUserOp struct { + Sender common.Address + Nonce *big.Int + VerificationGasLimit *big.Int + CallGasLimit *big.Int + PaymasterVerificationGasLimit *big.Int + PaymasterPostOpGasLimit *big.Int + PreVerificationGas *big.Int + Paymaster common.Address + MaxFeePerGas *big.Int + MaxPriorityFeePerGas *big.Int +} + +// EntryPointUserOpInfo is an auto generated low-level Go binding around an user-defined struct. +type EntryPointUserOpInfo struct { + MUserOp EntryPointMemoryUserOp + UserOpHash [32]byte + Prefund *big.Int + ContextOffset *big.Int + PreOpGas *big.Int +} + +// IEntryPointAggregatorStakeInfo is an auto generated low-level Go binding around an user-defined struct. +type IEntryPointAggregatorStakeInfo struct { + Aggregator common.Address + StakeInfo IStakeManagerStakeInfo +} + +// IEntryPointReturnInfo is an auto generated low-level Go binding around an user-defined struct. +type IEntryPointReturnInfo struct { + PreOpGas *big.Int + Prefund *big.Int + AccountValidationData *big.Int + PaymasterValidationData *big.Int + PaymasterContext []byte +} + +// IEntryPointSimulationsExecutionResult is an auto generated low-level Go binding around an user-defined struct. +type IEntryPointSimulationsExecutionResult struct { + PreOpGas *big.Int + Paid *big.Int + AccountValidationData *big.Int + PaymasterValidationData *big.Int + TargetSuccess bool + TargetResult []byte +} + +// IEntryPointSimulationsValidationResult is an auto generated low-level Go binding around an user-defined struct. +type IEntryPointSimulationsValidationResult struct { + ReturnInfo IEntryPointReturnInfo + SenderInfo IStakeManagerStakeInfo + FactoryInfo IStakeManagerStakeInfo + PaymasterInfo IStakeManagerStakeInfo + AggregatorInfo IEntryPointAggregatorStakeInfo +} + +// IEntryPointUserOpsPerAggregator is an auto generated low-level Go binding around an user-defined struct. +type IEntryPointUserOpsPerAggregator struct { + UserOps []PackedUserOperation + Aggregator common.Address + Signature []byte +} + +// IStakeManagerDepositInfo is an auto generated low-level Go binding around an user-defined struct. +type IStakeManagerDepositInfo struct { + Deposit *big.Int + Staked bool + Stake *big.Int + UnstakeDelaySec uint32 + WithdrawTime *big.Int +} + +// IStakeManagerStakeInfo is an auto generated low-level Go binding around an user-defined struct. +type IStakeManagerStakeInfo struct { + Stake *big.Int + UnstakeDelaySec *big.Int +} + +// PackedUserOperation is an auto generated low-level Go binding around an user-defined struct. +type PackedUserOperation struct { + Sender common.Address + Nonce *big.Int + InitCode []byte + CallData []byte + AccountGasLimits [32]byte + PreVerificationGas *big.Int + GasFees [32]byte + PaymasterAndData []byte + Signature []byte +} + +// ContractMetaData contains all meta data concerning the Contract contract. +var ContractMetaData = &bind.MetaData{ + ABI: "[{\"inputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[{\"internalType\":\"bool\",\"name\":\"success\",\"type\":\"bool\"},{\"internalType\":\"bytes\",\"name\":\"ret\",\"type\":\"bytes\"}],\"name\":\"DelegateAndRevert\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"opIndex\",\"type\":\"uint256\"},{\"internalType\":\"string\",\"name\":\"reason\",\"type\":\"string\"}],\"name\":\"FailedOp\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"opIndex\",\"type\":\"uint256\"},{\"internalType\":\"string\",\"name\":\"reason\",\"type\":\"string\"},{\"internalType\":\"bytes\",\"name\":\"inner\",\"type\":\"bytes\"}],\"name\":\"FailedOpWithRevert\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"returnData\",\"type\":\"bytes\"}],\"name\":\"PostOpReverted\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ReentrancyGuardReentrantCall\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"}],\"name\":\"SenderAddressResult\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"aggregator\",\"type\":\"address\"}],\"name\":\"SignatureValidationFailed\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"userOpHash\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"factory\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"paymaster\",\"type\":\"address\"}],\"name\":\"AccountDeployed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[],\"name\":\"BeforeExecution\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"totalDeposit\",\"type\":\"uint256\"}],\"name\":\"Deposited\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"userOpHash\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"nonce\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"revertReason\",\"type\":\"bytes\"}],\"name\":\"PostOpRevertReason\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"aggregator\",\"type\":\"address\"}],\"name\":\"SignatureAggregatorChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"totalStaked\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"unstakeDelaySec\",\"type\":\"uint256\"}],\"name\":\"StakeLocked\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"withdrawTime\",\"type\":\"uint256\"}],\"name\":\"StakeUnlocked\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"withdrawAddress\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"StakeWithdrawn\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"userOpHash\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"paymaster\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"nonce\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"success\",\"type\":\"bool\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"actualGasCost\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"actualGasUsed\",\"type\":\"uint256\"}],\"name\":\"UserOperationEvent\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"userOpHash\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"nonce\",\"type\":\"uint256\"}],\"name\":\"UserOperationPrefundTooLow\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"userOpHash\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"nonce\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"revertReason\",\"type\":\"bytes\"}],\"name\":\"UserOperationRevertReason\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"withdrawAddress\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"Withdrawn\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"initCode\",\"type\":\"bytes\"},{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"paymasterAndData\",\"type\":\"bytes\"}],\"name\":\"_validateSenderAndPaymaster\",\"outputs\":[],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint32\",\"name\":\"unstakeDelaySec\",\"type\":\"uint32\"}],\"name\":\"addStake\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"balanceOf\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"target\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"delegateAndRevert\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"depositTo\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"deposits\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"deposit\",\"type\":\"uint256\"},{\"internalType\":\"bool\",\"name\":\"staked\",\"type\":\"bool\"},{\"internalType\":\"uint112\",\"name\":\"stake\",\"type\":\"uint112\"},{\"internalType\":\"uint32\",\"name\":\"unstakeDelaySec\",\"type\":\"uint32\"},{\"internalType\":\"uint48\",\"name\":\"withdrawTime\",\"type\":\"uint48\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"getDepositInfo\",\"outputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"deposit\",\"type\":\"uint256\"},{\"internalType\":\"bool\",\"name\":\"staked\",\"type\":\"bool\"},{\"internalType\":\"uint112\",\"name\":\"stake\",\"type\":\"uint112\"},{\"internalType\":\"uint32\",\"name\":\"unstakeDelaySec\",\"type\":\"uint32\"},{\"internalType\":\"uint48\",\"name\":\"withdrawTime\",\"type\":\"uint48\"}],\"internalType\":\"structIStakeManager.DepositInfo\",\"name\":\"info\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"internalType\":\"uint192\",\"name\":\"key\",\"type\":\"uint192\"}],\"name\":\"getNonce\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"nonce\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"initCode\",\"type\":\"bytes\"}],\"name\":\"getSenderAddress\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"nonce\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"initCode\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"callData\",\"type\":\"bytes\"},{\"internalType\":\"bytes32\",\"name\":\"accountGasLimits\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"preVerificationGas\",\"type\":\"uint256\"},{\"internalType\":\"bytes32\",\"name\":\"gasFees\",\"type\":\"bytes32\"},{\"internalType\":\"bytes\",\"name\":\"paymasterAndData\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"signature\",\"type\":\"bytes\"}],\"internalType\":\"structPackedUserOperation\",\"name\":\"userOp\",\"type\":\"tuple\"}],\"name\":\"getUserOpHash\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"nonce\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"initCode\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"callData\",\"type\":\"bytes\"},{\"internalType\":\"bytes32\",\"name\":\"accountGasLimits\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"preVerificationGas\",\"type\":\"uint256\"},{\"internalType\":\"bytes32\",\"name\":\"gasFees\",\"type\":\"bytes32\"},{\"internalType\":\"bytes\",\"name\":\"paymasterAndData\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"signature\",\"type\":\"bytes\"}],\"internalType\":\"structPackedUserOperation[]\",\"name\":\"userOps\",\"type\":\"tuple[]\"},{\"internalType\":\"contractIAggregator\",\"name\":\"aggregator\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"signature\",\"type\":\"bytes\"}],\"internalType\":\"structIEntryPoint.UserOpsPerAggregator[]\",\"name\":\"opsPerAggregator\",\"type\":\"tuple[]\"},{\"internalType\":\"addresspayable\",\"name\":\"beneficiary\",\"type\":\"address\"}],\"name\":\"handleAggregatedOps\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"nonce\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"initCode\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"callData\",\"type\":\"bytes\"},{\"internalType\":\"bytes32\",\"name\":\"accountGasLimits\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"preVerificationGas\",\"type\":\"uint256\"},{\"internalType\":\"bytes32\",\"name\":\"gasFees\",\"type\":\"bytes32\"},{\"internalType\":\"bytes\",\"name\":\"paymasterAndData\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"signature\",\"type\":\"bytes\"}],\"internalType\":\"structPackedUserOperation[]\",\"name\":\"ops\",\"type\":\"tuple[]\"},{\"internalType\":\"addresspayable\",\"name\":\"beneficiary\",\"type\":\"address\"}],\"name\":\"handleOps\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint192\",\"name\":\"key\",\"type\":\"uint192\"}],\"name\":\"incrementNonce\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"callData\",\"type\":\"bytes\"},{\"components\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"nonce\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"verificationGasLimit\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"callGasLimit\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"paymasterVerificationGasLimit\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"paymasterPostOpGasLimit\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"preVerificationGas\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"paymaster\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"maxFeePerGas\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"maxPriorityFeePerGas\",\"type\":\"uint256\"}],\"internalType\":\"structEntryPoint.MemoryUserOp\",\"name\":\"mUserOp\",\"type\":\"tuple\"},{\"internalType\":\"bytes32\",\"name\":\"userOpHash\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"prefund\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"contextOffset\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"preOpGas\",\"type\":\"uint256\"}],\"internalType\":\"structEntryPoint.UserOpInfo\",\"name\":\"opInfo\",\"type\":\"tuple\"},{\"internalType\":\"bytes\",\"name\":\"context\",\"type\":\"bytes\"}],\"name\":\"innerHandleOp\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"actualGasCost\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"uint192\",\"name\":\"\",\"type\":\"uint192\"}],\"name\":\"nonceSequenceNumber\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"nonce\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"initCode\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"callData\",\"type\":\"bytes\"},{\"internalType\":\"bytes32\",\"name\":\"accountGasLimits\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"preVerificationGas\",\"type\":\"uint256\"},{\"internalType\":\"bytes32\",\"name\":\"gasFees\",\"type\":\"bytes32\"},{\"internalType\":\"bytes\",\"name\":\"paymasterAndData\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"signature\",\"type\":\"bytes\"}],\"internalType\":\"structPackedUserOperation\",\"name\":\"op\",\"type\":\"tuple\"},{\"internalType\":\"address\",\"name\":\"target\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"targetCallData\",\"type\":\"bytes\"}],\"name\":\"simulateHandleOp\",\"outputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"preOpGas\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"paid\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"accountValidationData\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"paymasterValidationData\",\"type\":\"uint256\"},{\"internalType\":\"bool\",\"name\":\"targetSuccess\",\"type\":\"bool\"},{\"internalType\":\"bytes\",\"name\":\"targetResult\",\"type\":\"bytes\"}],\"internalType\":\"structIEntryPointSimulations.ExecutionResult\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"nonce\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"initCode\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"callData\",\"type\":\"bytes\"},{\"internalType\":\"bytes32\",\"name\":\"accountGasLimits\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"preVerificationGas\",\"type\":\"uint256\"},{\"internalType\":\"bytes32\",\"name\":\"gasFees\",\"type\":\"bytes32\"},{\"internalType\":\"bytes\",\"name\":\"paymasterAndData\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"signature\",\"type\":\"bytes\"}],\"internalType\":\"structPackedUserOperation\",\"name\":\"userOp\",\"type\":\"tuple\"}],\"name\":\"simulateValidation\",\"outputs\":[{\"components\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"preOpGas\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"prefund\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"accountValidationData\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"paymasterValidationData\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"paymasterContext\",\"type\":\"bytes\"}],\"internalType\":\"structIEntryPoint.ReturnInfo\",\"name\":\"returnInfo\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"stake\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"unstakeDelaySec\",\"type\":\"uint256\"}],\"internalType\":\"structIStakeManager.StakeInfo\",\"name\":\"senderInfo\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"stake\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"unstakeDelaySec\",\"type\":\"uint256\"}],\"internalType\":\"structIStakeManager.StakeInfo\",\"name\":\"factoryInfo\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"stake\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"unstakeDelaySec\",\"type\":\"uint256\"}],\"internalType\":\"structIStakeManager.StakeInfo\",\"name\":\"paymasterInfo\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"aggregator\",\"type\":\"address\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"stake\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"unstakeDelaySec\",\"type\":\"uint256\"}],\"internalType\":\"structIStakeManager.StakeInfo\",\"name\":\"stakeInfo\",\"type\":\"tuple\"}],\"internalType\":\"structIEntryPoint.AggregatorStakeInfo\",\"name\":\"aggregatorInfo\",\"type\":\"tuple\"}],\"internalType\":\"structIEntryPointSimulations.ValidationResult\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"interfaceId\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"unlockStake\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"addresspayable\",\"name\":\"withdrawAddress\",\"type\":\"address\"}],\"name\":\"withdrawStake\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"addresspayable\",\"name\":\"withdrawAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"withdrawAmount\",\"type\":\"uint256\"}],\"name\":\"withdrawTo\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}]", +} + +// ContractABI is the input ABI used to generate the binding from. +// Deprecated: Use ContractMetaData.ABI instead. +var ContractABI = ContractMetaData.ABI + +// Contract is an auto generated Go binding around an Ethereum contract. +type Contract struct { + ContractCaller // Read-only binding to the contract + ContractTransactor // Write-only binding to the contract + ContractFilterer // Log filterer for contract events +} + +// ContractCaller is an auto generated read-only Go binding around an Ethereum contract. +type ContractCaller struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// ContractTransactor is an auto generated write-only Go binding around an Ethereum contract. +type ContractTransactor struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// ContractFilterer is an auto generated log filtering Go binding around an Ethereum contract events. +type ContractFilterer struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// ContractSession is an auto generated Go binding around an Ethereum contract, +// with pre-set call and transact options. +type ContractSession struct { + Contract *Contract // Generic contract binding to set the session for + CallOpts bind.CallOpts // Call options to use throughout this session + TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session +} + +// ContractCallerSession is an auto generated read-only Go binding around an Ethereum contract, +// with pre-set call options. +type ContractCallerSession struct { + Contract *ContractCaller // Generic contract caller binding to set the session for + CallOpts bind.CallOpts // Call options to use throughout this session +} + +// ContractTransactorSession is an auto generated write-only Go binding around an Ethereum contract, +// with pre-set transact options. +type ContractTransactorSession struct { + Contract *ContractTransactor // Generic contract transactor binding to set the session for + TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session +} + +// ContractRaw is an auto generated low-level Go binding around an Ethereum contract. +type ContractRaw struct { + Contract *Contract // Generic contract binding to access the raw methods on +} + +// ContractCallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract. +type ContractCallerRaw struct { + Contract *ContractCaller // Generic read-only contract binding to access the raw methods on +} + +// ContractTransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract. +type ContractTransactorRaw struct { + Contract *ContractTransactor // Generic write-only contract binding to access the raw methods on +} + +// NewContract creates a new instance of Contract, bound to a specific deployed contract. +func NewContract(address common.Address, backend bind.ContractBackend) (*Contract, error) { + contract, err := bindContract(address, backend, backend, backend) + if err != nil { + return nil, err + } + return &Contract{ContractCaller: ContractCaller{contract: contract}, ContractTransactor: ContractTransactor{contract: contract}, ContractFilterer: ContractFilterer{contract: contract}}, nil +} + +// NewContractCaller creates a new read-only instance of Contract, bound to a specific deployed contract. +func NewContractCaller(address common.Address, caller bind.ContractCaller) (*ContractCaller, error) { + contract, err := bindContract(address, caller, nil, nil) + if err != nil { + return nil, err + } + return &ContractCaller{contract: contract}, nil +} + +// NewContractTransactor creates a new write-only instance of Contract, bound to a specific deployed contract. +func NewContractTransactor(address common.Address, transactor bind.ContractTransactor) (*ContractTransactor, error) { + contract, err := bindContract(address, nil, transactor, nil) + if err != nil { + return nil, err + } + return &ContractTransactor{contract: contract}, nil +} + +// NewContractFilterer creates a new log filterer instance of Contract, bound to a specific deployed contract. +func NewContractFilterer(address common.Address, filterer bind.ContractFilterer) (*ContractFilterer, error) { + contract, err := bindContract(address, nil, nil, filterer) + if err != nil { + return nil, err + } + return &ContractFilterer{contract: contract}, nil +} + +// bindContract binds a generic wrapper to an already deployed contract. +func bindContract(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) { + parsed, err := ContractMetaData.GetAbi() + if err != nil { + return nil, err + } + return bind.NewBoundContract(address, *parsed, caller, transactor, filterer), nil +} + +// Call invokes the (constant) contract method with params as input values and +// sets the output to result. The result type might be a single field for simple +// returns, a slice of interfaces for anonymous returns and a struct for named +// returns. +func (_Contract *ContractRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { + return _Contract.Contract.ContractCaller.contract.Call(opts, result, method, params...) +} + +// Transfer initiates a plain transaction to move funds to the contract, calling +// its default method if one is available. +func (_Contract *ContractRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _Contract.Contract.ContractTransactor.contract.Transfer(opts) +} + +// Transact invokes the (paid) contract method with params as input values. +func (_Contract *ContractRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _Contract.Contract.ContractTransactor.contract.Transact(opts, method, params...) +} + +// Call invokes the (constant) contract method with params as input values and +// sets the output to result. The result type might be a single field for simple +// returns, a slice of interfaces for anonymous returns and a struct for named +// returns. +func (_Contract *ContractCallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { + return _Contract.Contract.contract.Call(opts, result, method, params...) +} + +// Transfer initiates a plain transaction to move funds to the contract, calling +// its default method if one is available. +func (_Contract *ContractTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _Contract.Contract.contract.Transfer(opts) +} + +// Transact invokes the (paid) contract method with params as input values. +func (_Contract *ContractTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _Contract.Contract.contract.Transact(opts, method, params...) +} + +// ValidateSenderAndPaymaster is a free data retrieval call binding the contract method 0x957122ab. +// +// Solidity: function _validateSenderAndPaymaster(bytes initCode, address sender, bytes paymasterAndData) view returns() +func (_Contract *ContractCaller) ValidateSenderAndPaymaster(opts *bind.CallOpts, initCode []byte, sender common.Address, paymasterAndData []byte) error { + var out []interface{} + err := _Contract.contract.Call(opts, &out, "_validateSenderAndPaymaster", initCode, sender, paymasterAndData) + + if err != nil { + return err + } + + return err + +} + +// ValidateSenderAndPaymaster is a free data retrieval call binding the contract method 0x957122ab. +// +// Solidity: function _validateSenderAndPaymaster(bytes initCode, address sender, bytes paymasterAndData) view returns() +func (_Contract *ContractSession) ValidateSenderAndPaymaster(initCode []byte, sender common.Address, paymasterAndData []byte) error { + return _Contract.Contract.ValidateSenderAndPaymaster(&_Contract.CallOpts, initCode, sender, paymasterAndData) +} + +// ValidateSenderAndPaymaster is a free data retrieval call binding the contract method 0x957122ab. +// +// Solidity: function _validateSenderAndPaymaster(bytes initCode, address sender, bytes paymasterAndData) view returns() +func (_Contract *ContractCallerSession) ValidateSenderAndPaymaster(initCode []byte, sender common.Address, paymasterAndData []byte) error { + return _Contract.Contract.ValidateSenderAndPaymaster(&_Contract.CallOpts, initCode, sender, paymasterAndData) +} + +// BalanceOf is a free data retrieval call binding the contract method 0x70a08231. +// +// Solidity: function balanceOf(address account) view returns(uint256) +func (_Contract *ContractCaller) BalanceOf(opts *bind.CallOpts, account common.Address) (*big.Int, error) { + var out []interface{} + err := _Contract.contract.Call(opts, &out, "balanceOf", account) + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// BalanceOf is a free data retrieval call binding the contract method 0x70a08231. +// +// Solidity: function balanceOf(address account) view returns(uint256) +func (_Contract *ContractSession) BalanceOf(account common.Address) (*big.Int, error) { + return _Contract.Contract.BalanceOf(&_Contract.CallOpts, account) +} + +// BalanceOf is a free data retrieval call binding the contract method 0x70a08231. +// +// Solidity: function balanceOf(address account) view returns(uint256) +func (_Contract *ContractCallerSession) BalanceOf(account common.Address) (*big.Int, error) { + return _Contract.Contract.BalanceOf(&_Contract.CallOpts, account) +} + +// Deposits is a free data retrieval call binding the contract method 0xfc7e286d. +// +// Solidity: function deposits(address ) view returns(uint256 deposit, bool staked, uint112 stake, uint32 unstakeDelaySec, uint48 withdrawTime) +func (_Contract *ContractCaller) Deposits(opts *bind.CallOpts, arg0 common.Address) (struct { + Deposit *big.Int + Staked bool + Stake *big.Int + UnstakeDelaySec uint32 + WithdrawTime *big.Int +}, error) { + var out []interface{} + err := _Contract.contract.Call(opts, &out, "deposits", arg0) + + outstruct := new(struct { + Deposit *big.Int + Staked bool + Stake *big.Int + UnstakeDelaySec uint32 + WithdrawTime *big.Int + }) + if err != nil { + return *outstruct, err + } + + outstruct.Deposit = *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + outstruct.Staked = *abi.ConvertType(out[1], new(bool)).(*bool) + outstruct.Stake = *abi.ConvertType(out[2], new(*big.Int)).(**big.Int) + outstruct.UnstakeDelaySec = *abi.ConvertType(out[3], new(uint32)).(*uint32) + outstruct.WithdrawTime = *abi.ConvertType(out[4], new(*big.Int)).(**big.Int) + + return *outstruct, err + +} + +// Deposits is a free data retrieval call binding the contract method 0xfc7e286d. +// +// Solidity: function deposits(address ) view returns(uint256 deposit, bool staked, uint112 stake, uint32 unstakeDelaySec, uint48 withdrawTime) +func (_Contract *ContractSession) Deposits(arg0 common.Address) (struct { + Deposit *big.Int + Staked bool + Stake *big.Int + UnstakeDelaySec uint32 + WithdrawTime *big.Int +}, error) { + return _Contract.Contract.Deposits(&_Contract.CallOpts, arg0) +} + +// Deposits is a free data retrieval call binding the contract method 0xfc7e286d. +// +// Solidity: function deposits(address ) view returns(uint256 deposit, bool staked, uint112 stake, uint32 unstakeDelaySec, uint48 withdrawTime) +func (_Contract *ContractCallerSession) Deposits(arg0 common.Address) (struct { + Deposit *big.Int + Staked bool + Stake *big.Int + UnstakeDelaySec uint32 + WithdrawTime *big.Int +}, error) { + return _Contract.Contract.Deposits(&_Contract.CallOpts, arg0) +} + +// GetDepositInfo is a free data retrieval call binding the contract method 0x5287ce12. +// +// Solidity: function getDepositInfo(address account) view returns((uint256,bool,uint112,uint32,uint48) info) +func (_Contract *ContractCaller) GetDepositInfo(opts *bind.CallOpts, account common.Address) (IStakeManagerDepositInfo, error) { + var out []interface{} + err := _Contract.contract.Call(opts, &out, "getDepositInfo", account) + + if err != nil { + return *new(IStakeManagerDepositInfo), err + } + + out0 := *abi.ConvertType(out[0], new(IStakeManagerDepositInfo)).(*IStakeManagerDepositInfo) + + return out0, err + +} + +// GetDepositInfo is a free data retrieval call binding the contract method 0x5287ce12. +// +// Solidity: function getDepositInfo(address account) view returns((uint256,bool,uint112,uint32,uint48) info) +func (_Contract *ContractSession) GetDepositInfo(account common.Address) (IStakeManagerDepositInfo, error) { + return _Contract.Contract.GetDepositInfo(&_Contract.CallOpts, account) +} + +// GetDepositInfo is a free data retrieval call binding the contract method 0x5287ce12. +// +// Solidity: function getDepositInfo(address account) view returns((uint256,bool,uint112,uint32,uint48) info) +func (_Contract *ContractCallerSession) GetDepositInfo(account common.Address) (IStakeManagerDepositInfo, error) { + return _Contract.Contract.GetDepositInfo(&_Contract.CallOpts, account) +} + +// GetNonce is a free data retrieval call binding the contract method 0x35567e1a. +// +// Solidity: function getNonce(address sender, uint192 key) view returns(uint256 nonce) +func (_Contract *ContractCaller) GetNonce(opts *bind.CallOpts, sender common.Address, key *big.Int) (*big.Int, error) { + var out []interface{} + err := _Contract.contract.Call(opts, &out, "getNonce", sender, key) + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// GetNonce is a free data retrieval call binding the contract method 0x35567e1a. +// +// Solidity: function getNonce(address sender, uint192 key) view returns(uint256 nonce) +func (_Contract *ContractSession) GetNonce(sender common.Address, key *big.Int) (*big.Int, error) { + return _Contract.Contract.GetNonce(&_Contract.CallOpts, sender, key) +} + +// GetNonce is a free data retrieval call binding the contract method 0x35567e1a. +// +// Solidity: function getNonce(address sender, uint192 key) view returns(uint256 nonce) +func (_Contract *ContractCallerSession) GetNonce(sender common.Address, key *big.Int) (*big.Int, error) { + return _Contract.Contract.GetNonce(&_Contract.CallOpts, sender, key) +} + +// GetUserOpHash is a free data retrieval call binding the contract method 0x22cdde4c. +// +// Solidity: function getUserOpHash((address,uint256,bytes,bytes,bytes32,uint256,bytes32,bytes,bytes) userOp) view returns(bytes32) +func (_Contract *ContractCaller) GetUserOpHash(opts *bind.CallOpts, userOp PackedUserOperation) ([32]byte, error) { + var out []interface{} + err := _Contract.contract.Call(opts, &out, "getUserOpHash", userOp) + + if err != nil { + return *new([32]byte), err + } + + out0 := *abi.ConvertType(out[0], new([32]byte)).(*[32]byte) + + return out0, err + +} + +// GetUserOpHash is a free data retrieval call binding the contract method 0x22cdde4c. +// +// Solidity: function getUserOpHash((address,uint256,bytes,bytes,bytes32,uint256,bytes32,bytes,bytes) userOp) view returns(bytes32) +func (_Contract *ContractSession) GetUserOpHash(userOp PackedUserOperation) ([32]byte, error) { + return _Contract.Contract.GetUserOpHash(&_Contract.CallOpts, userOp) +} + +// GetUserOpHash is a free data retrieval call binding the contract method 0x22cdde4c. +// +// Solidity: function getUserOpHash((address,uint256,bytes,bytes,bytes32,uint256,bytes32,bytes,bytes) userOp) view returns(bytes32) +func (_Contract *ContractCallerSession) GetUserOpHash(userOp PackedUserOperation) ([32]byte, error) { + return _Contract.Contract.GetUserOpHash(&_Contract.CallOpts, userOp) +} + +// NonceSequenceNumber is a free data retrieval call binding the contract method 0x1b2e01b8. +// +// Solidity: function nonceSequenceNumber(address , uint192 ) view returns(uint256) +func (_Contract *ContractCaller) NonceSequenceNumber(opts *bind.CallOpts, arg0 common.Address, arg1 *big.Int) (*big.Int, error) { + var out []interface{} + err := _Contract.contract.Call(opts, &out, "nonceSequenceNumber", arg0, arg1) + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// NonceSequenceNumber is a free data retrieval call binding the contract method 0x1b2e01b8. +// +// Solidity: function nonceSequenceNumber(address , uint192 ) view returns(uint256) +func (_Contract *ContractSession) NonceSequenceNumber(arg0 common.Address, arg1 *big.Int) (*big.Int, error) { + return _Contract.Contract.NonceSequenceNumber(&_Contract.CallOpts, arg0, arg1) +} + +// NonceSequenceNumber is a free data retrieval call binding the contract method 0x1b2e01b8. +// +// Solidity: function nonceSequenceNumber(address , uint192 ) view returns(uint256) +func (_Contract *ContractCallerSession) NonceSequenceNumber(arg0 common.Address, arg1 *big.Int) (*big.Int, error) { + return _Contract.Contract.NonceSequenceNumber(&_Contract.CallOpts, arg0, arg1) +} + +// SupportsInterface is a free data retrieval call binding the contract method 0x01ffc9a7. +// +// Solidity: function supportsInterface(bytes4 interfaceId) view returns(bool) +func (_Contract *ContractCaller) SupportsInterface(opts *bind.CallOpts, interfaceId [4]byte) (bool, error) { + var out []interface{} + err := _Contract.contract.Call(opts, &out, "supportsInterface", interfaceId) + + if err != nil { + return *new(bool), err + } + + out0 := *abi.ConvertType(out[0], new(bool)).(*bool) + + return out0, err + +} + +// SupportsInterface is a free data retrieval call binding the contract method 0x01ffc9a7. +// +// Solidity: function supportsInterface(bytes4 interfaceId) view returns(bool) +func (_Contract *ContractSession) SupportsInterface(interfaceId [4]byte) (bool, error) { + return _Contract.Contract.SupportsInterface(&_Contract.CallOpts, interfaceId) +} + +// SupportsInterface is a free data retrieval call binding the contract method 0x01ffc9a7. +// +// Solidity: function supportsInterface(bytes4 interfaceId) view returns(bool) +func (_Contract *ContractCallerSession) SupportsInterface(interfaceId [4]byte) (bool, error) { + return _Contract.Contract.SupportsInterface(&_Contract.CallOpts, interfaceId) +} + +// AddStake is a paid mutator transaction binding the contract method 0x0396cb60. +// +// Solidity: function addStake(uint32 unstakeDelaySec) payable returns() +func (_Contract *ContractTransactor) AddStake(opts *bind.TransactOpts, unstakeDelaySec uint32) (*types.Transaction, error) { + return _Contract.contract.Transact(opts, "addStake", unstakeDelaySec) +} + +// AddStake is a paid mutator transaction binding the contract method 0x0396cb60. +// +// Solidity: function addStake(uint32 unstakeDelaySec) payable returns() +func (_Contract *ContractSession) AddStake(unstakeDelaySec uint32) (*types.Transaction, error) { + return _Contract.Contract.AddStake(&_Contract.TransactOpts, unstakeDelaySec) +} + +// AddStake is a paid mutator transaction binding the contract method 0x0396cb60. +// +// Solidity: function addStake(uint32 unstakeDelaySec) payable returns() +func (_Contract *ContractTransactorSession) AddStake(unstakeDelaySec uint32) (*types.Transaction, error) { + return _Contract.Contract.AddStake(&_Contract.TransactOpts, unstakeDelaySec) +} + +// DelegateAndRevert is a paid mutator transaction binding the contract method 0x850aaf62. +// +// Solidity: function delegateAndRevert(address target, bytes data) returns() +func (_Contract *ContractTransactor) DelegateAndRevert(opts *bind.TransactOpts, target common.Address, data []byte) (*types.Transaction, error) { + return _Contract.contract.Transact(opts, "delegateAndRevert", target, data) +} + +// DelegateAndRevert is a paid mutator transaction binding the contract method 0x850aaf62. +// +// Solidity: function delegateAndRevert(address target, bytes data) returns() +func (_Contract *ContractSession) DelegateAndRevert(target common.Address, data []byte) (*types.Transaction, error) { + return _Contract.Contract.DelegateAndRevert(&_Contract.TransactOpts, target, data) +} + +// DelegateAndRevert is a paid mutator transaction binding the contract method 0x850aaf62. +// +// Solidity: function delegateAndRevert(address target, bytes data) returns() +func (_Contract *ContractTransactorSession) DelegateAndRevert(target common.Address, data []byte) (*types.Transaction, error) { + return _Contract.Contract.DelegateAndRevert(&_Contract.TransactOpts, target, data) +} + +// DepositTo is a paid mutator transaction binding the contract method 0xb760faf9. +// +// Solidity: function depositTo(address account) payable returns() +func (_Contract *ContractTransactor) DepositTo(opts *bind.TransactOpts, account common.Address) (*types.Transaction, error) { + return _Contract.contract.Transact(opts, "depositTo", account) +} + +// DepositTo is a paid mutator transaction binding the contract method 0xb760faf9. +// +// Solidity: function depositTo(address account) payable returns() +func (_Contract *ContractSession) DepositTo(account common.Address) (*types.Transaction, error) { + return _Contract.Contract.DepositTo(&_Contract.TransactOpts, account) +} + +// DepositTo is a paid mutator transaction binding the contract method 0xb760faf9. +// +// Solidity: function depositTo(address account) payable returns() +func (_Contract *ContractTransactorSession) DepositTo(account common.Address) (*types.Transaction, error) { + return _Contract.Contract.DepositTo(&_Contract.TransactOpts, account) +} + +// GetSenderAddress is a paid mutator transaction binding the contract method 0x9b249f69. +// +// Solidity: function getSenderAddress(bytes initCode) returns() +func (_Contract *ContractTransactor) GetSenderAddress(opts *bind.TransactOpts, initCode []byte) (*types.Transaction, error) { + return _Contract.contract.Transact(opts, "getSenderAddress", initCode) +} + +// GetSenderAddress is a paid mutator transaction binding the contract method 0x9b249f69. +// +// Solidity: function getSenderAddress(bytes initCode) returns() +func (_Contract *ContractSession) GetSenderAddress(initCode []byte) (*types.Transaction, error) { + return _Contract.Contract.GetSenderAddress(&_Contract.TransactOpts, initCode) +} + +// GetSenderAddress is a paid mutator transaction binding the contract method 0x9b249f69. +// +// Solidity: function getSenderAddress(bytes initCode) returns() +func (_Contract *ContractTransactorSession) GetSenderAddress(initCode []byte) (*types.Transaction, error) { + return _Contract.Contract.GetSenderAddress(&_Contract.TransactOpts, initCode) +} + +// HandleAggregatedOps is a paid mutator transaction binding the contract method 0xdbed18e0. +// +// Solidity: function handleAggregatedOps(((address,uint256,bytes,bytes,bytes32,uint256,bytes32,bytes,bytes)[],address,bytes)[] opsPerAggregator, address beneficiary) returns() +func (_Contract *ContractTransactor) HandleAggregatedOps(opts *bind.TransactOpts, opsPerAggregator []IEntryPointUserOpsPerAggregator, beneficiary common.Address) (*types.Transaction, error) { + return _Contract.contract.Transact(opts, "handleAggregatedOps", opsPerAggregator, beneficiary) +} + +// HandleAggregatedOps is a paid mutator transaction binding the contract method 0xdbed18e0. +// +// Solidity: function handleAggregatedOps(((address,uint256,bytes,bytes,bytes32,uint256,bytes32,bytes,bytes)[],address,bytes)[] opsPerAggregator, address beneficiary) returns() +func (_Contract *ContractSession) HandleAggregatedOps(opsPerAggregator []IEntryPointUserOpsPerAggregator, beneficiary common.Address) (*types.Transaction, error) { + return _Contract.Contract.HandleAggregatedOps(&_Contract.TransactOpts, opsPerAggregator, beneficiary) +} + +// HandleAggregatedOps is a paid mutator transaction binding the contract method 0xdbed18e0. +// +// Solidity: function handleAggregatedOps(((address,uint256,bytes,bytes,bytes32,uint256,bytes32,bytes,bytes)[],address,bytes)[] opsPerAggregator, address beneficiary) returns() +func (_Contract *ContractTransactorSession) HandleAggregatedOps(opsPerAggregator []IEntryPointUserOpsPerAggregator, beneficiary common.Address) (*types.Transaction, error) { + return _Contract.Contract.HandleAggregatedOps(&_Contract.TransactOpts, opsPerAggregator, beneficiary) +} + +// HandleOps is a paid mutator transaction binding the contract method 0x765e827f. +// +// Solidity: function handleOps((address,uint256,bytes,bytes,bytes32,uint256,bytes32,bytes,bytes)[] ops, address beneficiary) returns() +func (_Contract *ContractTransactor) HandleOps(opts *bind.TransactOpts, ops []PackedUserOperation, beneficiary common.Address) (*types.Transaction, error) { + return _Contract.contract.Transact(opts, "handleOps", ops, beneficiary) +} + +// HandleOps is a paid mutator transaction binding the contract method 0x765e827f. +// +// Solidity: function handleOps((address,uint256,bytes,bytes,bytes32,uint256,bytes32,bytes,bytes)[] ops, address beneficiary) returns() +func (_Contract *ContractSession) HandleOps(ops []PackedUserOperation, beneficiary common.Address) (*types.Transaction, error) { + return _Contract.Contract.HandleOps(&_Contract.TransactOpts, ops, beneficiary) +} + +// HandleOps is a paid mutator transaction binding the contract method 0x765e827f. +// +// Solidity: function handleOps((address,uint256,bytes,bytes,bytes32,uint256,bytes32,bytes,bytes)[] ops, address beneficiary) returns() +func (_Contract *ContractTransactorSession) HandleOps(ops []PackedUserOperation, beneficiary common.Address) (*types.Transaction, error) { + return _Contract.Contract.HandleOps(&_Contract.TransactOpts, ops, beneficiary) +} + +// IncrementNonce is a paid mutator transaction binding the contract method 0x0bd28e3b. +// +// Solidity: function incrementNonce(uint192 key) returns() +func (_Contract *ContractTransactor) IncrementNonce(opts *bind.TransactOpts, key *big.Int) (*types.Transaction, error) { + return _Contract.contract.Transact(opts, "incrementNonce", key) +} + +// IncrementNonce is a paid mutator transaction binding the contract method 0x0bd28e3b. +// +// Solidity: function incrementNonce(uint192 key) returns() +func (_Contract *ContractSession) IncrementNonce(key *big.Int) (*types.Transaction, error) { + return _Contract.Contract.IncrementNonce(&_Contract.TransactOpts, key) +} + +// IncrementNonce is a paid mutator transaction binding the contract method 0x0bd28e3b. +// +// Solidity: function incrementNonce(uint192 key) returns() +func (_Contract *ContractTransactorSession) IncrementNonce(key *big.Int) (*types.Transaction, error) { + return _Contract.Contract.IncrementNonce(&_Contract.TransactOpts, key) +} + +// InnerHandleOp is a paid mutator transaction binding the contract method 0x0042dc53. +// +// Solidity: function innerHandleOp(bytes callData, ((address,uint256,uint256,uint256,uint256,uint256,uint256,address,uint256,uint256),bytes32,uint256,uint256,uint256) opInfo, bytes context) returns(uint256 actualGasCost) +func (_Contract *ContractTransactor) InnerHandleOp(opts *bind.TransactOpts, callData []byte, opInfo EntryPointUserOpInfo, context []byte) (*types.Transaction, error) { + return _Contract.contract.Transact(opts, "innerHandleOp", callData, opInfo, context) +} + +// InnerHandleOp is a paid mutator transaction binding the contract method 0x0042dc53. +// +// Solidity: function innerHandleOp(bytes callData, ((address,uint256,uint256,uint256,uint256,uint256,uint256,address,uint256,uint256),bytes32,uint256,uint256,uint256) opInfo, bytes context) returns(uint256 actualGasCost) +func (_Contract *ContractSession) InnerHandleOp(callData []byte, opInfo EntryPointUserOpInfo, context []byte) (*types.Transaction, error) { + return _Contract.Contract.InnerHandleOp(&_Contract.TransactOpts, callData, opInfo, context) +} + +// InnerHandleOp is a paid mutator transaction binding the contract method 0x0042dc53. +// +// Solidity: function innerHandleOp(bytes callData, ((address,uint256,uint256,uint256,uint256,uint256,uint256,address,uint256,uint256),bytes32,uint256,uint256,uint256) opInfo, bytes context) returns(uint256 actualGasCost) +func (_Contract *ContractTransactorSession) InnerHandleOp(callData []byte, opInfo EntryPointUserOpInfo, context []byte) (*types.Transaction, error) { + return _Contract.Contract.InnerHandleOp(&_Contract.TransactOpts, callData, opInfo, context) +} + +// SimulateHandleOp is a paid mutator transaction binding the contract method 0x97b2dcb9. +// +// Solidity: function simulateHandleOp((address,uint256,bytes,bytes,bytes32,uint256,bytes32,bytes,bytes) op, address target, bytes targetCallData) returns((uint256,uint256,uint256,uint256,bool,bytes)) +func (_Contract *ContractTransactor) SimulateHandleOp(opts *bind.TransactOpts, op PackedUserOperation, target common.Address, targetCallData []byte) (*types.Transaction, error) { + return _Contract.contract.Transact(opts, "simulateHandleOp", op, target, targetCallData) +} + +// SimulateHandleOp is a paid mutator transaction binding the contract method 0x97b2dcb9. +// +// Solidity: function simulateHandleOp((address,uint256,bytes,bytes,bytes32,uint256,bytes32,bytes,bytes) op, address target, bytes targetCallData) returns((uint256,uint256,uint256,uint256,bool,bytes)) +func (_Contract *ContractSession) SimulateHandleOp(op PackedUserOperation, target common.Address, targetCallData []byte) (*types.Transaction, error) { + return _Contract.Contract.SimulateHandleOp(&_Contract.TransactOpts, op, target, targetCallData) +} + +// SimulateHandleOp is a paid mutator transaction binding the contract method 0x97b2dcb9. +// +// Solidity: function simulateHandleOp((address,uint256,bytes,bytes,bytes32,uint256,bytes32,bytes,bytes) op, address target, bytes targetCallData) returns((uint256,uint256,uint256,uint256,bool,bytes)) +func (_Contract *ContractTransactorSession) SimulateHandleOp(op PackedUserOperation, target common.Address, targetCallData []byte) (*types.Transaction, error) { + return _Contract.Contract.SimulateHandleOp(&_Contract.TransactOpts, op, target, targetCallData) +} + +// SimulateValidation is a paid mutator transaction binding the contract method 0xc3bce009. +// +// Solidity: function simulateValidation((address,uint256,bytes,bytes,bytes32,uint256,bytes32,bytes,bytes) userOp) returns(((uint256,uint256,uint256,uint256,bytes),(uint256,uint256),(uint256,uint256),(uint256,uint256),(address,(uint256,uint256)))) +func (_Contract *ContractTransactor) SimulateValidation(opts *bind.TransactOpts, userOp PackedUserOperation) (*types.Transaction, error) { + return _Contract.contract.Transact(opts, "simulateValidation", userOp) +} + +// SimulateValidation is a paid mutator transaction binding the contract method 0xc3bce009. +// +// Solidity: function simulateValidation((address,uint256,bytes,bytes,bytes32,uint256,bytes32,bytes,bytes) userOp) returns(((uint256,uint256,uint256,uint256,bytes),(uint256,uint256),(uint256,uint256),(uint256,uint256),(address,(uint256,uint256)))) +func (_Contract *ContractSession) SimulateValidation(userOp PackedUserOperation) (*types.Transaction, error) { + return _Contract.Contract.SimulateValidation(&_Contract.TransactOpts, userOp) +} + +// SimulateValidation is a paid mutator transaction binding the contract method 0xc3bce009. +// +// Solidity: function simulateValidation((address,uint256,bytes,bytes,bytes32,uint256,bytes32,bytes,bytes) userOp) returns(((uint256,uint256,uint256,uint256,bytes),(uint256,uint256),(uint256,uint256),(uint256,uint256),(address,(uint256,uint256)))) +func (_Contract *ContractTransactorSession) SimulateValidation(userOp PackedUserOperation) (*types.Transaction, error) { + return _Contract.Contract.SimulateValidation(&_Contract.TransactOpts, userOp) +} + +// UnlockStake is a paid mutator transaction binding the contract method 0xbb9fe6bf. +// +// Solidity: function unlockStake() returns() +func (_Contract *ContractTransactor) UnlockStake(opts *bind.TransactOpts) (*types.Transaction, error) { + return _Contract.contract.Transact(opts, "unlockStake") +} + +// UnlockStake is a paid mutator transaction binding the contract method 0xbb9fe6bf. +// +// Solidity: function unlockStake() returns() +func (_Contract *ContractSession) UnlockStake() (*types.Transaction, error) { + return _Contract.Contract.UnlockStake(&_Contract.TransactOpts) +} + +// UnlockStake is a paid mutator transaction binding the contract method 0xbb9fe6bf. +// +// Solidity: function unlockStake() returns() +func (_Contract *ContractTransactorSession) UnlockStake() (*types.Transaction, error) { + return _Contract.Contract.UnlockStake(&_Contract.TransactOpts) +} + +// WithdrawStake is a paid mutator transaction binding the contract method 0xc23a5cea. +// +// Solidity: function withdrawStake(address withdrawAddress) returns() +func (_Contract *ContractTransactor) WithdrawStake(opts *bind.TransactOpts, withdrawAddress common.Address) (*types.Transaction, error) { + return _Contract.contract.Transact(opts, "withdrawStake", withdrawAddress) +} + +// WithdrawStake is a paid mutator transaction binding the contract method 0xc23a5cea. +// +// Solidity: function withdrawStake(address withdrawAddress) returns() +func (_Contract *ContractSession) WithdrawStake(withdrawAddress common.Address) (*types.Transaction, error) { + return _Contract.Contract.WithdrawStake(&_Contract.TransactOpts, withdrawAddress) +} + +// WithdrawStake is a paid mutator transaction binding the contract method 0xc23a5cea. +// +// Solidity: function withdrawStake(address withdrawAddress) returns() +func (_Contract *ContractTransactorSession) WithdrawStake(withdrawAddress common.Address) (*types.Transaction, error) { + return _Contract.Contract.WithdrawStake(&_Contract.TransactOpts, withdrawAddress) +} + +// WithdrawTo is a paid mutator transaction binding the contract method 0x205c2878. +// +// Solidity: function withdrawTo(address withdrawAddress, uint256 withdrawAmount) returns() +func (_Contract *ContractTransactor) WithdrawTo(opts *bind.TransactOpts, withdrawAddress common.Address, withdrawAmount *big.Int) (*types.Transaction, error) { + return _Contract.contract.Transact(opts, "withdrawTo", withdrawAddress, withdrawAmount) +} + +// WithdrawTo is a paid mutator transaction binding the contract method 0x205c2878. +// +// Solidity: function withdrawTo(address withdrawAddress, uint256 withdrawAmount) returns() +func (_Contract *ContractSession) WithdrawTo(withdrawAddress common.Address, withdrawAmount *big.Int) (*types.Transaction, error) { + return _Contract.Contract.WithdrawTo(&_Contract.TransactOpts, withdrawAddress, withdrawAmount) +} + +// WithdrawTo is a paid mutator transaction binding the contract method 0x205c2878. +// +// Solidity: function withdrawTo(address withdrawAddress, uint256 withdrawAmount) returns() +func (_Contract *ContractTransactorSession) WithdrawTo(withdrawAddress common.Address, withdrawAmount *big.Int) (*types.Transaction, error) { + return _Contract.Contract.WithdrawTo(&_Contract.TransactOpts, withdrawAddress, withdrawAmount) +} + +// Receive is a paid mutator transaction binding the contract receive function. +// +// Solidity: receive() payable returns() +func (_Contract *ContractTransactor) Receive(opts *bind.TransactOpts) (*types.Transaction, error) { + return _Contract.contract.RawTransact(opts, nil) // calldata is disallowed for receive function +} + +// Receive is a paid mutator transaction binding the contract receive function. +// +// Solidity: receive() payable returns() +func (_Contract *ContractSession) Receive() (*types.Transaction, error) { + return _Contract.Contract.Receive(&_Contract.TransactOpts) +} + +// Receive is a paid mutator transaction binding the contract receive function. +// +// Solidity: receive() payable returns() +func (_Contract *ContractTransactorSession) Receive() (*types.Transaction, error) { + return _Contract.Contract.Receive(&_Contract.TransactOpts) +} + +// ContractAccountDeployedIterator is returned from FilterAccountDeployed and is used to iterate over the raw logs and unpacked data for AccountDeployed events raised by the Contract contract. +type ContractAccountDeployedIterator struct { + Event *ContractAccountDeployed // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *ContractAccountDeployedIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(ContractAccountDeployed) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(ContractAccountDeployed) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *ContractAccountDeployedIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *ContractAccountDeployedIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// ContractAccountDeployed represents a AccountDeployed event raised by the Contract contract. +type ContractAccountDeployed struct { + UserOpHash [32]byte + Sender common.Address + Factory common.Address + Paymaster common.Address + Raw types.Log // Blockchain specific contextual infos +} + +// FilterAccountDeployed is a free log retrieval operation binding the contract event 0xd51a9c61267aa6196961883ecf5ff2da6619c37dac0fa92122513fb32c032d2d. +// +// Solidity: event AccountDeployed(bytes32 indexed userOpHash, address indexed sender, address factory, address paymaster) +func (_Contract *ContractFilterer) FilterAccountDeployed(opts *bind.FilterOpts, userOpHash [][32]byte, sender []common.Address) (*ContractAccountDeployedIterator, error) { + + var userOpHashRule []interface{} + for _, userOpHashItem := range userOpHash { + userOpHashRule = append(userOpHashRule, userOpHashItem) + } + var senderRule []interface{} + for _, senderItem := range sender { + senderRule = append(senderRule, senderItem) + } + + logs, sub, err := _Contract.contract.FilterLogs(opts, "AccountDeployed", userOpHashRule, senderRule) + if err != nil { + return nil, err + } + return &ContractAccountDeployedIterator{contract: _Contract.contract, event: "AccountDeployed", logs: logs, sub: sub}, nil +} + +// WatchAccountDeployed is a free log subscription operation binding the contract event 0xd51a9c61267aa6196961883ecf5ff2da6619c37dac0fa92122513fb32c032d2d. +// +// Solidity: event AccountDeployed(bytes32 indexed userOpHash, address indexed sender, address factory, address paymaster) +func (_Contract *ContractFilterer) WatchAccountDeployed(opts *bind.WatchOpts, sink chan<- *ContractAccountDeployed, userOpHash [][32]byte, sender []common.Address) (event.Subscription, error) { + + var userOpHashRule []interface{} + for _, userOpHashItem := range userOpHash { + userOpHashRule = append(userOpHashRule, userOpHashItem) + } + var senderRule []interface{} + for _, senderItem := range sender { + senderRule = append(senderRule, senderItem) + } + + logs, sub, err := _Contract.contract.WatchLogs(opts, "AccountDeployed", userOpHashRule, senderRule) + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(ContractAccountDeployed) + if err := _Contract.contract.UnpackLog(event, "AccountDeployed", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseAccountDeployed is a log parse operation binding the contract event 0xd51a9c61267aa6196961883ecf5ff2da6619c37dac0fa92122513fb32c032d2d. +// +// Solidity: event AccountDeployed(bytes32 indexed userOpHash, address indexed sender, address factory, address paymaster) +func (_Contract *ContractFilterer) ParseAccountDeployed(log types.Log) (*ContractAccountDeployed, error) { + event := new(ContractAccountDeployed) + if err := _Contract.contract.UnpackLog(event, "AccountDeployed", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// ContractBeforeExecutionIterator is returned from FilterBeforeExecution and is used to iterate over the raw logs and unpacked data for BeforeExecution events raised by the Contract contract. +type ContractBeforeExecutionIterator struct { + Event *ContractBeforeExecution // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *ContractBeforeExecutionIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(ContractBeforeExecution) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(ContractBeforeExecution) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *ContractBeforeExecutionIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *ContractBeforeExecutionIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// ContractBeforeExecution represents a BeforeExecution event raised by the Contract contract. +type ContractBeforeExecution struct { + Raw types.Log // Blockchain specific contextual infos +} + +// FilterBeforeExecution is a free log retrieval operation binding the contract event 0xbb47ee3e183a558b1a2ff0874b079f3fc5478b7454eacf2bfc5af2ff5878f972. +// +// Solidity: event BeforeExecution() +func (_Contract *ContractFilterer) FilterBeforeExecution(opts *bind.FilterOpts) (*ContractBeforeExecutionIterator, error) { + + logs, sub, err := _Contract.contract.FilterLogs(opts, "BeforeExecution") + if err != nil { + return nil, err + } + return &ContractBeforeExecutionIterator{contract: _Contract.contract, event: "BeforeExecution", logs: logs, sub: sub}, nil +} + +// WatchBeforeExecution is a free log subscription operation binding the contract event 0xbb47ee3e183a558b1a2ff0874b079f3fc5478b7454eacf2bfc5af2ff5878f972. +// +// Solidity: event BeforeExecution() +func (_Contract *ContractFilterer) WatchBeforeExecution(opts *bind.WatchOpts, sink chan<- *ContractBeforeExecution) (event.Subscription, error) { + + logs, sub, err := _Contract.contract.WatchLogs(opts, "BeforeExecution") + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(ContractBeforeExecution) + if err := _Contract.contract.UnpackLog(event, "BeforeExecution", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseBeforeExecution is a log parse operation binding the contract event 0xbb47ee3e183a558b1a2ff0874b079f3fc5478b7454eacf2bfc5af2ff5878f972. +// +// Solidity: event BeforeExecution() +func (_Contract *ContractFilterer) ParseBeforeExecution(log types.Log) (*ContractBeforeExecution, error) { + event := new(ContractBeforeExecution) + if err := _Contract.contract.UnpackLog(event, "BeforeExecution", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// ContractDepositedIterator is returned from FilterDeposited and is used to iterate over the raw logs and unpacked data for Deposited events raised by the Contract contract. +type ContractDepositedIterator struct { + Event *ContractDeposited // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *ContractDepositedIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(ContractDeposited) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(ContractDeposited) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *ContractDepositedIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *ContractDepositedIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// ContractDeposited represents a Deposited event raised by the Contract contract. +type ContractDeposited struct { + Account common.Address + TotalDeposit *big.Int + Raw types.Log // Blockchain specific contextual infos +} + +// FilterDeposited is a free log retrieval operation binding the contract event 0x2da466a7b24304f47e87fa2e1e5a81b9831ce54fec19055ce277ca2f39ba42c4. +// +// Solidity: event Deposited(address indexed account, uint256 totalDeposit) +func (_Contract *ContractFilterer) FilterDeposited(opts *bind.FilterOpts, account []common.Address) (*ContractDepositedIterator, error) { + + var accountRule []interface{} + for _, accountItem := range account { + accountRule = append(accountRule, accountItem) + } + + logs, sub, err := _Contract.contract.FilterLogs(opts, "Deposited", accountRule) + if err != nil { + return nil, err + } + return &ContractDepositedIterator{contract: _Contract.contract, event: "Deposited", logs: logs, sub: sub}, nil +} + +// WatchDeposited is a free log subscription operation binding the contract event 0x2da466a7b24304f47e87fa2e1e5a81b9831ce54fec19055ce277ca2f39ba42c4. +// +// Solidity: event Deposited(address indexed account, uint256 totalDeposit) +func (_Contract *ContractFilterer) WatchDeposited(opts *bind.WatchOpts, sink chan<- *ContractDeposited, account []common.Address) (event.Subscription, error) { + + var accountRule []interface{} + for _, accountItem := range account { + accountRule = append(accountRule, accountItem) + } + + logs, sub, err := _Contract.contract.WatchLogs(opts, "Deposited", accountRule) + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(ContractDeposited) + if err := _Contract.contract.UnpackLog(event, "Deposited", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseDeposited is a log parse operation binding the contract event 0x2da466a7b24304f47e87fa2e1e5a81b9831ce54fec19055ce277ca2f39ba42c4. +// +// Solidity: event Deposited(address indexed account, uint256 totalDeposit) +func (_Contract *ContractFilterer) ParseDeposited(log types.Log) (*ContractDeposited, error) { + event := new(ContractDeposited) + if err := _Contract.contract.UnpackLog(event, "Deposited", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// ContractPostOpRevertReasonIterator is returned from FilterPostOpRevertReason and is used to iterate over the raw logs and unpacked data for PostOpRevertReason events raised by the Contract contract. +type ContractPostOpRevertReasonIterator struct { + Event *ContractPostOpRevertReason // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *ContractPostOpRevertReasonIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(ContractPostOpRevertReason) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(ContractPostOpRevertReason) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *ContractPostOpRevertReasonIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *ContractPostOpRevertReasonIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// ContractPostOpRevertReason represents a PostOpRevertReason event raised by the Contract contract. +type ContractPostOpRevertReason struct { + UserOpHash [32]byte + Sender common.Address + Nonce *big.Int + RevertReason []byte + Raw types.Log // Blockchain specific contextual infos +} + +// FilterPostOpRevertReason is a free log retrieval operation binding the contract event 0xf62676f440ff169a3a9afdbf812e89e7f95975ee8e5c31214ffdef631c5f4792. +// +// Solidity: event PostOpRevertReason(bytes32 indexed userOpHash, address indexed sender, uint256 nonce, bytes revertReason) +func (_Contract *ContractFilterer) FilterPostOpRevertReason(opts *bind.FilterOpts, userOpHash [][32]byte, sender []common.Address) (*ContractPostOpRevertReasonIterator, error) { + + var userOpHashRule []interface{} + for _, userOpHashItem := range userOpHash { + userOpHashRule = append(userOpHashRule, userOpHashItem) + } + var senderRule []interface{} + for _, senderItem := range sender { + senderRule = append(senderRule, senderItem) + } + + logs, sub, err := _Contract.contract.FilterLogs(opts, "PostOpRevertReason", userOpHashRule, senderRule) + if err != nil { + return nil, err + } + return &ContractPostOpRevertReasonIterator{contract: _Contract.contract, event: "PostOpRevertReason", logs: logs, sub: sub}, nil +} + +// WatchPostOpRevertReason is a free log subscription operation binding the contract event 0xf62676f440ff169a3a9afdbf812e89e7f95975ee8e5c31214ffdef631c5f4792. +// +// Solidity: event PostOpRevertReason(bytes32 indexed userOpHash, address indexed sender, uint256 nonce, bytes revertReason) +func (_Contract *ContractFilterer) WatchPostOpRevertReason(opts *bind.WatchOpts, sink chan<- *ContractPostOpRevertReason, userOpHash [][32]byte, sender []common.Address) (event.Subscription, error) { + + var userOpHashRule []interface{} + for _, userOpHashItem := range userOpHash { + userOpHashRule = append(userOpHashRule, userOpHashItem) + } + var senderRule []interface{} + for _, senderItem := range sender { + senderRule = append(senderRule, senderItem) + } + + logs, sub, err := _Contract.contract.WatchLogs(opts, "PostOpRevertReason", userOpHashRule, senderRule) + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(ContractPostOpRevertReason) + if err := _Contract.contract.UnpackLog(event, "PostOpRevertReason", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParsePostOpRevertReason is a log parse operation binding the contract event 0xf62676f440ff169a3a9afdbf812e89e7f95975ee8e5c31214ffdef631c5f4792. +// +// Solidity: event PostOpRevertReason(bytes32 indexed userOpHash, address indexed sender, uint256 nonce, bytes revertReason) +func (_Contract *ContractFilterer) ParsePostOpRevertReason(log types.Log) (*ContractPostOpRevertReason, error) { + event := new(ContractPostOpRevertReason) + if err := _Contract.contract.UnpackLog(event, "PostOpRevertReason", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// ContractSignatureAggregatorChangedIterator is returned from FilterSignatureAggregatorChanged and is used to iterate over the raw logs and unpacked data for SignatureAggregatorChanged events raised by the Contract contract. +type ContractSignatureAggregatorChangedIterator struct { + Event *ContractSignatureAggregatorChanged // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *ContractSignatureAggregatorChangedIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(ContractSignatureAggregatorChanged) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(ContractSignatureAggregatorChanged) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *ContractSignatureAggregatorChangedIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *ContractSignatureAggregatorChangedIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// ContractSignatureAggregatorChanged represents a SignatureAggregatorChanged event raised by the Contract contract. +type ContractSignatureAggregatorChanged struct { + Aggregator common.Address + Raw types.Log // Blockchain specific contextual infos +} + +// FilterSignatureAggregatorChanged is a free log retrieval operation binding the contract event 0x575ff3acadd5ab348fe1855e217e0f3678f8d767d7494c9f9fefbee2e17cca4d. +// +// Solidity: event SignatureAggregatorChanged(address indexed aggregator) +func (_Contract *ContractFilterer) FilterSignatureAggregatorChanged(opts *bind.FilterOpts, aggregator []common.Address) (*ContractSignatureAggregatorChangedIterator, error) { + + var aggregatorRule []interface{} + for _, aggregatorItem := range aggregator { + aggregatorRule = append(aggregatorRule, aggregatorItem) + } + + logs, sub, err := _Contract.contract.FilterLogs(opts, "SignatureAggregatorChanged", aggregatorRule) + if err != nil { + return nil, err + } + return &ContractSignatureAggregatorChangedIterator{contract: _Contract.contract, event: "SignatureAggregatorChanged", logs: logs, sub: sub}, nil +} + +// WatchSignatureAggregatorChanged is a free log subscription operation binding the contract event 0x575ff3acadd5ab348fe1855e217e0f3678f8d767d7494c9f9fefbee2e17cca4d. +// +// Solidity: event SignatureAggregatorChanged(address indexed aggregator) +func (_Contract *ContractFilterer) WatchSignatureAggregatorChanged(opts *bind.WatchOpts, sink chan<- *ContractSignatureAggregatorChanged, aggregator []common.Address) (event.Subscription, error) { + + var aggregatorRule []interface{} + for _, aggregatorItem := range aggregator { + aggregatorRule = append(aggregatorRule, aggregatorItem) + } + + logs, sub, err := _Contract.contract.WatchLogs(opts, "SignatureAggregatorChanged", aggregatorRule) + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(ContractSignatureAggregatorChanged) + if err := _Contract.contract.UnpackLog(event, "SignatureAggregatorChanged", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseSignatureAggregatorChanged is a log parse operation binding the contract event 0x575ff3acadd5ab348fe1855e217e0f3678f8d767d7494c9f9fefbee2e17cca4d. +// +// Solidity: event SignatureAggregatorChanged(address indexed aggregator) +func (_Contract *ContractFilterer) ParseSignatureAggregatorChanged(log types.Log) (*ContractSignatureAggregatorChanged, error) { + event := new(ContractSignatureAggregatorChanged) + if err := _Contract.contract.UnpackLog(event, "SignatureAggregatorChanged", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// ContractStakeLockedIterator is returned from FilterStakeLocked and is used to iterate over the raw logs and unpacked data for StakeLocked events raised by the Contract contract. +type ContractStakeLockedIterator struct { + Event *ContractStakeLocked // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *ContractStakeLockedIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(ContractStakeLocked) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(ContractStakeLocked) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *ContractStakeLockedIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *ContractStakeLockedIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// ContractStakeLocked represents a StakeLocked event raised by the Contract contract. +type ContractStakeLocked struct { + Account common.Address + TotalStaked *big.Int + UnstakeDelaySec *big.Int + Raw types.Log // Blockchain specific contextual infos +} + +// FilterStakeLocked is a free log retrieval operation binding the contract event 0xa5ae833d0bb1dcd632d98a8b70973e8516812898e19bf27b70071ebc8dc52c01. +// +// Solidity: event StakeLocked(address indexed account, uint256 totalStaked, uint256 unstakeDelaySec) +func (_Contract *ContractFilterer) FilterStakeLocked(opts *bind.FilterOpts, account []common.Address) (*ContractStakeLockedIterator, error) { + + var accountRule []interface{} + for _, accountItem := range account { + accountRule = append(accountRule, accountItem) + } + + logs, sub, err := _Contract.contract.FilterLogs(opts, "StakeLocked", accountRule) + if err != nil { + return nil, err + } + return &ContractStakeLockedIterator{contract: _Contract.contract, event: "StakeLocked", logs: logs, sub: sub}, nil +} + +// WatchStakeLocked is a free log subscription operation binding the contract event 0xa5ae833d0bb1dcd632d98a8b70973e8516812898e19bf27b70071ebc8dc52c01. +// +// Solidity: event StakeLocked(address indexed account, uint256 totalStaked, uint256 unstakeDelaySec) +func (_Contract *ContractFilterer) WatchStakeLocked(opts *bind.WatchOpts, sink chan<- *ContractStakeLocked, account []common.Address) (event.Subscription, error) { + + var accountRule []interface{} + for _, accountItem := range account { + accountRule = append(accountRule, accountItem) + } + + logs, sub, err := _Contract.contract.WatchLogs(opts, "StakeLocked", accountRule) + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(ContractStakeLocked) + if err := _Contract.contract.UnpackLog(event, "StakeLocked", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseStakeLocked is a log parse operation binding the contract event 0xa5ae833d0bb1dcd632d98a8b70973e8516812898e19bf27b70071ebc8dc52c01. +// +// Solidity: event StakeLocked(address indexed account, uint256 totalStaked, uint256 unstakeDelaySec) +func (_Contract *ContractFilterer) ParseStakeLocked(log types.Log) (*ContractStakeLocked, error) { + event := new(ContractStakeLocked) + if err := _Contract.contract.UnpackLog(event, "StakeLocked", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// ContractStakeUnlockedIterator is returned from FilterStakeUnlocked and is used to iterate over the raw logs and unpacked data for StakeUnlocked events raised by the Contract contract. +type ContractStakeUnlockedIterator struct { + Event *ContractStakeUnlocked // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *ContractStakeUnlockedIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(ContractStakeUnlocked) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(ContractStakeUnlocked) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *ContractStakeUnlockedIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *ContractStakeUnlockedIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// ContractStakeUnlocked represents a StakeUnlocked event raised by the Contract contract. +type ContractStakeUnlocked struct { + Account common.Address + WithdrawTime *big.Int + Raw types.Log // Blockchain specific contextual infos +} + +// FilterStakeUnlocked is a free log retrieval operation binding the contract event 0xfa9b3c14cc825c412c9ed81b3ba365a5b459439403f18829e572ed53a4180f0a. +// +// Solidity: event StakeUnlocked(address indexed account, uint256 withdrawTime) +func (_Contract *ContractFilterer) FilterStakeUnlocked(opts *bind.FilterOpts, account []common.Address) (*ContractStakeUnlockedIterator, error) { + + var accountRule []interface{} + for _, accountItem := range account { + accountRule = append(accountRule, accountItem) + } + + logs, sub, err := _Contract.contract.FilterLogs(opts, "StakeUnlocked", accountRule) + if err != nil { + return nil, err + } + return &ContractStakeUnlockedIterator{contract: _Contract.contract, event: "StakeUnlocked", logs: logs, sub: sub}, nil +} + +// WatchStakeUnlocked is a free log subscription operation binding the contract event 0xfa9b3c14cc825c412c9ed81b3ba365a5b459439403f18829e572ed53a4180f0a. +// +// Solidity: event StakeUnlocked(address indexed account, uint256 withdrawTime) +func (_Contract *ContractFilterer) WatchStakeUnlocked(opts *bind.WatchOpts, sink chan<- *ContractStakeUnlocked, account []common.Address) (event.Subscription, error) { + + var accountRule []interface{} + for _, accountItem := range account { + accountRule = append(accountRule, accountItem) + } + + logs, sub, err := _Contract.contract.WatchLogs(opts, "StakeUnlocked", accountRule) + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(ContractStakeUnlocked) + if err := _Contract.contract.UnpackLog(event, "StakeUnlocked", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseStakeUnlocked is a log parse operation binding the contract event 0xfa9b3c14cc825c412c9ed81b3ba365a5b459439403f18829e572ed53a4180f0a. +// +// Solidity: event StakeUnlocked(address indexed account, uint256 withdrawTime) +func (_Contract *ContractFilterer) ParseStakeUnlocked(log types.Log) (*ContractStakeUnlocked, error) { + event := new(ContractStakeUnlocked) + if err := _Contract.contract.UnpackLog(event, "StakeUnlocked", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// ContractStakeWithdrawnIterator is returned from FilterStakeWithdrawn and is used to iterate over the raw logs and unpacked data for StakeWithdrawn events raised by the Contract contract. +type ContractStakeWithdrawnIterator struct { + Event *ContractStakeWithdrawn // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *ContractStakeWithdrawnIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(ContractStakeWithdrawn) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(ContractStakeWithdrawn) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *ContractStakeWithdrawnIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *ContractStakeWithdrawnIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// ContractStakeWithdrawn represents a StakeWithdrawn event raised by the Contract contract. +type ContractStakeWithdrawn struct { + Account common.Address + WithdrawAddress common.Address + Amount *big.Int + Raw types.Log // Blockchain specific contextual infos +} + +// FilterStakeWithdrawn is a free log retrieval operation binding the contract event 0xb7c918e0e249f999e965cafeb6c664271b3f4317d296461500e71da39f0cbda3. +// +// Solidity: event StakeWithdrawn(address indexed account, address withdrawAddress, uint256 amount) +func (_Contract *ContractFilterer) FilterStakeWithdrawn(opts *bind.FilterOpts, account []common.Address) (*ContractStakeWithdrawnIterator, error) { + + var accountRule []interface{} + for _, accountItem := range account { + accountRule = append(accountRule, accountItem) + } + + logs, sub, err := _Contract.contract.FilterLogs(opts, "StakeWithdrawn", accountRule) + if err != nil { + return nil, err + } + return &ContractStakeWithdrawnIterator{contract: _Contract.contract, event: "StakeWithdrawn", logs: logs, sub: sub}, nil +} + +// WatchStakeWithdrawn is a free log subscription operation binding the contract event 0xb7c918e0e249f999e965cafeb6c664271b3f4317d296461500e71da39f0cbda3. +// +// Solidity: event StakeWithdrawn(address indexed account, address withdrawAddress, uint256 amount) +func (_Contract *ContractFilterer) WatchStakeWithdrawn(opts *bind.WatchOpts, sink chan<- *ContractStakeWithdrawn, account []common.Address) (event.Subscription, error) { + + var accountRule []interface{} + for _, accountItem := range account { + accountRule = append(accountRule, accountItem) + } + + logs, sub, err := _Contract.contract.WatchLogs(opts, "StakeWithdrawn", accountRule) + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(ContractStakeWithdrawn) + if err := _Contract.contract.UnpackLog(event, "StakeWithdrawn", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseStakeWithdrawn is a log parse operation binding the contract event 0xb7c918e0e249f999e965cafeb6c664271b3f4317d296461500e71da39f0cbda3. +// +// Solidity: event StakeWithdrawn(address indexed account, address withdrawAddress, uint256 amount) +func (_Contract *ContractFilterer) ParseStakeWithdrawn(log types.Log) (*ContractStakeWithdrawn, error) { + event := new(ContractStakeWithdrawn) + if err := _Contract.contract.UnpackLog(event, "StakeWithdrawn", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// ContractUserOperationEventIterator is returned from FilterUserOperationEvent and is used to iterate over the raw logs and unpacked data for UserOperationEvent events raised by the Contract contract. +type ContractUserOperationEventIterator struct { + Event *ContractUserOperationEvent // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *ContractUserOperationEventIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(ContractUserOperationEvent) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(ContractUserOperationEvent) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *ContractUserOperationEventIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *ContractUserOperationEventIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// ContractUserOperationEvent represents a UserOperationEvent event raised by the Contract contract. +type ContractUserOperationEvent struct { + UserOpHash [32]byte + Sender common.Address + Paymaster common.Address + Nonce *big.Int + Success bool + ActualGasCost *big.Int + ActualGasUsed *big.Int + Raw types.Log // Blockchain specific contextual infos +} + +// FilterUserOperationEvent is a free log retrieval operation binding the contract event 0x49628fd1471006c1482da88028e9ce4dbb080b815c9b0344d39e5a8e6ec1419f. +// +// Solidity: event UserOperationEvent(bytes32 indexed userOpHash, address indexed sender, address indexed paymaster, uint256 nonce, bool success, uint256 actualGasCost, uint256 actualGasUsed) +func (_Contract *ContractFilterer) FilterUserOperationEvent(opts *bind.FilterOpts, userOpHash [][32]byte, sender []common.Address, paymaster []common.Address) (*ContractUserOperationEventIterator, error) { + + var userOpHashRule []interface{} + for _, userOpHashItem := range userOpHash { + userOpHashRule = append(userOpHashRule, userOpHashItem) + } + var senderRule []interface{} + for _, senderItem := range sender { + senderRule = append(senderRule, senderItem) + } + var paymasterRule []interface{} + for _, paymasterItem := range paymaster { + paymasterRule = append(paymasterRule, paymasterItem) + } + + logs, sub, err := _Contract.contract.FilterLogs(opts, "UserOperationEvent", userOpHashRule, senderRule, paymasterRule) + if err != nil { + return nil, err + } + return &ContractUserOperationEventIterator{contract: _Contract.contract, event: "UserOperationEvent", logs: logs, sub: sub}, nil +} + +// WatchUserOperationEvent is a free log subscription operation binding the contract event 0x49628fd1471006c1482da88028e9ce4dbb080b815c9b0344d39e5a8e6ec1419f. +// +// Solidity: event UserOperationEvent(bytes32 indexed userOpHash, address indexed sender, address indexed paymaster, uint256 nonce, bool success, uint256 actualGasCost, uint256 actualGasUsed) +func (_Contract *ContractFilterer) WatchUserOperationEvent(opts *bind.WatchOpts, sink chan<- *ContractUserOperationEvent, userOpHash [][32]byte, sender []common.Address, paymaster []common.Address) (event.Subscription, error) { + + var userOpHashRule []interface{} + for _, userOpHashItem := range userOpHash { + userOpHashRule = append(userOpHashRule, userOpHashItem) + } + var senderRule []interface{} + for _, senderItem := range sender { + senderRule = append(senderRule, senderItem) + } + var paymasterRule []interface{} + for _, paymasterItem := range paymaster { + paymasterRule = append(paymasterRule, paymasterItem) + } + + logs, sub, err := _Contract.contract.WatchLogs(opts, "UserOperationEvent", userOpHashRule, senderRule, paymasterRule) + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(ContractUserOperationEvent) + if err := _Contract.contract.UnpackLog(event, "UserOperationEvent", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseUserOperationEvent is a log parse operation binding the contract event 0x49628fd1471006c1482da88028e9ce4dbb080b815c9b0344d39e5a8e6ec1419f. +// +// Solidity: event UserOperationEvent(bytes32 indexed userOpHash, address indexed sender, address indexed paymaster, uint256 nonce, bool success, uint256 actualGasCost, uint256 actualGasUsed) +func (_Contract *ContractFilterer) ParseUserOperationEvent(log types.Log) (*ContractUserOperationEvent, error) { + event := new(ContractUserOperationEvent) + if err := _Contract.contract.UnpackLog(event, "UserOperationEvent", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// ContractUserOperationPrefundTooLowIterator is returned from FilterUserOperationPrefundTooLow and is used to iterate over the raw logs and unpacked data for UserOperationPrefundTooLow events raised by the Contract contract. +type ContractUserOperationPrefundTooLowIterator struct { + Event *ContractUserOperationPrefundTooLow // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *ContractUserOperationPrefundTooLowIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(ContractUserOperationPrefundTooLow) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(ContractUserOperationPrefundTooLow) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *ContractUserOperationPrefundTooLowIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *ContractUserOperationPrefundTooLowIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// ContractUserOperationPrefundTooLow represents a UserOperationPrefundTooLow event raised by the Contract contract. +type ContractUserOperationPrefundTooLow struct { + UserOpHash [32]byte + Sender common.Address + Nonce *big.Int + Raw types.Log // Blockchain specific contextual infos +} + +// FilterUserOperationPrefundTooLow is a free log retrieval operation binding the contract event 0x67b4fa9642f42120bf031f3051d1824b0fe25627945b27b8a6a65d5761d5482e. +// +// Solidity: event UserOperationPrefundTooLow(bytes32 indexed userOpHash, address indexed sender, uint256 nonce) +func (_Contract *ContractFilterer) FilterUserOperationPrefundTooLow(opts *bind.FilterOpts, userOpHash [][32]byte, sender []common.Address) (*ContractUserOperationPrefundTooLowIterator, error) { + + var userOpHashRule []interface{} + for _, userOpHashItem := range userOpHash { + userOpHashRule = append(userOpHashRule, userOpHashItem) + } + var senderRule []interface{} + for _, senderItem := range sender { + senderRule = append(senderRule, senderItem) + } + + logs, sub, err := _Contract.contract.FilterLogs(opts, "UserOperationPrefundTooLow", userOpHashRule, senderRule) + if err != nil { + return nil, err + } + return &ContractUserOperationPrefundTooLowIterator{contract: _Contract.contract, event: "UserOperationPrefundTooLow", logs: logs, sub: sub}, nil +} + +// WatchUserOperationPrefundTooLow is a free log subscription operation binding the contract event 0x67b4fa9642f42120bf031f3051d1824b0fe25627945b27b8a6a65d5761d5482e. +// +// Solidity: event UserOperationPrefundTooLow(bytes32 indexed userOpHash, address indexed sender, uint256 nonce) +func (_Contract *ContractFilterer) WatchUserOperationPrefundTooLow(opts *bind.WatchOpts, sink chan<- *ContractUserOperationPrefundTooLow, userOpHash [][32]byte, sender []common.Address) (event.Subscription, error) { + + var userOpHashRule []interface{} + for _, userOpHashItem := range userOpHash { + userOpHashRule = append(userOpHashRule, userOpHashItem) + } + var senderRule []interface{} + for _, senderItem := range sender { + senderRule = append(senderRule, senderItem) + } + + logs, sub, err := _Contract.contract.WatchLogs(opts, "UserOperationPrefundTooLow", userOpHashRule, senderRule) + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(ContractUserOperationPrefundTooLow) + if err := _Contract.contract.UnpackLog(event, "UserOperationPrefundTooLow", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseUserOperationPrefundTooLow is a log parse operation binding the contract event 0x67b4fa9642f42120bf031f3051d1824b0fe25627945b27b8a6a65d5761d5482e. +// +// Solidity: event UserOperationPrefundTooLow(bytes32 indexed userOpHash, address indexed sender, uint256 nonce) +func (_Contract *ContractFilterer) ParseUserOperationPrefundTooLow(log types.Log) (*ContractUserOperationPrefundTooLow, error) { + event := new(ContractUserOperationPrefundTooLow) + if err := _Contract.contract.UnpackLog(event, "UserOperationPrefundTooLow", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// ContractUserOperationRevertReasonIterator is returned from FilterUserOperationRevertReason and is used to iterate over the raw logs and unpacked data for UserOperationRevertReason events raised by the Contract contract. +type ContractUserOperationRevertReasonIterator struct { + Event *ContractUserOperationRevertReason // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *ContractUserOperationRevertReasonIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(ContractUserOperationRevertReason) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(ContractUserOperationRevertReason) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *ContractUserOperationRevertReasonIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *ContractUserOperationRevertReasonIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// ContractUserOperationRevertReason represents a UserOperationRevertReason event raised by the Contract contract. +type ContractUserOperationRevertReason struct { + UserOpHash [32]byte + Sender common.Address + Nonce *big.Int + RevertReason []byte + Raw types.Log // Blockchain specific contextual infos +} + +// FilterUserOperationRevertReason is a free log retrieval operation binding the contract event 0x1c4fada7374c0a9ee8841fc38afe82932dc0f8e69012e927f061a8bae611a201. +// +// Solidity: event UserOperationRevertReason(bytes32 indexed userOpHash, address indexed sender, uint256 nonce, bytes revertReason) +func (_Contract *ContractFilterer) FilterUserOperationRevertReason(opts *bind.FilterOpts, userOpHash [][32]byte, sender []common.Address) (*ContractUserOperationRevertReasonIterator, error) { + + var userOpHashRule []interface{} + for _, userOpHashItem := range userOpHash { + userOpHashRule = append(userOpHashRule, userOpHashItem) + } + var senderRule []interface{} + for _, senderItem := range sender { + senderRule = append(senderRule, senderItem) + } + + logs, sub, err := _Contract.contract.FilterLogs(opts, "UserOperationRevertReason", userOpHashRule, senderRule) + if err != nil { + return nil, err + } + return &ContractUserOperationRevertReasonIterator{contract: _Contract.contract, event: "UserOperationRevertReason", logs: logs, sub: sub}, nil +} + +// WatchUserOperationRevertReason is a free log subscription operation binding the contract event 0x1c4fada7374c0a9ee8841fc38afe82932dc0f8e69012e927f061a8bae611a201. +// +// Solidity: event UserOperationRevertReason(bytes32 indexed userOpHash, address indexed sender, uint256 nonce, bytes revertReason) +func (_Contract *ContractFilterer) WatchUserOperationRevertReason(opts *bind.WatchOpts, sink chan<- *ContractUserOperationRevertReason, userOpHash [][32]byte, sender []common.Address) (event.Subscription, error) { + + var userOpHashRule []interface{} + for _, userOpHashItem := range userOpHash { + userOpHashRule = append(userOpHashRule, userOpHashItem) + } + var senderRule []interface{} + for _, senderItem := range sender { + senderRule = append(senderRule, senderItem) + } + + logs, sub, err := _Contract.contract.WatchLogs(opts, "UserOperationRevertReason", userOpHashRule, senderRule) + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(ContractUserOperationRevertReason) + if err := _Contract.contract.UnpackLog(event, "UserOperationRevertReason", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseUserOperationRevertReason is a log parse operation binding the contract event 0x1c4fada7374c0a9ee8841fc38afe82932dc0f8e69012e927f061a8bae611a201. +// +// Solidity: event UserOperationRevertReason(bytes32 indexed userOpHash, address indexed sender, uint256 nonce, bytes revertReason) +func (_Contract *ContractFilterer) ParseUserOperationRevertReason(log types.Log) (*ContractUserOperationRevertReason, error) { + event := new(ContractUserOperationRevertReason) + if err := _Contract.contract.UnpackLog(event, "UserOperationRevertReason", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// ContractWithdrawnIterator is returned from FilterWithdrawn and is used to iterate over the raw logs and unpacked data for Withdrawn events raised by the Contract contract. +type ContractWithdrawnIterator struct { + Event *ContractWithdrawn // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *ContractWithdrawnIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(ContractWithdrawn) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(ContractWithdrawn) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *ContractWithdrawnIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *ContractWithdrawnIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// ContractWithdrawn represents a Withdrawn event raised by the Contract contract. +type ContractWithdrawn struct { + Account common.Address + WithdrawAddress common.Address + Amount *big.Int + Raw types.Log // Blockchain specific contextual infos +} + +// FilterWithdrawn is a free log retrieval operation binding the contract event 0xd1c19fbcd4551a5edfb66d43d2e337c04837afda3482b42bdf569a8fccdae5fb. +// +// Solidity: event Withdrawn(address indexed account, address withdrawAddress, uint256 amount) +func (_Contract *ContractFilterer) FilterWithdrawn(opts *bind.FilterOpts, account []common.Address) (*ContractWithdrawnIterator, error) { + + var accountRule []interface{} + for _, accountItem := range account { + accountRule = append(accountRule, accountItem) + } + + logs, sub, err := _Contract.contract.FilterLogs(opts, "Withdrawn", accountRule) + if err != nil { + return nil, err + } + return &ContractWithdrawnIterator{contract: _Contract.contract, event: "Withdrawn", logs: logs, sub: sub}, nil +} + +// WatchWithdrawn is a free log subscription operation binding the contract event 0xd1c19fbcd4551a5edfb66d43d2e337c04837afda3482b42bdf569a8fccdae5fb. +// +// Solidity: event Withdrawn(address indexed account, address withdrawAddress, uint256 amount) +func (_Contract *ContractFilterer) WatchWithdrawn(opts *bind.WatchOpts, sink chan<- *ContractWithdrawn, account []common.Address) (event.Subscription, error) { + + var accountRule []interface{} + for _, accountItem := range account { + accountRule = append(accountRule, accountItem) + } + + logs, sub, err := _Contract.contract.WatchLogs(opts, "Withdrawn", accountRule) + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(ContractWithdrawn) + if err := _Contract.contract.UnpackLog(event, "Withdrawn", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseWithdrawn is a log parse operation binding the contract event 0xd1c19fbcd4551a5edfb66d43d2e337c04837afda3482b42bdf569a8fccdae5fb. +// +// Solidity: event Withdrawn(address indexed account, address withdrawAddress, uint256 amount) +func (_Contract *ContractFilterer) ParseWithdrawn(log types.Log) (*ContractWithdrawn, error) { + event := new(ContractWithdrawn) + if err := _Contract.contract.UnpackLog(event, "Withdrawn", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} diff --git a/common/ethereum_contract/ethereum_client_test.go b/common/ethereum_contract/ethereum_client_test.go new file mode 100644 index 00000000..03ace1d0 --- /dev/null +++ b/common/ethereum_contract/ethereum_client_test.go @@ -0,0 +1,99 @@ +package ethereum_contract + +import ( + "AAStarCommunity/EthPaymaster_BackService/common/ethereum_contract/contract/paymaster_verifying_erc20_v07" + "AAStarCommunity/EthPaymaster_BackService/common/global_const" + "AAStarCommunity/EthPaymaster_BackService/config" + "context" + "encoding/hex" + "encoding/json" + "github.com/ethereum/go-ethereum/accounts/abi/bind" + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/ethclient" + "testing" +) + +func TestPaymasterV07(t *testing.T) { + if testing.Short() { + t.Skip("skipping test in short mode.") + } + config.InitConfig("../../config/basic_strategy_config.json", "../../config/basic_config.json", "../../config/secret_config.json") + network := config.GetNewWorkClientURl(global_const.EthereumSepolia) + contractAddress := common.HexToAddress("0x3Da96267B98a33267249734FD8FFeC75093D3085") + t.Logf("network URL %s", network) + client, err := ethclient.Dial(network) + if err != nil { + t.Fatalf("Error: %v", err) + return + } + id, er := client.ChainID(context.Background()) + if er != nil { + t.Fatalf("Error: %v", er) + return + } + t.Log(id) + contractInstance, err := paymaster_verifying_erc20_v07.NewContract(contractAddress, client) + if err != nil { + t.Fatalf("Error: %v", err) + return + } + //writeInstance, err := paymaster_verifying_erc20_v07.NewContractTransactor(contractAddress, client) + //if err != nil { + // t.Fatalf("Error: %v", err) + // return + //} + tests := []struct { + name string + test func(t *testing.T) + }{ + { + "testV07Deposit", + func(t *testing.T) { + testV07Deposit(t, contractInstance) + }, + }, + + { + "parsePaymaster", + func(t *testing.T) { + parsePaymasterData(t, contractInstance) + }, + }, + } + for _, tt := range tests { + t.Run(tt.name, tt.test) + } +} + +func parsePaymasterData(t *testing.T, contractInstance *paymaster_verifying_erc20_v07.Contract) { + paymasterData := "3da96267b98a33267249734fd8ffec75093d308500000000004c4b40000000000000000000000000001e84800000000000000000000000000000000000000000000000000000000000000000000000006c7bacd00000000000000000000000000000000000000000000000000000000065ed355000000000000000000000000086af7fa0d8b0b7f757ed6cdd0e2aadb33b03be580000000000000000000000000000000000000000000000000000000000000000293df680d08a6d4da0bb7c0ba6d65af835b31f727e83b30e470a697c886597a50e96c2db45aa54b5f83c977745af6b948e86fbabf0fa96f5670e382b7586ac121b" + paymasterDataByte, er := hex.DecodeString(paymasterData) + if er != nil { + t.Fatalf("Error: %v", er) + return + } + res, err := contractInstance.ParsePaymasterAndData(&bind.CallOpts{}, paymasterDataByte) + if err != nil { + t.Fatalf("Error: %v", err) + return + } + resJson, _ := json.Marshal(res) + t.Log(string(resJson)) + +} + +func testV07Deposit(t *testing.T, contractInstance *paymaster_verifying_erc20_v07.Contract) { + deopsit, err := contractInstance.GetDeposit(&bind.CallOpts{}) + if err != nil { + t.Fatalf("Error: %v", err) + return + } + t.Log(deopsit) + + verifier, err := contractInstance.Verifier(&bind.CallOpts{}) + if err != nil { + t.Fatalf("Error: %v", err) + return + } + t.Log(verifier) +} diff --git a/common/ethereum_contract/paymaster_abi/abi_type.go b/common/ethereum_contract/paymaster_abi/abi_type.go new file mode 100644 index 00000000..5c89ddb6 --- /dev/null +++ b/common/ethereum_contract/paymaster_abi/abi_type.go @@ -0,0 +1,60 @@ +package paymaster_abi + +import ( + "fmt" + "github.com/ethereum/go-ethereum/accounts/abi" +) + +var ( + BytesType abi.Type + Bytes32Type abi.Type + Uint48Type abi.Type + Uint256Type abi.Type + Uint64Type abi.Type + AddressType abi.Type + BooleanType abi.Type +) + +func init() { + bytesTypeVar, err := abi.NewType("bytes", "", nil) + if err != nil { + panic(fmt.Sprintf("[initerror] %s", err)) + } + BytesType = bytesTypeVar + + byte32TypeVar, err := abi.NewType("bytes32", "", nil) + if err != nil { + panic(fmt.Sprintf("[initerror] %s", err)) + } + Bytes32Type = byte32TypeVar + + uint48Var, err := abi.NewType("uint48", "", nil) + if err != nil { + panic(fmt.Sprintf("[initerror] %s", err)) + } + Uint48Type = uint48Var + + uint256TypeVar, err := abi.NewType("uint256", "", nil) + if err != nil { + panic(fmt.Sprintf("[initerror] %s", err)) + } + Uint256Type = uint256TypeVar + + uint64TypeVar, err := abi.NewType("uint64", "", nil) + if err != nil { + panic(fmt.Sprintf("[initerror] %s", err)) + } + Uint64Type = uint64TypeVar + + addressType, err := abi.NewType("address", "", nil) + if err != nil { + panic(fmt.Sprintf("[initerror] %s", err)) + } + AddressType = addressType + + boolTypeVar, err := abi.NewType("bool", "", nil) + if err != nil { + panic(fmt.Sprintf("[initerror] %s", err)) + } + BooleanType = boolTypeVar +} diff --git a/common/ethereum_contract/paymaster_abi/entrypoint_v06_abi.json b/common/ethereum_contract/paymaster_abi/entrypoint_v06_abi.json new file mode 100644 index 00000000..57e4de06 --- /dev/null +++ b/common/ethereum_contract/paymaster_abi/entrypoint_v06_abi.json @@ -0,0 +1,938 @@ +[ + { + "inputs": [ + { "internalType": "uint256", "name": "preOpGas", "type": "uint256" }, + { "internalType": "uint256", "name": "paid", "type": "uint256" }, + { "internalType": "uint48", "name": "validAfter", "type": "uint48" }, + { "internalType": "uint48", "name": "validUntil", "type": "uint48" }, + { "internalType": "bool", "name": "targetSuccess", "type": "bool" }, + { "internalType": "bytes", "name": "targetResult", "type": "bytes" } + ], + "name": "ExecutionResult", + "type": "error" + }, + { + "inputs": [ + { "internalType": "uint256", "name": "opIndex", "type": "uint256" }, + { "internalType": "string", "name": "reason", "type": "string" } + ], + "name": "FailedOp", + "type": "error" + }, + { + "inputs": [ + { "internalType": "address", "name": "sender", "type": "address" } + ], + "name": "SenderAddressResult", + "type": "error" + }, + { + "inputs": [ + { "internalType": "address", "name": "aggregator", "type": "address" } + ], + "name": "SignatureValidationFailed", + "type": "error" + }, + { + "inputs": [ + { + "components": [ + { "internalType": "uint256", "name": "preOpGas", "type": "uint256" }, + { "internalType": "uint256", "name": "prefund", "type": "uint256" }, + { "internalType": "bool", "name": "sigFailed", "type": "bool" }, + { "internalType": "uint48", "name": "validAfter", "type": "uint48" }, + { "internalType": "uint48", "name": "validUntil", "type": "uint48" }, + { + "internalType": "bytes", + "name": "paymasterContext", + "type": "bytes" + } + ], + "internalType": "struct IEntryPoint.ReturnInfo", + "name": "returnInfo", + "type": "tuple" + }, + { + "components": [ + { "internalType": "uint256", "name": "stake", "type": "uint256" }, + { + "internalType": "uint256", + "name": "unstakeDelaySec", + "type": "uint256" + } + ], + "internalType": "struct IStakeManager.StakeInfo", + "name": "senderInfo", + "type": "tuple" + }, + { + "components": [ + { "internalType": "uint256", "name": "stake", "type": "uint256" }, + { + "internalType": "uint256", + "name": "unstakeDelaySec", + "type": "uint256" + } + ], + "internalType": "struct IStakeManager.StakeInfo", + "name": "factoryInfo", + "type": "tuple" + }, + { + "components": [ + { "internalType": "uint256", "name": "stake", "type": "uint256" }, + { + "internalType": "uint256", + "name": "unstakeDelaySec", + "type": "uint256" + } + ], + "internalType": "struct IStakeManager.StakeInfo", + "name": "paymasterInfo", + "type": "tuple" + } + ], + "name": "ValidationResult", + "type": "error" + }, + { + "inputs": [ + { + "components": [ + { "internalType": "uint256", "name": "preOpGas", "type": "uint256" }, + { "internalType": "uint256", "name": "prefund", "type": "uint256" }, + { "internalType": "bool", "name": "sigFailed", "type": "bool" }, + { "internalType": "uint48", "name": "validAfter", "type": "uint48" }, + { "internalType": "uint48", "name": "validUntil", "type": "uint48" }, + { + "internalType": "bytes", + "name": "paymasterContext", + "type": "bytes" + } + ], + "internalType": "struct IEntryPoint.ReturnInfo", + "name": "returnInfo", + "type": "tuple" + }, + { + "components": [ + { "internalType": "uint256", "name": "stake", "type": "uint256" }, + { + "internalType": "uint256", + "name": "unstakeDelaySec", + "type": "uint256" + } + ], + "internalType": "struct IStakeManager.StakeInfo", + "name": "senderInfo", + "type": "tuple" + }, + { + "components": [ + { "internalType": "uint256", "name": "stake", "type": "uint256" }, + { + "internalType": "uint256", + "name": "unstakeDelaySec", + "type": "uint256" + } + ], + "internalType": "struct IStakeManager.StakeInfo", + "name": "factoryInfo", + "type": "tuple" + }, + { + "components": [ + { "internalType": "uint256", "name": "stake", "type": "uint256" }, + { + "internalType": "uint256", + "name": "unstakeDelaySec", + "type": "uint256" + } + ], + "internalType": "struct IStakeManager.StakeInfo", + "name": "paymasterInfo", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "address", + "name": "aggregator", + "type": "address" + }, + { + "components": [ + { "internalType": "uint256", "name": "stake", "type": "uint256" }, + { + "internalType": "uint256", + "name": "unstakeDelaySec", + "type": "uint256" + } + ], + "internalType": "struct IStakeManager.StakeInfo", + "name": "stakeInfo", + "type": "tuple" + } + ], + "internalType": "struct IEntryPoint.AggregatorStakeInfo", + "name": "aggregatorInfo", + "type": "tuple" + } + ], + "name": "ValidationResultWithAggregation", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "userOpHash", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "factory", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "paymaster", + "type": "address" + } + ], + "name": "AccountDeployed", + "type": "event" + }, + { + "anonymous": false, + "inputs": [], + "name": "BeforeExecution", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "totalDeposit", + "type": "uint256" + } + ], + "name": "Deposited", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "aggregator", + "type": "address" + } + ], + "name": "SignatureAggregatorChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "totalStaked", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "unstakeDelaySec", + "type": "uint256" + } + ], + "name": "StakeLocked", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "withdrawTime", + "type": "uint256" + } + ], + "name": "StakeUnlocked", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "withdrawAddress", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "StakeWithdrawn", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "userOpHash", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "paymaster", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "nonce", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bool", + "name": "success", + "type": "bool" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "actualGasCost", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "actualGasUsed", + "type": "uint256" + } + ], + "name": "UserOperationEvent", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "userOpHash", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "nonce", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "revertReason", + "type": "bytes" + } + ], + "name": "UserOperationRevertReason", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "withdrawAddress", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "Withdrawn", + "type": "event" + }, + { + "inputs": [], + "name": "SIG_VALIDATION_FAILED", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "bytes", "name": "initCode", "type": "bytes" }, + { "internalType": "address", "name": "sender", "type": "address" }, + { "internalType": "bytes", "name": "paymasterAndData", "type": "bytes" } + ], + "name": "_validateSenderAndPaymaster", + "outputs": [], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint32", "name": "unstakeDelaySec", "type": "uint32" } + ], + "name": "addStake", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "account", "type": "address" } + ], + "name": "balanceOf", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "account", "type": "address" } + ], + "name": "depositTo", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [{ "internalType": "address", "name": "", "type": "address" }], + "name": "deposits", + "outputs": [ + { "internalType": "uint112", "name": "deposit", "type": "uint112" }, + { "internalType": "bool", "name": "staked", "type": "bool" }, + { "internalType": "uint112", "name": "stake", "type": "uint112" }, + { "internalType": "uint32", "name": "unstakeDelaySec", "type": "uint32" }, + { "internalType": "uint48", "name": "withdrawTime", "type": "uint48" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "account", "type": "address" } + ], + "name": "getDepositInfo", + "outputs": [ + { + "components": [ + { "internalType": "uint112", "name": "deposit", "type": "uint112" }, + { "internalType": "bool", "name": "staked", "type": "bool" }, + { "internalType": "uint112", "name": "stake", "type": "uint112" }, + { + "internalType": "uint32", + "name": "unstakeDelaySec", + "type": "uint32" + }, + { "internalType": "uint48", "name": "withdrawTime", "type": "uint48" } + ], + "internalType": "struct IStakeManager.DepositInfo", + "name": "info", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "sender", "type": "address" }, + { "internalType": "uint192", "name": "key", "type": "uint192" } + ], + "name": "getNonce", + "outputs": [ + { "internalType": "uint256", "name": "nonce", "type": "uint256" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "bytes", "name": "initCode", "type": "bytes" } + ], + "name": "getSenderAddress", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { "internalType": "address", "name": "sender", "type": "address" }, + { "internalType": "uint256", "name": "nonce", "type": "uint256" }, + { "internalType": "bytes", "name": "initCode", "type": "bytes" }, + { "internalType": "bytes", "name": "callData", "type": "bytes" }, + { + "internalType": "uint256", + "name": "callGasLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "verificationGasLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "preVerificationGas", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "maxFeePerGas", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "maxPriorityFeePerGas", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "paymasterAndData", + "type": "bytes" + }, + { "internalType": "bytes", "name": "signature", "type": "bytes" } + ], + "internalType": "struct UserOperation", + "name": "userOp", + "type": "tuple" + } + ], + "name": "getUserOpHash", + "outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "components": [ + { + "internalType": "address", + "name": "sender", + "type": "address" + }, + { "internalType": "uint256", "name": "nonce", "type": "uint256" }, + { "internalType": "bytes", "name": "initCode", "type": "bytes" }, + { "internalType": "bytes", "name": "callData", "type": "bytes" }, + { + "internalType": "uint256", + "name": "callGasLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "verificationGasLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "preVerificationGas", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "maxFeePerGas", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "maxPriorityFeePerGas", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "paymasterAndData", + "type": "bytes" + }, + { "internalType": "bytes", "name": "signature", "type": "bytes" } + ], + "internalType": "struct UserOperation[]", + "name": "userOps", + "type": "tuple[]" + }, + { + "internalType": "contract IAggregator", + "name": "aggregator", + "type": "address" + }, + { "internalType": "bytes", "name": "signature", "type": "bytes" } + ], + "internalType": "struct IEntryPoint.UserOpsPerAggregator[]", + "name": "opsPerAggregator", + "type": "tuple[]" + }, + { + "internalType": "address payable", + "name": "beneficiary", + "type": "address" + } + ], + "name": "handleAggregatedOps", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { "internalType": "address", "name": "sender", "type": "address" }, + { "internalType": "uint256", "name": "nonce", "type": "uint256" }, + { "internalType": "bytes", "name": "initCode", "type": "bytes" }, + { "internalType": "bytes", "name": "callData", "type": "bytes" }, + { + "internalType": "uint256", + "name": "callGasLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "verificationGasLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "preVerificationGas", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "maxFeePerGas", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "maxPriorityFeePerGas", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "paymasterAndData", + "type": "bytes" + }, + { "internalType": "bytes", "name": "signature", "type": "bytes" } + ], + "internalType": "struct UserOperation[]", + "name": "ops", + "type": "tuple[]" + }, + { + "internalType": "address payable", + "name": "beneficiary", + "type": "address" + } + ], + "name": "handleOps", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [{ "internalType": "uint192", "name": "key", "type": "uint192" }], + "name": "incrementNonce", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "bytes", "name": "callData", "type": "bytes" }, + { + "components": [ + { + "components": [ + { + "internalType": "address", + "name": "sender", + "type": "address" + }, + { "internalType": "uint256", "name": "nonce", "type": "uint256" }, + { + "internalType": "uint256", + "name": "callGasLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "verificationGasLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "preVerificationGas", + "type": "uint256" + }, + { + "internalType": "address", + "name": "paymaster", + "type": "address" + }, + { + "internalType": "uint256", + "name": "maxFeePerGas", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "maxPriorityFeePerGas", + "type": "uint256" + } + ], + "internalType": "struct EntryPoint.MemoryUserOp", + "name": "mUserOp", + "type": "tuple" + }, + { + "internalType": "bytes32", + "name": "userOpHash", + "type": "bytes32" + }, + { "internalType": "uint256", "name": "prefund", "type": "uint256" }, + { + "internalType": "uint256", + "name": "contextOffset", + "type": "uint256" + }, + { "internalType": "uint256", "name": "preOpGas", "type": "uint256" } + ], + "internalType": "struct EntryPoint.UserOpInfo", + "name": "opInfo", + "type": "tuple" + }, + { "internalType": "bytes", "name": "context", "type": "bytes" } + ], + "name": "innerHandleOp", + "outputs": [ + { "internalType": "uint256", "name": "actualGasCost", "type": "uint256" } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "", "type": "address" }, + { "internalType": "uint192", "name": "", "type": "uint192" } + ], + "name": "nonceSequenceNumber", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { "internalType": "address", "name": "sender", "type": "address" }, + { "internalType": "uint256", "name": "nonce", "type": "uint256" }, + { "internalType": "bytes", "name": "initCode", "type": "bytes" }, + { "internalType": "bytes", "name": "callData", "type": "bytes" }, + { + "internalType": "uint256", + "name": "callGasLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "verificationGasLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "preVerificationGas", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "maxFeePerGas", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "maxPriorityFeePerGas", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "paymasterAndData", + "type": "bytes" + }, + { "internalType": "bytes", "name": "signature", "type": "bytes" } + ], + "internalType": "struct UserOperation", + "name": "op", + "type": "tuple" + }, + { "internalType": "address", "name": "target", "type": "address" }, + { "internalType": "bytes", "name": "targetCallData", "type": "bytes" } + ], + "name": "simulateHandleOp", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { "internalType": "address", "name": "sender", "type": "address" }, + { "internalType": "uint256", "name": "nonce", "type": "uint256" }, + { "internalType": "bytes", "name": "initCode", "type": "bytes" }, + { "internalType": "bytes", "name": "callData", "type": "bytes" }, + { + "internalType": "uint256", + "name": "callGasLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "verificationGasLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "preVerificationGas", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "maxFeePerGas", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "maxPriorityFeePerGas", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "paymasterAndData", + "type": "bytes" + }, + { "internalType": "bytes", "name": "signature", "type": "bytes" } + ], + "internalType": "struct UserOperation", + "name": "userOp", + "type": "tuple" + } + ], + "name": "simulateValidation", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "unlockStake", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address payable", + "name": "withdrawAddress", + "type": "address" + } + ], + "name": "withdrawStake", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address payable", + "name": "withdrawAddress", + "type": "address" + }, + { "internalType": "uint256", "name": "withdrawAmount", "type": "uint256" } + ], + "name": "withdrawTo", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { "stateMutability": "payable", "type": "receive" } +] diff --git a/common/ethereum_contract/paymaster_abi/entrypoint_v07_abi.json b/common/ethereum_contract/paymaster_abi/entrypoint_v07_abi.json new file mode 100644 index 00000000..7b98abad --- /dev/null +++ b/common/ethereum_contract/paymaster_abi/entrypoint_v07_abi.json @@ -0,0 +1,996 @@ +[ + { + "inputs": [ + { + "internalType": "bool", + "name": "success", + "type": "bool" + }, + { + "internalType": "bytes", + "name": "ret", + "type": "bytes" + } + ], + "name": "DelegateAndRevert", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "opIndex", + "type": "uint256" + }, + { + "internalType": "string", + "name": "reason", + "type": "string" + } + ], + "name": "FailedOp", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "opIndex", + "type": "uint256" + }, + { + "internalType": "string", + "name": "reason", + "type": "string" + }, + { + "internalType": "bytes", + "name": "inner", + "type": "bytes" + } + ], + "name": "FailedOpWithRevert", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "returnData", + "type": "bytes" + } + ], + "name": "PostOpReverted", + "type": "error" + }, + { + "inputs": [], + "name": "ReentrancyGuardReentrantCall", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "sender", + "type": "address" + } + ], + "name": "SenderAddressResult", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "aggregator", + "type": "address" + } + ], + "name": "SignatureValidationFailed", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "userOpHash", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "factory", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "paymaster", + "type": "address" + } + ], + "name": "AccountDeployed", + "type": "event" + }, + { + "anonymous": false, + "inputs": [], + "name": "BeforeExecution", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "totalDeposit", + "type": "uint256" + } + ], + "name": "Deposited", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "userOpHash", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "nonce", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "revertReason", + "type": "bytes" + } + ], + "name": "PostOpRevertReason", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "aggregator", + "type": "address" + } + ], + "name": "SignatureAggregatorChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "totalStaked", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "unstakeDelaySec", + "type": "uint256" + } + ], + "name": "StakeLocked", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "withdrawTime", + "type": "uint256" + } + ], + "name": "StakeUnlocked", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "withdrawAddress", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "StakeWithdrawn", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "userOpHash", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "paymaster", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "nonce", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bool", + "name": "success", + "type": "bool" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "actualGasCost", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "actualGasUsed", + "type": "uint256" + } + ], + "name": "UserOperationEvent", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "userOpHash", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "nonce", + "type": "uint256" + } + ], + "name": "UserOperationPrefundTooLow", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "userOpHash", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "nonce", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "revertReason", + "type": "bytes" + } + ], + "name": "UserOperationRevertReason", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "withdrawAddress", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "Withdrawn", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "uint32", + "name": "unstakeDelaySec", + "type": "uint32" + } + ], + "name": "addStake", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "balanceOf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "target", + "type": "address" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "delegateAndRevert", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "depositTo", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "deposits", + "outputs": [ + { + "internalType": "uint256", + "name": "deposit", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "staked", + "type": "bool" + }, + { + "internalType": "uint112", + "name": "stake", + "type": "uint112" + }, + { + "internalType": "uint32", + "name": "unstakeDelaySec", + "type": "uint32" + }, + { + "internalType": "uint48", + "name": "withdrawTime", + "type": "uint48" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "getDepositInfo", + "outputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "deposit", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "staked", + "type": "bool" + }, + { + "internalType": "uint112", + "name": "stake", + "type": "uint112" + }, + { + "internalType": "uint32", + "name": "unstakeDelaySec", + "type": "uint32" + }, + { + "internalType": "uint48", + "name": "withdrawTime", + "type": "uint48" + } + ], + "internalType": "struct IStakeManager.DepositInfo", + "name": "info", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "internalType": "uint192", + "name": "key", + "type": "uint192" + } + ], + "name": "getNonce", + "outputs": [ + { + "internalType": "uint256", + "name": "nonce", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "initCode", + "type": "bytes" + } + ], + "name": "getSenderAddress", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "nonce", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "initCode", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "callData", + "type": "bytes" + }, + { + "internalType": "bytes32", + "name": "accountGasLimits", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "preVerificationGas", + "type": "uint256" + }, + { + "internalType": "bytes32", + "name": "gasFees", + "type": "bytes32" + }, + { + "internalType": "bytes", + "name": "paymasterAndData", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "signature", + "type": "bytes" + } + ], + "internalType": "struct PackedUserOperation", + "name": "userOp", + "type": "tuple" + } + ], + "name": "getUserOpHash", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "components": [ + { + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "nonce", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "initCode", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "callData", + "type": "bytes" + }, + { + "internalType": "bytes32", + "name": "accountGasLimits", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "preVerificationGas", + "type": "uint256" + }, + { + "internalType": "bytes32", + "name": "gasFees", + "type": "bytes32" + }, + { + "internalType": "bytes", + "name": "paymasterAndData", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "signature", + "type": "bytes" + } + ], + "internalType": "struct PackedUserOperation[]", + "name": "userOps", + "type": "tuple[]" + }, + { + "internalType": "contract IAggregator", + "name": "aggregator", + "type": "address" + }, + { + "internalType": "bytes", + "name": "signature", + "type": "bytes" + } + ], + "internalType": "struct IEntryPoint.UserOpsPerAggregator[]", + "name": "opsPerAggregator", + "type": "tuple[]" + }, + { + "internalType": "address payable", + "name": "beneficiary", + "type": "address" + } + ], + "name": "handleAggregatedOps", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "nonce", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "initCode", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "callData", + "type": "bytes" + }, + { + "internalType": "bytes32", + "name": "accountGasLimits", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "preVerificationGas", + "type": "uint256" + }, + { + "internalType": "bytes32", + "name": "gasFees", + "type": "bytes32" + }, + { + "internalType": "bytes", + "name": "paymasterAndData", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "signature", + "type": "bytes" + } + ], + "internalType": "struct PackedUserOperation[]", + "name": "ops", + "type": "tuple[]" + }, + { + "internalType": "address payable", + "name": "beneficiary", + "type": "address" + } + ], + "name": "handleOps", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint192", + "name": "key", + "type": "uint192" + } + ], + "name": "incrementNonce", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "callData", + "type": "bytes" + }, + { + "components": [ + { + "components": [ + { + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "nonce", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "verificationGasLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "callGasLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "paymasterVerificationGasLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "paymasterPostOpGasLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "preVerificationGas", + "type": "uint256" + }, + { + "internalType": "address", + "name": "paymaster", + "type": "address" + }, + { + "internalType": "uint256", + "name": "maxFeePerGas", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "maxPriorityFeePerGas", + "type": "uint256" + } + ], + "internalType": "struct EntryPoint.MemoryUserOp", + "name": "mUserOp", + "type": "tuple" + }, + { + "internalType": "bytes32", + "name": "userOpHash", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "prefund", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "contextOffset", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "preOpGas", + "type": "uint256" + } + ], + "internalType": "struct EntryPoint.UserOpInfo", + "name": "opInfo", + "type": "tuple" + }, + { + "internalType": "bytes", + "name": "context", + "type": "bytes" + } + ], + "name": "innerHandleOp", + "outputs": [ + { + "internalType": "uint256", + "name": "actualGasCost", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "uint192", + "name": "", + "type": "uint192" + } + ], + "name": "nonceSequenceNumber", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "interfaceId", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "unlockStake", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address payable", + "name": "withdrawAddress", + "type": "address" + } + ], + "name": "withdrawStake", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address payable", + "name": "withdrawAddress", + "type": "address" + }, + { + "internalType": "uint256", + "name": "withdrawAmount", + "type": "uint256" + } + ], + "name": "withdrawTo", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "stateMutability": "payable", + "type": "receive" + } +] diff --git a/common/ethereum_contract/paymaster_abi/erc20_abi.json b/common/ethereum_contract/paymaster_abi/erc20_abi.json new file mode 100644 index 00000000..405d6b36 --- /dev/null +++ b/common/ethereum_contract/paymaster_abi/erc20_abi.json @@ -0,0 +1,222 @@ +[ + { + "constant": true, + "inputs": [], + "name": "name", + "outputs": [ + { + "name": "", + "type": "string" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "_spender", + "type": "address" + }, + { + "name": "_value", + "type": "uint256" + } + ], + "name": "approve", + "outputs": [ + { + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "totalSupply", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "_from", + "type": "address" + }, + { + "name": "_to", + "type": "address" + }, + { + "name": "_value", + "type": "uint256" + } + ], + "name": "transferFrom", + "outputs": [ + { + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "decimals", + "outputs": [ + { + "name": "", + "type": "uint8" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "_owner", + "type": "address" + } + ], + "name": "balanceOf", + "outputs": [ + { + "name": "balance", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "symbol", + "outputs": [ + { + "name": "", + "type": "string" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "_to", + "type": "address" + }, + { + "name": "_value", + "type": "uint256" + } + ], + "name": "transfer", + "outputs": [ + { + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "_owner", + "type": "address" + }, + { + "name": "_spender", + "type": "address" + } + ], + "name": "allowance", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "payable": true, + "stateMutability": "payable", + "type": "fallback" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "name": "spender", + "type": "address" + }, + { + "indexed": false, + "name": "value", + "type": "uint256" + } + ], + "name": "Approval", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "name": "from", + "type": "address" + }, + { + "indexed": true, + "name": "to", + "type": "address" + }, + { + "indexed": false, + "name": "value", + "type": "uint256" + } + ], + "name": "Transfer", + "type": "event" + } +] diff --git a/common/ethereum_contract/paymaster_abi/erc721_abi.json b/common/ethereum_contract/paymaster_abi/erc721_abi.json new file mode 100644 index 00000000..d1f6e37a --- /dev/null +++ b/common/ethereum_contract/paymaster_abi/erc721_abi.json @@ -0,0 +1,332 @@ +[ + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "approved", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "Approval", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "indexed": false, + "internalType": "bool", + "name": "approved", + "type": "bool" + } + ], + "name": "ApprovalForAll", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "Transfer", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "approve", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "balanceOf", + "outputs": [ + { + "internalType": "uint256", + "name": "balance", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "getApproved", + "outputs": [ + { + "internalType": "address", + "name": "operator", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "address", + "name": "operator", + "type": "address" + } + ], + "name": "isApprovedForAll", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "name", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "ownerOf", + "outputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "safeTransferFrom", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "safeTransferFrom", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "internalType": "bool", + "name": "_approved", + "type": "bool" + } + ], + "name": "setApprovalForAll", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "interfaceId", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "symbol", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "tokenURI", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "transferFrom", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } +] diff --git a/common/ethereum_contract/paymaster_abi/l1_gas_oracle_abi.json b/common/ethereum_contract/paymaster_abi/l1_gas_oracle_abi.json new file mode 100644 index 00000000..fdc2e6f4 --- /dev/null +++ b/common/ethereum_contract/paymaster_abi/l1_gas_oracle_abi.json @@ -0,0 +1,289 @@ +[ + { + "inputs": [ + { + "internalType": "address", + "name": "_owner", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "l1BaseFee", + "type": "uint256" + } + ], + "name": "L1BaseFeeUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "overhead", + "type": "uint256" + } + ], + "name": "OverheadUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "_oldOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "_newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "scalar", + "type": "uint256" + } + ], + "name": "ScalarUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "_oldWhitelist", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "_newWhitelist", + "type": "address" + } + ], + "name": "UpdateWhitelist", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "_data", + "type": "bytes" + } + ], + "name": "getL1Fee", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "_data", + "type": "bytes" + } + ], + "name": "getL1GasUsed", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + + ], + "name": "l1BaseFee", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + + ], + "name": "overhead", + "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": "renounceOwnership", + "outputs": [ + + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + + ], + "name": "scalar", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_l1BaseFee", + "type": "uint256" + } + ], + "name": "setL1BaseFee", + "outputs": [ + + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_overhead", + "type": "uint256" + } + ], + "name": "setOverhead", + "outputs": [ + + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_scalar", + "type": "uint256" + } + ], + "name": "setScalar", + "outputs": [ + + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [ + + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_newWhitelist", + "type": "address" + } + ], + "name": "updateWhitelist", + "outputs": [ + + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + + ], + "name": "whitelist", + "outputs": [ + { + "internalType": "contract IWhitelist", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + } +] diff --git a/common/ethereum_contract/paymaster_abi/simulate_entrypoint_abi.json b/common/ethereum_contract/paymaster_abi/simulate_entrypoint_abi.json new file mode 100644 index 00000000..6ef51f5e --- /dev/null +++ b/common/ethereum_contract/paymaster_abi/simulate_entrypoint_abi.json @@ -0,0 +1,1312 @@ +[ + { + "inputs": [], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [ + { + "internalType": "bool", + "name": "success", + "type": "bool" + }, + { + "internalType": "bytes", + "name": "ret", + "type": "bytes" + } + ], + "name": "DelegateAndRevert", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "opIndex", + "type": "uint256" + }, + { + "internalType": "string", + "name": "reason", + "type": "string" + } + ], + "name": "FailedOp", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "opIndex", + "type": "uint256" + }, + { + "internalType": "string", + "name": "reason", + "type": "string" + }, + { + "internalType": "bytes", + "name": "inner", + "type": "bytes" + } + ], + "name": "FailedOpWithRevert", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "returnData", + "type": "bytes" + } + ], + "name": "PostOpReverted", + "type": "error" + }, + { + "inputs": [], + "name": "ReentrancyGuardReentrantCall", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "sender", + "type": "address" + } + ], + "name": "SenderAddressResult", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "aggregator", + "type": "address" + } + ], + "name": "SignatureValidationFailed", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "userOpHash", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "factory", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "paymaster", + "type": "address" + } + ], + "name": "AccountDeployed", + "type": "event" + }, + { + "anonymous": false, + "inputs": [], + "name": "BeforeExecution", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "totalDeposit", + "type": "uint256" + } + ], + "name": "Deposited", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "userOpHash", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "nonce", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "revertReason", + "type": "bytes" + } + ], + "name": "PostOpRevertReason", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "aggregator", + "type": "address" + } + ], + "name": "SignatureAggregatorChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "totalStaked", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "unstakeDelaySec", + "type": "uint256" + } + ], + "name": "StakeLocked", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "withdrawTime", + "type": "uint256" + } + ], + "name": "StakeUnlocked", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "withdrawAddress", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "StakeWithdrawn", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "userOpHash", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "paymaster", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "nonce", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bool", + "name": "success", + "type": "bool" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "actualGasCost", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "actualGasUsed", + "type": "uint256" + } + ], + "name": "UserOperationEvent", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "userOpHash", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "nonce", + "type": "uint256" + } + ], + "name": "UserOperationPrefundTooLow", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "userOpHash", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "nonce", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "revertReason", + "type": "bytes" + } + ], + "name": "UserOperationRevertReason", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "withdrawAddress", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "Withdrawn", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "initCode", + "type": "bytes" + }, + { + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "internalType": "bytes", + "name": "paymasterAndData", + "type": "bytes" + } + ], + "name": "_validateSenderAndPaymaster", + "outputs": [], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint32", + "name": "unstakeDelaySec", + "type": "uint32" + } + ], + "name": "addStake", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "balanceOf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "target", + "type": "address" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "delegateAndRevert", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "depositTo", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "deposits", + "outputs": [ + { + "internalType": "uint256", + "name": "deposit", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "staked", + "type": "bool" + }, + { + "internalType": "uint112", + "name": "stake", + "type": "uint112" + }, + { + "internalType": "uint32", + "name": "unstakeDelaySec", + "type": "uint32" + }, + { + "internalType": "uint48", + "name": "withdrawTime", + "type": "uint48" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "getDepositInfo", + "outputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "deposit", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "staked", + "type": "bool" + }, + { + "internalType": "uint112", + "name": "stake", + "type": "uint112" + }, + { + "internalType": "uint32", + "name": "unstakeDelaySec", + "type": "uint32" + }, + { + "internalType": "uint48", + "name": "withdrawTime", + "type": "uint48" + } + ], + "internalType": "struct IStakeManager.DepositInfo", + "name": "info", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "internalType": "uint192", + "name": "key", + "type": "uint192" + } + ], + "name": "getNonce", + "outputs": [ + { + "internalType": "uint256", + "name": "nonce", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "initCode", + "type": "bytes" + } + ], + "name": "getSenderAddress", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "nonce", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "initCode", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "callData", + "type": "bytes" + }, + { + "internalType": "bytes32", + "name": "accountGasLimits", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "preVerificationGas", + "type": "uint256" + }, + { + "internalType": "bytes32", + "name": "gasFees", + "type": "bytes32" + }, + { + "internalType": "bytes", + "name": "paymasterAndData", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "signature", + "type": "bytes" + } + ], + "internalType": "struct PackedUserOperation", + "name": "userOp", + "type": "tuple" + } + ], + "name": "getUserOpHash", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "components": [ + { + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "nonce", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "initCode", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "callData", + "type": "bytes" + }, + { + "internalType": "bytes32", + "name": "accountGasLimits", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "preVerificationGas", + "type": "uint256" + }, + { + "internalType": "bytes32", + "name": "gasFees", + "type": "bytes32" + }, + { + "internalType": "bytes", + "name": "paymasterAndData", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "signature", + "type": "bytes" + } + ], + "internalType": "struct PackedUserOperation[]", + "name": "userOps", + "type": "tuple[]" + }, + { + "internalType": "contract IAggregator", + "name": "aggregator", + "type": "address" + }, + { + "internalType": "bytes", + "name": "signature", + "type": "bytes" + } + ], + "internalType": "struct IEntryPoint.UserOpsPerAggregator[]", + "name": "opsPerAggregator", + "type": "tuple[]" + }, + { + "internalType": "address payable", + "name": "beneficiary", + "type": "address" + } + ], + "name": "handleAggregatedOps", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "nonce", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "initCode", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "callData", + "type": "bytes" + }, + { + "internalType": "bytes32", + "name": "accountGasLimits", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "preVerificationGas", + "type": "uint256" + }, + { + "internalType": "bytes32", + "name": "gasFees", + "type": "bytes32" + }, + { + "internalType": "bytes", + "name": "paymasterAndData", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "signature", + "type": "bytes" + } + ], + "internalType": "struct PackedUserOperation[]", + "name": "ops", + "type": "tuple[]" + }, + { + "internalType": "address payable", + "name": "beneficiary", + "type": "address" + } + ], + "name": "handleOps", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint192", + "name": "key", + "type": "uint192" + } + ], + "name": "incrementNonce", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "callData", + "type": "bytes" + }, + { + "components": [ + { + "components": [ + { + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "nonce", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "verificationGasLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "callGasLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "paymasterVerificationGasLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "paymasterPostOpGasLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "preVerificationGas", + "type": "uint256" + }, + { + "internalType": "address", + "name": "paymaster", + "type": "address" + }, + { + "internalType": "uint256", + "name": "maxFeePerGas", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "maxPriorityFeePerGas", + "type": "uint256" + } + ], + "internalType": "struct EntryPoint.MemoryUserOp", + "name": "mUserOp", + "type": "tuple" + }, + { + "internalType": "bytes32", + "name": "userOpHash", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "prefund", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "contextOffset", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "preOpGas", + "type": "uint256" + } + ], + "internalType": "struct EntryPoint.UserOpInfo", + "name": "opInfo", + "type": "tuple" + }, + { + "internalType": "bytes", + "name": "context", + "type": "bytes" + } + ], + "name": "innerHandleOp", + "outputs": [ + { + "internalType": "uint256", + "name": "actualGasCost", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "uint192", + "name": "", + "type": "uint192" + } + ], + "name": "nonceSequenceNumber", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "nonce", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "initCode", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "callData", + "type": "bytes" + }, + { + "internalType": "bytes32", + "name": "accountGasLimits", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "preVerificationGas", + "type": "uint256" + }, + { + "internalType": "bytes32", + "name": "gasFees", + "type": "bytes32" + }, + { + "internalType": "bytes", + "name": "paymasterAndData", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "signature", + "type": "bytes" + } + ], + "internalType": "struct PackedUserOperation", + "name": "op", + "type": "tuple" + }, + { + "internalType": "address", + "name": "target", + "type": "address" + }, + { + "internalType": "bytes", + "name": "targetCallData", + "type": "bytes" + } + ], + "name": "simulateHandleOp", + "outputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "preOpGas", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "paid", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "accountValidationData", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "paymasterValidationData", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "targetSuccess", + "type": "bool" + }, + { + "internalType": "bytes", + "name": "targetResult", + "type": "bytes" + } + ], + "internalType": "struct IEntryPointSimulations.ExecutionResult", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "nonce", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "initCode", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "callData", + "type": "bytes" + }, + { + "internalType": "bytes32", + "name": "accountGasLimits", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "preVerificationGas", + "type": "uint256" + }, + { + "internalType": "bytes32", + "name": "gasFees", + "type": "bytes32" + }, + { + "internalType": "bytes", + "name": "paymasterAndData", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "signature", + "type": "bytes" + } + ], + "internalType": "struct PackedUserOperation", + "name": "userOp", + "type": "tuple" + } + ], + "name": "simulateValidation", + "outputs": [ + { + "components": [ + { + "components": [ + { + "internalType": "uint256", + "name": "preOpGas", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "prefund", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "accountValidationData", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "paymasterValidationData", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "paymasterContext", + "type": "bytes" + } + ], + "internalType": "struct IEntryPoint.ReturnInfo", + "name": "returnInfo", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "stake", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "unstakeDelaySec", + "type": "uint256" + } + ], + "internalType": "struct IStakeManager.StakeInfo", + "name": "senderInfo", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "stake", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "unstakeDelaySec", + "type": "uint256" + } + ], + "internalType": "struct IStakeManager.StakeInfo", + "name": "factoryInfo", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "stake", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "unstakeDelaySec", + "type": "uint256" + } + ], + "internalType": "struct IStakeManager.StakeInfo", + "name": "paymasterInfo", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "address", + "name": "aggregator", + "type": "address" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "stake", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "unstakeDelaySec", + "type": "uint256" + } + ], + "internalType": "struct IStakeManager.StakeInfo", + "name": "stakeInfo", + "type": "tuple" + } + ], + "internalType": "struct IEntryPoint.AggregatorStakeInfo", + "name": "aggregatorInfo", + "type": "tuple" + } + ], + "internalType": "struct IEntryPointSimulations.ValidationResult", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "interfaceId", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "unlockStake", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address payable", + "name": "withdrawAddress", + "type": "address" + } + ], + "name": "withdrawStake", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address payable", + "name": "withdrawAddress", + "type": "address" + }, + { + "internalType": "uint256", + "name": "withdrawAmount", + "type": "uint256" + } + ], + "name": "withdrawTo", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "stateMutability": "payable", + "type": "receive" + } +] diff --git a/common/ethereum_contract/paymaster_abi/v06_erc20_verifying_paymaster_abi.json b/common/ethereum_contract/paymaster_abi/v06_erc20_verifying_paymaster_abi.json new file mode 100644 index 00000000..515b2e35 --- /dev/null +++ b/common/ethereum_contract/paymaster_abi/v06_erc20_verifying_paymaster_abi.json @@ -0,0 +1,468 @@ +[ + { + "inputs": [ + { + "internalType": "contract IEntryPoint", + "name": "_entryPoint", + "type": "address" + }, + { + "internalType": "address", + "name": "_owner", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "inputs": [], + "name": "POST_OP_GAS", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint32", + "name": "unstakeDelaySec", + "type": "uint32" + } + ], + "name": "addStake", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [], + "name": "deposit", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [], + "name": "entryPoint", + "outputs": [ + { + "internalType": "contract IEntryPoint", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getDeposit", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "nonce", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "initCode", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "callData", + "type": "bytes" + }, + { + "internalType": "uint256", + "name": "callGasLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "verificationGasLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "preVerificationGas", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "maxFeePerGas", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "maxPriorityFeePerGas", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "paymasterAndData", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "signature", + "type": "bytes" + } + ], + "internalType": "struct UserOperation", + "name": "userOp", + "type": "tuple" + }, + { + "internalType": "uint48", + "name": "validUntil", + "type": "uint48" + }, + { + "internalType": "uint48", + "name": "validAfter", + "type": "uint48" + }, + { + "internalType": "address", + "name": "erc20Token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "exchangeRate", + "type": "uint256" + } + ], + "name": "getHash", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "paymasterAndData", + "type": "bytes" + } + ], + "name": "parsePaymasterAndData", + "outputs": [ + { + "internalType": "uint48", + "name": "validUntil", + "type": "uint48" + }, + { + "internalType": "uint48", + "name": "validAfter", + "type": "uint48" + }, + { + "internalType": "address", + "name": "erc20Token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "exchangeRate", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "signature", + "type": "bytes" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "enum IPaymaster.PostOpMode", + "name": "mode", + "type": "uint8" + }, + { + "internalType": "bytes", + "name": "context", + "type": "bytes" + }, + { + "internalType": "uint256", + "name": "actualGasCost", + "type": "uint256" + } + ], + "name": "postOp", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_vault", + "type": "address" + } + ], + "name": "setVault", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_verifier", + "type": "address" + } + ], + "name": "setVerifier", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "unlockStake", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "nonce", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "initCode", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "callData", + "type": "bytes" + }, + { + "internalType": "uint256", + "name": "callGasLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "verificationGasLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "preVerificationGas", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "maxFeePerGas", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "maxPriorityFeePerGas", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "paymasterAndData", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "signature", + "type": "bytes" + } + ], + "internalType": "struct UserOperation", + "name": "userOp", + "type": "tuple" + }, + { + "internalType": "bytes32", + "name": "userOpHash", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "maxCost", + "type": "uint256" + } + ], + "name": "validatePaymasterUserOp", + "outputs": [ + { + "internalType": "bytes", + "name": "context", + "type": "bytes" + }, + { + "internalType": "uint256", + "name": "validationData", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "vault", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "verifier", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address payable", + "name": "withdrawAddress", + "type": "address" + } + ], + "name": "withdrawStake", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address payable", + "name": "withdrawAddress", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "withdrawTo", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } +] diff --git a/common/ethereum_contract/paymaster_abi/v07_erc20_verifying_paymaster_abi.json b/common/ethereum_contract/paymaster_abi/v07_erc20_verifying_paymaster_abi.json new file mode 100644 index 00000000..56fb508e --- /dev/null +++ b/common/ethereum_contract/paymaster_abi/v07_erc20_verifying_paymaster_abi.json @@ -0,0 +1,540 @@ +[ + { + "inputs": [ + { + "internalType": "contract IEntryPoint", + "name": "_entryPoint", + "type": "address" + }, + { + "internalType": "address", + "name": "_owner", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "target", + "type": "address" + } + ], + "name": "AddressEmptyCode", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "AddressInsufficientBalance", + "type": "error" + }, + { + "inputs": [], + "name": "ECDSAInvalidSignature", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "length", + "type": "uint256" + } + ], + "name": "ECDSAInvalidSignatureLength", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "s", + "type": "bytes32" + } + ], + "name": "ECDSAInvalidSignatureS", + "type": "error" + }, + { + "inputs": [], + "name": "FailedInnerCall", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "OwnableInvalidOwner", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "OwnableUnauthorizedAccount", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "token", + "type": "address" + } + ], + "name": "SafeERC20FailedOperation", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "inputs": [], + "name": "POST_OP_GAS", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint32", + "name": "unstakeDelaySec", + "type": "uint32" + } + ], + "name": "addStake", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [], + "name": "deposit", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [], + "name": "entryPoint", + "outputs": [ + { + "internalType": "contract IEntryPoint", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getDeposit", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "nonce", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "initCode", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "callData", + "type": "bytes" + }, + { + "internalType": "bytes32", + "name": "accountGasLimits", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "preVerificationGas", + "type": "uint256" + }, + { + "internalType": "bytes32", + "name": "gasFees", + "type": "bytes32" + }, + { + "internalType": "bytes", + "name": "paymasterAndData", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "signature", + "type": "bytes" + } + ], + "internalType": "struct PackedUserOperation", + "name": "userOp", + "type": "tuple" + }, + { + "internalType": "uint48", + "name": "validUntil", + "type": "uint48" + }, + { + "internalType": "uint48", + "name": "validAfter", + "type": "uint48" + }, + { + "internalType": "address", + "name": "erc20Token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "exchangeRate", + "type": "uint256" + } + ], + "name": "getHash", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "paymasterAndData", + "type": "bytes" + } + ], + "name": "parsePaymasterAndData", + "outputs": [ + { + "internalType": "uint48", + "name": "validUntil", + "type": "uint48" + }, + { + "internalType": "uint48", + "name": "validAfter", + "type": "uint48" + }, + { + "internalType": "address", + "name": "erc20Token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "exchangeRate", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "signature", + "type": "bytes" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "enum IPaymaster.PostOpMode", + "name": "mode", + "type": "uint8" + }, + { + "internalType": "bytes", + "name": "context", + "type": "bytes" + }, + { + "internalType": "uint256", + "name": "actualGasCost", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "actualUserOpFeePerGas", + "type": "uint256" + } + ], + "name": "postOp", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_vault", + "type": "address" + } + ], + "name": "setVault", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_verifier", + "type": "address" + } + ], + "name": "setVerifier", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "unlockStake", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "nonce", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "initCode", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "callData", + "type": "bytes" + }, + { + "internalType": "bytes32", + "name": "accountGasLimits", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "preVerificationGas", + "type": "uint256" + }, + { + "internalType": "bytes32", + "name": "gasFees", + "type": "bytes32" + }, + { + "internalType": "bytes", + "name": "paymasterAndData", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "signature", + "type": "bytes" + } + ], + "internalType": "struct PackedUserOperation", + "name": "userOp", + "type": "tuple" + }, + { + "internalType": "bytes32", + "name": "userOpHash", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "maxCost", + "type": "uint256" + } + ], + "name": "validatePaymasterUserOp", + "outputs": [ + { + "internalType": "bytes", + "name": "context", + "type": "bytes" + }, + { + "internalType": "uint256", + "name": "validationData", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "vault", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "verifier", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address payable", + "name": "withdrawAddress", + "type": "address" + } + ], + "name": "withdrawStake", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address payable", + "name": "withdrawAddress", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "withdrawTo", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } +] diff --git a/common/global_const/basic_strategy_code.go b/common/global_const/basic_strategy_code.go new file mode 100644 index 00000000..36f4e65d --- /dev/null +++ b/common/global_const/basic_strategy_code.go @@ -0,0 +1,19 @@ +package global_const + +type BasicStrategyCode string + +const ( + StrategyCodeEthereumSepoliaV06Verify BasicStrategyCode = "Ethereum_Sepolia_v06_verifyPaymaster" + StrategyCodeOptimismSepoliaV06Verify BasicStrategyCode = "Optimism_Sepolia_v06_verifyPaymaster" + StrategyCodeArbitrumSepoliaV06Verify BasicStrategyCode = "Arbitrum_Sepolia_v06_verifyPaymaster" + StrategyCodeScrollSepoliaV06Verify BasicStrategyCode = "Scroll_Sepolia_v06_verifyPaymaster" + StrategyCodeBaseSepoliaV06Verify BasicStrategyCode = "Base_Sepolia_v06_verifyPaymaster" + + StrategyCodeEthereumSepoliaV06Erc20 BasicStrategyCode = "Ethereum_Sepolia_v06_erc20Paymaster" + StrategyCodeOptimismSepoliaV06Erc20 BasicStrategyCode = "Optimism_Sepolia_v06_erc20Paymaster" + StrategyCodeArbitrumSepoliaV06Erc20 BasicStrategyCode = "Arbitrum_Sepolia_v06_erc20Paymaster" + StrategyCodeScrollSepoliaV06Erc20 BasicStrategyCode = "Scroll_Sepolia_v06_erc20Paymaster" + StrategyCodeBaseSepoliaV06Erc20 BasicStrategyCode = "Base_Sepolia_v06_erc20Paymaster" + + StrategyCodeEthereumSepoliaV07Verify BasicStrategyCode = "Ethereum_Sepolia_v07_verifyPaymaster" +) diff --git a/common/global_const/common_const.go b/common/global_const/common_const.go new file mode 100644 index 00000000..97d2c421 --- /dev/null +++ b/common/global_const/common_const.go @@ -0,0 +1,92 @@ +package global_const + +import ( + "crypto/ecdsa" + "encoding/hex" + mapset "github.com/deckarep/golang-set/v2" + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/crypto" + "math/big" +) + +const ( + DummyPrivateKeyText = "0a82406dc7fcf16090e05215ff394c7465608dd1a698632471b1eb37b8ece2f7" + DummySignature = "0x3054659b5e29460a8f3ac9afc3d5fcbe4b76f92aed454b944e9b29e55d80fde807716530b739540e95cfa4880d69f710a9d45910f2951a227675dc1fb0fdf2c71c" + DummyPaymasterData = "0xd93349Ee959d295B115Ee223aF10EF432A8E8523000000000000000000000000000000000000000000000000000000001710044496000000000000000000000000000000000000000000000000000000174158049605bea0bfb8539016420e76749fda407b74d3d35c539927a45000156335643827672fa359ee968d72db12d4b4768e8323cd47443505ab138a525c1f61c6abdac501" + DummyInitCode = "0x9406cc6185a346906296840746125a0e449764545fbfb9cf000000000000000000000000b6bcf9517d193f551d0e3d6860103972dd13de7b0000000000000000000000000000000000000000000000000000000000000000" + DummyVerificationGas = 50000 + DummyPaymasterPostOpGasLimit = 2000000 + DummyPaymasterVerificationGasLimit = 5000000 +) + +var ( + EthWeiFactor = new(big.Float).SetInt(big.NewInt(1e18)) + DummySignatureByte []byte + DummyInitCodeByte []byte + DummyReverificationsBigint = big.NewInt(DummyVerificationGas) + DummyPaymasterOversimplificationBigint = big.NewInt(DummyPaymasterVerificationGasLimit) + DummyPaymasterPostoperativelyBigint = big.NewInt(DummyPaymasterPostOpGasLimit) + ThreeBigint = big.NewInt(3) + HundredBigint = big.NewInt(100) + TwoBigint = big.NewInt(2) + HundredPlusOneBigint = big.NewInt(110) + DummyPrivateKey *ecdsa.PrivateKey + DummyAddress common.Address + DummyPaymasterDataByte []byte + DummyMaxFeePerGas = big.NewInt(1500012654) + DummyMaxPriorityFeePerGas = big.NewInt(1500000000) + DummyCallGasLimit = big.NewInt(21754) + DummyVerificationGasLimit = big.NewInt(391733) + EmptyAddress = common.HexToAddress("0x0000000000000000000000000000000000000000") + GitHubActionWhiteListSet = mapset.NewSet( + "Test_EthereumSepoliaV06Erc20_TryPayUserOpExecute", "Test_ArbSepoliaV06Erc20_TryPayUserOpExecute", "Test_OpSepoliaV06Erc20_TryPayUserOpExecute", "testGetAddressTokenBalance", "Test_EthereumSepoliaV06Verify_TryPayUserOpExecute", "Test_OptimismSepoliaV06Verify_TryPayUserOpExecute", "Test_BaseSepoliaV06Verify_TryPayUserOpExecute", + "Test_ArbitrumSpeoliaV06Verify_TryPayUserOpExecute", "Test_ScrollSepoliaV06Verify_TryPayUserOpExecute") +) + +func init() { + privateKey, err := crypto.HexToECDSA(DummyPrivateKeyText) + if err != nil { + panic(err) + } + DummyPrivateKey = privateKey + address := crypto.PubkeyToAddress(DummyPrivateKey.PublicKey) + DummyAddress = address + DummyPaymasterDataByte, err = hex.DecodeString(DummyPaymasterData[2:]) + if err != nil { + panic(err) + } + DummyInitCodeByte, err = hex.DecodeString(DummyInitCode[2:]) + if err != nil { + panic(err) + } + signatureByte, err := hex.DecodeString(DummySignature[2:]) + if err != nil { + panic(err) + } + DummySignatureByte = signatureByte +} + +var GasOverHand = struct { + //fixed overhead for entire handleOp bundle. + Fixed float64 + //per userOp overhead, added on top of the above fixed per-bundle + PerUserOp float64 + //overhead for userOp word (32 bytes) block + PerUserOpWord float64 + //zero byte cost, for callData gas cost calculations + ZeroByte float64 + //non-zero byte cost, for callData gas cost calculations + NonZeroByte float64 + //expected bundle size, to split per-bundle overhead between all ops. + BundleSize float64 + //expected length of the userOp signature. + sigSize float64 +}{ + Fixed: 21000, + PerUserOp: 18300, + PerUserOpWord: 4, + ZeroByte: 4, + NonZeroByte: 16, + BundleSize: 1, + sigSize: 65, +} diff --git a/common/types/currency.go b/common/global_const/currency.go similarity index 72% rename from common/types/currency.go rename to common/global_const/currency.go index efb4511b..6dde851a 100644 --- a/common/types/currency.go +++ b/common/global_const/currency.go @@ -1,4 +1,4 @@ -package types +package global_const type Currency string diff --git a/common/global_const/entrypoint_tag.go b/common/global_const/entrypoint_tag.go new file mode 100644 index 00000000..4ffd7f99 --- /dev/null +++ b/common/global_const/entrypoint_tag.go @@ -0,0 +1,8 @@ +package global_const + +type EntrypointVersion string + +const ( + EntrypointV06 EntrypointVersion = "v0.6" + EntrypointV07 EntrypointVersion = "v0.7" +) diff --git a/common/global_const/eoa.go b/common/global_const/eoa.go new file mode 100644 index 00000000..006cb9b7 --- /dev/null +++ b/common/global_const/eoa.go @@ -0,0 +1,32 @@ +package global_const + +import ( + "crypto/ecdsa" + "errors" + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/crypto" +) + +type EOA struct { + PrivateKey *ecdsa.PrivateKey + PublicKey *ecdsa.PublicKey + Address common.Address +} + +func NewEoa(pk string) (*EOA, error) { + privateKey, err := crypto.HexToECDSA(pk) + if err != nil { + return nil, err + } + publicKey, ok := privateKey.Public().(*ecdsa.PublicKey) + if !ok { + return nil, errors.New("cannot assert type: publicKey is not of type *ecdsa.PublicKey") + } + address := crypto.PubkeyToAddress(*publicKey) + + return &EOA{ + PrivateKey: privateKey, + PublicKey: publicKey, + Address: address, + }, nil +} diff --git a/common/global_const/network.go b/common/global_const/network.go new file mode 100644 index 00000000..58a0b1b9 --- /dev/null +++ b/common/global_const/network.go @@ -0,0 +1,33 @@ +package global_const + +type NetworkInfo struct { + Name string `json:"main_net_name"` + RpcUrl string `json:"main_net_rpc_url"` + GasToken TokenType `json:"gas_token"` +} + +type Network string + +const ( + EthereumMainnet Network = "ethereum-mainnet" + EthereumSepolia Network = "ethereum-sepolia" + OptimismMainnet Network = "optimism-mainnet" + OptimismSepolia Network = "optimism-sepolia" + ArbitrumOne Network = "arbitrum-one" + ArbitrumNova Network = "arbitrum-nova" + ArbitrumSpeolia Network = "arbitrum-sepolia" + ScrollMainnet Network = "scroll-mainnet" + ScrollSepolia Network = "scroll-sepolia" + StarketMainnet Network = "starknet-mainnet" + StarketSepolia Network = "starknet-sepolia" + BaseMainnet Network = "base-mainnet" + BaseSepolia Network = "base-sepolia" +) + +type NewWorkStack string + +const ( + OpStack NewWorkStack = "opstack" + ArbStack NewWorkStack = "arbstack" + DefaultStack NewWorkStack = "default" +) diff --git a/common/global_const/pay_type.go b/common/global_const/pay_type.go new file mode 100644 index 00000000..46228e12 --- /dev/null +++ b/common/global_const/pay_type.go @@ -0,0 +1,9 @@ +package global_const + +type PayType string + +const ( + PayTypeVerifying PayType = "PayTypeVerifying" + PayTypeERC20 PayType = "PayTypeERC20" + PayTypeSuperVerifying PayType = "PayTypeSuperVerifying" +) diff --git a/common/global_const/token.go b/common/global_const/token.go new file mode 100644 index 00000000..69ab4fd6 --- /dev/null +++ b/common/global_const/token.go @@ -0,0 +1,29 @@ +package global_const + +import ( + mapset "github.com/deckarep/golang-set/v2" +) + +type TokenType string + +var StableCoinSet mapset.Set[TokenType] + +//var StableCoinMap map[TokenType]bool + +func init() { + StableCoinSet = mapset.NewSet[TokenType]() + StableCoinSet.Add(TokenTypeUSDT) + StableCoinSet.Add(TokenTypeUSDC) + +} +func IsStableToken(token TokenType) bool { + return StableCoinSet.Contains(token) + +} + +const ( + TokenTypeUSDT TokenType = "USDT" + TokenTypeUSDC TokenType = "USDC" + TokenTypeETH TokenType = "ETH" + TokenTypeOP TokenType = "OP" +) diff --git a/common/model/api_request.go b/common/model/api_request.go index 29a1c2f2..b068f33b 100644 --- a/common/model/api_request.go +++ b/common/model/api_request.go @@ -1,38 +1,25 @@ package model import ( - "AAStarCommunity/EthPaymaster_BackService/common/types" - "errors" + "AAStarCommunity/EthPaymaster_BackService/common/global_const" ) -type TryPayUserOpRequest struct { - ForceStrategyId string `json:"force_strategy_id"` - ForceNetwork types.NetWork `json:"force_network"` - ForceToken string `json:"force_token"` - ForceEntryPointAddress string `json:"force_entrypoint_address"` - UserOperation UserOperationItem `json:"user_operation"` - Extra interface{} `json:"extra"` +type UserOpRequest struct { + ForceStrategyId string `json:"force_strategy_id"` + ForceNetwork global_const.Network `json:"force_network"` + Erc20Token global_const.TokenType `json:"force_token"` + ForceEntryPointAddress string `json:"force_entrypoint_address"` + UserOp map[string]any `json:"user_operation"` + Extra interface{} `json:"extra"` + EstimateOpGas bool `json:"estimate_op_gas"` + EntryPointVersion global_const.EntrypointVersion `json:"entrypoint_version"` } - -func (request *TryPayUserOpRequest) Validate() error { - if len(request.ForceStrategyId) == 0 { - if len(request.ForceNetwork) == 0 || len(request.ForceToken) == 0 || len(request.ForceEntryPointAddress) == 0 { - return errors.New("strategy configuration illegal") - } - } - return nil -} - -type GetSupportEntrypointRequest struct { -} - -func (request *GetSupportEntrypointRequest) Validate() error { - return nil -} - -type GetSupportStrategyRequest struct { +type JsonRpcRequest struct { + JsonRpc string `json:"jsonrpc"` + Method string `json:"method"` + Params []interface{} `json:"params"` + Id int `json:"id"` } - -func (request *GetSupportStrategyRequest) Validate() error { - return nil +type ClientCredential struct { + ApiKey string `json:"apiKey"` } diff --git a/common/model/api_response.go b/common/model/api_response.go index 4a361925..f60390f7 100644 --- a/common/model/api_response.go +++ b/common/model/api_response.go @@ -1,30 +1,69 @@ package model import ( - "AAStarCommunity/EthPaymaster_BackService/common/types" + "AAStarCommunity/EthPaymaster_BackService/common/global_const" "math/big" ) type TryPayUserOpResponse struct { - StrategyId string `json:"strategy_id"` - EntryPointAddress string `json:"entrypoint_address"` - PayMasterAddress string `json:"paymaster_address"` - PayMasterSignature string `json:"paymaster_signature"` - PayReceipt *PayReceipt `json:"pay_receipt"` - GasInfo *ComputeGasResponse `json:"gas_info"` + StrategyId string `json:"strategyId"` + NetWork global_const.Network `json:"network"` + EntrypointVersion global_const.EntrypointVersion `json:"entrypointVersion"` + EntryPointAddress string `json:"entrypointAddress"` + PayMasterAddress string `json:"paymasterAddress"` + Erc20TokenCost *big.Float `json:"Erc20TokenCost"` + UserOpResponse *UserOpResponse `json:"userOpResponse"` +} +type UserOpResponse struct { + PayMasterAndData string `json:"paymasterAndData"` + PreVerificationGas *big.Int `json:"preVerificationGas"` + VerificationGasLimit *big.Int `json:"verificationGasLimit"` + CallGasLimit *big.Int `json:"callGasLimit"` + MaxFeePerGas *big.Int `json:"maxFeePerGas"` + MaxPriorityFeePerGas *big.Int `json:"maxPriorityFeePerGas"` + //v0.7 + AccountGasLimit string `json:"accountGasLimit" binding:"required"` + PaymasterVerificationGasLimit *big.Int `json:"paymasterVerificationGasLimit" binding:"required"` + PaymasterPostOpGasLimit *big.Int `json:"paymasterPostOpGasLimit" binding:"required"` + GasFees string `json:"gasFees" binding:"required"` } type ComputeGasResponse struct { - GasPriceInWei uint64 `json:"gas_price_wei"` // wei - GasPriceInGwei *big.Float `json:"gas_price_gwei"` - GasPriceInEther string `json:"gas_price_ether"` - TokenCost string `json:"token_cost"` - Network types.NetWork `json:"network"` - Token types.TokenType `json:"token"` - UsdCost string `json:"usd_cost"` - BlobEnable bool `json:"blob_enable"` + Erc20TokenCost *big.Float `json:"Erc20TokenCost"` + OpEstimateGas *UserOpEstimateGas `json:"opEstimateGas"` + TotalGasDetail *TotalGasDetail `json:"totalGasDetail"` +} +type UserOpEstimateGas struct { + //common + PreVerificationGas *big.Int `json:"preVerificationGas"` + + BaseFee *big.Int `json:"baseFee"` + //v0.6 + VerificationGasLimit *big.Int `json:"verificationGasLimit"` + CallGasLimit *big.Int `json:"callGasLimit"` + MaxFeePerGas *big.Int `json:"maxFeePerGas"` + MaxPriorityFeePerGas *big.Int `json:"maxPriorityFeePerGas"` + //v0.7 + AccountGasLimit *[32]byte `json:"accountGasLimit" binding:"required"` + PaymasterVerificationGasLimit *big.Int `json:"paymasterVerificationGasLimit" binding:"required"` + PaymasterPostOpGasLimit *big.Int `json:"paymasterPostOpGasLimit" binding:"required"` + GasFees *[32]byte `json:"gasFees" binding:"required"` } type PayReceipt struct { TransactionHash string `json:"transaction_hash"` Sponsor string `json:"sponsor"` } + +type GetSupportEntryPointResponse struct { + EntrypointDomains *[]EntrypointDomain `json:"entrypoints"` +} +type EntrypointDomain struct { + Address string `json:"address"` + Desc string `json:"desc"` + NetWork global_const.Network `json:"network"` + StrategyId string `json:"strategy_id"` +} + +type GetSupportStrategyResponse struct { + Strategies *[]Strategy `json:"strategies"` +} diff --git a/common/model/client_credential.go b/common/model/client_credential.go deleted file mode 100644 index b38ab8ff..00000000 --- a/common/model/client_credential.go +++ /dev/null @@ -1,5 +0,0 @@ -package model - -type ClientCredential struct { - ApiKey string `json:"apiKey"` -} diff --git a/common/model/env.go b/common/model/env.go new file mode 100644 index 00000000..83444ec6 --- /dev/null +++ b/common/model/env.go @@ -0,0 +1,26 @@ +package model + +import ( + "strings" +) + +const EnvKey = "Env" +const ProdEnv = "prod" +const DevEnv = "dev" + +type Env struct { + Name string // env Name, like `prod`, `dev` and etc., + Debugger bool // whether to use debugger +} + +func (env *Env) IsDevelopment() bool { + return strings.EqualFold(DevEnv, env.Name) +} + +func (env *Env) IsProduction() bool { + return strings.EqualFold(ProdEnv, env.Name) +} + +func (env *Env) GetEnvName() *string { + return &env.Name +} diff --git a/common/model/gas.go b/common/model/gas.go new file mode 100644 index 00000000..e70b7ce2 --- /dev/null +++ b/common/model/gas.go @@ -0,0 +1,75 @@ +package model + +import ( + "AAStarCommunity/EthPaymaster_BackService/common/user_op" + "encoding/hex" + "math/big" +) + +var ( + MockSimulateHandleOpResult = &SimulateHandleOpResult{ + PreOpGas: big.NewInt(374992), + GasPaid: big.NewInt(595492500000000), + ValidAfter: big.NewInt(1710044496), + ValidUntil: big.NewInt(1820044496), + TargetSuccess: false, + TargetResult: nil, + } + MockGasPrice = &GasPrice{ + MaxFeePerGas: big.NewInt(2053608903), + MaxPriorityFeePerGas: big.NewInt(1000000000), + BaseFee: big.NewInt(1053608903), + } + MockGasPriceNotSupport1559 = &GasPrice{ + MaxFeePerGas: big.NewInt(2053608903), + MaxPriorityFeePerGas: big.NewInt(2053608903), + BaseFee: big.NewInt(0), + } +) + +func init() { + callDatStr := "0xd6383f940000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004e0000000000000000000000000ffdb071c2b58ccc10ad386f9bb4e8d3d664ce73c0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000016000000000000000000000000000000000000000000000000000000000000001e000000000000000000000000000000000000000000000000000000000000054fa000000000000000000000000000000000000000000000000000000000005fa35000000000000000000000000000000000000000000000000000000000000ae64000000000000000000000000000000000000000000000000000000005968606e0000000000000000000000000000000000000000000000000000000059682f000000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000589406cc6185a346906296840746125a0e449764545fbfb9cf000000000000000000000000b6bcf9517d193f551d0e3d6860103972dd13de7b0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e4b61d27f60000000000000000000000001c7d4b196cb0c7b01d743fbc6116a902379c7238000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000044095ea7b30000000000000000000000000000000000325602a77416a16136fdafd04b299fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000d5f2147ca7f18e8014b76e1a98baffc96ebb90a29f000000000000000000000000000000000000000000000000000000006c7bacd00000000000000000000000000000000000000000000000000000000065ed355000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000b5912d105cd6fcaed224191994d34ebbb68eec23ae9a431782b465cba3b0da3751fbbf9603de6ea56b42f1d5952a22d9826d71238165c3c75512952f016279de1b00000000000000000000000000000000000000000000000000000000000000000000000000000000000041aa846693598194980f3bf50486be854704534c1622d0c2ee895a5a1ebe1508221909a27cc7971d9f522c8df13b9d8a6ee446d09ea7635f31c59d77d35d1281421c000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + callDataByte, _ := hex.DecodeString(callDatStr[2:]) + MockSimulateHandleOpResult.SimulateUserOpCallData = callDataByte +} + +type TotalGasDetail struct { + MaxTxGasLimit *big.Int + MaxTxGasCostGwei *big.Float + MaxTxGasCostInEther *big.Float + GasPriceGwei *big.Float +} + +type GasPrice struct { + MaxFeePerGas *big.Int `json:"max_base_price_wei"` + //MaxBasePriceGwei float64 `json:"max_base_price_gwei"` + //MaxBasePriceEther *big.Float `json:"max_base_price_ether"` + MaxPriorityFeePerGas *big.Int `json:"max_priority_price_wei"` + //MaxPriorityPriceGwei float64 `json:"max_priority_price_gwei"` + //MaxPriorityPriceEther *big.Float `json:"max_priority_price_ether"` + BaseFee *big.Int `json:"base_fee"` +} +type SimulateHandleOpResult struct { + // PreOpGas = preGas - gasleft() + userOp.preVerificationGas; + // PreOpGas = verificationGasLimit + userOp.preVerificationGas; + PreOpGas *big.Int `json:"preOpGas"` + GasPaid *big.Int `json:"paid"` + ValidAfter *big.Int `json:"validAfter"` + ValidUntil *big.Int `json:"validUntil"` + TargetSuccess bool + TargetResult []byte + SimulateGasPrice *big.Int + SimulateUserOpCallData []byte +} + +type GasFeePerGasResult struct { + MaxFeePerGas *big.Int + MaxPriorityFeePerGas *big.Int + BaseFee *big.Int +} +type PreVerificationGasEstimateInput struct { + Strategy *Strategy + Op *user_op.UserOpInput + SimulateOpResult *SimulateHandleOpResult + GasFeeResult *GasPrice +} diff --git a/common/model/secret_config.go b/common/model/secret_config.go new file mode 100644 index 00000000..cf7c7542 --- /dev/null +++ b/common/model/secret_config.go @@ -0,0 +1,12 @@ +package model + +type SecretConfig struct { + PriceOracleApiKey string `json:"price_oracle_api_key"` + + NetWorkSecretConfigMap map[string]NetWorkSecretConfig `json:"network_secret_configs"` +} + +type NetWorkSecretConfig struct { + RpcUrl string `json:"rpc_url"` + SignerKey string `json:"signer_key"` +} diff --git a/common/model/strategy.go b/common/model/strategy.go index a86516c0..80f761f3 100644 --- a/common/model/strategy.go +++ b/common/model/strategy.go @@ -1,28 +1,69 @@ package model -import "AAStarCommunity/EthPaymaster_BackService/common/types" +import ( + "AAStarCommunity/EthPaymaster_BackService/common/global_const" + mapset "github.com/deckarep/golang-set/v2" + "github.com/ethereum/go-ethereum/common" + "math/big" +) type Strategy struct { Id string `json:"id"` - EntryPointAddress string `json:"entrypoint_address"` - PayMasterAddress string `json:"paymaster_address"` - NetWork types.NetWork `json:"network"` - Token types.TokenType `json:"token"` + StrategyCode string `json:"strategy_code"` + PaymasterInfo *PaymasterInfo `json:"paymaster_info"` + NetWorkInfo *NetWorkInfo `json:"network_info"` + EntryPointInfo *EntryPointInfo `json:"entrypoint_info"` Description string `json:"description"` ExecuteRestriction StrategyExecuteRestriction `json:"execute_restriction"` - EnableEoa bool `json:"enable_eoa"` - Enable7560 bool `json:"enable_7560"` - EnableErc20 bool `json:"enable_erc20"` - Enable4844 bool `json:"enable_4844"` - EnableCurrency bool `json:"enable_currency"` + Erc20TokenType global_const.TokenType } +type PaymasterInfo struct { + PayMasterAddress *common.Address `json:"paymaster_address"` + PayType global_const.PayType `json:"pay_type"` +} +type NetWorkInfo struct { + NetWork global_const.Network `json:"network"` + Token global_const.TokenType `json:"tokens"` +} +type EntryPointInfo struct { + EntryPointAddress *common.Address `json:"entrypoint_address"` + EntryPointVersion global_const.EntrypointVersion `json:"entrypoint_version"` +} + +func (strategy *Strategy) GetPaymasterAddress() *common.Address { + return strategy.PaymasterInfo.PayMasterAddress +} +func (strategy *Strategy) GetEntryPointAddress() *common.Address { + return strategy.EntryPointInfo.EntryPointAddress +} +func (strategy *Strategy) GetNewWork() global_const.Network { + return strategy.NetWorkInfo.NetWork +} + +func (strategy *Strategy) GetUseToken() global_const.TokenType { + return strategy.NetWorkInfo.Token +} +func (strategy *Strategy) GetPayType() global_const.PayType { + return strategy.PaymasterInfo.PayType +} +func (strategy *Strategy) GetStrategyEntrypointVersion() global_const.EntrypointVersion { + return strategy.EntryPointInfo.EntryPointVersion +} +func (strategy Strategy) IsCurrencyPayEnable() bool { + return false +} + type StrategyExecuteRestriction struct { - BanSenderAddress string `json:"ban_sender_address"` - EffectiveStartTime int64 `json:"effective_start_time"` - EffectiveEndTime int64 `json:"effective_end_time"` - GlobalMaxUSD int64 `json:"global_max_usd"` - GlobalMaxOpCount int64 `json:"global_max_op_count"` - DayMaxUSD int64 `json:"day_max_usd"` + BanSenderAddress string `json:"ban_sender_address"` + EffectiveStartTime *big.Int `json:"effective_start_time"` + EffectiveEndTime *big.Int `json:"effective_end_time"` + GlobalMaxUSD int64 `json:"global_max_usd"` + GlobalMaxOpCount int64 `json:"global_max_op_count"` + DayMaxUSD int64 `json:"day_max_usd"` + StartTime int64 `json:"start_time"` + EndTime int64 `json:"end_time"` + AccessProject mapset.Set[string] `json:"access_project"` + AccessErc20 mapset.Set[string] `json:"access_erc20"` } type StrategyValidateConfig struct { diff --git a/common/model/user_operation.go b/common/model/user_operation.go deleted file mode 100644 index c1fb22b5..00000000 --- a/common/model/user_operation.go +++ /dev/null @@ -1,15 +0,0 @@ -package model - -type UserOperationItem struct { - Sender string `json:"sender" binding:"required"` - Nonce string `json:"nonce" binding:"required"` - InitCode string `json:"init_code"` - CallData string `json:"call_data" binding:"required"` - CallGasLimit string `json:"call_gas_limit" binding:"required"` - VerificationGasList string `json:"verification_gas_list" binding:"required"` - PreVerificationGas string `json:"per_verification_gas" binding:"required"` - MaxFeePerGas string `json:"max_fee_per_gas" binding:"required"` - MaxPriorityFeePerGas string `json:"max_priority_fee_per_gas" binding:"required"` - Signature string `json:"signature"` - //paymasterAndData string `json:"paymaster_and_data"` -} diff --git a/common/network/arbitrum/arbitrum_test.go b/common/network/arbitrum/arbitrum_test.go new file mode 100644 index 00000000..6eeeb84e --- /dev/null +++ b/common/network/arbitrum/arbitrum_test.go @@ -0,0 +1,40 @@ +package arbitrum + +import ( + "AAStarCommunity/EthPaymaster_BackService/common/model" + "AAStarCommunity/EthPaymaster_BackService/common/network" + "AAStarCommunity/EthPaymaster_BackService/common/user_op" + "AAStarCommunity/EthPaymaster_BackService/common/utils" + "AAStarCommunity/EthPaymaster_BackService/config" + "encoding/json" + "testing" +) + +func TestGetArbitrumGas(t *testing.T) { + if testing.Short() { + t.Skip("skipping test in short mode.") + } + config.InitConfig("../../../config/basic_strategy_config.json", "../../../config/basic_config.json", "../../../config/secret_config.json") + strategy := config.GetBasicStrategyConfig("Arbitrum_Sepolia_v06_verifyPaymaster") + if strategy == nil { + t.Error("strategy is nil") + } + op, err := user_op.NewUserOp(utils.GenerateMockUservOperation()) + if err != nil { + t.Error(err) + return + } + executor := network.GetEthereumExecutor(strategy.GetNewWork()) + gasOutPut, err := GetArbEstimateOutPut(executor.Client, &model.PreVerificationGasEstimateInput{ + Strategy: strategy, + Op: op, + GasFeeResult: &model.GasPrice{}, + SimulateOpResult: model.MockSimulateHandleOpResult, + }) + if err != nil { + t.Error(err) + return + } + jsonRes, _ := json.Marshal(gasOutPut) + t.Logf("gasOutPut:%v", string(jsonRes)) +} diff --git a/common/network/arbitrum/nodeinterface.go b/common/network/arbitrum/nodeinterface.go new file mode 100644 index 00000000..046837a5 --- /dev/null +++ b/common/network/arbitrum/nodeinterface.go @@ -0,0 +1,83 @@ +package arbitrum + +import ( + "AAStarCommunity/EthPaymaster_BackService/common/ethereum_contract/paymaster_abi" + "AAStarCommunity/EthPaymaster_BackService/common/global_const" + "AAStarCommunity/EthPaymaster_BackService/common/model" + "github.com/ethereum/go-ethereum/accounts/abi" + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/common/hexutil" + "github.com/ethereum/go-ethereum/ethclient" + "golang.org/x/xerrors" + "math/big" +) + +var ( + // GasEstimateL1ComponentMethod https://github.com/OffchainLabs/nitro/blob/v2.2.5/nodeInterface/NodeInterface.go#L473C1-L473C47 + GasEstimateL1ComponentMethod = abi.NewMethod( + "gasEstimateL1Component", + "gasEstimateL1Component", + abi.Function, + "", + false, + true, + abi.Arguments{ + {Name: "to", Type: paymaster_abi.AddressType}, + {Name: "contractCreation", Type: paymaster_abi.BooleanType}, + {Name: "data", Type: paymaster_abi.BytesType}, + }, + abi.Arguments{ + {Name: "gasEstimateForL1", Type: paymaster_abi.Uint64Type}, + {Name: "baseFee", Type: paymaster_abi.Uint256Type}, + {Name: "l1BaseFeeEstimate", Type: paymaster_abi.Uint256Type}, + }, + ) + + PrecompileAddress = common.HexToAddress("0x00000000000000000000000000000000000000C8") +) + +type GasEstimateL1ComponentOutput struct { + GasEstimateForL1 uint64 + BaseFee *big.Int + L1BaseFeeEstimate *big.Int +} + +//GetArbEstimateOutPut https://docs.arbitrum.io/build-decentralized-apps/nodeinterface/reference +//https://medium.com/offchainlabs/understanding-arbitrum-2-dimensional-fees-fd1d582596c9 + +func GetArbEstimateOutPut(client *ethclient.Client, preVerificationEstimateInput *model.PreVerificationGasEstimateInput) (*GasEstimateL1ComponentOutput, error) { + strategy := preVerificationEstimateInput.Strategy + simulteaOpCallData := preVerificationEstimateInput.SimulateOpResult.SimulateUserOpCallData + methodIputeData, err := GasEstimateL1ComponentMethod.Inputs.Pack(strategy.GetEntryPointAddress(), false, append(simulteaOpCallData)) + + if err != nil { + return nil, err + } + req := map[string]any{ + "from": global_const.EmptyAddress, + "to": PrecompileAddress, + "data": hexutil.Encode(append(GasEstimateL1ComponentMethod.ID, methodIputeData...)), + } + var outPut any + if err := client.Client().Call(&outPut, "eth_call", &req, "latest"); err != nil { + return nil, err + } + outPutStr, ok := outPut.(string) + if !ok { + return nil, xerrors.Errorf("gasEstimateL1Component: cannot assert type: hex is not of type string") + } + data, err := hexutil.Decode(outPutStr) + if err != nil { + return nil, xerrors.Errorf("gasEstimateL1Component: %s", err) + } + outputArgs, err := GasEstimateL1ComponentMethod.Outputs.Unpack(data) + if err != nil { + return nil, xerrors.Errorf("gasEstimateL1Component: %s", err) + } + + return &GasEstimateL1ComponentOutput{ + GasEstimateForL1: outputArgs[0].(uint64), + BaseFee: outputArgs[1].(*big.Int), + L1BaseFeeEstimate: outputArgs[2].(*big.Int), + }, nil +} diff --git a/common/network/base_network_executor.go b/common/network/base_network_executor.go new file mode 100644 index 00000000..38dd9d2d --- /dev/null +++ b/common/network/base_network_executor.go @@ -0,0 +1,4 @@ +package network + +type BaseExecutor struct { +} diff --git a/common/network/ethereum_adaptable_executor.go b/common/network/ethereum_adaptable_executor.go new file mode 100644 index 00000000..444f4119 --- /dev/null +++ b/common/network/ethereum_adaptable_executor.go @@ -0,0 +1,556 @@ +package network + +import ( + "AAStarCommunity/EthPaymaster_BackService/common/ethereum_contract/contract/contract_entrypoint_v06" + "AAStarCommunity/EthPaymaster_BackService/common/ethereum_contract/contract/contract_entrypoint_v07" + "AAStarCommunity/EthPaymaster_BackService/common/ethereum_contract/contract/erc20" + "AAStarCommunity/EthPaymaster_BackService/common/ethereum_contract/contract/l1_gas_oracle" + "AAStarCommunity/EthPaymaster_BackService/common/ethereum_contract/contract/paymaster_verifying_erc20_v06" + "AAStarCommunity/EthPaymaster_BackService/common/ethereum_contract/contract/paymaster_verifying_erc20_v07" + "AAStarCommunity/EthPaymaster_BackService/common/ethereum_contract/contract/simulate_entrypoint" + "AAStarCommunity/EthPaymaster_BackService/common/global_const" + "AAStarCommunity/EthPaymaster_BackService/common/model" + "AAStarCommunity/EthPaymaster_BackService/common/paymaster_data" + "AAStarCommunity/EthPaymaster_BackService/common/paymaster_pay_type" + "AAStarCommunity/EthPaymaster_BackService/common/user_op" + "AAStarCommunity/EthPaymaster_BackService/common/utils" + "AAStarCommunity/EthPaymaster_BackService/config" + "context" + "crypto/ecdsa" + "encoding/hex" + "encoding/json" + "github.com/ethereum/go-ethereum" + "github.com/ethereum/go-ethereum/accounts/abi/bind" + "github.com/ethereum/go-ethereum/common" + goEthereumTypes "github.com/ethereum/go-ethereum/core/types" + "github.com/ethereum/go-ethereum/crypto" + "github.com/ethereum/go-ethereum/ethclient" + "github.com/ethereum/go-ethereum/ethclient/gethclient" + "github.com/sirupsen/logrus" + "golang.org/x/xerrors" + "math/big" + "sync" +) + +var executorMap = make(map[global_const.Network]*EthereumExecutor) +var TokenContractCache map[*common.Address]*contract_erc20.Contract +var V06EntryPointContractCache map[global_const.Network]map[common.Address]*contract_entrypoint_v06.Contract +var V07EntryPointContractCache map[global_const.Network]map[common.Address]*contract_entrypoint_v07.Contract + +var SimulateEntryPointContractCache map[global_const.Network]*simulate_entrypoint.Contract +var ( + EntryPointSimulationsDeploy = "0x60806040526004361061016d5760003560e01c8063765e827f116100cb578063b760faf91161007f578063c3bce00911610059578063c3bce009146105ac578063dbed18e0146105d9578063fc7e286d146105f957600080fd5b8063b760faf914610564578063bb9fe6bf14610577578063c23a5cea1461058c57600080fd5b8063957122ab116100b0578063957122ab146104f757806397b2dcb9146105175780639b249f691461054457600080fd5b8063765e827f146104b7578063850aaf62146104d757600080fd5b8063205c28781161012257806335567e1a1161010757806335567e1a146102905780635287ce121461032557806370a082311461047457600080fd5b8063205c28781461025057806322cdde4c1461027057600080fd5b80630396cb60116101535780630396cb60146101e55780630bd28e3b146101f85780631b2e01b81461021857600080fd5b806242dc531461018257806301ffc9a7146101b557600080fd5b3661017d5761017b336106cb565b005b600080fd5b34801561018e57600080fd5b506101a261019d36600461426a565b6106ec565b6040519081526020015b60405180910390f35b3480156101c157600080fd5b506101d56101d0366004614330565b6108b7565b60405190151581526020016101ac565b61017b6101f3366004614372565b610a34565b34801561020457600080fd5b5061017b6102133660046143c0565b610dca565b34801561022457600080fd5b506101a26102333660046143db565b600160209081526000928352604080842090915290825290205481565b34801561025c57600080fd5b5061017b61026b366004614410565b610e12565b34801561027c57600080fd5b506101a261028b366004614455565b610fbc565b34801561029c57600080fd5b506101a26102ab3660046143db565b73ffffffffffffffffffffffffffffffffffffffff8216600090815260016020908152604080832077ffffffffffffffffffffffffffffffffffffffffffffffff8516845290915290819020549082901b7fffffffffffffffffffffffffffffffffffffffffffffffff0000000000000000161792915050565b34801561033157600080fd5b5061041261034036600461448a565b6040805160a0810182526000808252602082018190529181018290526060810182905260808101919091525073ffffffffffffffffffffffffffffffffffffffff1660009081526020818152604091829020825160a0810184528154815260019091015460ff811615159282019290925261010082046dffffffffffffffffffffffffffff16928101929092526f01000000000000000000000000000000810463ffffffff166060830152730100000000000000000000000000000000000000900465ffffffffffff16608082015290565b6040516101ac9190600060a082019050825182526020830151151560208301526dffffffffffffffffffffffffffff604084015116604083015263ffffffff606084015116606083015265ffffffffffff608084015116608083015292915050565b34801561048057600080fd5b506101a261048f36600461448a565b73ffffffffffffffffffffffffffffffffffffffff1660009081526020819052604090205490565b3480156104c357600080fd5b5061017b6104d23660046144ec565b610ffe565b3480156104e357600080fd5b5061017b6104f2366004614543565b61117b565b34801561050357600080fd5b5061017b610512366004614598565b611220565b34801561052357600080fd5b5061053761053236600461461d565b611378565b6040516101ac91906146ed565b34801561055057600080fd5b5061017b61055f36600461473c565b6114c4565b61017b61057236600461448a565b6106cb565b34801561058357600080fd5b5061017b6115af565b34801561059857600080fd5b5061017b6105a736600461448a565b61178f565b3480156105b857600080fd5b506105cc6105c7366004614455565b611a7c565b6040516101ac919061477e565b3480156105e557600080fd5b5061017b6105f43660046144ec565b611d80565b34801561060557600080fd5b5061068161061436600461448a565b6000602081905290815260409020805460019091015460ff81169061010081046dffffffffffffffffffffffffffff16906f01000000000000000000000000000000810463ffffffff1690730100000000000000000000000000000000000000900465ffffffffffff1685565b6040805195865293151560208601526dffffffffffffffffffffffffffff9092169284019290925263ffffffff909116606083015265ffffffffffff16608082015260a0016101ac565b60015b60058110156106df576001016106ce565b6106e88261222c565b5050565b6000805a9050333014610760576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601760248201527f4141393220696e7465726e616c2063616c6c206f6e6c7900000000000000000060448201526064015b60405180910390fd5b8451606081015160a082015181016127100160405a603f02816107855761078561485e565b0410156107b6577fdeaddead0000000000000000000000000000000000000000000000000000000060005260206000fd5b8751600090156108575760006107d3846000015160008c86612282565b9050806108555760006107e761080061229a565b80519091501561084f57846000015173ffffffffffffffffffffffffffffffffffffffff168a602001517f1c4fada7374c0a9ee8841fc38afe82932dc0f8e69012e927f061a8bae611a20187602001518460405161084692919061488d565b60405180910390a35b60019250505b505b600088608001515a86030190506108a7828a8a8a8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152508792506122c6915050565b955050505050505b949350505050565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f60fc6b6e00000000000000000000000000000000000000000000000000000000148061094a57507fffffffff0000000000000000000000000000000000000000000000000000000082167f915074d800000000000000000000000000000000000000000000000000000000145b8061099657507fffffffff0000000000000000000000000000000000000000000000000000000082167fcf28ef9700000000000000000000000000000000000000000000000000000000145b806109e257507fffffffff0000000000000000000000000000000000000000000000000000000082167f3e84f02100000000000000000000000000000000000000000000000000000000145b80610a2e57507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff000000000000000000000000000000000000000000000000000000008316145b92915050565b33600090815260208190526040902063ffffffff8216610ab0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601a60248201527f6d757374207370656369667920756e7374616b652064656c61790000000000006044820152606401610757565b600181015463ffffffff6f0100000000000000000000000000000090910481169083161015610b3b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601c60248201527f63616e6e6f7420646563726561736520756e7374616b652074696d65000000006044820152606401610757565b6001810154600090610b6390349061010090046dffffffffffffffffffffffffffff166148d5565b905060008111610bcf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f6e6f207374616b652073706563696669656400000000000000000000000000006044820152606401610757565b6dffffffffffffffffffffffffffff811115610c47576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600e60248201527f7374616b65206f766572666c6f770000000000000000000000000000000000006044820152606401610757565b6040805160a08101825283548152600160208083018281526dffffffffffffffffffffffffffff86811685870190815263ffffffff8a811660608801818152600060808a0181815233808352828a52918c90209a518b55965199909801805494519151965165ffffffffffff16730100000000000000000000000000000000000000027fffffffffffffff000000000000ffffffffffffffffffffffffffffffffffffff979094166f0100000000000000000000000000000002969096167fffffffffffffff00000000000000000000ffffffffffffffffffffffffffffff91909516610100027fffffffffffffffffffffffffffffffffff0000000000000000000000000000ff991515999099167fffffffffffffffffffffffffffffffffff00000000000000000000000000000090941693909317979097179190911691909117179055835185815290810192909252917fa5ae833d0bb1dcd632d98a8b70973e8516812898e19bf27b70071ebc8dc52c01910160405180910390a2505050565b33600090815260016020908152604080832077ffffffffffffffffffffffffffffffffffffffffffffffff851684529091528120805491610e0a836148e8565b919050555050565b3360009081526020819052604090208054821115610e8c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601960248201527f576974686472617720616d6f756e7420746f6f206c61726765000000000000006044820152606401610757565b8054610e99908390614920565b81556040805173ffffffffffffffffffffffffffffffffffffffff851681526020810184905233917fd1c19fbcd4551a5edfb66d43d2e337c04837afda3482b42bdf569a8fccdae5fb910160405180910390a260008373ffffffffffffffffffffffffffffffffffffffff168360405160006040518083038185875af1925050503d8060008114610f46576040519150601f19603f3d011682016040523d82523d6000602084013e610f4b565b606091505b5050905080610fb6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f6661696c656420746f20776974686472617700000000000000000000000000006044820152606401610757565b50505050565b6000610fc7826124ee565b6040805160208101929092523090820152466060820152608001604051602081830303815290604052805190602001209050919050565b611006612507565b8160008167ffffffffffffffff81111561102257611022613ffd565b60405190808252806020026020018201604052801561105b57816020015b611048613e51565b8152602001906001900390816110405790505b50905060005b828110156110d457600082828151811061107d5761107d614933565b602002602001015190506000806110b8848a8a878181106110a0576110a0614933565b90506020028101906110b29190614962565b85612548565b915091506110c984838360006127a7565b505050600101611061565b506040516000907fbb47ee3e183a558b1a2ff0874b079f3fc5478b7454eacf2bfc5af2ff5878f972908290a160005b8381101561115e576111528188888481811061112157611121614933565b90506020028101906111339190614962565b85848151811061114557611145614933565b60200260200101516129fc565b90910190600101611103565b506111698482612dd2565b5050506111766001600255565b505050565b6000808473ffffffffffffffffffffffffffffffffffffffff1684846040516111a59291906149a0565b600060405180830381855af49150503d80600081146111e0576040519150601f19603f3d011682016040523d82523d6000602084013e6111e5565b606091505b509150915081816040517f994105540000000000000000000000000000000000000000000000000000000081526004016107579291906149b0565b83158015611243575073ffffffffffffffffffffffffffffffffffffffff83163b155b156112aa576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601960248201527f41413230206163636f756e74206e6f74206465706c6f796564000000000000006044820152606401610757565b6014811061133c5760006112c160148284866149cb565b6112ca916149f5565b60601c9050803b60000361133a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601b60248201527f41413330207061796d6173746572206e6f74206465706c6f79656400000000006044820152606401610757565b505b6040517f08c379a00000000000000000000000000000000000000000000000000000000081526020600482015260006024820152604401610757565b6113b36040518060c0016040528060008152602001600081526020016000815260200160008152602001600015158152602001606081525090565b6113bb612507565b6113c3613e51565b6113cc86612f19565b6000806113db60008985612548565b9150915060006113ed60008a866129fc565b90506000606073ffffffffffffffffffffffffffffffffffffffff8a161561147f578973ffffffffffffffffffffffffffffffffffffffff1689896040516114369291906149a0565b6000604051808303816000865af19150503d8060008114611473576040519150601f19603f3d011682016040523d82523d6000602084013e611478565b606091505b5090925090505b6040518060c001604052808760800151815260200184815260200186815260200185815260200183151581526020018281525096505050505050506108af6001600255565b60006114e560065473ffffffffffffffffffffffffffffffffffffffff1690565b73ffffffffffffffffffffffffffffffffffffffff1663570e1a3684846040518363ffffffff1660e01b815260040161151f929190614a86565b6020604051808303816000875af115801561153e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115629190614a9a565b6040517f6ca7b80600000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff82166004820152909150602401610757565b336000908152602081905260408120600181015490916f0100000000000000000000000000000090910463ffffffff169003611647576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600a60248201527f6e6f74207374616b6564000000000000000000000000000000000000000000006044820152606401610757565b600181015460ff166116b5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f616c726561647920756e7374616b696e670000000000000000000000000000006044820152606401610757565b60018101546000906116e0906f01000000000000000000000000000000900463ffffffff1642614ab7565b6001830180547fffffffffffffff000000000000ffffffffffffffffffffffffffffffffffff001673010000000000000000000000000000000000000065ffffffffffff84169081027fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00169190911790915560405190815290915033907ffa9b3c14cc825c412c9ed81b3ba365a5b459439403f18829e572ed53a4180f0a906020015b60405180910390a25050565b336000908152602081905260409020600181015461010090046dffffffffffffffffffffffffffff168061181f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f4e6f207374616b6520746f2077697468647261770000000000000000000000006044820152606401610757565b6001820154730100000000000000000000000000000000000000900465ffffffffffff166118a9576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f6d7573742063616c6c20756e6c6f636b5374616b6528292066697273740000006044820152606401610757565b60018201544273010000000000000000000000000000000000000090910465ffffffffffff161115611937576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601b60248201527f5374616b65207769746864726177616c206973206e6f742064756500000000006044820152606401610757565b6001820180547fffffffffffffff000000000000000000000000000000000000000000000000ff1690556040805173ffffffffffffffffffffffffffffffffffffffff851681526020810183905233917fb7c918e0e249f999e965cafeb6c664271b3f4317d296461500e71da39f0cbda3910160405180910390a260008373ffffffffffffffffffffffffffffffffffffffff168260405160006040518083038185875af1925050503d8060008114611a0c576040519150601f19603f3d011682016040523d82523d6000602084013e611a11565b606091505b5050905080610fb6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f6661696c656420746f207769746864726177207374616b6500000000000000006044820152606401610757565b611a84613f03565b611a8c613e51565b611a9583612f19565b600080611aa460008685612548565b845160e001516040805180820182526000808252602080830182815273ffffffffffffffffffffffffffffffffffffffff95861683528282528483206001908101546dffffffffffffffffffffffffffff6101008083048216885263ffffffff6f010000000000000000000000000000009384900481169095528e51518951808b018b5288815280880189815291909b168852878752898820909401549081049091168952049091169052835180850190945281845283015293955091935090366000611b7460408b018b614add565b909250905060006014821015611b8b576000611ba6565b611b996014600084866149cb565b611ba2916149f5565b60601c5b6040805180820182526000808252602080830182815273ffffffffffffffffffffffffffffffffffffffff86168352908290529290206001015461010081046dffffffffffffffffffffffffffff1682526f01000000000000000000000000000000900463ffffffff169091529091509350505050600085905060006040518060a001604052808960800151815260200189604001518152602001888152602001878152602001611c588a6060015190565b905260408051808201825260035473ffffffffffffffffffffffffffffffffffffffff908116825282518084019093526004548352600554602084810191909152820192909252919250831615801590611cc9575060018373ffffffffffffffffffffffffffffffffffffffff1614155b15611d4d5760408051808201825273ffffffffffffffffffffffffffffffffffffffff851680825282518084018452600080825260208083018281529382528181529490206001015461010081046dffffffffffffffffffffffffffff1682526f01000000000000000000000000000000900463ffffffff16909152909182015290505b6040805160a081018252928352602083019590955293810192909252506060810192909252608082015295945050505050565b611d88612507565b816000805b82811015611f7a5736868683818110611da857611da8614933565b9050602002810190611dba9190614b42565b9050366000611dc98380614b76565b90925090506000611de0604085016020860161448a565b90507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff73ffffffffffffffffffffffffffffffffffffffff821601611e81576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601760248201527f4141393620696e76616c69642061676772656761746f720000000000000000006044820152606401610757565b73ffffffffffffffffffffffffffffffffffffffff811615611f5e5773ffffffffffffffffffffffffffffffffffffffff8116632dd811338484611ec86040890189614add565b6040518563ffffffff1660e01b8152600401611ee79493929190614d2e565b60006040518083038186803b158015611eff57600080fd5b505afa925050508015611f10575060015b611f5e576040517f86a9f75000000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff82166004820152602401610757565b611f6882876148d5565b95505060019093019250611d8d915050565b5060008167ffffffffffffffff811115611f9657611f96613ffd565b604051908082528060200260200182016040528015611fcf57816020015b611fbc613e51565b815260200190600190039081611fb45790505b5090506000805b848110156120ac5736888883818110611ff157611ff1614933565b90506020028101906120039190614b42565b90503660006120128380614b76565b90925090506000612029604085016020860161448a565b90508160005b8181101561209a57600089898151811061204b5761204b614933565b6020026020010151905060008061206e8b8989878181106110a0576110a0614933565b9150915061207e848383896127a7565b8a612088816148e8565b9b50506001909301925061202f915050565b505060019094019350611fd692505050565b506040517fbb47ee3e183a558b1a2ff0874b079f3fc5478b7454eacf2bfc5af2ff5878f97290600090a150600080805b858110156121e757368989838181106120f7576120f7614933565b90506020028101906121099190614b42565b905061211b604082016020830161448a565b73ffffffffffffffffffffffffffffffffffffffff167f575ff3acadd5ab348fe1855e217e0f3678f8d767d7494c9f9fefbee2e17cca4d60405160405180910390a236600061216a8380614b76565b90925090508060005b818110156121d6576121b58885858481811061219157612191614933565b90506020028101906121a39190614962565b8b8b8151811061114557611145614933565b6121bf90886148d5565b9650876121cb816148e8565b985050600101612173565b5050600190930192506120dc915050565b506040516000907f575ff3acadd5ab348fe1855e217e0f3678f8d767d7494c9f9fefbee2e17cca4d908290a261221d8682612dd2565b50505050506111766001600255565b60006122388234613107565b90508173ffffffffffffffffffffffffffffffffffffffff167f2da466a7b24304f47e87fa2e1e5a81b9831ce54fec19055ce277ca2f39ba42c48260405161178391815260200190565b6000806000845160208601878987f195945050505050565b60603d828111156122a85750815b604051602082018101604052818152816000602083013e9392505050565b6000805a8551909150600090816122dc82613147565b60e083015190915073ffffffffffffffffffffffffffffffffffffffff81166123085782519350612403565b80935060008851111561240357868202955060028a600281111561232e5761232e614de5565b146124035760a08301516040517f7c627b2100000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff831691637c627b2191612390908e908d908c908990600401614e14565b600060405180830381600088803b1580156123aa57600080fd5b5087f1935050505080156123bc575060015b6124035760006123cd61080061229a565b9050806040517fad7954bc0000000000000000000000000000000000000000000000000000000081526004016107579190614e77565b5a60a0840151606085015160808c015192880399909901980190880380821115612436576064600a828403020498909801975b505060408901518783029650868110156124ab5760028b600281111561245e5761245e614de5565b036124815780965061246f8a613171565b61247c8a6000898b6131cd565b6124e0565b7fdeadaa510000000000000000000000000000000000000000000000000000000060005260206000fd5b8681036124b88682613107565b506000808d60028111156124ce576124ce614de5565b1490506124dd8c828b8d6131cd565b50505b505050505050949350505050565b60006124f982613255565b805190602001209050919050565b6002805403612542576040517f3ee5aeb500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60028055565b60008060005a845190915061255d868261331a565b61256686610fbc565b6020860152604081015161012082015161010083015160a08401516080850151606086015160c0870151861717171717176effffffffffffffffffffffffffffff811115612610576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f41413934206761732076616c756573206f766572666c6f7700000000000000006044820152606401610757565b600061263f8460c081015160a08201516080830151606084015160408501516101009095015194010101010290565b905061264e8a8a8a8487613465565b9650612662846000015185602001516136a6565b6126d157896040517f220266b6000000000000000000000000000000000000000000000000000000008152600401610757918152604060208201819052601a908201527f4141323520696e76616c6964206163636f756e74206e6f6e6365000000000000606082015260800190565b825a8603111561274657896040517f220266b6000000000000000000000000000000000000000000000000000000008152600401610757918152604060208201819052601e908201527f41413236206f76657220766572696669636174696f6e4761734c696d69740000606082015260800190565b60e084015160609073ffffffffffffffffffffffffffffffffffffffff161561277a576127758b8b8b85613701565b975090505b604089018290528060608a015260a08a01355a870301896080018181525050505050505050935093915050565b6000806127b385613958565b915091508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161461285557856040517f220266b60000000000000000000000000000000000000000000000000000000081526004016107579181526040602082018190526014908201527f41413234207369676e6174757265206572726f72000000000000000000000000606082015260800190565b80156128c657856040517f220266b60000000000000000000000000000000000000000000000000000000081526004016107579181526040602082018190526017908201527f414132322065787069726564206f72206e6f7420647565000000000000000000606082015260800190565b60006128d185613958565b9250905073ffffffffffffffffffffffffffffffffffffffff81161561295c57866040517f220266b60000000000000000000000000000000000000000000000000000000081526004016107579181526040602082018190526014908201527f41413334207369676e6174757265206572726f72000000000000000000000000606082015260800190565b81156129f357866040517f220266b60000000000000000000000000000000000000000000000000000000081526004016107579181526040602082018190526021908201527f41413332207061796d61737465722065787069726564206f72206e6f7420647560608201527f6500000000000000000000000000000000000000000000000000000000000000608082015260a00190565b50505050505050565b6000805a90506000612a0f846060015190565b6040519091506000903682612a2760608a018a614add565b9150915060606000826003811115612a3e57843591505b507f72288ed1000000000000000000000000000000000000000000000000000000007fffffffff00000000000000000000000000000000000000000000000000000000821601612b7e5760008b8b60200151604051602401612aa1929190614e8a565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529181526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f8dd7712f000000000000000000000000000000000000000000000000000000001790525190915030906242dc5390612b349084908f908d90602401614f70565b604051602081830303815290604052915060e01b6020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050925050612bf5565b3073ffffffffffffffffffffffffffffffffffffffff166242dc5385858d8b604051602401612bb09493929190614fb0565b604051602081830303815290604052915060e01b6020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff838183161783525050505091505b602060008351602085016000305af19550600051985084604052505050505080612dc85760003d80602003612c305760206000803e60005191505b507fdeaddead000000000000000000000000000000000000000000000000000000008103612cc357876040517f220266b6000000000000000000000000000000000000000000000000000000008152600401610757918152604060208201819052600f908201527f41413935206f7574206f66206761730000000000000000000000000000000000606082015260800190565b7fdeadaa51000000000000000000000000000000000000000000000000000000008103612d2d57600086608001515a612cfc9087614920565b612d0691906148d5565b6040880151909150612d1788613171565b612d2488600083856131cd565b9550612dc69050565b8551805160208089015192015173ffffffffffffffffffffffffffffffffffffffff90911691907ff62676f440ff169a3a9afdbf812e89e7f95975ee8e5c31214ffdef631c5f479290612d8161080061229a565b604051612d8f92919061488d565b60405180910390a3600086608001515a612da99087614920565b612db391906148d5565b9050612dc260028886846122c6565b9550505b505b5050509392505050565b73ffffffffffffffffffffffffffffffffffffffff8216612e4f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f4141393020696e76616c69642062656e656669636961727900000000000000006044820152606401610757565b60008273ffffffffffffffffffffffffffffffffffffffff168260405160006040518083038185875af1925050503d8060008114612ea9576040519150601f19603f3d011682016040523d82523d6000602084013e612eae565b606091505b5050905080611176576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f41413931206661696c65642073656e6420746f2062656e6566696369617279006044820152606401610757565b6130196040517fd69400000000000000000000000000000000000000000000000000000000000060208201527fffffffffffffffffffffffffffffffffffffffff0000000000000000000000003060601b1660228201527f01000000000000000000000000000000000000000000000000000000000000006036820152600090603701604080518083037fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe00181529190528051602090910120600680547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff90921691909117905550565b3063957122ab61302c6040840184614add565b613039602086018661448a565b61304660e0870187614add565b6040518663ffffffff1660e01b8152600401613066959493929190614fe7565b60006040518083038186803b15801561307e57600080fd5b505afa92505050801561308f575060015b6131045761309b615036565b806308c379a0036130f857506130af615052565b806130ba57506130fa565b8051156106e8576000816040517f220266b600000000000000000000000000000000000000000000000000000000815260040161075792919061488d565b505b3d6000803e3d6000fd5b50565b73ffffffffffffffffffffffffffffffffffffffff821660009081526020819052604081208054829061313b9085906148d5565b91829055509392505050565b61010081015161012082015160009190808203613165575092915050565b6108af824883016139ab565b805180516020808401519281015160405190815273ffffffffffffffffffffffffffffffffffffffff90921692917f67b4fa9642f42120bf031f3051d1824b0fe25627945b27b8a6a65d5761d5482e910160405180910390a350565b835160e0810151815160208088015193015160405173ffffffffffffffffffffffffffffffffffffffff9384169492909316927f49628fd1471006c1482da88028e9ce4dbb080b815c9b0344d39e5a8e6ec1419f916132479189908990899093845291151560208401526040830152606082015260800190565b60405180910390a450505050565b60608135602083013560006132756132706040870187614add565b6139c3565b905060006132896132706060880188614add565b9050608086013560a087013560c088013560006132ac61327060e08c018c614add565b6040805173ffffffffffffffffffffffffffffffffffffffff9a909a1660208b015289810198909852606089019690965250608087019390935260a086019190915260c085015260e08401526101008084019190915281518084039091018152610120909201905292915050565b613327602083018361448a565b73ffffffffffffffffffffffffffffffffffffffff168152602082810135908201526fffffffffffffffffffffffffffffffff6080808401358281166060850152811c604084015260a084013560c0808501919091528401359182166101008401521c6101208201523660006133a060e0850185614add565b9092509050801561344a576034811015613416576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f4141393320696e76616c6964207061796d6173746572416e64446174610000006044820152606401610757565b61342082826139d6565b60a0860152608085015273ffffffffffffffffffffffffffffffffffffffff1660e0840152610fb6565b600060e084018190526080840181905260a084015250505050565b8251805160009190613484888761347f60408b018b614add565b613a47565b60e0820151600073ffffffffffffffffffffffffffffffffffffffff82166134e25773ffffffffffffffffffffffffffffffffffffffff83166000908152602081905260409020548781116134db578088036134de565b60005b9150505b60208801516040517f19822f7c00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8516916319822f7c91899161353e918e919087906004016150fa565b60206040518083038160008887f193505050508015613598575060408051601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01682019092526135959181019061511f565b60015b6135dc57896135a861080061229a565b6040517f65c8fd4d000000000000000000000000000000000000000000000000000000008152600401610757929190615138565b945073ffffffffffffffffffffffffffffffffffffffff82166136995773ffffffffffffffffffffffffffffffffffffffff83166000908152602081905260409020805480891115613693578b6040517f220266b60000000000000000000000000000000000000000000000000000000081526004016107579181526040602082018190526017908201527f41413231206469646e2774207061792070726566756e64000000000000000000606082015260800190565b88900390555b5050505095945050505050565b73ffffffffffffffffffffffffffffffffffffffff8216600090815260016020908152604080832084821c808552925282208054849167ffffffffffffffff83169190856136f3836148e8565b909155501495945050505050565b60606000805a855160e081015173ffffffffffffffffffffffffffffffffffffffff8116600090815260208190526040902080549394509192909190878110156137b0578a6040517f220266b6000000000000000000000000000000000000000000000000000000008152600401610757918152604060208201819052601e908201527f41413331207061796d6173746572206465706f73697420746f6f206c6f770000606082015260800190565b87810382600001819055506000846080015190508373ffffffffffffffffffffffffffffffffffffffff166352b7512c828d8d602001518d6040518563ffffffff1660e01b8152600401613806939291906150fa565b60006040518083038160008887f19350505050801561386557506040513d6000823e601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01682016040526138629190810190615185565b60015b6138a9578b61387561080061229a565b6040517f65c8fd4d000000000000000000000000000000000000000000000000000000008152600401610757929190615211565b9098509650805a87031115613949578b6040517f220266b60000000000000000000000000000000000000000000000000000000081526004016107579181526040602082018190526027908201527f41413336206f766572207061796d6173746572566572696669636174696f6e4760608201527f61734c696d697400000000000000000000000000000000000000000000000000608082015260a00190565b50505050505094509492505050565b6000808260000361396e57506000928392509050565b600061397984613dd3565b9050806040015165ffffffffffff164211806139a05750806020015165ffffffffffff1642105b905194909350915050565b60008183106139ba57816139bc565b825b9392505050565b6000604051828085833790209392505050565b600080806139e760148286886149cb565b6139f0916149f5565b60601c613a016024601487896149cb565b613a0a9161525e565b60801c613a1b60346024888a6149cb565b613a249161525e565b9194506fffffffffffffffffffffffffffffffff16925060801c90509250925092565b8015610fb65782515173ffffffffffffffffffffffffffffffffffffffff81163b15613ad857846040517f220266b6000000000000000000000000000000000000000000000000000000008152600401610757918152604060208201819052601f908201527f414131302073656e64657220616c726561647920636f6e737472756374656400606082015260800190565b6000613af960065473ffffffffffffffffffffffffffffffffffffffff1690565b73ffffffffffffffffffffffffffffffffffffffff1663570e1a3686600001516040015186866040518463ffffffff1660e01b8152600401613b3c929190614a86565b60206040518083038160008887f1158015613b5b573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190613b809190614a9a565b905073ffffffffffffffffffffffffffffffffffffffff8116613c0857856040517f220266b6000000000000000000000000000000000000000000000000000000008152600401610757918152604060208201819052601b908201527f4141313320696e6974436f6465206661696c6564206f72204f4f470000000000606082015260800190565b8173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614613ca557856040517f220266b600000000000000000000000000000000000000000000000000000000815260040161075791815260406020808301829052908201527f4141313420696e6974436f6465206d7573742072657475726e2073656e646572606082015260800190565b8073ffffffffffffffffffffffffffffffffffffffff163b600003613d2e57856040517f220266b600000000000000000000000000000000000000000000000000000000815260040161075791815260406020808301829052908201527f4141313520696e6974436f6465206d757374206372656174652073656e646572606082015260800190565b6000613d3d60148286886149cb565b613d46916149f5565b60601c90508273ffffffffffffffffffffffffffffffffffffffff1686602001517fd51a9c61267aa6196961883ecf5ff2da6619c37dac0fa92122513fb32c032d2d83896000015160e00151604051613dc292919073ffffffffffffffffffffffffffffffffffffffff92831681529116602082015260400190565b60405180910390a350505050505050565b60408051606081018252600080825260208201819052918101919091528160a081901c65ffffffffffff8116600003613e0f575065ffffffffffff5b6040805160608101825273ffffffffffffffffffffffffffffffffffffffff909316835260d09490941c602083015265ffffffffffff16928101929092525090565b6040518060a00160405280613ede604051806101400160405280600073ffffffffffffffffffffffffffffffffffffffff168152602001600081526020016000815260200160008152602001600081526020016000815260200160008152602001600073ffffffffffffffffffffffffffffffffffffffff16815260200160008152602001600081525090565b8152602001600080191681526020016000815260200160008152602001600081525090565b6040518060a00160405280613f406040518060a0016040528060008152602001600081526020016000815260200160008152602001606081525090565b8152602001613f62604051806040016040528060008152602001600081525090565b8152602001613f84604051806040016040528060008152602001600081525090565b8152602001613fa6604051806040016040528060008152602001600081525090565b8152602001613fb3613fb8565b905290565b6040518060400160405280600073ffffffffffffffffffffffffffffffffffffffff168152602001613fb3604051806040016040528060008152602001600081525090565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b60a0810181811067ffffffffffffffff8211171561404c5761404c613ffd565b60405250565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f830116810181811067ffffffffffffffff8211171561409657614096613ffd565b6040525050565b604051610140810167ffffffffffffffff811182821017156140c1576140c1613ffd565b60405290565b600067ffffffffffffffff8211156140e1576140e1613ffd565b50601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01660200190565b73ffffffffffffffffffffffffffffffffffffffff8116811461310457600080fd5b803561413a8161410d565b919050565b60008183036101c081121561415357600080fd5b60405161415f8161402c565b8092506101408083121561417257600080fd5b61417a61409d565b92506141858561412f565b83526020850135602084015260408501356040840152606085013560608401526080850135608084015260a085013560a084015260c085013560c08401526141cf60e0860161412f565b60e084015261010085810135908401526101208086013590840152918152908301356020820152610160830135604082015261018083013560608201526101a090920135608090920191909152919050565b60008083601f84011261423357600080fd5b50813567ffffffffffffffff81111561424b57600080fd5b60208301915083602082850101111561426357600080fd5b9250929050565b600080600080610200858703121561428157600080fd5b843567ffffffffffffffff8082111561429957600080fd5b818701915087601f8301126142ad57600080fd5b81356142b8816140c7565b6040516142c58282614052565b8281528a60208487010111156142da57600080fd5b82602086016020830137600060208483010152809850505050614300886020890161413f565b94506101e087013591508082111561431757600080fd5b5061432487828801614221565b95989497509550505050565b60006020828403121561434257600080fd5b81357fffffffff00000000000000000000000000000000000000000000000000000000811681146139bc57600080fd5b60006020828403121561438457600080fd5b813563ffffffff811681146139bc57600080fd5b803577ffffffffffffffffffffffffffffffffffffffffffffffff8116811461413a57600080fd5b6000602082840312156143d257600080fd5b6139bc82614398565b600080604083850312156143ee57600080fd5b82356143f98161410d565b915061440760208401614398565b90509250929050565b6000806040838503121561442357600080fd5b823561442e8161410d565b946020939093013593505050565b6000610120828403121561444f57600080fd5b50919050565b60006020828403121561446757600080fd5b813567ffffffffffffffff81111561447e57600080fd5b6108af8482850161443c565b60006020828403121561449c57600080fd5b81356139bc8161410d565b60008083601f8401126144b957600080fd5b50813567ffffffffffffffff8111156144d157600080fd5b6020830191508360208260051b850101111561426357600080fd5b60008060006040848603121561450157600080fd5b833567ffffffffffffffff81111561451857600080fd5b614524868287016144a7565b90945092505060208401356145388161410d565b809150509250925092565b60008060006040848603121561455857600080fd5b83356145638161410d565b9250602084013567ffffffffffffffff81111561457f57600080fd5b61458b86828701614221565b9497909650939450505050565b6000806000806000606086880312156145b057600080fd5b853567ffffffffffffffff808211156145c857600080fd5b6145d489838a01614221565b9097509550602088013591506145e98261410d565b909350604087013590808211156145ff57600080fd5b5061460c88828901614221565b969995985093965092949392505050565b6000806000806060858703121561463357600080fd5b843567ffffffffffffffff8082111561464b57600080fd5b6146578883890161443c565b9550602087013591506146698261410d565b9093506040860135908082111561431757600080fd5b60005b8381101561469a578181015183820152602001614682565b50506000910152565b600081518084526146bb81602086016020860161467f565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b60208152815160208201526020820151604082015260408201516060820152606082015160808201526080820151151560a0820152600060a083015160c0808401526108af60e08401826146a3565b6000806020838503121561474f57600080fd5b823567ffffffffffffffff81111561476657600080fd5b61477285828601614221565b90969095509350505050565b602080825282516101408383015280516101608401529081015161018083015260408101516101a083015260608101516101c08301526080015160a06101e08301526000906147d16102008401826146a3565b905060208401516147ef604085018280518252602090810151910152565b506040840151805160808581019190915260209182015160a08601526060860151805160c087015282015160e0860152850151805173ffffffffffffffffffffffffffffffffffffffff1661010086015280820151805161012087015290910151610140850152509392505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b8281526040602082015260006108af60408301846146a3565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b80820180821115610a2e57610a2e6148a6565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203614919576149196148a6565b5060010190565b81810381811115610a2e57610a2e6148a6565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600082357ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffee183360301811261499657600080fd5b9190910192915050565b8183823760009101908152919050565b82151581526040602082015260006108af60408301846146a3565b600080858511156149db57600080fd5b838611156149e857600080fd5b5050820193919092039150565b7fffffffffffffffffffffffffffffffffffffffff0000000000000000000000008135818116916014851015614a355780818660140360031b1b83161692505b505092915050565b8183528181602085013750600060208284010152600060207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f840116840101905092915050565b6020815260006108af602083018486614a3d565b600060208284031215614aac57600080fd5b81516139bc8161410d565b65ffffffffffff818116838216019080821115614ad657614ad66148a6565b5092915050565b60008083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe1843603018112614b1257600080fd5b83018035915067ffffffffffffffff821115614b2d57600080fd5b60200191503681900382131561426357600080fd5b600082357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffa183360301811261499657600080fd5b60008083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe1843603018112614bab57600080fd5b83018035915067ffffffffffffffff821115614bc657600080fd5b6020019150600581901b360382131561426357600080fd5b60008083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe1843603018112614c1357600080fd5b830160208101925035905067ffffffffffffffff811115614c3357600080fd5b80360382131561426357600080fd5b6000610120614c6e84614c548561412f565b73ffffffffffffffffffffffffffffffffffffffff169052565b60208301356020850152614c856040840184614bde565b826040870152614c988387018284614a3d565b92505050614ca96060840184614bde565b8583036060870152614cbc838284614a3d565b925050506080830135608085015260a083013560a085015260c083013560c0850152614ceb60e0840184614bde565b85830360e0870152614cfe838284614a3d565b92505050610100614d1181850185614bde565b86840383880152614d23848284614a3d565b979650505050505050565b6040808252810184905260006060600586901b830181019083018783805b89811015614dce577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffa087860301845282357ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffee18c3603018112614dac578283fd5b614db8868d8301614c42565b9550506020938401939290920191600101614d4c565b505050508281036020840152614d23818587614a3d565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b600060038610614e4d577f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b85825260806020830152614e6460808301866146a3565b6040830194909452506060015292915050565b6020815260006139bc60208301846146a3565b604081526000614e9d6040830185614c42565b90508260208301529392505050565b8051805173ffffffffffffffffffffffffffffffffffffffff1683526020810151602084015260408101516040840152606081015160608401526080810151608084015260a081015160a084015260c081015160c084015260e0810151614f2b60e085018273ffffffffffffffffffffffffffffffffffffffff169052565b5061010081810151908401526101209081015190830152602081015161014083015260408101516101608301526060810151610180830152608001516101a090910152565b6000610200808352614f84818401876146a3565b9050614f936020840186614eac565b8281036101e0840152614fa681856146a3565b9695505050505050565b6000610200808352614fc58184018789614a3d565b9050614fd46020840186614eac565b8281036101e0840152614d2381856146a3565b606081526000614ffb606083018789614a3d565b73ffffffffffffffffffffffffffffffffffffffff86166020840152828103604084015261502a818587614a3d565b98975050505050505050565b600060033d111561504f5760046000803e5060005160e01c5b90565b600060443d10156150605790565b6040517ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc803d016004833e81513d67ffffffffffffffff81602484011181841117156150ae57505050505090565b82850191508151818111156150c65750505050505090565b843d87010160208285010111156150e05750505050505090565b6150ef60208286010187614052565b509095945050505050565b60608152600061510d6060830186614c42565b60208301949094525060400152919050565b60006020828403121561513157600080fd5b5051919050565b82815260606020820152600d60608201527f4141323320726576657274656400000000000000000000000000000000000000608082015260a0604082015260006108af60a08301846146a3565b6000806040838503121561519857600080fd5b825167ffffffffffffffff8111156151af57600080fd5b8301601f810185136151c057600080fd5b80516151cb816140c7565b6040516151d88282614052565b8281528760208486010111156151ed57600080fd5b6151fe83602083016020870161467f565b6020969096015195979596505050505050565b82815260606020820152600d60608201527f4141333320726576657274656400000000000000000000000000000000000000608082015260a0604082015260006108af60a08301846146a3565b7fffffffffffffffffffffffffffffffff000000000000000000000000000000008135818116916010851015614a355760109490940360031b84901b169092169291505056fea2646970667358221220da6235a9fed490e0598819f695bb128f935391fa9c8ba963180dfb5cab452aef64736f6c63430008170033" + EntryPointSimulationsDeployCode []byte + V06PaymasterErc20AndPaymasterCache = make(map[global_const.Network]map[common.Address]*paymaster_verifying_erc20_v06.Contract) + V07PaymasterErc20AndPaymasterCache = make(map[global_const.Network]map[common.Address]*paymaster_verifying_erc20_v07.Contract) +) + +func init() { + TokenContractCache = make(map[*common.Address]*contract_erc20.Contract) + V06EntryPointContractCache = make(map[global_const.Network]map[common.Address]*contract_entrypoint_v06.Contract) + V07EntryPointContractCache = make(map[global_const.Network]map[common.Address]*contract_entrypoint_v07.Contract) + deployCode, err := hex.DecodeString(EntryPointSimulationsDeploy[2:]) + if err != nil { + panic(err) + } + EntryPointSimulationsDeployCode = deployCode + +} + +type EthereumExecutor struct { + BaseExecutor + Client *ethclient.Client + GethClient *gethclient.Client + network global_const.Network + ChainId *big.Int +} + +var mu sync.Mutex + +func GetEthereumExecutor(network global_const.Network) *EthereumExecutor { + executor, ok := executorMap[network] + if ok { + return executor + } + + mu.Lock() + defer mu.Unlock() + executor, ok = executorMap[network] + if ok { + return executor + } + rpcUrl := config.GetNewWorkClientURl(network) + if rpcUrl == "" { + panic(xerrors.Errorf("network [%s] is not supported", network)) + } + client, err := ethclient.Dial(rpcUrl) + if err != nil { + panic(err) + } + chainId := big.NewInt(0) + _, success := chainId.SetString(config.GetChainId(network), 10) + if !success { + panic(xerrors.Errorf("chainId %s is invalid", config.GetChainId(network))) + } + geth := gethclient.New(client.Client()) + executorMap[network] = &EthereumExecutor{ + network: network, + Client: client, + ChainId: chainId, + GethClient: geth, + } + + return executorMap[network] +} + +func (executor *EthereumExecutor) GetEntryPointV6Deposit(entryPoint *common.Address, deposit common.Address) (*big.Int, error) { + contract, err := executor.GetEntryPoint06(entryPoint) + if err != nil { + return nil, err + } + depoistInfo, err := contract.GetDepositInfo(&bind.CallOpts{}, deposit) + if err != nil { + return nil, err + } + return depoistInfo.Deposit, nil +} +func (executor *EthereumExecutor) GetEntryPointV7Deposit(entryPoint *common.Address, depoist common.Address) (*big.Int, error) { + contract, err := executor.GetEntryPoint07(entryPoint) + if err != nil { + return nil, err + } + depositInfo, err := contract.GetDepositInfo(nil, depoist) + if err != nil { + return nil, err + } + return depositInfo.Deposit, nil +} + +func (executor *EthereumExecutor) GetUserTokenBalance(userAddress common.Address, token global_const.TokenType) (*big.Int, error) { + tokenAddress := config.GetTokenAddress(executor.network, token) //TODO + if tokenAddress == "" { + return nil, xerrors.Errorf("tokenType [%s] is not supported in [%s] network", token, executor.network) + } + ethTokenAddress := common.HexToAddress(tokenAddress) + tokenInstance, err := executor.GetTokenContract(ðTokenAddress) + if err != nil { + return nil, err + } + return tokenInstance.BalanceOf(&bind.CallOpts{}, userAddress) +} +func (executor *EthereumExecutor) CheckContractAddressAccess(contract *common.Address) (bool, error) { + client := executor.Client + + code, err := client.CodeAt(context.Background(), *contract, nil) + if err != nil { + return false, err + } + if len(code) == 0 { + return false, xerrors.Errorf("contract [%s] address not exist in [%s] network", contract, executor.network) + } + return true, nil +} + +func (executor *EthereumExecutor) GetTokenContract(tokenAddress *common.Address) (*contract_erc20.Contract, error) { + client := executor.Client + contract, ok := TokenContractCache[tokenAddress] + if !ok { + erc20Contract, err := contract_erc20.NewContract(*tokenAddress, client) + if err != nil { + return nil, err + } + TokenContractCache[tokenAddress] = erc20Contract + return erc20Contract, nil + } + return contract, nil +} + +func (executor *EthereumExecutor) EstimateUserOpCallGas(entrypointAddress *common.Address, userOpParam *user_op.UserOpInput) (*big.Int, error) { + client := executor.Client + userOpValue := *userOpParam + res, err := client.EstimateGas(context.Background(), ethereum.CallMsg{ + From: *entrypointAddress, + To: userOpValue.Sender, + Data: userOpValue.CallData, + }) + if err != nil { + return nil, err + } + return new(big.Int).SetUint64(res), nil +} +func (executor *EthereumExecutor) EstimateCreateSenderGas(entrypointAddress *common.Address, userOpParam *user_op.UserOpInput) (*big.Int, error) { + client := executor.Client + userOpValue := *userOpParam + factoryAddress, err := userOpValue.GetFactoryAddress() + if err != nil { + return nil, err + } + res, err := client.EstimateGas(context.Background(), ethereum.CallMsg{ + From: *entrypointAddress, + To: factoryAddress, + Data: userOpValue.InitCode, + }) + if err != nil { + return nil, err + } + return new(big.Int).SetUint64(res), nil +} + +// GetGasPrice uint256 gasFee = min(maxFeePerGas, maxPriorityFeePerGas + block.baseFee); +// maxPriorityFeePerGasBuffer = L1_fee / verificationGasLimit +func (executor *EthereumExecutor) GetGasPrice() (*model.GasPrice, error) { + + //The Arbitrum sequencer ignores priority fees and eth_maxPriorityFeePerGas always returns 0 + //On Optimism we set maxPriorityFeePerGas = l1_gas / l2_base_fee + client := executor.Client + logrus.Debugf("GetGasPrice network :[%s]", executor.network) + priceWei, priceWeiErr := client.SuggestGasPrice(context.Background()) + if priceWeiErr != nil { + return nil, priceWeiErr + } + logrus.Debugf("SuggestGasPrice priceWei :[%v]", priceWei) + priorityPriceWei, tiperr := client.SuggestGasTipCap(context.Background()) + if tiperr != nil { + return nil, tiperr + } + logrus.Debugf("SuggestGasTipCap priorityPriceWei :[%v]", priorityPriceWei) + result := model.GasPrice{} + result.MaxFeePerGas = priceWei + result.MaxPriorityFeePerGas = priorityPriceWei + + head, err := client.HeaderByNumber(context.Background(), nil) + if err != nil { + return nil, err + } + if head.BaseFee == nil { + if executor.network == global_const.ScrollSepolia || executor.network == global_const.ScrollMainnet { + head.BaseFee = big.NewInt(0) + } else { + return nil, xerrors.Errorf("baseFee is nil in [%s] network", executor.network) + } + } + result.BaseFee = head.BaseFee + return &result, nil + // + + //gasPriceInEther := new(big.Float).SetInt(priceWei) + //gasPriceInEther.Quo(gasPriceInEther, EthWeiFactor) + //gasPriceInGweiFloat, _ := gasPriceInGwei.Float64() + //result.MaxBasePriceGwei = gasPriceInGweiFloat + //result.MaxBasePriceEther = gasPriceInEther + // + //priorityPriceInGwei := new(big.Float).SetInt(priorityPriceWei) + //priorityPriceInGwei.Quo(priorityPriceInGwei, GweiFactor) + //priorityPriceInEther := new(big.Float).SetInt(priorityPriceWei) + //priorityPriceInEther.Quo(priorityPriceInEther, EthWeiFactor) + //priorityPriceInGweiFloat, _ := priorityPriceInGwei.Float64() + //result.MaxPriorityPriceGwei = priorityPriceInGweiFloat + //result.MaxPriorityPriceEther = gasPriceInEther + //return &result, nil +} + +// GetL1DataFee +// OpResource https://github.com/ethereum-optimism/optimism/blob/233ede59d16cb01bdd8e7ff662a153a4c3178bdd/packages/contracts/contracts/L2/predeploys/OVM_GasPriceOracle.sol#L109-L124 +// l1Gas = zeros * TX_DATA_ZERO_GAS + (nonZeros + 4) * TX_DATA_NON_ZERO_GAS +// l1GasFee = ((l1Gas + overhead) * l1BaseFee * scalar) / PRECISION +func (executor *EthereumExecutor) GetL1DataFee(data []byte) (*big.Int, error) { + address, ok := config.L1GasOracleInL2[executor.network] + if !ok { + return nil, xerrors.Errorf("L1GasOracleInL2 not found in network %s", executor.network) + } + + contract, err := l1_gas_oracle.NewContract(address, executor.Client) + if err != nil { + return nil, err + } + + abi, err := l1_gas_oracle.ContractMetaData.GetAbi() + if err != nil { + return nil, err + } + method := abi.Methods["getL1Fee"] + input, err := method.Inputs.Pack(data) + if err != nil { + return nil, err + } + fee, err := contract.GetL1Fee(nil, input) + if err != nil { + return nil, err + } + return fee, nil +} + +func (executor *EthereumExecutor) SimulateV06HandleOp(v06 *user_op.UserOpInput, entryPoint *common.Address) (*model.SimulateHandleOpResult, error) { + abi, err := contract_entrypoint_v06.ContractMetaData.GetAbi() + if err != nil { + return nil, err + } + callData, err := abi.Pack("simulateHandleOp", v06, global_const.EmptyAddress, []byte{}) + if err != nil { + return nil, xerrors.Errorf("pack Arg ERROR [%v]", err) + } + if callData == nil { + return nil, xerrors.Errorf("callData is nil") + } + client := executor.Client + req := utils.EthCallReq{ + From: global_const.EmptyAddress, + To: *entryPoint, + Data: callData, + } + logrus.Debugf("simulateHandleOp req :[%v]", req) + callErr := client.Client().CallContext(context.Background(), nil, "eth_call", &req, "latest") + logrus.Debugf("simulateHandleOp callErr :[%v]", callErr) + simResult, simErr := contract_entrypoint_v06.NewExecutionResult(callErr, abi) + if simErr != nil { + return nil, simErr + } + + return &model.SimulateHandleOpResult{ + PreOpGas: simResult.PreOpGas, + GasPaid: simResult.Paid, + ValidAfter: simResult.ValidAfter, + ValidUntil: simResult.ValidUntil, + TargetSuccess: simResult.TargetSuccess, + TargetResult: simResult.TargetResult, + SimulateUserOpCallData: callData, + }, nil +} + +func (executor *EthereumExecutor) SimulateV07HandleOp(userOpV07 user_op.UserOpInput, entryPoint *common.Address) (*model.SimulateHandleOpResult, error) { + var result *simulate_entrypoint.IEntryPointSimulationsExecutionResult + simulateAbi, err := simulate_entrypoint.ContractMetaData.GetAbi() + if err != nil { + return nil, err + } + + callData, err := simulateAbi.Pack("simulateHandleOp", &userOpV07, global_const.EmptyAddress, []byte{}) + logrus.Debugf("simulateHandleOp callData :[%s]", hex.EncodeToString(callData)) + if err != nil { + return nil, err + } + req := ethereum.CallMsg{ + From: global_const.EmptyAddress, + To: entryPoint, + Data: callData, + } + mapAcc := &map[common.Address]gethclient.OverrideAccount{ + *entryPoint: { + Code: EntryPointSimulationsDeployCode, + }, + } + logrus.Debugf("simulateHandleOp req :[%v]", req) + + gClient := executor.GethClient + byteResult, err := gClient.CallContractWithBlockOverrides(context.Background(), req, nil, mapAcc, gethclient.BlockOverrides{}) + + if err != nil { + abi, abiErr := simulate_entrypoint.ContractMetaData.GetAbi() + if abiErr != nil { + return nil, abiErr + } + errStr, parseErr := utils.ParseCallError(err, abi) + if parseErr != nil { + return nil, parseErr + } + return nil, xerrors.Errorf("SimulateV07HandleOp error [%v] Res [%s]", errStr, string(byteResult)) + + } + err = json.Unmarshal(byteResult, &result) + if err != nil { + return nil, err + } + return &model.SimulateHandleOpResult{ + PreOpGas: result.PreOpGas, + GasPaid: result.Paid, + TargetSuccess: result.TargetSuccess, + TargetResult: result.TargetResult, + }, nil +} +func (executor *EthereumExecutor) GetSimulateEntryPoint() (*simulate_entrypoint.Contract, error) { + contract, ok := SimulateEntryPointContractCache[executor.network] + if !ok { + contractInstance, err := simulate_entrypoint.NewContract(common.HexToAddress("0x"), executor.Client) + if err != nil { + return nil, err + } + SimulateEntryPointContractCache[executor.network] = contractInstance + return contractInstance, nil + } + return contract, nil +} +func (executor *EthereumExecutor) GetPaymasterDeposit(paymasterAddress *common.Address) (*big.Int, error) { + contract, err := executor.GetPaymasterErc20AndVerifyV06(paymasterAddress) + if err != nil { + return nil, err + } + deposit, err := contract.GetDeposit(&bind.CallOpts{}) + if err != nil { + return nil, err + } + return deposit, nil +} + +func (executor *EthereumExecutor) GetEntryPoint07(entryPoint *common.Address) (*contract_entrypoint_v07.Contract, error) { + contract, ok := V07EntryPointContractCache[executor.network][*entryPoint] + if !ok { + contractInstance, err := contract_entrypoint_v07.NewContract(*entryPoint, executor.Client) + if err != nil { + return nil, err + } + V07EntryPointContractCache[executor.network][*entryPoint] = contractInstance + return contractInstance, nil + } + return contract, nil +} +func (executor *EthereumExecutor) GetEntryPoint06(entryPoint *common.Address) (*contract_entrypoint_v06.Contract, error) { + contract, ok := V06EntryPointContractCache[executor.network][*entryPoint] + if !ok { + contractInstance, err := contract_entrypoint_v06.NewContract(*entryPoint, executor.Client) + if err != nil { + return nil, err + } + if V06EntryPointContractCache[executor.network] == nil { + V06EntryPointContractCache[executor.network] = make(map[common.Address]*contract_entrypoint_v06.Contract) + } + V06EntryPointContractCache[executor.network][*entryPoint] = contractInstance + return contractInstance, nil + } + return contract, nil + +} +func (executor *EthereumExecutor) GetPaymasterErc20AndVerifyV06(paymasterAddress *common.Address) (*paymaster_verifying_erc20_v06.Contract, error) { + contract, ok := V06PaymasterErc20AndPaymasterCache[executor.network][*paymasterAddress] + if !ok { + contractInstance, err := paymaster_verifying_erc20_v06.NewContract(*paymasterAddress, executor.Client) + if err != nil { + return nil, err + } + if V06PaymasterErc20AndPaymasterCache[executor.network] == nil { + V06PaymasterErc20AndPaymasterCache[executor.network] = make(map[common.Address]*paymaster_verifying_erc20_v06.Contract) + } + V06PaymasterErc20AndPaymasterCache[executor.network][*paymasterAddress] = contractInstance + return contractInstance, nil + } + return contract, nil +} +func (executor *EthereumExecutor) GetPaymasterErc20AndVerifyV07(paymasterAddress *common.Address) (*paymaster_verifying_erc20_v07.Contract, error) { + contract, ok := V07PaymasterErc20AndPaymasterCache[executor.network][*paymasterAddress] + if !ok { + contractInstance, err := paymaster_verifying_erc20_v07.NewContract(*paymasterAddress, executor.Client) + if err != nil { + return nil, err + } + if V07PaymasterErc20AndPaymasterCache[executor.network] == nil { + V07PaymasterErc20AndPaymasterCache[executor.network] = make(map[common.Address]*paymaster_verifying_erc20_v07.Contract) + } + V07PaymasterErc20AndPaymasterCache[executor.network][*paymasterAddress] = contractInstance + return contractInstance, nil + } + return contract, nil +} + +func (executor *EthereumExecutor) GetAuth() (*bind.TransactOpts, error) { + if executor.ChainId == nil { + return nil, xerrors.Errorf("chainId is nil") + } + return GetAuth(executor.ChainId, global_const.DummyPrivateKey) +} +func GetAuth(chainId *big.Int, privateKey *ecdsa.PrivateKey) (*bind.TransactOpts, error) { + signer := goEthereumTypes.LatestSignerForChainID(chainId) + address := crypto.PubkeyToAddress(privateKey.PublicKey) + return &bind.TransactOpts{ + From: address, + Signer: func(address common.Address, tx *goEthereumTypes.Transaction) (*goEthereumTypes.Transaction, error) { + if address != address { + return nil, bind.ErrNotAuthorized + } + signature, err := crypto.Sign(signer.Hash(tx).Bytes(), privateKey) + if err != nil { + return nil, err + } + return tx.WithSignature(signer, signature) + }, + Context: context.Background(), + }, nil +} +func (executor *EthereumExecutor) GetUserOpHash(userOp *user_op.UserOpInput, strategy *model.Strategy) ([]byte, string, error) { + version := strategy.GetStrategyEntrypointVersion() + erc20Token := common.HexToAddress("0x") + payType := strategy.GetPayType() + if payType == global_const.PayTypeERC20 { + tokenType := strategy.Erc20TokenType + tokenAddress := config.GetTokenAddress(strategy.GetNewWork(), tokenType) + erc20Token = common.HexToAddress(tokenAddress) + } + + if version == global_const.EntrypointV06 { + contract, err := executor.GetPaymasterErc20AndVerifyV06(strategy.GetPaymasterAddress()) + if err != nil { + return nil, "", err + } + contractUserOp := paymaster_verifying_erc20_v06.UserOperation{ + Sender: *userOp.Sender, + Nonce: userOp.Nonce, + InitCode: userOp.InitCode, + CallData: userOp.CallData, + CallGasLimit: userOp.CallGasLimit, + VerificationGasLimit: userOp.VerificationGasLimit, + PreVerificationGas: userOp.PreVerificationGas, + MaxFeePerGas: userOp.MaxFeePerGas, + MaxPriorityFeePerGas: userOp.MaxPriorityFeePerGas, + PaymasterAndData: userOp.PaymasterAndData, + Signature: userOp.Signature, + } + jsonString, _ := json.Marshal(contractUserOp) + logrus.Debug("opString :", string(jsonString)) + hash, err := contract.GetHash(&bind.CallOpts{}, contractUserOp, strategy.ExecuteRestriction.EffectiveEndTime, strategy.ExecuteRestriction.EffectiveStartTime, erc20Token, big.NewInt(0)) + if err != nil { + return nil, "", err + } + return hash[:], "", nil + } else if version == global_const.EntrypointV07 { + contract, err := executor.GetPaymasterErc20AndVerifyV07(strategy.GetPaymasterAddress()) + if err != nil { + return nil, "", err + } + packUserOp := paymaster_verifying_erc20_v07.PackedUserOperation{ + Sender: *userOp.Sender, + Nonce: userOp.Nonce, + InitCode: userOp.InitCode, + CallData: userOp.CallData, + AccountGasLimits: userOp.AccountGasLimits, + PreVerificationGas: userOp.PreVerificationGas, + GasFees: userOp.GasFees, + PaymasterAndData: userOp.PaymasterAndData, + Signature: userOp.Signature, + } + + jsonString, _ := json.Marshal(packUserOp) + logrus.Debug("opString:", string(jsonString)) + hash, err := contract.GetHash(&bind.CallOpts{}, packUserOp, strategy.ExecuteRestriction.EffectiveEndTime, strategy.ExecuteRestriction.EffectiveStartTime, erc20Token, big.NewInt(0)) + if err != nil { + return nil, "", err + } + return hash[:], "", nil + + } else { + return nil, "", xerrors.Errorf("entrypoint version %s not support", version) + } + +} +func (executor *EthereumExecutor) GetPaymasterData(userOp *user_op.UserOpInput, strategy *model.Strategy, paymasterDataInput *paymaster_data.PaymasterDataInput) ([]byte, error) { + userOpHash, _, err := executor.GetUserOpHash(userOp, strategy) + if err != nil { + logrus.Errorf("GetUserOpHash error [%v]", err) + return nil, err + } + signer := config.GetSigner(strategy.GetNewWork()) + signature, err := utils.GetSign(userOpHash, signer.PrivateKey) + if err != nil { + return nil, err + } + dataGenerateFunc := paymaster_pay_type.GetGenerateFunc(strategy.GetPayType()) + paymasterData, err := dataGenerateFunc(paymasterDataInput, signature) + return paymasterData, err +} diff --git a/common/network/ethereum_adaptable_executor_test.go b/common/network/ethereum_adaptable_executor_test.go new file mode 100644 index 00000000..cb6197f6 --- /dev/null +++ b/common/network/ethereum_adaptable_executor_test.go @@ -0,0 +1,367 @@ +package network + +import ( + "AAStarCommunity/EthPaymaster_BackService/common/global_const" + "AAStarCommunity/EthPaymaster_BackService/common/model" + "AAStarCommunity/EthPaymaster_BackService/common/paymaster_data" + "AAStarCommunity/EthPaymaster_BackService/common/user_op" + "AAStarCommunity/EthPaymaster_BackService/common/utils" + "AAStarCommunity/EthPaymaster_BackService/config" + "context" + "encoding/hex" + "encoding/json" + "github.com/ethereum/go-ethereum/common" + "github.com/sirupsen/logrus" + "testing" +) + +func TestEthereumAdaptableExecutor(t *testing.T) { + if testing.Short() { + t.Skip("skipping test in short mode.") + } + config.InitConfig("../../config/basic_strategy_config.json", "../../config/basic_config.json", "../../config/secret_config.json") + logrus.SetLevel(logrus.DebugLevel) + op, err := user_op.NewUserOp(utils.GenerateMockUservOperation()) + if err != nil { + t.Error(err) + return + } + userAddresss := common.HexToAddress("0xFD44DF0Fe211d5EFDBe1423483Fcb3FDeF84540f") + tests := []struct { + name string + test func(t *testing.T) + }{ + { + "TestEthereumSepoliaClientConnect", + func(t *testing.T) { + testEthereumExecutorClientConnect(t, global_const.EthereumSepolia) + }, + }, + + { + "TestScrollSepoliaClientConnect", + func(t *testing.T) { + testEthereumExecutorClientConnect(t, global_const.ScrollSepolia) + }, + }, + { + "TestOptimismSepoliaClientConnect", + func(t *testing.T) { + testEthereumExecutorClientConnect(t, global_const.OptimismSepolia) + }, + }, + { + "TestArbitrumSpeoliaClientConnect", + func(t *testing.T) { + testEthereumExecutorClientConnect(t, global_const.ArbitrumSpeolia) + }, + }, + { + "TestGetUseOpHash", + func(t *testing.T) { + strategy := config.GetBasicStrategyConfig("Ethereum_Sepolia_v06_verifyPaymaster") + t.Logf("paymaster Address %s", strategy.GetPaymasterAddress()) + testGetUserOpHash(t, *op, strategy) + }, + }, + { + "TestGetUseOpHashV07", + func(t *testing.T) { + strategy := config.GetBasicStrategyConfig("Ethereum_Sepolia_v07_verifyPaymaster") + t.Logf("paymaster Address %s", strategy.GetPaymasterAddress()) + testGetUserOpHash(t, *op, strategy) + }, + }, + { + "TestSepoliaSimulateV06HandleOp", + func(t *testing.T) { + strategy := config.GetBasicStrategyConfig(global_const.StrategyCodeEthereumSepoliaV06Verify) + testSimulateHandleOp(t, global_const.EthereumSepolia, strategy) + }, + }, + { + "TestSepoliaSimulateV06HandleOp", + func(t *testing.T) { + strategy := config.GetBasicStrategyConfig(global_const.StrategyCodeOptimismSepoliaV06Verify) + testSimulateHandleOp(t, global_const.OptimismSepolia, strategy) + }, + }, + //{ + // "TestScrollSepoliaSimulateV06HandleOp", + // func(t *testing.T) { + // strategy := conf.GetBasicStrategyConfig(global_const.StrategyCodeScrollSepoliaV06Verify) + // testSimulateHandleOp(t, global_const.ScrollSepolia, strategy) + // }, + //}, + //{ TODO Support V07 later + // "TestSepoliaSimulateV07HandleOp", + // func(t *testing.T) { + // strategy := config.GetBasicStrategyConfig(global_const.StrategyCodeEthereumSepoliaV07Verify) + // + // testSimulateHandleOp(t, global_const.EthereumSepolia, strategy) + // }, + //}, + { + "TestGetPaymasterAndDataV07", + func(t *testing.T) { + strategy := config.GetBasicStrategyConfig(global_const.StrategyCodeEthereumSepoliaV07Verify) + testGetPaymasterData(t, global_const.EthereumSepolia, op, strategy) + }, + }, + { + "TestEthExecutorGetPrice", + func(t *testing.T) { + testGetPrice(t, global_const.EthereumSepolia) + }, + }, + { + "TestScrollExecutorGetPrice", + func(t *testing.T) { + testGetPrice(t, global_const.ScrollSepolia) + }, + }, + { + "TestSepoliaGetUserTokenBalance", + func(t *testing.T) { + testGetBalance(t, global_const.EthereumSepolia, userAddresss) + }, + }, + { + "checkContractAddressAccess", + func(t *testing.T) { + address := common.HexToAddress("0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789") + testCheckContractAddressAccess(t, global_const.EthereumSepolia, address) + }, + }, + { + "checkContractAddressAccess", + func(t *testing.T) { + address := common.HexToAddress("0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789") + testCheckContractAddressAccess(t, global_const.ScrollSepolia, address) + }, + }, + { + "TestEstimateUserOpCallGas", + func(t *testing.T) { + strategy := config.GetBasicStrategyConfig("Ethereum_Sepolia_v06_verifyPaymaster") + entrypointAddress := strategy.GetEntryPointAddress() + testEstimateUserOpCallGas(t, global_const.EthereumSepolia, op, entrypointAddress) + }, + }, + { + "TestEstimateCreateSenderGas", + func(t *testing.T) { + strategy := config.GetBasicStrategyConfig("Ethereum_Sepolia_v06_verifyPaymaster") + entrypointAddress := strategy.GetEntryPointAddress() + testEstimateCreateSenderGas(t, global_const.EthereumSepolia, op, entrypointAddress) + }, + }, + { + "TestOptimismGetL1DataFee", + func(t *testing.T) { + strategy := config.GetBasicStrategyConfig("Optimism_Sepolia_v06_verifyPaymaster") + + testGetL1DataFee(t, global_const.OptimismSepolia, *op, strategy.GetStrategyEntrypointVersion()) + }, + }, + { + "TestOpPreVerificationGasFunc", + func(t *testing.T) { + + }, + }, + } + for _, tt := range tests { + t.Run(tt.name, tt.test) + } +} + +func testGetL1DataFee(t *testing.T, chain global_const.Network, input user_op.UserOpInput, version global_const.EntrypointVersion) { + executor := GetEthereumExecutor(chain) + if executor == nil { + t.Error("executor is nil") + } + _, data, err := input.PackUserOpForMock(version) + if err != nil { + t.Error(err) + return + } + l1DataFee, err := executor.GetL1DataFee(data) + if err != nil { + t.Error(err) + return + } + t.Logf("l1DataFee: %v", l1DataFee) +} +func testEstimateUserOpCallGas(t *testing.T, chain global_const.Network, userOpParam *user_op.UserOpInput, entpointAddress *common.Address) { + executor := GetEthereumExecutor(chain) + if executor == nil { + t.Error("executor is nil") + } + gasResult, err := executor.EstimateUserOpCallGas(entpointAddress, userOpParam) + if err != nil { + t.Error(err) + return + } + t.Logf("gasResult: %v", gasResult) +} +func testEstimateCreateSenderGas(t *testing.T, chain global_const.Network, userOpParam *user_op.UserOpInput, entrypointAddress *common.Address) { + executor := GetEthereumExecutor(chain) + if executor == nil { + t.Error("executor is nil") + } + gasResult, err := executor.EstimateCreateSenderGas(entrypointAddress, userOpParam) + if err != nil { + t.Error(err) + return + } + t.Logf("gasResult: %v", gasResult) +} +func testCheckContractAddressAccess(t *testing.T, chain global_const.Network, address common.Address) { + executor := GetEthereumExecutor(chain) + if executor == nil { + t.Error("executor is nil") + } + res, err := executor.CheckContractAddressAccess(&address) + if err != nil { + t.Error(err) + return + } + if !res { + t.Error("checkContractAddressAccess failed") + } +} +func testGetBalance(t *testing.T, chain global_const.Network, address common.Address) { + executor := GetEthereumExecutor(chain) + if executor == nil { + t.Error("executor is nil") + } + balance, err := executor.GetUserTokenBalance(address, global_const.TokenTypeUSDC) + if err != nil { + t.Error(err) + return + } + t.Logf("balance: %v", balance) +} + +func testGetPrice(t *testing.T, chain global_const.Network) { + executor := GetEthereumExecutor(chain) + if executor == nil { + t.Error("executor is nil") + } + price, err := executor.GetGasPrice() + if err != nil { + t.Error(err) + return + } + t.Logf("price: %v", price) +} +func testGetUserOpHash(t *testing.T, input user_op.UserOpInput, strategy *model.Strategy) { + executor := GetEthereumExecutor(strategy.GetNewWork()) + if executor == nil { + t.Error("executor is nil") + } + + if strategy.GetStrategyEntrypointVersion() == global_const.EntrypointV07 { + input.AccountGasLimits = user_op.DummyAccountGasLimits + input.GasFees = user_op.DummyGasFees + } + res, _, err := executor.GetUserOpHash(&input, strategy) + if err != nil { + t.Error(err) + return + } + t.Logf("userOpHash: %s", hex.EncodeToString(res)) +} + +func testGetPaymasterData(t *testing.T, chain global_const.Network, input *user_op.UserOpInput, strategy *model.Strategy) { + executor := GetEthereumExecutor(chain) + if executor == nil { + t.Error("executor is nil") + } + t.Logf("entryPoint Address %s", strategy.GetEntryPointAddress()) + dataInput := paymaster_data.NewPaymasterDataInput(strategy) + dataInput.PaymasterPostOpGasLimit = global_const.DummyPaymasterPostoperativelyBigint + dataInput.PaymasterVerificationGasLimit = global_const.DummyPaymasterOversimplificationBigint + paymasterData, err := executor.GetPaymasterData(input, strategy, dataInput) + if err != nil { + t.Error(err) + return + } + t.Logf("paymasterData: %v", hex.EncodeToString(paymasterData)) + +} +func testSimulateHandleOp(t *testing.T, chain global_const.Network, strategy *model.Strategy) { + sepoliaExector := GetEthereumExecutor(chain) + op, newErr := user_op.NewUserOp(utils.GenerateMockUservOperation()) + if newErr != nil { + t.Error(newErr) + return + } + dataInput := paymaster_data.NewPaymasterDataInput(strategy) + op.AccountGasLimits = user_op.DummyAccountGasLimits + op.GasFees = user_op.DummyGasFees + paymasterData, err := sepoliaExector.GetPaymasterData(op, strategy, dataInput) + if err != nil { + t.Error(err) + return + } + op.PaymasterAndData = paymasterData + opMap := parseOpToMapV7(*op) + opJson, _ := json.Marshal(opMap) + t.Logf("SimulateHandleOp op: %v", string(opJson)) + + t.Logf("entryPoint Address %s", strategy.GetEntryPointAddress()) + version := strategy.GetStrategyEntrypointVersion() + t.Logf("version: %s", version) + var simulateResult *model.SimulateHandleOpResult + if version == global_const.EntrypointV06 { + simulateResult, err = sepoliaExector.SimulateV06HandleOp(op, strategy.GetEntryPointAddress()) + } else if version == global_const.EntrypointV07 { + + simulateResult, err = sepoliaExector.SimulateV07HandleOp(*op, strategy.GetEntryPointAddress()) + } + + if err != nil { + t.Error(err) + return + } + if simulateResult == nil { + t.Error("simulataResult is nil") + return + } + t.Logf("simulateResult: %v", simulateResult) + callData := simulateResult.SimulateUserOpCallData + t.Logf("callData: %v", hex.EncodeToString(callData)) +} +func parseOpToMapV7(input user_op.UserOpInput) map[string]string { + opMap := make(map[string]string) + opMap["sender"] = input.Sender.String() + opMap["Nonce"] = input.Nonce.String() + opMap["initCode"] = utils.EncodeToStringWithPrefix(input.InitCode[:]) + opMap["accountGasLimits"] = utils.EncodeToStringWithPrefix(input.AccountGasLimits[:]) + opMap["preVerificationGas"] = input.PreVerificationGas.String() + opMap["gasFees"] = utils.EncodeToStringWithPrefix(input.GasFees[:]) + opMap["paymasterAndData"] = utils.EncodeToStringWithPrefix(input.PaymasterAndData[:]) + opMap["signature"] = utils.EncodeToStringWithPrefix(input.Signature[:]) + return opMap +} + +func testEthereumExecutorClientConnect(t *testing.T, chain global_const.Network) { + executor := GetEthereumExecutor(chain) + if executor == nil { + t.Error("executor is nil") + } + client := executor.Client + chainId, err := client.ChainID(context.Background()) + if err != nil { + t.Error(err) + } + if chainId == nil { + t.Error("chainId is nil") + } + if chainId.String() != executor.ChainId.String() { + t.Fatalf(" %s chainId not equal %s", chainId.String(), executor.ChainId.String()) + } + t.Logf("network %s chainId: %s", chain, chainId.String()) +} diff --git a/common/network/pre_verification_gas_test.go b/common/network/pre_verification_gas_test.go new file mode 100644 index 00000000..0e8b613c --- /dev/null +++ b/common/network/pre_verification_gas_test.go @@ -0,0 +1,30 @@ +package network + +import ( + "AAStarCommunity/EthPaymaster_BackService/config" + "github.com/sirupsen/logrus" + "testing" +) + +func TestPreVerGas(t *testing.T) { + if testing.Short() { + t.Skip("skipping test in short mode.") + } + config.InitConfig("../../config/basic_strategy_config.json", "../../config/basic_config.json", "../../config/secret_config.json") + logrus.SetLevel(logrus.DebugLevel) + + tests := []struct { + name string + test func(t *testing.T) + }{ + { + "TestOpPreVerGas", + func(t *testing.T) { + + }, + }, + } + for _, tt := range tests { + t.Run(tt.name, tt.test) + } +} diff --git a/common/network/starknet/starknet_executor_test.go b/common/network/starknet/starknet_executor_test.go new file mode 100644 index 00000000..66ef3736 --- /dev/null +++ b/common/network/starknet/starknet_executor_test.go @@ -0,0 +1,25 @@ +package starknet + +import ( + "context" + "fmt" + "github.com/NethermindEth/starknet.go/rpc" + "testing" +) + +func TestDemo(t *testing.T) { + //only read + starkProvider, err := rpc.NewProvider("https://starknet-sepolia.public.blastapi.io/rpc/v0_7") + if err != nil { + t.Fatalf("Error: %v", err) + return + } + chainId, chainIdError := starkProvider.ChainID(context.Background()) + if chainIdError != nil { + t.Fatalf("Error: %v", chainIdError) + return + } + //starkProvider.SimulateTransactions() + fmt.Println(chainId) + +} diff --git a/common/network/starknet_executor.go b/common/network/starknet_executor.go new file mode 100644 index 00000000..dfe3db04 --- /dev/null +++ b/common/network/starknet_executor.go @@ -0,0 +1,17 @@ +package network + +import "AAStarCommunity/EthPaymaster_BackService/common/model" + +type StarknetExecutor struct { + BaseExecutor +} + +func init() { + +} +func GetStarknetExecutor() *StarknetExecutor { + return &StarknetExecutor{} +} +func (executor *StarknetExecutor) GetGasPrice() (*model.GasPrice, error) { + return nil, nil +} diff --git a/common/paymaster_data/paymaster_data.go b/common/paymaster_data/paymaster_data.go new file mode 100644 index 00000000..0a43692f --- /dev/null +++ b/common/paymaster_data/paymaster_data.go @@ -0,0 +1,47 @@ +package paymaster_data + +import ( + "AAStarCommunity/EthPaymaster_BackService/common/global_const" + "AAStarCommunity/EthPaymaster_BackService/common/model" + "AAStarCommunity/EthPaymaster_BackService/config" + "github.com/ethereum/go-ethereum/common" + "github.com/sirupsen/logrus" + "math/big" +) + +type PaymasterDataInput struct { + Paymaster common.Address + ValidUntil *big.Int + ValidAfter *big.Int + ERC20Token common.Address + ExchangeRate *big.Int + PayType global_const.PayType + EntryPointVersion global_const.EntrypointVersion + PaymasterVerificationGasLimit *big.Int + PaymasterPostOpGasLimit *big.Int +} + +func NewPaymasterDataInput(strategy *model.Strategy) *PaymasterDataInput { + start := strategy.ExecuteRestriction.EffectiveStartTime + end := strategy.ExecuteRestriction.EffectiveEndTime + var tokenAddress string + if strategy.GetPayType() == global_const.PayTypeERC20 { + tokenAddress = config.GetTokenAddress(strategy.GetNewWork(), strategy.Erc20TokenType) + + } else { + tokenAddress = global_const.DummyAddress.String() + logrus.Debug("token address ", tokenAddress) + } + + return &PaymasterDataInput{ + Paymaster: *strategy.GetPaymasterAddress(), + ValidUntil: big.NewInt(end.Int64()), + ValidAfter: big.NewInt(start.Int64()), + ERC20Token: common.HexToAddress(tokenAddress), + ExchangeRate: big.NewInt(0), + PayType: strategy.GetPayType(), + EntryPointVersion: strategy.GetStrategyEntrypointVersion(), + PaymasterVerificationGasLimit: global_const.DummyPaymasterOversimplificationBigint, + PaymasterPostOpGasLimit: global_const.DummyPaymasterPostoperativelyBigint, + } +} diff --git a/common/paymaster_pay_type/paymaster_data_generate.go b/common/paymaster_pay_type/paymaster_data_generate.go new file mode 100644 index 00000000..c8414179 --- /dev/null +++ b/common/paymaster_pay_type/paymaster_data_generate.go @@ -0,0 +1,73 @@ +package paymaster_pay_type + +import ( + "AAStarCommunity/EthPaymaster_BackService/common/ethereum_contract/paymaster_abi" + "AAStarCommunity/EthPaymaster_BackService/common/global_const" + "AAStarCommunity/EthPaymaster_BackService/common/paymaster_data" + "AAStarCommunity/EthPaymaster_BackService/common/utils" + "github.com/ethereum/go-ethereum/accounts/abi" + "golang.org/x/xerrors" +) + +var paymasterDataFuncMap = map[global_const.PayType]GeneratePaymasterDataFunc{} +var BasicPaymasterDataAbiV06 abi.Arguments +var BasicPaymasterDataAbiV07 abi.Arguments +var basicPaymasterDataFunc = func(data *paymaster_data.PaymasterDataInput, signature []byte) ([]byte, error) { + var packedRes []byte + if data.EntryPointVersion == global_const.EntrypointV06 { + v06Packed, err := BasicPaymasterDataAbiV06.Pack(data.ValidUntil, data.ValidAfter, data.ERC20Token, data.ExchangeRate) + if err != nil { + return nil, err + } + packedRes = v06Packed + } else if data.EntryPointVersion == global_const.EntrypointV07 { + accountGasLimit := utils.PackIntTo32Bytes(data.PaymasterVerificationGasLimit, data.PaymasterPostOpGasLimit) + v07Packed, err := BasicPaymasterDataAbiV07.Pack(accountGasLimit, data.ValidUntil, data.ValidAfter, data.ERC20Token, data.ExchangeRate) + if err != nil { + return nil, err + } + packedRes = v07Packed + } else { + return nil, xerrors.Errorf("unsupported entrypoint version") + } + + concat := data.Paymaster.Bytes() + concat = append(concat, packedRes...) + concat = append(concat, signature...) + return concat, nil +} + +func init() { + paymasterDataFuncMap[global_const.PayTypeVerifying] = basicPaymasterDataFunc + paymasterDataFuncMap[global_const.PayTypeERC20] = basicPaymasterDataFunc + paymasterDataFuncMap[global_const.PayTypeSuperVerifying] = func(data *paymaster_data.PaymasterDataInput, signature []byte) ([]byte, error) { + packed, err := BasicPaymasterDataAbiV06.Pack(data.ValidUntil, data.ValidAfter, data.ERC20Token, data.ExchangeRate) + if err != nil { + return nil, err + } + + concat := data.Paymaster.Bytes() + concat = append(concat, packed...) + concat = append(concat, signature...) + return concat, nil + } + BasicPaymasterDataAbiV07 = abi.Arguments{ + {Name: "accountGasLimit", Type: paymaster_abi.Bytes32Type}, + {Name: "validUntil", Type: paymaster_abi.Uint48Type}, + {Name: "validAfter", Type: paymaster_abi.Uint48Type}, + {Name: "erc20Token", Type: paymaster_abi.AddressType}, + {Name: "exchangeRate", Type: paymaster_abi.Uint256Type}, + } + BasicPaymasterDataAbiV06 = abi.Arguments{ + {Name: "validUntil", Type: paymaster_abi.Uint48Type}, + {Name: "validAfter", Type: paymaster_abi.Uint48Type}, + {Name: "erc20Token", Type: paymaster_abi.AddressType}, + {Name: "exchangeRate", Type: paymaster_abi.Uint256Type}, + } + +} +func GetGenerateFunc(payType global_const.PayType) GeneratePaymasterDataFunc { + return paymasterDataFuncMap[payType] +} + +type GeneratePaymasterDataFunc = func(data *paymaster_data.PaymasterDataInput, signature []byte) ([]byte, error) diff --git a/common/price_compoent/price_util.go b/common/price_compoent/price_util.go new file mode 100644 index 00000000..61b3d36a --- /dev/null +++ b/common/price_compoent/price_util.go @@ -0,0 +1,91 @@ +package price_compoent + +import ( + "AAStarCommunity/EthPaymaster_BackService/common/global_const" + "AAStarCommunity/EthPaymaster_BackService/config" + "fmt" + "golang.org/x/xerrors" + "io" + "io/ioutil" + "log" + "net/http" + "net/url" + "os" + "strconv" + "strings" +) + +var ( + URLMap = map[global_const.TokenType]string{} + httpClient = &http.Client{} +) + +type Price struct { +} + +func init() { + URLMap = make(map[global_const.TokenType]string) + URLMap[global_const.TokenTypeETH] = "https://api.coingecko.com/api/v3/simple/price?ids=ethereum&vs_currencies=usd" + URLMap[global_const.TokenTypeOP] = "https://api.coingecko.com/api/v3/simple/price?ids=optimism&vs_currencies=usd" +} + +func GetPriceUsd(tokenType global_const.TokenType) (float64, error) { + + if global_const.IsStableToken(tokenType) { + return 1, nil + } + //if tokenType == global_const.ETH { + // return 3100, nil + //} + tokenUrl, ok := URLMap[tokenType] + if !ok { + return 0, xerrors.Errorf("tokens type [%w] not found", tokenType) + } + req, _ := http.NewRequest("GET", tokenUrl, nil) + //TODO remove APIKey + req.Header.Add("x-cg-demo-api-key", config.GetPriceOracleApiKey()) + + res, _ := http.DefaultClient.Do(req) + + defer res.Body.Close() + body, _ := io.ReadAll(res.Body) + bodystr := string(body) + strarr := strings.Split(bodystr, ":") + usdstr := strings.TrimRight(strarr[2], "}}") + return strconv.ParseFloat(usdstr, 64) +} + +// GetToken Get The FromToken/ToToken Rate +func GetToken(fromToken global_const.TokenType, toToken global_const.TokenType) (float64, error) { + if toToken == global_const.TokenTypeUSDT { + return GetPriceUsd(fromToken) + } + formTokenPrice, _ := GetPriceUsd(fromToken) + toTokenPrice, _ := GetPriceUsd(toToken) + + return formTokenPrice / toTokenPrice, nil +} + +func GetCoinMarketPrice() { + req, err := http.NewRequest("GET", "https://pro-api.coinmarketcap.com/v2/tools/price-conversion", nil) + if err != nil { + log.Print(err) + os.Exit(1) + } + q := url.Values{} + q.Add("amount", "2") + q.Add("symbol", "BTC") + q.Add("convert", "USD") + + req.Header.Set("Accepts", "application/json") + req.Header.Add("X-CMC_PRO_API_KEY", "a1441679-b8fd-49a0-aa47-51f88f7d3d52") + req.URL.RawQuery = q.Encode() + resp, err := httpClient.Do(req) + if err != nil { + fmt.Println("Error sending request to server") + os.Exit(1) + } + fmt.Println(resp.Status) + respBody, _ := ioutil.ReadAll(resp.Body) + fmt.Println(string(respBody)) +} diff --git a/common/price_compoent/price_util_test.go b/common/price_compoent/price_util_test.go new file mode 100644 index 00000000..9f104f77 --- /dev/null +++ b/common/price_compoent/price_util_test.go @@ -0,0 +1,53 @@ +package price_compoent + +import ( + "AAStarCommunity/EthPaymaster_BackService/common/global_const" + "AAStarCommunity/EthPaymaster_BackService/config" + "fmt" + "strconv" + "testing" +) + +func TestPriceUtilTest(t *testing.T) { + if testing.Short() { + t.Skip("skipping test in short mode.") + } + config.InitConfig("../../config/basic_strategy_config.json", "../../config/basic_config.json", "../../config/secret_config.json") + tests := []struct { + name string + test func(t *testing.T) + }{ + { + "test_ETH_GetPriceUsd", + func(t *testing.T) { + testGetPriceUsd(t, global_const.TokenTypeETH) + }, + }, + { + "test_OP_GetPriceUsd", + func(t *testing.T) { + testGetPriceUsd(t, global_const.TokenTypeOP) + }, + }, + } + for _, tt := range tests { + t.Run(tt.name, tt.test) + } +} +func testGetPriceUsd(t *testing.T, tokenType global_const.TokenType) { + price, err := GetPriceUsd(tokenType) + if err != nil { + t.Fatal(err) + + } + t.Logf("price:%v", price) +} + +func TestDemo(t *testing.T) { + str := "0000000000000000000000000000000000000000000000000000000000000002" + fmt.Printf(strconv.Itoa(len(str))) +} + +func TestGetCoinMarketPrice(t *testing.T) { + GetCoinMarketPrice() +} diff --git a/common/types/chain.go b/common/types/chain.go deleted file mode 100644 index fa0e68d1..00000000 --- a/common/types/chain.go +++ /dev/null @@ -1,22 +0,0 @@ -package types - -type NetworkInfo struct { - Name string `json:"main_net_name"` - RpcUrl string `json:"main_net_rpc_url"` -} - -//type Chain string -// -//const ( -// Ethereum Chain = "Ethereum" -// Arbitrum Chain = "Arbitrum" -// Optimism Chain = "Optimism" -//) - -type NetWork string - -const ( - Ethereum NetWork = "ethereum" - Sepolia NetWork = "sepolia" - Arbitrum NetWork = "arbitrum" -) diff --git a/common/types/token.go b/common/types/token.go deleted file mode 100644 index f5321605..00000000 --- a/common/types/token.go +++ /dev/null @@ -1,8 +0,0 @@ -package types - -type TokenType string - -const ( - USDT TokenType = "USDT" - ETH TokenType = "ETH" -) diff --git a/common/user_op/user_op_test.go b/common/user_op/user_op_test.go new file mode 100644 index 00000000..0bc47957 --- /dev/null +++ b/common/user_op/user_op_test.go @@ -0,0 +1,54 @@ +package user_op + +import ( + "AAStarCommunity/EthPaymaster_BackService/common/global_const" + "AAStarCommunity/EthPaymaster_BackService/common/utils" + "testing" +) + +func TestUserOp(t *testing.T) { + userOpMap := utils.GenerateMockUservOperation() + userOp, err := NewUserOp(userOpMap) + if err != nil { + t.Error(err) + return + } + if userOp == nil { + t.Error("userOp is nil") + return + } + t.Logf("userOp: %v", userOp) + + tests := []struct { + name string + test func(t *testing.T) + }{ + { + "TestPackUserOpV6", + func(t *testing.T) { + testPackUserOp(t, userOp, global_const.EntrypointV06) + }, + }, + { + "TestPackUserOpV7", + func(t *testing.T) { + testPackUserOp(t, userOp, global_const.EntrypointV07) + }, + }, + } + for _, tt := range tests { + t.Run(tt.name, tt.test) + } +} +func testPackUserOp(t *testing.T, userOp *UserOpInput, version global_const.EntrypointVersion) { + res, _, err := userOp.PackUserOpForMock(version) + if err != nil { + t.Error(err) + return + } + if res == "" { + t.Error("res is nil") + return + } + +} diff --git a/common/user_op/user_operation.go b/common/user_op/user_operation.go new file mode 100644 index 00000000..32167b9e --- /dev/null +++ b/common/user_op/user_operation.go @@ -0,0 +1,381 @@ +package user_op + +import ( + "AAStarCommunity/EthPaymaster_BackService/common/ethereum_contract/paymaster_abi" + "AAStarCommunity/EthPaymaster_BackService/common/global_const" + "AAStarCommunity/EthPaymaster_BackService/common/utils" + "encoding/hex" + "github.com/ethereum/go-ethereum/accounts/abi" + "github.com/ethereum/go-ethereum/common" + "github.com/go-playground/validator/v10" + "github.com/mitchellh/mapstructure" + "golang.org/x/xerrors" + "math/big" + "reflect" + "strconv" + "sync" +) + +var ( + DummyGasFees = utils.PackIntTo32Bytes(global_const.DummyMaxPriorityFeePerGas, global_const.DummyMaxFeePerGas) + DummyAccountGasLimits = utils.PackIntTo32Bytes(global_const.DummyVerificationGasLimit, global_const.DummyCallGasLimit) + MinPreVerificationGas *big.Int + validate = validator.New() + onlyOnce = sync.Once{} + userOPV06GetHashArguments abi.Arguments + UserOpV07GetHashArguments abi.Arguments + userOpV06PackArg abi.Arguments + UserOpV07PackArg abi.Arguments +) + +func init() { + MinPreVerificationGas = big.NewInt(21000) + + userOPV06GetHashArguments = abi.Arguments{ + { + Type: paymaster_abi.BytesType, + }, + { + Type: paymaster_abi.Uint256Type, + }, + { + Type: paymaster_abi.AddressType, + }, + { + Type: paymaster_abi.Uint256Type, + }, + { + Type: paymaster_abi.Uint48Type, + }, + { + Type: paymaster_abi.Uint48Type, + }, + } + UserOpV07GetHashArguments = abi.Arguments{ + { + Type: paymaster_abi.AddressType, //Sender + }, + { + Type: paymaster_abi.Uint256Type, //userOp.nonce + }, + { + Type: paymaster_abi.Bytes32Type, //keccak256(userOp.initCode), + }, + { + Type: paymaster_abi.Bytes32Type, //keccak256(userOp.callData), + }, + { + Type: paymaster_abi.Bytes32Type, //userOp.accountGasLimits, + }, + { + Type: paymaster_abi.Uint256Type, //uint256(bytes32(userOp.paymasterAndData[PAYMASTER_VALIDATION_GAS_OFFSET : PAYMASTER_DATA_OFFSET])), + }, + { + Type: paymaster_abi.Uint256Type, // userOp.preVerificationGas, + }, + { + Type: paymaster_abi.Uint256Type, //userOp.gasFees, + }, + { + Type: paymaster_abi.Uint256Type, //block.chainid, + }, + { + Type: paymaster_abi.AddressType, //address(this), + }, + { + Type: paymaster_abi.Uint48Type, // validUntil, + }, + { + Type: paymaster_abi.Uint48Type, // validAfter, + }, + } + userOpV06PackArg = abi.Arguments{ + { + Name: "Sender", + Type: paymaster_abi.AddressType, + }, + { + Name: "Nonce", + Type: paymaster_abi.Uint256Type, + }, + { + Name: "InitCode", + Type: paymaster_abi.BytesType, + }, + { + Name: "CallData", + Type: paymaster_abi.BytesType, + }, + { + Name: "CallGasLimit", + Type: paymaster_abi.Uint256Type, + }, + { + Name: "VerificationGasLimit", + Type: paymaster_abi.Uint256Type, + }, + { + Name: "PreVerificationGas", + Type: paymaster_abi.Uint256Type, + }, + { + Name: "MaxFeePerGas", + Type: paymaster_abi.Uint256Type, + }, + { + Name: "MaxPriorityFeePerGas", + Type: paymaster_abi.Uint256Type, + }, + { + Name: "PaymasterAndData", + Type: paymaster_abi.BytesType, + }, + { + Name: "Signature", + Type: paymaster_abi.BytesType, + }, + } + UserOpV07PackArg = abi.Arguments{ + { + Name: "Sender", + Type: paymaster_abi.AddressType, + }, + { + Name: "Nonce", + Type: paymaster_abi.Uint256Type, + }, + { + Name: "InitCode", + Type: paymaster_abi.BytesType, + }, + { + Name: "CallData", + Type: paymaster_abi.BytesType, + }, + { + Name: "AccountGasLimits", + Type: paymaster_abi.Bytes32Type, + }, + { + Name: "PreVerificationGas", + Type: paymaster_abi.Uint256Type, + }, + { + Name: "GasFees", + Type: paymaster_abi.Bytes32Type, + }, + { + Name: "PaymasterAndData", + Type: paymaster_abi.BytesType, + }, + { + Name: "Signature", + Type: paymaster_abi.BytesType, + }, + } +} + +type BaseUserOperation struct { + Sender *common.Address `json:"sender" mapstructure:"sender" binding:"required,hexParam"` + Nonce *big.Int `json:"nonce" mapstructure:"nonce" binding:"required"` + InitCode []byte `json:"initCode" mapstructure:"initCode" ` + CallData []byte `json:"callData" mapstructure:"callData" binding:"required"` + PreVerificationGas *big.Int `json:"preVerificationGas" mapstructure:"pre_verification_gas" binding:"required"` + PaymasterAndData []byte `json:"paymasterAndData" mapstructure:"paymaster_and_data"` + Signature []byte `json:"signature" mapstructure:"signature" binding:"required"` +} + +// UserOperationV06 entrypoint v0.0.6 +// verificationGasLimit validateUserOp ,validatePaymasterUserOp limit +// callGasLimit calldata Execute gas limit +// preVerificationGas +type UserOperationV06 struct { + Sender *common.Address `json:"sender" mapstructure:"sender" binding:"required,hexParam"` + Nonce *big.Int `json:"nonce" mapstructure:"nonce" binding:"required"` + InitCode []byte `json:"initCode" mapstructure:"initCode" ` + CallData []byte `json:"callData" mapstructure:"callData" binding:"required"` + PreVerificationGas *big.Int `json:"preVerificationGas" mapstructure:"pre_verification_gas" binding:"required"` + PaymasterAndData []byte `json:"paymasterAndData" mapstructure:"paymaster_and_data"` + Signature []byte `json:"signature" mapstructure:"signature" binding:"required"` + //Maximum fee per gas (similar to EIP-1559 max_fee_per_gas) + MaxFeePerGas *big.Int `json:"maxFeePerGas" mapstructure:"maxFeePerGas" binding:"required"` + //Maximum priority fee per gas (similar to EIP-1559 max_priority_fee_per_gas) + MaxPriorityFeePerGas *big.Int `json:"maxPriorityFeePerGas" mapstructure:"max_priority_fee_per_gas" binding:"required"` + //Gas limit for execution phase + CallGasLimit *big.Int `json:"callGasLimit" mapstructure:"call_gas_limit" binding:"required"` + //Gas limit for verification phase + VerificationGasLimit *big.Int `json:"verificationGasLimit" mapstructure:"verification_gas_limit" binding:"required"` +} + +// UserOperationV07 entrypoint v0.0.7 +type UserOperationV07 struct { + BaseUserOperation + AccountGasLimit [32]byte `json:"account_gas_limit" mapstructure:"account_gas_limit" binding:"required"` + PaymasterVerificationGasLimit *big.Int `json:"paymaster_verification_gas_limit" mapstructure:"paymaster_verification_gas_limit" binding:"required"` + PaymasterPostOpGasLimit *big.Int `json:"paymaster_post_op_gas_limit" mapstructure:"paymaster_post_op_gas_limit" binding:"required"` + GasFees [32]byte `json:"gas_fees" mapstructure:"gas_fees" binding:"required"` +} + +func NewUserOp(userOp *map[string]any) (*UserOpInput, error) { + var result UserOpInput + + // Convert map to struct + decodeConfig := &mapstructure.DecoderConfig{ + DecodeHook: decodeOpTypes, + Result: &result, + ErrorUnset: false, + MatchName: exactFieldMatch, + } + decoder, err := mapstructure.NewDecoder(decodeConfig) + if err != nil { + return nil, err + } + if err := decoder.Decode(userOp); err != nil { + return nil, xerrors.Errorf("data [%w] convert failed: [%w]", userOp, err) + } + onlyOnce.Do(func() { + validate.RegisterCustomTypeFunc(validateAddressType, common.Address{}) + validate.RegisterCustomTypeFunc(validateBigIntType, big.Int{}) + }) + // Validate struct + err = validate.Struct(result) + if err != nil { + return nil, err + } + return &result, nil +} + +type UserOpInput struct { + Sender *common.Address `json:"sender" mapstructure:"sender" binding:"required,hexParam"` + Nonce *big.Int `json:"nonce" mapstructure:"nonce" binding:"required"` + InitCode []byte `json:"initCode" mapstructure:"initCode" ` + CallData []byte `json:"callData" mapstructure:"callData" binding:"required"` + PreVerificationGas *big.Int `json:"preVerificationGas" mapstructure:"preVerificationGas"` + PaymasterAndData []byte `json:"paymasterAndData" mapstructure:"paymasterAndData"` + Signature []byte `json:"signature" mapstructure:"signature" binding:"required"` + //Maximum fee per gas (similar to EIP-1559 max_fee_per_gas) + MaxFeePerGas *big.Int `json:"maxFeePerGas" mapstructure:"maxFeePerGas"` + //Maximum priority fee per gas (similar to EIP-1559 max_priority_fee_per_gas) + MaxPriorityFeePerGas *big.Int `json:"maxPriorityFeePerGas" mapstructure:"maxPriorityFeePerGas" ` + //Gas limit for execution phase + CallGasLimit *big.Int `json:"callGasLimit" mapstructure:"callGasLimit"` + //Gas limit for verification phase + VerificationGasLimit *big.Int `json:"verificationGasLimit" mapstructure:"verificationGasLimit"` + AccountGasLimits [32]byte `json:"accountGasLimits" mapstructure:"accountGasLimits"` + GasFees [32]byte `json:"gasFees" mapstructure:"gas_fees" binding:"required"` + + ComputeGasOnly bool +} + +func (userOp *UserOpInput) PackUserOpForMock(version global_const.EntrypointVersion) (string, []byte, error) { + if version == global_const.EntrypointV07 { + gasFee := utils.PackIntTo32Bytes(userOp.MaxPriorityFeePerGas, userOp.MaxFeePerGas) + encoded, err := UserOpV07PackArg.Pack(userOp.Sender, userOp.Nonce, userOp.InitCode, userOp.CallData, DummyAccountGasLimits, userOp.PreVerificationGas, gasFee, global_const.DummyPaymasterDataByte, global_const.DummySignatureByte) + if err != nil { + return "", nil, err + } + return hex.EncodeToString(encoded), encoded, nil + } else if version == global_const.EntrypointV06 { + maxFeePerGas := userOp.MaxFeePerGas + if maxFeePerGas == nil { + maxFeePerGas = global_const.DummyMaxFeePerGas + } + maxPriorityFeePerGas := userOp.MaxPriorityFeePerGas + if maxPriorityFeePerGas == nil { + maxPriorityFeePerGas = global_const.DummyMaxPriorityFeePerGas + } + encoded, err := userOpV06PackArg.Pack(userOp.Sender, userOp.Nonce, userOp.InitCode, userOp.CallData, global_const.DummyCallGasLimit, global_const.DummyVerificationGasLimit, global_const.DummyReverificationsBigint, maxFeePerGas, maxPriorityFeePerGas, global_const.DummyPaymasterDataByte, userOp.Signature) + + if err != nil { + return "", nil, err + } + return hex.EncodeToString(encoded), encoded, nil + } else { + return "", nil, xerrors.Errorf("should never be here ") + } +} + +func (userOp *UserOpInput) GetFactoryAddress() (*common.Address, error) { + initCode := userOp.InitCode + if len(initCode) < 20 { + return nil, xerrors.Errorf("initCode length is less than 20") + } + address := common.BytesToAddress(initCode[:42]) + return &address, nil +} + +func (userOp *UserOpInput) ValidateUserOp() error { + panic("implement me") +} + +func GetIndex(hexString string) int64 { + //1. 从 63*10+ 1 ~64*10获取 + indexPre := hexString[576:640] + indePreInt, _ := strconv.ParseInt(indexPre, 16, 64) + result := indePreInt * 2 + return result +} +func validateAddressType(field reflect.Value) interface{} { + value, ok := field.Interface().(common.Address) + if !ok || value == common.HexToAddress("0x") { + return nil + } + return field +} + +func validateBigIntType(field reflect.Value) interface{} { + value, ok := field.Interface().(big.Int) + if !ok || value.Cmp(big.NewInt(0)) == -1 { + return nil + } + return field +} + +func exactFieldMatch(mapKey, fieldName string) bool { + return mapKey == fieldName +} + +func decodeOpTypes( + f reflect.Kind, + t reflect.Kind, + data interface{}) (interface{}, error) { + // String to common.Address conversion + if f == reflect.String && t == reflect.Array { + return common.HexToAddress(data.(string)), nil + } + + // String to big.Int conversion + if f == reflect.String && t == reflect.Struct { + n := new(big.Int) + n, ok := n.SetString(data.(string), 0) + if !ok { + return nil, xerrors.Errorf("bigInt conversion failed") + } + return n, nil + } + + // Float64 to big.Int conversion + if f == reflect.Float64 && t == reflect.Struct { + n, ok := data.(float64) + if !ok { + return nil, xerrors.Errorf("bigInt conversion failed") + } + return big.NewInt(int64(n)), nil + } + + // String to []byte conversion + if f == reflect.String && t == reflect.Slice { + byteStr := data.(string) + if len(byteStr) < 2 || byteStr[:2] != "0x" { + return nil, xerrors.Errorf("not byte string") + } + + b, err := hex.DecodeString(byteStr[2:]) + if err != nil { + return nil, err + } + return b, nil + } + + return data, nil +} diff --git a/common/utils/util.go b/common/utils/util.go index faef363c..246ae7ad 100644 --- a/common/utils/util.go +++ b/common/utils/util.go @@ -1,43 +1,115 @@ package utils import ( - "AAStarCommunity/EthPaymaster_BackService/common/model" - "encoding/json" + "AAStarCommunity/EthPaymaster_BackService/common/global_const" + "bytes" + "crypto/ecdsa" + "encoding/hex" + "fmt" + mapset "github.com/deckarep/golang-set/v2" + "github.com/ethereum/go-ethereum/accounts/abi" + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/common/hexutil" "github.com/ethereum/go-ethereum/crypto" + "github.com/ethereum/go-ethereum/rpc" + "github.com/sirupsen/logrus" + "golang.org/x/xerrors" + "math/big" + "regexp" + "runtime" + "strconv" + "strings" ) -func GenerateMockUserOperation() *model.UserOperationItem { +var HexPattern = regexp.MustCompile(`^0x[a-fA-F\d]*$`) + +const defaultStackSize = 4096 + +type EthCallReq struct { + From common.Address `json:"from"` + To common.Address `json:"to"` + Data hexutil.Bytes `json:"data"` +} + +type TraceCallOpts struct { + Tracer string `json:"tracer"` + StateOverrides OverrideSet `json:"stateOverrides"` +} +type OverrideSet map[common.Address]OverrideAccount +type OverrideAccount struct { + Nonce *hexutil.Uint64 `json:"nonce"` + Code *hexutil.Bytes `json:"code"` + Balance *hexutil.Big `json:"balance"` + State *map[common.Hash]common.Hash `json:"state"` + StateDiff *map[common.Hash]common.Hash `json:"stateDiff"` +} + +func GenerateMockUservOperation() *map[string]any { //TODO use config - return &model.UserOperationItem{ - Sender: "0x4A2FD3215420376DA4eD32853C19E4755deeC4D1", - Nonce: "1", - InitCode: "0x", - CallData: "0xb61d27f6000000000000000000000000c206b552ab127608c3f666156c8e03a8471c72df000000000000000000000000000000000000000000000000002386f26fc1000000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000000", - CallGasLimit: "39837", - VerificationGasList: "100000", - PreVerificationGas: "44020", - MaxFeePerGas: "1743509478", - MaxPriorityFeePerGas: "1500000000", - Signature: "0x760868cd7d9539c6e31c2169c4cab6817beb8247516a90e4301e929011451658623455035b83d38e987ef2e57558695040a25219c39eaa0e31a0ead16a5c925c1c", + var MockUserOpData = map[string]any{ + "callData": "0xb61d27f60000000000000000000000001c7d4b196cb0c7b01d743fbc6116a902379c7238000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000044095ea7b30000000000000000000000000000000000325602a77416a16136fdafd04b299fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00000000000000000000000000000000000000000000000000000000", + "callGasLimit": "0x54fa", + "initCode": "0x9406cc6185a346906296840746125a0e449764545fbfb9cf000000000000000000000000b6bcf9517d193f551d0e3d6860103972dd13de7b0000000000000000000000000000000000000000000000000000000000000000", + "maxFeePerGas": "0x5968606e", + "maxPriorityFeePerGas": "0x59682f00", + "nonce": "0x00", + "preVerificationGas": "0xae64", + "sender": "0xffdb071c2b58ccc10ad386f9bb4e8d3d664ce73c", + "signature": "0xaa846693598194980f3bf50486be854704534c1622d0c2ee895a5a1ebe1508221909a27cc7971d9f522c8df13b9d8a6ee446d09ea7635f31c59d77d35d1281421c", + "verificationGasLimit": "0x05fa35", } + + return &MockUserOpData } -func GenerateUserOperation() *model.UserOperationItem { - return &model.UserOperationItem{} +func ValidateHex(value string) bool { + if HexPattern.MatchString(value) { + return true + } + return false +} +func IsStringInUint64Range(s string) bool { + num, err := strconv.ParseUint(s, 10, 64) + if err != nil { + return false + } + // 0 <= num <= MaxUint64 + return num <= ^uint64(0) } -func SignUserOp(privateKeyHex string, userOp *model.UserOperationItem) ([]byte, error) { +func PackIntTo32Bytes(left *big.Int, right *big.Int) [32]byte { + leftBytes := left.Bytes() + rightBytes := right.Bytes() + leftBytes = append(make([]byte, 16-len(leftBytes)), leftBytes...) + rightBytes = append(make([]byte, 16-len(rightBytes)), rightBytes...) + var result = [32]byte{} + copy(result[:16], leftBytes) + copy(result[16:], rightBytes) - serializedUserOp, err := json.Marshal(userOp) - if err != nil { - return nil, err + return result +} + +func GetGasEntryPointGasPrice(maxFeePerGas *big.Int, maxPriorityFeePerGas *big.Int, baseFee *big.Int) *big.Int { + if maxFeePerGas == maxPriorityFeePerGas { + // is 1559 not support + return maxFeePerGas } + combineFee := new(big.Int).Add(baseFee, maxPriorityFeePerGas) + return GetMinValue(maxFeePerGas, combineFee) +} - signature, err := SignMessage(privateKeyHex, string(serializedUserOp)) - if err != nil { - return nil, err +func EncodeToStringWithPrefix(data []byte) string { + res := hex.EncodeToString(data) + if res[:2] != "0x" { + return "0x" + res } + return res +} - return signature, nil +func DecodeStringWithPrefix(data string) ([]byte, error) { + if data[:2] == "0x" { + data = data[2:] + } + return hex.DecodeString(data) } func SignMessage(privateKeyHex string, message string) ([]byte, error) { privateKey, err := crypto.HexToECDSA(privateKeyHex) @@ -56,3 +128,75 @@ func SignMessage(privateKeyHex string, message string) ([]byte, error) { return signature, nil } + +func ToEthSignedMessageHash(msg []byte) []byte { + buffer := new(bytes.Buffer) + buffer.Write([]byte("\x19Ethereum Signed Message:\n32")) + buffer.Write(msg) + return crypto.Keccak256(buffer.Bytes()) +} + +func LeftIsLessTanRight(a *big.Int, b *big.Int) bool { + return a.Cmp(b) < 0 +} +func GetSign(message []byte, privateKey *ecdsa.PrivateKey) ([]byte, error) { + digest := fmt.Sprintf("\x19Ethereum Signed Message:\n%d%s", len(message), message) + hash := crypto.Keccak256Hash([]byte(digest)) + sig, err := crypto.Sign(hash.Bytes(), privateKey) + if err != nil { + return nil, err + } + //In Ethereum, the last byte of the signature result represents the recovery ID of the signature, and by adding 27 to ensure it conforms to Ethereum's specification. + sig[64] += 27 + return sig, nil +} + +func GetMinValue(int2 *big.Int, int3 *big.Int) *big.Int { + if int2.Cmp(int3) == -1 { + return int2 + } + return int3 +} +func ConvertBalanceToEther(balance *big.Int) *big.Float { + balanceFloat := new(big.Float).SetInt(balance) + balanceFloat = new(big.Float).Quo(balanceFloat, global_const.EthWeiFactor) + return balanceFloat +} +func ConvertStringToSet(input string, split string) mapset.Set[string] { + set := mapset.NewSet[string]() + arr := strings.Split(input, split) + for _, value := range arr { + set.Add(value) + } + return set +} +func ParseCallError(err error, abi *abi.ABI) (string, error) { + rpcErr, ok := err.(rpc.DataError) + if !ok { + return "", xerrors.Errorf("ExecutionResult: cannot assert type: error is not of type rpc.DataError") + } + data, ok := rpcErr.ErrorData().(string) + if !ok { + return "", xerrors.Errorf("ExecutionResult: cannot assert type: data is not of type string") + } + logrus.Debugf("data :[%s]", data) + + for _, abiErr := range abi.Errors { + logrus.Debugf("abiErr :[%v]", abiErr) + revert, uppackErr := abiErr.Unpack(common.Hex2Bytes(data[2:])) + if uppackErr != nil { + logrus.Debugf("executionResult err: [%s]", uppackErr.Error()) + } else { + logrus.Debugf("has revert :[%v]", revert) + + return fmt.Sprintf("%v", revert), nil + } + } + return "", nil +} + +func GetCurrentGoroutineStack() string { + var buf [defaultStackSize]byte + n := runtime.Stack(buf[:], false) + return string(buf[:n]) +} diff --git a/common/utils/util_test.go b/common/utils/util_test.go index f9574b11..1445a1b2 100644 --- a/common/utils/util_test.go +++ b/common/utils/util_test.go @@ -5,7 +5,7 @@ import ( "encoding/hex" "fmt" "github.com/ethereum/go-ethereum/crypto" - "github.com/stretchr/testify/assert" + "math/big" "testing" ) @@ -20,14 +20,50 @@ func TestGenerateKeypair(t *testing.T) { fmt.Printf("publicKey: %x\n", publicKeyBytes) fmt.Printf("address: %s\n", address) } -func TestSignUserOp(t *testing.T) { - //privateKeyHex: 1d8a58126e87e53edc7b24d58d1328230641de8c4242c135492bf5560e0ff421 - //publicKey: 044eaed6b1f16e60354156fa334a094affc76d7b7061875a0b04290af9a14cc14ce2bce6ceba941856bd55c63f8199f408fff6495ce9d4c76899055972d23bdb3e - //address: 0x0E1375d18a4A2A867bEfe908E87322ad031386a6 - signByte, err := SignUserOp("1d8a58126e87e53edc7b24d58d1328230641de8c4242c135492bf5560e0ff421", GenerateMockUserOperation()) - assert.NoError(t, err) - fmt.Printf("signByte: %x\n", signByte) - singature := hex.EncodeToString(signByte) - fmt.Printf("singature: %s\n", singature) +func TestToEthSignedMessageHash(t *testing.T) { + strByte, err := hex.DecodeString("4bd85fb8854a6bd9dfb18cf88a5bba4daf9bc65f4b8ac00a706f426d40498302") + if err != nil { + fmt.Printf("has Error %s", err) + return + } + afterStrByte := ToEthSignedMessageHash(strByte) + fmt.Printf("afterStrByte: %x\n", afterStrByte) + afterStr := hex.EncodeToString(afterStrByte) + fmt.Printf("afterStr: %s\n", afterStr) } +func TestConvertStringToSet(t *testing.T) { + str := "a,b,c,d" + set := ConvertStringToSet(str, ",") + fmt.Printf("set: %v\n", set) +} +func TestPackIntTo32Bytes(t *testing.T) { + + bytes := PackIntTo32Bytes(big.NewInt(2312), big.NewInt(2312)) + + resStr := EncodeToStringWithPrefix(bytes[:]) + t.Logf("resStr: %s\n", resStr) +} + +//func TestEthereumSign(t *testing.T) { +// messageStr := "hello world" +// messageByte := []byte(messageStr) +// privateKey, _ := crypto.GenerateKey() +// publicKey := privateKey.Public() +// publicKeyBytes := crypto.FromECDSAPub(publicKey.(*ecdsa.PublicKey)) +// +// sign, err := GetSign(messageByte, privateKey) +// if err != nil { +// t.Fatalf("has Error %s", err) +// return +// } +// t.Logf("sign: %x\n", sign) +// +// sigPublicKey, err := crypto.Ecrecover(hash.Bytes(), sign) +// if err != nil { +// t.Fatalf("has Error %s", err) +// return +// } +// matches := bytes.Equal(sigPublicKey, publicKeyBytes) +// t.Logf("matches: %t\n", matches) +//} diff --git a/conf/conf.go b/conf/conf.go deleted file mode 100644 index 9e85f880..00000000 --- a/conf/conf.go +++ /dev/null @@ -1,62 +0,0 @@ -package conf - -import ( - "k8s.io/apimachinery/pkg/util/yaml" - "os" - "sync" -) - -var once sync.Once - -type Conf struct { - Jwt JWT -} - -var conf *Conf - -// getConf read conf from file -func getConf() *Conf { - once.Do(func() { - if conf == nil { - filePath := getConfFilePath() - conf = getConfiguration(filePath) - } - }) - return conf -} - -// getConfiguration -func getConfiguration(filePath *string) *Conf { - if file, err := os.ReadFile(*filePath); err != nil { - return mappingEnvToConf( - &Conf{ - Jwt: JWT{}, - }, - ) - } else { - c := Conf{} - err := yaml.Unmarshal(file, &c) - if err != nil { - return mappingEnvToConf(&c) - } - - return &c - } -} - -func mappingEnvToConf(conf *Conf) *Conf { - - // TODO: read from env - // e.g. if dummy := os.Getenv("dummy"); len(dummy) > 0 {conf.Dummy = dummy} - if jwt__security := os.Getenv("jwt__security"); len(jwt__security) > 0 { - conf.Jwt.Security = jwt__security - } - if jwt__realm := os.Getenv("jwt__realm"); len(jwt__realm) > 0 { - conf.Jwt.Security = jwt__realm - } - if jwt__idkey := os.Getenv("jwt__idkey"); len(jwt__idkey) > 0 { - conf.Jwt.Security = jwt__idkey - } - - return conf -} diff --git a/conf/env.go b/conf/env.go deleted file mode 100644 index 5d8b7a7d..00000000 --- a/conf/env.go +++ /dev/null @@ -1,51 +0,0 @@ -package conf - -import ( - "fmt" - "os" - "strings" -) - -const envKey = "Env" -const ProdEnv = "prod" -const DevEnv = "dev" - -type Env struct { - Name string // env Name, like `prod`, `dev` and etc., - Debugger bool // whether to use debugger -} - -func (env *Env) IsDevelopment() bool { - return strings.EqualFold(DevEnv, env.Name) -} - -func (env *Env) IsProduction() bool { - return strings.EqualFold(ProdEnv, env.Name) -} - -func (env *Env) GetEnvName() *string { - return &env.Name -} - -func getConfFilePath() *string { - path := fmt.Sprintf("conf/appsettings.%s.yaml", strings.ToLower(Environment.Name)) - if _, err := os.Stat(path); err != nil && os.IsNotExist(err) { - path = fmt.Sprintf("conf/appsettings.yaml") - } - return &path -} - -var Environment *Env - -func init() { - envName := DevEnv - if len(os.Getenv(envKey)) > 0 { - envName = os.Getenv(envKey) - } - Environment = &Env{ - Name: envName, - Debugger: func() bool { - return envName != ProdEnv - }(), - } -} diff --git a/conf/appsettings.yaml b/config/appsettings.yaml similarity index 100% rename from conf/appsettings.yaml rename to config/appsettings.yaml diff --git a/config/basic_config.go b/config/basic_config.go new file mode 100644 index 00000000..ca6e57dc --- /dev/null +++ b/config/basic_config.go @@ -0,0 +1,199 @@ +package config + +import ( + "AAStarCommunity/EthPaymaster_BackService/common/global_const" + "encoding/json" + "fmt" + mapset "github.com/deckarep/golang-set/v2" + "github.com/ethereum/go-ethereum/common" + "os" +) + +var basicConfig *BusinessConfig + +func basicConfigInit(path string) { + if path == "" { + panic("pathParam is empty") + } + originConfig := initBusinessConfig(path) + basicConfig = convertConfig(originConfig) +} + +func convertConfig(originConfig *OriginBusinessConfig) *BusinessConfig { + basic := &BusinessConfig{} + basic.NetworkConfigMap = make(map[global_const.Network]NetWorkConfig) + basic.SupportEntryPoint = make(map[global_const.Network]mapset.Set[string]) + basic.SupportPaymaster = make(map[global_const.Network]mapset.Set[string]) + for network, originNetWorkConfig := range originConfig.NetworkConfigMap { + //TODO valid + basic.NetworkConfigMap[network] = NetWorkConfig{ + ChainId: originNetWorkConfig.ChainId, + IsTest: originNetWorkConfig.IsTest, + TokenConfig: originNetWorkConfig.TokenConfig, + GasToken: originNetWorkConfig.GasToken, + V06EntryPointAddress: common.HexToAddress(originNetWorkConfig.V06EntryPointAddress), + V07EntryPointAddress: common.HexToAddress(originNetWorkConfig.V07EntryPointAddress), + V06PaymasterAddress: common.HexToAddress(originNetWorkConfig.V06PaymasterAddress), + V07PaymasterAddress: common.HexToAddress(originNetWorkConfig.V07PaymasterAddress), + } + paymasterArr := originConfig.SupportPaymaster[network] + paymasterSet := mapset.NewSet[string]() + paymasterSet.Append(paymasterArr...) + basic.SupportPaymaster[network] = paymasterSet + + entryPointArr := originConfig.SupportEntryPoint[network] + entryPointSet := mapset.NewSet[string]() + entryPointSet.Append(entryPointArr...) + basic.SupportEntryPoint[network] = entryPointSet + } + return basic +} +func initBusinessConfig(path string) *OriginBusinessConfig { + var config OriginBusinessConfig + file, err := os.Open(path) + if err != nil { + panic(fmt.Sprintf("file not found: %s", path)) + } + //var mapValue map[string]any + decoder := json.NewDecoder(file) + err = decoder.Decode(&config) + if err != nil { + panic(fmt.Sprintf("parse file error: %s", err)) + } + + return &config +} + +type OriginBusinessConfig struct { + NetworkConfigMap map[global_const.Network]*OriginNetWorkConfig `json:"network_config"` + SupportEntryPoint map[global_const.Network][]string `json:"support_entrypoint"` + SupportPaymaster map[global_const.Network][]string `json:"support_paymaster"` +} +type OriginNetWorkConfig struct { + ChainId string `json:"chain_id"` + IsTest bool `json:"is_test"` + TokenConfig map[global_const.TokenType]string `json:"token_config"` + GasToken global_const.TokenType `json:"gas_token"` + V06PaymasterAddress string `json:"v06_paymaster_address"` + V07PaymasterAddress string `json:"v07_paymaster_address"` + V06EntryPointAddress string `json:"v06_entrypoint_address"` + V07EntryPointAddress string `json:"v07_entrypoint_address"` + GasOracleAddress string +} + +type BusinessConfig struct { + NetworkConfigMap map[global_const.Network]NetWorkConfig `json:"network_config"` + SupportEntryPoint map[global_const.Network]mapset.Set[string] `json:"support_entrypoint"` + SupportPaymaster map[global_const.Network]mapset.Set[string] `json:"support_paymaster"` +} +type NetWorkConfig struct { + ChainId string `json:"chain_id"` + IsTest bool `json:"is_test"` + TokenConfig map[global_const.TokenType]string `json:"token_config"` + GasToken global_const.TokenType + GasOracleAddress common.Address + V06PaymasterAddress common.Address + V07PaymasterAddress common.Address + V06EntryPointAddress common.Address + V07EntryPointAddress common.Address +} + +func GetSupportEntryPoints(network global_const.Network) (mapset.Set[string], error) { + res, ok := basicConfig.SupportEntryPoint[network] + if !ok { + return nil, fmt.Errorf("network not found") + } + return res, nil +} +func GetSupportPaymaster(network global_const.Network) (mapset.Set[string], error) { + res, ok := basicConfig.SupportPaymaster[network] + if !ok { + return nil, fmt.Errorf("network not found") + } + return res, nil +} + +func GetTokenAddress(networkParam global_const.Network, tokenParam global_const.TokenType) string { + networkConfig := basicConfig.NetworkConfigMap[networkParam] + + return networkConfig.TokenConfig[tokenParam] +} +func CheckEntryPointExist(network2 global_const.Network, address string) bool { + entryPointSet := basicConfig.SupportEntryPoint[network2] + entryPointSetValue := entryPointSet + return entryPointSetValue.Contains(address) +} +func GetGasToken(networkParam global_const.Network) global_const.TokenType { + networkConfig := basicConfig.NetworkConfigMap[networkParam] + return networkConfig.GasToken +} + +func GetChainId(networkParam global_const.Network) string { + networkConfig := basicConfig.NetworkConfigMap[networkParam] + return networkConfig.ChainId +} + +func GetPaymasterAddress(network global_const.Network, version global_const.EntrypointVersion) common.Address { + networkConfig := basicConfig.NetworkConfigMap[network] + if version == global_const.EntrypointV07 { + return networkConfig.V07PaymasterAddress + } + return networkConfig.V06PaymasterAddress +} + +func GetEntrypointAddress(network global_const.Network, version global_const.EntrypointVersion) common.Address { + networkConfig := basicConfig.NetworkConfigMap[network] + if version == global_const.EntrypointV07 { + return networkConfig.V07EntryPointAddress + } + return networkConfig.V06EntryPointAddress + +} + +var ( + TestNetWork = mapset.NewSet( + global_const.EthereumSepolia, global_const.OptimismSepolia, global_const.ArbitrumSpeolia, global_const.ScrollSepolia, global_const.StarketSepolia, global_const.BaseSepolia) + OpeStackNetWork = mapset.NewSet( + global_const.OptimismMainnet, global_const.OptimismSepolia, global_const.BaseMainnet, global_const.BaseSepolia) + EthereumAdaptableNetWork = mapset.NewSet( + global_const.ArbitrumOne, global_const.ArbitrumNova, global_const.ArbitrumSpeolia, + global_const.OptimismMainnet, global_const.OptimismSepolia, global_const.EthereumSepolia, global_const.EthereumMainnet, global_const.ScrollSepolia, global_const.ScrollMainnet, global_const.BaseMainnet, global_const.BaseSepolia) + ArbStackNetWork = mapset.NewSet( + global_const.ArbitrumSpeolia, global_const.ArbitrumOne, global_const.ArbitrumNova) + + L1GasOracleInL2 = map[global_const.Network]common.Address{ + global_const.OptimismMainnet: common.HexToAddress("0x420000000000000000000000000000000000000F"), + global_const.OptimismSepolia: common.HexToAddress("0x420000000000000000000000000000000000000F"), + global_const.BaseSepolia: common.HexToAddress("0x420000000000000000000000000000000000000F"), + global_const.BaseMainnet: common.HexToAddress("0x420000000000000000000000000000000000000F"), + global_const.ScrollSepolia: common.HexToAddress("0x5300000000000000000000000000000000000002"), + global_const.ScrollMainnet: common.HexToAddress("0x5300000000000000000000000000000000000002"), + } + Disable1559Chain = mapset.NewSet(global_const.ScrollSepolia, global_const.ScrollMainnet) +) + +func IsDisable1559Chain(network global_const.Network) bool { + return Disable1559Chain.Contains(network) +} +func GetNetWorkStack(network global_const.Network) global_const.NewWorkStack { + if IsOpStackNetWork(network) { + return global_const.OpStack + } + if IsArbNetWork(network) { + return global_const.ArbStack + } + return global_const.DefaultStack +} + +func IsTestNet(network global_const.Network) bool { + return TestNetWork.Contains(network) +} +func IsOpStackNetWork(network global_const.Network) bool { + return OpeStackNetWork.Contains(network) +} +func IsEthereumAdaptableNetWork(network global_const.Network) bool { + return EthereumAdaptableNetWork.Contains(network) +} +func IsArbNetWork(network global_const.Network) bool { + return ArbStackNetWork.Contains(network) +} diff --git a/config/basic_config.json b/config/basic_config.json new file mode 100644 index 00000000..061fa5cc --- /dev/null +++ b/config/basic_config.json @@ -0,0 +1,145 @@ +{ + "network_config": { + "ethereum-sepolia": { + "chain_id": "11155111", + "is_test": true, + "rpc_url": "https://eth-sepolia.g.alchemy.com/v2", + "api_key": "wKeLycGxgYRykgf0aGfcpEkUtqyLQg4v", + "signer_key" : "752d81d71afd0b25a09f24718baf82c0846cc3b68122cfb3a1d41529c8a46b05", + "v06_entrypoint_address" : "0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789", + "v07_entrypoint_address" : "0x0000000071727De22E5E9d8BAf0edAc6f37da032", + "v06_paymaster_address" : "0xF2147CA7f18e8014b76e1A98BaffC96ebB90a29f", + "v07_paymaster_address": "0x3Da96267B98a33267249734FD8FFeC75093D3085", + "gas_token": "ETH", + "token_config": { + "USDT": "0x3870419Ba2BBf0127060bCB37f69A1b1C090992B", + "USDC": "0x3870419Ba2BBf0127060bCB37f69A1b1C090992B" + } + }, + "optimism-sepolia": { + "chain_id": "11155420", + "is_test": true, + "rpc_url": "https://opt-sepolia.g.alchemy.com/v2", + "api_key": "_z0GaU6Zk8RfIR1guuli8nqMdb8RPdp0", + "signer_key" : "1d8a58126e87e53edc7b24d58d1328230641de8c4242c135492bf5560e0ff421", + "v06_entrypoint_address" : "0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789", + "v07_entrypoint_address" : "0x0000000071727De22E5E9d8BAf0edAc6f37da032", + "v06_paymaster_address" : "0xF2147CA7f18e8014b76e1A98BaffC96ebB90a29f", + "v07_paymaster_address": "0xF2147CA7f18e8014b76e1A98BaffC96ebB90a29f", + "gas_token": "ETH", + "token_config": { + "USDT": "0x3870419Ba2BBf0127060bCB37f69A1b1C090992B", + "USDC": "0x3870419Ba2BBf0127060bCB37f69A1b1C090992B" + } + }, + "arbitrum-sepolia": { + "chain_id": "421614", + "is_test": true, + "rpc_url": "https://arb-sepolia.g.alchemy.com/v2", + "api_key": "xSBkiidslrZmlcWUOSF3AluKx0A9g_kl", + "signer_key" : "752d81d71afd0b25a09f24718baf82c0846cc3b68122cfb3a1d41529c8a46b05", + "v06_entrypoint_address" : "0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789", + "v07_entrypoint_address" : "0xF2147CA7f18e8014b76e1A98BaffC96ebB90a29f", + "v06_paymaster_address" : "0xF2147CA7f18e8014b76e1A98BaffC96ebB90a29f", + "v07_paymaster_address": "0xF2147CA7f18e8014b76e1A98BaffC96ebB90a29f", + "gas_token": "ETH", + "token_config": { + "USDT": "0x3870419Ba2BBf0127060bCB37f69A1b1C090992B", + "USDC": "0x3870419Ba2BBf0127060bCB37f69A1b1C090992B" + } + }, + "scroll-sepolia": { + "chain_id": "534351", + "is_test": true, + "rpc_url": "https://sepolia-rpc.scroll.io", + "api_key": "9DGRNUARDVGDPZWN2G55I3Y5NG7HQJBUTH", + "signer_key" : "752d81d71afd0b25a09f24718baf82c0846cc3b68122cfb3a1d41529c8a46b05", + "v06_entrypoint_address" : "0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789", + "v07_entrypoint_address" : "0x0000000071727De22E5E9d8BAf0edAc6f37da032", + "v06_paymaster_address" : "0x0Fa9ee28202F8602E9a4C99Af799C75C29AFbC89", + "v07_paymaster_address": "0xF2147CA7f18e8014b76e1A98BaffC96ebB90a29f", + "gas_token": "ETH", + "token_config": { + "USDT": "0x3870419Ba2BBf0127060bCB37f69A1b1C090992B", + "USDC": "0x3870419Ba2BBf0127060bCB37f69A1b1C090992B" + } + }, + "starknet-sepolia": { + "chain_id": "534351", + "is_test": true, + "rpc_url": "https://starknet-sepolia.infura.io/v3", + "api_key": "0284f5a9fc55476698079b24e2f97909", + "signer_key" : "752d81d71afd0b25a09f24718baf82c0846cc3b68122cfb3a1d41529c8a46b05", + "v06_entrypoint_address" : "0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789", + "v07_entrypoint_address" : "0x0000000071727De22E5E9d8BAf0edAc6f37da032", + "v06_paymaster_address" : "0xF2147CA7f18e8014b76e1A98BaffC96ebB90a29f", + "v07_paymaster_address": "0xF2147CA7f18e8014b76e1A98BaffC96ebB90a29f", + "gas_token": "ETH", + "token_config": { + "USDT": "0x3870419Ba2BBf0127060bCB37f69A1b1C090992B", + "USDC": "0x3870419Ba2BBf0127060bCB37f69A1b1C090992B" + } + }, + "base-sepolia": { + "chain_id": "84532", + "is_test": true, + "rpc_url": "https://base-sepolia.g.alchemy.com/v2", + "api_key": "zUhtd18b2ZOTIJME6rv2Uwz9q7PBnnsa", + "signer_key" : "752d81d71afd0b25a09f24718baf82c0846cc3b68122cfb3a1d41529c8a46b05", + "v06_entrypoint_address" : "0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789", + "v07_entrypoint_address" : "0x0000000071727De22E5E9d8BAf0edAc6f37da032", + "v06_paymaster_address" : "0xa86cFf572E299B2704FBBCF77dcbbc7FEfFbcA06", + "v07_paymaster_address": "0xF2147CA7f18e8014b76e1A98BaffC96ebB90a29f", + "gas_token": "ETH", + "token_config": { + "USDT": "0x3870419Ba2BBf0127060bCB37f69A1b1C090992B", + "USDC": "0x3870419Ba2BBf0127060bCB37f69A1b1C090992B" + } + } + }, + "support_entrypoint": { + "ethereum-sepolia": [ + "0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789", + "0x0000000071727De22E5E9d8BAf0edAc6f37da032" + ], + "optimism-sepolia": [ + "0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789", + "0x0000000071727De22E5E9d8BAf0edAc6f37da032" + ], + "arbitrum-sepolia": [ + "0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789", + "0x0000000071727De22E5E9d8BAf0edAc6f37da032" + ], + "scroll-sepolia": [ + "0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789", + "0x0000000071727De22E5E9d8BAf0edAc6f37da032" + ], + "base-sepolia": [ + "0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789", + "0x0000000071727De22E5E9d8BAf0edAc6f37da032" + ] + }, + "support_paymaster": { + "ethereum-sepolia": [ + "0xF2147CA7f18e8014b76e1A98BaffC96ebB90a29f", + "0x3Da96267B98a33267249734FD8FFeC75093D3085" + ], + "optimism-sepolia": [ + "0xF2147CA7f18e8014b76e1A98BaffC96ebB90a29f", + "0x2" + ], + "arbitrum-sepolia": [ + "0xF2147CA7f18e8014b76e1A98BaffC96ebB90a29f", + "0x2" + ], + "scroll-sepolia": [ + "0xF2147CA7f18e8014b76e1A98BaffC96ebB90a29f", + "0x2" + ], + "base-sepolia": [ + "0xF2147CA7f18e8014b76e1A98BaffC96ebB90a29f", + "0x2" + ] + }, + "price_oracle_api_key": "CG-ioE6p8cmmSFBFwJnKECCbZ7U" +} diff --git a/config/basic_strategy_config.go b/config/basic_strategy_config.go new file mode 100644 index 00000000..2462970d --- /dev/null +++ b/config/basic_strategy_config.go @@ -0,0 +1,107 @@ +package config + +import ( + "AAStarCommunity/EthPaymaster_BackService/common/global_const" + "AAStarCommunity/EthPaymaster_BackService/common/model" + "AAStarCommunity/EthPaymaster_BackService/common/utils" + "encoding/json" + "fmt" + "golang.org/x/xerrors" + "math/big" + "os" +) + +var basicStrategyConfig = make(map[string]*model.Strategy) + +// suitableStrategyMap[chain][entrypoint][payType] +var suitableStrategyMap = make(map[global_const.Network]map[global_const.EntrypointVersion]map[global_const.PayType]*model.Strategy) + +func GetBasicStrategyConfig(strategyCode global_const.BasicStrategyCode) *model.Strategy { + strategy := basicStrategyConfig[string(strategyCode)] + paymasterAddress := GetPaymasterAddress(strategy.GetNewWork(), strategy.GetStrategyEntrypointVersion()) + strategy.PaymasterInfo.PayMasterAddress = &paymasterAddress + entryPointAddress := GetEntrypointAddress(strategy.GetNewWork(), strategy.GetStrategyEntrypointVersion()) + strategy.EntryPointInfo.EntryPointAddress = &entryPointAddress + return strategy + +} +func GetSuitableStrategy(entrypointVersion global_const.EntrypointVersion, chain global_const.Network, payType global_const.PayType) (*model.Strategy, error) { + //TODO + strategy := suitableStrategyMap[chain][entrypointVersion][payType] + if strategy == nil { + return nil, xerrors.Errorf("strategy not found") + } + return strategy, nil +} + +func basicStrategyInit(path string) { + if path == "" { + panic("pathParam is empty") + } + + file, err := os.Open(path) + if err != nil { + panic(err) + } + //var mapValue map[string]any + decoder := json.NewDecoder(file) + var config map[string]map[string]any + err = decoder.Decode(&config) + if err != nil { + panic(fmt.Sprintf("parse file error: %s", err)) + } + strateyMap, err := convertMapToStrategyConfig(config) + if err != nil { + panic(fmt.Sprintf("parse file error: %s", err)) + } + basicStrategyConfig = strateyMap +} +func convertMapToStrategyConfig(data map[string]map[string]any) (map[string]*model.Strategy, error) { + config := make(map[string]*model.Strategy) + + for key, value := range data { + effectiveStartTime, ok := new(big.Int).SetString(value["effective_start_time"].(string), 10) + if !ok { + return nil, xerrors.Errorf("effective_start_time illegal") + } + effectiveEndTime, ok := new(big.Int).SetString(value["effective_end_time"].(string), 10) + if !ok { + return nil, xerrors.Errorf("effective_end_time illegal") + } + accessProjectStr := value["access_project"].(string) + strategy := &model.Strategy{ + Id: key, + StrategyCode: key, + NetWorkInfo: &model.NetWorkInfo{ + NetWork: global_const.Network(value["network"].(string)), + }, + EntryPointInfo: &model.EntryPointInfo{ + EntryPointVersion: global_const.EntrypointVersion(value["entrypoint_version"].(string)), + }, + + ExecuteRestriction: model.StrategyExecuteRestriction{ + EffectiveStartTime: effectiveStartTime, + EffectiveEndTime: effectiveEndTime, + AccessProject: utils.ConvertStringToSet(accessProjectStr, ","), + }, + PaymasterInfo: &model.PaymasterInfo{ + PayType: global_const.PayType(value["paymaster_pay_type"].(string)), + }, + } + if strategy.GetPayType() == global_const.PayTypeERC20 { + erc20TokenStr := value["access_erc20"].(string) + strategy.NetWorkInfo.Token = global_const.TokenType(erc20TokenStr) + strategy.ExecuteRestriction.AccessErc20 = utils.ConvertStringToSet(erc20TokenStr, ",") + } + + config[key] = strategy + if suitableStrategyMap[strategy.NetWorkInfo.NetWork] == nil { + suitableStrategyMap[strategy.NetWorkInfo.NetWork] = make(map[global_const.EntrypointVersion]map[global_const.PayType]*model.Strategy) + } + if suitableStrategyMap[strategy.NetWorkInfo.NetWork][strategy.GetStrategyEntrypointVersion()] == nil { + suitableStrategyMap[strategy.NetWorkInfo.NetWork][strategy.GetStrategyEntrypointVersion()] = make(map[global_const.PayType]*model.Strategy) + } + suitableStrategyMap[strategy.NetWorkInfo.NetWork][strategy.GetStrategyEntrypointVersion()][strategy.GetPayType()] = strategy + } + return config, nil +} diff --git a/config/basic_strategy_config.json b/config/basic_strategy_config.json new file mode 100644 index 00000000..47e0ea74 --- /dev/null +++ b/config/basic_strategy_config.json @@ -0,0 +1,172 @@ +{ + "Ethereum_Sepolia_v06_verifyPaymaster": { + "network": "ethereum-sepolia", + "entrypoint_version": "v0.6", + "effective_start_time": "1710044496", + "effective_end_time": "1820044496", + "paymaster_pay_type": "PayTypeVerifying", + "access_project": "official" + }, + "Ethereum_Sepolia_v07_verifyPaymaster": { + "network": "ethereum-sepolia", + "entrypoint_version": "v0.7", + "effective_start_time": "1710044496", + "effective_end_time": "1820044496", + "paymaster_pay_type": "PayTypeVerifying", + "access_project": "official" + }, + "Ethereum_Sepolia_v06_erc20Paymaster": { + "network": "ethereum-sepolia", + "entrypoint_version": "v0.6", + "effective_start_time": "1710044496", + "effective_end_time": "1820044496", + "paymaster_pay_type": "PayTypeERC20", + "access_erc20": "USDT,USDC", + "access_project": "official" + }, + "Ethereum_Sepolia_v07_erc20Paymaster": { + "network": "ethereum-sepolia", + "entrypoint_version": "v0.7", + "effective_start_time": "1710044496", + "effective_end_time": "1820044496", + "paymaster_pay_type": "PayTypeERC20", + "access_erc20": "USDT,USDC", + "access_project": "official" + }, + "Optimism_Sepolia_v06_verifyPaymaster": { + "network": "optimism-sepolia", + "entrypoint_version": "v0.6", + "effective_start_time": "1710044496", + "effective_end_time": "1820044496", + "paymaster_pay_type": "PayTypeVerifying", + "access_project": "official" + }, + "Optimism_Sepolia_v07_verifyPaymaster": { + "network": "optimism-sepolia", + "entrypoint_version": "v0.7", + "effective_start_time": "1710044496", + "effective_end_time": "1820044496", + "paymaster_pay_type": "PayTypeVerifying", + "access_project": "official" + }, + "Optimism_Sepolia_v06_erc20Paymaster": { + "network": "optimism-sepolia", + "entrypoint_version": "v0.6", + "effective_start_time": "1710044496", + "effective_end_time": "1820044496", + "paymaster_pay_type": "PayTypeERC20", + "access_erc20": "USDT,USDC", + "access_project": "official" + }, + "Optimism_Sepolia_v07_erc20Paymaster": { + "network": "optimism-sepolia", + "entrypoint_version": "v0.7", + "effective_start_time": "1710044496", + "effective_end_time": "1820044496", + "paymaster_pay_type": "PayTypeERC20", + "access_erc20": "USDT,USDC", + "access_project": "official" + }, + "Arbitrum_Sepolia_v06_verifyPaymaster": { + "network": "arbitrum-sepolia", + "entrypoint_version": "v0.6", + "effective_start_time": "1710044496", + "effective_end_time": "1820044496", + "paymaster_pay_type": "PayTypeVerifying", + "access_project": "official" + }, + "Arbitrum_Sepolia_v06_erc20Paymaster": { + "network": "arbitrum-sepolia", + "entrypoint_version": "v0.6", + "effective_start_time": "1710044496", + "effective_end_time": "1820044496", + "paymaster_pay_type": "PayTypeERC20", + "access_erc20": "USDT,USDC", + "access_project": "official" + }, + "Arbitrum_Sepolia_v07_verifyPaymaster": { + "network": "arbitrum-sepolia", + "entrypoint_version": "v0.7", + "effective_start_time": "1710044496", + "effective_end_time": "1820044496", + "paymaster_pay_type": "PayTypeVerifying", + "access_project": "official" + }, + "Arbitrum_Sepolia_v07_erc20Paymaster": { + "network": "arbitrum-sepolia", + "entrypoint_version": "v0.7", + "effective_start_time": "1710044496", + "effective_end_time": "1820044496", + "paymaster_pay_type": "PayTypeERC20", + "access_erc20": "USDT,USDC", + "access_project": "official" + }, + "Scroll_Sepolia_v06_verifyPaymaster": { + "network": "scroll-sepolia", + "entrypoint_version": "v0.6", + "effective_start_time": "1710044496", + "effective_end_time": "1820044496", + "paymaster_pay_type": "PayTypeVerifying", + "access_project": "official" + }, + "Scroll_Sepolia_v06_erc20Paymaster": { + "network": "scroll-sepolia", + "entrypoint_version": "v0.6", + "effective_start_time": "1710044496", + "effective_end_time": "1820044496", + "paymaster_pay_type": "PayTypeERC20", + "access_erc20": "USDT,USDC", + "access_project": "official" + }, + "Scroll_Sepolia_v07_verifyPaymaster": { + "network": "scroll-sepolia", + "entrypoint_version": "v0.7", + "effective_start_time": "1710044496", + "effective_end_time": "1820044496", + "paymaster_pay_type": "PayTypeVerifying", + "access_project": "official" + }, + "Scroll_Sepolia_v07_erc20Paymaster": { + "network": "scroll-sepolia", + "entrypoint_version": "v0.7", + "effective_start_time": "1710044496", + "effective_end_time": "1820044496", + "paymaster_pay_type": "PayTypeERC20", + "access_erc20": "USDT,USDC", + "access_project": "official" + }, + "Base_Sepolia_v06_verifyPaymaster": { + "network": "base-sepolia", + "entrypoint_version": "v0.6", + "effective_start_time": "1710044496", + "effective_end_time": "1820044496", + "paymaster_pay_type": "PayTypeVerifying", + "access_project": "official" + }, + "Base_Sepolia_v07_verifyPaymaster": { + "network": "base-sepolia", + "entrypoint_version": "v0.7", + "effective_start_time": "1710044496", + "effective_end_time": "1820044496", + "paymaster_pay_type": "PayTypeVerifying", + "access_project": "official" + }, + "Base_Sepolia_v06_erc20Paymaster": { + "network": "base-sepolia", + "entrypoint_version": "v0.6", + "effective_start_time": "1710044496", + "effective_end_time": "1820044496", + "paymaster_pay_type": "PayTypeERC20", + "access_erc20": "USDT,USDC", + "access_project": "official" + }, + "Base_Sepolia_v07_erc20Paymaster": { + "network": "base-sepolia", + "entrypoint_version": "v0.7", + "effective_start_time": "1710044496", + "effective_end_time": "1820044496", + "paymaster_pay_type": "PayTypeERC20", + "access_erc20": "USDT,USDC", + "access_project": "official" + } +} diff --git a/config/config.go b/config/config.go new file mode 100644 index 00000000..74b46283 --- /dev/null +++ b/config/config.go @@ -0,0 +1,7 @@ +package config + +func InitConfig(basicStrategyPath string, basicConfigPath string, secretconfig string) { + secretConfigInit(secretconfig) + basicStrategyInit(basicStrategyPath) + basicConfigInit(basicConfigPath) +} diff --git a/config/config_test.go b/config/config_test.go new file mode 100644 index 00000000..1684e669 --- /dev/null +++ b/config/config_test.go @@ -0,0 +1,60 @@ +package config + +import ( + "AAStarCommunity/EthPaymaster_BackService/common/global_const" + "testing" +) + +func TestSecretConfigInit(t *testing.T) { + if testing.Short() { + t.Skip("skipping test in short mode.") + } + secretConfigInit("../config/secret_config.json") + config := GetNetworkSecretConfig(global_const.EthereumSepolia) + t.Log(config.RpcUrl) + t.Log(config.SignerKey) + t.Log(GetSigner(global_const.EthereumSepolia).Address.Hex()) +} +func TestConfigInit(t *testing.T) { + if testing.Short() { + t.Skip("skipping test in short mode.") + } + InitConfig("../config/basic_strategy_config.json", "../config/basic_config.json", "../config/secret_config.json") + strategy := GetBasicStrategyConfig("Ethereum_Sepolia_v06_verifyPaymaster") + if strategy == nil { + t.Error("strategy is nil") + return + } + strategySuit, err := GetSuitableStrategy(global_const.EntrypointV06, global_const.EthereumSepolia, global_const.PayTypeVerifying) + if err != nil { + + t.Error("strategySuit is nil") + return + } + if strategySuit == nil { + t.Error("strategySuit is nil") + return + } + + chainId := GetChainId(global_const.EthereumSepolia) + if chainId == "" { + t.Error("chainid is 0") + } + t.Log(chainId) + rpcUrl := GetNewWorkClientURl(global_const.EthereumSepolia) + if rpcUrl == "" { + t.Error("rpcUrl is 0") + } + t.Log(rpcUrl) + + eoa := GetSigner(global_const.EthereumSepolia) + if eoa == nil { + t.Error("eoa is nil") + } + t.Log(eoa.Address.Hex()) + scrollEoa := GetSigner(global_const.ScrollSepolia) + if scrollEoa == nil { + t.Error("eoa is nil") + } + t.Log(scrollEoa.Address.Hex()) +} diff --git a/config/secret_config.go b/config/secret_config.go new file mode 100644 index 00000000..9148b405 --- /dev/null +++ b/config/secret_config.go @@ -0,0 +1,56 @@ +package config + +import ( + "AAStarCommunity/EthPaymaster_BackService/common/global_const" + "AAStarCommunity/EthPaymaster_BackService/common/model" + "encoding/json" + "fmt" + "os" +) + +var secretConfig *model.SecretConfig +var signerConfig = make(SignerConfigMap) + +type SignerConfigMap map[global_const.Network]*global_const.EOA + +func secretConfigInit(secretConfigPath string) { + if secretConfigPath == "" { + panic("secretConfigPath is empty") + } + file, err := os.Open(secretConfigPath) + if err != nil { + panic(err) + } + decoder := json.NewDecoder(file) + var config model.SecretConfig + err = decoder.Decode(&config) + if err != nil { + panic(fmt.Sprintf("parse file error: %s", err)) + } + secretConfig = &config + for network, originNetWorkConfig := range secretConfig.NetWorkSecretConfigMap { + signerKey := originNetWorkConfig.SignerKey + eoa, err := global_const.NewEoa(signerKey) + if err != nil { + panic(fmt.Sprintf("signer key error: %s", err)) + } + + signerConfig[global_const.Network(network)] = eoa + } +} +func GetNetworkSecretConfig(network global_const.Network) model.NetWorkSecretConfig { + return secretConfig.NetWorkSecretConfigMap[string(network)] +} + +func GetPriceOracleApiKey() string { + return secretConfig.PriceOracleApiKey +} +func GetNewWorkClientURl(network global_const.Network) string { + return secretConfig.NetWorkSecretConfigMap[string(network)].RpcUrl +} +func GetSignerKey(network global_const.Network) string { + return secretConfig.NetWorkSecretConfigMap[string(network)].SignerKey +} +func GetSigner(network global_const.Network) *global_const.EOA { + return signerConfig[network] +} diff --git a/docs/docs.go b/docs/docs.go index 0e07f2c2..ab889b9e 100644 --- a/docs/docs.go +++ b/docs/docs.go @@ -61,73 +61,28 @@ const docTemplate = `{ } } }, - "/api/v1/get-support-entrypoint": { - "get": { - "security": [ - { - "JWT": [] - } - ], - "description": "get the support entrypoint", - "consumes": [ - "application/json" - ], - "tags": [ - "Sponsor" - ], - "responses": { - "200": { - "description": "OK" - } - } - } - }, - "/api/v1/get-support-strategy": { - "get": { - "security": [ - { - "JWT": [] - } - ], - "description": "get the support strategy", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "Sponsor" - ], - "responses": { - "200": { - "description": "OK" - } - } - } - }, - "/api/v1/try-pay-user-operation": { + "/api/v1/paymaster": { "post": { "security": [ { "JWT": [] } ], - "description": "sponsor the userOp", + "description": "Paymaster JSON-RPC API", "consumes": [ "application/json" ], "tags": [ - "Sponsor" + "Paymaster" ], "parameters": [ { - "description": "UserOp Request", - "name": "tryPay", + "description": "JsonRpcRequest Model", + "name": "rpcRequest", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/model.TryPayUserOpRequest" + "$ref": "#/definitions/model.JsonRpcRequest" } } ], @@ -148,84 +103,23 @@ const docTemplate = `{ } } }, - "model.TryPayUserOpRequest": { - "type": "object", - "properties": { - "extra": {}, - "force_entrypoint_address": { - "type": "string" - }, - "force_network": { - "$ref": "#/definitions/types.NetWork" - }, - "force_strategy_id": { - "type": "string" - }, - "force_token": { - "type": "string" - }, - "user_operation": { - "$ref": "#/definitions/model.UserOperationItem" - } - } - }, - "model.UserOperationItem": { + "model.JsonRpcRequest": { "type": "object", - "required": [ - "call_data", - "call_gas_limit", - "max_fee_per_gas", - "max_priority_fee_per_gas", - "nonce", - "per_verification_gas", - "sender", - "verification_gas_list" - ], "properties": { - "call_data": { - "type": "string" - }, - "call_gas_limit": { - "type": "string" - }, - "init_code": { - "type": "string" - }, - "max_fee_per_gas": { - "type": "string" + "id": { + "type": "integer" }, - "max_priority_fee_per_gas": { + "jsonrpc": { "type": "string" }, - "nonce": { + "method": { "type": "string" }, - "per_verification_gas": { - "type": "string" - }, - "sender": { - "type": "string" - }, - "signature": { - "type": "string" - }, - "verification_gas_list": { - "type": "string" + "params": { + "type": "array", + "items": {} } } - }, - "types.NetWork": { - "type": "string", - "enum": [ - "ethereum", - "sepolia", - "arbitrum" - ], - "x-enum-varnames": [ - "Ethereum", - "Sepolia", - "Arbitrum" - ] } }, "securityDefinitions": { diff --git a/docs/swagger.json b/docs/swagger.json index e9a7fd87..f813c38c 100644 --- a/docs/swagger.json +++ b/docs/swagger.json @@ -50,73 +50,28 @@ } } }, - "/api/v1/get-support-entrypoint": { - "get": { - "security": [ - { - "JWT": [] - } - ], - "description": "get the support entrypoint", - "consumes": [ - "application/json" - ], - "tags": [ - "Sponsor" - ], - "responses": { - "200": { - "description": "OK" - } - } - } - }, - "/api/v1/get-support-strategy": { - "get": { - "security": [ - { - "JWT": [] - } - ], - "description": "get the support strategy", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "Sponsor" - ], - "responses": { - "200": { - "description": "OK" - } - } - } - }, - "/api/v1/try-pay-user-operation": { + "/api/v1/paymaster": { "post": { "security": [ { "JWT": [] } ], - "description": "sponsor the userOp", + "description": "Paymaster JSON-RPC API", "consumes": [ "application/json" ], "tags": [ - "Sponsor" + "Paymaster" ], "parameters": [ { - "description": "UserOp Request", - "name": "tryPay", + "description": "JsonRpcRequest Model", + "name": "rpcRequest", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/model.TryPayUserOpRequest" + "$ref": "#/definitions/model.JsonRpcRequest" } } ], @@ -137,84 +92,23 @@ } } }, - "model.TryPayUserOpRequest": { - "type": "object", - "properties": { - "extra": {}, - "force_entrypoint_address": { - "type": "string" - }, - "force_network": { - "$ref": "#/definitions/types.NetWork" - }, - "force_strategy_id": { - "type": "string" - }, - "force_token": { - "type": "string" - }, - "user_operation": { - "$ref": "#/definitions/model.UserOperationItem" - } - } - }, - "model.UserOperationItem": { + "model.JsonRpcRequest": { "type": "object", - "required": [ - "call_data", - "call_gas_limit", - "max_fee_per_gas", - "max_priority_fee_per_gas", - "nonce", - "per_verification_gas", - "sender", - "verification_gas_list" - ], "properties": { - "call_data": { - "type": "string" - }, - "call_gas_limit": { - "type": "string" - }, - "init_code": { - "type": "string" - }, - "max_fee_per_gas": { - "type": "string" + "id": { + "type": "integer" }, - "max_priority_fee_per_gas": { + "jsonrpc": { "type": "string" }, - "nonce": { + "method": { "type": "string" }, - "per_verification_gas": { - "type": "string" - }, - "sender": { - "type": "string" - }, - "signature": { - "type": "string" - }, - "verification_gas_list": { - "type": "string" + "params": { + "type": "array", + "items": {} } } - }, - "types.NetWork": { - "type": "string", - "enum": [ - "ethereum", - "sepolia", - "arbitrum" - ], - "x-enum-varnames": [ - "Ethereum", - "Sepolia", - "Arbitrum" - ] } }, "securityDefinitions": { diff --git a/docs/swagger.yaml b/docs/swagger.yaml index b20ce651..282e5be6 100644 --- a/docs/swagger.yaml +++ b/docs/swagger.yaml @@ -4,62 +4,18 @@ definitions: apiKey: type: string type: object - model.TryPayUserOpRequest: + model.JsonRpcRequest: properties: - extra: {} - force_entrypoint_address: + id: + type: integer + jsonrpc: type: string - force_network: - $ref: '#/definitions/types.NetWork' - force_strategy_id: + method: type: string - force_token: - type: string - user_operation: - $ref: '#/definitions/model.UserOperationItem' - type: object - model.UserOperationItem: - properties: - call_data: - type: string - call_gas_limit: - type: string - init_code: - type: string - max_fee_per_gas: - type: string - max_priority_fee_per_gas: - type: string - nonce: - type: string - per_verification_gas: - type: string - sender: - type: string - signature: - type: string - verification_gas_list: - type: string - required: - - call_data - - call_gas_limit - - max_fee_per_gas - - max_priority_fee_per_gas - - nonce - - per_verification_gas - - sender - - verification_gas_list + params: + items: {} + type: array type: object - types.NetWork: - enum: - - ethereum - - sepolia - - arbitrum - type: string - x-enum-varnames: - - Ethereum - - Sepolia - - Arbitrum info: contact: name: AAStar Support @@ -92,51 +48,25 @@ paths: description: OK tags: - Healthz - /api/v1/get-support-entrypoint: - get: - consumes: - - application/json - description: get the support entrypoint - responses: - "200": - description: OK - security: - - JWT: [] - tags: - - Sponsor - /api/v1/get-support-strategy: - get: - consumes: - - application/json - description: get the support strategy - produces: - - application/json - responses: - "200": - description: OK - security: - - JWT: [] - tags: - - Sponsor - /api/v1/try-pay-user-operation: + /api/v1/paymaster: post: consumes: - application/json - description: sponsor the userOp + description: Paymaster JSON-RPC API parameters: - - description: UserOp Request + - description: JsonRpcRequest Model in: body - name: tryPay + name: rpcRequest required: true schema: - $ref: '#/definitions/model.TryPayUserOpRequest' + $ref: '#/definitions/model.JsonRpcRequest' responses: "200": description: OK security: - JWT: [] tags: - - Sponsor + - Paymaster securityDefinitions: JWT: description: Type 'Bearer \' to correctly set the AccessToken diff --git a/envirment/app_config.go b/envirment/app_config.go new file mode 100644 index 00000000..bbc91bd5 --- /dev/null +++ b/envirment/app_config.go @@ -0,0 +1,86 @@ +package envirment + +import ( + "AAStarCommunity/EthPaymaster_BackService/common/model" + "fmt" + "k8s.io/apimachinery/pkg/util/yaml" + "os" + "strings" + "sync" +) + +var once sync.Once +var Environment *model.Env + +type Conf struct { + Jwt JWT +} + +func init() { + envName := model.DevEnv + if len(os.Getenv(model.EnvKey)) > 0 { + envName = os.Getenv(model.EnvKey) + } + Environment = &model.Env{ + Name: envName, + Debugger: func() bool { + return envName != model.ProdEnv + }(), + } +} + +var conf *Conf + +// GetAppConf read conf from file +func GetAppConf() *Conf { + once.Do(func() { + if conf == nil { + filePath := getConfFilePath() + conf = getConfiguration(filePath) + } + }) + return conf +} +func getConfFilePath() *string { + path := fmt.Sprintf("conf/appsettings.%s.yaml", strings.ToLower(Environment.Name)) + if _, err := os.Stat(path); err != nil && os.IsNotExist(err) { + path = fmt.Sprintf("config/appsettings.yaml") + } + return &path +} + +// getConfiguration +func getConfiguration(filePath *string) *Conf { + if file, err := os.ReadFile(*filePath); err != nil { + return mappingEnvToConf( + &Conf{ + Jwt: JWT{}, + }, + ) + } else { + c := Conf{} + err := yaml.Unmarshal(file, &c) + if err != nil { + return mappingEnvToConf(&c) + } + + return &c + } +} + +func mappingEnvToConf(conf *Conf) *Conf { + + // TODO: read from env + // e.g. if dummy := os.Getenv("dummy"); len(dummy) > 0 {conf.Dummy = dummy} + if jwtSecurity := os.Getenv("jwt__security"); len(jwtSecurity) > 0 { + conf.Jwt.Security = jwtSecurity + } + if jwtRealm := os.Getenv("jwt__realm"); len(jwtRealm) > 0 { + conf.Jwt.Security = jwtRealm + } + if jetIkey := os.Getenv("jwt__idkey"); len(jetIkey) > 0 { + conf.Jwt.Security = jetIkey + } + + return conf +} diff --git a/conf/jwt.go b/envirment/jwt.go similarity index 87% rename from conf/jwt.go rename to envirment/jwt.go index b25c8d1a..867c3460 100644 --- a/conf/jwt.go +++ b/envirment/jwt.go @@ -1,4 +1,4 @@ -package conf +package envirment import "sync" @@ -16,7 +16,7 @@ var onceJwt sync.Once func GetJwtKey() *JWT { onceJwt.Do(func() { if jwt == nil { - j := getConf().Jwt + j := GetAppConf().Jwt jwt = &JWT{ Security: j.Security, Realm: j.Realm, diff --git a/gas_executor/gas_computor.go b/gas_executor/gas_computor.go new file mode 100644 index 00000000..69a5ce97 --- /dev/null +++ b/gas_executor/gas_computor.go @@ -0,0 +1,282 @@ +package gas_executor + +import ( + "AAStarCommunity/EthPaymaster_BackService/common/data_utils" + "AAStarCommunity/EthPaymaster_BackService/common/global_const" + "AAStarCommunity/EthPaymaster_BackService/common/model" + "AAStarCommunity/EthPaymaster_BackService/common/network" + "AAStarCommunity/EthPaymaster_BackService/common/paymaster_data" + "AAStarCommunity/EthPaymaster_BackService/common/price_compoent" + "AAStarCommunity/EthPaymaster_BackService/common/user_op" + "AAStarCommunity/EthPaymaster_BackService/common/utils" + "AAStarCommunity/EthPaymaster_BackService/config" + "AAStarCommunity/EthPaymaster_BackService/service/chain_service" + "github.com/sirupsen/logrus" + "golang.org/x/xerrors" + "math/big" +) + +var ( + GweiFactor = new(big.Float).SetInt(big.NewInt(1e9)) + EthWeiFactor = new(big.Float).SetInt(big.NewInt(1e18)) +) + +// ComputeGas https://blog.particle.network/bundler-predicting-gas/ +func ComputeGas(userOp *user_op.UserOpInput, strategy *model.Strategy, paymasterDataInput *paymaster_data.PaymasterDataInput) (*model.ComputeGasResponse, *user_op.UserOpInput, error) { + + opEstimateGas, err := getUserOpEstimateGas(userOp, strategy, paymasterDataInput) + if err != nil { + return nil, nil, err + } + + totalGasDetail := GetTotalCostByEstimateGas(opEstimateGas) + updateUserOp := getNewUserOpAfterCompute(userOp, opEstimateGas, strategy.GetStrategyEntrypointVersion()) + var erc20TokenCost *big.Float + if !userOp.ComputeGasOnly { + // NetworkCall 1 + erc20TokenCost, err = getErc20TokenCost(strategy, totalGasDetail.MaxTxGasCostInEther) + if err != nil { + return nil, nil, xerrors.Errorf("getErc20TokenCost error: %v", err) + } + } + return &model.ComputeGasResponse{ + OpEstimateGas: opEstimateGas, + TotalGasDetail: totalGasDetail, + Erc20TokenCost: erc20TokenCost, + }, updateUserOp, nil +} + +func GetTotalCostByEstimateGas(userOpGas *model.UserOpEstimateGas) *model.TotalGasDetail { + gasPrice := GetUserOpGasPrice(userOpGas) + totalGasLimit := new(big.Int) + totalGasLimit = totalGasLimit.Add(totalGasLimit, userOpGas.VerificationGasLimit) + totalGasLimit = totalGasLimit.Add(totalGasLimit, userOpGas.CallGasLimit) + totalGasLimit = totalGasLimit.Add(totalGasLimit, userOpGas.PreVerificationGas) + totalGasGost := new(big.Int).Mul(gasPrice, totalGasLimit) + + gasPriceInGwei := new(big.Float).SetInt(gasPrice) + gasPriceInGwei.Quo(gasPriceInGwei, GweiFactor) + + totalGasGostInGwei := new(big.Float).SetInt(totalGasGost) + totalGasGostInGwei.Quo(totalGasGostInGwei, GweiFactor) + logrus.Debug("totalGasGostInGwei: ", totalGasGostInGwei) + + totalGasGostInEther := new(big.Float).SetInt(totalGasGost) + totalGasGostInEther.Quo(totalGasGostInEther, EthWeiFactor) + logrus.Debug("totalGasGostInEther: ", totalGasGostInEther) + + return &model.TotalGasDetail{ + MaxTxGasLimit: totalGasLimit, + MaxTxGasCostGwei: totalGasGostInGwei, + MaxTxGasCostInEther: totalGasGostInEther, + GasPriceGwei: gasPriceInGwei, + } +} + +// GetUserOpGasPrice if network not Support EIP1559 will set MaxFeePerGas And MaxPriorityFeePerGas to the same value +func GetUserOpGasPrice(userOpGas *model.UserOpEstimateGas) *big.Int { + maxFeePerGas := userOpGas.MaxFeePerGas + maxPriorityFeePerGas := userOpGas.MaxPriorityFeePerGas + if maxFeePerGas == maxPriorityFeePerGas { + return maxFeePerGas + } + combineFee := new(big.Int).Add(userOpGas.BaseFee, maxPriorityFeePerGas) + return utils.GetMinValue(maxFeePerGas, combineFee) +} + +func getUserOpEstimateGas(userOp *user_op.UserOpInput, strategy *model.Strategy, paymasterDataInput *paymaster_data.PaymasterDataInput) (*model.UserOpEstimateGas, error) { + gasPriceResult, gasPriceErr := GetGasPrice(strategy.GetNewWork()) + if gasPriceErr != nil { + return nil, xerrors.Errorf("get gas price error: %v", gasPriceErr) + } + if userOp.MaxFeePerGas != nil && userOp.MaxPriorityFeePerGas != nil { + if config.IsDisable1559Chain(strategy.GetNewWork()) && userOp.MaxFeePerGas.Cmp(userOp.MaxPriorityFeePerGas) != 0 { + return nil, xerrors.Errorf("[%v] is not support 1559 MaxFeePerGas and MaxPriorityFeePerGas can not be same at the same time", strategy.GetNewWork()) + } + } + if userOp.MaxFeePerGas != nil { + gasPriceResult.MaxFeePerGas = userOp.MaxFeePerGas + } + if userOp.MaxPriorityFeePerGas != nil { + gasPriceResult.MaxPriorityFeePerGas = userOp.MaxPriorityFeePerGas + } + + //TODO calculate the maximum possible fee the account needs to pay (based on validation and call gas limits, and current gas values) + + userOpInputForSimulate, err := data_utils.GetUserOpWithPaymasterAndDataForSimulate(*userOp, strategy, paymasterDataInput, gasPriceResult) + if err != nil { + return nil, xerrors.Errorf("GetUserOpWithPaymasterAndDataForSimulate error: %v", err) + } + logrus.Debugf("userOpInputForSimulate: %v", userOpInputForSimulate) + logrus.Debugf("getUserOpEstimateGas gasPriceResult: %v", gasPriceResult) + // get EntryPoint GasPrice + // NetworkCall 1 + simulateGasPrice := utils.GetGasEntryPointGasPrice(gasPriceResult.MaxFeePerGas, gasPriceResult.MaxPriorityFeePerGas, gasPriceResult.BaseFee) + // NetworkCall 1 + simulateResult, err := chain_service.SimulateHandleOp(userOpInputForSimulate, strategy) + if err != nil { + return nil, xerrors.Errorf("SimulateHandleOp error: %v", err) + } + // NetworkCall 1 + preVerificationGas, err := GetPreVerificationGas(userOp, strategy, gasPriceResult, simulateResult) + if err != nil { + return nil, xerrors.Errorf("GetPreVerificationGas error: %v", err) + } + + // TODO verificationGasLimit and callGasLimit parell + verificationGasLimit, err := estimateVerificationGasLimit(simulateResult, preVerificationGas) + if err != nil { + return nil, xerrors.Errorf("estimateVerificationGasLimit error: %v", err) + } + + // NetworkCall 1 + callGasLimit, err := EstimateCallGasLimit(strategy, simulateResult, userOp, simulateGasPrice) + if err != nil { + return nil, xerrors.Errorf("EstimateCallGasLimit error: %v", err) + } + + opEstimateGas := model.UserOpEstimateGas{} + opEstimateGas.PreVerificationGas = preVerificationGas + opEstimateGas.MaxFeePerGas = gasPriceResult.MaxFeePerGas + opEstimateGas.MaxPriorityFeePerGas = gasPriceResult.MaxPriorityFeePerGas + opEstimateGas.BaseFee = gasPriceResult.BaseFee + opEstimateGas.VerificationGasLimit = verificationGasLimit + opEstimateGas.CallGasLimit = callGasLimit + + entryPointVersion := strategy.GetStrategyEntrypointVersion() + if entryPointVersion == global_const.EntrypointV07 { + accountGasLimit := utils.PackIntTo32Bytes(verificationGasLimit, callGasLimit) + opEstimateGas.AccountGasLimit = &accountGasLimit + gasFees := utils.PackIntTo32Bytes(gasPriceResult.MaxPriorityFeePerGas, gasPriceResult.MaxFeePerGas) + opEstimateGas.GasFees = &gasFees + opEstimateGas.PaymasterPostOpGasLimit = global_const.DummyPaymasterPostoperativelyBigint + opEstimateGas.PaymasterVerificationGasLimit = global_const.DummyPaymasterOversimplificationBigint + } + return &opEstimateGas, nil +} + +func getNewUserOpAfterCompute(op *user_op.UserOpInput, gas *model.UserOpEstimateGas, version global_const.EntrypointVersion) *user_op.UserOpInput { + var accountGasLimits [32]byte + var gasFee [32]byte + if version == global_const.EntrypointV07 { + accountGasLimits = utils.PackIntTo32Bytes(gas.PreVerificationGas, gas.CallGasLimit) + gasFee = utils.PackIntTo32Bytes(gas.MaxPriorityFeePerGas, gas.MaxFeePerGas) + } + result := &user_op.UserOpInput{ + Sender: op.Sender, + Nonce: op.Nonce, + InitCode: op.InitCode, + CallData: op.CallData, + MaxFeePerGas: gas.MaxFeePerGas, + Signature: op.Signature, + MaxPriorityFeePerGas: gas.MaxPriorityFeePerGas, + CallGasLimit: gas.CallGasLimit, + VerificationGasLimit: gas.VerificationGasLimit, + AccountGasLimits: accountGasLimits, + GasFees: gasFee, + PreVerificationGas: gas.PreVerificationGas, + } + return result +} + +func EstimateCallGasLimit(strategy *model.Strategy, simulateOpResult *model.SimulateHandleOpResult, op *user_op.UserOpInput, simulateGasPrice *big.Int) (*big.Int, error) { + ethereumExecutor := network.GetEthereumExecutor(strategy.GetNewWork()) + opValue := *op + senderExist, _ := ethereumExecutor.CheckContractAddressAccess(opValue.Sender) + if senderExist { + userOPCallGas, err := ethereumExecutor.EstimateUserOpCallGas(strategy.GetEntryPointAddress(), op) + if err != nil { + return nil, err + } + return userOPCallGas, nil + } else { + //1. TotalGas - createSenderGas = (verifyOpGas + verifyPaymasterGas) + callGasLimit + //2. TotalGas - (verifyOpGas + verifyPaymasterGas) = executeUserOpGas; + //3. executeUserOpGas(getFrom SimulateHandlop)- createSenderGas= callGasLimit + initGas, err := ethereumExecutor.EstimateCreateSenderGas(strategy.GetEntryPointAddress(), op) + if err != nil { + return nil, err + } + executeUserOpGas := new(big.Int).Div(simulateOpResult.GasPaid, simulateGasPrice) + return big.NewInt(0).Sub(executeUserOpGas, initGas), nil + } +} + +// ratio need cache +func getErc20TokenCost(strategy *model.Strategy, tokenCount *big.Float) (*big.Float, error) { + if strategy.GetPayType() == global_const.PayTypeERC20 { + if strategy.Erc20TokenType == "" { + return nil, xerrors.Errorf("strategy.Erc20TokenType is nil") + } + formTokenType := config.GetGasToken(strategy.GetNewWork()) + toTokenType := strategy.Erc20TokenType + toTokenPrice, err := price_compoent.GetToken(formTokenType, toTokenType) + if err != nil { + return nil, err + } + if toTokenPrice == 0 { + return nil, xerrors.Errorf("toTokenPrice can not be 0") + } + logrus.Debugf("toTokenPrice: %v", toTokenPrice) + tokenCost := new(big.Float).Mul(tokenCount, big.NewFloat(toTokenPrice)) + return tokenCost, nil + } + return nil, nil + +} + +func estimateVerificationGasLimit(simulateOpResult *model.SimulateHandleOpResult, preVerificationGas *big.Int) (*big.Int, error) { + preOpGas := simulateOpResult.PreOpGas + logrus.Debugf("preOpGas: %v", preOpGas) + logrus.Debugf("preVerificationGas: %v", preVerificationGas) + // verificationGasLimit = (preOpGas - preVerificationGas) * 1.5 + result := new(big.Int).Sub(preOpGas, preVerificationGas) + result = result.Mul(result, global_const.ThreeBigint) + result = result.Div(result, global_const.TwoBigint) + if utils.LeftIsLessTanRight(result, global_const.DummyVerificationGasLimit) { + return global_const.DummyVerificationGasLimit, nil + } + return result, nil +} + +// GetGasPrice return gas price in wei, gwei, ether +func GetGasPrice(chain global_const.Network) (*model.GasPrice, error) { + if config.IsEthereumAdaptableNetWork(chain) { + ethereumExecutor := network.GetEthereumExecutor(chain) + return ethereumExecutor.GetGasPrice() + } else if chain == global_const.StarketMainnet || chain == global_const.StarketSepolia { + starknetExecutor := network.GetStarknetExecutor() + return starknetExecutor.GetGasPrice() + } else { + return nil, xerrors.Errorf("chain %s not support", chain) + } + //MaxFeePerGas + //MaxPriorityPrice + //preOpGas (get verificationGasLimit from preOpGas) + // + +} + +// GetPreVerificationGas https://github.com/eth-infinitism/bundler/blob/main/packages/sdk/src/calcPreVerificationGas.ts +func GetPreVerificationGas(userOp *user_op.UserOpInput, strategy *model.Strategy, gasFeeResult *model.GasPrice, simulateOpResult *model.SimulateHandleOpResult) (*big.Int, error) { + chain := strategy.GetNewWork() + stack := config.GetNetWorkStack(chain) + preGasFunc, err := GetPreVerificationGasFunc(stack) + if err != nil { + return nil, err + } + preGas, err := preGasFunc(&model.PreVerificationGasEstimateInput{ + Strategy: strategy, + Op: userOp, + GasFeeResult: gasFeeResult, + SimulateOpResult: simulateOpResult, + }) + if err != nil { + return nil, err + } + // add 10% buffer + preGas = preGas.Mul(preGas, global_const.HundredPlusOneBigint) + preGas = preGas.Div(preGas, global_const.HundredBigint) + logrus.Debugf("GetPreVerificationGas preVerificationGas: %v", preGas) + return preGas, nil +} diff --git a/gas_executor/gas_computor_test.go b/gas_executor/gas_computor_test.go new file mode 100644 index 00000000..26107316 --- /dev/null +++ b/gas_executor/gas_computor_test.go @@ -0,0 +1,282 @@ +package gas_executor + +import ( + "AAStarCommunity/EthPaymaster_BackService/common/global_const" + "AAStarCommunity/EthPaymaster_BackService/common/model" + "AAStarCommunity/EthPaymaster_BackService/common/paymaster_data" + "AAStarCommunity/EthPaymaster_BackService/common/user_op" + "AAStarCommunity/EthPaymaster_BackService/common/utils" + "AAStarCommunity/EthPaymaster_BackService/config" + "AAStarCommunity/EthPaymaster_BackService/service/dashboard_service" + "encoding/json" + "github.com/sirupsen/logrus" + "math/big" + "testing" +) + +var ( + MockEstimateGas = &model.UserOpEstimateGas{ + PreVerificationGas: big.NewInt(52456), + BaseFee: big.NewInt(9320437485), + VerificationGasLimit: big.NewInt(483804), + CallGasLimit: big.NewInt(374945), + MaxFeePerGas: big.NewInt(10320437485), + MaxPriorityFeePerGas: big.NewInt(1000000000), + } +) + +func testGetGasPrice(t *testing.T, chain global_const.Network) { + gasprice, err := GetGasPrice(chain) + if err != nil { + t.Error(err) + return + } + t.Logf("gasprice:%v", gasprice) +} + +func TestComputeGas(t *testing.T) { + //userOp, newErr := user_op.NewUserOp(utils.GenerateMockUservOperation(), global_const.EntrypointV06) + //assert.NoError(t, newErr) + //strategy := dashboard_service.GetStrategyById("1") + //gas, _, err := ComputeGas(userOp, strategy) + //assert.NoError(t, err) + //assert.NotNil(t, gas) + //jsonBypte, _ := json.Marshal(gas) + //fmt.Println(string(jsonBypte)) + if testing.Short() { + t.Skip("skipping test in short mode.") + } + config.InitConfig("../config/basic_strategy_config.json", "../config/basic_config.json", "../config/secret_config.json") + logrus.SetLevel(logrus.DebugLevel) + op, err := user_op.NewUserOp(utils.GenerateMockUservOperation()) + if err != nil { + t.Error(err) + return + } + opFor1559NotSupport, err := user_op.NewUserOp(utils.GenerateMockUservOperation()) + if err != nil { + t.Error(err) + return + } + opFor1559NotSupport.MaxPriorityFeePerGas = opFor1559NotSupport.MaxFeePerGas + + tests := []struct { + name string + test func(t *testing.T) + }{ + { + "TestEthereumSepoliaGetPrice", + func(t *testing.T) { + testGetGasPrice(t, global_const.EthereumSepolia) + }, + }, + { + "testEstimateVerificationGasLimit", + func(*testing.T) { + strategy := dashboard_service.GetStrategyByCode("Ethereum_Sepolia_v06_verifyPaymaster") + if strategy == nil { + t.Fatal("strategy is nil") + } + testGetUserOpEstimateGas(t, op, strategy) + }, + }, + { + "testScrollGetUserOpEstimateGas", + func(*testing.T) { + + strategy := dashboard_service.GetStrategyByCode(string(global_const.StrategyCodeScrollSepoliaV06Verify)) + + testGetUserOpEstimateGas(t, opFor1559NotSupport, strategy) + }, + }, + { + "testEstimateVerificationGasLimit", + func(*testing.T) { + totalGasDetail := GetTotalCostByEstimateGas(MockEstimateGas) + t.Logf("totalGasDetail: %v", totalGasDetail) + jsonRes, _ := json.Marshal(totalGasDetail) + t.Logf("totalGasDetail: %v", string(jsonRes)) + }, + }, + { + "TestGetPreVerificationGas", + func(t *testing.T) { + strategy := config.GetBasicStrategyConfig("Optimism_Sepolia_v06_verifyPaymaster") + testGetPreVerificationGas(t, op, strategy, model.MockGasPrice) + }, + }, + { + "testComputeGas_StrategyCodeEthereumSepoliaVo6Verify", + func(*testing.T) { + testComputeGas(t, op, config.GetBasicStrategyConfig(global_const.StrategyCodeEthereumSepoliaV06Verify)) + }, + }, + { + "testComputeGas_StrategyCodeOpSepoliaVo6Verify", + func(*testing.T) { + testComputeGas(t, op, config.GetBasicStrategyConfig(global_const.StrategyCodeOptimismSepoliaV06Verify)) + }, + }, + { + "testComputeGas_StrategyCodeOpSepoliaVo6Verify", + func(*testing.T) { + testComputeGas(t, op, config.GetBasicStrategyConfig(global_const.StrategyCodeOptimismSepoliaV06Verify)) + }, + }, + { + "testComputeGas_StrategyCodeArbSepoliaVo6Verify", + func(*testing.T) { + testComputeGas(t, op, config.GetBasicStrategyConfig(global_const.StrategyCodeArbitrumSepoliaV06Verify)) + }, + }, + { + "testComputeGas_StrategyCodeScrollSepoliaVo6Verify", + func(*testing.T) { + testComputeGas(t, opFor1559NotSupport, config.GetBasicStrategyConfig(global_const.StrategyCodeScrollSepoliaV06Verify)) + }, + }, + { + "testComputeGas_StrategyCodeBaseSepoliaVo6Verify", + func(*testing.T) { + testComputeGas(t, op, config.GetBasicStrategyConfig(global_const.StrategyCodeBaseSepoliaV06Verify)) + }, + }, + { + "testComputeGas_StrategyCodeEthereumSepoliaV06Erc20", + func(*testing.T) { + strategy := config.GetBasicStrategyConfig(global_const.StrategyCodeEthereumSepoliaV06Erc20) + strategy.Erc20TokenType = global_const.TokenTypeUSDT + testComputeGas(t, op, strategy) + }, + }, + { + "testComputeGas_StrategyCodeOptimismSepoliaV06Erc20", + func(*testing.T) { + strategy := config.GetBasicStrategyConfig(global_const.StrategyCodeOptimismSepoliaV06Erc20) + strategy.Erc20TokenType = global_const.TokenTypeUSDT + testComputeGas(t, op, strategy) + }, + }, + { + "testComputeGas_StrategyCodeArbitrumSpeoliaV06Erc20", + func(*testing.T) { + strategy := config.GetBasicStrategyConfig(global_const.StrategyCodeArbitrumSepoliaV06Erc20) + strategy.Erc20TokenType = global_const.TokenTypeUSDT + testComputeGas(t, op, strategy) + }, + }, + { + "testComputeGas_StrategyCodeBaseSepoliaV06Erc20", + func(*testing.T) { + strategy := config.GetBasicStrategyConfig(global_const.StrategyCodeBaseSepoliaV06Erc20) + strategy.Erc20TokenType = global_const.TokenTypeUSDT + testComputeGas(t, op, strategy) + }, + }, + { + "testComputeGas_StrategyCodeScrollSepoliaV06Erc20", + func(*testing.T) { + strategy := config.GetBasicStrategyConfig(global_const.StrategyCodeScrollSepoliaV06Erc20) + strategy.Erc20TokenType = global_const.TokenTypeUSDT + testComputeGas(t, opFor1559NotSupport, strategy) + }, + }, + { + "TestScrollEstimateCallGasLimit", + func(t *testing.T) { + testEstimateCallGasLimit(t, config.GetBasicStrategyConfig(global_const.StrategyCodeScrollSepoliaV06Verify), model.MockSimulateHandleOpResult, opFor1559NotSupport, global_const.DummyReverificationsBigint) + }, + }, + { + "TestErc20", + func(t *testing.T) { + strategy := config.GetBasicStrategyConfig(global_const.StrategyCodeEthereumSepoliaV06Erc20) + strategy.Erc20TokenType = global_const.TokenTypeUSDT + testErc20TokenCost(t, strategy, big.NewFloat(0.0001)) + }, + }, + { + "TestUSDTTokenCost", + func(t *testing.T) { + strategy := config.GetBasicStrategyConfig(global_const.StrategyCodeEthereumSepoliaV06Erc20) + strategy.Erc20TokenType = global_const.TokenTypeUSDT + testErc20TokenCost(t, strategy, big.NewFloat(0.0001)) + }, + }, + } + for _, tt := range tests { + t.Run(tt.name, tt.test) + } +} +func testErc20TokenCost(t *testing.T, strategy *model.Strategy, tokenCount *big.Float) { + erc20TokenCost, err := getErc20TokenCost(strategy, tokenCount) + if err != nil { + t.Error(err) + return + } + t.Logf("erc20TokenCost:%v", erc20TokenCost) + +} +func testEstimateCallGasLimit(t *testing.T, strategy *model.Strategy, simulateOpResult *model.SimulateHandleOpResult, op *user_op.UserOpInput, simulateGasPrice *big.Int) { + callGasLimit, err := EstimateCallGasLimit(strategy, simulateOpResult, op, simulateGasPrice) + if err != nil { + t.Error(err) + return + } + if callGasLimit == nil { + t.Error("callGasLimit is nil") + return + } + t.Logf("callGasLimit: %v", callGasLimit) + +} +func testGetPreVerificationGas(t *testing.T, userOp *user_op.UserOpInput, strategy *model.Strategy, gasFeeResult *model.GasPrice) { + res, err := GetPreVerificationGas(userOp, strategy, gasFeeResult, nil) + if err != nil { + t.Error(err) + return + } + t.Logf("preVerificationGas:%v", res) +} +func testComputeGas(t *testing.T, input *user_op.UserOpInput, strategy *model.Strategy) { + t.Logf("strategy: %v", strategy) + paymasterDataInput := paymaster_data.NewPaymasterDataInput(strategy) + res, _, err := ComputeGas(input, strategy, paymasterDataInput) + if err != nil { + t.Fatalf("err: %v", err) + return + } + if res == nil { + t.Error("res is nil") + return + } + jsonRes, _ := json.Marshal(res) + t.Logf("res: %v", string(jsonRes)) +} +func TestEstimateCallGasLimit(t *testing.T) { + callGasLimit, err := estimateVerificationGasLimit(model.MockSimulateHandleOpResult, global_const.DummyReverificationsBigint) + + if err != nil { + t.Error(err) + return + } + if callGasLimit == nil { + t.Error("callGasLimit is nil") + return + } + t.Logf("callGasLimit: %v", callGasLimit) +} +func testGetUserOpEstimateGas(t *testing.T, input *user_op.UserOpInput, strategy *model.Strategy) { + paymasterDataInput := paymaster_data.NewPaymasterDataInput(strategy) + res, err := getUserOpEstimateGas(input, strategy, paymasterDataInput) + if err != nil { + t.Error(err) + return + } + if res == nil { + t.Error("res is nil") + return + } + jsonRes, _ := json.Marshal(res) + t.Logf("res: %v", string(jsonRes)) +} diff --git a/gas_executor/gas_validate.go b/gas_executor/gas_validate.go new file mode 100644 index 00000000..06fdc274 --- /dev/null +++ b/gas_executor/gas_validate.go @@ -0,0 +1,62 @@ +package gas_executor + +import ( + "AAStarCommunity/EthPaymaster_BackService/common/global_const" + "AAStarCommunity/EthPaymaster_BackService/common/model" + "AAStarCommunity/EthPaymaster_BackService/common/user_op" + "AAStarCommunity/EthPaymaster_BackService/service/chain_service" + "golang.org/x/xerrors" + "math/big" +) + +var ( + gasValidateFuncMap = map[global_const.PayType]ValidatePaymasterGasFunc{} + verifyingGasValidateFunc = func(userOp *user_op.UserOpInput, gasComputeResponse *model.ComputeGasResponse, strategy *model.Strategy) error { + //Validate the account’s deposit in the entryPoint is high enough to cover the max possible cost (cover the already-done verification and max execution gas) + // Paymaster check paymaster balance + + //check EntryPoint paymasterAddress balance + balance, err := chain_service.GetPaymasterEntryPointBalance(strategy) + if err != nil { + return err + } + // if balance < 0 + if balance.Cmp(big.NewFloat(0)) < 0 { + return xerrors.Errorf("paymaster EntryPoint balance < 0") + } + etherCost := gasComputeResponse.TotalGasDetail.MaxTxGasCostInEther + if balance.Cmp(etherCost) < 0 { + return xerrors.Errorf("paymaster EntryPoint Not Enough balance %s < %s", balance, etherCost) + } + return nil + } + erc20GasValidateFunc = func(userOp *user_op.UserOpInput, gasComputeResponse *model.ComputeGasResponse, strategy *model.Strategy) error { + userOpValue := *userOp + sender := userOpValue.Sender + tokenBalance, getTokenBalanceErr := chain_service.GetAddressTokenBalance(strategy.GetNewWork(), *sender, strategy.Erc20TokenType) + if getTokenBalanceErr != nil { + return getTokenBalanceErr + } + tokenCost := gasComputeResponse.Erc20TokenCost + bigFloatValue := new(big.Float).SetFloat64(tokenBalance) + if bigFloatValue.Cmp(tokenCost) < 0 { + return xerrors.Errorf("user Token Not Enough tokenBalance %s < tokenCost %s", tokenBalance, tokenCost) + } + return nil + } + superGasValidateFunc = func(userOp *user_op.UserOpInput, gasComputeResponse *model.ComputeGasResponse, strategy *model.Strategy) error { + return xerrors.Errorf("never reach here") + } +) + +func init() { + gasValidateFuncMap[global_const.PayTypeVerifying] = verifyingGasValidateFunc + gasValidateFuncMap[global_const.PayTypeERC20] = erc20GasValidateFunc + gasValidateFuncMap[global_const.PayTypeSuperVerifying] = superGasValidateFunc +} + +func GetGasValidateFunc(payType global_const.PayType) ValidatePaymasterGasFunc { + return gasValidateFuncMap[payType] +} + +type ValidatePaymasterGasFunc = func(userOp *user_op.UserOpInput, gasComputeResponse *model.ComputeGasResponse, strategy *model.Strategy) error diff --git a/gas_executor/pre_vertification_gas.go b/gas_executor/pre_vertification_gas.go new file mode 100644 index 00000000..65d6cb52 --- /dev/null +++ b/gas_executor/pre_vertification_gas.go @@ -0,0 +1,125 @@ +package gas_executor + +import ( + "AAStarCommunity/EthPaymaster_BackService/common/global_const" + "AAStarCommunity/EthPaymaster_BackService/common/model" + "AAStarCommunity/EthPaymaster_BackService/common/network" + "AAStarCommunity/EthPaymaster_BackService/common/network/arbitrum" + "AAStarCommunity/EthPaymaster_BackService/common/user_op" + "AAStarCommunity/EthPaymaster_BackService/common/utils" + "golang.org/x/xerrors" + "math" + "math/big" +) + +var preVerificationGasFuncMap = map[global_const.NewWorkStack]PreVerificationGasFunc{} + +type PreVerificationGasFunc = func(preVerificationEstimateInput *model.PreVerificationGasEstimateInput) (*big.Int, error) + +func init() { + preVerificationGasFuncMap[global_const.ArbStack] = ArbitrumPreVerificationGasFunc() + preVerificationGasFuncMap[global_const.DefaultStack] = DefaultPreVerificationGasFunc() + preVerificationGasFuncMap[global_const.OpStack] = OPStackPreVerificationGasFunc() +} +func GetPreVerificationGasFunc(stack global_const.NewWorkStack) (PreVerificationGasFunc, error) { + function, ok := preVerificationGasFuncMap[stack] + if !ok { + return nil, xerrors.Errorf("stack %s not support", stack) + } + return function, nil +} + +// ArbitrumPreVerificationGasFunc +// https://medium.com/offchainlabs/understanding-arbitrum-2-dimensional-fees-fd1d582596c9. +// https://docs.arbitrum.io/build-decentralized-apps/nodeinterface/reference +func ArbitrumPreVerificationGasFunc() PreVerificationGasFunc { + return func(preVerificationEstimateInput *model.PreVerificationGasEstimateInput) (*big.Int, error) { + strategy := preVerificationEstimateInput.Strategy + base, err := getBasicPreVerificationGas(preVerificationEstimateInput.Op, strategy) + if err != nil { + return nil, err + } + executor := network.GetEthereumExecutor(strategy.GetNewWork()) + estimateOutPut, err := arbitrum.GetArbEstimateOutPut(executor.Client, preVerificationEstimateInput) + if err != nil { + return nil, err + } + + return big.NewInt(0).Add(base, big.NewInt(int64(estimateOutPut.GasEstimateForL1))), nil + } +} +func DefaultPreVerificationGasFunc() PreVerificationGasFunc { + return func(preVerificationEstimateInput *model.PreVerificationGasEstimateInput) (*big.Int, error) { + return getBasicPreVerificationGas(preVerificationEstimateInput.Op, preVerificationEstimateInput.Strategy) + } +} + +// OPStackPreVerificationGasFunc +// The L1 data fee is paid based on the current Ethereum gas price as tracked within the GasPriceOracle smart contract. This gas price is updated automatically by the OP Mainnet protocol. +// https://docs.optimism.io/builders/app-developers/transactions/estimates#execution-gas-fee +// https://docs.optimism.io/stack/transactions/fees#the-l1-data-fee +func OPStackPreVerificationGasFunc() PreVerificationGasFunc { + return func(preVerificationEstimateInput *model.PreVerificationGasEstimateInput) (*big.Int, error) { + op := preVerificationEstimateInput.Op + strategy := preVerificationEstimateInput.Strategy + gasFeeResult := preVerificationEstimateInput.GasFeeResult + basicGas, err := getBasicPreVerificationGas(op, strategy) + if err != nil { + return nil, err + } + executor := network.GetEthereumExecutor(strategy.GetNewWork()) + _, data, err := op.PackUserOpForMock(strategy.GetStrategyEntrypointVersion()) + if err != nil { + return nil, err + } + l1DataFee, err := executor.GetL1DataFee(data) + if err != nil { + return nil, err + } + l2MaxFee := gasFeeResult.MaxFeePerGas + l2priorityFee := big.NewInt(0).Add(gasFeeResult.MaxFeePerGas, gasFeeResult.BaseFee) + // use smaller one + var l2Price *big.Int + if utils.LeftIsLessTanRight(l2MaxFee, l2priorityFee) { + l2Price = l2MaxFee + } else { + l2Price = l2priorityFee + } + //Return static + L1 buffer as PVG. L1 buffer is equal to L1Fee/L2Price. + return big.NewInt(0).Add(basicGas, big.NewInt(0).Div(l1DataFee, l2Price)), nil + } +} + +/** + * calculate the preVerificationGas of the given UserOperation + * preVerificationGas (by definition) is the cost overhead that can't be calculated on-chain. + * it is based on parameters that are defined by the Ethereum protocol for external transactions. + * @param userOp filled userOp to calculate. The only possible missing fields can be the signature and preVerificationGas itself + * @param overheads gas overheads to use, to override the default values + */ +func getBasicPreVerificationGas(op *user_op.UserOpInput, strategy *model.Strategy) (*big.Int, error) { + //op.SetPreVerificationGas(global_const.DUMMAY_PREVERIFICATIONGAS_BIGINT) + //op.SetSignature(global_const.DUMMY_SIGNATURE_BYTE) + //Simulate the `packUserOp(p)` function and return a byte slice. + opValue := *op + _, userOPPack, err := opValue.PackUserOpForMock(strategy.GetStrategyEntrypointVersion()) + if err != nil { + return nil, err + } + //Calculate the length of the packed byte sequence and convert it to the number of characters. + lengthInWord := math.Ceil(float64(len(userOPPack)) / 32) + var callDataConst float64 + for _, b := range userOPPack { + if b == byte(0) { + callDataConst += global_const.GasOverHand.ZeroByte + } else { + callDataConst += global_const.GasOverHand.NonZeroByte + } + } + floatRes := math.Round(callDataConst + global_const.GasOverHand.Fixed/global_const.GasOverHand.BundleSize + + global_const.GasOverHand.PerUserOp + global_const.GasOverHand.PerUserOpWord*lengthInWord) + floatVal := new(big.Float).SetFloat64(floatRes) + result := new(big.Int) + floatVal.Int(result) + return result, err +} diff --git a/go.mod b/go.mod index 62750d97..80736515 100644 --- a/go.mod +++ b/go.mod @@ -1,51 +1,80 @@ module AAStarCommunity/EthPaymaster_BackService -go 1.22.1 +go 1.22.3 require ( + github.com/NethermindEth/starknet.go v0.7.0 github.com/appleboy/gin-jwt/v2 v2.9.2 - github.com/ethereum/go-ethereum v1.13.14 - github.com/gin-contrib/cors v1.5.0 + github.com/deckarep/golang-set/v2 v2.6.0 + github.com/ethereum/go-ethereum v1.14.3 + github.com/gin-contrib/cors v1.7.1 github.com/gin-gonic/gin v1.9.1 - github.com/stretchr/testify v1.8.4 + github.com/go-playground/validator/v10 v10.19.0 + github.com/mitchellh/mapstructure v1.5.0 + github.com/sirupsen/logrus v1.9.3 + github.com/stretchr/testify v1.9.0 github.com/swaggo/files v1.0.1 github.com/swaggo/gin-swagger v1.6.0 github.com/swaggo/swag v1.16.3 - golang.org/x/time v0.3.0 + golang.org/x/time v0.5.0 golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028 - k8s.io/apimachinery v0.29.2 + k8s.io/apimachinery v0.29.3 +) + +require ( + github.com/NethermindEth/juno v0.3.1 // indirect + github.com/fxamacker/cbor/v2 v2.4.0 // indirect + github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb // indirect + github.com/hashicorp/hcl v1.0.0 // indirect + github.com/holiman/uint256 v1.2.4 // indirect + github.com/huin/goupnp v1.3.0 // indirect + github.com/jackpal/go-nat-pmp v1.0.2 // indirect + github.com/joho/godotenv v1.5.1 // indirect + github.com/magiconair/properties v1.8.7 // indirect + github.com/sagikazarmark/locafero v0.4.0 // indirect + github.com/sagikazarmark/slog-shim v0.1.0 // indirect + github.com/sourcegraph/conc v0.3.0 // indirect + github.com/spf13/afero v1.11.0 // indirect + github.com/spf13/cast v1.6.0 // indirect + github.com/spf13/pflag v1.0.5 // indirect + github.com/spf13/viper v1.18.2 // indirect + github.com/subosito/gotenv v1.6.0 // indirect + github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 // indirect + github.com/test-go/testify v1.1.4 // indirect + github.com/x448/float16 v0.8.4 // indirect + go.uber.org/atomic v1.10.0 // indirect + go.uber.org/multierr v1.9.0 // indirect + gopkg.in/ini.v1 v1.67.0 // indirect ) require ( github.com/KyleBanks/depth v1.2.1 // indirect github.com/Microsoft/go-winio v0.6.1 // indirect - github.com/StackExchange/wmi v1.2.1 // indirect - github.com/bits-and-blooms/bitset v1.10.0 // indirect - github.com/btcsuite/btcd/btcec/v2 v2.2.0 // indirect - github.com/bytedance/sonic v1.11.1 // indirect + github.com/bits-and-blooms/bitset v1.13.0 // indirect + github.com/btcsuite/btcd/btcec/v2 v2.3.2 // indirect + github.com/bytedance/sonic v1.11.3 // indirect github.com/chenzhuoyu/base64x v0.0.0-20230717121745-296ad89f973d // indirect github.com/chenzhuoyu/iasm v0.9.1 // indirect github.com/consensys/bavard v0.1.13 // indirect github.com/consensys/gnark-crypto v0.12.1 // indirect - github.com/crate-crypto/go-kzg-4844 v0.7.0 // indirect - github.com/davecgh/go-spew v1.1.1 // indirect - github.com/deckarep/golang-set/v2 v2.1.0 // indirect - github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1 // indirect - github.com/ethereum/c-kzg-4844 v0.4.0 // indirect + github.com/crate-crypto/go-kzg-4844 v1.0.0 // indirect; indirect(force degrade) + github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect + github.com/decred/dcrd/dcrec/secp256k1/v4 v4.3.0 // indirect + github.com/ethereum/c-kzg-4844 v1.0.0 // indirect; indirect (force degrade) + github.com/fsnotify/fsnotify v1.7.0 // indirect github.com/gabriel-vasile/mimetype v1.4.3 // indirect github.com/gin-contrib/sse v0.1.0 // indirect github.com/go-ole/go-ole v1.3.0 // indirect - github.com/go-openapi/jsonpointer v0.20.2 // indirect - github.com/go-openapi/jsonreference v0.20.4 // indirect - github.com/go-openapi/spec v0.20.14 // indirect - github.com/go-openapi/swag v0.22.9 // indirect + github.com/go-openapi/jsonpointer v0.21.0 // indirect + github.com/go-openapi/jsonreference v0.21.0 // indirect + github.com/go-openapi/spec v0.21.0 // indirect + github.com/go-openapi/swag v0.23.0 // indirect github.com/go-playground/locales v0.14.1 // indirect github.com/go-playground/universal-translator v0.18.1 // indirect - github.com/go-playground/validator/v10 v10.18.0 // indirect github.com/goccy/go-json v0.10.2 // indirect github.com/golang-jwt/jwt/v4 v4.5.0 // indirect - github.com/gorilla/websocket v1.4.2 // indirect - github.com/holiman/uint256 v1.2.4 // indirect + github.com/google/uuid v1.6.0 // indirect + github.com/gorilla/websocket v1.5.1 // indirect github.com/josharian/intern v1.0.0 // indirect github.com/json-iterator/go v1.1.12 // indirect github.com/klauspost/cpuid/v2 v2.2.7 // indirect @@ -55,27 +84,27 @@ require ( github.com/mmcloughlin/addchain v0.4.0 // indirect github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/modern-go/reflect2 v1.0.2 // indirect - github.com/pelletier/go-toml/v2 v2.1.1 // indirect - github.com/pmezard/go-difflib v1.0.0 // indirect - github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible // indirect + github.com/pelletier/go-toml/v2 v2.2.0 // indirect + github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect + github.com/shirou/gopsutil v3.21.11+incompatible // indirect github.com/supranational/blst v0.3.11 // indirect - github.com/tklauser/go-sysconf v0.3.12 // indirect - github.com/tklauser/numcpus v0.6.1 // indirect + github.com/tklauser/go-sysconf v0.3.13 // indirect + github.com/tklauser/numcpus v0.7.0 // indirect github.com/twitchyliquid64/golang-asm v0.15.1 // indirect github.com/ugorji/go/codec v1.2.12 // indirect + github.com/yusufpapurcu/wmi v1.2.4 // indirect golang.org/x/arch v0.7.0 // indirect - golang.org/x/crypto v0.20.0 // indirect - golang.org/x/exp v0.0.0-20231110203233-9a3e6036ecaa // indirect - golang.org/x/mod v0.15.0 // indirect - golang.org/x/net v0.21.0 // indirect - golang.org/x/sync v0.6.0 // indirect - golang.org/x/sys v0.17.0 // indirect + golang.org/x/crypto v0.22.0 // indirect + golang.org/x/exp v0.0.0-20240409090435-93d18d7e34b8 // indirect + golang.org/x/mod v0.17.0 // indirect + golang.org/x/net v0.24.0 // indirect + golang.org/x/sync v0.7.0 // indirect + golang.org/x/sys v0.19.0 // indirect golang.org/x/text v0.14.0 // indirect - golang.org/x/tools v0.18.0 // indirect - google.golang.org/protobuf v1.32.0 // indirect - gopkg.in/yaml.v2 v2.4.0 // indirect + golang.org/x/tools v0.20.0 // indirect + google.golang.org/protobuf v1.33.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect rsc.io/tmplfunc v0.0.3 // indirect sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect - sigs.k8s.io/yaml v1.3.0 // indirect + sigs.k8s.io/yaml v1.4.0 // indirect ) diff --git a/go.sum b/go.sum index 3050129d..eebfdc2f 100644 --- a/go.sum +++ b/go.sum @@ -4,8 +4,10 @@ github.com/KyleBanks/depth v1.2.1 h1:5h8fQADFrWtarTdtDudMmGsC7GPbOAu6RVB3ffsVFHc github.com/KyleBanks/depth v1.2.1/go.mod h1:jzSb9d0L43HxTQfT+oSA1EEp2q+ne2uh6XgeJcm8brE= github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migciow= github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= -github.com/StackExchange/wmi v1.2.1 h1:VIkavFPXSjcnS+O8yTq7NI32k0R5Aj+v39y29VYDOSA= -github.com/StackExchange/wmi v1.2.1/go.mod h1:rcmrprowKIVzvc+NUiLncP2uuArMWLCbu9SBzvHz7e8= +github.com/NethermindEth/juno v0.3.1 h1:AW72LiAm9gqUeCVJWvepnZcTnpU4Vkl0KzPMxS+42FA= +github.com/NethermindEth/juno v0.3.1/go.mod h1:SGbTpgGaCsxhFsKOid7Ylnz//WZ8swtILk+NbHGsk/Q= +github.com/NethermindEth/starknet.go v0.7.0 h1:OmKkPs7EvS8uUkoxh+y/4xeluFx4fepZoqhczr51Y/c= +github.com/NethermindEth/starknet.go v0.7.0/go.mod h1:k6qFeYocOAeY7sdF7oAaabvjXvmcVtBbLn7YE2azVyQ= github.com/VictoriaMetrics/fastcache v1.12.1 h1:i0mICQuojGDL3KblA7wUNlY5lOK6a4bwt3uRKnkZU40= github.com/VictoriaMetrics/fastcache v1.12.1/go.mod h1:tX04vaqcNoQeGLD+ra5pU5sWkuxnzWhEzLwhP9w653o= github.com/appleboy/gin-jwt/v2 v2.9.2 h1:GeS3lm9mb9HMmj7+GNjYUtpp3V1DAQ1TkUFa5poiZ7Y= @@ -14,16 +16,18 @@ github.com/appleboy/gofight/v2 v2.1.2 h1:VOy3jow4vIK8BRQJoC/I9muxyYlJ2yb9ht2hZoS github.com/appleboy/gofight/v2 v2.1.2/go.mod h1:frW+U1QZEdDgixycTj4CygQ48yLTUhplt43+Wczp3rw= github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= -github.com/bits-and-blooms/bitset v1.10.0 h1:ePXTeiPEazB5+opbv5fr8umg2R/1NlzgDsyepwsSr88= -github.com/bits-and-blooms/bitset v1.10.0/go.mod h1:7hO7Gc7Pp1vODcmWvKMRA9BNmbv6a/7QIWpPxHddWR8= -github.com/btcsuite/btcd/btcec/v2 v2.2.0 h1:fzn1qaOt32TuLjFlkzYSsBC35Q3KUjT1SwPxiMSCF5k= -github.com/btcsuite/btcd/btcec/v2 v2.2.0/go.mod h1:U7MHm051Al6XmscBQ0BoNydpOTsFAn707034b5nY8zU= +github.com/bits-and-blooms/bitset v1.13.0 h1:bAQ9OPNFYbGHV6Nez0tmNI0RiEu7/hxlYJRUA0wFAVE= +github.com/bits-and-blooms/bitset v1.13.0/go.mod h1:7hO7Gc7Pp1vODcmWvKMRA9BNmbv6a/7QIWpPxHddWR8= +github.com/btcsuite/btcd/btcec/v2 v2.3.2 h1:5n0X6hX0Zk+6omWcihdYvdAlGf2DfasC0GMf7DClJ3U= +github.com/btcsuite/btcd/btcec/v2 v2.3.2/go.mod h1:zYzJ8etWJQIv1Ogk7OzpWjowwOdXY1W/17j2MW85J04= github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1 h1:q0rUy8C/TYNBQS1+CGKw68tLOFYSNEs0TFnxxnS9+4U= github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1/go.mod h1:7SFka0XMvUgj3hfZtydOrQY2mwhPclbT2snogU7SQQc= github.com/bytedance/sonic v1.5.0/go.mod h1:ED5hyg4y6t3/9Ku1R6dU/4KyJ48DZ4jPhfY1O2AihPM= github.com/bytedance/sonic v1.10.0-rc/go.mod h1:ElCzW+ufi8qKqNW0FY314xriJhyJhuoJ3gFZdAHF7NM= -github.com/bytedance/sonic v1.11.1 h1:JC0+6c9FoWYYxakaoa+c5QTtJeiSZNeByOBhXtAFSn4= -github.com/bytedance/sonic v1.11.1/go.mod h1:iZcSUejdk5aukTND/Eu/ivjQuEL0Cu9/rf50Hi0u/g4= +github.com/bytedance/sonic v1.11.3 h1:jRN+yEjakWh8aK5FzrciUHG8OFXK+4/KrAX/ysEtHAA= +github.com/bytedance/sonic v1.11.3/go.mod h1:iZcSUejdk5aukTND/Eu/ivjQuEL0Cu9/rf50Hi0u/g4= +github.com/cespare/cp v0.1.0 h1:SE+dxFebS7Iik5LK0tsi1k9ZCxEaFX4AjQmoyA+1dJk= +github.com/cespare/cp v0.1.0/go.mod h1:SOGHArjBr4JWaSDEVpWpo/hNg6RoKrls6Oh40hiwW+s= github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj44= github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/chenzhuoyu/base64x v0.0.0-20211019084208-fb5309c8db06/go.mod h1:DH46F32mSOjUmXrMHnKwZdA8wcEefY7UVqBKYGjpdQY= @@ -33,16 +37,14 @@ github.com/chenzhuoyu/base64x v0.0.0-20230717121745-296ad89f973d/go.mod h1:8EPpV github.com/chenzhuoyu/iasm v0.9.0/go.mod h1:Xjy2NpN3h7aUqeqM+woSuuvxmIe6+DDsiNLIrkAmYog= github.com/chenzhuoyu/iasm v0.9.1 h1:tUHQJXo3NhBqw6s33wkGn9SP3bvrWLdlVIJ3hQBL7P0= github.com/chenzhuoyu/iasm v0.9.1/go.mod h1:Xjy2NpN3h7aUqeqM+woSuuvxmIe6+DDsiNLIrkAmYog= -github.com/cockroachdb/errors v1.8.1 h1:A5+txlVZfOqFBDa4mGz2bUWSp0aHElvHX2bKkdbQu+Y= -github.com/cockroachdb/errors v1.8.1/go.mod h1:qGwQn6JmZ+oMjuLwjWzUNqblqk0xl4CVV3SQbGwK7Ac= -github.com/cockroachdb/logtags v0.0.0-20190617123548-eb05cc24525f h1:o/kfcElHqOiXqcou5a3rIlMc7oJbMQkeLk0VQJ7zgqY= -github.com/cockroachdb/logtags v0.0.0-20190617123548-eb05cc24525f/go.mod h1:i/u985jwjWRlyHXQbwatDASoW0RMlZ/3i9yJHE2xLkI= +github.com/cockroachdb/errors v1.9.0 h1:B48dYem5SlAY7iU8AKsgedb4gH6mo+bDkbtLIvM/a88= +github.com/cockroachdb/errors v1.9.0/go.mod h1:vaNcEYYqbIqB5JhKBhFV9CneUqeuEbB2OYJBK4GBNYQ= +github.com/cockroachdb/logtags v0.0.0-20211118104740-dabe8e521a4f h1:6jduT9Hfc0njg5jJ1DdKCFPdMBrp/mdZfCpa5h+WM74= +github.com/cockroachdb/logtags v0.0.0-20211118104740-dabe8e521a4f/go.mod h1:Vz9DsVWQQhf3vs21MhPMZpMGSht7O/2vFW2xusFUVOs= github.com/cockroachdb/pebble v0.0.0-20230928194634-aa077af62593 h1:aPEJyR4rPBvDmeyi+l/FS/VtA00IWvjeFvjen1m1l1A= github.com/cockroachdb/pebble v0.0.0-20230928194634-aa077af62593/go.mod h1:6hk1eMY/u5t+Cf18q5lFMUA1Rc+Sm5I6Ra1QuPyxXCo= -github.com/cockroachdb/redact v1.0.8 h1:8QG/764wK+vmEYoOlfobpe12EQcS81ukx/a4hdVMxNw= -github.com/cockroachdb/redact v1.0.8/go.mod h1:BVNblN9mBWFyMyqK1k3AAiSxhvhfK2oOZZ2lK+dpvRg= -github.com/cockroachdb/sentry-go v0.6.1-cockroachdb.2 h1:IKgmqgMQlVJIZj19CdocBeSfSaiCbEBZGKODaixqtHM= -github.com/cockroachdb/sentry-go v0.6.1-cockroachdb.2/go.mod h1:8BT+cPK6xvFOcRlk0R8eg+OTkcqI6baNH4xAkpiYVvQ= +github.com/cockroachdb/redact v1.1.3 h1:AKZds10rFSIj7qADf0g46UixK8NNLwWTNdCIGS5wfSQ= +github.com/cockroachdb/redact v1.1.3/go.mod h1:BVNblN9mBWFyMyqK1k3AAiSxhvhfK2oOZZ2lK+dpvRg= github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06 h1:zuQyyAKVxetITBuuhv3BI9cMrmStnpT18zmgmTxunpo= github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06/go.mod h1:7nc4anLGjupUW/PeY5qiNYsdNXj7zopG+eqsS7To5IQ= github.com/consensys/bavard v0.1.13 h1:oLhMLOFGTLdlda/kma4VOJazblc7IM5y5QPd2A/YjhQ= @@ -55,56 +57,70 @@ github.com/crate-crypto/go-ipa v0.0.0-20231025140028-3c0104f4b233 h1:d28BXYi+wUp github.com/crate-crypto/go-ipa v0.0.0-20231025140028-3c0104f4b233/go.mod h1:geZJZH3SzKCqnz5VT0q/DyIG/tvu/dZk+VIfXicupJs= github.com/crate-crypto/go-kzg-4844 v0.7.0 h1:C0vgZRk4q4EZ/JgPfzuSoxdCq3C3mOZMBShovmncxvA= github.com/crate-crypto/go-kzg-4844 v0.7.0/go.mod h1:1kMhvPgI0Ky3yIa+9lFySEBUBXkYxeOi8ZF1sYioxhc= +github.com/crate-crypto/go-kzg-4844 v1.0.0 h1:TsSgHwrkTKecKJ4kadtHi4b3xHW5dCFUDFnUp1TsawI= +github.com/crate-crypto/go-kzg-4844 v1.0.0/go.mod h1:1kMhvPgI0Ky3yIa+9lFySEBUBXkYxeOi8ZF1sYioxhc= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/deckarep/golang-set/v2 v2.1.0 h1:g47V4Or+DUdzbs8FxCCmgb6VYd+ptPAngjM6dtGktsI= -github.com/deckarep/golang-set/v2 v2.1.0/go.mod h1:VAky9rY/yGXJOLEDv3OMci+7wtDpOF4IN+y82NBOac4= -github.com/decred/dcrd/crypto/blake256 v1.0.0 h1:/8DMNYp9SGi5f0w7uCm6d6M4OU2rGFK09Y2A4Xv7EE0= -github.com/decred/dcrd/crypto/blake256 v1.0.0/go.mod h1:sQl2p6Y26YV+ZOcSTP6thNdn47hh8kt6rqSlvmrXFAc= -github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1 h1:YLtO71vCjJRCBcrPMtQ9nqBsqpA1m5sE92cU+pd5Mcc= -github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1/go.mod h1:hyedUtir6IdtD/7lIxGeCxkaw7y45JueMRL4DIyJDKs= +github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= +github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/deckarep/golang-set/v2 v2.6.0 h1:XfcQbWM1LlMB8BsJ8N9vW5ehnnPVIw0je80NsVHagjM= +github.com/deckarep/golang-set/v2 v2.6.0/go.mod h1:VAky9rY/yGXJOLEDv3OMci+7wtDpOF4IN+y82NBOac4= +github.com/decred/dcrd/crypto/blake256 v1.0.1 h1:7PltbUIQB7u/FfZ39+DGa/ShuMyJ5ilcvdfma9wOH6Y= +github.com/decred/dcrd/crypto/blake256 v1.0.1/go.mod h1:2OfgNZ5wDpcsFmHmCK5gZTPcCXqlm2ArzUIkw9czNJo= +github.com/decred/dcrd/dcrec/secp256k1/v4 v4.3.0 h1:rpfIENRNNilwHwZeG5+P150SMrnNEcHYvcCuK6dPZSg= +github.com/decred/dcrd/dcrec/secp256k1/v4 v4.3.0/go.mod h1:v57UDF4pDQJcEfFUCRop3lJL149eHGSe9Jvczhzjo/0= github.com/ethereum/c-kzg-4844 v0.4.0 h1:3MS1s4JtA868KpJxroZoepdV0ZKBp3u/O5HcZ7R3nlY= github.com/ethereum/c-kzg-4844 v0.4.0/go.mod h1:VewdlzQmpT5QSrVhbBuGoCdFJkpaJlO1aQputP83wc0= +github.com/ethereum/c-kzg-4844 v1.0.0 h1:0X1LBXxaEtYD9xsyj9B9ctQEZIpnvVDeoBx8aHEwTNA= +github.com/ethereum/c-kzg-4844 v1.0.0/go.mod h1:VewdlzQmpT5QSrVhbBuGoCdFJkpaJlO1aQputP83wc0= github.com/ethereum/go-ethereum v1.13.14 h1:EwiY3FZP94derMCIam1iW4HFVrSgIcpsu0HwTQtm6CQ= github.com/ethereum/go-ethereum v1.13.14/go.mod h1:TN8ZiHrdJwSe8Cb6x+p0hs5CxhJZPbqB7hHkaUXcmIU= +github.com/ethereum/go-ethereum v1.14.3 h1:5zvnAqLtnCZrU9uod1JCvHWJbPMURzYFHfc2eHz4PHA= +github.com/ethereum/go-ethereum v1.14.3/go.mod h1:1STrq471D0BQbCX9He0hUj4bHxX2k6mt5nOQJhDNOJ8= github.com/fjl/memsize v0.0.2 h1:27txuSD9or+NZlnOWdKUxeBzTAUkWCVh+4Gf2dWFOzA= github.com/fjl/memsize v0.0.2/go.mod h1:VvhXpOYNQvB+uIk2RvXzuaQtkQJzzIx6lSBe1xv7hi0= -github.com/fsnotify/fsnotify v1.6.0 h1:n+5WquG0fcWoWp6xPWfHdbskMCQaFnG6PfBrh1Ky4HY= -github.com/fsnotify/fsnotify v1.6.0/go.mod h1:sl3t1tCWJFWoRz9R8WJCbQihKKwmorjAbSClcnxKAGw= +github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= +github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= +github.com/fsnotify/fsnotify v1.7.0 h1:8JEhPFa5W2WU7YfeZzPNqzMP6Lwt7L2715Ggo0nosvA= +github.com/fsnotify/fsnotify v1.7.0/go.mod h1:40Bi/Hjc2AVfZrqy+aj+yEI+/bRxZnMJyTJwOpGvigM= +github.com/fxamacker/cbor/v2 v2.4.0 h1:ri0ArlOR+5XunOP8CRUowT0pSJOwhW098ZCUyskZD88= +github.com/fxamacker/cbor/v2 v2.4.0/go.mod h1:TA1xS00nchWmaBnEIxPSE5oHLuJBAVvqrtAnWBwBCVo= github.com/gabriel-vasile/mimetype v1.4.3 h1:in2uUcidCuFcDKtdcBxlR0rJ1+fsokWf+uqxgUFjbI0= github.com/gabriel-vasile/mimetype v1.4.3/go.mod h1:d8uq/6HKRL6CGdk+aubisF/M5GcPfT7nKyLpA0lbSSk= github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff h1:tY80oXqGNY4FhTFhk+o9oFHGINQ/+vhlm8HFzi6znCI= github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff/go.mod h1:x7DCsMOv1taUwEWCzT4cmDeAkigA5/QCwUodaVOe8Ww= github.com/gballet/go-verkle v0.1.1-0.20231031103413-a67434b50f46 h1:BAIP2GihuqhwdILrV+7GJel5lyPV3u1+PgzrWLc0TkE= github.com/gballet/go-verkle v0.1.1-0.20231031103413-a67434b50f46/go.mod h1:QNpY22eby74jVhqH4WhDLDwxc/vqsern6pW+u2kbkpc= -github.com/gin-contrib/cors v1.5.0 h1:DgGKV7DDoOn36DFkNtbHrjoRiT5ExCe+PC9/xp7aKvk= -github.com/gin-contrib/cors v1.5.0/go.mod h1:TvU7MAZ3EwrPLI2ztzTt3tqgvBCq+wn8WpZmfADjupI= +github.com/getsentry/sentry-go v0.13.0 h1:20dgTiUSfxRB/EhMPtxcL9ZEbM1ZdR+W/7f7NWD+xWo= +github.com/getsentry/sentry-go v0.13.0/go.mod h1:EOsfu5ZdvKPfeHYV6pTVQnsjfp30+XA7//UooKNumH0= +github.com/gin-contrib/cors v1.7.1 h1:s9SIppU/rk8enVvkzwiC2VK3UZ/0NNGsWfUKvV55rqs= +github.com/gin-contrib/cors v1.7.1/go.mod h1:n/Zj7B4xyrgk/cX1WCX2dkzFfaNm/xJb6oIUk7WTtps= github.com/gin-contrib/gzip v0.0.6 h1:NjcunTcGAj5CO1gn4N8jHOSIeRFHIbn51z6K+xaN4d4= github.com/gin-contrib/gzip v0.0.6/go.mod h1:QOJlmV2xmayAjkNS2Y8NQsMneuRShOU/kjovCXNuzzk= github.com/gin-contrib/sse v0.1.0 h1:Y/yl/+YNO8GZSjAhjMsSuLt29uWRFHdHYUb5lYOV9qE= github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm+fLHvGI= github.com/gin-gonic/gin v1.9.1 h1:4idEAncQnU5cB7BeOkPtxjfCSye0AAm1R0RVIqJ+Jmg= github.com/gin-gonic/gin v1.9.1/go.mod h1:hPrL7YrpYKXt5YId3A/Tnip5kqbEAP+KLuI3SUcPTeU= -github.com/go-ole/go-ole v1.2.5/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0= +github.com/go-ole/go-ole v1.2.6/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0= github.com/go-ole/go-ole v1.3.0 h1:Dt6ye7+vXGIKZ7Xtk4s6/xVdGDQynvom7xCFEdWr6uE= github.com/go-ole/go-ole v1.3.0/go.mod h1:5LS6F96DhAwUc7C+1HLexzMXY1xGRSryjyPPKW6zv78= -github.com/go-openapi/jsonpointer v0.20.2 h1:mQc3nmndL8ZBzStEo3JYF8wzmeWffDH4VbXz58sAx6Q= -github.com/go-openapi/jsonpointer v0.20.2/go.mod h1:bHen+N0u1KEO3YlmqOjTT9Adn1RfD91Ar825/PuiRVs= -github.com/go-openapi/jsonreference v0.20.4 h1:bKlDxQxQJgwpUSgOENiMPzCTBVuc7vTdXSSgNeAhojU= -github.com/go-openapi/jsonreference v0.20.4/go.mod h1:5pZJyJP2MnYCpoeoMAql78cCHauHj0V9Lhc506VOpw4= -github.com/go-openapi/spec v0.20.14 h1:7CBlRnw+mtjFGlPDRZmAMnq35cRzI91xj03HVyUi/Do= -github.com/go-openapi/spec v0.20.14/go.mod h1:8EOhTpBoFiask8rrgwbLC3zmJfz4zsCUueRuPM6GNkw= -github.com/go-openapi/swag v0.22.9 h1:XX2DssF+mQKM2DHsbgZK74y/zj4mo9I99+89xUmuZCE= -github.com/go-openapi/swag v0.22.9/go.mod h1:3/OXnFfnMAwBD099SwYRk7GD3xOrr1iL7d/XNLXVVwE= +github.com/go-openapi/jsonpointer v0.21.0 h1:YgdVicSA9vH5RiHs9TZW5oyafXZFc6+2Vc1rr/O9oNQ= +github.com/go-openapi/jsonpointer v0.21.0/go.mod h1:IUyH9l/+uyhIYQ/PXVA41Rexl+kOkAPDdXEYns6fzUY= +github.com/go-openapi/jsonreference v0.21.0 h1:Rs+Y7hSXT83Jacb7kFyjn4ijOuVGSvOdF2+tg1TRrwQ= +github.com/go-openapi/jsonreference v0.21.0/go.mod h1:LmZmgsrTkVg9LG4EaHeY8cBDslNPMo06cago5JNLkm4= +github.com/go-openapi/spec v0.21.0 h1:LTVzPc3p/RzRnkQqLRndbAzjY0d0BCL72A6j3CdL9ZY= +github.com/go-openapi/spec v0.21.0/go.mod h1:78u6VdPw81XU44qEWGhtr982gJ5BWg2c0I5XwVMotYk= +github.com/go-openapi/swag v0.23.0 h1:vsEVJDUo2hPJ2tu0/Xc+4noaxyEffXNIs3cOULZ+GrE= +github.com/go-openapi/swag v0.23.0/go.mod h1:esZ8ITTYEsH1V2trKHjAN8Ai7xHb8RV+YSZ577vPjgQ= github.com/go-playground/assert/v2 v2.2.0 h1:JvknZsQTYeFEAhQwI4qEt9cyV5ONwRHC+lYKSsYSR8s= github.com/go-playground/assert/v2 v2.2.0/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4= github.com/go-playground/locales v0.14.1 h1:EWaQ/wswjilfKLTECiXz7Rh+3BjFhfDFKv/oXslEjJA= github.com/go-playground/locales v0.14.1/go.mod h1:hxrqLVvrK65+Rwrd5Fc6F2O76J/NuW9t0sjnWqG1slY= github.com/go-playground/universal-translator v0.18.1 h1:Bcnm0ZwsGyWbCzImXv+pAJnYK9S473LQFuzCbDbfSFY= github.com/go-playground/universal-translator v0.18.1/go.mod h1:xekY+UJKNuX9WP91TpwSH2VMlDf28Uj24BCp08ZFTUY= -github.com/go-playground/validator/v10 v10.18.0 h1:BvolUXjp4zuvkZ5YN5t7ebzbhlUtPsPm2S9NAZ5nl9U= -github.com/go-playground/validator/v10 v10.18.0/go.mod h1:dbuPbCMFw/DrkbEynArYaCwl3amGuJotoKCe95atGMM= +github.com/go-playground/validator/v10 v10.19.0 h1:ol+5Fu+cSq9JD7SoSqe04GMI92cbn0+wvQ3bZ8b/AU4= +github.com/go-playground/validator/v10 v10.19.0/go.mod h1:dbuPbCMFw/DrkbEynArYaCwl3amGuJotoKCe95atGMM= github.com/goccy/go-json v0.10.2 h1:CrxCmQqYDkv1z7lO7Wbh2HN93uovUHgrECaO5ZrCXAU= github.com/goccy/go-json v0.10.2/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I= github.com/gofrs/flock v0.8.1 h1:+gYjHKf32LDeiEEFhQaotPbLuUXjY5ZqxKgXy7n59aw= @@ -113,30 +129,51 @@ github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= github.com/golang-jwt/jwt/v4 v4.5.0 h1:7cYmW1XlMY7h7ii7UhUyChSgS5wUJEnm9uZVTGqOWzg= github.com/golang-jwt/jwt/v4 v4.5.0/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0= -github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= -github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= +github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= +github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= +github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= +github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= +github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= +github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= +github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= +github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= +github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb h1:PBC98N2aIaM3XXiurYmW7fx4GZkL8feAMVq7nEjURHk= github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= +github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= +github.com/google/gofuzz v1.2.0 h1:xRy4A+RhZaiKjJ1bPfwQ8sedCA+YS2YcCHW6ec7JMi0= +github.com/google/gofuzz v1.2.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/subcommands v1.2.0/go.mod h1:ZjhPrFU+Olkh9WazFPsl27BQ4UPiG37m3yTrtFlrHVk= -github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= -github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/gorilla/websocket v1.4.2 h1:+/TMaTYc4QFitKJxsQ7Yye35DkWvkdLcvGKqM+x0Ufc= -github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= +github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= +github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/gorilla/websocket v1.5.1 h1:gmztn0JnHVt9JZquRuzLw3g4wouNVzKL15iLr/zn/QY= +github.com/gorilla/websocket v1.5.1/go.mod h1:x3kM2JMyaluk02fnUJpQuwD2dCS5NDG2ZHL0uE0tcaY= github.com/hashicorp/go-bexpr v0.1.10 h1:9kuI5PFotCboP3dkDYFr/wi0gg0QVbSNz5oFRpxn4uE= github.com/hashicorp/go-bexpr v0.1.10/go.mod h1:oxlubA2vC/gFVfX1A6JGp7ls7uCDlfJn732ehYYg+g0= +github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4= +github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= github.com/holiman/billy v0.0.0-20240216141850-2abb0c79d3c4 h1:X4egAf/gcS1zATw6wn4Ej8vjuVGxeHdan+bRb2ebyv4= github.com/holiman/billy v0.0.0-20240216141850-2abb0c79d3c4/go.mod h1:5GuXa7vkL8u9FkFuWdVvfR5ix8hRB7DbOAaYULamFpc= github.com/holiman/bloomfilter/v2 v2.0.3 h1:73e0e/V0tCydx14a0SCYS/EWCxgwLZ18CZcZKVu0fao= github.com/holiman/bloomfilter/v2 v2.0.3/go.mod h1:zpoh+gs7qcpqrHr3dB55AMiJwo0iURXE7ZOP9L9hSkA= github.com/holiman/uint256 v1.2.4 h1:jUc4Nk8fm9jZabQuqr2JzednajVmBpC+oiTiXZJEApU= github.com/holiman/uint256 v1.2.4/go.mod h1:EOMSn4q6Nyt9P6efbI3bueV4e1b3dGlUCXeiRV4ng7E= +github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= github.com/huin/goupnp v1.3.0 h1:UvLUlWDNpoUdYzb2TCn+MuTWtcjXKSza2n6CBdQ0xXc= github.com/huin/goupnp v1.3.0/go.mod h1:gnGPsThkYa7bFi/KWmEysQRf48l2dvR5bxr2OFckNX8= github.com/jackpal/go-nat-pmp v1.0.2 h1:KzKSgb7qkJvOUTqYl9/Hg/me3pWgBmERKrTGD7BdWus= github.com/jackpal/go-nat-pmp v1.0.2/go.mod h1:QPH045xvCAeXUZOxsnwmrtiCoxIr9eob+4orBN1SBKc= +github.com/joho/godotenv v1.4.0 h1:3l4+N6zfMWnkbPEXKng2o2/MR5mSwTrBih4ZEkkz1lg= +github.com/joho/godotenv v1.4.0/go.mod h1:f4LDr5Voq0i2e/R5DDNOoa2zzDfwtkZa6DnEwAbqwq4= +github.com/joho/godotenv v1.5.1 h1:7eLL/+HRGLY0ldzfGMeQkb7vMd0as4CfYvUVzLqw0N0= +github.com/joho/godotenv v1.5.1/go.mod h1:f4LDr5Voq0i2e/R5DDNOoa2zzDfwtkZa6DnEwAbqwq4= github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY= github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y= github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= @@ -157,6 +194,8 @@ github.com/leanovate/gopter v0.2.9 h1:fQjYxZaynp97ozCzfOyOuAGOU4aU/z37zf/tOujFk7 github.com/leanovate/gopter v0.2.9/go.mod h1:U2L/78B+KVFIx2VmW6onHJQzXtFb+p5y3y2Sh+Jxxv8= github.com/leodido/go-urn v1.4.0 h1:WT9HwE9SGECu3lg4d/dIA+jxlljEa1/ffXKmRjqdmIQ= github.com/leodido/go-urn v1.4.0/go.mod h1:bvxc+MVxLKB4z00jd1z+Dvzr47oO32F/QSNjSBOlFxI= +github.com/magiconair/properties v1.8.7 h1:IeQXZAiQcpL9mgcAe1Nu6cX9LLw6ExEHKjN0VQdvPDY= +github.com/magiconair/properties v1.8.7/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0= github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0= github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc= github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= @@ -167,8 +206,8 @@ github.com/mattn/go-runewidth v0.0.13 h1:lTGmDsbAYt5DmK6OnoV7EuIF1wEIFAcxld6ypU4 github.com/mattn/go-runewidth v0.0.13/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369 h1:I0XW9+e1XWDxdcEniV4rQAIOPUGDq67JSCiRCgGCZLI= github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369/go.mod h1:BSXmuO+STAnVfrANrmjBb36TMTDstsz7MSK+HVaYKv4= -github.com/mitchellh/mapstructure v1.4.1 h1:CpVNEelQCZBooIPDn+AR3NpivK/TIKU8bDxdASFVQag= -github.com/mitchellh/mapstructure v1.4.1/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= +github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= +github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= github.com/mitchellh/pointerstructure v1.2.0 h1:O+i9nHnXS3l/9Wu7r4NrEdwA2VFTicjUEN1uBnDo34A= github.com/mitchellh/pointerstructure v1.2.0/go.mod h1:BRAsLI5zgXmw97Lf6s25bs8ohIXc3tViBH44KcwB2g4= github.com/mmcloughlin/addchain v0.4.0 h1:SobOdjm2xLj1KkXN5/n0xTIWyZA2+s99UCY1iPfkHRY= @@ -179,14 +218,28 @@ github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M= github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= +github.com/nsf/jsondiff v0.0.0-20210926074059-1e845ec5d249 h1:NHrXEjTNQY7P0Zfx1aMrNhpgxHmow66XQtm0aQLY0AE= +github.com/nsf/jsondiff v0.0.0-20210926074059-1e845ec5d249/go.mod h1:mpRZBD8SJ55OIICQ3iWH0Yz3cjzA61JdqMLoWXeB2+8= +github.com/nxadm/tail v1.4.4 h1:DQuhQpB1tVlglWS2hLQ5OV6B5r8aGxSrPc5Qo6uTN78= +github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= github.com/olekukonko/tablewriter v0.0.5 h1:P2Ga83D34wi1o9J6Wh1mRuqd4mF/x/lgBS7N7AbDhec= github.com/olekukonko/tablewriter v0.0.5/go.mod h1:hPp6KlRPjbx+hW8ykQs1w3UBbZlj6HuIJcUGPhkA7kY= -github.com/pelletier/go-toml/v2 v2.1.1 h1:LWAJwfNvjQZCFIDKWYQaM62NcYeYViCmWIwmOStowAI= -github.com/pelletier/go-toml/v2 v2.1.1/go.mod h1:tJU2Z3ZkXwnxa4DPO899bsyIoywizdUvyaeZurnPPDc= +github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= +github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk= +github.com/onsi/ginkgo v1.14.0 h1:2mOpI4JVVPBN+WQRa0WKH2eXR+Ey+uK4n7Zj0aYpIQA= +github.com/onsi/ginkgo v1.14.0/go.mod h1:iSB4RoI2tjJc9BBv4NKIKWKya62Rps+oPG/Lv9klQyY= +github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= +github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= +github.com/onsi/gomega v1.29.0 h1:KIA/t2t5UBzoirT4H9tsML45GEbo3ouUnBHsCfD2tVg= +github.com/onsi/gomega v1.29.0/go.mod h1:9sxs+SwGrKI0+PWe4Fxa9tFQQBG5xSsSbMXOI8PPpoQ= +github.com/pelletier/go-toml/v2 v2.2.0 h1:QLgLl2yMN7N+ruc31VynXs1vhMZa7CeHHejIeBAsoHo= +github.com/pelletier/go-toml/v2 v2.2.0/go.mod h1:1t835xjRzz80PqgE6HHgN2JOsmgYu/h4qDAS4n929Rs= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= +github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/prometheus/client_golang v1.12.0 h1:C+UIj/QWtmqY13Arb8kwMt5j34/0Z2iKamrJ+ryC0Gg= github.com/prometheus/client_golang v1.12.0/go.mod h1:3Z9XVyYiZYEO+YQWt3RD2R3jrbd179Rt297l4aS6nDY= github.com/prometheus/client_model v0.2.1-0.20210607210712-147c58e9608a h1:CmF68hwI0XsOQ5UwlBopMi2Ow4Pbg32akc4KIVCOm+Y= @@ -203,20 +256,40 @@ github.com/rs/cors v1.7.0 h1:+88SsELBHx5r+hZ8TCkggzSstaWNbDvThkVK8H6f9ik= github.com/rs/cors v1.7.0/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU= github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= -github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible h1:Bn1aCHHRnjv4Bl16T8rcaFjYSrGrIZvpiGO6P3Q4GpU= -github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA= +github.com/sagikazarmark/locafero v0.4.0 h1:HApY1R9zGo4DBgr7dqsTH/JJxLTTsOt7u6keLGt6kNQ= +github.com/sagikazarmark/locafero v0.4.0/go.mod h1:Pe1W6UlPYUk/+wc/6KFhbORCfqzgYEpgQ3O5fPuL3H4= +github.com/sagikazarmark/slog-shim v0.1.0 h1:diDBnUNK9N/354PgrxMywXnAwEr1QZcOr6gto+ugjYE= +github.com/sagikazarmark/slog-shim v0.1.0/go.mod h1:SrcSrq8aKtyuqEI1uvTDTK1arOWRIczQRv+GVI1AkeQ= +github.com/shirou/gopsutil v3.21.11+incompatible h1:+1+c1VGhc88SSonWP6foOcLhvnKlUeu/erjjvaPEYiI= +github.com/shirou/gopsutil v3.21.11+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA= +github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ= +github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= +github.com/sourcegraph/conc v0.3.0 h1:OQTbbt6P72L20UqAkXXuLOj79LfEanQ+YQFNpLA9ySo= +github.com/sourcegraph/conc v0.3.0/go.mod h1:Sdozi7LEKbFPqYX2/J+iBAM6HpqSLTASQIKqDmF7Mt0= +github.com/spf13/afero v1.11.0 h1:WJQKhtpdm3v2IzqG8VMqrr6Rf3UYpEF239Jy9wNepM8= +github.com/spf13/afero v1.11.0/go.mod h1:GH9Y3pIexgf1MTIWtNGyogA5MwRIDXGUr+hbWNoBjkY= +github.com/spf13/cast v1.6.0 h1:GEiTHELF+vaR5dhz3VqZfFSzZjYbgeKDpBxQVS4GYJ0= +github.com/spf13/cast v1.6.0/go.mod h1:ancEpBxwJDODSW/UG4rDrAqiKolqNNh2DX3mk86cAdo= +github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= +github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= +github.com/spf13/viper v1.18.2 h1:LUXCnvUvSM6FXAsj6nnfc8Q2tp1dIgUfY9Kc8GsSOiQ= +github.com/spf13/viper v1.18.2/go.mod h1:EKmWIqdnk5lOcmR72yw6hS+8OPYcwD0jteitLMVB+yk= github.com/status-im/keycard-go v0.2.0 h1:QDLFswOQu1r5jsycloeQh3bVU8n/NatHHaZobtDnDzA= github.com/status-im/keycard-go v0.2.0/go.mod h1:wlp8ZLbsmrF6g6WjugPAx+IzoLrkdf9+mHxBEeo3Hbg= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= +github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= -github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= +github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= +github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= +github.com/subosito/gotenv v1.6.0 h1:9NlTDc1FTs4qu0DDq7AEtTPNw6SVm7uBMsUCUjABIf8= +github.com/subosito/gotenv v1.6.0/go.mod h1:Dk4QP5c2W3ibzajGcXpNraDfq2IrhjMIvMSWPKKo0FU= github.com/supranational/blst v0.3.11 h1:LyU6FolezeWAhvQk0k6O/d49jqgO52MSDDfYgbeoEm4= github.com/supranational/blst v0.3.11/go.mod h1:jZJtfjgudtNl4en1tzwPIV3KjUnQUvG3/j+w+fVonLw= github.com/swaggo/files v1.0.1 h1:J1bVJ4XHZNq0I46UU90611i9/YzdrF7x92oX1ig5IdE= @@ -227,16 +300,18 @@ github.com/swaggo/swag v1.16.3 h1:PnCYjPCah8FK4I26l2F/KQ4yz3sILcVUN3cTlBFA9Pg= github.com/swaggo/swag v1.16.3/go.mod h1:DImHIuOFXKpMFAQjcC7FG4m3Dg4+QuUgUzJmKjI/gRk= github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 h1:epCh84lMvA70Z7CTTCmYQn2CKbY8j86K7/FAIr141uY= github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7/go.mod h1:q4W45IWZaF22tdD+VEXcAWRA037jwmWEB5VWYORlTpc= +github.com/test-go/testify v1.1.4 h1:Tf9lntrKUMHiXQ07qBScBTSA0dhYQlu83hswqelv1iE= +github.com/test-go/testify v1.1.4/go.mod h1:rH7cfJo/47vWGdi4GPj16x3/t1xGOj2YxzmNQzk2ghU= github.com/tidwall/gjson v1.17.0 h1:/Jocvlh98kcTfpN2+JzGQWQcqrPQwDrVEMApx/M5ZwM= github.com/tidwall/gjson v1.17.0/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk= github.com/tidwall/match v1.1.1 h1:+Ho715JplO36QYgwN9PGYNhgZvoUSc9X2c80KVTi+GA= github.com/tidwall/match v1.1.1/go.mod h1:eRSPERbgtNPcGhD8UCthc6PmLEQXEWd3PRB5JTxsfmM= github.com/tidwall/pretty v1.2.0 h1:RWIZEg2iJ8/g6fDDYzMpobmaoGh5OLl4AXtGUGPcqCs= github.com/tidwall/pretty v1.2.0/go.mod h1:ITEVvHYasfjBbM0u2Pg8T2nJnzm8xPwvNhhsoaGGjNU= -github.com/tklauser/go-sysconf v0.3.12 h1:0QaGUFOdQaIVdPgfITYzaTegZvdCjmYO52cSFAEVmqU= -github.com/tklauser/go-sysconf v0.3.12/go.mod h1:Ho14jnntGE1fpdOqQEEaiKRpvIavV0hSfmBq8nJbHYI= -github.com/tklauser/numcpus v0.6.1 h1:ng9scYS7az0Bk4OZLvrNXNSAO2Pxr1XXRAPyjhIx+Fk= -github.com/tklauser/numcpus v0.6.1/go.mod h1:1XfjsgE2zo8GVw7POkMbHENHzVg3GzmoZ9fESEdAacY= +github.com/tklauser/go-sysconf v0.3.13 h1:GBUpcahXSpR2xN01jhkNAbTLRk2Yzgggk8IM08lq3r4= +github.com/tklauser/go-sysconf v0.3.13/go.mod h1:zwleP4Q4OehZHGn4CYZDipCgg9usW5IJePewFCGVEa0= +github.com/tklauser/numcpus v0.7.0 h1:yjuerZP127QG9m5Zh/mSO4wqurYil27tHrqwRoRjpr4= +github.com/tklauser/numcpus v0.7.0/go.mod h1:bb6dMVcj8A42tSE7i32fsIUCbQNllK5iDguyOZRUzAY= github.com/twitchyliquid64/golang-asm v0.15.1 h1:SU5vSMR7hnwNxj24w34ZyCi/FmDZTkS4MhqMhdFk5YI= github.com/twitchyliquid64/golang-asm v0.15.1/go.mod h1:a1lVb/DtPvCB8fslRZhAngC2+aY1QWCk3Cedj/Gdt08= github.com/tyler-smith/go-bip39 v1.1.0 h1:5eUemwrMargf3BSLRRCalXT93Ns6pQJIjYQN2nyfOP8= @@ -245,82 +320,120 @@ github.com/ugorji/go/codec v1.2.12 h1:9LC83zGrHhuUA9l16C9AHXAqEV/2wBQ4nkvumAE65E github.com/ugorji/go/codec v1.2.12/go.mod h1:UNopzCgEMSXjBc6AOMqYvWC1ktqTAfzJZUZgYf6w6lg= github.com/urfave/cli/v2 v2.25.7 h1:VAzn5oq403l5pHjc4OhD54+XGO9cdKVL/7lDjF+iKUs= github.com/urfave/cli/v2 v2.25.7/go.mod h1:8qnjx1vcq5s2/wpsqoZFndg2CE5tNFyrTvS6SinrnYQ= +github.com/x448/float16 v0.8.4 h1:qLwI1I70+NjRFUR3zs1JPUCgaCXSh3SW62uAKT1mSBM= +github.com/x448/float16 v0.8.4/go.mod h1:14CWIYCyZA/cWjXOioeEpHeN/83MdbZDRQHoFcYsOfg= github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 h1:bAn7/zixMGCfxrRTfdpNzjtPYqr8smhKouy9mxVdGPU= github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673/go.mod h1:N3UwUGtsrSj3ccvlPHLoLsHnpR27oXr4ZE984MbSER8= github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= +github.com/yusufpapurcu/wmi v1.2.4 h1:zFUKzehAFReQwLys1b/iSMl+JQGSCSjtVqQn9bBrPo0= +github.com/yusufpapurcu/wmi v1.2.4/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQmPyzfmi0= +go.uber.org/atomic v1.10.0 h1:9qC72Qh0+3MqyJbAn8YU5xVq1frD8bn3JtD2oXtafVQ= +go.uber.org/atomic v1.10.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0= +go.uber.org/multierr v1.9.0 h1:7fIwc/ZtS0q++VgcfqFDxSBZVv/Xo49/SYnDFupUwlI= +go.uber.org/multierr v1.9.0/go.mod h1:X2jQV1h+kxSjClGpnseKVIxpmcjrj7MNnI0bnlfKTVQ= golang.org/x/arch v0.0.0-20210923205945-b76863e36670/go.mod h1:5om86z9Hs0C8fWVUuoMHwpExlXzs5Tkyp9hOrfG7pp8= golang.org/x/arch v0.7.0 h1:pskyeJh/3AmoQ8CPE95vxHLqp1G1GfGNXTmcl9NEKTc= golang.org/x/arch v0.7.0/go.mod h1:FEVrYAQjsQXMVJ1nsMoVVXPZg6p2JE2mx8psSWTDQys= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.20.0 h1:jmAMJJZXr5KiCw05dfYK9QnqaqKLYXijU23lsEdcQqg= -golang.org/x/crypto v0.20.0/go.mod h1:Xwo95rrVNIoSMx9wa1JroENMToLWn3RNVrTBpLHgZPQ= -golang.org/x/exp v0.0.0-20231110203233-9a3e6036ecaa h1:FRnLl4eNAQl8hwxVVC17teOw8kdjVDVAiFMtgUdTSRQ= -golang.org/x/exp v0.0.0-20231110203233-9a3e6036ecaa/go.mod h1:zk2irFbV9DP96SEBUUAy67IdHUaZuSnrz1n472HUCLE= +golang.org/x/crypto v0.22.0 h1:g1v0xeRhjcugydODzvb3mEM9SQ0HGp9s/nh3COQ/C30= +golang.org/x/crypto v0.22.0/go.mod h1:vr6Su+7cTlO45qkww3VDJlzDn0ctJvRgYbC2NvXHt+M= +golang.org/x/exp v0.0.0-20240409090435-93d18d7e34b8 h1:ESSUROHIBHg7USnszlcdmjBEwdMj9VUvU+OPk4yl2mc= +golang.org/x/exp v0.0.0-20240409090435-93d18d7e34b8/go.mod h1:/lliqkxwWAhPjf5oSOIJup2XcqJaw8RGS6k3TGEc7GI= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= -golang.org/x/mod v0.15.0 h1:SernR4v+D55NyBH2QiEQrlBAnj1ECL6AGrA5+dPaMY8= -golang.org/x/mod v0.15.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= +golang.org/x/mod v0.17.0 h1:zY54UmvipHiNd+pm+m0x9KhZ9hl1/7QNMyxXbc6ICqA= +golang.org/x/mod v0.17.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= +golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200813134508-3edf25e44fcc/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= -golang.org/x/net v0.21.0 h1:AQyQV4dYCvJ7vGmJyKki9+PBdyvhkSd8EIx/qb0AYv4= -golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44= +golang.org/x/net v0.24.0 h1:1PcaxkF854Fu3+lvBIx5SYn9wRlBzzcnHZSiaFFAb0w= +golang.org/x/net v0.24.0/go.mod h1:2Q7sJY5mzlzWjKtYUEXSlBWCdyaioyXzRB2RtU8KVE8= +golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.6.0 h1:5BMeUDZ7vkXGfEr1x9B4bRcTH4lpkTkpdh0T/J+qjbQ= -golang.org/x/sync v0.6.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/sync v0.7.0 h1:YsImfSBoP9QPYL0xyKJPq0gcaJdG3rInoqxTWbfQu9M= +golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200519105757-fe76b779f299/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200814200057-3d37ad5750ed/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.17.0 h1:25cE3gD+tdBA7lp7QfhuV+rJiE9YXTcS3VG1SqssI/Y= -golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.19.0 h1:q5f1RH2jigJ1MoAWp2KTp3gm5zAGFUTarQZ5U386+4o= +golang.org/x/sys v0.19.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= -golang.org/x/time v0.3.0 h1:rg5rLMjNzMS1RkNLzCG38eapWhnYLFYXDXj2gOlr8j4= -golang.org/x/time v0.3.0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.5.0 h1:o7cqy6amK/52YcAKIPlM3a+Fpj35zvRj2TP+e1xFSfk= +golang.org/x/time v0.5.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= -golang.org/x/tools v0.18.0 h1:k8NLag8AGHnn+PHbl7g43CtqZAwG60vZkLqgyZgIHgQ= -golang.org/x/tools v0.18.0/go.mod h1:GL7B4CwcLLeo59yx/9UWWuNOW1n3VZ4f5axWfML7Lcg= +golang.org/x/tools v0.20.0 h1:hz/CVckiOxybQvFw6h7b/q80NTr9IUQb4s1IIzW7KNY= +golang.org/x/tools v0.20.0/go.mod h1:WvitBU7JJf6A4jOdg4S1tviW9bhUxkgeCui/0JHctQg= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028 h1:+cNy6SZtPcJQH3LJVLOSmiC7MMxXNOb3PU/VUEz+EhU= golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028/go.mod h1:NDW/Ps6MPRej6fsCIbMTohpP40sJ/P/vI1MoTEGwX90= -google.golang.org/protobuf v1.32.0 h1:pPC6BG5ex8PDFnkbrGU3EixyhKcQ2aDuBS36lqK/C7I= -google.golang.org/protobuf v1.32.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= +google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= +google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= +google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= +google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= +google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= +google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI= +google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= +gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= +gopkg.in/ini.v1 v1.67.0 h1:Dgnx+6+nfE+IfzjUEISNeydPJh9AXNNsWbGP9KzCsOA= +gopkg.in/ini.v1 v1.67.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= gopkg.in/natefinch/lumberjack.v2 v2.0.0 h1:1Lc07Kr7qY4U2YPouBjpCLxpiyxIVoxqXgkXLknAOE8= gopkg.in/natefinch/lumberjack.v2 v2.0.0/go.mod h1:l0ndWWf7gzL7RNwBG7wST/UCcT4T24xpD6X8LsfU/+k= +gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= +gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= +gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -k8s.io/apimachinery v0.29.2 h1:EWGpfJ856oj11C52NRCHuU7rFDwxev48z+6DSlGNsV8= -k8s.io/apimachinery v0.29.2/go.mod h1:6HVkd1FwxIagpYrHSwJlQqZI3G9LfYWRPAkUvLnXTKU= +k8s.io/apimachinery v0.29.3 h1:2tbx+5L7RNvqJjn7RIuIKu9XTsIZ9Z5wX2G22XAa5EU= +k8s.io/apimachinery v0.29.3/go.mod h1:hx/S4V2PNW4OMg3WizRrHutyB5la0iCUbZym+W0EQIU= nullprogram.com/x/optparse v1.0.0/go.mod h1:KdyPE+Igbe0jQUrVfMqDMeJQIJZEuyV7pjYmp6pbG50= rsc.io/pdf v0.1.1/go.mod h1:n8OzWcQ6Sp37PL01nO98y4iUCRdTGarVfzxY20ICaU4= rsc.io/tmplfunc v0.0.3 h1:53XFQh69AfOa8Tw0Jm7t+GV7KZhOi6jzsCzTtKbMvzU= rsc.io/tmplfunc v0.0.3/go.mod h1:AG3sTPzElb1Io3Yg4voV9AGZJuleGAwaVRxL9M49PhA= sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd h1:EDPBXCAspyGV4jQlpZSudPeMmr1bNJefnuqLsRAsHZo= sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd/go.mod h1:B8JuhiUyNFVKdsE8h686QcCxMaH6HrOAZj4vswFpcB0= -sigs.k8s.io/yaml v1.3.0 h1:a2VclLzOGrwOHDiV8EfBGhvjHvP46CtW5j6POvhYGGo= -sigs.k8s.io/yaml v1.3.0/go.mod h1:GeOyir5tyXNByN85N/dRIT9es5UQNerPYEKK56eTBm8= +sigs.k8s.io/yaml v1.4.0 h1:Mk1wCc2gy/F0THH0TAp1QYyJNzRm2KCLy3o5ASXVI5E= +sigs.k8s.io/yaml v1.4.0/go.mod h1:Ejl7/uTz7PSA4eKMyQCUTnhZYNmLIl+5c2lQPGR2BPY= diff --git a/rpc_server/api/health.go b/rpc_server/api/health.go index f7be562c..4dc6680f 100644 --- a/rpc_server/api/health.go +++ b/rpc_server/api/health.go @@ -2,8 +2,9 @@ package api import ( "AAStarCommunity/EthPaymaster_BackService/common/model" - "AAStarCommunity/EthPaymaster_BackService/conf" + "AAStarCommunity/EthPaymaster_BackService/envirment" "github.com/gin-gonic/gin" + "github.com/sirupsen/logrus" "time" ) @@ -16,9 +17,10 @@ import ( // @Success 200 func Healthz(c *gin.Context) { response := model.GetResponse() + logrus.Debug("In the Healthz") response.WithDataSuccess(c, gin.H{ "hello": "Eth Paymaster", - "environment": conf.Environment.Name, + "environment": envirment.Environment.Name, "time": time.Now(), "version": "v1.0.0", }) diff --git a/rpc_server/api/v1/get_support_entrypoint.go b/rpc_server/api/v1/get_support_entrypoint.go deleted file mode 100644 index d3e0a0b8..00000000 --- a/rpc_server/api/v1/get_support_entrypoint.go +++ /dev/null @@ -1,42 +0,0 @@ -package v1 - -import ( - "AAStarCommunity/EthPaymaster_BackService/common/model" - "AAStarCommunity/EthPaymaster_BackService/service/operator" - "fmt" - "github.com/gin-gonic/gin" - "net/http" -) - -// GetSupportEntrypoint -// @Tags Sponsor -// @Description get the support entrypoint -// @Accept json -// @Product json -// @Router /api/v1/get-support-entrypoint [GET] -// @Success 200 -// @Security JWT -func GetSupportEntrypoint(c *gin.Context) { - request := model.GetSupportEntrypointRequest{} - response := model.GetResponse() - //1. API validate - if err := c.ShouldBindJSON(&request); err != nil { - errStr := fmt.Sprintf("Request Error [%v]", err) - response.SetHttpCode(http.StatusBadRequest).FailCode(c, http.StatusBadRequest, errStr) - return - } - if err := request.Validate(); err != nil { - errStr := fmt.Sprintf("Request Error [%v]", err) - response.SetHttpCode(http.StatusBadRequest).FailCode(c, http.StatusBadRequest, errStr) - return - } - - //2. recall service - result, err := operator.GetSupportEntrypointExecute(&request) - if err != nil { - errStr := fmt.Sprintf("%v", err) - response.SetHttpCode(http.StatusInternalServerError).FailCode(c, http.StatusInternalServerError, errStr) - return - } - response.WithData(result).Success(c) -} diff --git a/rpc_server/api/v1/get_support_strategy.go b/rpc_server/api/v1/get_support_strategy.go deleted file mode 100644 index 76ce005a..00000000 --- a/rpc_server/api/v1/get_support_strategy.go +++ /dev/null @@ -1,43 +0,0 @@ -package v1 - -import ( - "AAStarCommunity/EthPaymaster_BackService/common/model" - "AAStarCommunity/EthPaymaster_BackService/service/operator" - "fmt" - "github.com/gin-gonic/gin" - "net/http" -) - -// GetSupportStrategy -// @Tags Sponsor -// @Description get the support strategy -// @Accept json -// @Produce json -// @Success 200 -// @Router /api/v1/get-support-strategy [GET] -// @Security JWT -func GetSupportStrategy(c *gin.Context) { - request := model.GetSupportStrategyRequest{} - response := model.GetResponse() - - //1. API validate - if err := c.ShouldBindJSON(&request); err != nil { - errStr := fmt.Sprintf("Request Error [%v]", err) - response.SetHttpCode(http.StatusBadRequest).FailCode(c, http.StatusBadRequest, errStr) - return - } - if err := request.Validate(); err != nil { - errStr := fmt.Sprintf("Request Error [%v]", err) - response.SetHttpCode(http.StatusBadRequest).FailCode(c, http.StatusBadRequest, errStr) - return - } - - if result, err := operator.GetSupportStrategyExecute(&request); err != nil { - errStr := fmt.Sprintf("%v", err) - response.SetHttpCode(http.StatusInternalServerError).FailCode(c, http.StatusInternalServerError, errStr) - return - } else { - response.WithData(result).Success(c) - return - } -} diff --git a/rpc_server/api/v1/paymaster.go b/rpc_server/api/v1/paymaster.go new file mode 100644 index 00000000..18ad6cc7 --- /dev/null +++ b/rpc_server/api/v1/paymaster.go @@ -0,0 +1,191 @@ +package v1 + +import ( + "AAStarCommunity/EthPaymaster_BackService/common/global_const" + "AAStarCommunity/EthPaymaster_BackService/common/model" + "AAStarCommunity/EthPaymaster_BackService/common/utils" + "AAStarCommunity/EthPaymaster_BackService/config" + "AAStarCommunity/EthPaymaster_BackService/service/operator" + "fmt" + "github.com/gin-gonic/gin" + "github.com/sirupsen/logrus" + "golang.org/x/xerrors" + "net/http" +) + +var PaymasterAPIMethods = map[string]MethodFunctionFunc{} + +type MethodFunctionFunc = func(ctx *gin.Context, jsonRpcRequest model.JsonRpcRequest) (result interface{}, err error) + +func init() { + PaymasterAPIMethods["pm_sponsorUserOperation"] = TryPayUserOperationMethod() + PaymasterAPIMethods["pm_supportEntrypoint"] = GetSupportEntryPointFunc() + PaymasterAPIMethods["pm_estimateUserOperationGas"] = EstimateUserOpGasFunc() + PaymasterAPIMethods["pm_paymasterAccount"] = GetSupportPaymaster() +} + +// Paymaster +// @Tags Paymaster +// @Description Paymaster JSON-RPC API +// @Accept json +// @Product json +// @Param rpcRequest body model.JsonRpcRequest true "JsonRpcRequest Model" +// @Router /api/v1/paymaster [post] +// @Success 200 +// @Security JWT +func Paymaster(ctx *gin.Context) { + + jsonRpcRequest := model.JsonRpcRequest{} + response := model.GetResponse() + + defer func() { + if r := recover(); r != nil { + errInfo := fmt.Sprintf("[panic]: err : [%v] , stack :[%v]", r, utils.GetCurrentGoroutineStack()) + logrus.Error(errInfo) + response.SetHttpCode(http.StatusInternalServerError).FailCode(ctx, http.StatusInternalServerError, fmt.Sprintf("%v", r)) + } + + }() + + if err := ctx.ShouldBindJSON(&jsonRpcRequest); err != nil { + errStr := fmt.Sprintf("Request Error [%v]", err) + response.SetHttpCode(http.StatusBadRequest).FailCode(ctx, http.StatusBadRequest, errStr) + return + } + method := jsonRpcRequest.Method + if method == "" { + errStr := fmt.Sprintf("Request Error [method is empty]") + response.SetHttpCode(http.StatusBadRequest).FailCode(ctx, http.StatusBadRequest, errStr) + return + } + + if methodFunc, ok := PaymasterAPIMethods[method]; ok { + logrus.Debug(fmt.Sprintf("method: %s", method)) + result, err := methodFunc(ctx, jsonRpcRequest) + logrus.Debugf("result: %v", result) + if err != nil { + errStr := fmt.Sprintf("%v", err) + response.SetHttpCode(http.StatusInternalServerError).FailCode(ctx, http.StatusInternalServerError, errStr) + return + } + response.WithData(result).Success(ctx) + return + } else { + errStr := fmt.Sprintf("Request Error [method not found]") + response.SetHttpCode(http.StatusBadRequest).FailCode(ctx, http.StatusBadRequest, errStr) + return + } +} + +func GetSupportPaymaster() MethodFunctionFunc { + return func(ctx *gin.Context, jsonRpcRequest model.JsonRpcRequest) (result interface{}, err error) { + if jsonRpcRequest.Params[0] == nil { + return nil, xerrors.Errorf("Request Error [network is empty]") + } + networkStr, ok := jsonRpcRequest.Params[0].(string) + if !ok { + return nil, xerrors.Errorf("Request Error [network is not string]") + } + paymasterSet, err := config.GetSupportPaymaster(global_const.Network(networkStr)) + if err != nil { + return nil, err + } + return paymasterSet.ToSlice(), nil + } +} + +func GetSupportEntryPointFunc() MethodFunctionFunc { + return func(ctx *gin.Context, jsonRpcRequest model.JsonRpcRequest) (result interface{}, err error) { + if jsonRpcRequest.Params[0] == nil { + return nil, xerrors.Errorf("Request Error [network is empty]") + } + networkStr, ok := jsonRpcRequest.Params[0].(string) + if !ok { + return nil, xerrors.Errorf("Request Error [network is not string]") + } + entryPoints, err := config.GetSupportEntryPoints(global_const.Network(networkStr)) + if err != nil { + return nil, err + } + return entryPoints.ToSlice(), nil + } +} +func EstimateUserOpGasFunc() MethodFunctionFunc { + return func(ctx *gin.Context, jsonRpcRequest model.JsonRpcRequest) (result interface{}, err error) { + request, err := parseTryPayUserOperationParams(jsonRpcRequest.Params) + if err != nil { + return nil, xerrors.Errorf("parseTryPayUserOperationParams ERROR [%v]", err) + } + if err := validateUserOpRequest(request); err != nil { + return nil, xerrors.Errorf("Request Error [%v]", err) + } + if result, err := operator.GetEstimateUserOpGas(request); err != nil { + return nil, xerrors.Errorf("GetEstimateUserOpGas ERROR [%v]", err) + } else { + return result, nil + } + } +} + +func TryPayUserOperationMethod() MethodFunctionFunc { + return func(ctx *gin.Context, jsonRpcRequest model.JsonRpcRequest) (result interface{}, err error) { + request, err := parseTryPayUserOperationParams(jsonRpcRequest.Params) + logrus.Debug("parseTryPayUserOperationParams result: ", request) + + if err != nil { + return nil, xerrors.Errorf("parseTryPayUserOperationParams ERROR [%v]", err) + } + if err := validateUserOpRequest(request); err != nil { + return nil, xerrors.Errorf("Request Error [%v]", err) + } + logrus.Debugf("After Validate ") + + if result, err := operator.TryPayUserOpExecute(request); err != nil { + return nil, xerrors.Errorf("TryPayUserOpExecute ERROR [%v]", err) + } else { + return result, nil + } + } +} +func parseTryPayUserOperationParams(params []interface{}) (*model.UserOpRequest, error) { + if len(params) < 2 { + return nil, xerrors.Errorf("params length is less than 2") + } + result := model.UserOpRequest{} + userInputParam := params[0] + if userInputParam == nil { + return nil, xerrors.Errorf("user input is nil") + } + userOpInput := userInputParam.(map[string]any) + result.UserOp = userOpInput + + extraParam := params[1] + if extraParam == nil { + return nil, xerrors.Errorf("extra is nil") + } + extra := extraParam.(map[string]any) + if extra["strategy_code"] != nil { + result.ForceStrategyId = extra["strategy_code"].(string) + } + if extra["network"] != nil { + result.ForceNetwork = extra["network"].(global_const.Network) + } + if extra["token"] != nil { + result.Erc20Token = extra["token"].(global_const.TokenType) + } + if extra["version"] != nil { + result.EntryPointVersion = extra["version"].(global_const.EntrypointVersion) + } + return &result, nil +} + +func validateUserOpRequest(request *model.UserOpRequest) error { + if request.ForceStrategyId != "" { + return nil + } + if request.ForceNetwork == "" { + return xerrors.Errorf("ForceNetwork is empty") + } + + return nil +} diff --git a/rpc_server/api/v1/try_pay_user_operation.go b/rpc_server/api/v1/try_pay_user_operation.go deleted file mode 100644 index b9ce5e1a..00000000 --- a/rpc_server/api/v1/try_pay_user_operation.go +++ /dev/null @@ -1,46 +0,0 @@ -package v1 - -import ( - "AAStarCommunity/EthPaymaster_BackService/common/model" - "AAStarCommunity/EthPaymaster_BackService/service/operator" - "fmt" - "github.com/gin-gonic/gin" - "net/http" -) - -// TryPayUserOperation -// @Tags Sponsor -// @Description sponsor the userOp -// @Accept json -// @Product json -// @Router /api/v1/try-pay-user-operation [POST] -// @Param tryPay body model.TryPayUserOpRequest true "UserOp Request" -// @Success 200 -// @Security JWT -func TryPayUserOperation(c *gin.Context) { - request := model.TryPayUserOpRequest{} - response := model.GetResponse() - - //1. API validate - if err := c.ShouldBindJSON(&request); err != nil { - errStr := fmt.Sprintf("Request Error [%v]", err) - response.SetHttpCode(http.StatusBadRequest).FailCode(c, http.StatusBadRequest, errStr) - return - } - - if err := request.Validate(); err != nil { - errStr := fmt.Sprintf("Request Error [%v]", err) - response.SetHttpCode(http.StatusBadRequest).FailCode(c, http.StatusBadRequest, errStr) - return - } - - //2. recall service - if result, err := operator.TryPayUserOpExecute(&request); err != nil { - errStr := fmt.Sprintf("TryPayUserOpExecute ERROR [%v]", err) - response.SetHttpCode(http.StatusInternalServerError).FailCode(c, http.StatusInternalServerError, errStr) - return - } else { - response.WithData(result).Success(c) - return - } -} diff --git a/rpc_server/middlewares/auth.go b/rpc_server/middlewares/auth.go index 9fd6f1c2..472bca3c 100644 --- a/rpc_server/middlewares/auth.go +++ b/rpc_server/middlewares/auth.go @@ -1,7 +1,7 @@ package middlewares import ( - "AAStarCommunity/EthPaymaster_BackService/conf" + "AAStarCommunity/EthPaymaster_BackService/envirment" jwt "github.com/appleboy/gin-jwt/v2" "github.com/gin-gonic/gin" "time" @@ -19,8 +19,8 @@ func GinJwtMiddleware() *jwt.GinJWTMiddleware { func AuthHandler() gin.HandlerFunc { m, _ := jwt.New(&jwt.GinJWTMiddleware{ - Realm: conf.GetJwtKey().Realm, - Key: []byte(conf.GetJwtKey().Security), + Realm: envirment.GetJwtKey().Realm, + Key: []byte(envirment.GetJwtKey().Security), Timeout: time.Hour * 24, MaxRefresh: time.Hour / 2, IdentityKey: "jti", diff --git a/rpc_server/middlewares/rate_limit.go b/rpc_server/middlewares/rate_limit.go index 0d52d82d..5c1ea090 100644 --- a/rpc_server/middlewares/rate_limit.go +++ b/rpc_server/middlewares/rate_limit.go @@ -30,6 +30,9 @@ func RateLimiterByApiKeyHandler() gin.HandlerFunc { } } } +func clearLimiter(apiKey *string) { + delete(limiter, *apiKey) +} func limiting(apiKey *string) bool { diff --git a/rpc_server/middlewares/rate_limit_test.go b/rpc_server/middlewares/rate_limit_test.go index 3965094a..e7d86dbc 100644 --- a/rpc_server/middlewares/rate_limit_test.go +++ b/rpc_server/middlewares/rate_limit_test.go @@ -7,7 +7,30 @@ import ( "time" ) -func TestRateLimitShouldPreventRequestWhenOverDefaultLimit(t *testing.T) { +func TestLimit(t *testing.T) { + tests := []struct { + name string + test func(t *testing.T) + }{ + { + "TestRateLimitShouldPreventRequestWhenOverDefaultLimit", + func(t *testing.T) { + testRateLimitShouldPreventRequestWhenOverDefaultLimit(t) + }, + }, + { + "TestRateLimiterShouldAllowDefaultLimitPerSecond", + func(t *testing.T) { + testRateLimiterShouldAllowDefaultLimitPerSecond(t) + }, + }, + } + for _, tt := range tests { + t.Run(tt.name, tt.test) + } +} + +func testRateLimitShouldPreventRequestWhenOverDefaultLimit(t *testing.T) { mockApiKey := "TestingAipKey" @@ -20,11 +43,12 @@ func TestRateLimitShouldPreventRequestWhenOverDefaultLimit(t *testing.T) { assert.Equal(t, false, b) } } + clearLimiter(&mockApiKey) } -func TestRateLimiterShouldAllowDefaultLimitPerSecond(t *testing.T) { +func testRateLimiterShouldAllowDefaultLimitPerSecond(t *testing.T) { if os.Getenv("GITHUB_ACTIONS") != "" { - t.Skip() + t.Logf("Skip test in GitHub Actions") return } mockApiKey := "TestingAipKey" @@ -40,4 +64,5 @@ func TestRateLimiterShouldAllowDefaultLimitPerSecond(t *testing.T) { } time.Sleep(time.Second * 2) } + clearLimiter(&mockApiKey) } diff --git a/rpc_server/middlewares/recovery.go b/rpc_server/middlewares/recovery.go index c6807e03..b9a9d472 100644 --- a/rpc_server/middlewares/recovery.go +++ b/rpc_server/middlewares/recovery.go @@ -2,7 +2,7 @@ package middlewares import ( "AAStarCommunity/EthPaymaster_BackService/common/model" - "AAStarCommunity/EthPaymaster_BackService/conf" + "AAStarCommunity/EthPaymaster_BackService/envirment" "errors" "fmt" "github.com/gin-gonic/gin" @@ -15,7 +15,7 @@ func GenericRecoveryHandler() gin.HandlerFunc { DefaultErrorWriter := &PanicExceptionRecord{} return gin.RecoveryWithWriter(DefaultErrorWriter, func(c *gin.Context, err interface{}) { errStr := "" - if conf.Environment.Debugger { + if envirment.Environment.Debugger { errStr = fmt.Sprintf("%v", err) } model.GetResponse().SetHttpCode(http.StatusInternalServerError).FailCode(c, http.StatusInternalServerError, errStr) diff --git a/rpc_server/routers/boot.go b/rpc_server/routers/boot.go index 70263d43..0d2fd18e 100644 --- a/rpc_server/routers/boot.go +++ b/rpc_server/routers/boot.go @@ -2,32 +2,50 @@ package routers import ( "AAStarCommunity/EthPaymaster_BackService/common/model" - "AAStarCommunity/EthPaymaster_BackService/conf" + "AAStarCommunity/EthPaymaster_BackService/common/utils" "AAStarCommunity/EthPaymaster_BackService/docs" + "AAStarCommunity/EthPaymaster_BackService/envirment" "AAStarCommunity/EthPaymaster_BackService/rpc_server/middlewares" "github.com/gin-gonic/gin" + "github.com/gin-gonic/gin/binding" + "github.com/go-playground/validator/v10" swaggerFiles "github.com/swaggo/files" ginSwagger "github.com/swaggo/gin-swagger" "io" "net/http" ) +var hexParam validator.Func = func(fl validator.FieldLevel) bool { + param, ok := fl.Field().Interface().(string) + if ok { + return utils.ValidateHex(param) + } + return true +} + // SetRouters set routers func SetRouters() (routers *gin.Engine) { routers = gin.New() - + if v, ok := binding.Validator.Engine().(*validator.Validate); ok { + err := v.RegisterValidation("hexParam", hexParam) + if err != nil { + return nil + } + } buildMod(routers) buildRoute(routers) routers.NoRoute(func(ctx *gin.Context) { model.GetResponse().SetHttpCode(http.StatusNotFound).FailCode(ctx, http.StatusNotFound) }) - return + return routers } + +// buildRouters build routers Init API AND Middleware func buildRoute(routers *gin.Engine) { // build http routers and middleware routers.Use(middlewares.GenericRecoveryHandler()) - if conf.Environment.IsDevelopment() { + if envirment.Environment.IsDevelopment() { routers.Use(middlewares.LogHandler()) } routers.Use(middlewares.CorsHandler()) @@ -39,17 +57,18 @@ func buildRoute(routers *gin.Engine) { buildRouters(routers, PrivateRouterMaps) } +// buildMod set Mode by envirment func buildMod(routers *gin.Engine) { // prod mode - if conf.Environment.IsProduction() { + if envirment.Environment.IsProduction() { gin.SetMode(gin.ReleaseMode) gin.DefaultWriter = io.Discard // disable gin log return } // dev mod - if conf.Environment.IsDevelopment() { + if envirment.Environment.IsDevelopment() { gin.SetMode(gin.DebugMode) buildSwagger(routers) return diff --git a/rpc_server/routers/router_test.go b/rpc_server/routers/router_test.go deleted file mode 100644 index b91e913c..00000000 --- a/rpc_server/routers/router_test.go +++ /dev/null @@ -1,8 +0,0 @@ -package routers - -import "testing" - -func TestConst(t *testing.T) { - - t.Logf("%s", string(TryPayUserOperation)) -} diff --git a/rpc_server/routers/routers_map.go b/rpc_server/routers/routers_map.go index ec90f12b..341b397d 100644 --- a/rpc_server/routers/routers_map.go +++ b/rpc_server/routers/routers_map.go @@ -10,10 +10,7 @@ var PublicRouterMaps []RouterMap func init() { PrivateRouterMaps = make([]RouterMap, 0) - - PrivateRouterMaps = append(PrivateRouterMaps, RouterMap{string(TryPayUserOperation), []RestfulMethod{POST}, v1.TryPayUserOperation}) - PrivateRouterMaps = append(PrivateRouterMaps, RouterMap{string(GetSupportStrategy), []RestfulMethod{GET}, v1.GetSupportStrategy}) - PrivateRouterMaps = append(PrivateRouterMaps, RouterMap{string(GetSupportEntrypoint), []RestfulMethod{GET}, v1.GetSupportEntrypoint}) + PrivateRouterMaps = append(PrivateRouterMaps, RouterMap{string(Paymaster), []RestfulMethod{POST}, v1.Paymaster}) PublicRouterMaps = append(PublicRouterMaps, RouterMap{string(Auth), []RestfulMethod{POST}, api.Auth}) PublicRouterMaps = append(PublicRouterMaps, RouterMap{string(Healthz), []RestfulMethod{GET, HEAD, OPTIONS}, api.Healthz}) } @@ -21,9 +18,7 @@ func init() { type Path string const ( - TryPayUserOperation Path = "api/v1/try-pay-user-operation" - GetSupportStrategy Path = "api/v1/get-support-strategy" - GetSupportEntrypoint Path = "api/v1/get-support-entrypoint" - Auth Path = "api/auth" - Healthz Path = "api/healthz" + Auth Path = "api/auth" + Healthz Path = "api/healthz" + Paymaster Path = "api/v1/paymaster" ) diff --git a/service/chain_service/chain_config.go b/service/chain_service/chain_config.go deleted file mode 100644 index 3ce2b73d..00000000 --- a/service/chain_service/chain_config.go +++ /dev/null @@ -1,39 +0,0 @@ -package chain_service - -import ( - "AAStarCommunity/EthPaymaster_BackService/common/types" - "github.com/ethereum/go-ethereum/ethclient" -) - -var NetworkInfoMap map[types.NetWork]*types.NetworkInfo -var NetWorkClientMap map[types.NetWork]*ethclient.Client - -func init() { - ConfigInit() - ClientInit() -} -func ConfigInit() { - //TODO api key secret store - NetworkInfoMap = map[types.NetWork]*types.NetworkInfo{ - types.Ethereum: { - Name: "ethereum", - RpcUrl: "https://eth-mainnet.g.alchemy.com/v2/bIZQS43-rJMgv2_SiHqfVvXa-Z1UGoGt", - }, - types.Sepolia: { - Name: "sepolia", - RpcUrl: "https://eth-sepolia.g.alchemy.com/v2/wKeLycGxgYRykgf0aGfcpEkUtqyLQg4v", - }, - } -} - -func ClientInit() { - NetWorkClientMap = make(map[types.NetWork]*ethclient.Client) - for chain, networkInfo := range NetworkInfoMap { - client, err := ethclient.Dial(networkInfo.RpcUrl) - if err != nil { - panic(err) - } - NetWorkClientMap[chain] = client - continue - } -} diff --git a/service/chain_service/chain_service.go b/service/chain_service/chain_service.go index 0a43ca0e..7efaea21 100644 --- a/service/chain_service/chain_service.go +++ b/service/chain_service/chain_service.go @@ -1,52 +1,60 @@ package chain_service import ( - "AAStarCommunity/EthPaymaster_BackService/common/types" - "context" + "AAStarCommunity/EthPaymaster_BackService/common/global_const" + "AAStarCommunity/EthPaymaster_BackService/common/model" + "AAStarCommunity/EthPaymaster_BackService/common/network" + "AAStarCommunity/EthPaymaster_BackService/common/user_op" + "AAStarCommunity/EthPaymaster_BackService/common/utils" "github.com/ethereum/go-ethereum/common" + "github.com/sirupsen/logrus" "golang.org/x/xerrors" + "math" "math/big" ) -var GweiFactor = new(big.Float).SetInt(big.NewInt(1e9)) -var EthWeiFactor = new(big.Float).SetInt(new(big.Int).Exp(big.NewInt(10), big.NewInt(18), nil)) - -func CheckContractAddressAccess(contract string, chain types.NetWork) (bool, error) { - if chain == "" { - return false, xerrors.Errorf("chain can not be empty") - } - contractAddress := common.HexToAddress(contract) +func CheckContractAddressAccess(contract *common.Address, chain global_const.Network) (bool, error) { + //todo DB Cache needCache + executor := network.GetEthereumExecutor(chain) + return executor.CheckContractAddressAccess(contract) +} - client, exist := NetWorkClientMap[chain] - if !exist { - return false, xerrors.Errorf("chain Client [%s] not exist", chain) - } - code, err := client.CodeAt(context.Background(), contractAddress, nil) +func GetAddressTokenBalance(networkParam global_const.Network, address common.Address, tokenTypeParam global_const.TokenType) (float64, error) { + executor := network.GetEthereumExecutor(networkParam) + balanceResult, err := executor.GetUserTokenBalance(address, tokenTypeParam) if err != nil { - return false, err - } - if len(code) == 0 { - return false, xerrors.Errorf("contract [%s] address not exist in [%s] network", contract, chain) + return 0, err } - return true, nil -} -// GetGasPrice return gas price in wei, gwei, ether -func GetGasPrice(chain types.NetWork) (*big.Int, *big.Float, *string, error) { - client, exist := NetWorkClientMap[chain] - if !exist { - return nil, nil, nil, xerrors.Errorf("chain Client [%s] not exist", chain) - } - priceWei, err := client.SuggestGasPrice(context.Background()) + balanceResultFloat := float64(balanceResult.Int64()) * math.Pow(10, -6) + return balanceResultFloat, nil + +} +func GetPaymasterEntryPointBalance(strategy *model.Strategy) (*big.Float, error) { + networkParam := strategy.GetNewWork() + paymasterAddress := strategy.GetPaymasterAddress() + logrus.Debug("paymasterAddress", paymasterAddress) + executor := network.GetEthereumExecutor(networkParam) + balance, err := executor.GetPaymasterDeposit(paymasterAddress) if err != nil { - return nil, nil, nil, err + return nil, err } + logrus.Debug("balance", balance) + balanceResultFloat := utils.ConvertBalanceToEther(balance) - gasPriceInGwei := new(big.Float).SetInt(priceWei) - gasPriceInGwei.Quo(gasPriceInGwei, GweiFactor) + return balanceResultFloat, nil +} +func SimulateHandleOp(op *user_op.UserOpInput, strategy *model.Strategy) (*model.SimulateHandleOpResult, error) { + networkParam := strategy.GetNewWork() + executor := network.GetEthereumExecutor(networkParam) + entrypointVersion := strategy.GetStrategyEntrypointVersion() + if entrypointVersion == global_const.EntrypointV06 { + + return executor.SimulateV06HandleOp(op, strategy.GetEntryPointAddress()) - gasPriceInEther := new(big.Float).SetInt(priceWei) - gasPriceInEther.Quo(gasPriceInEther, EthWeiFactor) - gasPriceInEtherStr := gasPriceInEther.Text('f', 18) - return priceWei, gasPriceInGwei, &gasPriceInEtherStr, nil + } else if entrypointVersion == global_const.EntrypointV07 { + return executor.SimulateV07HandleOp(*op, strategy.GetEntryPointAddress()) + } + return nil, xerrors.Errorf("[never be here]entrypoint version %s not support", entrypointVersion) + //TODO Starknet } diff --git a/service/chain_service/chain_service_test.go b/service/chain_service/chain_service_test.go new file mode 100644 index 00000000..d37720bc --- /dev/null +++ b/service/chain_service/chain_service_test.go @@ -0,0 +1,134 @@ +package chain_service + +import ( + "AAStarCommunity/EthPaymaster_BackService/common/data_utils" + "AAStarCommunity/EthPaymaster_BackService/common/global_const" + "AAStarCommunity/EthPaymaster_BackService/common/model" + "AAStarCommunity/EthPaymaster_BackService/common/paymaster_data" + "AAStarCommunity/EthPaymaster_BackService/common/user_op" + "AAStarCommunity/EthPaymaster_BackService/common/utils" + "AAStarCommunity/EthPaymaster_BackService/config" + "encoding/json" + "fmt" + "github.com/ethereum/go-ethereum/common" + "github.com/sirupsen/logrus" + "github.com/stretchr/testify/assert" + "math/big" + "os" + "testing" +) + +func TestChainService(t *testing.T) { + if testing.Short() { + t.Skip("skipping test in short mode.") + } + config.InitConfig("../../config/basic_strategy_config.json", "../../config/basic_config.json", "../../config/secret_config.json") + logrus.SetLevel(logrus.DebugLevel) + op, err := user_op.NewUserOp(utils.GenerateMockUservOperation()) + if err != nil { + t.Error(err) + return + } + opFor1559NotSupport, err := user_op.NewUserOp(utils.GenerateMockUservOperation()) + if err != nil { + t.Error(err) + return + } + opFor1559NotSupport.MaxPriorityFeePerGas = opFor1559NotSupport.MaxFeePerGas + + tests := []struct { + name string + test func(t *testing.T) + }{ + + { + "TestSepoliaSimulateHandleOp", + func(t *testing.T) { + strategy := config.GetBasicStrategyConfig("Ethereum_Sepolia_v06_verifyPaymaster") + testSimulateHandleOp(t, op, strategy, model.MockGasPrice) + }, + }, + { + "TestScrollSepoliaSimulateHandleOp", + func(t *testing.T) { + strategy := config.GetBasicStrategyConfig(global_const.StrategyCodeScrollSepoliaV06Verify) + testSimulateHandleOp(t, opFor1559NotSupport, strategy, model.MockGasPriceNotSupport1559) + }, + }, + //{ TODO support v07 later + // "TestV07SepoliaSimulateHandleOp", + // func(t *testing.T) { + // strategy := config.GetBasicStrategyConfig(global_const.StrategyCodeEthereumSepoliaV07Verify) + // testSimulateHandleOp(t, op, strategy, model.MockGasPrice) + // }, + //}, + { + "testGetpaymasterEntryPointBalance", + func(t *testing.T) { + strategy := config.GetBasicStrategyConfig("Ethereum_Sepolia_v06_verifyPaymaster") + testGetPaymasterEntryPointBalance(t, *strategy) + }, + }, + { + "testCheckContractAddressAccess", + func(t *testing.T) { + testCheckContractAddressAccess(t) + }, + }, + { + + "testGetAddressTokenBalance", + func(t *testing.T) { + testGetAddressTokenBalance(t) + }, + }, + } + for _, tt := range tests { + if os.Getenv("GITHUB_ACTIONS") != "" && global_const.GitHubActionWhiteListSet.Contains(tt.name) { + t.Logf("Skip test [%s] in GitHub Actions", tt.name) + continue + } + t.Run(tt.name, tt.test) + } +} +func testGetAddressTokenBalance(t *testing.T) { + res, err := GetAddressTokenBalance(global_const.EthereumSepolia, common.HexToAddress("0xFD44DF0Fe211d5EFDBe1423483Fcb3FDeF84540f"), global_const.TokenTypeUSDC) + assert.NoError(t, err) + fmt.Println(res) +} +func testCheckContractAddressAccess(t *testing.T) { + addressStr := "0xF2147CA7f18e8014b76e1A98BaffC96ebB90a29f" + address := common.HexToAddress(addressStr) + res, err := CheckContractAddressAccess(&address, global_const.EthereumSepolia) + assert.NoError(t, err) + assert.True(t, res) +} +func testGetPaymasterEntryPointBalance(t *testing.T, strategy model.Strategy) { + res, err := GetPaymasterEntryPointBalance(&strategy) + if err != nil { + t.Error(err) + return + } + fmt.Println(res) + t.Logf("paymasterEntryPointBalance:%v", res) + +} + +func testSimulateHandleOp(t *testing.T, userOp *user_op.UserOpInput, strategy *model.Strategy, gasPrice *model.GasPrice) { + paymasterDataInput := paymaster_data.NewPaymasterDataInput(strategy) + + userOpInputForSimulate, err := data_utils.GetUserOpWithPaymasterAndDataForSimulate(*userOp, strategy, paymasterDataInput, gasPrice) + if err != nil { + t.Error(err) + return + } + res, err := SimulateHandleOp(userOpInputForSimulate, strategy) + if err != nil { + t.Error(err) + return + } + jsonRes, _ := json.Marshal(res) + t.Logf("simulateHandleOp:%v", string(jsonRes)) + callGasCount := new(big.Int).Div(res.GasPaid, res.PreOpGas) + t.Logf("callGasCount:%v", callGasCount) +} diff --git a/service/chain_service/chain_test.go b/service/chain_service/chain_test.go deleted file mode 100644 index 6831ad39..00000000 --- a/service/chain_service/chain_test.go +++ /dev/null @@ -1,30 +0,0 @@ -package chain_service - -import ( - "AAStarCommunity/EthPaymaster_BackService/common/types" - "context" - "fmt" - "github.com/stretchr/testify/assert" - "testing" -) - -func TestCheckContractAddressAccess(t *testing.T) { - res, err := CheckContractAddressAccess("0x0576a174D229E3cFA37253523E645A78A0C91B57", types.Sepolia) - assert.NoError(t, err) - assert.True(t, res) -} -func TestGetGasPrice(t *testing.T) { - priceWei, gasPriceInGwei, gasPriceInEtherStr, _ := GetGasPrice(types.Ethereum) - priceWeiInt := priceWei.Uint64() - fmt.Printf("priceWeiInt %d\n", priceWeiInt) - fmt.Printf("gasPriceInGwei %f\n", gasPriceInGwei) - fmt.Printf("gasPriceInEtherStr %s\n", *gasPriceInEtherStr) - -} - -func TestGethClient(t *testing.T) { - client, _ := NetWorkClientMap[types.Sepolia] - num, _ := client.BlockNumber(context.Background()) - assert.NotEqual(t, 0, num) - fmt.Println(num) -} diff --git a/service/dashboard_service/dashboard_service.go b/service/dashboard_service/dashboard_service.go index 0aa0b4c0..a49ea4f3 100644 --- a/service/dashboard_service/dashboard_service.go +++ b/service/dashboard_service/dashboard_service.go @@ -1,26 +1,52 @@ package dashboard_service import ( + "AAStarCommunity/EthPaymaster_BackService/common/global_const" "AAStarCommunity/EthPaymaster_BackService/common/model" - "AAStarCommunity/EthPaymaster_BackService/common/types" + "AAStarCommunity/EthPaymaster_BackService/config" "errors" ) -var mockStrategyMap = map[string]*model.Strategy{} +func GetStrategyByCode(strategyCode string) *model.Strategy { + strategy := config.GetBasicStrategyConfig(global_const.BasicStrategyCode(strategyCode)) + paymasterAddress := config.GetPaymasterAddress(strategy.GetNewWork(), strategy.GetStrategyEntrypointVersion()) + strategy.PaymasterInfo.PayMasterAddress = &paymasterAddress + entryPointAddress := config.GetEntrypointAddress(strategy.GetNewWork(), strategy.GetStrategyEntrypointVersion()) + strategy.EntryPointInfo.EntryPointAddress = &entryPointAddress + return strategy +} + +func GetSuitableStrategy(entryPointVersion global_const.EntrypointVersion, chain global_const.Network, payType global_const.PayType) (*model.Strategy, error) { + if entryPointVersion == "" { + entryPointVersion = global_const.EntrypointV06 + } + strategy, err := config.GetSuitableStrategy(entryPointVersion, chain, payType) + if err != nil { + return nil, err + } -func init() { - mockStrategyMap["1"] = &model.Strategy{ - Id: "1", - EntryPointAddress: "0x0576a174D229E3cFA37253523E645A78A0C91B57", - PayMasterAddress: "0x0000000000325602a77416A16136FDafd04b299f", - NetWork: types.Sepolia, - Token: types.USDT, + if strategy == nil { + return nil, errors.New("strategy not found") } + paymasterAddress := config.GetPaymasterAddress(strategy.GetNewWork(), strategy.GetStrategyEntrypointVersion()) + strategy.PaymasterInfo.PayMasterAddress = &paymasterAddress + entryPointAddress := config.GetEntrypointAddress(strategy.GetNewWork(), strategy.GetStrategyEntrypointVersion()) + strategy.EntryPointInfo.EntryPointAddress = &entryPointAddress + return strategy, nil } -func GetStrategyById(strategyId string) *model.Strategy { - return mockStrategyMap[strategyId] + +func IsEntryPointsSupport(address string, chain global_const.Network) bool { + supportEntryPointSet, _ := config.GetSupportEntryPoints(chain) + if supportEntryPointSet == nil { + return false + } + return supportEntryPointSet.Contains(address) } +func IsPayMasterSupport(address string, chain global_const.Network) bool { + supportPayMasterSet, _ := config.GetSupportPaymaster(chain) + if supportPayMasterSet == nil { + return false + } -func GetSuitableStrategy(entrypoint string, chain types.NetWork, token string) (*model.Strategy, error) { - return nil, errors.New("not implemented") + return supportPayMasterSet.Contains(address) } diff --git a/service/dashboard_service/dashboard_service_test.go b/service/dashboard_service/dashboard_service_test.go new file mode 100644 index 00000000..8bdb5ee5 --- /dev/null +++ b/service/dashboard_service/dashboard_service_test.go @@ -0,0 +1,12 @@ +package dashboard_service + +import ( + "AAStarCommunity/EthPaymaster_BackService/common/global_const" + "fmt" + "testing" +) + +func TestGetSuitableStrategy(t *testing.T) { + x := global_const.Network("Ethereum") + fmt.Println(x) +} diff --git a/service/gas_service/gas_computor.go b/service/gas_service/gas_computor.go deleted file mode 100644 index 37c0b65c..00000000 --- a/service/gas_service/gas_computor.go +++ /dev/null @@ -1,28 +0,0 @@ -package gas_service - -import ( - "AAStarCommunity/EthPaymaster_BackService/common/model" - "AAStarCommunity/EthPaymaster_BackService/common/types" - "AAStarCommunity/EthPaymaster_BackService/service/chain_service" -) - -func ComputeGas(userOp *model.UserOperationItem, strategy *model.Strategy) (*model.ComputeGasResponse, error) { - priceInWei, gasPriceInGwei, gasPriceInEtherStr, getGasErr := chain_service.GetGasPrice(types.Sepolia) - if getGasErr != nil { - return nil, getGasErr - } - return &model.ComputeGasResponse{ - GasPriceInWei: priceInWei.Uint64(), - GasPriceInGwei: gasPriceInGwei, - GasPriceInEther: *gasPriceInEtherStr, - TokenCost: "0.0001", - Network: strategy.NetWork, - Token: strategy.Token, - UsdCost: "0.4", - BlobEnable: strategy.Enable4844, - }, nil -} - -func ValidateGas(userOp *model.UserOperationItem, gasComputeResponse *model.ComputeGasResponse) error { - return nil -} diff --git a/service/gas_service/gas_computor_test.go b/service/gas_service/gas_computor_test.go deleted file mode 100644 index 27fcf074..00000000 --- a/service/gas_service/gas_computor_test.go +++ /dev/null @@ -1 +0,0 @@ -package gas_service diff --git a/service/gas_service/gas_wei_generator.go b/service/gas_service/gas_wei_generator.go deleted file mode 100644 index 27fcf074..00000000 --- a/service/gas_service/gas_wei_generator.go +++ /dev/null @@ -1 +0,0 @@ -package gas_service diff --git a/service/operator/get_estimate_user_op_gas.go b/service/operator/get_estimate_user_op_gas.go new file mode 100644 index 00000000..ac1aad4a --- /dev/null +++ b/service/operator/get_estimate_user_op_gas.go @@ -0,0 +1,27 @@ +package operator + +import ( + "AAStarCommunity/EthPaymaster_BackService/common/model" + "AAStarCommunity/EthPaymaster_BackService/common/paymaster_data" + "AAStarCommunity/EthPaymaster_BackService/common/user_op" + "AAStarCommunity/EthPaymaster_BackService/gas_executor" +) + +func GetEstimateUserOpGas(request *model.UserOpRequest) (*model.ComputeGasResponse, error) { + var strategy *model.Strategy + strategy, generateErr := StrategyGenerate(request) + if generateErr != nil { + return nil, generateErr + } + + userOp, err := user_op.NewUserOp(&request.UserOp) + if err != nil { + return nil, err + } + userOp.ComputeGasOnly = true + gasResponse, _, gasComputeError := gas_executor.ComputeGas(userOp, strategy, paymaster_data.NewPaymasterDataInput(strategy)) + if gasComputeError != nil { + return nil, gasComputeError + } + return gasResponse, nil +} diff --git a/service/operator/get_support_entry_point_execute.go b/service/operator/get_support_entry_point_execute.go index b3f5cd9c..70a9426f 100644 --- a/service/operator/get_support_entry_point_execute.go +++ b/service/operator/get_support_entry_point_execute.go @@ -1,7 +1,21 @@ package operator -import "AAStarCommunity/EthPaymaster_BackService/common/model" +import ( + "AAStarCommunity/EthPaymaster_BackService/common/global_const" + "AAStarCommunity/EthPaymaster_BackService/config" +) -func GetSupportEntrypointExecute(request *model.GetSupportEntrypointRequest) (*model.Result, error) { - return &model.Result{}, nil +func GetSupportEntrypointExecute(networkStr string) ([]string, error) { + + entryPoints, err := config.GetSupportEntryPoints(global_const.Network(networkStr)) + if err != nil { + return nil, err + } + + it := entryPoints.Iterator() + var entrypointArr []string + for entry := range it.C { + entrypointArr = append(entrypointArr, entry) + } + return entrypointArr, nil } diff --git a/service/operator/get_support_entry_point_execute_test.go b/service/operator/get_support_entry_point_execute_test.go deleted file mode 100644 index 18b97f2b..00000000 --- a/service/operator/get_support_entry_point_execute_test.go +++ /dev/null @@ -1 +0,0 @@ -package operator diff --git a/service/operator/get_support_strategy_execute.go b/service/operator/get_support_strategy_execute.go deleted file mode 100644 index b0cd18f4..00000000 --- a/service/operator/get_support_strategy_execute.go +++ /dev/null @@ -1,9 +0,0 @@ -package operator - -import ( - "AAStarCommunity/EthPaymaster_BackService/common/model" -) - -func GetSupportStrategyExecute(request *model.GetSupportStrategyRequest) (*model.Result, error) { - return &model.Result{}, nil -} diff --git a/service/operator/get_support_strategy_execute_test.go b/service/operator/get_support_strategy_execute_test.go deleted file mode 100644 index 18b97f2b..00000000 --- a/service/operator/get_support_strategy_execute_test.go +++ /dev/null @@ -1 +0,0 @@ -package operator diff --git a/service/operator/operator_test.go b/service/operator/operator_test.go new file mode 100644 index 00000000..195c45a8 --- /dev/null +++ b/service/operator/operator_test.go @@ -0,0 +1,215 @@ +package operator + +import ( + "AAStarCommunity/EthPaymaster_BackService/common/global_const" + "AAStarCommunity/EthPaymaster_BackService/common/model" + "AAStarCommunity/EthPaymaster_BackService/common/network" + "AAStarCommunity/EthPaymaster_BackService/common/user_op" + "AAStarCommunity/EthPaymaster_BackService/common/utils" + "AAStarCommunity/EthPaymaster_BackService/config" + "encoding/json" + "fmt" + "github.com/ethereum/go-ethereum/common" + "github.com/sirupsen/logrus" + "os" + "testing" +) + +func TestOperator(t *testing.T) { + if testing.Short() { + t.Skip("skipping test in short mode.") + } + config.InitConfig("../../config/basic_strategy_config.json", "../../config/basic_config.json", "../../config/secret_config.json") + logrus.SetLevel(logrus.DebugLevel) + immutableRequest := getMockTryPayUserOpRequest() + mockRequestNotSupport1559 := getMockTryPayUserOpRequest() + mockRequestNotSupport1559.UserOp["maxPriorityFeePerGas"] = mockRequestNotSupport1559.UserOp["maxFeePerGas"] + tests := []struct { + name string + test func(t *testing.T) + }{ + { + "testStrategyGenerate", + func(t *testing.T) { + testStrategyGenerate(t, immutableRequest) + }, + }, + { + "testEstimateUserOpGas", + func(t *testing.T) { + testGetEstimateUserOpGas(t, immutableRequest) + }, + }, + { + "testGetSupportEntrypointExecute", + func(t *testing.T) { + testGetSupportEntrypointExecute(t) + }, + }, + { + "Test_ScrollSepoliaV06Verify_TryPayUserOpExecute", + func(t *testing.T) { + mockRequestNotSupport1559.ForceStrategyId = string(global_const.StrategyCodeScrollSepoliaV06Verify) + mockRequest := getMockTryPayUserOpRequest() + + testTryPayUserOpExecute(t, mockRequest) + }, + }, + { + "Test_EthereumSepoliaV06Verify_TryPayUserOpExecute", + func(t *testing.T) { + mockRequest := getMockTryPayUserOpRequest() + + mockRequest.ForceStrategyId = string(global_const.StrategyCodeEthereumSepoliaV06Verify) + + testTryPayUserOpExecute(t, mockRequest) + }, + }, + { + "Test_OptimismSepoliaV06Verify_TryPayUserOpExecute", + func(t *testing.T) { + mockRequest := getMockTryPayUserOpRequest() + + mockRequest.ForceStrategyId = string(global_const.StrategyCodeOptimismSepoliaV06Verify) + + testTryPayUserOpExecute(t, mockRequest) + }, + }, + { + "Test_ArbitrumSpeoliaV06Verify_TryPayUserOpExecute", + func(t *testing.T) { + mockRequest := getMockTryPayUserOpRequest() + + mockRequest.ForceStrategyId = string(global_const.StrategyCodeArbitrumSepoliaV06Verify) + + testTryPayUserOpExecute(t, mockRequest) + }, + }, + { + "Test_BaseSepoliaV06Verify_TryPayUserOpExecute", + func(t *testing.T) { + mockRequest := getMockTryPayUserOpRequest() + mockRequest.ForceStrategyId = string(global_const.StrategyCodeArbitrumSepoliaV06Verify) + + testTryPayUserOpExecute(t, mockRequest) + }, + }, + { + "Test_EthereumSepoliaV06Erc20_TryPayUserOpExecute", + func(t *testing.T) { + mockRequest := getMockTryPayUserOpRequest() + + mockRequest.Erc20Token = global_const.TokenTypeUSDT + mockRequest.ForceStrategyId = string(global_const.StrategyCodeEthereumSepoliaV06Erc20) + testTryPayUserOpExecute(t, mockRequest) + }, + }, + { + "Test_OpSepoliaV06Erc20_TryPayUserOpExecute", + func(t *testing.T) { + mockRequest := getMockTryPayUserOpRequest() + + mockRequest.Erc20Token = global_const.TokenTypeUSDT + mockRequest.ForceStrategyId = string(global_const.StrategyCodeOptimismSepoliaV06Erc20) + testTryPayUserOpExecute(t, mockRequest) + }, + }, + { + "Test_ArbSepoliaV06Erc20_TryPayUserOpExecute", + func(t *testing.T) { + mockRequest := getMockTryPayUserOpRequest() + mockRequest.Erc20Token = global_const.TokenTypeUSDT + mockRequest.ForceStrategyId = string(global_const.StrategyCodeArbitrumSepoliaV06Erc20) + testTryPayUserOpExecute(t, mockRequest) + }, + }, + } + for _, tt := range tests { + if os.Getenv("GITHUB_ACTIONS") != "" && global_const.GitHubActionWhiteListSet.Contains(tt.name) { + t.Logf("Skip test [%s] in GitHub Actions", tt.name) + continue + } + t.Run(tt.name, tt.test) + } + +} +func testGetEstimateUserOpGas(t *testing.T, request *model.UserOpRequest) { + result, err := GetEstimateUserOpGas(request) + if err != nil { + t.Error(err) + return + } + resultJson, _ := json.Marshal(result) + fmt.Printf("Result: %v", string(resultJson)) +} +func testStrategyGenerate(t *testing.T, request *model.UserOpRequest) { + strategy, err := StrategyGenerate(request) + if err != nil { + t.Error(err) + return + } + strategyJson, _ := json.Marshal(strategy) + fmt.Printf("Strategy: %v", string(strategyJson)) +} +func testGetSupportEntrypointExecute(t *testing.T) { + res, err := GetSupportEntrypointExecute("ethereum-sepolia") + if err != nil { + t.Error(err) + return + } + t.Log(res) +} +func testTryPayUserOpExecute(t *testing.T, request *model.UserOpRequest) { + result, err := TryPayUserOpExecute(request) + if err != nil { + t.Fatal(err) + return + } + resultJson, _ := json.Marshal(result) + t.Logf("Result: %v", string(resultJson)) + + executor := network.GetEthereumExecutor(result.NetWork) + if executor == nil { + t.Error("executor is nil") + return + } + userOp, err := user_op.NewUserOp(&request.UserOp) + paymasterDataStr := result.UserOpResponse.PayMasterAndData + + paymasterData, err := utils.DecodeStringWithPrefix(paymasterDataStr) + userOp.PaymasterAndData = paymasterData + if err != nil { + t.Error(err) + return + } + if result.EntrypointVersion == global_const.EntrypointV07 { + //TODO + } else { + userOp.VerificationGasLimit = result.UserOpResponse.VerificationGasLimit + userOp.PreVerificationGas = result.UserOpResponse.PreVerificationGas + userOp.MaxFeePerGas = result.UserOpResponse.MaxFeePerGas + userOp.MaxPriorityFeePerGas = result.UserOpResponse.MaxPriorityFeePerGas + userOp.CallGasLimit = result.UserOpResponse.CallGasLimit + address := common.HexToAddress(result.EntryPointAddress) + jsonUserOP, err := json.Marshal(userOp) + if err != nil { + t.Error(err) + return + } + t.Logf("jsonUserOP: %v", string(jsonUserOP)) + result, err := executor.SimulateV06HandleOp(userOp, &address) + if err != nil { + t.Fatal(err) + return + } + resultJson, _ := json.Marshal(result) + t.Logf("Result: %v", string(resultJson)) + } +} + +func getMockTryPayUserOpRequest() *model.UserOpRequest { + return &model.UserOpRequest{ + ForceStrategyId: "Ethereum_Sepolia_v06_verifyPaymaster", + UserOp: *utils.GenerateMockUservOperation(), + } +} diff --git a/service/operator/try_pay_user_op_execute.go b/service/operator/try_pay_user_op_execute.go index f7c01853..0981134d 100644 --- a/service/operator/try_pay_user_op_execute.go +++ b/service/operator/try_pay_user_op_execute.go @@ -1,88 +1,92 @@ package operator import ( + "AAStarCommunity/EthPaymaster_BackService/common/global_const" "AAStarCommunity/EthPaymaster_BackService/common/model" + "AAStarCommunity/EthPaymaster_BackService/common/network" + "AAStarCommunity/EthPaymaster_BackService/common/paymaster_data" + "AAStarCommunity/EthPaymaster_BackService/common/user_op" "AAStarCommunity/EthPaymaster_BackService/common/utils" - "AAStarCommunity/EthPaymaster_BackService/service/chain_service" + "AAStarCommunity/EthPaymaster_BackService/gas_executor" "AAStarCommunity/EthPaymaster_BackService/service/dashboard_service" - "AAStarCommunity/EthPaymaster_BackService/service/gas_service" "AAStarCommunity/EthPaymaster_BackService/service/pay_service" "AAStarCommunity/EthPaymaster_BackService/service/validator_service" - "encoding/hex" + "github.com/sirupsen/logrus" "golang.org/x/xerrors" ) -func TryPayUserOpExecute(request *model.TryPayUserOpRequest) (*model.Result, error) { - // validator - if err := businessParamValidate(request); err != nil { +func TryPayUserOpExecute(request *model.UserOpRequest) (*model.TryPayUserOpResponse, error) { + userOp, strategy, paymasterDataInput, err := prepareExecute(request) + if err != nil { return nil, err } - userOp := request.UserOperation - // getStrategy - var strategy *model.Strategy - if stg, err := strategyGenerate(request); err != nil { - return nil, err - } else if err = validator_service.ValidateStrategy(stg, &userOp); err != nil { + gasResponse, paymasterUserOp, err := estimateGas(userOp, strategy, paymasterDataInput) + if err != nil { return nil, err - } else { - strategy = stg } - //base Strategy and UserOp computeGas - gasResponse, gasComputeError := gas_service.ComputeGas(&userOp, strategy) - if gasComputeError != nil { - return nil, gasComputeError - } + paymasterDataInput.PaymasterVerificationGasLimit = gasResponse.OpEstimateGas.PaymasterVerificationGasLimit + paymasterDataInput.PaymasterPostOpGasLimit = gasResponse.OpEstimateGas.PaymasterPostOpGasLimit - //validate gas - if err := gas_service.ValidateGas(&userOp, gasResponse); err != nil { + payReceipt, err := executePay(strategy, paymasterUserOp, gasResponse) + if err != nil { return nil, err } - - //pay - payReceipt, payError := executePay(strategy, &userOp, gasResponse) - if payError != nil { - return nil, payError + logrus.Debug("payReceipt:", payReceipt) + result, err := postExecute(paymasterUserOp, strategy, gasResponse, paymasterDataInput) + if err != nil { + return nil, err } - paymasterSignature := getPayMasterSignature(strategy, &userOp) - var result = model.TryPayUserOpResponse{ - StrategyId: strategy.Id, - EntryPointAddress: strategy.EntryPointAddress, - PayMasterAddress: strategy.PayMasterAddress, - PayReceipt: payReceipt, - PayMasterSignature: paymasterSignature, - GasInfo: gasResponse, + logrus.Debug("postExecute result:", result) + return result, nil +} + +func prepareExecute(request *model.UserOpRequest) (*user_op.UserOpInput, *model.Strategy, *paymaster_data.PaymasterDataInput, error) { + var strategy *model.Strategy + strategy, generateErr := StrategyGenerate(request) + if generateErr != nil { + return nil, nil, nil, generateErr } - return &model.Result{ - Code: 200, - Data: result, - Message: "message", - Cost: "cost", - }, nil + userOp, err := user_op.NewUserOp(&request.UserOp) + if err != nil { + return nil, nil, nil, err + } + if err := validator_service.ValidateStrategy(strategy); err != nil { + return nil, nil, nil, err + } + if err := validator_service.ValidateUserOp(userOp, strategy); err != nil { + return nil, nil, nil, err + } + paymasterDataIput := paymaster_data.NewPaymasterDataInput(strategy) + paymaster_data.NewPaymasterDataInput(strategy) + return userOp, strategy, paymasterDataIput, nil } -func businessParamValidate(request *model.TryPayUserOpRequest) error { - if request.ForceStrategyId == "" && (request.ForceToken == "" || request.ForceNetwork == "") { - return xerrors.Errorf("Token And Network Must Set When ForceStrategyId Is Empty") +func estimateGas(userOp *user_op.UserOpInput, strategy *model.Strategy, paymasterDataInput *paymaster_data.PaymasterDataInput) (*model.ComputeGasResponse, *user_op.UserOpInput, error) { + //base Strategy and UserOp computeGas + gasResponse, paymasterUserOp, gasComputeError := gas_executor.ComputeGas(userOp, strategy, paymasterDataInput) + if gasComputeError != nil { + return nil, nil, gasComputeError } - //UserOp Validate - if err := validator_service.ValidateUserOp(&request.UserOperation); err != nil { - return err + //The maxFeePerGas and maxPriorityFeePerGas are above a configurable minimum value that the client is willing to accept. At the minimum, they are sufficiently high to be included with the current block.basefee. + if err := ValidateGas(userOp, gasResponse, strategy); err != nil { + return nil, nil, err } - if request.ForceEntryPointAddress != "" && request.ForceNetwork != "" { - // check Address is available in NetWork - if ok, err := chain_service.CheckContractAddressAccess(request.ForceEntryPointAddress, request.ForceNetwork); err != nil { - return err - } else if !ok { - return xerrors.Errorf("ForceEntryPointAddress: [%s] not exist in [%s] network", request.ForceEntryPointAddress, request.ForceNetwork) - } + return gasResponse, paymasterUserOp, nil +} + +func ValidateGas(userOp *user_op.UserOpInput, gasComputeResponse *model.ComputeGasResponse, strategy *model.Strategy) error { + validateFunc := gas_executor.GetGasValidateFunc(strategy.GetPayType()) + err := validateFunc(userOp, gasComputeResponse, strategy) + if err != nil { + return err } return nil } -func executePay(strategy *model.Strategy, userOp *model.UserOperationItem, gasResponse *model.ComputeGasResponse) (*model.PayReceipt, error) { +func executePay(strategy *model.Strategy, userOp *user_op.UserOpInput, gasResponse *model.ComputeGasResponse) (*model.PayReceipt, error) { //1.Recharge ethereumPayservice := pay_service.EthereumPayService{} if err := ethereumPayservice.Pay(); err != nil { @@ -97,27 +101,69 @@ func executePay(strategy *model.Strategy, userOp *model.UserOperationItem, gasRe Sponsor: "aastar", }, nil } -func getPayMasterSignature(strategy *model.Strategy, userOp *model.UserOperationItem) string { - signatureBytes, _ := utils.SignUserOp("1d8a58126e87e53edc7b24d58d1328230641de8c4242c135492bf5560e0ff421", userOp) - return hex.EncodeToString(signatureBytes) + +func postExecute(userOp *user_op.UserOpInput, strategy *model.Strategy, gasResponse *model.ComputeGasResponse, paymasterDataInput *paymaster_data.PaymasterDataInput) (*model.TryPayUserOpResponse, error) { + executor := network.GetEthereumExecutor(strategy.GetNewWork()) + paymasterData, err := executor.GetPaymasterData(userOp, strategy, paymasterDataInput) + if err != nil { + return nil, xerrors.Errorf("postExecute GetPaymasterData Error: [%w]", err) + } + logrus.Debug("postExecute paymasterData:", paymasterData) + + var result = &model.TryPayUserOpResponse{ + StrategyId: strategy.Id, + EntryPointAddress: strategy.GetEntryPointAddress().String(), + NetWork: strategy.GetNewWork(), + EntrypointVersion: strategy.GetStrategyEntrypointVersion(), + PayMasterAddress: strategy.GetPaymasterAddress().String(), + Erc20TokenCost: gasResponse.Erc20TokenCost, + + UserOpResponse: &model.UserOpResponse{ + PayMasterAndData: utils.EncodeToStringWithPrefix(paymasterData), + PreVerificationGas: gasResponse.OpEstimateGas.PreVerificationGas, + MaxFeePerGas: gasResponse.OpEstimateGas.MaxFeePerGas, + MaxPriorityFeePerGas: gasResponse.OpEstimateGas.MaxPriorityFeePerGas, + VerificationGasLimit: gasResponse.OpEstimateGas.VerificationGasLimit, + CallGasLimit: gasResponse.OpEstimateGas.CallGasLimit, + }, + } + + if strategy.GetStrategyEntrypointVersion() == global_const.EntrypointV07 { + result.UserOpResponse.AccountGasLimit = utils.EncodeToStringWithPrefix(gasResponse.OpEstimateGas.AccountGasLimit[:]) + result.UserOpResponse.GasFees = utils.EncodeToStringWithPrefix(gasResponse.OpEstimateGas.GasFees[:]) + result.UserOpResponse.PaymasterVerificationGasLimit = gasResponse.OpEstimateGas.PaymasterVerificationGasLimit + result.UserOpResponse.PaymasterPostOpGasLimit = gasResponse.OpEstimateGas.PaymasterPostOpGasLimit + } + + return result, nil } -func strategyGenerate(request *model.TryPayUserOpRequest) (*model.Strategy, error) { +func StrategyGenerate(request *model.UserOpRequest) (*model.Strategy, error) { + var strategyResult *model.Strategy if forceStrategyId := request.ForceStrategyId; forceStrategyId != "" { //force strategy - if strategy := dashboard_service.GetStrategyById(forceStrategyId); strategy == nil { + if strategy := dashboard_service.GetStrategyByCode(forceStrategyId); strategy == nil { return nil, xerrors.Errorf("Not Support Strategy ID: [%w]", forceStrategyId) } else { - return strategy, nil + strategyResult = strategy + } + } else { + suitableStrategy, err := dashboard_service.GetSuitableStrategy(request.EntryPointVersion, request.ForceNetwork, global_const.PayTypeSuperVerifying) //TODO + if err != nil { + return nil, err + } + if suitableStrategy == nil { + return nil, xerrors.Errorf("Empty Strategies") } - } - suitableStrategy, err := dashboard_service.GetSuitableStrategy(request.ForceEntryPointAddress, request.ForceNetwork, request.ForceToken) //TODO - if err != nil { - return nil, err + strategyResult = suitableStrategy } - if suitableStrategy == nil { - return nil, xerrors.Errorf("Empty Strategies") + if strategyResult.GetPayType() == global_const.PayTypeERC20 { + if request.Erc20Token == "" { + return nil, xerrors.Errorf("Empty Erc20Token") + } + strategyResult.Erc20TokenType = request.Erc20Token + } - return suitableStrategy, nil + return strategyResult, nil } diff --git a/service/operator/try_pay_user_op_execute_test.go b/service/operator/try_pay_user_op_execute_test.go deleted file mode 100644 index 39a11329..00000000 --- a/service/operator/try_pay_user_op_execute_test.go +++ /dev/null @@ -1,25 +0,0 @@ -package operator - -import ( - "AAStarCommunity/EthPaymaster_BackService/common/model" - "AAStarCommunity/EthPaymaster_BackService/common/utils" - "encoding/json" - "fmt" - "github.com/stretchr/testify/assert" - "testing" -) - -func TestTryPayUserOpExecute(t *testing.T) { - request := getMockTryPayUserOpRequest() - result, err := TryPayUserOpExecute(request) - assert.NoError(t, err) - resultJson, _ := json.Marshal(result) - fmt.Printf("Result: %v", string(resultJson)) -} - -func getMockTryPayUserOpRequest() *model.TryPayUserOpRequest { - return &model.TryPayUserOpRequest{ - ForceStrategyId: "1", - UserOperation: *utils.GenerateMockUserOperation(), - } -} diff --git a/service/pay_service/pay_service.go b/service/pay_service/pay_service.go index 86ae6fc0..7cb11e83 100644 --- a/service/pay_service/pay_service.go +++ b/service/pay_service/pay_service.go @@ -20,6 +20,25 @@ func (e *EthereumPayService) GetReceipt() { } func (e *EthereumPayService) Pay() error { + //1.if validate Paymaster //TODO implement me return nil } + +type StarkNetPayService struct { +} + +func (s StarkNetPayService) Pay() error { + //TODO implement me + return nil +} + +func (s StarkNetPayService) RecordAccount() { + //TODO implement me + return +} + +func (s StarkNetPayService) getReceipt() { + //TODO implement me + return +} diff --git a/service/service.go b/service/service.go deleted file mode 100644 index 6d43c336..00000000 --- a/service/service.go +++ /dev/null @@ -1 +0,0 @@ -package service diff --git a/service/validator_service/basic_validator.go b/service/validator_service/basic_validator.go index d52effca..3240355d 100644 --- a/service/validator_service/basic_validator.go +++ b/service/validator_service/basic_validator.go @@ -1,29 +1,68 @@ package validator_service import ( + "AAStarCommunity/EthPaymaster_BackService/common/global_const" "AAStarCommunity/EthPaymaster_BackService/common/model" + "AAStarCommunity/EthPaymaster_BackService/common/user_op" "AAStarCommunity/EthPaymaster_BackService/service/chain_service" + "github.com/ethereum/go-ethereum/common" "golang.org/x/xerrors" ) -func ValidateStrategy(strategy *model.Strategy, userOp *model.UserOperationItem) error { +func ValidateStrategy(strategy *model.Strategy) error { if strategy == nil { return xerrors.Errorf("empty strategy") } - if strategy.NetWork == "" { + if strategy.GetNewWork() == "" { return xerrors.Errorf("empty strategy network") } // check Paymaster - ok, err := chain_service.CheckContractAddressAccess(strategy.PayMasterAddress, strategy.NetWork) - if !ok || err != nil { + _, err := chain_service.CheckContractAddressAccess(strategy.GetPaymasterAddress(), strategy.GetNewWork()) + if err != nil { return err } // check EntryPoint + _, err = chain_service.CheckContractAddressAccess(strategy.GetEntryPointAddress(), strategy.GetNewWork()) + if err != nil { + return err + } return nil } -func ValidateUserOp(userOp *model.UserOperationItem) error { - // check Sender is valid ,if sender is invalid And InitCode empty, return error - // nonce is valid +func ValidateUserOp(userOpParam *user_op.UserOpInput, strategy *model.Strategy) error { + if err := checkSender(userOpParam, strategy.GetNewWork()); err != nil { + return err + } + userOpValue := *userOpParam + if !userOpValue.Nonce.IsInt64() { + return xerrors.Errorf("nonce is not in uint64 range") + } + //If initCode is not empty, parse its first 20 bytes as a factory address. Record whether the factory is staked, in case the later simulation indicates that it needs to be. If the factory accesses global state, it must be staked - see reputation, throttling and banning section for details. + //The verificationGasLimit is sufficiently low (<= MAX_VERIFICATION_GAS) and the preVerificationGas is sufficiently high (enough to pay for the calldata gas cost of serializing the UserOperationV06 plus PRE_VERIFICATION_OVERHEAD_GAS) + return nil + //TODO secure check https://github.com/eth-infinitism/account-abstraction/blob/develop/erc/ERCS/erc-7562.md +} +func checkSender(userOpParam *user_op.UserOpInput, netWork global_const.Network) error { + userOpValue := *userOpParam + checkOk, checkSenderErr := chain_service.CheckContractAddressAccess(userOpValue.Sender, netWork) + if !checkOk { + if err := checkInitCode(userOpValue.InitCode, netWork); err != nil { + return xerrors.Errorf("%s and %s", checkSenderErr.Error(), err.Error()) + } + } + return nil +} +func checkInitCode(initCode []byte, network global_const.Network) error { + if len(initCode) < 20 { + return xerrors.Errorf("initCode length is less than 20 do not have factory address") + } + factoryAddress := common.BytesToAddress(initCode[:20]) + if ok, err := chain_service.CheckContractAddressAccess(&factoryAddress, network); err != nil { + return err + } else if !ok { + return xerrors.Errorf("factoryAddress address [factoryAddress] not exist in [%s] network", network) + } + //parse its first 20 bytes as a factory address. Record whether the factory is staked, + //factory and factoryData - either both exist, or none return nil } diff --git a/service/validator_service/user_op_validator.go b/service/validator_service/user_op_validator.go deleted file mode 100644 index cb6263b0..00000000 --- a/service/validator_service/user_op_validator.go +++ /dev/null @@ -1 +0,0 @@ -package validator_service diff --git a/validator/chain/chain_validator.go b/validator/chain/chain_validator.go deleted file mode 100644 index 1cb6d7fc..00000000 --- a/validator/chain/chain_validator.go +++ /dev/null @@ -1,10 +0,0 @@ -package chain - -type Validator interface { - PreValidate() (err error) - AfterGasValidate() (err error) - IsSupport() bool -} -type Base struct { - name string -} diff --git a/validator/chain/ethereum/ethereum_validator.go b/validator/chain/ethereum/ethereum_validator.go deleted file mode 100644 index c6a7f7fe..00000000 --- a/validator/chain/ethereum/ethereum_validator.go +++ /dev/null @@ -1,24 +0,0 @@ -package ethereum - -import ( - "AAStarCommunity/EthPaymaster_BackService/validator/chain" -) - -type Validator struct { - *chain.Base -} - -func (e *Validator) IsSupport() bool { - //TODO implement me - panic("implement me") -} - -func (e *Validator) PreValidate() (err error) { - //TODO implement me - panic("implement me") -} - -func (e *Validator) AfterGasValidate() (err error) { - //TODO implement me - panic("implement me") -} diff --git a/validator/eip/eip_4844/4844_validator.go b/validator/eip/eip_4844/4844_validator.go deleted file mode 100644 index c847b0f8..00000000 --- a/validator/eip/eip_4844/4844_validator.go +++ /dev/null @@ -1 +0,0 @@ -package eip_4844 diff --git a/validator/other/eoa_enabled_validator.go b/validator/other/eoa_enabled_validator.go deleted file mode 100644 index 58a9531f..00000000 --- a/validator/other/eoa_enabled_validator.go +++ /dev/null @@ -1 +0,0 @@ -package other