From 7a680df713319586e26efe8f3fa09464fef06d1e Mon Sep 17 00:00:00 2001 From: Valentin Trinque Date: Wed, 21 Feb 2024 18:53:32 +0100 Subject: [PATCH] chore: Fix linter issues --- .github/workflows/golangci-lint.yml | 10 +- .golangci.toml | 40 + .golangci.yaml | 34 - cmd/docs/main.go | 1 + cmd/ethereum.go | 1 + cmd/ethereum_asset.go | 1 - cmd/ethereum_asset_deposit.go | 15 +- cmd/ethereum_asset_mint.go | 15 +- cmd/ethereum_asset_stake.go | 15 +- cmd/install_dependencies.go | 4 +- cmd/jobs_start.go | 1 + cmd/jobs_stop.go | 1 + cmd/logs.go | 1 + cmd/network_addresses.go | 1 + cmd/network_bootstrap.go | 1 + cmd/network_destroy.go | 1 + cmd/network_generate.go | 1 + cmd/network_keys_import.go | 5 +- cmd/network_logs.go | 1 + cmd/network_start.go | 5 +- cmd/network_stop.go | 5 +- cmd/nodes_add.go | 3 +- cmd/nodes_list.go | 1 + cmd/nodes_list_validators.go | 1 + cmd/nodes_protocol_upgrade.go | 1 + cmd/nodes_remove.go | 6 +- cmd/nodes_reset_state.go | 1 + cmd/nodes_restore_cp.go | 3 +- cmd/nodes_start.go | 1 + cmd/nodes_stop.go | 1 + cmd/nomad.go | 1 + cmd/nomad_log.go | 1 + cmd/nomad_log_tail.go | 1 + cmd/root.go | 1 + cmd/state.go | 1 + cmd/template.go | 8 +- cmd/template_genesis.go | 1 + cmd/template_node_sets.go | 1 + cmd/template_nomad.go | 1 + config/config.go | 6 +- config/parser.go | 2 +- docsgenerator/generator.go | 4 +- ethereum/multisig.go | 1 - generator/datanode/generator.go | 1 - generator/datanode/templates.go | 6 +- generator/faucet/generator.go | 5 +- generator/generator.go | 12 +- generator/initiate.go | 1 + generator/nomad/nomad.go | 1 + generator/tendermint/generator.go | 2 +- generator/tendermint/templates.go | 1 + generator/vega/generator.go | 6 +- generator/vega/templates.go | 2 +- generator/visor/templates.go | 3 +- generator/wallet/generator.go | 2 +- go.mod | 1 - go.sum | 4 - importer/ethereum.go | 2 +- importer/tendermint.go | 1 + installer/installer.go | 3 +- libs/ethereum/base_token_session.go | 226 +++ libs/ethereum/base_token_session_test.go | 30 + libs/ethereum/client.go | 195 ++ libs/ethereum/client_test.go | 160 ++ libs/ethereum/erc20_bridge_session.go | 40 + libs/ethereum/generated/base_token.go | 1183 ++++++++++++ libs/ethereum/generated/erc20_bridge.go | 2143 +++++++++++++++++++++ libs/ethereum/generated/staking_bridge.go | 201 ++ libs/ethereum/staking_bridge_session.go | 19 + logscollector/collector.go | 1 - logscollector/printer.go | 1 + nomad/client.go | 1 + nomad/client_allocs.go | 1 - nomad/job_runner.go | 3 +- nomad/job_runner_void.go | 1 + nomad/runner/binary_installer.go | 6 +- probes/probe.go | 1 + types/node_set_test.go | 1 + utils/filesystem.go | 6 +- 79 files changed, 4351 insertions(+), 127 deletions(-) create mode 100644 .golangci.toml delete mode 100644 .golangci.yaml create mode 100644 libs/ethereum/base_token_session.go create mode 100644 libs/ethereum/base_token_session_test.go create mode 100644 libs/ethereum/client.go create mode 100644 libs/ethereum/client_test.go create mode 100644 libs/ethereum/erc20_bridge_session.go create mode 100644 libs/ethereum/generated/base_token.go create mode 100644 libs/ethereum/generated/erc20_bridge.go create mode 100644 libs/ethereum/generated/staking_bridge.go create mode 100644 libs/ethereum/staking_bridge_session.go diff --git a/.github/workflows/golangci-lint.yml b/.github/workflows/golangci-lint.yml index 3979b3c5..33c92ad8 100644 --- a/.github/workflows/golangci-lint.yml +++ b/.github/workflows/golangci-lint.yml @@ -16,14 +16,14 @@ jobs: runs-on: ubuntu-latest steps: - name: Setup Go - uses: actions/setup-go@v4 + uses: actions/setup-go@v5 with: go-version: '1.21.5' - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: golangci-lint - uses: golangci/golangci-lint-action@v3 + uses: golangci/golangci-lint-action@v3.7.0 with: - version: v1.53.2 - args: --config .golangci.yaml --verbose + version: v1.55.2 + args: --config .golangci.toml --verbose env: GO111MODULE: on diff --git a/.golangci.toml b/.golangci.toml new file mode 100644 index 00000000..4a235310 --- /dev/null +++ b/.golangci.toml @@ -0,0 +1,40 @@ +[run] +allow-parallel-runners = true +print-linter-name = true +timeout = '15m0s' + +[output] +print-issued-lines = true +format = "colored-line-number" + +[issues] +max-issues-per-linter = 0 +max-same-issues = 0 +exclude = [ + "Error return value of .(.*MarkFlagRequired). is not checked" +] + +[linters] +disable-all = true +enable = [ + "errcheck", + "gosimple", + "govet", + "ineffassign", + "staticcheck", + "typecheck", + "unused", + "nilerr", + "misspell", + "gci" +] + +[linters-settings.gci] +custom-order = true +sections = [ + "standard", # Standard section: captures all standard packages. + "prefix(code.vegaprotocol.io/vega)", # Custom section: groups all imports with the specified Prefix. + "default", # Default section: contains all imports that could not be matched to another section type. + "blank", # Blank section: contains all blank imports. This section is not present unless explicitly enabled. + "dot", +] diff --git a/.golangci.yaml b/.golangci.yaml deleted file mode 100644 index 40240f3a..00000000 --- a/.golangci.yaml +++ /dev/null @@ -1,34 +0,0 @@ -run: - allow-parallel-runners: true - print-linter-name: true - timeout: '5m0s' - - -output: - print-issued-lines: true - format: colored-line-number - -issues: - max-issues-per-linter: 50 - max-same-issues: 0 - exclude: - - "Error return value of .(.*MarkFlagRequired). is not checked" - -linters: - # Disable all linters. - # Default: false - disable-all: true - # Enable specific linter - # https://golangci-lint.run/usage/linters/#enabled-by-default-linters - enable: - - errcheck - - gosimple - - govet - - ineffassign - - staticcheck - - typecheck - - unused - # Additional linters - - nilerr - # - nilnil - - misspell \ No newline at end of file diff --git a/cmd/docs/main.go b/cmd/docs/main.go index 69d6716f..751a56c7 100644 --- a/cmd/docs/main.go +++ b/cmd/docs/main.go @@ -6,6 +6,7 @@ import ( "strings" "code.vegaprotocol.io/vegacapsule/docsgenerator" + "github.com/cometbft/cometbft/libs/os" ) diff --git a/cmd/ethereum.go b/cmd/ethereum.go index 2b8add5e..d25b586e 100644 --- a/cmd/ethereum.go +++ b/cmd/ethereum.go @@ -10,6 +10,7 @@ import ( "code.vegaprotocol.io/vegacapsule/state" "code.vegaprotocol.io/vegacapsule/types" "code.vegaprotocol.io/vegacapsule/utils" + "github.com/spf13/cobra" ) diff --git a/cmd/ethereum_asset.go b/cmd/ethereum_asset.go index 75301a9c..b99863e8 100644 --- a/cmd/ethereum_asset.go +++ b/cmd/ethereum_asset.go @@ -5,7 +5,6 @@ import ( "time" vgtypes "github.com/ethereum/go-ethereum/core/types" - "github.com/spf13/cobra" ) diff --git a/cmd/ethereum_asset_deposit.go b/cmd/ethereum_asset_deposit.go index 8140d87e..35130af1 100644 --- a/cmd/ethereum_asset_deposit.go +++ b/cmd/ethereum_asset_deposit.go @@ -5,8 +5,9 @@ import ( "fmt" "math/big" - vgethereum "code.vegaprotocol.io/shared/libs/ethereum" + vgethereum "code.vegaprotocol.io/vegacapsule/libs/ethereum" "code.vegaprotocol.io/vegacapsule/state" + "github.com/ethereum/go-ethereum/common" "github.com/spf13/cobra" ) @@ -20,13 +21,11 @@ type ethereumAssetDepositOrStakeArgs struct { networkAddress string } -var ( - ethereumAssetDepositFlags = struct { - vegaPubKey string - assetSymbol string - amount int64 - }{} -) +var ethereumAssetDepositFlags = struct { + vegaPubKey string + assetSymbol string + amount int64 +}{} func init() { ethereumAssetDepositCmd.Flags().StringVar(ðereumAssetDepositFlags.assetSymbol, "asset-symbol", "", "symbol of the asset to be deposited") diff --git a/cmd/ethereum_asset_mint.go b/cmd/ethereum_asset_mint.go index 5d2c5515..fc1c7574 100644 --- a/cmd/ethereum_asset_mint.go +++ b/cmd/ethereum_asset_mint.go @@ -5,8 +5,9 @@ import ( "fmt" "math/big" - vgethereum "code.vegaprotocol.io/shared/libs/ethereum" + vgethereum "code.vegaprotocol.io/vegacapsule/libs/ethereum" "code.vegaprotocol.io/vegacapsule/state" + "github.com/ethereum/go-ethereum/common" "github.com/spf13/cobra" ) @@ -19,13 +20,11 @@ type ethereumAssetMintArgs struct { networkAddress string } -var ( - ethereumAssetMintFlags = struct { - toAddress string - assetSymbol string - amount int64 - }{} -) +var ethereumAssetMintFlags = struct { + toAddress string + assetSymbol string + amount int64 +}{} func init() { ethereumAssetMintCmd.Flags().StringVar(ðereumAssetMintFlags.assetSymbol, "asset-symbol", "", "symbol of the asset to be minted") diff --git a/cmd/ethereum_asset_stake.go b/cmd/ethereum_asset_stake.go index 42ef215d..e9b57034 100644 --- a/cmd/ethereum_asset_stake.go +++ b/cmd/ethereum_asset_stake.go @@ -5,19 +5,18 @@ import ( "fmt" "math/big" - vgethereum "code.vegaprotocol.io/shared/libs/ethereum" + vgethereum "code.vegaprotocol.io/vegacapsule/libs/ethereum" "code.vegaprotocol.io/vegacapsule/state" + "github.com/ethereum/go-ethereum/common" "github.com/spf13/cobra" ) -var ( - ethereumAssetStakeFlags = struct { - vegaPubKey string - assetSymbol string - amount int64 - }{} -) +var ethereumAssetStakeFlags = struct { + vegaPubKey string + assetSymbol string + amount int64 +}{} func init() { ethereumAssetStakeCmd.Flags().StringVar(ðereumAssetStakeFlags.assetSymbol, "asset-symbol", "", "symbol of the asset to be staked") diff --git a/cmd/install_dependencies.go b/cmd/install_dependencies.go index adac13e3..cafcd91d 100644 --- a/cmd/install_dependencies.go +++ b/cmd/install_dependencies.go @@ -4,11 +4,11 @@ import ( "fmt" "os" - "github.com/spf13/cobra" - "code.vegaprotocol.io/vegacapsule/config" "code.vegaprotocol.io/vegacapsule/installer" "code.vegaprotocol.io/vegacapsule/utils" + + "github.com/spf13/cobra" ) const ( diff --git a/cmd/jobs_start.go b/cmd/jobs_start.go index 1f546c45..e1e5b530 100644 --- a/cmd/jobs_start.go +++ b/cmd/jobs_start.go @@ -8,6 +8,7 @@ import ( "code.vegaprotocol.io/vegacapsule/config" "code.vegaprotocol.io/vegacapsule/nomad" "code.vegaprotocol.io/vegacapsule/state" + "github.com/spf13/cobra" ) diff --git a/cmd/jobs_stop.go b/cmd/jobs_stop.go index df5bfea1..9f7e3ed5 100644 --- a/cmd/jobs_stop.go +++ b/cmd/jobs_stop.go @@ -7,6 +7,7 @@ import ( "code.vegaprotocol.io/vegacapsule/nomad" "code.vegaprotocol.io/vegacapsule/state" + "github.com/spf13/cobra" ) diff --git a/cmd/logs.go b/cmd/logs.go index 72139aa0..f77a633e 100644 --- a/cmd/logs.go +++ b/cmd/logs.go @@ -5,6 +5,7 @@ import ( "code.vegaprotocol.io/vegacapsule/logscollector" "code.vegaprotocol.io/vegacapsule/state" + "github.com/spf13/cobra" ) diff --git a/cmd/network_addresses.go b/cmd/network_addresses.go index 7637f0ac..9962e3bc 100644 --- a/cmd/network_addresses.go +++ b/cmd/network_addresses.go @@ -10,6 +10,7 @@ import ( "code.vegaprotocol.io/vegacapsule/ports" "code.vegaprotocol.io/vegacapsule/state" "code.vegaprotocol.io/vegacapsule/types" + "github.com/spf13/cobra" ) diff --git a/cmd/network_bootstrap.go b/cmd/network_bootstrap.go index fd02e346..d6e314ad 100644 --- a/cmd/network_bootstrap.go +++ b/cmd/network_bootstrap.go @@ -8,6 +8,7 @@ import ( "code.vegaprotocol.io/vegacapsule/installer" "code.vegaprotocol.io/vegacapsule/state" "code.vegaprotocol.io/vegacapsule/types" + "github.com/spf13/cobra" ) diff --git a/cmd/network_destroy.go b/cmd/network_destroy.go index 7150d7df..8de605cf 100644 --- a/cmd/network_destroy.go +++ b/cmd/network_destroy.go @@ -8,6 +8,7 @@ import ( "code.vegaprotocol.io/vegacapsule/nomad" "code.vegaprotocol.io/vegacapsule/state" + "github.com/spf13/cobra" ) diff --git a/cmd/network_generate.go b/cmd/network_generate.go index ce3cb7f3..017f53a8 100644 --- a/cmd/network_generate.go +++ b/cmd/network_generate.go @@ -12,6 +12,7 @@ import ( "code.vegaprotocol.io/vegacapsule/state" "code.vegaprotocol.io/vegacapsule/types" "code.vegaprotocol.io/vegacapsule/utils" + "github.com/spf13/cobra" ) diff --git a/cmd/network_keys_import.go b/cmd/network_keys_import.go index 6aebaa59..f8b56b75 100644 --- a/cmd/network_keys_import.go +++ b/cmd/network_keys_import.go @@ -9,6 +9,7 @@ import ( "code.vegaprotocol.io/vegacapsule/importer" "code.vegaprotocol.io/vegacapsule/state" + "github.com/spf13/cobra" ) @@ -48,9 +49,7 @@ Example content of the file with data to import: ... ]` -var ( - keysFilePath string -) +var keysFilePath string var netKeysImportCmd = &cobra.Command{ Use: "import", diff --git a/cmd/network_logs.go b/cmd/network_logs.go index 126b2950..0f26233a 100644 --- a/cmd/network_logs.go +++ b/cmd/network_logs.go @@ -9,6 +9,7 @@ import ( "code.vegaprotocol.io/vegacapsule/nomad" "code.vegaprotocol.io/vegacapsule/state" "code.vegaprotocol.io/vegacapsule/types" + "github.com/spf13/cobra" ) diff --git a/cmd/network_start.go b/cmd/network_start.go index ac5614f6..d7568cf7 100644 --- a/cmd/network_start.go +++ b/cmd/network_start.go @@ -8,12 +8,11 @@ import ( "code.vegaprotocol.io/vegacapsule/config" "code.vegaprotocol.io/vegacapsule/nomad" "code.vegaprotocol.io/vegacapsule/state" + "github.com/spf13/cobra" ) -var ( - doNotStopAllJobsOnFailure bool -) +var doNotStopAllJobsOnFailure bool var netStartCmd = &cobra.Command{ Use: "start", diff --git a/cmd/network_stop.go b/cmd/network_stop.go index 978c47ae..e3a60e93 100644 --- a/cmd/network_stop.go +++ b/cmd/network_stop.go @@ -7,12 +7,11 @@ import ( "code.vegaprotocol.io/vegacapsule/nomad" "code.vegaprotocol.io/vegacapsule/state" + "github.com/spf13/cobra" ) -var ( - stopNodesOnly bool -) +var stopNodesOnly bool var netStopCmd = &cobra.Command{ Use: "stop", diff --git a/cmd/nodes_add.go b/cmd/nodes_add.go index 5a15a02d..33a8a096 100644 --- a/cmd/nodes_add.go +++ b/cmd/nodes_add.go @@ -10,6 +10,7 @@ import ( "code.vegaprotocol.io/vegacapsule/nomad" "code.vegaprotocol.io/vegacapsule/state" "code.vegaprotocol.io/vegacapsule/types" + "github.com/spf13/cobra" "golang.org/x/sync/errgroup" ) @@ -89,7 +90,7 @@ var nodesAddCmd = &cobra.Command{ fmt.Println(string(outputStringJSON)) if resultsOutPath != "" { - if err := os.WriteFile(resultsOutPath, outputStringJSON, 0666); err != nil { + if err := os.WriteFile(resultsOutPath, outputStringJSON, 0o666); err != nil { return fmt.Errorf("failed to save results about new nodes into the file: %w", err) } } diff --git a/cmd/nodes_list.go b/cmd/nodes_list.go index 9f0845ad..3eec1eab 100644 --- a/cmd/nodes_list.go +++ b/cmd/nodes_list.go @@ -5,6 +5,7 @@ import ( "fmt" "code.vegaprotocol.io/vegacapsule/state" + "github.com/spf13/cobra" ) diff --git a/cmd/nodes_list_validators.go b/cmd/nodes_list_validators.go index 9d24b2c7..511a60ec 100644 --- a/cmd/nodes_list_validators.go +++ b/cmd/nodes_list_validators.go @@ -5,6 +5,7 @@ import ( "fmt" "code.vegaprotocol.io/vegacapsule/state" + "github.com/spf13/cobra" ) diff --git a/cmd/nodes_protocol_upgrade.go b/cmd/nodes_protocol_upgrade.go index 10cb62e4..2a9bd5a6 100644 --- a/cmd/nodes_protocol_upgrade.go +++ b/cmd/nodes_protocol_upgrade.go @@ -9,6 +9,7 @@ import ( "code.vegaprotocol.io/vegacapsule/generator/visor" "code.vegaprotocol.io/vegacapsule/state" "code.vegaprotocol.io/vegacapsule/types" + "github.com/spf13/cobra" ) diff --git a/cmd/nodes_remove.go b/cmd/nodes_remove.go index 713d8a65..520dbc94 100644 --- a/cmd/nodes_remove.go +++ b/cmd/nodes_remove.go @@ -1,11 +1,13 @@ package cmd import ( + "context" + "fmt" + "code.vegaprotocol.io/vegacapsule/generator" "code.vegaprotocol.io/vegacapsule/nomad" "code.vegaprotocol.io/vegacapsule/state" - "context" - "fmt" + "github.com/spf13/cobra" ) diff --git a/cmd/nodes_reset_state.go b/cmd/nodes_reset_state.go index b63ad655..14defb63 100644 --- a/cmd/nodes_reset_state.go +++ b/cmd/nodes_reset_state.go @@ -7,6 +7,7 @@ import ( "code.vegaprotocol.io/vegacapsule/commands" "code.vegaprotocol.io/vegacapsule/state" + "github.com/spf13/cobra" ) diff --git a/cmd/nodes_restore_cp.go b/cmd/nodes_restore_cp.go index 3568bd88..866448dc 100644 --- a/cmd/nodes_restore_cp.go +++ b/cmd/nodes_restore_cp.go @@ -8,10 +8,11 @@ import ( "strconv" "strings" - vspaths "code.vegaprotocol.io/shared/paths" + vspaths "code.vegaprotocol.io/vega/paths" "code.vegaprotocol.io/vegacapsule/commands" "code.vegaprotocol.io/vegacapsule/state" "code.vegaprotocol.io/vegacapsule/types" + "github.com/BurntSushi/toml" "github.com/spf13/cobra" ) diff --git a/cmd/nodes_start.go b/cmd/nodes_start.go index 2063b908..84150403 100644 --- a/cmd/nodes_start.go +++ b/cmd/nodes_start.go @@ -10,6 +10,7 @@ import ( "code.vegaprotocol.io/vegacapsule/state" "code.vegaprotocol.io/vegacapsule/types" "code.vegaprotocol.io/vegacapsule/utils" + "github.com/spf13/cobra" ) diff --git a/cmd/nodes_stop.go b/cmd/nodes_stop.go index 5a6cda80..b1dad2b8 100644 --- a/cmd/nodes_stop.go +++ b/cmd/nodes_stop.go @@ -7,6 +7,7 @@ import ( "code.vegaprotocol.io/vegacapsule/nomad" "code.vegaprotocol.io/vegacapsule/state" + "github.com/spf13/cobra" ) diff --git a/cmd/nomad.go b/cmd/nomad.go index 43bd2ab8..446a0c94 100644 --- a/cmd/nomad.go +++ b/cmd/nomad.go @@ -5,6 +5,7 @@ import ( "os" nmrunner "code.vegaprotocol.io/vegacapsule/nomad/runner" + "github.com/spf13/cobra" ) diff --git a/cmd/nomad_log.go b/cmd/nomad_log.go index 30bd1ff2..49e409b8 100644 --- a/cmd/nomad_log.go +++ b/cmd/nomad_log.go @@ -10,6 +10,7 @@ import ( "syscall" "code.vegaprotocol.io/vegacapsule/logscollector" + "github.com/spf13/cobra" ) diff --git a/cmd/nomad_log_tail.go b/cmd/nomad_log_tail.go index 36a9d825..7a709061 100644 --- a/cmd/nomad_log_tail.go +++ b/cmd/nomad_log_tail.go @@ -4,6 +4,7 @@ import ( "path" "code.vegaprotocol.io/vegacapsule/logscollector" + "github.com/spf13/cobra" ) diff --git a/cmd/root.go b/cmd/root.go index d304d034..42714e81 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -5,6 +5,7 @@ import ( "os" "code.vegaprotocol.io/vegacapsule/config" + "github.com/spf13/cobra" ) diff --git a/cmd/state.go b/cmd/state.go index b1c69631..b16e1ea5 100644 --- a/cmd/state.go +++ b/cmd/state.go @@ -4,6 +4,7 @@ import ( "fmt" "code.vegaprotocol.io/vegacapsule/state" + "github.com/spf13/cobra" ) diff --git a/cmd/template.go b/cmd/template.go index eaad5034..1e9ff036 100644 --- a/cmd/template.go +++ b/cmd/template.go @@ -5,14 +5,14 @@ import ( "fmt" "log" - "code.vegaprotocol.io/vegacapsule/types" - "code.vegaprotocol.io/vegacapsule/utils" - "github.com/spf13/cobra" - datanodegen "code.vegaprotocol.io/vegacapsule/generator/datanode" genesisgen "code.vegaprotocol.io/vegacapsule/generator/genesis" tmgen "code.vegaprotocol.io/vegacapsule/generator/tendermint" vegagen "code.vegaprotocol.io/vegacapsule/generator/vega" + "code.vegaprotocol.io/vegacapsule/types" + "code.vegaprotocol.io/vegacapsule/utils" + + "github.com/spf13/cobra" ) type templateKindType string diff --git a/cmd/template_genesis.go b/cmd/template_genesis.go index c843246f..97e5f73d 100644 --- a/cmd/template_genesis.go +++ b/cmd/template_genesis.go @@ -9,6 +9,7 @@ import ( "code.vegaprotocol.io/vegacapsule/generator/genesis" "code.vegaprotocol.io/vegacapsule/generator/tendermint" "code.vegaprotocol.io/vegacapsule/state" + "github.com/spf13/cobra" ) diff --git a/cmd/template_node_sets.go b/cmd/template_node_sets.go index 59472be3..4e35c9e7 100644 --- a/cmd/template_node_sets.go +++ b/cmd/template_node_sets.go @@ -13,6 +13,7 @@ import ( "code.vegaprotocol.io/vegacapsule/generator/visor" "code.vegaprotocol.io/vegacapsule/state" "code.vegaprotocol.io/vegacapsule/types" + "github.com/spf13/cobra" ) diff --git a/cmd/template_nomad.go b/cmd/template_nomad.go index a15022e9..37bc8048 100644 --- a/cmd/template_nomad.go +++ b/cmd/template_nomad.go @@ -11,6 +11,7 @@ import ( "code.vegaprotocol.io/vegacapsule/state" "code.vegaprotocol.io/vegacapsule/types" "code.vegaprotocol.io/vegacapsule/utils" + "github.com/spf13/cobra" ) diff --git a/config/config.go b/config/config.go index ca6a535a..11c68365 100644 --- a/config/config.go +++ b/config/config.go @@ -9,12 +9,12 @@ import ( "path" "path/filepath" - "github.com/hashicorp/hcl/v2/gohcl" - "github.com/hashicorp/hcl/v2/hclwrite" - "code.vegaprotocol.io/vegacapsule/installer" "code.vegaprotocol.io/vegacapsule/types" "code.vegaprotocol.io/vegacapsule/utils" + + "github.com/hashicorp/hcl/v2/gohcl" + "github.com/hashicorp/hcl/v2/hclwrite" ) const ( diff --git a/config/parser.go b/config/parser.go index ceafff11..ff641a03 100644 --- a/config/parser.go +++ b/config/parser.go @@ -6,6 +6,7 @@ import ( "path/filepath" "code.vegaprotocol.io/vegacapsule/types" + "github.com/hashicorp/go-cty-funcs/crypto" "github.com/hashicorp/go-cty-funcs/encoding" "github.com/hashicorp/go-cty-funcs/uuid" @@ -41,7 +42,6 @@ var envFunc = function.New(&function.Spec{ }) func newEvalContext(genServices cty.Value, homePath string) *hcl.EvalContext { - return &hcl.EvalContext{ Variables: map[string]cty.Value{ "generated": genServices, diff --git a/docsgenerator/generator.go b/docsgenerator/generator.go index 3a501b96..ee6262c2 100644 --- a/docsgenerator/generator.go +++ b/docsgenerator/generator.go @@ -10,9 +10,7 @@ import ( const optionalTag = "optional" -var ( - mapRegex = regexp.MustCompile(`map\[(.*)\](.*)`) -) +var mapRegex = regexp.MustCompile(`map\[(.*)\](.*)`) type TypeDocGenerator struct { fileTypes map[string]docTypeWithFileContent diff --git a/ethereum/multisig.go b/ethereum/multisig.go index 6de40e05..8dec9cda 100644 --- a/ethereum/multisig.go +++ b/ethereum/multisig.go @@ -55,7 +55,6 @@ type EthereumMultisigClientParameters struct { func NewEthereumMultisigClient(ctx context.Context, params EthereumMultisigClientParameters) (*EthereumMultisigClient, error) { client, err := ethclient.DialContext(ctx, params.EthereumAddress) - if err != nil { return nil, fmt.Errorf("failed creating ethereum client: %w", err) } diff --git a/generator/datanode/generator.go b/generator/datanode/generator.go index 6e4ff2a6..218c06d0 100644 --- a/generator/datanode/generator.go +++ b/generator/datanode/generator.go @@ -30,7 +30,6 @@ type ConfigGenerator struct { func NewConfigGenerator(conf *config.Config, generatedNodeSets []types.NodeSet) (*ConfigGenerator, error) { homeDir, err := filepath.Abs(path.Join(*conf.OutputDir, conf.DataNodePrefix)) - if err != nil { return nil, err } diff --git a/generator/datanode/templates.go b/generator/datanode/templates.go index ce1fe522..00cb3969 100644 --- a/generator/datanode/templates.go +++ b/generator/datanode/templates.go @@ -7,13 +7,13 @@ import ( "os" "text/template" - "code.vegaprotocol.io/shared/paths" "code.vegaprotocol.io/vega/datanode/networkhistory/store" + "code.vegaprotocol.io/vega/paths" "code.vegaprotocol.io/vegacapsule/types" - "github.com/Masterminds/sprig" - "github.com/imdario/mergo" "github.com/BurntSushi/toml" + "github.com/Masterminds/sprig" + "github.com/imdario/mergo" ) type IPSFPeer struct { diff --git a/generator/faucet/generator.go b/generator/faucet/generator.go index 373c0f78..fc7b146d 100644 --- a/generator/faucet/generator.go +++ b/generator/faucet/generator.go @@ -8,10 +8,11 @@ import ( "path/filepath" "text/template" - "code.vegaprotocol.io/shared/paths" "code.vegaprotocol.io/vega/core/faucet" + "code.vegaprotocol.io/vega/paths" "code.vegaprotocol.io/vegacapsule/config" "code.vegaprotocol.io/vegacapsule/types" + "github.com/BurntSushi/toml" "github.com/Masterminds/sprig" "github.com/imdario/mergo" @@ -78,7 +79,7 @@ func (cg *ConfigGenerator) Initiate(conf *config.FaucetConfig) (*types.Faucet, e } walletPassFilePath := path.Join(cg.homeDir, "faucet-wallet-pass.txt") - if err := os.WriteFile(walletPassFilePath, []byte(conf.Pass), 0644); err != nil { + if err := os.WriteFile(walletPassFilePath, []byte(conf.Pass), 0o644); err != nil { return nil, fmt.Errorf("failed to write faucet wallet passphrase to file: %w", err) } diff --git a/generator/generator.go b/generator/generator.go index 3eef65d4..002ece8d 100644 --- a/generator/generator.go +++ b/generator/generator.go @@ -1,6 +1,12 @@ package generator import ( + "context" + "fmt" + "log" + "os" + "path/filepath" + "code.vegaprotocol.io/vegacapsule/config" "code.vegaprotocol.io/vegacapsule/generator/datanode" "code.vegaprotocol.io/vegacapsule/generator/faucet" @@ -11,12 +17,8 @@ import ( "code.vegaprotocol.io/vegacapsule/generator/wallet" "code.vegaprotocol.io/vegacapsule/types" "code.vegaprotocol.io/vegacapsule/utils" - "context" - "fmt" + "github.com/otiai10/copy" - "log" - "os" - "path/filepath" ) type nodeSets struct { diff --git a/generator/initiate.go b/generator/initiate.go index 67b1ec0a..af96a19c 100644 --- a/generator/initiate.go +++ b/generator/initiate.go @@ -8,6 +8,7 @@ import ( "code.vegaprotocol.io/vegacapsule/generator/nomad" "code.vegaprotocol.io/vegacapsule/generator/wallet" "code.vegaprotocol.io/vegacapsule/types" + "golang.org/x/sync/errgroup" ) diff --git a/generator/nomad/nomad.go b/generator/nomad/nomad.go index b9148363..b38f81a8 100644 --- a/generator/nomad/nomad.go +++ b/generator/nomad/nomad.go @@ -6,6 +6,7 @@ import ( "text/template" "code.vegaprotocol.io/vegacapsule/types" + "github.com/Masterminds/sprig" ) diff --git a/generator/tendermint/generator.go b/generator/tendermint/generator.go index a8a35b00..1fe089c6 100644 --- a/generator/tendermint/generator.go +++ b/generator/tendermint/generator.go @@ -19,7 +19,7 @@ import ( ) const ( - nodeDirPerm = 0755 + nodeDirPerm = 0o755 ) type Peer struct { diff --git a/generator/tendermint/templates.go b/generator/tendermint/templates.go index f6a8de95..95fa5072 100644 --- a/generator/tendermint/templates.go +++ b/generator/tendermint/templates.go @@ -8,6 +8,7 @@ import ( "text/template" "code.vegaprotocol.io/vegacapsule/types" + "github.com/Masterminds/sprig" tmconfig "github.com/cometbft/cometbft/config" "github.com/spf13/viper" diff --git a/generator/vega/generator.go b/generator/vega/generator.go index 0190ace4..3c539873 100644 --- a/generator/vega/generator.go +++ b/generator/vega/generator.go @@ -48,7 +48,7 @@ func (vg ConfigGenerator) Initiate( nodeWalletPassFilePath := path.Join(nodeDir, "node-vega-wallet-pass.txt") - if err := os.WriteFile(nodeWalletPassFilePath, []byte(nodeWalletPass), 0644); err != nil { + if err := os.WriteFile(nodeWalletPassFilePath, []byte(nodeWalletPass), 0o644); err != nil { return nil, fmt.Errorf("failed to write node wallet passphrase to file: %w", err) } @@ -114,11 +114,11 @@ func (vg ConfigGenerator) initiateValidatorWallets( walletPassFilePath := path.Join(nodeDir, "vega-wallet-pass.txt") ethereumPassFilePath := path.Join(nodeDir, "ethereum-vega-wallet-pass.txt") - if err := os.WriteFile(walletPassFilePath, []byte(vegaWalletPass), 0644); err != nil { + if err := os.WriteFile(walletPassFilePath, []byte(vegaWalletPass), 0o644); err != nil { return nil, fmt.Errorf("failed to write wallet passphrase to file: %w", err) } - if err := os.WriteFile(ethereumPassFilePath, []byte(ethereumWalletPass), 0644); err != nil { + if err := os.WriteFile(ethereumPassFilePath, []byte(ethereumWalletPass), 0o644); err != nil { return nil, fmt.Errorf("failed to write ethereum wallet passphrase to file: %w", err) } diff --git a/generator/vega/templates.go b/generator/vega/templates.go index 2eb36175..c7ca4ed0 100644 --- a/generator/vega/templates.go +++ b/generator/vega/templates.go @@ -7,8 +7,8 @@ import ( "os" "text/template" - "code.vegaprotocol.io/shared/paths" vgconfig "code.vegaprotocol.io/vega/core/config" + "code.vegaprotocol.io/vega/paths" "code.vegaprotocol.io/vegacapsule/types" "github.com/BurntSushi/toml" diff --git a/generator/visor/templates.go b/generator/visor/templates.go index 18a15634..4b7d7c02 100644 --- a/generator/visor/templates.go +++ b/generator/visor/templates.go @@ -7,9 +7,10 @@ import ( "os" "text/template" - "code.vegaprotocol.io/shared/paths" + "code.vegaprotocol.io/vega/paths" vsconfig "code.vegaprotocol.io/vega/visor/config" "code.vegaprotocol.io/vegacapsule/types" + "github.com/BurntSushi/toml" "github.com/Masterminds/sprig" "github.com/imdario/mergo" diff --git a/generator/wallet/generator.go b/generator/wallet/generator.go index eb97f9fb..645d7bbb 100644 --- a/generator/wallet/generator.go +++ b/generator/wallet/generator.go @@ -8,7 +8,7 @@ import ( "path/filepath" "text/template" - vspaths "code.vegaprotocol.io/shared/paths" + vspaths "code.vegaprotocol.io/vega/paths" vwconfig "code.vegaprotocol.io/vega/wallet/network" "code.vegaprotocol.io/vegacapsule/config" "code.vegaprotocol.io/vegacapsule/types" diff --git a/go.mod b/go.mod index 048126b3..b42e6cdd 100644 --- a/go.mod +++ b/go.mod @@ -5,7 +5,6 @@ go 1.21 toolchain go1.21.5 require ( - code.vegaprotocol.io/shared v0.0.0-20230119125558-bda6563e1c7a code.vegaprotocol.io/vega v0.74.1 github.com/BurntSushi/toml v1.2.1 github.com/Masterminds/sprig v2.22.0+incompatible diff --git a/go.sum b/go.sum index 473b559a..3928a665 100644 --- a/go.sum +++ b/go.sum @@ -36,10 +36,6 @@ cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RX cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0= code.vegaprotocol.io/quant v0.2.5 h1:8h+TTHdz1LCO4oGXt8mbowXszd8CQP1MHlJOkthUp1E= code.vegaprotocol.io/quant v0.2.5/go.mod h1:HEzOoPKj8OIP49r9AZYeo5281M5ygeGWxopwvt8k6Es= -code.vegaprotocol.io/shared v0.0.0-20230119125558-bda6563e1c7a h1:sgniM6sgxPKAStJo2rNoYJR3NMlS/t55H12lvynkw5c= -code.vegaprotocol.io/shared v0.0.0-20230119125558-bda6563e1c7a/go.mod h1:XzX67GsyOHzvytMr0QOHX4CCTdCZDYKUUi88rx40Nt0= -code.vegaprotocol.io/vega v0.73.1-0.20240130125731-d7fcaa73afd7 h1:t3CV1t6r4M9nz12U9U7dA0OQuPGBLOkJxH7oOgWynGI= -code.vegaprotocol.io/vega v0.73.1-0.20240130125731-d7fcaa73afd7/go.mod h1:taCX5tXcjenslMb7yb5+X6jnd/nYpnjM9Jd4MJyCdmQ= code.vegaprotocol.io/vega v0.74.1 h1:XNMTjYBwaD/iMd9MVa0HrKcb49bcOLGhrKHSzo9Qra4= code.vegaprotocol.io/vega v0.74.1/go.mod h1:taCX5tXcjenslMb7yb5+X6jnd/nYpnjM9Jd4MJyCdmQ= contrib.go.opencensus.io/exporter/prometheus v0.4.2 h1:sqfsYl5GIY/L570iT+l93ehxaWJs2/OwXtiWwew3oAg= diff --git a/importer/ethereum.go b/importer/ethereum.go index 495b50ce..bd5132fe 100644 --- a/importer/ethereum.go +++ b/importer/ethereum.go @@ -16,7 +16,7 @@ func importEthereumKey(nodeSet types.NodeSet, ethereumPrivateKey string) (*ether if err != nil { return nil, fmt.Errorf("failed to import private ethereum key into node keystore: %w", err) } - + log.Println("... adding ethereum wallet to the nodewallet") ethImportArgs := []string{ "nodewallet", "import", "--force", diff --git a/importer/tendermint.go b/importer/tendermint.go index 00cf7d91..4efcce3a 100644 --- a/importer/tendermint.go +++ b/importer/tendermint.go @@ -11,6 +11,7 @@ import ( tmgen "code.vegaprotocol.io/vegacapsule/generator/tendermint" "code.vegaprotocol.io/vegacapsule/types" "code.vegaprotocol.io/vegacapsule/utils" + "github.com/tomwright/dasel" "github.com/tomwright/dasel/storage" ) diff --git a/installer/installer.go b/installer/installer.go index dbfca5ef..ee434ab5 100644 --- a/installer/installer.go +++ b/installer/installer.go @@ -12,6 +12,7 @@ import ( "sync" "code.vegaprotocol.io/vegacapsule/utils" + "github.com/blang/semver" "github.com/google/go-github/v43/github" "golang.org/x/sync/errgroup" @@ -149,7 +150,7 @@ func (i Installer) downloadAsset(ctx context.Context, asset asset, releaseTag st } // Make sure the file has executable perms - if err := os.Chmod(binPath, 0700); err != nil { + if err := os.Chmod(binPath, 0o700); err != nil { return "", fmt.Errorf("failed to chmod 0700 file %q: %w", binPath, err) } diff --git a/libs/ethereum/base_token_session.go b/libs/ethereum/base_token_session.go new file mode 100644 index 00000000..62b1b907 --- /dev/null +++ b/libs/ethereum/base_token_session.go @@ -0,0 +1,226 @@ +package ethereum + +import ( + "context" + "crypto/ecdsa" + "fmt" + "math/big" + "time" + + "code.vegaprotocol.io/vegacapsule/libs/ethereum/generated" + + "github.com/ethereum/go-ethereum/accounts/abi/bind" + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/common/hexutil" + "github.com/ethereum/go-ethereum/core/types" +) + +type BaseTokenSession struct { + generated.BaseTokenSession + syncTimeout time.Duration + address common.Address + privateKey *ecdsa.PrivateKey + client *Client +} + +func (ts *BaseTokenSession) Address() common.Address { + return ts.address +} + +func (ts *BaseTokenSession) ApproveSync(spender common.Address, value *big.Int) (*types.Transaction, error) { + sink := make(chan *generated.BaseTokenApproval) + + sub, err := ts.Contract.WatchApproval(&bind.WatchOpts{}, sink, []common.Address{ts.CallOpts.From}, []common.Address{spender}) + if err != nil { + return nil, fmt.Errorf("failed to watch for approval: %w", err) + } + defer sub.Unsubscribe() + + tx, err := ts.Approve(spender, value) + if err != nil { + return nil, err + } + + return wait(sink, sub, tx, ts.syncTimeout) +} + +func (ts *BaseTokenSession) TransferSync(recipient common.Address, value *big.Int) (*types.Transaction, error) { + sink := make(chan *generated.BaseTokenTransfer) + + sub, err := ts.Contract.WatchTransfer(&bind.WatchOpts{}, sink, []common.Address{ts.CallOpts.From}, []common.Address{recipient}) + if err != nil { + return nil, fmt.Errorf("failed to watch for transfer: %w", err) + } + defer sub.Unsubscribe() + + tx, err := ts.Transfer(recipient, value) + if err != nil { + return nil, err + } + + return wait(sink, sub, tx, ts.syncTimeout) +} + +func (ts *BaseTokenSession) TransferFromSync(sender common.Address, recipient common.Address, value *big.Int) (*types.Transaction, error) { + sink := make(chan *generated.BaseTokenTransfer) + + sub, err := ts.Contract.WatchTransfer(&bind.WatchOpts{}, sink, []common.Address{sender}, []common.Address{recipient}) + if err != nil { + return nil, fmt.Errorf("failed to watch for transfer: %w", err) + } + defer sub.Unsubscribe() + + tx, err := ts.TransferFrom(sender, recipient, value) + if err != nil { + return nil, err + } + + return wait(sink, sub, tx, ts.syncTimeout) +} + +func (ts *BaseTokenSession) MintSync(to common.Address, amount *big.Int) (*types.Transaction, error) { + sink := make(chan *generated.BaseTokenTransfer) + + sub, err := ts.Contract.WatchTransfer(&bind.WatchOpts{}, sink, []common.Address{common.BigToAddress(common.Big0)}, []common.Address{to}) + if err != nil { + return nil, fmt.Errorf("failed to watch for transfer: %w", err) + } + defer sub.Unsubscribe() + + tx, err := ts.Mint(to, amount) + if err != nil { + return nil, fmt.Errorf("failed to mint %s: %w", to, err) + } + + tx, err = wait(sink, sub, tx, ts.syncTimeout) + if err != nil { + return nil, fmt.Errorf("failed to wait for mint: %w", err) + } + + return tx, nil +} + +// MintRawSync is an experimental way of minting new tokens. It attempts to execute an on-chain transaction that +// runs a Yul script which loops over the "faucet" method until either of the following happens: +// 1. the target balance is reached, +// 2. the caller runs out of gas. +// +// Use this method only if the "mint" contract method is not available, or a non-owner account is the caller. +// The execution time is very slow so the (context) timeout for it should be higher than for other methods. +func (ts *BaseTokenSession) MintRawSync(ctx context.Context, to common.Address, amount *big.Int) (*big.Int, error) { + tx, err := ts.MintRaw(to, amount) + if err != nil { + return nil, fmt.Errorf("failed to mint raw: %w", err) + } + + minted, err := ts.GetLastTransferValueSync(ctx, tx) + if err != nil { + return nil, fmt.Errorf("failed to wait for last value: %w", err) + } + + return minted, nil +} + +// MintRaw is an experimental way of minting new tokens. It attempts to execute an on-chain transaction that +// runs a Yul script which loops over the "faucet" method until either of the following happens: +// 1. the target balance is reached, +// 2. the caller runs out of gas. +// +// Use this method only if the "mint" contract method is not available, or a non-owner account is the caller. +func (ts *BaseTokenSession) MintRaw(to common.Address, amount *big.Int) (*types.Transaction, error) { + if amount == nil || amount.Cmp(big.NewInt(0)) == 0 { + return nil, fmt.Errorf("amount must be not be nil and greater than 0") + } + + balance, err := ts.BalanceOf(to) + if err != nil { + return nil, fmt.Errorf("failed to get balance: %w", err) + } + + targetBalance := new(big.Int).Add(balance, amount) + + tx, err := ts.mintRaw(to, targetBalance) + if err != nil { + return nil, fmt.Errorf("failed to mint: %w", err) + } + + return tx, nil +} + +func (ts *BaseTokenSession) mintRaw(to common.Address, targetBalance *big.Int) (*types.Transaction, error) { + signedTx, err := ts.createMintSignedTx(to, targetBalance) + if err != nil { + return nil, fmt.Errorf("failed to create signed mint tx: %w", err) + } + + if err = ts.client.SendTransaction(ts.CallOpts.Context, signedTx); err != nil { + return nil, fmt.Errorf("failed to send transaction: %w", err) + } + + return signedTx, nil +} + +func (ts *BaseTokenSession) GetLastTransferValueSync(ctx context.Context, signedTx *types.Transaction) (*big.Int, error) { + receipt, err := bind.WaitMined(ctx, ts.client, signedTx) + if err != nil { + return nil, fmt.Errorf("failed to wait for transaction to be mined: %w", err) + } + + if len(receipt.Logs) == 0 { + return nil, fmt.Errorf("no logs in transaction") + } + + // last transfer event + log := receipt.Logs[len(receipt.Logs)-1] + + transfer, err := ts.Contract.ParseTransfer(*log) + if err != nil { + return nil, fmt.Errorf("failed to parse transfer: %w", err) + } + + return transfer.Value, nil +} + +func (ts *BaseTokenSession) createMintSignedTx(to common.Address, targetBalance *big.Int) (*types.Transaction, error) { + nonce, err := ts.client.PendingNonceAt(ts.CallOpts.Context, to) + if err != nil { + return nil, fmt.Errorf("failed to get nonce: %w", err) + } + + gasPrice, err := ts.client.SuggestGasPrice(ts.CallOpts.Context) + if err != nil { + return nil, fmt.Errorf("failed to get gas price: %w", err) + } + + // use maximum gas limit of 30m + gasLimit := new(big.Int).Mul(big.NewInt(30), new(big.Int).Exp(big.NewInt(10), big.NewInt(6), nil)) + + data, err := ts.prepareMintBytecode(targetBalance) + if err != nil { + return nil, fmt.Errorf("failed to prepare data: %w", err) + } + + tx := types.NewContractCreation(nonce, big.NewInt(0), gasLimit.Uint64(), gasPrice, data) + + signedTx, err := types.SignTx(tx, types.HomesteadSigner{}, ts.privateKey) + if err != nil { + return nil, fmt.Errorf("failed to sign transaction: %w", err) + } + + return signedTx, nil +} + +func (ts *BaseTokenSession) prepareMintBytecode(targetBalance *big.Int) ([]byte, error) { + const script = `0x6000603460be8239805160601c9060145160183384609f565b908181116043575b82806044818088602f3082609f565b5063a9059cbb60e01b600052336004525af1005b63de5f72fd60e01b600052600492918280858180895af15060633086609f565b63de5f72fd60e01b60005291030491815b8381105a61ea6010161560925760019083808481808a5af150016074565b5090915060449050816020565b6024600081926044946370a0823160e01b83526004525afa506024519056` + + hexCode, err := hexutil.Decode(script) + if err != nil { + return nil, fmt.Errorf("failed to decode script: %w", err) + } + + var data []byte + data = append(data, hexCode...) + data = append(data, ts.address.Bytes()...) + data = append(data, common.LeftPadBytes(targetBalance.Bytes(), 32)...) + return data, nil +} diff --git a/libs/ethereum/base_token_session_test.go b/libs/ethereum/base_token_session_test.go new file mode 100644 index 00000000..09c87dfc --- /dev/null +++ b/libs/ethereum/base_token_session_test.go @@ -0,0 +1,30 @@ +package ethereum + +import ( + "fmt" + "math/big" + "reflect" + "testing" + + "github.com/ethereum/go-ethereum/common" +) + +func TestBaseTokenSession_prepareRawMintData(t *testing.T) { + want := "6000603460be8239805160601c9060145160183384609f565b908181116043575b82806044818088602f3082609f565b5063a9059cbb60e01b600052336004525af1005b63de5f72fd60e01b600052600492918280858180895af15060633086609f565b63de5f72fd60e01b60005291030491815b8381105a61ea6010161560925760019083808481808a5af150016074565b5090915060449050816020565b6024600081926044946370a0823160e01b83526004525afa5060245190563773a5c7aff77e014cbf067dd31801b4c6dc4136000000000000000000000000000000000000000000000000000006faf9a60e00" + + ts := &BaseTokenSession{ + address: common.HexToAddress("0x3773A5c7aFF77e014cBF067dd31801b4C6dc4136"), + } + + targetBalance := big.NewInt(7675000000000) + + got, err := ts.prepareMintBytecode(targetBalance) + if err != nil { + t.Errorf("prepareMintBytecode() error = %s", err) + return + } + + if !reflect.DeepEqual(fmt.Sprintf("%x", got), want) { + t.Errorf("prepareMintBytecode() got = %x, want %s", got, want) + } +} diff --git a/libs/ethereum/client.go b/libs/ethereum/client.go new file mode 100644 index 00000000..890922e4 --- /dev/null +++ b/libs/ethereum/client.go @@ -0,0 +1,195 @@ +package ethereum + +import ( + "context" + "encoding/hex" + "fmt" + "math/big" + "net/url" + "time" + + "code.vegaprotocol.io/vegacapsule/libs/ethereum/generated" + + "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/crypto" + "github.com/ethereum/go-ethereum/ethclient" + "github.com/ethereum/go-ethereum/event" +) + +var defaultSyncDuration = time.Second * 5 + +type Client struct { + *ethclient.Client + chainID *big.Int +} + +func NewClient(ctx context.Context, ethereumAddress string) (*Client, error) { + addr, err := url.Parse(ethereumAddress) + if err != nil { + return nil, fmt.Errorf("failed to parse Ethereum address: %w", err) + } + + if addr.Scheme != "ws" && addr.Scheme != "wss" { + return nil, fmt.Errorf("address scheme needs to be 'ws' or 'wss': %q", addr.Scheme) + } + + client, err := ethclient.DialContext(ctx, addr.String()) + if err != nil { + return nil, fmt.Errorf("failed to dial Ethereum client: %s", err) + } + + chainID, err := client.ChainID(ctx) + if err != nil { + return nil, fmt.Errorf("failed to get chain ID: %w", err) + } + + return &Client{ + chainID: chainID, + Client: client, + }, nil +} + +func (ec *Client) NewERC20BridgeSession( + ctx context.Context, + contractOwnerPrivateKey string, + bridgeAddress common.Address, + syncTimeout *time.Duration, +) (*ERC20BridgeSession, error) { + privateKey, err := crypto.HexToECDSA(contractOwnerPrivateKey) + if err != nil { + return nil, fmt.Errorf("failed to convert erc20 bridge contract owner private key hash into ECDSA: %w", err) + } + + auth, err := bind.NewKeyedTransactorWithChainID(privateKey, ec.chainID) + if err != nil { + return nil, fmt.Errorf("failed to create erc20 bridge contract authentication: %w", err) + } + + bridge, err := generated.NewERC20Bridge(bridgeAddress, ec.Client) + if err != nil { + return nil, fmt.Errorf("failed creating erc20 bridge contract for address %q: %w", bridgeAddress, err) + } + + if syncTimeout == nil { + syncTimeout = &defaultSyncDuration + } + + return &ERC20BridgeSession{ + ERC20BridgeSession: generated.ERC20BridgeSession{ + Contract: bridge, + CallOpts: bind.CallOpts{ + From: auth.From, + Context: ctx, + }, + TransactOpts: *auth, + }, + syncTimeout: *syncTimeout, + address: bridgeAddress, + }, nil +} + +func (ec *Client) NewStakingBridgeSession( + ctx context.Context, + contractOwnerPrivateKey string, + bridgeAddress common.Address, + syncTimeout *time.Duration, +) (*StakingBridgeSession, error) { + privateKey, err := crypto.HexToECDSA(contractOwnerPrivateKey) + if err != nil { + return nil, fmt.Errorf("failed to convert staking bridge contract owner private key hash into ECDSA: %w", err) + } + + auth, err := bind.NewKeyedTransactorWithChainID(privateKey, ec.chainID) + if err != nil { + return nil, fmt.Errorf("failed to create staking bridge contract authentication: %w", err) + } + + bridge, err := generated.NewStakingBridge(bridgeAddress, ec.Client) + if err != nil { + return nil, fmt.Errorf("failed creating staking bridge contract for address %q: %w", bridgeAddress, err) + } + + if syncTimeout == nil { + syncTimeout = &defaultSyncDuration + } + + return &StakingBridgeSession{ + StakingBridgeSession: generated.StakingBridgeSession{ + Contract: bridge, + CallOpts: bind.CallOpts{ + From: auth.From, + Context: ctx, + }, + TransactOpts: *auth, + }, + syncTimeout: *syncTimeout, + address: bridgeAddress, + }, nil +} + +func (ec *Client) NewBaseTokenSession( + ctx context.Context, + contractOwnerPrivateKey string, + tokenAddress common.Address, + syncTimeout *time.Duration, +) (*BaseTokenSession, error) { + privateKey, err := crypto.HexToECDSA(contractOwnerPrivateKey) + if err != nil { + return nil, fmt.Errorf("failed to convert base token contract owner private key hash into ECDSA: %w", err) + } + + auth, err := bind.NewKeyedTransactorWithChainID(privateKey, ec.chainID) + if err != nil { + return nil, fmt.Errorf("failed to create base token contract authentication: %w", err) + } + + token, err := generated.NewBaseToken(tokenAddress, ec.Client) + if err != nil { + return nil, fmt.Errorf("failed creating base token contract for address %q: %w", tokenAddress, err) + } + + if syncTimeout == nil { + syncTimeout = &defaultSyncDuration + } + + return &BaseTokenSession{ + BaseTokenSession: generated.BaseTokenSession{ + Contract: token, + CallOpts: bind.CallOpts{ + From: auth.From, + Context: ctx, + }, + TransactOpts: *auth, + }, + syncTimeout: *syncTimeout, + address: tokenAddress, + privateKey: privateKey, + client: ec, + }, nil +} + +func wait[T any](sink chan T, sub event.Subscription, tx *types.Transaction, timeout time.Duration) (*types.Transaction, error) { + select { + case <-sink: + return tx, nil + case err := <-sub.Err(): + return nil, err + case <-time.After(timeout): + return nil, fmt.Errorf("transaction time has timed out") + } +} + +func HexStringToByte32Array(str string) ([32]byte, error) { + value := [32]byte{} + + decoded, err := hex.DecodeString(str) + if err != nil { + return value, err + } + + copy(value[:], decoded) + + return value, nil +} diff --git a/libs/ethereum/client_test.go b/libs/ethereum/client_test.go new file mode 100644 index 00000000..cd2520ce --- /dev/null +++ b/libs/ethereum/client_test.go @@ -0,0 +1,160 @@ +package ethereum_test + +import ( + "context" + "fmt" + "math/big" + "os" + "testing" + + vgethereum "code.vegaprotocol.io/vegacapsule/libs/ethereum" + + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/core/types" +) + +var ( + erc20BridgeAddress = common.HexToAddress("0x9708FF7510D4A7B9541e1699d15b53Ecb1AFDc54") + stakingBridgeAddress = common.HexToAddress("0x9135f5afd6F055e731bca2348429482eE614CFfA") + tUSDCTokenAddress = common.HexToAddress("0x1b8a1B6CBE5c93609b46D1829Cc7f3Cb8eeE23a0") + vegaTokenAddress = common.HexToAddress("0x67175Da1D5e966e40D11c4B2519392B2058373de") + contractOwnerAddress = common.HexToAddress("0xEe7D375bcB50C26d52E1A4a472D8822A2A22d94F") + + vegaPubKey = "321b470cddc840854fb33b34674683cae3201c7b3eceffa927f663549f17484f" + contractOwnerPrivateKey = "a37f4c2a678aefb5037bf415a826df1540b330b7e471aa54184877ba901b9ef0" +) + +type token interface { + Mint(to common.Address, amount *big.Int) (*types.Transaction, error) + MintSync(to common.Address, amount *big.Int) (*types.Transaction, error) + BalanceOf(account common.Address) (*big.Int, error) + ApproveSync(spender common.Address, value *big.Int) (*types.Transaction, error) + Address() common.Address +} + +func mintTokenAndShowBalances(token token, address common.Address, amount *big.Int) error { + fmt.Println("---- Minting new token") + + balance, err := token.BalanceOf(address) + if err != nil { + return fmt.Errorf("failed to get balance for %s: %s", address.String(), err) + } + fmt.Printf("Initial balance of %s is %s \n", address, balance) + + fmt.Printf("Minting token %s amount %s for %s \n", token.Address(), amount, address) + if _, err := token.MintSync(address, amount); err != nil { + return fmt.Errorf("failed to call Mint contract: %s", err) + } + + balance, err = token.BalanceOf(address) + if err != nil { + return fmt.Errorf("failed to get balance for %s: %s", address.String(), err) + } + + fmt.Printf("Balance of %s after mint is %s \n", address, balance) + + fmt.Println("---- Token minted") + + return nil +} + +func approveAndDepositToken(token token, bridge *vgethereum.ERC20BridgeSession, amount *big.Int, vegaPubKey string) error { + fmt.Println("---- Deposit token") + + fmt.Printf("Approving token %s amount %s for %s \n", token.Address(), amount, bridge.Address()) + if _, err := token.ApproveSync(bridge.Address(), amount); err != nil { + return fmt.Errorf("failed to approve token: %w", err) + } + + fmt.Printf("Depositing asset %s amout %s Vega pub key %s \n", token.Address(), amount, bridge.Address()) + + vegaPubKeyByte32, err := vgethereum.HexStringToByte32Array(vegaPubKey) + if err != nil { + return err + } + + if _, err := bridge.DepositAssetSync(token.Address(), amount, vegaPubKeyByte32); err != nil { + return fmt.Errorf("failed to deposit asset: %w", err) + } + + fmt.Println("---- Token deposited") + + return nil +} + +func approveAndStakeToken(token token, bridge *vgethereum.StakingBridgeSession, amount *big.Int, vegaPubKey string) error { + fmt.Println("---- Stake token") + + fmt.Printf("Approving token %s amount %s for %s \n", token.Address(), amount, bridge.Address()) + if _, err := token.ApproveSync(bridge.Address(), amount); err != nil { + return fmt.Errorf("failed to approve token: %w", err) + } + + vegaPubKeyByte32, err := vgethereum.HexStringToByte32Array(vegaPubKey) + if err != nil { + return err + } + + fmt.Printf("Staking asset %s amout %s Vega pub key %s \n", token.Address(), amount, bridge.Address()) + if _, err := bridge.Stake(amount, vegaPubKeyByte32); err != nil { + return fmt.Errorf("failed to stake asset: %w", err) + } + + fmt.Println("---- Token staked") + + return nil +} + +func TestClient(t *testing.T) { + ethereumAddress := os.Getenv("ETHEREUM_CLIENT_ADDRESS") + if ethereumAddress == "" { + t.Skip("skipping Ethereum client test, set environment variable ETHEREUM_CLIENT_ADDRESS to run it") + } + + amount := big.NewInt(1000000000000000000) + + ctx := context.Background() + + client, err := vgethereum.NewClient(ctx, ethereumAddress) + if err != nil { + t.Fatalf("Failed to create Ethereum client: %s", err) + } + + stakingBridge, err := client.NewStakingBridgeSession(ctx, contractOwnerPrivateKey, stakingBridgeAddress, nil) + if err != nil { + t.Fatalf("Failed to create staking bridge: %s", err) + } + + erc20bridge, err := client.NewERC20BridgeSession(ctx, contractOwnerPrivateKey, erc20BridgeAddress, nil) + if err != nil { + t.Fatalf("Failed to create staking bridge: %s", err) + } + + tUSDCToken, err := client.NewBaseTokenSession(ctx, contractOwnerPrivateKey, tUSDCTokenAddress, nil) + if err != nil { + t.Fatalf("Failed to create tUSDC token: %s", err) + } + + vegaToken, err := client.NewBaseTokenSession(ctx, contractOwnerPrivateKey, vegaTokenAddress, nil) + if err != nil { + t.Fatalf("Failed to create vega token: %s", err) + } + + if err := mintTokenAndShowBalances(tUSDCToken, contractOwnerAddress, amount); err != nil { + t.Fatalf("Failed to mint and show balances for tUSDCToken: %s", err) + } + + if err := mintTokenAndShowBalances(vegaToken, contractOwnerAddress, amount); err != nil { + t.Fatalf("Failed to mint and show balances for vegaToken: %s", err) + } + + if err := approveAndDepositToken(tUSDCToken, erc20bridge, amount, vegaPubKey); err != nil { + t.Fatalf("Failed to approve and deposit token on erc20 bridge: %s", err) + } + + if err := approveAndStakeToken(vegaToken, stakingBridge, amount, vegaPubKey); err != nil { + t.Fatalf("Failed to approve and stake token on staking bridge: %s", err) + } + + fmt.Println("Done") +} diff --git a/libs/ethereum/erc20_bridge_session.go b/libs/ethereum/erc20_bridge_session.go new file mode 100644 index 00000000..077bc4df --- /dev/null +++ b/libs/ethereum/erc20_bridge_session.go @@ -0,0 +1,40 @@ +package ethereum + +import ( + "fmt" + "math/big" + "time" + + "code.vegaprotocol.io/vegacapsule/libs/ethereum/generated" + + "github.com/ethereum/go-ethereum/accounts/abi/bind" + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/core/types" +) + +type ERC20BridgeSession struct { + generated.ERC20BridgeSession + syncTimeout time.Duration + address common.Address +} + +func (bs ERC20BridgeSession) Address() common.Address { + return bs.address +} + +func (bs ERC20BridgeSession) DepositAssetSync(asset_source common.Address, amount *big.Int, vega_public_key [32]byte) (*types.Transaction, error) { + sink := make(chan *generated.ERC20BridgeAssetDeposited) + + sub, err := bs.Contract.WatchAssetDeposited(&bind.WatchOpts{}, sink, []common.Address{}, []common.Address{asset_source}) + if err != nil { + return nil, fmt.Errorf("failed to watch for deposit: %w", err) + } + defer sub.Unsubscribe() + + tx, err := bs.DepositAsset(asset_source, amount, vega_public_key) + if err != nil { + return nil, err + } + + return wait(sink, sub, tx, bs.syncTimeout) +} diff --git a/libs/ethereum/generated/base_token.go b/libs/ethereum/generated/base_token.go new file mode 100644 index 00000000..1e64e2b9 --- /dev/null +++ b/libs/ethereum/generated/base_token.go @@ -0,0 +1,1183 @@ +// Code generated - DO NOT EDIT. +// This file is a generated binding and any manual changes will be lost. + +package generated + +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 +) + +// BaseTokenMetaData contains all meta data concerning the BaseToken contract. +var BaseTokenMetaData = &bind.MetaData{ + ABI: "[{\"inputs\":[{\"internalType\":\"string\",\"name\":\"_name\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"_symbol\",\"type\":\"string\"},{\"internalType\":\"uint8\",\"name\":\"_decimals\",\"type\":\"uint8\"},{\"internalType\":\"uint256\",\"name\":\"total_supply_whole_tokens\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"faucet_amount\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"}],\"name\":\"Approval\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"}],\"name\":\"Transfer\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"bridge_address\",\"type\":\"address\"},{\"internalType\":\"bytes32[]\",\"name\":\"vega_public_keys\",\"type\":\"bytes32[]\"}],\"name\":\"admin_deposit_bulk\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"bridge_address\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"vega_public_key\",\"type\":\"bytes32\"}],\"name\":\"admin_deposit_single\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"staking_bridge_address\",\"type\":\"address\"},{\"internalType\":\"bytes32[]\",\"name\":\"vega_public_keys\",\"type\":\"bytes32[]\"}],\"name\":\"admin_stake_bulk\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"}],\"name\":\"allowance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"}],\"name\":\"approve\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"balanceOf\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"decimals\",\"outputs\":[{\"internalType\":\"uint8\",\"name\":\"\",\"type\":\"uint8\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"subtractedValue\",\"type\":\"uint256\"}],\"name\":\"decreaseAllowance\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"faucet\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"addedValue\",\"type\":\"uint256\"}],\"name\":\"increaseAllowance\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"isOwner\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"}],\"name\":\"issue\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"kill\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"mint\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"name\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"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\":\"symbol\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"totalSupply\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"transfer\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"transferFrom\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]", +} + +// BaseTokenABI is the input ABI used to generate the binding from. +// Deprecated: Use BaseTokenMetaData.ABI instead. +var BaseTokenABI = BaseTokenMetaData.ABI + +// BaseToken is an auto generated Go binding around an Ethereum contract. +type BaseToken struct { + BaseTokenCaller // Read-only binding to the contract + BaseTokenTransactor // Write-only binding to the contract + BaseTokenFilterer // Log filterer for contract events +} + +// BaseTokenCaller is an auto generated read-only Go binding around an Ethereum contract. +type BaseTokenCaller struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// BaseTokenTransactor is an auto generated write-only Go binding around an Ethereum contract. +type BaseTokenTransactor struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// BaseTokenFilterer is an auto generated log filtering Go binding around an Ethereum contract events. +type BaseTokenFilterer struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// BaseTokenSession is an auto generated Go binding around an Ethereum contract, +// with pre-set call and transact options. +type BaseTokenSession struct { + Contract *BaseToken // 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 +} + +// BaseTokenCallerSession is an auto generated read-only Go binding around an Ethereum contract, +// with pre-set call options. +type BaseTokenCallerSession struct { + Contract *BaseTokenCaller // Generic contract caller binding to set the session for + CallOpts bind.CallOpts // Call options to use throughout this session +} + +// BaseTokenTransactorSession is an auto generated write-only Go binding around an Ethereum contract, +// with pre-set transact options. +type BaseTokenTransactorSession struct { + Contract *BaseTokenTransactor // Generic contract transactor binding to set the session for + TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session +} + +// BaseTokenRaw is an auto generated low-level Go binding around an Ethereum contract. +type BaseTokenRaw struct { + Contract *BaseToken // Generic contract binding to access the raw methods on +} + +// BaseTokenCallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract. +type BaseTokenCallerRaw struct { + Contract *BaseTokenCaller // Generic read-only contract binding to access the raw methods on +} + +// BaseTokenTransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract. +type BaseTokenTransactorRaw struct { + Contract *BaseTokenTransactor // Generic write-only contract binding to access the raw methods on +} + +// NewBaseToken creates a new instance of BaseToken, bound to a specific deployed contract. +func NewBaseToken(address common.Address, backend bind.ContractBackend) (*BaseToken, error) { + contract, err := bindBaseToken(address, backend, backend, backend) + if err != nil { + return nil, err + } + return &BaseToken{BaseTokenCaller: BaseTokenCaller{contract: contract}, BaseTokenTransactor: BaseTokenTransactor{contract: contract}, BaseTokenFilterer: BaseTokenFilterer{contract: contract}}, nil +} + +// NewBaseTokenCaller creates a new read-only instance of BaseToken, bound to a specific deployed contract. +func NewBaseTokenCaller(address common.Address, caller bind.ContractCaller) (*BaseTokenCaller, error) { + contract, err := bindBaseToken(address, caller, nil, nil) + if err != nil { + return nil, err + } + return &BaseTokenCaller{contract: contract}, nil +} + +// NewBaseTokenTransactor creates a new write-only instance of BaseToken, bound to a specific deployed contract. +func NewBaseTokenTransactor(address common.Address, transactor bind.ContractTransactor) (*BaseTokenTransactor, error) { + contract, err := bindBaseToken(address, nil, transactor, nil) + if err != nil { + return nil, err + } + return &BaseTokenTransactor{contract: contract}, nil +} + +// NewBaseTokenFilterer creates a new log filterer instance of BaseToken, bound to a specific deployed contract. +func NewBaseTokenFilterer(address common.Address, filterer bind.ContractFilterer) (*BaseTokenFilterer, error) { + contract, err := bindBaseToken(address, nil, nil, filterer) + if err != nil { + return nil, err + } + return &BaseTokenFilterer{contract: contract}, nil +} + +// bindBaseToken binds a generic wrapper to an already deployed contract. +func bindBaseToken(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) { + parsed, err := abi.JSON(strings.NewReader(BaseTokenABI)) + 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 (_BaseToken *BaseTokenRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { + return _BaseToken.Contract.BaseTokenCaller.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 (_BaseToken *BaseTokenRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _BaseToken.Contract.BaseTokenTransactor.contract.Transfer(opts) +} + +// Transact invokes the (paid) contract method with params as input values. +func (_BaseToken *BaseTokenRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _BaseToken.Contract.BaseTokenTransactor.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 (_BaseToken *BaseTokenCallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { + return _BaseToken.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 (_BaseToken *BaseTokenTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _BaseToken.Contract.contract.Transfer(opts) +} + +// Transact invokes the (paid) contract method with params as input values. +func (_BaseToken *BaseTokenTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _BaseToken.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 (_BaseToken *BaseTokenCaller) Allowance(opts *bind.CallOpts, owner common.Address, spender common.Address) (*big.Int, error) { + var out []interface{} + err := _BaseToken.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 (_BaseToken *BaseTokenSession) Allowance(owner common.Address, spender common.Address) (*big.Int, error) { + return _BaseToken.Contract.Allowance(&_BaseToken.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 (_BaseToken *BaseTokenCallerSession) Allowance(owner common.Address, spender common.Address) (*big.Int, error) { + return _BaseToken.Contract.Allowance(&_BaseToken.CallOpts, owner, spender) +} + +// BalanceOf is a free data retrieval call binding the contract method 0x70a08231. +// +// Solidity: function balanceOf(address account) view returns(uint256) +func (_BaseToken *BaseTokenCaller) BalanceOf(opts *bind.CallOpts, account common.Address) (*big.Int, error) { + var out []interface{} + err := _BaseToken.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 (_BaseToken *BaseTokenSession) BalanceOf(account common.Address) (*big.Int, error) { + return _BaseToken.Contract.BalanceOf(&_BaseToken.CallOpts, account) +} + +// BalanceOf is a free data retrieval call binding the contract method 0x70a08231. +// +// Solidity: function balanceOf(address account) view returns(uint256) +func (_BaseToken *BaseTokenCallerSession) BalanceOf(account common.Address) (*big.Int, error) { + return _BaseToken.Contract.BalanceOf(&_BaseToken.CallOpts, account) +} + +// Decimals is a free data retrieval call binding the contract method 0x313ce567. +// +// Solidity: function decimals() view returns(uint8) +func (_BaseToken *BaseTokenCaller) Decimals(opts *bind.CallOpts) (uint8, error) { + var out []interface{} + err := _BaseToken.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 (_BaseToken *BaseTokenSession) Decimals() (uint8, error) { + return _BaseToken.Contract.Decimals(&_BaseToken.CallOpts) +} + +// Decimals is a free data retrieval call binding the contract method 0x313ce567. +// +// Solidity: function decimals() view returns(uint8) +func (_BaseToken *BaseTokenCallerSession) Decimals() (uint8, error) { + return _BaseToken.Contract.Decimals(&_BaseToken.CallOpts) +} + +// IsOwner is a free data retrieval call binding the contract method 0x8f32d59b. +// +// Solidity: function isOwner() view returns(bool) +func (_BaseToken *BaseTokenCaller) IsOwner(opts *bind.CallOpts) (bool, error) { + var out []interface{} + err := _BaseToken.contract.Call(opts, &out, "isOwner") + + if err != nil { + return *new(bool), err + } + + out0 := *abi.ConvertType(out[0], new(bool)).(*bool) + + return out0, err + +} + +// IsOwner is a free data retrieval call binding the contract method 0x8f32d59b. +// +// Solidity: function isOwner() view returns(bool) +func (_BaseToken *BaseTokenSession) IsOwner() (bool, error) { + return _BaseToken.Contract.IsOwner(&_BaseToken.CallOpts) +} + +// IsOwner is a free data retrieval call binding the contract method 0x8f32d59b. +// +// Solidity: function isOwner() view returns(bool) +func (_BaseToken *BaseTokenCallerSession) IsOwner() (bool, error) { + return _BaseToken.Contract.IsOwner(&_BaseToken.CallOpts) +} + +// Name is a free data retrieval call binding the contract method 0x06fdde03. +// +// Solidity: function name() view returns(string) +func (_BaseToken *BaseTokenCaller) Name(opts *bind.CallOpts) (string, error) { + var out []interface{} + err := _BaseToken.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 (_BaseToken *BaseTokenSession) Name() (string, error) { + return _BaseToken.Contract.Name(&_BaseToken.CallOpts) +} + +// Name is a free data retrieval call binding the contract method 0x06fdde03. +// +// Solidity: function name() view returns(string) +func (_BaseToken *BaseTokenCallerSession) Name() (string, error) { + return _BaseToken.Contract.Name(&_BaseToken.CallOpts) +} + +// Owner is a free data retrieval call binding the contract method 0x8da5cb5b. +// +// Solidity: function owner() view returns(address) +func (_BaseToken *BaseTokenCaller) Owner(opts *bind.CallOpts) (common.Address, error) { + var out []interface{} + err := _BaseToken.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 (_BaseToken *BaseTokenSession) Owner() (common.Address, error) { + return _BaseToken.Contract.Owner(&_BaseToken.CallOpts) +} + +// Owner is a free data retrieval call binding the contract method 0x8da5cb5b. +// +// Solidity: function owner() view returns(address) +func (_BaseToken *BaseTokenCallerSession) Owner() (common.Address, error) { + return _BaseToken.Contract.Owner(&_BaseToken.CallOpts) +} + +// Symbol is a free data retrieval call binding the contract method 0x95d89b41. +// +// Solidity: function symbol() view returns(string) +func (_BaseToken *BaseTokenCaller) Symbol(opts *bind.CallOpts) (string, error) { + var out []interface{} + err := _BaseToken.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 (_BaseToken *BaseTokenSession) Symbol() (string, error) { + return _BaseToken.Contract.Symbol(&_BaseToken.CallOpts) +} + +// Symbol is a free data retrieval call binding the contract method 0x95d89b41. +// +// Solidity: function symbol() view returns(string) +func (_BaseToken *BaseTokenCallerSession) Symbol() (string, error) { + return _BaseToken.Contract.Symbol(&_BaseToken.CallOpts) +} + +// TotalSupply is a free data retrieval call binding the contract method 0x18160ddd. +// +// Solidity: function totalSupply() view returns(uint256) +func (_BaseToken *BaseTokenCaller) TotalSupply(opts *bind.CallOpts) (*big.Int, error) { + var out []interface{} + err := _BaseToken.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 (_BaseToken *BaseTokenSession) TotalSupply() (*big.Int, error) { + return _BaseToken.Contract.TotalSupply(&_BaseToken.CallOpts) +} + +// TotalSupply is a free data retrieval call binding the contract method 0x18160ddd. +// +// Solidity: function totalSupply() view returns(uint256) +func (_BaseToken *BaseTokenCallerSession) TotalSupply() (*big.Int, error) { + return _BaseToken.Contract.TotalSupply(&_BaseToken.CallOpts) +} + +// AdminDepositBulk is a paid mutator transaction binding the contract method 0xbc36878e. +// +// Solidity: function admin_deposit_bulk(uint256 amount, address bridge_address, bytes32[] vega_public_keys) returns() +func (_BaseToken *BaseTokenTransactor) AdminDepositBulk(opts *bind.TransactOpts, amount *big.Int, bridge_address common.Address, vega_public_keys [][32]byte) (*types.Transaction, error) { + return _BaseToken.contract.Transact(opts, "admin_deposit_bulk", amount, bridge_address, vega_public_keys) +} + +// AdminDepositBulk is a paid mutator transaction binding the contract method 0xbc36878e. +// +// Solidity: function admin_deposit_bulk(uint256 amount, address bridge_address, bytes32[] vega_public_keys) returns() +func (_BaseToken *BaseTokenSession) AdminDepositBulk(amount *big.Int, bridge_address common.Address, vega_public_keys [][32]byte) (*types.Transaction, error) { + return _BaseToken.Contract.AdminDepositBulk(&_BaseToken.TransactOpts, amount, bridge_address, vega_public_keys) +} + +// AdminDepositBulk is a paid mutator transaction binding the contract method 0xbc36878e. +// +// Solidity: function admin_deposit_bulk(uint256 amount, address bridge_address, bytes32[] vega_public_keys) returns() +func (_BaseToken *BaseTokenTransactorSession) AdminDepositBulk(amount *big.Int, bridge_address common.Address, vega_public_keys [][32]byte) (*types.Transaction, error) { + return _BaseToken.Contract.AdminDepositBulk(&_BaseToken.TransactOpts, amount, bridge_address, vega_public_keys) +} + +// AdminDepositSingle is a paid mutator transaction binding the contract method 0xb777374c. +// +// Solidity: function admin_deposit_single(uint256 amount, address bridge_address, bytes32 vega_public_key) returns() +func (_BaseToken *BaseTokenTransactor) AdminDepositSingle(opts *bind.TransactOpts, amount *big.Int, bridge_address common.Address, vega_public_key [32]byte) (*types.Transaction, error) { + return _BaseToken.contract.Transact(opts, "admin_deposit_single", amount, bridge_address, vega_public_key) +} + +// AdminDepositSingle is a paid mutator transaction binding the contract method 0xb777374c. +// +// Solidity: function admin_deposit_single(uint256 amount, address bridge_address, bytes32 vega_public_key) returns() +func (_BaseToken *BaseTokenSession) AdminDepositSingle(amount *big.Int, bridge_address common.Address, vega_public_key [32]byte) (*types.Transaction, error) { + return _BaseToken.Contract.AdminDepositSingle(&_BaseToken.TransactOpts, amount, bridge_address, vega_public_key) +} + +// AdminDepositSingle is a paid mutator transaction binding the contract method 0xb777374c. +// +// Solidity: function admin_deposit_single(uint256 amount, address bridge_address, bytes32 vega_public_key) returns() +func (_BaseToken *BaseTokenTransactorSession) AdminDepositSingle(amount *big.Int, bridge_address common.Address, vega_public_key [32]byte) (*types.Transaction, error) { + return _BaseToken.Contract.AdminDepositSingle(&_BaseToken.TransactOpts, amount, bridge_address, vega_public_key) +} + +// AdminStakeBulk is a paid mutator transaction binding the contract method 0xd779cae8. +// +// Solidity: function admin_stake_bulk(uint256 amount, address staking_bridge_address, bytes32[] vega_public_keys) returns() +func (_BaseToken *BaseTokenTransactor) AdminStakeBulk(opts *bind.TransactOpts, amount *big.Int, staking_bridge_address common.Address, vega_public_keys [][32]byte) (*types.Transaction, error) { + return _BaseToken.contract.Transact(opts, "admin_stake_bulk", amount, staking_bridge_address, vega_public_keys) +} + +// AdminStakeBulk is a paid mutator transaction binding the contract method 0xd779cae8. +// +// Solidity: function admin_stake_bulk(uint256 amount, address staking_bridge_address, bytes32[] vega_public_keys) returns() +func (_BaseToken *BaseTokenSession) AdminStakeBulk(amount *big.Int, staking_bridge_address common.Address, vega_public_keys [][32]byte) (*types.Transaction, error) { + return _BaseToken.Contract.AdminStakeBulk(&_BaseToken.TransactOpts, amount, staking_bridge_address, vega_public_keys) +} + +// AdminStakeBulk is a paid mutator transaction binding the contract method 0xd779cae8. +// +// Solidity: function admin_stake_bulk(uint256 amount, address staking_bridge_address, bytes32[] vega_public_keys) returns() +func (_BaseToken *BaseTokenTransactorSession) AdminStakeBulk(amount *big.Int, staking_bridge_address common.Address, vega_public_keys [][32]byte) (*types.Transaction, error) { + return _BaseToken.Contract.AdminStakeBulk(&_BaseToken.TransactOpts, amount, staking_bridge_address, vega_public_keys) +} + +// Approve is a paid mutator transaction binding the contract method 0x095ea7b3. +// +// Solidity: function approve(address spender, uint256 value) returns(bool) +func (_BaseToken *BaseTokenTransactor) Approve(opts *bind.TransactOpts, spender common.Address, value *big.Int) (*types.Transaction, error) { + return _BaseToken.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 (_BaseToken *BaseTokenSession) Approve(spender common.Address, value *big.Int) (*types.Transaction, error) { + return _BaseToken.Contract.Approve(&_BaseToken.TransactOpts, spender, value) +} + +// Approve is a paid mutator transaction binding the contract method 0x095ea7b3. +// +// Solidity: function approve(address spender, uint256 value) returns(bool) +func (_BaseToken *BaseTokenTransactorSession) Approve(spender common.Address, value *big.Int) (*types.Transaction, error) { + return _BaseToken.Contract.Approve(&_BaseToken.TransactOpts, spender, value) +} + +// DecreaseAllowance is a paid mutator transaction binding the contract method 0xa457c2d7. +// +// Solidity: function decreaseAllowance(address spender, uint256 subtractedValue) returns(bool) +func (_BaseToken *BaseTokenTransactor) DecreaseAllowance(opts *bind.TransactOpts, spender common.Address, subtractedValue *big.Int) (*types.Transaction, error) { + return _BaseToken.contract.Transact(opts, "decreaseAllowance", spender, subtractedValue) +} + +// DecreaseAllowance is a paid mutator transaction binding the contract method 0xa457c2d7. +// +// Solidity: function decreaseAllowance(address spender, uint256 subtractedValue) returns(bool) +func (_BaseToken *BaseTokenSession) DecreaseAllowance(spender common.Address, subtractedValue *big.Int) (*types.Transaction, error) { + return _BaseToken.Contract.DecreaseAllowance(&_BaseToken.TransactOpts, spender, subtractedValue) +} + +// DecreaseAllowance is a paid mutator transaction binding the contract method 0xa457c2d7. +// +// Solidity: function decreaseAllowance(address spender, uint256 subtractedValue) returns(bool) +func (_BaseToken *BaseTokenTransactorSession) DecreaseAllowance(spender common.Address, subtractedValue *big.Int) (*types.Transaction, error) { + return _BaseToken.Contract.DecreaseAllowance(&_BaseToken.TransactOpts, spender, subtractedValue) +} + +// Faucet is a paid mutator transaction binding the contract method 0xde5f72fd. +// +// Solidity: function faucet() returns() +func (_BaseToken *BaseTokenTransactor) Faucet(opts *bind.TransactOpts) (*types.Transaction, error) { + return _BaseToken.contract.Transact(opts, "faucet") +} + +// Faucet is a paid mutator transaction binding the contract method 0xde5f72fd. +// +// Solidity: function faucet() returns() +func (_BaseToken *BaseTokenSession) Faucet() (*types.Transaction, error) { + return _BaseToken.Contract.Faucet(&_BaseToken.TransactOpts) +} + +// Faucet is a paid mutator transaction binding the contract method 0xde5f72fd. +// +// Solidity: function faucet() returns() +func (_BaseToken *BaseTokenTransactorSession) Faucet() (*types.Transaction, error) { + return _BaseToken.Contract.Faucet(&_BaseToken.TransactOpts) +} + +// IncreaseAllowance is a paid mutator transaction binding the contract method 0x39509351. +// +// Solidity: function increaseAllowance(address spender, uint256 addedValue) returns(bool) +func (_BaseToken *BaseTokenTransactor) IncreaseAllowance(opts *bind.TransactOpts, spender common.Address, addedValue *big.Int) (*types.Transaction, error) { + return _BaseToken.contract.Transact(opts, "increaseAllowance", spender, addedValue) +} + +// IncreaseAllowance is a paid mutator transaction binding the contract method 0x39509351. +// +// Solidity: function increaseAllowance(address spender, uint256 addedValue) returns(bool) +func (_BaseToken *BaseTokenSession) IncreaseAllowance(spender common.Address, addedValue *big.Int) (*types.Transaction, error) { + return _BaseToken.Contract.IncreaseAllowance(&_BaseToken.TransactOpts, spender, addedValue) +} + +// IncreaseAllowance is a paid mutator transaction binding the contract method 0x39509351. +// +// Solidity: function increaseAllowance(address spender, uint256 addedValue) returns(bool) +func (_BaseToken *BaseTokenTransactorSession) IncreaseAllowance(spender common.Address, addedValue *big.Int) (*types.Transaction, error) { + return _BaseToken.Contract.IncreaseAllowance(&_BaseToken.TransactOpts, spender, addedValue) +} + +// Issue is a paid mutator transaction binding the contract method 0x867904b4. +// +// Solidity: function issue(address account, uint256 value) returns() +func (_BaseToken *BaseTokenTransactor) Issue(opts *bind.TransactOpts, account common.Address, value *big.Int) (*types.Transaction, error) { + return _BaseToken.contract.Transact(opts, "issue", account, value) +} + +// Issue is a paid mutator transaction binding the contract method 0x867904b4. +// +// Solidity: function issue(address account, uint256 value) returns() +func (_BaseToken *BaseTokenSession) Issue(account common.Address, value *big.Int) (*types.Transaction, error) { + return _BaseToken.Contract.Issue(&_BaseToken.TransactOpts, account, value) +} + +// Issue is a paid mutator transaction binding the contract method 0x867904b4. +// +// Solidity: function issue(address account, uint256 value) returns() +func (_BaseToken *BaseTokenTransactorSession) Issue(account common.Address, value *big.Int) (*types.Transaction, error) { + return _BaseToken.Contract.Issue(&_BaseToken.TransactOpts, account, value) +} + +// Kill is a paid mutator transaction binding the contract method 0x41c0e1b5. +// +// Solidity: function kill() returns() +func (_BaseToken *BaseTokenTransactor) Kill(opts *bind.TransactOpts) (*types.Transaction, error) { + return _BaseToken.contract.Transact(opts, "kill") +} + +// Kill is a paid mutator transaction binding the contract method 0x41c0e1b5. +// +// Solidity: function kill() returns() +func (_BaseToken *BaseTokenSession) Kill() (*types.Transaction, error) { + return _BaseToken.Contract.Kill(&_BaseToken.TransactOpts) +} + +// Kill is a paid mutator transaction binding the contract method 0x41c0e1b5. +// +// Solidity: function kill() returns() +func (_BaseToken *BaseTokenTransactorSession) Kill() (*types.Transaction, error) { + return _BaseToken.Contract.Kill(&_BaseToken.TransactOpts) +} + +// Mint is a paid mutator transaction binding the contract method 0x40c10f19. +// +// Solidity: function mint(address to, uint256 amount) returns() +func (_BaseToken *BaseTokenTransactor) Mint(opts *bind.TransactOpts, to common.Address, amount *big.Int) (*types.Transaction, error) { + return _BaseToken.contract.Transact(opts, "mint", to, amount) +} + +// Mint is a paid mutator transaction binding the contract method 0x40c10f19. +// +// Solidity: function mint(address to, uint256 amount) returns() +func (_BaseToken *BaseTokenSession) Mint(to common.Address, amount *big.Int) (*types.Transaction, error) { + return _BaseToken.Contract.Mint(&_BaseToken.TransactOpts, to, amount) +} + +// Mint is a paid mutator transaction binding the contract method 0x40c10f19. +// +// Solidity: function mint(address to, uint256 amount) returns() +func (_BaseToken *BaseTokenTransactorSession) Mint(to common.Address, amount *big.Int) (*types.Transaction, error) { + return _BaseToken.Contract.Mint(&_BaseToken.TransactOpts, to, amount) +} + +// RenounceOwnership is a paid mutator transaction binding the contract method 0x715018a6. +// +// Solidity: function renounceOwnership() returns() +func (_BaseToken *BaseTokenTransactor) RenounceOwnership(opts *bind.TransactOpts) (*types.Transaction, error) { + return _BaseToken.contract.Transact(opts, "renounceOwnership") +} + +// RenounceOwnership is a paid mutator transaction binding the contract method 0x715018a6. +// +// Solidity: function renounceOwnership() returns() +func (_BaseToken *BaseTokenSession) RenounceOwnership() (*types.Transaction, error) { + return _BaseToken.Contract.RenounceOwnership(&_BaseToken.TransactOpts) +} + +// RenounceOwnership is a paid mutator transaction binding the contract method 0x715018a6. +// +// Solidity: function renounceOwnership() returns() +func (_BaseToken *BaseTokenTransactorSession) RenounceOwnership() (*types.Transaction, error) { + return _BaseToken.Contract.RenounceOwnership(&_BaseToken.TransactOpts) +} + +// Transfer is a paid mutator transaction binding the contract method 0xa9059cbb. +// +// Solidity: function transfer(address recipient, uint256 amount) returns(bool) +func (_BaseToken *BaseTokenTransactor) Transfer(opts *bind.TransactOpts, recipient common.Address, amount *big.Int) (*types.Transaction, error) { + return _BaseToken.contract.Transact(opts, "transfer", recipient, amount) +} + +// Transfer is a paid mutator transaction binding the contract method 0xa9059cbb. +// +// Solidity: function transfer(address recipient, uint256 amount) returns(bool) +func (_BaseToken *BaseTokenSession) Transfer(recipient common.Address, amount *big.Int) (*types.Transaction, error) { + return _BaseToken.Contract.Transfer(&_BaseToken.TransactOpts, recipient, amount) +} + +// Transfer is a paid mutator transaction binding the contract method 0xa9059cbb. +// +// Solidity: function transfer(address recipient, uint256 amount) returns(bool) +func (_BaseToken *BaseTokenTransactorSession) Transfer(recipient common.Address, amount *big.Int) (*types.Transaction, error) { + return _BaseToken.Contract.Transfer(&_BaseToken.TransactOpts, recipient, amount) +} + +// TransferFrom is a paid mutator transaction binding the contract method 0x23b872dd. +// +// Solidity: function transferFrom(address sender, address recipient, uint256 amount) returns(bool) +func (_BaseToken *BaseTokenTransactor) TransferFrom(opts *bind.TransactOpts, sender common.Address, recipient common.Address, amount *big.Int) (*types.Transaction, error) { + return _BaseToken.contract.Transact(opts, "transferFrom", sender, recipient, amount) +} + +// TransferFrom is a paid mutator transaction binding the contract method 0x23b872dd. +// +// Solidity: function transferFrom(address sender, address recipient, uint256 amount) returns(bool) +func (_BaseToken *BaseTokenSession) TransferFrom(sender common.Address, recipient common.Address, amount *big.Int) (*types.Transaction, error) { + return _BaseToken.Contract.TransferFrom(&_BaseToken.TransactOpts, sender, recipient, amount) +} + +// TransferFrom is a paid mutator transaction binding the contract method 0x23b872dd. +// +// Solidity: function transferFrom(address sender, address recipient, uint256 amount) returns(bool) +func (_BaseToken *BaseTokenTransactorSession) TransferFrom(sender common.Address, recipient common.Address, amount *big.Int) (*types.Transaction, error) { + return _BaseToken.Contract.TransferFrom(&_BaseToken.TransactOpts, sender, recipient, amount) +} + +// TransferOwnership is a paid mutator transaction binding the contract method 0xf2fde38b. +// +// Solidity: function transferOwnership(address newOwner) returns() +func (_BaseToken *BaseTokenTransactor) TransferOwnership(opts *bind.TransactOpts, newOwner common.Address) (*types.Transaction, error) { + return _BaseToken.contract.Transact(opts, "transferOwnership", newOwner) +} + +// TransferOwnership is a paid mutator transaction binding the contract method 0xf2fde38b. +// +// Solidity: function transferOwnership(address newOwner) returns() +func (_BaseToken *BaseTokenSession) TransferOwnership(newOwner common.Address) (*types.Transaction, error) { + return _BaseToken.Contract.TransferOwnership(&_BaseToken.TransactOpts, newOwner) +} + +// TransferOwnership is a paid mutator transaction binding the contract method 0xf2fde38b. +// +// Solidity: function transferOwnership(address newOwner) returns() +func (_BaseToken *BaseTokenTransactorSession) TransferOwnership(newOwner common.Address) (*types.Transaction, error) { + return _BaseToken.Contract.TransferOwnership(&_BaseToken.TransactOpts, newOwner) +} + +// BaseTokenApprovalIterator is returned from FilterApproval and is used to iterate over the raw logs and unpacked data for Approval events raised by the BaseToken contract. +type BaseTokenApprovalIterator struct { + Event *BaseTokenApproval // 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 *BaseTokenApprovalIterator) 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(BaseTokenApproval) + 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(BaseTokenApproval) + 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 *BaseTokenApprovalIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *BaseTokenApprovalIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// BaseTokenApproval represents a Approval event raised by the BaseToken contract. +type BaseTokenApproval 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 (_BaseToken *BaseTokenFilterer) FilterApproval(opts *bind.FilterOpts, owner []common.Address, spender []common.Address) (*BaseTokenApprovalIterator, 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 := _BaseToken.contract.FilterLogs(opts, "Approval", ownerRule, spenderRule) + if err != nil { + return nil, err + } + return &BaseTokenApprovalIterator{contract: _BaseToken.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 (_BaseToken *BaseTokenFilterer) WatchApproval(opts *bind.WatchOpts, sink chan<- *BaseTokenApproval, 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 := _BaseToken.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(BaseTokenApproval) + if err := _BaseToken.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 (_BaseToken *BaseTokenFilterer) ParseApproval(log types.Log) (*BaseTokenApproval, error) { + event := new(BaseTokenApproval) + if err := _BaseToken.contract.UnpackLog(event, "Approval", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// BaseTokenOwnershipTransferredIterator is returned from FilterOwnershipTransferred and is used to iterate over the raw logs and unpacked data for OwnershipTransferred events raised by the BaseToken contract. +type BaseTokenOwnershipTransferredIterator struct { + Event *BaseTokenOwnershipTransferred // 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 *BaseTokenOwnershipTransferredIterator) 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(BaseTokenOwnershipTransferred) + 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(BaseTokenOwnershipTransferred) + 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 *BaseTokenOwnershipTransferredIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *BaseTokenOwnershipTransferredIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// BaseTokenOwnershipTransferred represents a OwnershipTransferred event raised by the BaseToken contract. +type BaseTokenOwnershipTransferred 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 (_BaseToken *BaseTokenFilterer) FilterOwnershipTransferred(opts *bind.FilterOpts, previousOwner []common.Address, newOwner []common.Address) (*BaseTokenOwnershipTransferredIterator, 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 := _BaseToken.contract.FilterLogs(opts, "OwnershipTransferred", previousOwnerRule, newOwnerRule) + if err != nil { + return nil, err + } + return &BaseTokenOwnershipTransferredIterator{contract: _BaseToken.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 (_BaseToken *BaseTokenFilterer) WatchOwnershipTransferred(opts *bind.WatchOpts, sink chan<- *BaseTokenOwnershipTransferred, 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 := _BaseToken.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(BaseTokenOwnershipTransferred) + if err := _BaseToken.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 (_BaseToken *BaseTokenFilterer) ParseOwnershipTransferred(log types.Log) (*BaseTokenOwnershipTransferred, error) { + event := new(BaseTokenOwnershipTransferred) + if err := _BaseToken.contract.UnpackLog(event, "OwnershipTransferred", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// BaseTokenTransferIterator is returned from FilterTransfer and is used to iterate over the raw logs and unpacked data for Transfer events raised by the BaseToken contract. +type BaseTokenTransferIterator struct { + Event *BaseTokenTransfer // 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 *BaseTokenTransferIterator) 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(BaseTokenTransfer) + 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(BaseTokenTransfer) + 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 *BaseTokenTransferIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *BaseTokenTransferIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// BaseTokenTransfer represents a Transfer event raised by the BaseToken contract. +type BaseTokenTransfer 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 (_BaseToken *BaseTokenFilterer) FilterTransfer(opts *bind.FilterOpts, from []common.Address, to []common.Address) (*BaseTokenTransferIterator, 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 := _BaseToken.contract.FilterLogs(opts, "Transfer", fromRule, toRule) + if err != nil { + return nil, err + } + return &BaseTokenTransferIterator{contract: _BaseToken.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 (_BaseToken *BaseTokenFilterer) WatchTransfer(opts *bind.WatchOpts, sink chan<- *BaseTokenTransfer, 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 := _BaseToken.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(BaseTokenTransfer) + if err := _BaseToken.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 (_BaseToken *BaseTokenFilterer) ParseTransfer(log types.Log) (*BaseTokenTransfer, error) { + event := new(BaseTokenTransfer) + if err := _BaseToken.contract.UnpackLog(event, "Transfer", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} diff --git a/libs/ethereum/generated/erc20_bridge.go b/libs/ethereum/generated/erc20_bridge.go new file mode 100644 index 00000000..365d8d34 --- /dev/null +++ b/libs/ethereum/generated/erc20_bridge.go @@ -0,0 +1,2143 @@ +// Code generated - DO NOT EDIT. +// This file is a generated binding and any manual changes will be lost. + +package generated + +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 +) + +// ERC20BridgeMetaData contains all meta data concerning the ERC20Bridge contract. +var ERC20BridgeMetaData = &bind.MetaData{ + ABI: "[{\"inputs\":[{\"internalType\":\"addresspayable\",\"name\":\"erc20_asset_pool\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"user_address\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"asset_source\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"vega_public_key\",\"type\":\"bytes32\"}],\"name\":\"Asset_Deposited\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"asset_source\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"lifetime_limit\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"withdraw_threshold\",\"type\":\"uint256\"}],\"name\":\"Asset_Limits_Updated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"asset_source\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"vega_asset_id\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"nonce\",\"type\":\"uint256\"}],\"name\":\"Asset_Listed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"asset_source\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"nonce\",\"type\":\"uint256\"}],\"name\":\"Asset_Removed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"user_address\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"asset_source\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"nonce\",\"type\":\"uint256\"}],\"name\":\"Asset_Withdrawn\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[],\"name\":\"Bridge_Resumed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[],\"name\":\"Bridge_Stopped\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"withdraw_delay\",\"type\":\"uint256\"}],\"name\":\"Bridge_Withdraw_Delay_Set\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"depositor\",\"type\":\"address\"}],\"name\":\"Depositor_Exempted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"depositor\",\"type\":\"address\"}],\"name\":\"Depositor_Exemption_Revoked\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"default_withdraw_delay\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"asset_source\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"bytes32\",\"name\":\"vega_public_key\",\"type\":\"bytes32\"}],\"name\":\"deposit_asset\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"erc20_asset_pool_address\",\"outputs\":[{\"internalType\":\"addresspayable\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"exempt_depositor\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"asset_source\",\"type\":\"address\"}],\"name\":\"get_asset_deposit_lifetime_limit\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"vega_asset_id\",\"type\":\"bytes32\"}],\"name\":\"get_asset_source\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"get_multisig_control_address\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"asset_source\",\"type\":\"address\"}],\"name\":\"get_vega_asset_id\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"asset_source\",\"type\":\"address\"}],\"name\":\"get_withdraw_threshold\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"nonce\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"signatures\",\"type\":\"bytes\"}],\"name\":\"global_resume\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"nonce\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"signatures\",\"type\":\"bytes\"}],\"name\":\"global_stop\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"asset_source\",\"type\":\"address\"}],\"name\":\"is_asset_listed\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"depositor\",\"type\":\"address\"}],\"name\":\"is_exempt_depositor\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"is_stopped\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"asset_source\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"vega_asset_id\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"lifetime_limit\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"withdraw_threshold\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"nonce\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"signatures\",\"type\":\"bytes\"}],\"name\":\"list_asset\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"asset_source\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"nonce\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"signatures\",\"type\":\"bytes\"}],\"name\":\"remove_asset\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"revoke_exempt_depositor\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"asset_source\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"lifetime_limit\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"threshold\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"nonce\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"signatures\",\"type\":\"bytes\"}],\"name\":\"set_asset_limits\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"delay\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"nonce\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"signatures\",\"type\":\"bytes\"}],\"name\":\"set_withdraw_delay\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"asset_source\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"target\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"creation\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"nonce\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"signatures\",\"type\":\"bytes\"}],\"name\":\"withdraw_asset\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]", +} + +// ERC20BridgeABI is the input ABI used to generate the binding from. +// Deprecated: Use ERC20BridgeMetaData.ABI instead. +var ERC20BridgeABI = ERC20BridgeMetaData.ABI + +// ERC20Bridge is an auto generated Go binding around an Ethereum contract. +type ERC20Bridge struct { + ERC20BridgeCaller // Read-only binding to the contract + ERC20BridgeTransactor // Write-only binding to the contract + ERC20BridgeFilterer // Log filterer for contract events +} + +// ERC20BridgeCaller is an auto generated read-only Go binding around an Ethereum contract. +type ERC20BridgeCaller struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// ERC20BridgeTransactor is an auto generated write-only Go binding around an Ethereum contract. +type ERC20BridgeTransactor struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// ERC20BridgeFilterer is an auto generated log filtering Go binding around an Ethereum contract events. +type ERC20BridgeFilterer struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// ERC20BridgeSession is an auto generated Go binding around an Ethereum contract, +// with pre-set call and transact options. +type ERC20BridgeSession struct { + Contract *ERC20Bridge // 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 +} + +// ERC20BridgeCallerSession is an auto generated read-only Go binding around an Ethereum contract, +// with pre-set call options. +type ERC20BridgeCallerSession struct { + Contract *ERC20BridgeCaller // Generic contract caller binding to set the session for + CallOpts bind.CallOpts // Call options to use throughout this session +} + +// ERC20BridgeTransactorSession is an auto generated write-only Go binding around an Ethereum contract, +// with pre-set transact options. +type ERC20BridgeTransactorSession struct { + Contract *ERC20BridgeTransactor // Generic contract transactor binding to set the session for + TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session +} + +// ERC20BridgeRaw is an auto generated low-level Go binding around an Ethereum contract. +type ERC20BridgeRaw struct { + Contract *ERC20Bridge // Generic contract binding to access the raw methods on +} + +// ERC20BridgeCallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract. +type ERC20BridgeCallerRaw struct { + Contract *ERC20BridgeCaller // Generic read-only contract binding to access the raw methods on +} + +// ERC20BridgeTransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract. +type ERC20BridgeTransactorRaw struct { + Contract *ERC20BridgeTransactor // Generic write-only contract binding to access the raw methods on +} + +// NewERC20Bridge creates a new instance of ERC20Bridge, bound to a specific deployed contract. +func NewERC20Bridge(address common.Address, backend bind.ContractBackend) (*ERC20Bridge, error) { + contract, err := bindERC20Bridge(address, backend, backend, backend) + if err != nil { + return nil, err + } + return &ERC20Bridge{ERC20BridgeCaller: ERC20BridgeCaller{contract: contract}, ERC20BridgeTransactor: ERC20BridgeTransactor{contract: contract}, ERC20BridgeFilterer: ERC20BridgeFilterer{contract: contract}}, nil +} + +// NewERC20BridgeCaller creates a new read-only instance of ERC20Bridge, bound to a specific deployed contract. +func NewERC20BridgeCaller(address common.Address, caller bind.ContractCaller) (*ERC20BridgeCaller, error) { + contract, err := bindERC20Bridge(address, caller, nil, nil) + if err != nil { + return nil, err + } + return &ERC20BridgeCaller{contract: contract}, nil +} + +// NewERC20BridgeTransactor creates a new write-only instance of ERC20Bridge, bound to a specific deployed contract. +func NewERC20BridgeTransactor(address common.Address, transactor bind.ContractTransactor) (*ERC20BridgeTransactor, error) { + contract, err := bindERC20Bridge(address, nil, transactor, nil) + if err != nil { + return nil, err + } + return &ERC20BridgeTransactor{contract: contract}, nil +} + +// NewERC20BridgeFilterer creates a new log filterer instance of ERC20Bridge, bound to a specific deployed contract. +func NewERC20BridgeFilterer(address common.Address, filterer bind.ContractFilterer) (*ERC20BridgeFilterer, error) { + contract, err := bindERC20Bridge(address, nil, nil, filterer) + if err != nil { + return nil, err + } + return &ERC20BridgeFilterer{contract: contract}, nil +} + +// bindERC20Bridge binds a generic wrapper to an already deployed contract. +func bindERC20Bridge(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) { + parsed, err := abi.JSON(strings.NewReader(ERC20BridgeABI)) + 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 (_ERC20Bridge *ERC20BridgeRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { + return _ERC20Bridge.Contract.ERC20BridgeCaller.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 (_ERC20Bridge *ERC20BridgeRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _ERC20Bridge.Contract.ERC20BridgeTransactor.contract.Transfer(opts) +} + +// Transact invokes the (paid) contract method with params as input values. +func (_ERC20Bridge *ERC20BridgeRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _ERC20Bridge.Contract.ERC20BridgeTransactor.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 (_ERC20Bridge *ERC20BridgeCallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { + return _ERC20Bridge.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 (_ERC20Bridge *ERC20BridgeTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _ERC20Bridge.Contract.contract.Transfer(opts) +} + +// Transact invokes the (paid) contract method with params as input values. +func (_ERC20Bridge *ERC20BridgeTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _ERC20Bridge.Contract.contract.Transact(opts, method, params...) +} + +// DefaultWithdrawDelay is a free data retrieval call binding the contract method 0x3f4f199d. +// +// Solidity: function default_withdraw_delay() view returns(uint256) +func (_ERC20Bridge *ERC20BridgeCaller) DefaultWithdrawDelay(opts *bind.CallOpts) (*big.Int, error) { + var out []interface{} + err := _ERC20Bridge.contract.Call(opts, &out, "default_withdraw_delay") + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// DefaultWithdrawDelay is a free data retrieval call binding the contract method 0x3f4f199d. +// +// Solidity: function default_withdraw_delay() view returns(uint256) +func (_ERC20Bridge *ERC20BridgeSession) DefaultWithdrawDelay() (*big.Int, error) { + return _ERC20Bridge.Contract.DefaultWithdrawDelay(&_ERC20Bridge.CallOpts) +} + +// DefaultWithdrawDelay is a free data retrieval call binding the contract method 0x3f4f199d. +// +// Solidity: function default_withdraw_delay() view returns(uint256) +func (_ERC20Bridge *ERC20BridgeCallerSession) DefaultWithdrawDelay() (*big.Int, error) { + return _ERC20Bridge.Contract.DefaultWithdrawDelay(&_ERC20Bridge.CallOpts) +} + +// Erc20AssetPoolAddress is a free data retrieval call binding the contract method 0x9356aab8. +// +// Solidity: function erc20_asset_pool_address() view returns(address) +func (_ERC20Bridge *ERC20BridgeCaller) Erc20AssetPoolAddress(opts *bind.CallOpts) (common.Address, error) { + var out []interface{} + err := _ERC20Bridge.contract.Call(opts, &out, "erc20_asset_pool_address") + + if err != nil { + return *new(common.Address), err + } + + out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) + + return out0, err + +} + +// Erc20AssetPoolAddress is a free data retrieval call binding the contract method 0x9356aab8. +// +// Solidity: function erc20_asset_pool_address() view returns(address) +func (_ERC20Bridge *ERC20BridgeSession) Erc20AssetPoolAddress() (common.Address, error) { + return _ERC20Bridge.Contract.Erc20AssetPoolAddress(&_ERC20Bridge.CallOpts) +} + +// Erc20AssetPoolAddress is a free data retrieval call binding the contract method 0x9356aab8. +// +// Solidity: function erc20_asset_pool_address() view returns(address) +func (_ERC20Bridge *ERC20BridgeCallerSession) Erc20AssetPoolAddress() (common.Address, error) { + return _ERC20Bridge.Contract.Erc20AssetPoolAddress(&_ERC20Bridge.CallOpts) +} + +// GetAssetDepositLifetimeLimit is a free data retrieval call binding the contract method 0x354a897a. +// +// Solidity: function get_asset_deposit_lifetime_limit(address asset_source) view returns(uint256) +func (_ERC20Bridge *ERC20BridgeCaller) GetAssetDepositLifetimeLimit(opts *bind.CallOpts, asset_source common.Address) (*big.Int, error) { + var out []interface{} + err := _ERC20Bridge.contract.Call(opts, &out, "get_asset_deposit_lifetime_limit", asset_source) + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// GetAssetDepositLifetimeLimit is a free data retrieval call binding the contract method 0x354a897a. +// +// Solidity: function get_asset_deposit_lifetime_limit(address asset_source) view returns(uint256) +func (_ERC20Bridge *ERC20BridgeSession) GetAssetDepositLifetimeLimit(asset_source common.Address) (*big.Int, error) { + return _ERC20Bridge.Contract.GetAssetDepositLifetimeLimit(&_ERC20Bridge.CallOpts, asset_source) +} + +// GetAssetDepositLifetimeLimit is a free data retrieval call binding the contract method 0x354a897a. +// +// Solidity: function get_asset_deposit_lifetime_limit(address asset_source) view returns(uint256) +func (_ERC20Bridge *ERC20BridgeCallerSession) GetAssetDepositLifetimeLimit(asset_source common.Address) (*big.Int, error) { + return _ERC20Bridge.Contract.GetAssetDepositLifetimeLimit(&_ERC20Bridge.CallOpts, asset_source) +} + +// GetAssetSource is a free data retrieval call binding the contract method 0x786b0bc0. +// +// Solidity: function get_asset_source(bytes32 vega_asset_id) view returns(address) +func (_ERC20Bridge *ERC20BridgeCaller) GetAssetSource(opts *bind.CallOpts, vega_asset_id [32]byte) (common.Address, error) { + var out []interface{} + err := _ERC20Bridge.contract.Call(opts, &out, "get_asset_source", vega_asset_id) + + if err != nil { + return *new(common.Address), err + } + + out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) + + return out0, err + +} + +// GetAssetSource is a free data retrieval call binding the contract method 0x786b0bc0. +// +// Solidity: function get_asset_source(bytes32 vega_asset_id) view returns(address) +func (_ERC20Bridge *ERC20BridgeSession) GetAssetSource(vega_asset_id [32]byte) (common.Address, error) { + return _ERC20Bridge.Contract.GetAssetSource(&_ERC20Bridge.CallOpts, vega_asset_id) +} + +// GetAssetSource is a free data retrieval call binding the contract method 0x786b0bc0. +// +// Solidity: function get_asset_source(bytes32 vega_asset_id) view returns(address) +func (_ERC20Bridge *ERC20BridgeCallerSession) GetAssetSource(vega_asset_id [32]byte) (common.Address, error) { + return _ERC20Bridge.Contract.GetAssetSource(&_ERC20Bridge.CallOpts, vega_asset_id) +} + +// GetMultisigControlAddress is a free data retrieval call binding the contract method 0xc58dc3b9. +// +// Solidity: function get_multisig_control_address() view returns(address) +func (_ERC20Bridge *ERC20BridgeCaller) GetMultisigControlAddress(opts *bind.CallOpts) (common.Address, error) { + var out []interface{} + err := _ERC20Bridge.contract.Call(opts, &out, "get_multisig_control_address") + + if err != nil { + return *new(common.Address), err + } + + out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) + + return out0, err + +} + +// GetMultisigControlAddress is a free data retrieval call binding the contract method 0xc58dc3b9. +// +// Solidity: function get_multisig_control_address() view returns(address) +func (_ERC20Bridge *ERC20BridgeSession) GetMultisigControlAddress() (common.Address, error) { + return _ERC20Bridge.Contract.GetMultisigControlAddress(&_ERC20Bridge.CallOpts) +} + +// GetMultisigControlAddress is a free data retrieval call binding the contract method 0xc58dc3b9. +// +// Solidity: function get_multisig_control_address() view returns(address) +func (_ERC20Bridge *ERC20BridgeCallerSession) GetMultisigControlAddress() (common.Address, error) { + return _ERC20Bridge.Contract.GetMultisigControlAddress(&_ERC20Bridge.CallOpts) +} + +// GetVegaAssetId is a free data retrieval call binding the contract method 0xa06b5d39. +// +// Solidity: function get_vega_asset_id(address asset_source) view returns(bytes32) +func (_ERC20Bridge *ERC20BridgeCaller) GetVegaAssetId(opts *bind.CallOpts, asset_source common.Address) ([32]byte, error) { + var out []interface{} + err := _ERC20Bridge.contract.Call(opts, &out, "get_vega_asset_id", asset_source) + + if err != nil { + return *new([32]byte), err + } + + out0 := *abi.ConvertType(out[0], new([32]byte)).(*[32]byte) + + return out0, err + +} + +// GetVegaAssetId is a free data retrieval call binding the contract method 0xa06b5d39. +// +// Solidity: function get_vega_asset_id(address asset_source) view returns(bytes32) +func (_ERC20Bridge *ERC20BridgeSession) GetVegaAssetId(asset_source common.Address) ([32]byte, error) { + return _ERC20Bridge.Contract.GetVegaAssetId(&_ERC20Bridge.CallOpts, asset_source) +} + +// GetVegaAssetId is a free data retrieval call binding the contract method 0xa06b5d39. +// +// Solidity: function get_vega_asset_id(address asset_source) view returns(bytes32) +func (_ERC20Bridge *ERC20BridgeCallerSession) GetVegaAssetId(asset_source common.Address) ([32]byte, error) { + return _ERC20Bridge.Contract.GetVegaAssetId(&_ERC20Bridge.CallOpts, asset_source) +} + +// GetWithdrawThreshold is a free data retrieval call binding the contract method 0xe8a7bce0. +// +// Solidity: function get_withdraw_threshold(address asset_source) view returns(uint256) +func (_ERC20Bridge *ERC20BridgeCaller) GetWithdrawThreshold(opts *bind.CallOpts, asset_source common.Address) (*big.Int, error) { + var out []interface{} + err := _ERC20Bridge.contract.Call(opts, &out, "get_withdraw_threshold", asset_source) + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// GetWithdrawThreshold is a free data retrieval call binding the contract method 0xe8a7bce0. +// +// Solidity: function get_withdraw_threshold(address asset_source) view returns(uint256) +func (_ERC20Bridge *ERC20BridgeSession) GetWithdrawThreshold(asset_source common.Address) (*big.Int, error) { + return _ERC20Bridge.Contract.GetWithdrawThreshold(&_ERC20Bridge.CallOpts, asset_source) +} + +// GetWithdrawThreshold is a free data retrieval call binding the contract method 0xe8a7bce0. +// +// Solidity: function get_withdraw_threshold(address asset_source) view returns(uint256) +func (_ERC20Bridge *ERC20BridgeCallerSession) GetWithdrawThreshold(asset_source common.Address) (*big.Int, error) { + return _ERC20Bridge.Contract.GetWithdrawThreshold(&_ERC20Bridge.CallOpts, asset_source) +} + +// IsAssetListed is a free data retrieval call binding the contract method 0x7fd27b7f. +// +// Solidity: function is_asset_listed(address asset_source) view returns(bool) +func (_ERC20Bridge *ERC20BridgeCaller) IsAssetListed(opts *bind.CallOpts, asset_source common.Address) (bool, error) { + var out []interface{} + err := _ERC20Bridge.contract.Call(opts, &out, "is_asset_listed", asset_source) + + if err != nil { + return *new(bool), err + } + + out0 := *abi.ConvertType(out[0], new(bool)).(*bool) + + return out0, err + +} + +// IsAssetListed is a free data retrieval call binding the contract method 0x7fd27b7f. +// +// Solidity: function is_asset_listed(address asset_source) view returns(bool) +func (_ERC20Bridge *ERC20BridgeSession) IsAssetListed(asset_source common.Address) (bool, error) { + return _ERC20Bridge.Contract.IsAssetListed(&_ERC20Bridge.CallOpts, asset_source) +} + +// IsAssetListed is a free data retrieval call binding the contract method 0x7fd27b7f. +// +// Solidity: function is_asset_listed(address asset_source) view returns(bool) +func (_ERC20Bridge *ERC20BridgeCallerSession) IsAssetListed(asset_source common.Address) (bool, error) { + return _ERC20Bridge.Contract.IsAssetListed(&_ERC20Bridge.CallOpts, asset_source) +} + +// IsExemptDepositor is a free data retrieval call binding the contract method 0x15c0df9d. +// +// Solidity: function is_exempt_depositor(address depositor) view returns(bool) +func (_ERC20Bridge *ERC20BridgeCaller) IsExemptDepositor(opts *bind.CallOpts, depositor common.Address) (bool, error) { + var out []interface{} + err := _ERC20Bridge.contract.Call(opts, &out, "is_exempt_depositor", depositor) + + if err != nil { + return *new(bool), err + } + + out0 := *abi.ConvertType(out[0], new(bool)).(*bool) + + return out0, err + +} + +// IsExemptDepositor is a free data retrieval call binding the contract method 0x15c0df9d. +// +// Solidity: function is_exempt_depositor(address depositor) view returns(bool) +func (_ERC20Bridge *ERC20BridgeSession) IsExemptDepositor(depositor common.Address) (bool, error) { + return _ERC20Bridge.Contract.IsExemptDepositor(&_ERC20Bridge.CallOpts, depositor) +} + +// IsExemptDepositor is a free data retrieval call binding the contract method 0x15c0df9d. +// +// Solidity: function is_exempt_depositor(address depositor) view returns(bool) +func (_ERC20Bridge *ERC20BridgeCallerSession) IsExemptDepositor(depositor common.Address) (bool, error) { + return _ERC20Bridge.Contract.IsExemptDepositor(&_ERC20Bridge.CallOpts, depositor) +} + +// IsStopped is a free data retrieval call binding the contract method 0xe272e9d0. +// +// Solidity: function is_stopped() view returns(bool) +func (_ERC20Bridge *ERC20BridgeCaller) IsStopped(opts *bind.CallOpts) (bool, error) { + var out []interface{} + err := _ERC20Bridge.contract.Call(opts, &out, "is_stopped") + + if err != nil { + return *new(bool), err + } + + out0 := *abi.ConvertType(out[0], new(bool)).(*bool) + + return out0, err + +} + +// IsStopped is a free data retrieval call binding the contract method 0xe272e9d0. +// +// Solidity: function is_stopped() view returns(bool) +func (_ERC20Bridge *ERC20BridgeSession) IsStopped() (bool, error) { + return _ERC20Bridge.Contract.IsStopped(&_ERC20Bridge.CallOpts) +} + +// IsStopped is a free data retrieval call binding the contract method 0xe272e9d0. +// +// Solidity: function is_stopped() view returns(bool) +func (_ERC20Bridge *ERC20BridgeCallerSession) IsStopped() (bool, error) { + return _ERC20Bridge.Contract.IsStopped(&_ERC20Bridge.CallOpts) +} + +// DepositAsset is a paid mutator transaction binding the contract method 0xf7683932. +// +// Solidity: function deposit_asset(address asset_source, uint256 amount, bytes32 vega_public_key) returns() +func (_ERC20Bridge *ERC20BridgeTransactor) DepositAsset(opts *bind.TransactOpts, asset_source common.Address, amount *big.Int, vega_public_key [32]byte) (*types.Transaction, error) { + return _ERC20Bridge.contract.Transact(opts, "deposit_asset", asset_source, amount, vega_public_key) +} + +// DepositAsset is a paid mutator transaction binding the contract method 0xf7683932. +// +// Solidity: function deposit_asset(address asset_source, uint256 amount, bytes32 vega_public_key) returns() +func (_ERC20Bridge *ERC20BridgeSession) DepositAsset(asset_source common.Address, amount *big.Int, vega_public_key [32]byte) (*types.Transaction, error) { + return _ERC20Bridge.Contract.DepositAsset(&_ERC20Bridge.TransactOpts, asset_source, amount, vega_public_key) +} + +// DepositAsset is a paid mutator transaction binding the contract method 0xf7683932. +// +// Solidity: function deposit_asset(address asset_source, uint256 amount, bytes32 vega_public_key) returns() +func (_ERC20Bridge *ERC20BridgeTransactorSession) DepositAsset(asset_source common.Address, amount *big.Int, vega_public_key [32]byte) (*types.Transaction, error) { + return _ERC20Bridge.Contract.DepositAsset(&_ERC20Bridge.TransactOpts, asset_source, amount, vega_public_key) +} + +// ExemptDepositor is a paid mutator transaction binding the contract method 0xb76fbb75. +// +// Solidity: function exempt_depositor() returns() +func (_ERC20Bridge *ERC20BridgeTransactor) ExemptDepositor(opts *bind.TransactOpts) (*types.Transaction, error) { + return _ERC20Bridge.contract.Transact(opts, "exempt_depositor") +} + +// ExemptDepositor is a paid mutator transaction binding the contract method 0xb76fbb75. +// +// Solidity: function exempt_depositor() returns() +func (_ERC20Bridge *ERC20BridgeSession) ExemptDepositor() (*types.Transaction, error) { + return _ERC20Bridge.Contract.ExemptDepositor(&_ERC20Bridge.TransactOpts) +} + +// ExemptDepositor is a paid mutator transaction binding the contract method 0xb76fbb75. +// +// Solidity: function exempt_depositor() returns() +func (_ERC20Bridge *ERC20BridgeTransactorSession) ExemptDepositor() (*types.Transaction, error) { + return _ERC20Bridge.Contract.ExemptDepositor(&_ERC20Bridge.TransactOpts) +} + +// GlobalResume is a paid mutator transaction binding the contract method 0xd72ed529. +// +// Solidity: function global_resume(uint256 nonce, bytes signatures) returns() +func (_ERC20Bridge *ERC20BridgeTransactor) GlobalResume(opts *bind.TransactOpts, nonce *big.Int, signatures []byte) (*types.Transaction, error) { + return _ERC20Bridge.contract.Transact(opts, "global_resume", nonce, signatures) +} + +// GlobalResume is a paid mutator transaction binding the contract method 0xd72ed529. +// +// Solidity: function global_resume(uint256 nonce, bytes signatures) returns() +func (_ERC20Bridge *ERC20BridgeSession) GlobalResume(nonce *big.Int, signatures []byte) (*types.Transaction, error) { + return _ERC20Bridge.Contract.GlobalResume(&_ERC20Bridge.TransactOpts, nonce, signatures) +} + +// GlobalResume is a paid mutator transaction binding the contract method 0xd72ed529. +// +// Solidity: function global_resume(uint256 nonce, bytes signatures) returns() +func (_ERC20Bridge *ERC20BridgeTransactorSession) GlobalResume(nonce *big.Int, signatures []byte) (*types.Transaction, error) { + return _ERC20Bridge.Contract.GlobalResume(&_ERC20Bridge.TransactOpts, nonce, signatures) +} + +// GlobalStop is a paid mutator transaction binding the contract method 0x9dfd3c88. +// +// Solidity: function global_stop(uint256 nonce, bytes signatures) returns() +func (_ERC20Bridge *ERC20BridgeTransactor) GlobalStop(opts *bind.TransactOpts, nonce *big.Int, signatures []byte) (*types.Transaction, error) { + return _ERC20Bridge.contract.Transact(opts, "global_stop", nonce, signatures) +} + +// GlobalStop is a paid mutator transaction binding the contract method 0x9dfd3c88. +// +// Solidity: function global_stop(uint256 nonce, bytes signatures) returns() +func (_ERC20Bridge *ERC20BridgeSession) GlobalStop(nonce *big.Int, signatures []byte) (*types.Transaction, error) { + return _ERC20Bridge.Contract.GlobalStop(&_ERC20Bridge.TransactOpts, nonce, signatures) +} + +// GlobalStop is a paid mutator transaction binding the contract method 0x9dfd3c88. +// +// Solidity: function global_stop(uint256 nonce, bytes signatures) returns() +func (_ERC20Bridge *ERC20BridgeTransactorSession) GlobalStop(nonce *big.Int, signatures []byte) (*types.Transaction, error) { + return _ERC20Bridge.Contract.GlobalStop(&_ERC20Bridge.TransactOpts, nonce, signatures) +} + +// ListAsset is a paid mutator transaction binding the contract method 0x0ff3562c. +// +// Solidity: function list_asset(address asset_source, bytes32 vega_asset_id, uint256 lifetime_limit, uint256 withdraw_threshold, uint256 nonce, bytes signatures) returns() +func (_ERC20Bridge *ERC20BridgeTransactor) ListAsset(opts *bind.TransactOpts, asset_source common.Address, vega_asset_id [32]byte, lifetime_limit *big.Int, withdraw_threshold *big.Int, nonce *big.Int, signatures []byte) (*types.Transaction, error) { + return _ERC20Bridge.contract.Transact(opts, "list_asset", asset_source, vega_asset_id, lifetime_limit, withdraw_threshold, nonce, signatures) +} + +// ListAsset is a paid mutator transaction binding the contract method 0x0ff3562c. +// +// Solidity: function list_asset(address asset_source, bytes32 vega_asset_id, uint256 lifetime_limit, uint256 withdraw_threshold, uint256 nonce, bytes signatures) returns() +func (_ERC20Bridge *ERC20BridgeSession) ListAsset(asset_source common.Address, vega_asset_id [32]byte, lifetime_limit *big.Int, withdraw_threshold *big.Int, nonce *big.Int, signatures []byte) (*types.Transaction, error) { + return _ERC20Bridge.Contract.ListAsset(&_ERC20Bridge.TransactOpts, asset_source, vega_asset_id, lifetime_limit, withdraw_threshold, nonce, signatures) +} + +// ListAsset is a paid mutator transaction binding the contract method 0x0ff3562c. +// +// Solidity: function list_asset(address asset_source, bytes32 vega_asset_id, uint256 lifetime_limit, uint256 withdraw_threshold, uint256 nonce, bytes signatures) returns() +func (_ERC20Bridge *ERC20BridgeTransactorSession) ListAsset(asset_source common.Address, vega_asset_id [32]byte, lifetime_limit *big.Int, withdraw_threshold *big.Int, nonce *big.Int, signatures []byte) (*types.Transaction, error) { + return _ERC20Bridge.Contract.ListAsset(&_ERC20Bridge.TransactOpts, asset_source, vega_asset_id, lifetime_limit, withdraw_threshold, nonce, signatures) +} + +// RemoveAsset is a paid mutator transaction binding the contract method 0xc76de358. +// +// Solidity: function remove_asset(address asset_source, uint256 nonce, bytes signatures) returns() +func (_ERC20Bridge *ERC20BridgeTransactor) RemoveAsset(opts *bind.TransactOpts, asset_source common.Address, nonce *big.Int, signatures []byte) (*types.Transaction, error) { + return _ERC20Bridge.contract.Transact(opts, "remove_asset", asset_source, nonce, signatures) +} + +// RemoveAsset is a paid mutator transaction binding the contract method 0xc76de358. +// +// Solidity: function remove_asset(address asset_source, uint256 nonce, bytes signatures) returns() +func (_ERC20Bridge *ERC20BridgeSession) RemoveAsset(asset_source common.Address, nonce *big.Int, signatures []byte) (*types.Transaction, error) { + return _ERC20Bridge.Contract.RemoveAsset(&_ERC20Bridge.TransactOpts, asset_source, nonce, signatures) +} + +// RemoveAsset is a paid mutator transaction binding the contract method 0xc76de358. +// +// Solidity: function remove_asset(address asset_source, uint256 nonce, bytes signatures) returns() +func (_ERC20Bridge *ERC20BridgeTransactorSession) RemoveAsset(asset_source common.Address, nonce *big.Int, signatures []byte) (*types.Transaction, error) { + return _ERC20Bridge.Contract.RemoveAsset(&_ERC20Bridge.TransactOpts, asset_source, nonce, signatures) +} + +// RevokeExemptDepositor is a paid mutator transaction binding the contract method 0x6a1c6fa4. +// +// Solidity: function revoke_exempt_depositor() returns() +func (_ERC20Bridge *ERC20BridgeTransactor) RevokeExemptDepositor(opts *bind.TransactOpts) (*types.Transaction, error) { + return _ERC20Bridge.contract.Transact(opts, "revoke_exempt_depositor") +} + +// RevokeExemptDepositor is a paid mutator transaction binding the contract method 0x6a1c6fa4. +// +// Solidity: function revoke_exempt_depositor() returns() +func (_ERC20Bridge *ERC20BridgeSession) RevokeExemptDepositor() (*types.Transaction, error) { + return _ERC20Bridge.Contract.RevokeExemptDepositor(&_ERC20Bridge.TransactOpts) +} + +// RevokeExemptDepositor is a paid mutator transaction binding the contract method 0x6a1c6fa4. +// +// Solidity: function revoke_exempt_depositor() returns() +func (_ERC20Bridge *ERC20BridgeTransactorSession) RevokeExemptDepositor() (*types.Transaction, error) { + return _ERC20Bridge.Contract.RevokeExemptDepositor(&_ERC20Bridge.TransactOpts) +} + +// SetAssetLimits is a paid mutator transaction binding the contract method 0x41fb776d. +// +// Solidity: function set_asset_limits(address asset_source, uint256 lifetime_limit, uint256 threshold, uint256 nonce, bytes signatures) returns() +func (_ERC20Bridge *ERC20BridgeTransactor) SetAssetLimits(opts *bind.TransactOpts, asset_source common.Address, lifetime_limit *big.Int, threshold *big.Int, nonce *big.Int, signatures []byte) (*types.Transaction, error) { + return _ERC20Bridge.contract.Transact(opts, "set_asset_limits", asset_source, lifetime_limit, threshold, nonce, signatures) +} + +// SetAssetLimits is a paid mutator transaction binding the contract method 0x41fb776d. +// +// Solidity: function set_asset_limits(address asset_source, uint256 lifetime_limit, uint256 threshold, uint256 nonce, bytes signatures) returns() +func (_ERC20Bridge *ERC20BridgeSession) SetAssetLimits(asset_source common.Address, lifetime_limit *big.Int, threshold *big.Int, nonce *big.Int, signatures []byte) (*types.Transaction, error) { + return _ERC20Bridge.Contract.SetAssetLimits(&_ERC20Bridge.TransactOpts, asset_source, lifetime_limit, threshold, nonce, signatures) +} + +// SetAssetLimits is a paid mutator transaction binding the contract method 0x41fb776d. +// +// Solidity: function set_asset_limits(address asset_source, uint256 lifetime_limit, uint256 threshold, uint256 nonce, bytes signatures) returns() +func (_ERC20Bridge *ERC20BridgeTransactorSession) SetAssetLimits(asset_source common.Address, lifetime_limit *big.Int, threshold *big.Int, nonce *big.Int, signatures []byte) (*types.Transaction, error) { + return _ERC20Bridge.Contract.SetAssetLimits(&_ERC20Bridge.TransactOpts, asset_source, lifetime_limit, threshold, nonce, signatures) +} + +// SetWithdrawDelay is a paid mutator transaction binding the contract method 0x5a246728. +// +// Solidity: function set_withdraw_delay(uint256 delay, uint256 nonce, bytes signatures) returns() +func (_ERC20Bridge *ERC20BridgeTransactor) SetWithdrawDelay(opts *bind.TransactOpts, delay *big.Int, nonce *big.Int, signatures []byte) (*types.Transaction, error) { + return _ERC20Bridge.contract.Transact(opts, "set_withdraw_delay", delay, nonce, signatures) +} + +// SetWithdrawDelay is a paid mutator transaction binding the contract method 0x5a246728. +// +// Solidity: function set_withdraw_delay(uint256 delay, uint256 nonce, bytes signatures) returns() +func (_ERC20Bridge *ERC20BridgeSession) SetWithdrawDelay(delay *big.Int, nonce *big.Int, signatures []byte) (*types.Transaction, error) { + return _ERC20Bridge.Contract.SetWithdrawDelay(&_ERC20Bridge.TransactOpts, delay, nonce, signatures) +} + +// SetWithdrawDelay is a paid mutator transaction binding the contract method 0x5a246728. +// +// Solidity: function set_withdraw_delay(uint256 delay, uint256 nonce, bytes signatures) returns() +func (_ERC20Bridge *ERC20BridgeTransactorSession) SetWithdrawDelay(delay *big.Int, nonce *big.Int, signatures []byte) (*types.Transaction, error) { + return _ERC20Bridge.Contract.SetWithdrawDelay(&_ERC20Bridge.TransactOpts, delay, nonce, signatures) +} + +// WithdrawAsset is a paid mutator transaction binding the contract method 0x3ad90635. +// +// Solidity: function withdraw_asset(address asset_source, uint256 amount, address target, uint256 creation, uint256 nonce, bytes signatures) returns() +func (_ERC20Bridge *ERC20BridgeTransactor) WithdrawAsset(opts *bind.TransactOpts, asset_source common.Address, amount *big.Int, target common.Address, creation *big.Int, nonce *big.Int, signatures []byte) (*types.Transaction, error) { + return _ERC20Bridge.contract.Transact(opts, "withdraw_asset", asset_source, amount, target, creation, nonce, signatures) +} + +// WithdrawAsset is a paid mutator transaction binding the contract method 0x3ad90635. +// +// Solidity: function withdraw_asset(address asset_source, uint256 amount, address target, uint256 creation, uint256 nonce, bytes signatures) returns() +func (_ERC20Bridge *ERC20BridgeSession) WithdrawAsset(asset_source common.Address, amount *big.Int, target common.Address, creation *big.Int, nonce *big.Int, signatures []byte) (*types.Transaction, error) { + return _ERC20Bridge.Contract.WithdrawAsset(&_ERC20Bridge.TransactOpts, asset_source, amount, target, creation, nonce, signatures) +} + +// WithdrawAsset is a paid mutator transaction binding the contract method 0x3ad90635. +// +// Solidity: function withdraw_asset(address asset_source, uint256 amount, address target, uint256 creation, uint256 nonce, bytes signatures) returns() +func (_ERC20Bridge *ERC20BridgeTransactorSession) WithdrawAsset(asset_source common.Address, amount *big.Int, target common.Address, creation *big.Int, nonce *big.Int, signatures []byte) (*types.Transaction, error) { + return _ERC20Bridge.Contract.WithdrawAsset(&_ERC20Bridge.TransactOpts, asset_source, amount, target, creation, nonce, signatures) +} + +// ERC20BridgeAssetDepositedIterator is returned from FilterAssetDeposited and is used to iterate over the raw logs and unpacked data for AssetDeposited events raised by the ERC20Bridge contract. +type ERC20BridgeAssetDepositedIterator struct { + Event *ERC20BridgeAssetDeposited // 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 *ERC20BridgeAssetDepositedIterator) 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(ERC20BridgeAssetDeposited) + 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(ERC20BridgeAssetDeposited) + 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 *ERC20BridgeAssetDepositedIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *ERC20BridgeAssetDepositedIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// ERC20BridgeAssetDeposited represents a AssetDeposited event raised by the ERC20Bridge contract. +type ERC20BridgeAssetDeposited struct { + UserAddress common.Address + AssetSource common.Address + Amount *big.Int + VegaPublicKey [32]byte + Raw types.Log // Blockchain specific contextual infos +} + +// FilterAssetDeposited is a free log retrieval operation binding the contract event 0x3724ff5e82ddc640a08d68b0b782a5991aea0de51a8dd10a59cdbe5b3ec4e6bf. +// +// Solidity: event Asset_Deposited(address indexed user_address, address indexed asset_source, uint256 amount, bytes32 vega_public_key) +func (_ERC20Bridge *ERC20BridgeFilterer) FilterAssetDeposited(opts *bind.FilterOpts, user_address []common.Address, asset_source []common.Address) (*ERC20BridgeAssetDepositedIterator, error) { + + var user_addressRule []interface{} + for _, user_addressItem := range user_address { + user_addressRule = append(user_addressRule, user_addressItem) + } + var asset_sourceRule []interface{} + for _, asset_sourceItem := range asset_source { + asset_sourceRule = append(asset_sourceRule, asset_sourceItem) + } + + logs, sub, err := _ERC20Bridge.contract.FilterLogs(opts, "Asset_Deposited", user_addressRule, asset_sourceRule) + if err != nil { + return nil, err + } + return &ERC20BridgeAssetDepositedIterator{contract: _ERC20Bridge.contract, event: "Asset_Deposited", logs: logs, sub: sub}, nil +} + +// WatchAssetDeposited is a free log subscription operation binding the contract event 0x3724ff5e82ddc640a08d68b0b782a5991aea0de51a8dd10a59cdbe5b3ec4e6bf. +// +// Solidity: event Asset_Deposited(address indexed user_address, address indexed asset_source, uint256 amount, bytes32 vega_public_key) +func (_ERC20Bridge *ERC20BridgeFilterer) WatchAssetDeposited(opts *bind.WatchOpts, sink chan<- *ERC20BridgeAssetDeposited, user_address []common.Address, asset_source []common.Address) (event.Subscription, error) { + + var user_addressRule []interface{} + for _, user_addressItem := range user_address { + user_addressRule = append(user_addressRule, user_addressItem) + } + var asset_sourceRule []interface{} + for _, asset_sourceItem := range asset_source { + asset_sourceRule = append(asset_sourceRule, asset_sourceItem) + } + + logs, sub, err := _ERC20Bridge.contract.WatchLogs(opts, "Asset_Deposited", user_addressRule, asset_sourceRule) + 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(ERC20BridgeAssetDeposited) + if err := _ERC20Bridge.contract.UnpackLog(event, "Asset_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 +} + +// ParseAssetDeposited is a log parse operation binding the contract event 0x3724ff5e82ddc640a08d68b0b782a5991aea0de51a8dd10a59cdbe5b3ec4e6bf. +// +// Solidity: event Asset_Deposited(address indexed user_address, address indexed asset_source, uint256 amount, bytes32 vega_public_key) +func (_ERC20Bridge *ERC20BridgeFilterer) ParseAssetDeposited(log types.Log) (*ERC20BridgeAssetDeposited, error) { + event := new(ERC20BridgeAssetDeposited) + if err := _ERC20Bridge.contract.UnpackLog(event, "Asset_Deposited", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// ERC20BridgeAssetLimitsUpdatedIterator is returned from FilterAssetLimitsUpdated and is used to iterate over the raw logs and unpacked data for AssetLimitsUpdated events raised by the ERC20Bridge contract. +type ERC20BridgeAssetLimitsUpdatedIterator struct { + Event *ERC20BridgeAssetLimitsUpdated // 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 *ERC20BridgeAssetLimitsUpdatedIterator) 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(ERC20BridgeAssetLimitsUpdated) + 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(ERC20BridgeAssetLimitsUpdated) + 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 *ERC20BridgeAssetLimitsUpdatedIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *ERC20BridgeAssetLimitsUpdatedIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// ERC20BridgeAssetLimitsUpdated represents a AssetLimitsUpdated event raised by the ERC20Bridge contract. +type ERC20BridgeAssetLimitsUpdated struct { + AssetSource common.Address + LifetimeLimit *big.Int + WithdrawThreshold *big.Int + Raw types.Log // Blockchain specific contextual infos +} + +// FilterAssetLimitsUpdated is a free log retrieval operation binding the contract event 0xfc7eab762b8751ad85c101fd1025c763b4e8d48f2093f506629b606618e884fe. +// +// Solidity: event Asset_Limits_Updated(address indexed asset_source, uint256 lifetime_limit, uint256 withdraw_threshold) +func (_ERC20Bridge *ERC20BridgeFilterer) FilterAssetLimitsUpdated(opts *bind.FilterOpts, asset_source []common.Address) (*ERC20BridgeAssetLimitsUpdatedIterator, error) { + + var asset_sourceRule []interface{} + for _, asset_sourceItem := range asset_source { + asset_sourceRule = append(asset_sourceRule, asset_sourceItem) + } + + logs, sub, err := _ERC20Bridge.contract.FilterLogs(opts, "Asset_Limits_Updated", asset_sourceRule) + if err != nil { + return nil, err + } + return &ERC20BridgeAssetLimitsUpdatedIterator{contract: _ERC20Bridge.contract, event: "Asset_Limits_Updated", logs: logs, sub: sub}, nil +} + +// WatchAssetLimitsUpdated is a free log subscription operation binding the contract event 0xfc7eab762b8751ad85c101fd1025c763b4e8d48f2093f506629b606618e884fe. +// +// Solidity: event Asset_Limits_Updated(address indexed asset_source, uint256 lifetime_limit, uint256 withdraw_threshold) +func (_ERC20Bridge *ERC20BridgeFilterer) WatchAssetLimitsUpdated(opts *bind.WatchOpts, sink chan<- *ERC20BridgeAssetLimitsUpdated, asset_source []common.Address) (event.Subscription, error) { + + var asset_sourceRule []interface{} + for _, asset_sourceItem := range asset_source { + asset_sourceRule = append(asset_sourceRule, asset_sourceItem) + } + + logs, sub, err := _ERC20Bridge.contract.WatchLogs(opts, "Asset_Limits_Updated", asset_sourceRule) + 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(ERC20BridgeAssetLimitsUpdated) + if err := _ERC20Bridge.contract.UnpackLog(event, "Asset_Limits_Updated", 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 +} + +// ParseAssetLimitsUpdated is a log parse operation binding the contract event 0xfc7eab762b8751ad85c101fd1025c763b4e8d48f2093f506629b606618e884fe. +// +// Solidity: event Asset_Limits_Updated(address indexed asset_source, uint256 lifetime_limit, uint256 withdraw_threshold) +func (_ERC20Bridge *ERC20BridgeFilterer) ParseAssetLimitsUpdated(log types.Log) (*ERC20BridgeAssetLimitsUpdated, error) { + event := new(ERC20BridgeAssetLimitsUpdated) + if err := _ERC20Bridge.contract.UnpackLog(event, "Asset_Limits_Updated", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// ERC20BridgeAssetListedIterator is returned from FilterAssetListed and is used to iterate over the raw logs and unpacked data for AssetListed events raised by the ERC20Bridge contract. +type ERC20BridgeAssetListedIterator struct { + Event *ERC20BridgeAssetListed // 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 *ERC20BridgeAssetListedIterator) 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(ERC20BridgeAssetListed) + 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(ERC20BridgeAssetListed) + 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 *ERC20BridgeAssetListedIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *ERC20BridgeAssetListedIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// ERC20BridgeAssetListed represents a AssetListed event raised by the ERC20Bridge contract. +type ERC20BridgeAssetListed struct { + AssetSource common.Address + VegaAssetId [32]byte + Nonce *big.Int + Raw types.Log // Blockchain specific contextual infos +} + +// FilterAssetListed is a free log retrieval operation binding the contract event 0x4180d77d05ff0d31650c548c23f2de07a3da3ad42e3dd6edd817b438a150452e. +// +// Solidity: event Asset_Listed(address indexed asset_source, bytes32 indexed vega_asset_id, uint256 nonce) +func (_ERC20Bridge *ERC20BridgeFilterer) FilterAssetListed(opts *bind.FilterOpts, asset_source []common.Address, vega_asset_id [][32]byte) (*ERC20BridgeAssetListedIterator, error) { + + var asset_sourceRule []interface{} + for _, asset_sourceItem := range asset_source { + asset_sourceRule = append(asset_sourceRule, asset_sourceItem) + } + var vega_asset_idRule []interface{} + for _, vega_asset_idItem := range vega_asset_id { + vega_asset_idRule = append(vega_asset_idRule, vega_asset_idItem) + } + + logs, sub, err := _ERC20Bridge.contract.FilterLogs(opts, "Asset_Listed", asset_sourceRule, vega_asset_idRule) + if err != nil { + return nil, err + } + return &ERC20BridgeAssetListedIterator{contract: _ERC20Bridge.contract, event: "Asset_Listed", logs: logs, sub: sub}, nil +} + +// WatchAssetListed is a free log subscription operation binding the contract event 0x4180d77d05ff0d31650c548c23f2de07a3da3ad42e3dd6edd817b438a150452e. +// +// Solidity: event Asset_Listed(address indexed asset_source, bytes32 indexed vega_asset_id, uint256 nonce) +func (_ERC20Bridge *ERC20BridgeFilterer) WatchAssetListed(opts *bind.WatchOpts, sink chan<- *ERC20BridgeAssetListed, asset_source []common.Address, vega_asset_id [][32]byte) (event.Subscription, error) { + + var asset_sourceRule []interface{} + for _, asset_sourceItem := range asset_source { + asset_sourceRule = append(asset_sourceRule, asset_sourceItem) + } + var vega_asset_idRule []interface{} + for _, vega_asset_idItem := range vega_asset_id { + vega_asset_idRule = append(vega_asset_idRule, vega_asset_idItem) + } + + logs, sub, err := _ERC20Bridge.contract.WatchLogs(opts, "Asset_Listed", asset_sourceRule, vega_asset_idRule) + 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(ERC20BridgeAssetListed) + if err := _ERC20Bridge.contract.UnpackLog(event, "Asset_Listed", 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 +} + +// ParseAssetListed is a log parse operation binding the contract event 0x4180d77d05ff0d31650c548c23f2de07a3da3ad42e3dd6edd817b438a150452e. +// +// Solidity: event Asset_Listed(address indexed asset_source, bytes32 indexed vega_asset_id, uint256 nonce) +func (_ERC20Bridge *ERC20BridgeFilterer) ParseAssetListed(log types.Log) (*ERC20BridgeAssetListed, error) { + event := new(ERC20BridgeAssetListed) + if err := _ERC20Bridge.contract.UnpackLog(event, "Asset_Listed", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// ERC20BridgeAssetRemovedIterator is returned from FilterAssetRemoved and is used to iterate over the raw logs and unpacked data for AssetRemoved events raised by the ERC20Bridge contract. +type ERC20BridgeAssetRemovedIterator struct { + Event *ERC20BridgeAssetRemoved // 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 *ERC20BridgeAssetRemovedIterator) 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(ERC20BridgeAssetRemoved) + 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(ERC20BridgeAssetRemoved) + 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 *ERC20BridgeAssetRemovedIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *ERC20BridgeAssetRemovedIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// ERC20BridgeAssetRemoved represents a AssetRemoved event raised by the ERC20Bridge contract. +type ERC20BridgeAssetRemoved struct { + AssetSource common.Address + Nonce *big.Int + Raw types.Log // Blockchain specific contextual infos +} + +// FilterAssetRemoved is a free log retrieval operation binding the contract event 0x58ad5e799e2df93ab408be0e5c1870d44c80b5bca99dfaf7ddf0dab5e6b155c9. +// +// Solidity: event Asset_Removed(address indexed asset_source, uint256 nonce) +func (_ERC20Bridge *ERC20BridgeFilterer) FilterAssetRemoved(opts *bind.FilterOpts, asset_source []common.Address) (*ERC20BridgeAssetRemovedIterator, error) { + + var asset_sourceRule []interface{} + for _, asset_sourceItem := range asset_source { + asset_sourceRule = append(asset_sourceRule, asset_sourceItem) + } + + logs, sub, err := _ERC20Bridge.contract.FilterLogs(opts, "Asset_Removed", asset_sourceRule) + if err != nil { + return nil, err + } + return &ERC20BridgeAssetRemovedIterator{contract: _ERC20Bridge.contract, event: "Asset_Removed", logs: logs, sub: sub}, nil +} + +// WatchAssetRemoved is a free log subscription operation binding the contract event 0x58ad5e799e2df93ab408be0e5c1870d44c80b5bca99dfaf7ddf0dab5e6b155c9. +// +// Solidity: event Asset_Removed(address indexed asset_source, uint256 nonce) +func (_ERC20Bridge *ERC20BridgeFilterer) WatchAssetRemoved(opts *bind.WatchOpts, sink chan<- *ERC20BridgeAssetRemoved, asset_source []common.Address) (event.Subscription, error) { + + var asset_sourceRule []interface{} + for _, asset_sourceItem := range asset_source { + asset_sourceRule = append(asset_sourceRule, asset_sourceItem) + } + + logs, sub, err := _ERC20Bridge.contract.WatchLogs(opts, "Asset_Removed", asset_sourceRule) + 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(ERC20BridgeAssetRemoved) + if err := _ERC20Bridge.contract.UnpackLog(event, "Asset_Removed", 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 +} + +// ParseAssetRemoved is a log parse operation binding the contract event 0x58ad5e799e2df93ab408be0e5c1870d44c80b5bca99dfaf7ddf0dab5e6b155c9. +// +// Solidity: event Asset_Removed(address indexed asset_source, uint256 nonce) +func (_ERC20Bridge *ERC20BridgeFilterer) ParseAssetRemoved(log types.Log) (*ERC20BridgeAssetRemoved, error) { + event := new(ERC20BridgeAssetRemoved) + if err := _ERC20Bridge.contract.UnpackLog(event, "Asset_Removed", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// ERC20BridgeAssetWithdrawnIterator is returned from FilterAssetWithdrawn and is used to iterate over the raw logs and unpacked data for AssetWithdrawn events raised by the ERC20Bridge contract. +type ERC20BridgeAssetWithdrawnIterator struct { + Event *ERC20BridgeAssetWithdrawn // 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 *ERC20BridgeAssetWithdrawnIterator) 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(ERC20BridgeAssetWithdrawn) + 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(ERC20BridgeAssetWithdrawn) + 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 *ERC20BridgeAssetWithdrawnIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *ERC20BridgeAssetWithdrawnIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// ERC20BridgeAssetWithdrawn represents a AssetWithdrawn event raised by the ERC20Bridge contract. +type ERC20BridgeAssetWithdrawn struct { + UserAddress common.Address + AssetSource common.Address + Amount *big.Int + Nonce *big.Int + Raw types.Log // Blockchain specific contextual infos +} + +// FilterAssetWithdrawn is a free log retrieval operation binding the contract event 0xa79be4f3361e32d396d64c478ecef73732cb40b2a75702c3b3b3226a2c83b5df. +// +// Solidity: event Asset_Withdrawn(address indexed user_address, address indexed asset_source, uint256 amount, uint256 nonce) +func (_ERC20Bridge *ERC20BridgeFilterer) FilterAssetWithdrawn(opts *bind.FilterOpts, user_address []common.Address, asset_source []common.Address) (*ERC20BridgeAssetWithdrawnIterator, error) { + + var user_addressRule []interface{} + for _, user_addressItem := range user_address { + user_addressRule = append(user_addressRule, user_addressItem) + } + var asset_sourceRule []interface{} + for _, asset_sourceItem := range asset_source { + asset_sourceRule = append(asset_sourceRule, asset_sourceItem) + } + + logs, sub, err := _ERC20Bridge.contract.FilterLogs(opts, "Asset_Withdrawn", user_addressRule, asset_sourceRule) + if err != nil { + return nil, err + } + return &ERC20BridgeAssetWithdrawnIterator{contract: _ERC20Bridge.contract, event: "Asset_Withdrawn", logs: logs, sub: sub}, nil +} + +// WatchAssetWithdrawn is a free log subscription operation binding the contract event 0xa79be4f3361e32d396d64c478ecef73732cb40b2a75702c3b3b3226a2c83b5df. +// +// Solidity: event Asset_Withdrawn(address indexed user_address, address indexed asset_source, uint256 amount, uint256 nonce) +func (_ERC20Bridge *ERC20BridgeFilterer) WatchAssetWithdrawn(opts *bind.WatchOpts, sink chan<- *ERC20BridgeAssetWithdrawn, user_address []common.Address, asset_source []common.Address) (event.Subscription, error) { + + var user_addressRule []interface{} + for _, user_addressItem := range user_address { + user_addressRule = append(user_addressRule, user_addressItem) + } + var asset_sourceRule []interface{} + for _, asset_sourceItem := range asset_source { + asset_sourceRule = append(asset_sourceRule, asset_sourceItem) + } + + logs, sub, err := _ERC20Bridge.contract.WatchLogs(opts, "Asset_Withdrawn", user_addressRule, asset_sourceRule) + 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(ERC20BridgeAssetWithdrawn) + if err := _ERC20Bridge.contract.UnpackLog(event, "Asset_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 +} + +// ParseAssetWithdrawn is a log parse operation binding the contract event 0xa79be4f3361e32d396d64c478ecef73732cb40b2a75702c3b3b3226a2c83b5df. +// +// Solidity: event Asset_Withdrawn(address indexed user_address, address indexed asset_source, uint256 amount, uint256 nonce) +func (_ERC20Bridge *ERC20BridgeFilterer) ParseAssetWithdrawn(log types.Log) (*ERC20BridgeAssetWithdrawn, error) { + event := new(ERC20BridgeAssetWithdrawn) + if err := _ERC20Bridge.contract.UnpackLog(event, "Asset_Withdrawn", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// ERC20BridgeBridgeResumedIterator is returned from FilterBridgeResumed and is used to iterate over the raw logs and unpacked data for BridgeResumed events raised by the ERC20Bridge contract. +type ERC20BridgeBridgeResumedIterator struct { + Event *ERC20BridgeBridgeResumed // 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 *ERC20BridgeBridgeResumedIterator) 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(ERC20BridgeBridgeResumed) + 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(ERC20BridgeBridgeResumed) + 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 *ERC20BridgeBridgeResumedIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *ERC20BridgeBridgeResumedIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// ERC20BridgeBridgeResumed represents a BridgeResumed event raised by the ERC20Bridge contract. +type ERC20BridgeBridgeResumed struct { + Raw types.Log // Blockchain specific contextual infos +} + +// FilterBridgeResumed is a free log retrieval operation binding the contract event 0x79c02b0e60e0f00fe0370791204f2f175fe3f06f4816f3506ad4fa1b8e8cde0f. +// +// Solidity: event Bridge_Resumed() +func (_ERC20Bridge *ERC20BridgeFilterer) FilterBridgeResumed(opts *bind.FilterOpts) (*ERC20BridgeBridgeResumedIterator, error) { + + logs, sub, err := _ERC20Bridge.contract.FilterLogs(opts, "Bridge_Resumed") + if err != nil { + return nil, err + } + return &ERC20BridgeBridgeResumedIterator{contract: _ERC20Bridge.contract, event: "Bridge_Resumed", logs: logs, sub: sub}, nil +} + +// WatchBridgeResumed is a free log subscription operation binding the contract event 0x79c02b0e60e0f00fe0370791204f2f175fe3f06f4816f3506ad4fa1b8e8cde0f. +// +// Solidity: event Bridge_Resumed() +func (_ERC20Bridge *ERC20BridgeFilterer) WatchBridgeResumed(opts *bind.WatchOpts, sink chan<- *ERC20BridgeBridgeResumed) (event.Subscription, error) { + + logs, sub, err := _ERC20Bridge.contract.WatchLogs(opts, "Bridge_Resumed") + 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(ERC20BridgeBridgeResumed) + if err := _ERC20Bridge.contract.UnpackLog(event, "Bridge_Resumed", 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 +} + +// ParseBridgeResumed is a log parse operation binding the contract event 0x79c02b0e60e0f00fe0370791204f2f175fe3f06f4816f3506ad4fa1b8e8cde0f. +// +// Solidity: event Bridge_Resumed() +func (_ERC20Bridge *ERC20BridgeFilterer) ParseBridgeResumed(log types.Log) (*ERC20BridgeBridgeResumed, error) { + event := new(ERC20BridgeBridgeResumed) + if err := _ERC20Bridge.contract.UnpackLog(event, "Bridge_Resumed", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// ERC20BridgeBridgeStoppedIterator is returned from FilterBridgeStopped and is used to iterate over the raw logs and unpacked data for BridgeStopped events raised by the ERC20Bridge contract. +type ERC20BridgeBridgeStoppedIterator struct { + Event *ERC20BridgeBridgeStopped // 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 *ERC20BridgeBridgeStoppedIterator) 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(ERC20BridgeBridgeStopped) + 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(ERC20BridgeBridgeStopped) + 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 *ERC20BridgeBridgeStoppedIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *ERC20BridgeBridgeStoppedIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// ERC20BridgeBridgeStopped represents a BridgeStopped event raised by the ERC20Bridge contract. +type ERC20BridgeBridgeStopped struct { + Raw types.Log // Blockchain specific contextual infos +} + +// FilterBridgeStopped is a free log retrieval operation binding the contract event 0x129d99581c8e70519df1f0733d3212f33d0ed3ea6144adacc336c647f1d36382. +// +// Solidity: event Bridge_Stopped() +func (_ERC20Bridge *ERC20BridgeFilterer) FilterBridgeStopped(opts *bind.FilterOpts) (*ERC20BridgeBridgeStoppedIterator, error) { + + logs, sub, err := _ERC20Bridge.contract.FilterLogs(opts, "Bridge_Stopped") + if err != nil { + return nil, err + } + return &ERC20BridgeBridgeStoppedIterator{contract: _ERC20Bridge.contract, event: "Bridge_Stopped", logs: logs, sub: sub}, nil +} + +// WatchBridgeStopped is a free log subscription operation binding the contract event 0x129d99581c8e70519df1f0733d3212f33d0ed3ea6144adacc336c647f1d36382. +// +// Solidity: event Bridge_Stopped() +func (_ERC20Bridge *ERC20BridgeFilterer) WatchBridgeStopped(opts *bind.WatchOpts, sink chan<- *ERC20BridgeBridgeStopped) (event.Subscription, error) { + + logs, sub, err := _ERC20Bridge.contract.WatchLogs(opts, "Bridge_Stopped") + 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(ERC20BridgeBridgeStopped) + if err := _ERC20Bridge.contract.UnpackLog(event, "Bridge_Stopped", 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 +} + +// ParseBridgeStopped is a log parse operation binding the contract event 0x129d99581c8e70519df1f0733d3212f33d0ed3ea6144adacc336c647f1d36382. +// +// Solidity: event Bridge_Stopped() +func (_ERC20Bridge *ERC20BridgeFilterer) ParseBridgeStopped(log types.Log) (*ERC20BridgeBridgeStopped, error) { + event := new(ERC20BridgeBridgeStopped) + if err := _ERC20Bridge.contract.UnpackLog(event, "Bridge_Stopped", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// ERC20BridgeBridgeWithdrawDelaySetIterator is returned from FilterBridgeWithdrawDelaySet and is used to iterate over the raw logs and unpacked data for BridgeWithdrawDelaySet events raised by the ERC20Bridge contract. +type ERC20BridgeBridgeWithdrawDelaySetIterator struct { + Event *ERC20BridgeBridgeWithdrawDelaySet // 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 *ERC20BridgeBridgeWithdrawDelaySetIterator) 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(ERC20BridgeBridgeWithdrawDelaySet) + 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(ERC20BridgeBridgeWithdrawDelaySet) + 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 *ERC20BridgeBridgeWithdrawDelaySetIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *ERC20BridgeBridgeWithdrawDelaySetIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// ERC20BridgeBridgeWithdrawDelaySet represents a BridgeWithdrawDelaySet event raised by the ERC20Bridge contract. +type ERC20BridgeBridgeWithdrawDelaySet struct { + WithdrawDelay *big.Int + Raw types.Log // Blockchain specific contextual infos +} + +// FilterBridgeWithdrawDelaySet is a free log retrieval operation binding the contract event 0x1c7e8f73a01b8af4e18dd34455a42a45ad742bdb79cfda77bbdf50db2391fc88. +// +// Solidity: event Bridge_Withdraw_Delay_Set(uint256 withdraw_delay) +func (_ERC20Bridge *ERC20BridgeFilterer) FilterBridgeWithdrawDelaySet(opts *bind.FilterOpts) (*ERC20BridgeBridgeWithdrawDelaySetIterator, error) { + + logs, sub, err := _ERC20Bridge.contract.FilterLogs(opts, "Bridge_Withdraw_Delay_Set") + if err != nil { + return nil, err + } + return &ERC20BridgeBridgeWithdrawDelaySetIterator{contract: _ERC20Bridge.contract, event: "Bridge_Withdraw_Delay_Set", logs: logs, sub: sub}, nil +} + +// WatchBridgeWithdrawDelaySet is a free log subscription operation binding the contract event 0x1c7e8f73a01b8af4e18dd34455a42a45ad742bdb79cfda77bbdf50db2391fc88. +// +// Solidity: event Bridge_Withdraw_Delay_Set(uint256 withdraw_delay) +func (_ERC20Bridge *ERC20BridgeFilterer) WatchBridgeWithdrawDelaySet(opts *bind.WatchOpts, sink chan<- *ERC20BridgeBridgeWithdrawDelaySet) (event.Subscription, error) { + + logs, sub, err := _ERC20Bridge.contract.WatchLogs(opts, "Bridge_Withdraw_Delay_Set") + 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(ERC20BridgeBridgeWithdrawDelaySet) + if err := _ERC20Bridge.contract.UnpackLog(event, "Bridge_Withdraw_Delay_Set", 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 +} + +// ParseBridgeWithdrawDelaySet is a log parse operation binding the contract event 0x1c7e8f73a01b8af4e18dd34455a42a45ad742bdb79cfda77bbdf50db2391fc88. +// +// Solidity: event Bridge_Withdraw_Delay_Set(uint256 withdraw_delay) +func (_ERC20Bridge *ERC20BridgeFilterer) ParseBridgeWithdrawDelaySet(log types.Log) (*ERC20BridgeBridgeWithdrawDelaySet, error) { + event := new(ERC20BridgeBridgeWithdrawDelaySet) + if err := _ERC20Bridge.contract.UnpackLog(event, "Bridge_Withdraw_Delay_Set", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// ERC20BridgeDepositorExemptedIterator is returned from FilterDepositorExempted and is used to iterate over the raw logs and unpacked data for DepositorExempted events raised by the ERC20Bridge contract. +type ERC20BridgeDepositorExemptedIterator struct { + Event *ERC20BridgeDepositorExempted // 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 *ERC20BridgeDepositorExemptedIterator) 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(ERC20BridgeDepositorExempted) + 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(ERC20BridgeDepositorExempted) + 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 *ERC20BridgeDepositorExemptedIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *ERC20BridgeDepositorExemptedIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// ERC20BridgeDepositorExempted represents a DepositorExempted event raised by the ERC20Bridge contract. +type ERC20BridgeDepositorExempted struct { + Depositor common.Address + Raw types.Log // Blockchain specific contextual infos +} + +// FilterDepositorExempted is a free log retrieval operation binding the contract event 0xf56e0868b913034a60dbca9c89ee79f8b0fa18dadbc5f6665f2f9a2cf3f51cdb. +// +// Solidity: event Depositor_Exempted(address indexed depositor) +func (_ERC20Bridge *ERC20BridgeFilterer) FilterDepositorExempted(opts *bind.FilterOpts, depositor []common.Address) (*ERC20BridgeDepositorExemptedIterator, error) { + + var depositorRule []interface{} + for _, depositorItem := range depositor { + depositorRule = append(depositorRule, depositorItem) + } + + logs, sub, err := _ERC20Bridge.contract.FilterLogs(opts, "Depositor_Exempted", depositorRule) + if err != nil { + return nil, err + } + return &ERC20BridgeDepositorExemptedIterator{contract: _ERC20Bridge.contract, event: "Depositor_Exempted", logs: logs, sub: sub}, nil +} + +// WatchDepositorExempted is a free log subscription operation binding the contract event 0xf56e0868b913034a60dbca9c89ee79f8b0fa18dadbc5f6665f2f9a2cf3f51cdb. +// +// Solidity: event Depositor_Exempted(address indexed depositor) +func (_ERC20Bridge *ERC20BridgeFilterer) WatchDepositorExempted(opts *bind.WatchOpts, sink chan<- *ERC20BridgeDepositorExempted, depositor []common.Address) (event.Subscription, error) { + + var depositorRule []interface{} + for _, depositorItem := range depositor { + depositorRule = append(depositorRule, depositorItem) + } + + logs, sub, err := _ERC20Bridge.contract.WatchLogs(opts, "Depositor_Exempted", depositorRule) + 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(ERC20BridgeDepositorExempted) + if err := _ERC20Bridge.contract.UnpackLog(event, "Depositor_Exempted", 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 +} + +// ParseDepositorExempted is a log parse operation binding the contract event 0xf56e0868b913034a60dbca9c89ee79f8b0fa18dadbc5f6665f2f9a2cf3f51cdb. +// +// Solidity: event Depositor_Exempted(address indexed depositor) +func (_ERC20Bridge *ERC20BridgeFilterer) ParseDepositorExempted(log types.Log) (*ERC20BridgeDepositorExempted, error) { + event := new(ERC20BridgeDepositorExempted) + if err := _ERC20Bridge.contract.UnpackLog(event, "Depositor_Exempted", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// ERC20BridgeDepositorExemptionRevokedIterator is returned from FilterDepositorExemptionRevoked and is used to iterate over the raw logs and unpacked data for DepositorExemptionRevoked events raised by the ERC20Bridge contract. +type ERC20BridgeDepositorExemptionRevokedIterator struct { + Event *ERC20BridgeDepositorExemptionRevoked // 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 *ERC20BridgeDepositorExemptionRevokedIterator) 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(ERC20BridgeDepositorExemptionRevoked) + 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(ERC20BridgeDepositorExemptionRevoked) + 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 *ERC20BridgeDepositorExemptionRevokedIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *ERC20BridgeDepositorExemptionRevokedIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// ERC20BridgeDepositorExemptionRevoked represents a DepositorExemptionRevoked event raised by the ERC20Bridge contract. +type ERC20BridgeDepositorExemptionRevoked struct { + Depositor common.Address + Raw types.Log // Blockchain specific contextual infos +} + +// FilterDepositorExemptionRevoked is a free log retrieval operation binding the contract event 0xe74b113dca87276d976f476a9b4b9da3c780a3262eaabad051ee4e98912936a4. +// +// Solidity: event Depositor_Exemption_Revoked(address indexed depositor) +func (_ERC20Bridge *ERC20BridgeFilterer) FilterDepositorExemptionRevoked(opts *bind.FilterOpts, depositor []common.Address) (*ERC20BridgeDepositorExemptionRevokedIterator, error) { + + var depositorRule []interface{} + for _, depositorItem := range depositor { + depositorRule = append(depositorRule, depositorItem) + } + + logs, sub, err := _ERC20Bridge.contract.FilterLogs(opts, "Depositor_Exemption_Revoked", depositorRule) + if err != nil { + return nil, err + } + return &ERC20BridgeDepositorExemptionRevokedIterator{contract: _ERC20Bridge.contract, event: "Depositor_Exemption_Revoked", logs: logs, sub: sub}, nil +} + +// WatchDepositorExemptionRevoked is a free log subscription operation binding the contract event 0xe74b113dca87276d976f476a9b4b9da3c780a3262eaabad051ee4e98912936a4. +// +// Solidity: event Depositor_Exemption_Revoked(address indexed depositor) +func (_ERC20Bridge *ERC20BridgeFilterer) WatchDepositorExemptionRevoked(opts *bind.WatchOpts, sink chan<- *ERC20BridgeDepositorExemptionRevoked, depositor []common.Address) (event.Subscription, error) { + + var depositorRule []interface{} + for _, depositorItem := range depositor { + depositorRule = append(depositorRule, depositorItem) + } + + logs, sub, err := _ERC20Bridge.contract.WatchLogs(opts, "Depositor_Exemption_Revoked", depositorRule) + 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(ERC20BridgeDepositorExemptionRevoked) + if err := _ERC20Bridge.contract.UnpackLog(event, "Depositor_Exemption_Revoked", 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 +} + +// ParseDepositorExemptionRevoked is a log parse operation binding the contract event 0xe74b113dca87276d976f476a9b4b9da3c780a3262eaabad051ee4e98912936a4. +// +// Solidity: event Depositor_Exemption_Revoked(address indexed depositor) +func (_ERC20Bridge *ERC20BridgeFilterer) ParseDepositorExemptionRevoked(log types.Log) (*ERC20BridgeDepositorExemptionRevoked, error) { + event := new(ERC20BridgeDepositorExemptionRevoked) + if err := _ERC20Bridge.contract.UnpackLog(event, "Depositor_Exemption_Revoked", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} diff --git a/libs/ethereum/generated/staking_bridge.go b/libs/ethereum/generated/staking_bridge.go new file mode 100644 index 00000000..56f467f3 --- /dev/null +++ b/libs/ethereum/generated/staking_bridge.go @@ -0,0 +1,201 @@ +// Code generated - DO NOT EDIT. +// This file is a generated binding and any manual changes will be lost. + +package generated + +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 +) + +// StakingBridgeMetaData contains all meta data concerning the StakingBridge contract. +var StakingBridgeMetaData = &bind.MetaData{ + ABI: "[{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"bytes32\",\"name\":\"vega_public_key\",\"type\":\"bytes32\"}],\"name\":\"stake\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]", +} + +// StakingBridgeABI is the input ABI used to generate the binding from. +// Deprecated: Use StakingBridgeMetaData.ABI instead. +var StakingBridgeABI = StakingBridgeMetaData.ABI + +// StakingBridge is an auto generated Go binding around an Ethereum contract. +type StakingBridge struct { + StakingBridgeCaller // Read-only binding to the contract + StakingBridgeTransactor // Write-only binding to the contract + StakingBridgeFilterer // Log filterer for contract events +} + +// StakingBridgeCaller is an auto generated read-only Go binding around an Ethereum contract. +type StakingBridgeCaller struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// StakingBridgeTransactor is an auto generated write-only Go binding around an Ethereum contract. +type StakingBridgeTransactor struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// StakingBridgeFilterer is an auto generated log filtering Go binding around an Ethereum contract events. +type StakingBridgeFilterer struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// StakingBridgeSession is an auto generated Go binding around an Ethereum contract, +// with pre-set call and transact options. +type StakingBridgeSession struct { + Contract *StakingBridge // 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 +} + +// StakingBridgeCallerSession is an auto generated read-only Go binding around an Ethereum contract, +// with pre-set call options. +type StakingBridgeCallerSession struct { + Contract *StakingBridgeCaller // Generic contract caller binding to set the session for + CallOpts bind.CallOpts // Call options to use throughout this session +} + +// StakingBridgeTransactorSession is an auto generated write-only Go binding around an Ethereum contract, +// with pre-set transact options. +type StakingBridgeTransactorSession struct { + Contract *StakingBridgeTransactor // Generic contract transactor binding to set the session for + TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session +} + +// StakingBridgeRaw is an auto generated low-level Go binding around an Ethereum contract. +type StakingBridgeRaw struct { + Contract *StakingBridge // Generic contract binding to access the raw methods on +} + +// StakingBridgeCallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract. +type StakingBridgeCallerRaw struct { + Contract *StakingBridgeCaller // Generic read-only contract binding to access the raw methods on +} + +// StakingBridgeTransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract. +type StakingBridgeTransactorRaw struct { + Contract *StakingBridgeTransactor // Generic write-only contract binding to access the raw methods on +} + +// NewStakingBridge creates a new instance of StakingBridge, bound to a specific deployed contract. +func NewStakingBridge(address common.Address, backend bind.ContractBackend) (*StakingBridge, error) { + contract, err := bindStakingBridge(address, backend, backend, backend) + if err != nil { + return nil, err + } + return &StakingBridge{StakingBridgeCaller: StakingBridgeCaller{contract: contract}, StakingBridgeTransactor: StakingBridgeTransactor{contract: contract}, StakingBridgeFilterer: StakingBridgeFilterer{contract: contract}}, nil +} + +// NewStakingBridgeCaller creates a new read-only instance of StakingBridge, bound to a specific deployed contract. +func NewStakingBridgeCaller(address common.Address, caller bind.ContractCaller) (*StakingBridgeCaller, error) { + contract, err := bindStakingBridge(address, caller, nil, nil) + if err != nil { + return nil, err + } + return &StakingBridgeCaller{contract: contract}, nil +} + +// NewStakingBridgeTransactor creates a new write-only instance of StakingBridge, bound to a specific deployed contract. +func NewStakingBridgeTransactor(address common.Address, transactor bind.ContractTransactor) (*StakingBridgeTransactor, error) { + contract, err := bindStakingBridge(address, nil, transactor, nil) + if err != nil { + return nil, err + } + return &StakingBridgeTransactor{contract: contract}, nil +} + +// NewStakingBridgeFilterer creates a new log filterer instance of StakingBridge, bound to a specific deployed contract. +func NewStakingBridgeFilterer(address common.Address, filterer bind.ContractFilterer) (*StakingBridgeFilterer, error) { + contract, err := bindStakingBridge(address, nil, nil, filterer) + if err != nil { + return nil, err + } + return &StakingBridgeFilterer{contract: contract}, nil +} + +// bindStakingBridge binds a generic wrapper to an already deployed contract. +func bindStakingBridge(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) { + parsed, err := abi.JSON(strings.NewReader(StakingBridgeABI)) + 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 (_StakingBridge *StakingBridgeRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { + return _StakingBridge.Contract.StakingBridgeCaller.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 (_StakingBridge *StakingBridgeRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _StakingBridge.Contract.StakingBridgeTransactor.contract.Transfer(opts) +} + +// Transact invokes the (paid) contract method with params as input values. +func (_StakingBridge *StakingBridgeRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _StakingBridge.Contract.StakingBridgeTransactor.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 (_StakingBridge *StakingBridgeCallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { + return _StakingBridge.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 (_StakingBridge *StakingBridgeTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _StakingBridge.Contract.contract.Transfer(opts) +} + +// Transact invokes the (paid) contract method with params as input values. +func (_StakingBridge *StakingBridgeTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _StakingBridge.Contract.contract.Transact(opts, method, params...) +} + +// Stake is a paid mutator transaction binding the contract method 0x83c592cf. +// +// Solidity: function stake(uint256 amount, bytes32 vega_public_key) returns() +func (_StakingBridge *StakingBridgeTransactor) Stake(opts *bind.TransactOpts, amount *big.Int, vega_public_key [32]byte) (*types.Transaction, error) { + return _StakingBridge.contract.Transact(opts, "stake", amount, vega_public_key) +} + +// Stake is a paid mutator transaction binding the contract method 0x83c592cf. +// +// Solidity: function stake(uint256 amount, bytes32 vega_public_key) returns() +func (_StakingBridge *StakingBridgeSession) Stake(amount *big.Int, vega_public_key [32]byte) (*types.Transaction, error) { + return _StakingBridge.Contract.Stake(&_StakingBridge.TransactOpts, amount, vega_public_key) +} + +// Stake is a paid mutator transaction binding the contract method 0x83c592cf. +// +// Solidity: function stake(uint256 amount, bytes32 vega_public_key) returns() +func (_StakingBridge *StakingBridgeTransactorSession) Stake(amount *big.Int, vega_public_key [32]byte) (*types.Transaction, error) { + return _StakingBridge.Contract.Stake(&_StakingBridge.TransactOpts, amount, vega_public_key) +} diff --git a/libs/ethereum/staking_bridge_session.go b/libs/ethereum/staking_bridge_session.go new file mode 100644 index 00000000..7f20861d --- /dev/null +++ b/libs/ethereum/staking_bridge_session.go @@ -0,0 +1,19 @@ +package ethereum + +import ( + "time" + + "code.vegaprotocol.io/vegacapsule/libs/ethereum/generated" + + "github.com/ethereum/go-ethereum/common" +) + +type StakingBridgeSession struct { + generated.StakingBridgeSession + syncTimeout time.Duration + address common.Address +} + +func (ss StakingBridgeSession) Address() common.Address { + return ss.address +} diff --git a/logscollector/collector.go b/logscollector/collector.go index 2d4ac450..d56146c5 100644 --- a/logscollector/collector.go +++ b/logscollector/collector.go @@ -116,7 +116,6 @@ func (lc Collector) collectLogs(ctx context.Context, logFilePath string) error { case <-stopChan: return nil } - } } diff --git a/logscollector/printer.go b/logscollector/printer.go index 60b328df..6a04d363 100644 --- a/logscollector/printer.go +++ b/logscollector/printer.go @@ -13,6 +13,7 @@ import ( "code.vegaprotocol.io/vegacapsule/types" "code.vegaprotocol.io/vegacapsule/utils" + "github.com/nxadm/tail" "golang.org/x/sync/errgroup" ) diff --git a/nomad/client.go b/nomad/client.go index 8dc18f63..97c7e783 100644 --- a/nomad/client.go +++ b/nomad/client.go @@ -8,6 +8,7 @@ import ( "code.vegaprotocol.io/vegacapsule/probes" "code.vegaprotocol.io/vegacapsule/types" + "github.com/hashicorp/nomad/api" ) diff --git a/nomad/client_allocs.go b/nomad/client_allocs.go index a2c03da2..7175d620 100644 --- a/nomad/client_allocs.go +++ b/nomad/client_allocs.go @@ -55,7 +55,6 @@ func (ai allocationInfo) finishedWithoutError() bool { return strings.ToLower(e.Type) == Terminated && e.ExitCode == 0 && !e.FailsTask - } // lastEventMessageContains lowercase the message and check if message contains given text. diff --git a/nomad/job_runner.go b/nomad/job_runner.go index 4db20659..675565c7 100644 --- a/nomad/job_runner.go +++ b/nomad/job_runner.go @@ -11,10 +11,10 @@ import ( "code.vegaprotocol.io/vegacapsule/config" "code.vegaprotocol.io/vegacapsule/logscollector" "code.vegaprotocol.io/vegacapsule/types" - "golang.org/x/sync/errgroup" "github.com/hashicorp/nomad/api" "github.com/hashicorp/nomad/jobspec2" + "golang.org/x/sync/errgroup" ) type JobRunner struct { @@ -203,7 +203,6 @@ func (r *JobRunner) RunDockerJob(ctx context.Context, dc config.DockerConfig) (s return "", fmt.Errorf("failed to run pre start job %q: %w", *job.ID, err) } return *job.ID, nil - } func (r *JobRunner) RunExecJob(ctx context.Context, ec config.ExecConfig) (string, error) { diff --git a/nomad/job_runner_void.go b/nomad/job_runner_void.go index 14617c2a..7771978b 100644 --- a/nomad/job_runner_void.go +++ b/nomad/job_runner_void.go @@ -5,6 +5,7 @@ import ( "fmt" "code.vegaprotocol.io/vegacapsule/types" + "github.com/hashicorp/nomad/api" ) diff --git a/nomad/runner/binary_installer.go b/nomad/runner/binary_installer.go index b766c847..1c1ebda9 100644 --- a/nomad/runner/binary_installer.go +++ b/nomad/runner/binary_installer.go @@ -21,9 +21,7 @@ const ( nomadBinaryVersion = "1.3.14" ) -var ( - nomadBinaryName = fmt.Sprintf("%s_%s", nomadBinName, nomadBinaryVersion) -) +var nomadBinaryName = fmt.Sprintf("%s_%s", nomadBinName, nomadBinaryVersion) func nomadBinaryPath() (string, error) { homeDir, err := capsuleHome() @@ -89,7 +87,7 @@ func installNomadBinary(localBinPath, binInstallPath string) (err error) { } defer binFile.Close() - err = os.Chmod(localBinPath, 0755) + err = os.Chmod(localBinPath, 0o755) if err != nil { return fmt.Errorf("failed to change permission for file %q: %w", localBinPath, err) } diff --git a/probes/probe.go b/probes/probe.go index 7cea232f..d714dc22 100644 --- a/probes/probe.go +++ b/probes/probe.go @@ -7,6 +7,7 @@ import ( "time" "code.vegaprotocol.io/vegacapsule/types" + "golang.org/x/sync/errgroup" ) diff --git a/types/node_set_test.go b/types/node_set_test.go index 38aa2de5..8ac79a2d 100644 --- a/types/node_set_test.go +++ b/types/node_set_test.go @@ -4,6 +4,7 @@ import ( "testing" "code.vegaprotocol.io/vegacapsule/types" + "github.com/stretchr/testify/assert" ) diff --git a/utils/filesystem.go b/utils/filesystem.go index 91d5489c..e9f6497e 100644 --- a/utils/filesystem.go +++ b/utils/filesystem.go @@ -69,7 +69,7 @@ func DirEmpty(path string, ignore ...string) (bool, error) { // Create file creates file and it's path if not exists. func CreateFile(p string) (*os.File, error) { - if err := os.MkdirAll(filepath.Dir(p), 0770); err != nil { + if err := os.MkdirAll(filepath.Dir(p), 0o770); err != nil { return nil, err } return os.Create(p) @@ -81,7 +81,7 @@ func CopyFile(srcFile, dstFile string) error { return fmt.Errorf("failed to read file %q: %w", srcFile, err) } - if err := os.WriteFile(dstFile, input, 0644); err != nil { + if err := os.WriteFile(dstFile, input, 0o644); err != nil { return fmt.Errorf("failed to write to file %q: %w", dstFile, err) } @@ -135,7 +135,7 @@ func CpAndChmodxFile(source, destination string) error { return fmt.Errorf("failed to copy file %q to %q: %w", source, destination, err) } - if err := os.Chmod(destination, 0700); err != nil { + if err := os.Chmod(destination, 0o700); err != nil { return fmt.Errorf("failed to chmod 0700 file %q: %w", destination, err) }