From e63bc15331a607ee85ec811cd58b3c63840de3ca Mon Sep 17 00:00:00 2001 From: Franky <75002277+FrankLi123@users.noreply.github.com> Date: Sat, 7 Sep 2024 12:56:31 +0800 Subject: [PATCH] feat(worker/paraswap): add paraswap worker (#507) fix: re-add paraswap content --- .../decentralized/contract/paraswap/worker.go | 232 ++++ .../contract/paraswap/worker_test.go | 440 ++++++ .../engine/worker/decentralized/factory.go | 3 + .../node/component/info/network_config.go | 2 + .../contract/paraswap/abi/V5ParaSwap.abi | 1018 ++++++++++++++ .../ethereum/contract/paraswap/contract.go | 21 + .../contract/paraswap/contract_v5_paraswap.go | 1218 +++++++++++++++++ schema/worker/decentralized/platform.go | 2 + .../worker/decentralized/platform_string.go | 52 +- schema/worker/decentralized/worker.go | 2 + schema/worker/decentralized/worker_string.go | 52 +- 11 files changed, 2994 insertions(+), 48 deletions(-) create mode 100644 internal/engine/worker/decentralized/contract/paraswap/worker.go create mode 100644 internal/engine/worker/decentralized/contract/paraswap/worker_test.go create mode 100644 provider/ethereum/contract/paraswap/abi/V5ParaSwap.abi create mode 100644 provider/ethereum/contract/paraswap/contract.go create mode 100644 provider/ethereum/contract/paraswap/contract_v5_paraswap.go diff --git a/internal/engine/worker/decentralized/contract/paraswap/worker.go b/internal/engine/worker/decentralized/contract/paraswap/worker.go new file mode 100644 index 00000000..593d944c --- /dev/null +++ b/internal/engine/worker/decentralized/contract/paraswap/worker.go @@ -0,0 +1,232 @@ +package paraswap + +import ( + "context" + "fmt" + "math/big" + + "github.com/ethereum/go-ethereum/common" + "github.com/rss3-network/node/config" + "github.com/rss3-network/node/internal/engine" + source "github.com/rss3-network/node/internal/engine/source/ethereum" + "github.com/rss3-network/node/provider/ethereum" + "github.com/rss3-network/node/provider/ethereum/contract" + "github.com/rss3-network/node/provider/ethereum/contract/paraswap" + "github.com/rss3-network/node/provider/ethereum/token" + "github.com/rss3-network/node/schema/worker/decentralized" + "github.com/rss3-network/protocol-go/schema" + activityx "github.com/rss3-network/protocol-go/schema/activity" + "github.com/rss3-network/protocol-go/schema/metadata" + "github.com/rss3-network/protocol-go/schema/network" + "github.com/rss3-network/protocol-go/schema/tag" + "github.com/rss3-network/protocol-go/schema/typex" + "github.com/samber/lo" + "github.com/shopspring/decimal" + "go.uber.org/zap" +) + +var _ engine.Worker = (*worker)(nil) + +type worker struct { + ethereumClient ethereum.Client + tokenClient token.Client + paraswapV5Filter *paraswap.V5ParaSwapFilterer +} + +func (w *worker) Name() string { + return decentralized.Paraswap.String() +} + +func (w *worker) Platform() string { + return decentralized.PlatformParaswap.String() +} + +func (w *worker) Network() []network.Network { + return []network.Network{ + network.Ethereum, + } +} + +func (w *worker) Tags() []tag.Tag { + return []tag.Tag{ + tag.Exchange, + } +} + +func (w *worker) Types() []schema.Type { + return []schema.Type{ + typex.ExchangeSwap, + } +} + +func (w *worker) Filter() engine.DataSourceFilter { + return &source.Filter{ + LogAddresses: []common.Address{ + paraswap.AddressV5ParaSwap, + paraswap.AddressV5ParaSwapBase, + }, + LogTopics: []common.Hash{ + paraswap.EventHashV3Swapped, + paraswap.EventHashV3Bought, + paraswap.EventHashSwappedDirect, + }, + } +} + +func (w *worker) Transform(ctx context.Context, task engine.Task) (*activityx.Activity, error) { + ethereumTask, ok := task.(*source.Task) + if !ok { + return nil, fmt.Errorf("invalid task type %T", task) + } + + activity, err := task.BuildActivity(activityx.WithActivityPlatform(w.Platform())) + if err != nil { + return nil, fmt.Errorf("build activity: %w", err) + } + + activity.Type = typex.ExchangeSwap + activity.Actions = w.transformSwapTransaction(ctx, ethereumTask) + + return activity, nil +} + +func (w *worker) transformSwapTransaction(ctx context.Context, ethereumTask *source.Task) (actions []*activityx.Action) { + for _, log := range ethereumTask.Receipt.Logs { + if len(log.Topics) == 0 { + continue + } + + var ( + buffer []*activityx.Action + err error + ) + + switch { + case w.matchV3SwappedLog(ethereumTask, log): + buffer, err = w.transformV3SwappedLog(ctx, ethereumTask, log) + case w.matchV3BoughtLog(ethereumTask, log): + buffer, err = w.transformV3BoughtLog(ctx, ethereumTask, log) + case w.matchSwappedDirectLog(ethereumTask, log): + buffer, err = w.transformSwappedDirectLog(ctx, ethereumTask, log) + default: + zap.L().Debug("unknown event", zap.String("worker", w.Name()), zap.String("task", ethereumTask.ID()), zap.Stringer("event", log.Topics[0])) + continue + } + + if err != nil { + zap.L().Warn("handle paraswap swap transaction", zap.Error(err), zap.String("worker", w.Name()), zap.String("task", ethereumTask.ID())) + continue + } + + actions = append(actions, buffer...) + } + + zap.L().Info("Processing task", zap.Any("task", ethereumTask)) + + return actions +} + +func (w *worker) matchV3SwappedLog(_ *source.Task, log *ethereum.Log) bool { + return contract.MatchEventHashes(log.Topics[0], paraswap.EventHashV3Swapped) && + contract.MatchAddresses(log.Address, paraswap.AddressV5ParaSwap, paraswap.AddressV5ParaSwapBase) +} + +func (w *worker) matchV3BoughtLog(_ *source.Task, log *ethereum.Log) bool { + return contract.MatchEventHashes(log.Topics[0], paraswap.EventHashV3Bought) && + contract.MatchAddresses(log.Address, paraswap.AddressV5ParaSwap, paraswap.AddressV5ParaSwapBase) +} + +func (w *worker) matchSwappedDirectLog(_ *source.Task, log *ethereum.Log) bool { + return contract.MatchEventHashes(log.Topics[0], paraswap.EventHashSwappedDirect) && + contract.MatchAddresses(log.Address, paraswap.AddressV5ParaSwap, paraswap.AddressV5ParaSwapBase) +} + +func (w *worker) transformV3SwappedLog(ctx context.Context, task *source.Task, log *ethereum.Log) ([]*activityx.Action, error) { + event, err := w.paraswapV5Filter.ParseSwappedV3(log.Export()) + if err != nil { + return nil, fmt.Errorf("parse SwappedV3 event: %w", err) + } + + action, err := w.buildExchangeSwapAction(ctx, task, event.Beneficiary, event.Beneficiary, event.SrcToken, event.DestToken, event.SrcAmount, event.ReceivedAmount) + if err != nil { + return nil, fmt.Errorf("build exchange swap action: %w", err) + } + + return []*activityx.Action{action}, nil +} + +func (w *worker) transformV3BoughtLog(ctx context.Context, task *source.Task, log *ethereum.Log) ([]*activityx.Action, error) { + event, err := w.paraswapV5Filter.ParseBoughtV3(log.Export()) + if err != nil { + return nil, fmt.Errorf("parse BoughtV3 event: %w", err) + } + + action, err := w.buildExchangeSwapAction(ctx, task, event.Beneficiary, event.Beneficiary, event.SrcToken, event.DestToken, event.SrcAmount, event.ReceivedAmount) + if err != nil { + return nil, fmt.Errorf("build exchange swap action: %w", err) + } + + return []*activityx.Action{action}, nil +} + +func (w *worker) transformSwappedDirectLog(ctx context.Context, task *source.Task, log *ethereum.Log) ([]*activityx.Action, error) { + event, err := w.paraswapV5Filter.ParseSwappedDirect(log.Export()) + if err != nil { + return nil, fmt.Errorf("parse SwappedDirect event: %w", err) + } + + action, err := w.buildExchangeSwapAction(ctx, task, event.Beneficiary, event.Beneficiary, event.SrcToken, event.DestToken, event.SrcAmount, event.ReceivedAmount) + if err != nil { + return nil, fmt.Errorf("build exchange swap action: %w", err) + } + + return []*activityx.Action{action}, nil +} + +func (w *worker) buildExchangeSwapAction(ctx context.Context, task *source.Task, sender, receiver common.Address, tokenIn, tokenOut common.Address, amountIn, amountOut *big.Int) (*activityx.Action, error) { + tokenInAddress := lo.Ternary(tokenIn != paraswap.AddressETH, &tokenIn, nil) + tokenOutAddress := lo.Ternary(tokenOut != paraswap.AddressETH, &tokenOut, nil) + + tokenInMetadata, err := w.tokenClient.Lookup(ctx, task.ChainID, tokenInAddress, nil, task.Header.Number) + if err != nil { + return nil, fmt.Errorf("lookup token in metadata: %w", err) + } + + tokenInMetadata.Value = lo.ToPtr(decimal.NewFromBigInt(amountIn, 0)) + + tokenOutMetadata, err := w.tokenClient.Lookup(ctx, task.ChainID, tokenOutAddress, nil, task.Header.Number) + if err != nil { + return nil, fmt.Errorf("lookup token out metadata: %w", err) + } + + tokenOutMetadata.Value = lo.ToPtr(decimal.NewFromBigInt(amountOut, 0)) + + action := activityx.Action{ + Type: typex.ExchangeSwap, + Platform: w.Platform(), + From: sender.String(), + To: receiver.String(), + Metadata: metadata.ExchangeSwap{ + From: *tokenInMetadata, + To: *tokenOutMetadata, + }, + } + + return &action, nil +} + +func NewWorker(config *config.Module) (engine.Worker, error) { + instance := worker{ + paraswapV5Filter: lo.Must(paraswap.NewV5ParaSwapFilterer(ethereum.AddressGenesis, nil)), + } + + var err error + + if instance.ethereumClient, err = ethereum.Dial(context.Background(), config.Endpoint.URL, config.Endpoint.BuildEthereumOptions()...); err != nil { + return nil, fmt.Errorf("initialize ethereum client: %w", err) + } + + instance.tokenClient = token.NewClient(instance.ethereumClient) + + return &instance, nil +} diff --git a/internal/engine/worker/decentralized/contract/paraswap/worker_test.go b/internal/engine/worker/decentralized/contract/paraswap/worker_test.go new file mode 100644 index 00000000..392587d1 --- /dev/null +++ b/internal/engine/worker/decentralized/contract/paraswap/worker_test.go @@ -0,0 +1,440 @@ +package paraswap_test + +import ( + "context" + "encoding/json" + "math/big" + "testing" + + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/common/hexutil" + "github.com/rss3-network/node/config" + source "github.com/rss3-network/node/internal/engine/source/ethereum" + worker "github.com/rss3-network/node/internal/engine/worker/decentralized/contract/paraswap" + "github.com/rss3-network/node/provider/ethereum" + "github.com/rss3-network/node/provider/ethereum/endpoint" + workerx "github.com/rss3-network/node/schema/worker/decentralized" + activityx "github.com/rss3-network/protocol-go/schema/activity" + "github.com/rss3-network/protocol-go/schema/metadata" + "github.com/rss3-network/protocol-go/schema/network" + "github.com/rss3-network/protocol-go/schema/typex" + "github.com/samber/lo" + "github.com/shopspring/decimal" + "github.com/stretchr/testify/require" +) + +func TestWorker_Paraswap(t *testing.T) { + t.Parallel() + + type arguments struct { + task *source.Task + config *config.Module + } + + testcases := []struct { + name string + arguments arguments + want *activityx.Activity + wantError require.ErrorAssertionFunc + }{ + { + name: "Paraswap Token Swap (REZ to ETH)", + arguments: struct { + task *source.Task + config *config.Module + }{ + task: &source.Task{ + Network: network.Ethereum, + ChainID: 1, + Header: ðereum.Header{ + Hash: common.HexToHash("0xa20374ef4f54e40ea0b12bea342d038217c1c52e9579f8784868422b8757619e"), + ParentHash: common.HexToHash("0xbc369c24220496d87af0ebddb713ad7fa96a6756088efd3289d99a0e03162cd3"), + UncleHash: common.HexToHash("0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347"), + Coinbase: common.HexToAddress("0x1f9090aaE28b8a3dCeaDf281B0F12828e676c326"), + Number: lo.Must(new(big.Int).SetString("19771930", 0)), + GasLimit: 30000000, + GasUsed: 11600032, + Timestamp: 1714526063, + BaseFee: lo.Must(new(big.Int).SetString("6866994584", 0)), + Transactions: nil, + }, + Transaction: ðereum.Transaction{ + BlockHash: common.HexToHash("0x2c668402f39a485ef57cbfe31e24d7e0f9342a4584de7f94889fd7b02f90d77b"), + From: common.HexToAddress("0x7c614681E6F6ECCa2E84D311D3f6dda6c460E55B"), + Gas: 306971, + GasPrice: lo.Must(new(big.Int).SetString("6956994584", 10)), + Hash: common.HexToHash("0x2c668402f39a485ef57cbfe31e24d7e0f9342a4584de7f94889fd7b02f90d77b"), + Input: hexutil.MustDecode("0xa6886da900000000000000000000000000000000000000000000000000000000000000200000000000000000000000003b50805453023a91a8bf641e279401a0b23fa6f9000000000000000000000000eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee000000000000000000000000e592427a0aece92de3edee1f18e0157c05861564000000000000000000000000000000000000000000000052f103edb66ba80000000000000000000000000000000000000000000000000000010338174146251a0000000000000000000000000000000000000000000000000104858f02911c490100000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000006631ebc900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001c000000000000000000000000000000000000000000000000000000000000002201704308b9f1748d39431ba15f2bedcc500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002b3b50805453023a91a8bf641e279401a0b23fa6f9000bb8c02aaa39b223fe8d0a0e5c4f27ead9083c756cc200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e00000000000000000000000007c614681e6f6ecca2e84d311d3f6dda6c460e55b000000000000000000000000216b4b4ba9f3e719726886d34a177484278bfcae000000000000000000000000000000000000000000000052f103edb66ba800000000000000000000000000000000000000000000000000000000000066358bde000000000000000000000000000000000000000000000000000000000000001bdcd2799ac8a0174f1f44a3be56a31351b0fbfefb7620766293cfbec2f2343ff0653c54e08e4c433cd970a875c8eba3480fc58299d32e784ecbe541af4c451007"), + To: lo.ToPtr(common.HexToAddress("0xDEF171Fe48CF0115B1d80b88dc8eAB59176FEe57")), + Value: lo.Must(new(big.Int).SetString("0", 0)), + Type: 2, + ChainID: lo.Must(new(big.Int).SetString("1", 0)), + }, + Receipt: ðereum.Receipt{ + BlockHash: common.HexToHash("0xa20374ef4f54e40ea0b12bea342d038217c1c52e9579f8784868422b8757619e"), + BlockNumber: lo.Must(new(big.Int).SetString("19771930", 0)), + ContractAddress: nil, + CumulativeGasUsed: 5998846, + EffectiveGasPrice: hexutil.MustDecodeBig("0x19eab5018"), + GasUsed: 200757, + + Logs: []*ethereum.Log{{ + Address: common.HexToAddress("0x3B50805453023a91a8bf641e279401a0b23FA6F9"), + Topics: []common.Hash{ + common.HexToHash("0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925"), + common.HexToHash("0x0000000000000000000000007c614681e6f6ecca2e84d311d3f6dda6c460e55b"), + common.HexToHash("0x000000000000000000000000216b4b4ba9f3e719726886d34a177484278bfcae"), + }, + Data: hexutil.MustDecode("0x000000000000000000000000000000000000000000000052f103edb66ba80000"), + BlockNumber: lo.Must(new(big.Int).SetString("19771930", 0)), + TransactionHash: common.HexToHash("0x2c668402f39a485ef57cbfe31e24d7e0f9342a4584de7f94889fd7b02f90d77b"), + Index: 160, + Removed: false, + }, { + Address: common.HexToAddress("0x3B50805453023a91a8bf641e279401a0b23FA6F9"), + Topics: []common.Hash{ + common.HexToHash("0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef"), + common.HexToHash("0x0000000000000000000000007c614681e6f6ecca2e84d311d3f6dda6c460e55b"), + common.HexToHash("0x000000000000000000000000def171fe48cf0115b1d80b88dc8eab59176fee57"), + }, + Data: hexutil.MustDecode("0x000000000000000000000000000000000000000000000052f103edb66ba80000"), + BlockNumber: lo.Must(new(big.Int).SetString("19771930", 0)), + TransactionHash: common.HexToHash("0x2c668402f39a485ef57cbfe31e24d7e0f9342a4584de7f94889fd7b02f90d77b"), + Index: 161, + Removed: false, + }, { + Address: common.HexToAddress("0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2"), + Topics: []common.Hash{ + common.HexToHash("0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef"), + common.HexToHash("0x00000000000000000000000059c68e0eca9f0844d9d4cee0bedf23c8dee462c5"), + common.HexToHash("0x000000000000000000000000def171fe48cf0115b1d80b88dc8eab59176fee57"), + }, + Data: hexutil.MustDecode("0x0000000000000000000000000000000000000000000000000104579503cdcadc"), + BlockNumber: lo.Must(new(big.Int).SetString("19771930", 0)), + TransactionHash: common.HexToHash("0x2c668402f39a485ef57cbfe31e24d7e0f9342a4584de7f94889fd7b02f90d77b"), + Index: 162, + Removed: false, + }, { + Address: common.HexToAddress("0x3B50805453023a91a8bf641e279401a0b23FA6F9"), + Topics: []common.Hash{ + common.HexToHash("0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef"), + common.HexToHash("0x000000000000000000000000def171fe48cf0115b1d80b88dc8eab59176fee57"), + common.HexToHash("0x00000000000000000000000059c68e0eca9f0844d9d4cee0bedf23c8dee462c5"), + }, + Data: hexutil.MustDecode("0x000000000000000000000000000000000000000000000052f103edb66ba80000"), + BlockNumber: lo.Must(new(big.Int).SetString("19771930", 0)), + TransactionHash: common.HexToHash("0x2c668402f39a485ef57cbfe31e24d7e0f9342a4584de7f94889fd7b02f90d77b"), + Index: 163, + Removed: false, + }, { + Address: common.HexToAddress("0x59C68e0ECa9F0844d9D4CeE0BEDf23c8dEE462c5"), + Topics: []common.Hash{ + common.HexToHash("0xc42079f94a6350d7e6235f29174924f928cc2ac818eb64fed8004e115fbcca67"), + common.HexToHash("0x000000000000000000000000e592427a0aece92de3edee1f18e0157c05861564"), + common.HexToHash("0x000000000000000000000000def171fe48cf0115b1d80b88dc8eab59176fee57"), + }, + Data: hexutil.MustDecode("0x000000000000000000000000000000000000000000000052f103edb66ba80000fffffffffffffffffffffffffffffffffffffffffffffffffefba86afc323524000000000000000000000000000000000000000001c632f4c47ef9821f94f0b1000000000000000000000000000000000000000000000ef1fb85fa4e8dd48af1fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe7b8e"), + BlockNumber: lo.Must(new(big.Int).SetString("19771930", 0)), + TransactionHash: common.HexToHash("0x2c668402f39a485ef57cbfe31e24d7e0f9342a4584de7f94889fd7b02f90d77b"), + Index: 164, + Removed: false, + }, { + Address: common.HexToAddress("0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2"), + Topics: []common.Hash{ + common.HexToHash("0x7fcf532c15f0a6db0bd6d0e038bea71d30d808c7d98cb3bf7268a95bf5081b65"), + common.HexToHash("0x000000000000000000000000def171fe48cf0115b1d80b88dc8eab59176fee57"), + }, + Data: hexutil.MustDecode("0x0000000000000000000000000000000000000000000000000104579503cdcadc"), + BlockNumber: lo.Must(new(big.Int).SetString("19771930", 0)), + TransactionHash: common.HexToHash("0x2c668402f39a485ef57cbfe31e24d7e0f9342a4584de7f94889fd7b02f90d77b"), + Index: 165, + Removed: false, + }, { + Address: common.HexToAddress("0xDEF171Fe48CF0115B1d80b88dc8eAB59176FEe57"), + Topics: []common.Hash{ + common.HexToHash("0xd2d73da2b5fd52cd654d8fd1b514ad57355bad741de639e3a1c3a20dd9f17347"), + common.HexToHash("0x0000000000000000000000007c614681e6f6ecca2e84d311d3f6dda6c460e55b"), + common.HexToHash("0x0000000000000000000000003b50805453023a91a8bf641e279401a0b23fa6f9"), + common.HexToHash("0x000000000000000000000000eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee"), + }, + Data: hexutil.MustDecode("0x1704308b9f1748d39431ba15f2bedcc500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000040000000000000000000000000007c614681e6f6ecca2e84d311d3f6dda6c460e55b0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000052f103edb66ba800000000000000000000000000000000000000000000000000000104579503cdcadc0000000000000000000000000000000000000000000000000104858f02911c49"), + BlockNumber: lo.Must(new(big.Int).SetString("19771930", 0)), + TransactionHash: common.HexToHash("0x2c668402f39a485ef57cbfe31e24d7e0f9342a4584de7f94889fd7b02f90d77b"), + Index: 166, + Removed: false, + }}, + Status: 1, + TransactionHash: common.HexToHash("0x2c668402f39a485ef57cbfe31e24d7e0f9342a4584de7f94889fd7b02f90d77b"), + TransactionIndex: 71, + }, + }, + config: &config.Module{ + Network: network.Ethereum, + Endpoint: config.Endpoint{ + URL: endpoint.MustGet(network.Ethereum), + }, + }, + }, + want: &activityx.Activity{ + ID: "0x2c668402f39a485ef57cbfe31e24d7e0f9342a4584de7f94889fd7b02f90d77b", + Network: network.Ethereum, + Index: 71, + From: "0x7c614681E6F6ECCa2E84D311D3f6dda6c460E55B", + To: "0xDEF171Fe48CF0115B1d80b88dc8eAB59176FEe57", + Type: typex.ExchangeSwap, + Platform: workerx.PlatformParaswap.String(), + Fee: &activityx.Fee{ + Amount: lo.Must(decimal.NewFromString("1396665361700088")), + Decimal: 18, + }, + Calldata: &activityx.Calldata{ + FunctionHash: "0xa6886da9", + }, + Actions: []*activityx.Action{ + { + Type: typex.ExchangeSwap, + Platform: workerx.PlatformParaswap.String(), + From: "0x7c614681E6F6ECCa2E84D311D3f6dda6c460E55B", + To: "0x7c614681E6F6ECCa2E84D311D3f6dda6c460E55B", + Metadata: metadata.ExchangeSwap{ + From: metadata.Token{ + Address: lo.ToPtr("0x3B50805453023a91a8bf641e279401a0b23FA6F9"), + Value: lo.ToPtr(lo.Must(decimal.NewFromString("1530000000000000000000"))), + Name: "Renzo", + Symbol: "REZ", + Decimals: 18, + Standard: metadata.StandardERC20, + }, + To: metadata.Token{ + Value: lo.ToPtr(lo.Must(decimal.NewFromString("73279791470332636"))), + Name: "Ethereum", + Symbol: "ETH", + Decimals: 18, + }, + }, + }, + }, + Status: true, + Timestamp: 1714526063, + }, + wantError: require.NoError, + }, + { + name: "Paraswap Token Swap (WETH to USDC)", + arguments: struct { + task *source.Task + config *config.Module + }{ + task: &source.Task{ + Network: network.Ethereum, + ChainID: 1, + Header: ðereum.Header{ + Hash: common.HexToHash("0x0e8ad5c0a8197420174e4622129960d4d9e551839eb0defab002c48b4f00b800"), + ParentHash: common.HexToHash("0x97206ab738d3f885446763cf64dc4b354e3781a3d044659cb9e8511885acb17b"), + UncleHash: common.HexToHash("0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347"), + Coinbase: common.HexToAddress("0x95222290DD7278Aa3Ddd389Cc1E1d165CC4BAfe5"), + Number: lo.Must(new(big.Int).SetString("19771969", 0)), + GasLimit: 30000000, + GasUsed: 12027224, + Timestamp: 1714526531, + BaseFee: lo.Must(new(big.Int).SetString("6640967522", 0)), + Transactions: nil, + }, + Transaction: ðereum.Transaction{ + BlockHash: common.HexToHash("0x647baef594b4acaab7e8e4e18a56d442b679a7e70d7b552da8250d675004176b"), + From: common.HexToAddress("0x47ed2b8a79f6D67dFD0C50313e260d07F5AC7E95"), + Gas: 2026878, + GasPrice: lo.Must(new(big.Int).SetString("6690967522", 10)), + Hash: common.HexToHash("0x647baef594b4acaab7e8e4e18a56d442b679a7e70d7b552da8250d675004176b"), + Input: hexutil.MustDecode("0x6092eae500000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000002000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc200000000000000000000000000000000000000000000000026d6a0823aceefc0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000380000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb4800000000000000000000000000000000000000000000000026d6a0823aceefc000000000000000000000000000000000000000000000000000000001f48502e5000000000000000000000000def171fe48cf0115b1d80b88dc8eab59176fee57000000000000000000000000216b4b4ba9f3e719726886d34a177484278bfcae00000000000000000000000000000000000000000000000000000000000000e00000000000000000000000000000000000000000000000000000000000000264a6886da90000000000000000000000000000000000000000000000000000000000000020000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48000000000000000000000000e592427a0aece92de3edee1f18e0157c0586156400000000000000000000000000000000000000000000000026d6a0823aceefc000000000000000000000000000000000000000000000000000000001ef83ae6200000000000000000000000000000000000000000000000000000001f48502e50100000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000006631ed9c00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001c000000000000000000000000000000000000000000000000000000000000002201d0deb7b7778495c981e4402121ab77b00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002bc02aaa39b223fe8d0a0e5c4f27ead9083c756cc20001f4a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"), + To: lo.ToPtr(common.HexToAddress("0xe6FC6A67607EFE4C44224c16be190980779F2dC1")), + Value: lo.Must(new(big.Int).SetString("0", 0)), + Type: 2, + ChainID: lo.Must(new(big.Int).SetString("1", 0)), + }, + Receipt: ðereum.Receipt{ + BlockHash: common.HexToHash("0x0e8ad5c0a8197420174e4622129960d4d9e551839eb0defab002c48b4f00b800"), + BlockNumber: lo.Must(new(big.Int).SetString("19771969", 0)), + ContractAddress: nil, + CumulativeGasUsed: 11301628, + EffectiveGasPrice: hexutil.MustDecodeBig("0x18ed00fe2"), + GasUsed: 999677, + + Logs: []*ethereum.Log{{ + Address: common.HexToAddress("0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2"), + Topics: []common.Hash{ + common.HexToHash("0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef"), + common.HexToHash("0x0000000000000000000000004d5f47fa6a74757f35c14fd3a6ef8e3c9bc514e8"), + common.HexToHash("0x0000000000000000000000006e5743e228614b000104b7d9b95d8981c92c26f0"), + }, + Data: hexutil.MustDecode("0x00000000000000000000000000000000000000000000000026d6a0823aceefc0"), + BlockNumber: lo.Must(new(big.Int).SetString("19771969", 0)), + TransactionHash: common.HexToHash("0x647baef594b4acaab7e8e4e18a56d442b679a7e70d7b552da8250d675004176b"), + Index: 262, + Removed: false, + }, { + Address: common.HexToAddress("0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2"), + Topics: []common.Hash{ + common.HexToHash("0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925"), + common.HexToHash("0x0000000000000000000000006e5743e228614b000104b7d9b95d8981c92c26f0"), + common.HexToHash("0x000000000000000000000000216b4b4ba9f3e719726886d34a177484278bfcae"), + }, + Data: hexutil.MustDecode("0x00000000000000000000000000000000000000000000000026d6a0823aceefc0"), + BlockNumber: lo.Must(new(big.Int).SetString("19771969", 0)), + TransactionHash: common.HexToHash("0x647baef594b4acaab7e8e4e18a56d442b679a7e70d7b552da8250d675004176b"), + Index: 263, + Removed: false, + }, { + Address: common.HexToAddress("0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2"), + Topics: []common.Hash{ + common.HexToHash("0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef"), + common.HexToHash("0x0000000000000000000000006e5743e228614b000104b7d9b95d8981c92c26f0"), + common.HexToHash("0x000000000000000000000000def171fe48cf0115b1d80b88dc8eab59176fee57"), + }, + Data: hexutil.MustDecode("0x00000000000000000000000000000000000000000000000026d6a0823aceefc0"), + BlockNumber: lo.Must(new(big.Int).SetString("19771969", 0)), + TransactionHash: common.HexToHash("0x647baef594b4acaab7e8e4e18a56d442b679a7e70d7b552da8250d675004176b"), + Index: 264, + Removed: false, + }, { + Address: common.HexToAddress("0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"), + Topics: []common.Hash{ + common.HexToHash("0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef"), + common.HexToHash("0x00000000000000000000000088e6a0c2ddd26feeb64f039a2c41296fcb3f5640"), + common.HexToHash("0x000000000000000000000000def171fe48cf0115b1d80b88dc8eab59176fee57"), + }, + Data: hexutil.MustDecode("0x00000000000000000000000000000000000000000000000000000001f48502e5"), + BlockNumber: lo.Must(new(big.Int).SetString("19771969", 0)), + TransactionHash: common.HexToHash("0x647baef594b4acaab7e8e4e18a56d442b679a7e70d7b552da8250d675004176b"), + Index: 265, + Removed: false, + }, { + Address: common.HexToAddress("0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2"), + Topics: []common.Hash{ + common.HexToHash("0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef"), + common.HexToHash("0x000000000000000000000000def171fe48cf0115b1d80b88dc8eab59176fee57"), + common.HexToHash("0x00000000000000000000000088e6a0c2ddd26feeb64f039a2c41296fcb3f5640"), + }, + Data: hexutil.MustDecode("0x00000000000000000000000000000000000000000000000026d6a0823aceefc0"), + BlockNumber: lo.Must(new(big.Int).SetString("19771969", 0)), + TransactionHash: common.HexToHash("0x647baef594b4acaab7e8e4e18a56d442b679a7e70d7b552da8250d675004176b"), + Index: 266, + Removed: false, + }, { + Address: common.HexToAddress("0x88e6A0c2dDD26FEEb64F039a2c41296FcB3f5640"), + Topics: []common.Hash{ + common.HexToHash("0xc42079f94a6350d7e6235f29174924f928cc2ac818eb64fed8004e115fbcca67"), + common.HexToHash("0x000000000000000000000000e592427a0aece92de3edee1f18e0157c05861564"), + common.HexToHash("0x000000000000000000000000def171fe48cf0115b1d80b88dc8eab59176fee57"), + }, + Data: hexutil.MustDecode("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffe0b7afd1b00000000000000000000000000000000000000000000000026d6a0823aceefc0000000000000000000000000000000000000474b5fc02aca0c9606d9228e78f10000000000000000000000000000000000000000000000006e880344f151bb84000000000000000000000000000000000000000000000000000000000002fe99"), + BlockNumber: lo.Must(new(big.Int).SetString("19771969", 0)), + TransactionHash: common.HexToHash("0x647baef594b4acaab7e8e4e18a56d442b679a7e70d7b552da8250d675004176b"), + Index: 267, + Removed: false, + }, { + Address: common.HexToAddress("0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"), + Topics: []common.Hash{ + common.HexToHash("0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef"), + common.HexToHash("0x000000000000000000000000def171fe48cf0115b1d80b88dc8eab59176fee57"), + common.HexToHash("0x0000000000000000000000006e5743e228614b000104b7d9b95d8981c92c26f0"), + }, + Data: hexutil.MustDecode("0x00000000000000000000000000000000000000000000000000000001f48502e5"), + BlockNumber: lo.Must(new(big.Int).SetString("19771969", 0)), + TransactionHash: common.HexToHash("0x647baef594b4acaab7e8e4e18a56d442b679a7e70d7b552da8250d675004176b"), + Index: 268, + Removed: false, + }, { + Address: common.HexToAddress("0xDEF171Fe48CF0115B1d80b88dc8eAB59176FEe57"), + Topics: []common.Hash{ + common.HexToHash("0xd2d73da2b5fd52cd654d8fd1b514ad57355bad741de639e3a1c3a20dd9f17347"), + common.HexToHash("0x0000000000000000000000006e5743e228614b000104b7d9b95d8981c92c26f0"), + common.HexToHash("0x000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2"), + common.HexToHash("0x000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48"), + }, + Data: hexutil.MustDecode("0x1d0deb7b7778495c981e4402121ab77b00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000040000000000000000000000000006e5743e228614b000104b7d9b95d8981c92c26f0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000026d6a0823aceefc000000000000000000000000000000000000000000000000000000001f48502e500000000000000000000000000000000000000000000000000000001f48502e5"), + BlockNumber: lo.Must(new(big.Int).SetString("19771969", 0)), + TransactionHash: common.HexToHash("0x647baef594b4acaab7e8e4e18a56d442b679a7e70d7b552da8250d675004176b"), + Index: 269, + Removed: false, + }}, + Status: 1, + TransactionHash: common.HexToHash("0x647baef594b4acaab7e8e4e18a56d442b679a7e70d7b552da8250d675004176b"), + TransactionIndex: 135, + }, + }, + config: &config.Module{ + Network: network.Ethereum, + Endpoint: config.Endpoint{ + URL: endpoint.MustGet(network.Ethereum), + }, + }, + }, + want: &activityx.Activity{ + ID: "0x647baef594b4acaab7e8e4e18a56d442b679a7e70d7b552da8250d675004176b", + Network: network.Ethereum, + Index: 135, + From: "0x47ed2b8a79f6D67dFD0C50313e260d07F5AC7E95", + To: "0xe6FC6A67607EFE4C44224c16be190980779F2dC1", + Type: typex.ExchangeSwap, + Platform: workerx.PlatformParaswap.String(), + Fee: &activityx.Fee{ + Amount: lo.Must(decimal.NewFromString("6688806339490394")), + Decimal: 18, + }, + Calldata: &activityx.Calldata{ + FunctionHash: "0x6092eae5", + }, + Actions: []*activityx.Action{ + { + Type: typex.ExchangeSwap, + Platform: workerx.PlatformParaswap.String(), + From: "0x6E5743E228614B000104b7D9B95d8981c92c26F0", + To: "0x6E5743E228614B000104b7D9B95d8981c92c26F0", + Metadata: metadata.ExchangeSwap{ + From: metadata.Token{ + Address: lo.ToPtr("0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2"), + Value: lo.ToPtr(lo.Must(decimal.NewFromString("2798600699650174912"))), + Name: "Wrapped Ether", + Symbol: "WETH", + Decimals: 18, + Standard: metadata.StandardERC20, + }, + To: metadata.Token{ + Address: lo.ToPtr("0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"), + Value: lo.ToPtr(lo.Must(decimal.NewFromString("8397325029"))), + Name: "USD Coin", + Symbol: "USDC", + Decimals: 6, + Standard: metadata.StandardERC20, + }, + }, + }, + }, + Status: true, + Timestamp: 1714526531, + }, + wantError: require.NoError, + }, + } + + for _, testcase := range testcases { + testcase := testcase + + t.Run(testcase.name, func(t *testing.T) { + t.Parallel() + + ctx := context.Background() + + instance, err := worker.NewWorker(testcase.arguments.config) + require.NoError(t, err) + + activity, err := instance.Transform(ctx, testcase.arguments.task) + testcase.wantError(t, err) + + t.Log(string(lo.Must(json.MarshalIndent(activity, "", "\x20\x20")))) + + require.Equal(t, testcase.want, activity) + }) + } +} diff --git a/internal/engine/worker/decentralized/factory.go b/internal/engine/worker/decentralized/factory.go index 0c7a6a27..f5469fca 100644 --- a/internal/engine/worker/decentralized/factory.go +++ b/internal/engine/worker/decentralized/factory.go @@ -28,6 +28,7 @@ import ( "github.com/rss3-network/node/internal/engine/worker/decentralized/contract/opensea" "github.com/rss3-network/node/internal/engine/worker/decentralized/contract/optimism" "github.com/rss3-network/node/internal/engine/worker/decentralized/contract/paragraph" + "github.com/rss3-network/node/internal/engine/worker/decentralized/contract/paraswap" "github.com/rss3-network/node/internal/engine/worker/decentralized/contract/rss3" "github.com/rss3-network/node/internal/engine/worker/decentralized/contract/savm" "github.com/rss3-network/node/internal/engine/worker/decentralized/contract/stargate" @@ -89,6 +90,8 @@ func New(config *config.Module, databaseClient database.Client, redisClient ruei return stargate.NewWorker(config) case decentralized.Curve: return curve.NewWorker(config, redisClient) + case decentralized.Paraswap: + return paraswap.NewWorker(config) case decentralized.Cow: return cow.NewWorker(config) case decentralized.BendDAO: diff --git a/internal/node/component/info/network_config.go b/internal/node/component/info/network_config.go index 5ddf4484..ef317b22 100644 --- a/internal/node/component/info/network_config.go +++ b/internal/node/component/info/network_config.go @@ -239,6 +239,7 @@ var NetworkToWorkersMap = map[network.Network][]worker.Worker{ decentralized.Oneinch, decentralized.OpenSea, decentralized.Optimism, + decentralized.Paraswap, decentralized.RSS3, decentralized.Stargate, decentralized.Uniswap, @@ -345,6 +346,7 @@ var WorkerToConfigMap = map[network.Source]map[worker.Worker]workerConfig{ decentralized.Oneinch: defaultWorkerConfig(decentralized.Oneinch, network.EthereumSource, nil), decentralized.OpenSea: defaultWorkerConfig(decentralized.OpenSea, network.EthereumSource, nil), decentralized.Optimism: defaultWorkerConfig(decentralized.Optimism, network.EthereumSource, nil), + decentralized.Paraswap: defaultWorkerConfig(decentralized.Paraswap, network.EthereumSource, nil), decentralized.RSS3: defaultWorkerConfig(decentralized.RSS3, network.EthereumSource, nil), decentralized.SAVM: defaultWorkerConfig(decentralized.SAVM, network.EthereumSource, nil), decentralized.Stargate: defaultWorkerConfig(decentralized.Stargate, network.EthereumSource, nil), diff --git a/provider/ethereum/contract/paraswap/abi/V5ParaSwap.abi b/provider/ethereum/contract/paraswap/abi/V5ParaSwap.abi new file mode 100644 index 00000000..874b02b7 --- /dev/null +++ b/provider/ethereum/contract/paraswap/abi/V5ParaSwap.abi @@ -0,0 +1,1018 @@ +[ + { + "inputs": [ + { + "internalType": "address", + "name": "_weth", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_partnerSharePercent", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_maxFeePercent", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_paraswapReferralShare", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_paraswapSlippageShare", + "type": "uint256" + }, + { + "internalType": "contract IFeeClaimer", + "name": "_feeClaimer", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "bytes16", + "name": "uuid", + "type": "bytes16" + }, + { + "indexed": false, + "internalType": "address", + "name": "partner", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "feePercent", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "address", + "name": "initiator", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "beneficiary", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "srcToken", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "destToken", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "srcAmount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "receivedAmount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "expectedAmount", + "type": "uint256" + } + ], + "name": "BoughtV3", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "bytes16", + "name": "uuid", + "type": "bytes16" + }, + { + "indexed": false, + "internalType": "address", + "name": "partner", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "feePercent", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "address", + "name": "initiator", + "type": "address" + }, + { + "indexed": false, + "internalType": "enum DirectSwap.DirectSwapKind", + "name": "kind", + "type": "uint8" + }, + { + "indexed": true, + "internalType": "address", + "name": "beneficiary", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "srcToken", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "destToken", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "srcAmount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "receivedAmount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "expectedAmount", + "type": "uint256" + } + ], + "name": "SwappedDirect", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "bytes16", + "name": "uuid", + "type": "bytes16" + }, + { + "indexed": false, + "internalType": "address", + "name": "partner", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "feePercent", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "address", + "name": "initiator", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "beneficiary", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "srcToken", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "destToken", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "srcAmount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "receivedAmount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "expectedAmount", + "type": "uint256" + } + ], + "name": "SwappedV3", + "type": "event" + }, + { + "inputs": [], + "name": "ROUTER_ROLE", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "WHITELISTED_ROLE", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "components": [ + { + "internalType": "bytes32", + "name": "poolId", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "assetInIndex", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "assetOutIndex", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "userData", + "type": "bytes" + } + ], + "internalType": "struct IBalancerV2Vault.BatchSwapStep[]", + "name": "swaps", + "type": "tuple[]" + }, + { + "internalType": "address[]", + "name": "assets", + "type": "address[]" + }, + { + "components": [ + { + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "internalType": "bool", + "name": "fromInternalBalance", + "type": "bool" + }, + { + "internalType": "address payable", + "name": "recipient", + "type": "address" + }, + { + "internalType": "bool", + "name": "toInternalBalance", + "type": "bool" + } + ], + "internalType": "struct IBalancerV2Vault.FundManagement", + "name": "funds", + "type": "tuple" + }, + { + "internalType": "int256[]", + "name": "limits", + "type": "int256[]" + }, + { + "internalType": "uint256", + "name": "fromAmount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "toAmount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "expectedAmount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "deadline", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "feePercent", + "type": "uint256" + }, + { + "internalType": "address", + "name": "vault", + "type": "address" + }, + { + "internalType": "address payable", + "name": "partner", + "type": "address" + }, + { + "internalType": "bool", + "name": "isApproved", + "type": "bool" + }, + { + "internalType": "address payable", + "name": "beneficiary", + "type": "address" + }, + { + "internalType": "bytes", + "name": "permit", + "type": "bytes" + }, + { + "internalType": "bytes16", + "name": "uuid", + "type": "bytes16" + } + ], + "internalType": "struct Utils.DirectBalancerV2", + "name": "data", + "type": "tuple" + } + ], + "name": "directBalancerV2GivenInSwap", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "components": [ + { + "internalType": "bytes32", + "name": "poolId", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "assetInIndex", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "assetOutIndex", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "userData", + "type": "bytes" + } + ], + "internalType": "struct IBalancerV2Vault.BatchSwapStep[]", + "name": "swaps", + "type": "tuple[]" + }, + { + "internalType": "address[]", + "name": "assets", + "type": "address[]" + }, + { + "components": [ + { + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "internalType": "bool", + "name": "fromInternalBalance", + "type": "bool" + }, + { + "internalType": "address payable", + "name": "recipient", + "type": "address" + }, + { + "internalType": "bool", + "name": "toInternalBalance", + "type": "bool" + } + ], + "internalType": "struct IBalancerV2Vault.FundManagement", + "name": "funds", + "type": "tuple" + }, + { + "internalType": "int256[]", + "name": "limits", + "type": "int256[]" + }, + { + "internalType": "uint256", + "name": "fromAmount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "toAmount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "expectedAmount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "deadline", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "feePercent", + "type": "uint256" + }, + { + "internalType": "address", + "name": "vault", + "type": "address" + }, + { + "internalType": "address payable", + "name": "partner", + "type": "address" + }, + { + "internalType": "bool", + "name": "isApproved", + "type": "bool" + }, + { + "internalType": "address payable", + "name": "beneficiary", + "type": "address" + }, + { + "internalType": "bytes", + "name": "permit", + "type": "bytes" + }, + { + "internalType": "bytes16", + "name": "uuid", + "type": "bytes16" + } + ], + "internalType": "struct Utils.DirectBalancerV2", + "name": "data", + "type": "tuple" + } + ], + "name": "directBalancerV2GivenOutSwap", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "address", + "name": "fromToken", + "type": "address" + }, + { + "internalType": "address", + "name": "toToken", + "type": "address" + }, + { + "internalType": "address", + "name": "exchange", + "type": "address" + }, + { + "internalType": "uint256", + "name": "fromAmount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "toAmount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "expectedAmount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "feePercent", + "type": "uint256" + }, + { + "internalType": "int128", + "name": "i", + "type": "int128" + }, + { + "internalType": "int128", + "name": "j", + "type": "int128" + }, + { + "internalType": "address payable", + "name": "partner", + "type": "address" + }, + { + "internalType": "bool", + "name": "isApproved", + "type": "bool" + }, + { + "internalType": "enum Utils.CurveSwapType", + "name": "swapType", + "type": "uint8" + }, + { + "internalType": "address payable", + "name": "beneficiary", + "type": "address" + }, + { + "internalType": "bool", + "name": "needWrapNative", + "type": "bool" + }, + { + "internalType": "bytes", + "name": "permit", + "type": "bytes" + }, + { + "internalType": "bytes16", + "name": "uuid", + "type": "bytes16" + } + ], + "internalType": "struct Utils.DirectCurveV1", + "name": "data", + "type": "tuple" + } + ], + "name": "directCurveV1Swap", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "address", + "name": "fromToken", + "type": "address" + }, + { + "internalType": "address", + "name": "toToken", + "type": "address" + }, + { + "internalType": "address", + "name": "exchange", + "type": "address" + }, + { + "internalType": "address", + "name": "poolAddress", + "type": "address" + }, + { + "internalType": "uint256", + "name": "fromAmount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "toAmount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "expectedAmount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "feePercent", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "i", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "j", + "type": "uint256" + }, + { + "internalType": "address payable", + "name": "partner", + "type": "address" + }, + { + "internalType": "bool", + "name": "isApproved", + "type": "bool" + }, + { + "internalType": "enum Utils.CurveSwapType", + "name": "swapType", + "type": "uint8" + }, + { + "internalType": "address payable", + "name": "beneficiary", + "type": "address" + }, + { + "internalType": "bool", + "name": "needWrapNative", + "type": "bool" + }, + { + "internalType": "bytes", + "name": "permit", + "type": "bytes" + }, + { + "internalType": "bytes16", + "name": "uuid", + "type": "bytes16" + } + ], + "internalType": "struct Utils.DirectCurveV2", + "name": "data", + "type": "tuple" + } + ], + "name": "directCurveV2Swap", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "address", + "name": "fromToken", + "type": "address" + }, + { + "internalType": "address", + "name": "toToken", + "type": "address" + }, + { + "internalType": "address", + "name": "exchange", + "type": "address" + }, + { + "internalType": "uint256", + "name": "fromAmount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "toAmount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "expectedAmount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "feePercent", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "deadline", + "type": "uint256" + }, + { + "internalType": "address payable", + "name": "partner", + "type": "address" + }, + { + "internalType": "bool", + "name": "isApproved", + "type": "bool" + }, + { + "internalType": "address payable", + "name": "beneficiary", + "type": "address" + }, + { + "internalType": "bytes", + "name": "path", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "permit", + "type": "bytes" + }, + { + "internalType": "bytes16", + "name": "uuid", + "type": "bytes16" + } + ], + "internalType": "struct Utils.DirectUniV3", + "name": "data", + "type": "tuple" + } + ], + "name": "directUniV3Buy", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "address", + "name": "fromToken", + "type": "address" + }, + { + "internalType": "address", + "name": "toToken", + "type": "address" + }, + { + "internalType": "address", + "name": "exchange", + "type": "address" + }, + { + "internalType": "uint256", + "name": "fromAmount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "toAmount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "expectedAmount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "feePercent", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "deadline", + "type": "uint256" + }, + { + "internalType": "address payable", + "name": "partner", + "type": "address" + }, + { + "internalType": "bool", + "name": "isApproved", + "type": "bool" + }, + { + "internalType": "address payable", + "name": "beneficiary", + "type": "address" + }, + { + "internalType": "bytes", + "name": "path", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "permit", + "type": "bytes" + }, + { + "internalType": "bytes16", + "name": "uuid", + "type": "bytes16" + } + ], + "internalType": "struct Utils.DirectUniV3", + "name": "data", + "type": "tuple" + } + ], + "name": "directUniV3Swap", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [], + "name": "feeClaimer", + "outputs": [ + { + "internalType": "contract IFeeClaimer", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getKey", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "name": "initialize", + "outputs": [], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [], + "name": "maxFeePercent", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "paraswapReferralShare", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "paraswapSlippageShare", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "partnerSharePercent", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "weth", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + } +] diff --git a/provider/ethereum/contract/paraswap/contract.go b/provider/ethereum/contract/paraswap/contract.go new file mode 100644 index 00000000..df5b661c --- /dev/null +++ b/provider/ethereum/contract/paraswap/contract.go @@ -0,0 +1,21 @@ +package paraswap + +import ( + "github.com/ethereum/go-ethereum/common" + "github.com/rss3-network/node/provider/ethereum/contract" +) + +// Paraswap V5 https://etherscan.io/address/0xdef171fe48cf0115b1d80b88dc8eab59176fee57 +//go:generate go run --mod=mod github.com/ethereum/go-ethereum/cmd/abigen --abi ./abi/V5ParaSwap.abi --pkg paraswap --type V5ParaSwap --out contract_v5_paraswap.go + +// https://developers.paraswap.network/smart-contracts +var ( + AddressV5ParaSwap = common.HexToAddress("0xDEF171Fe48CF0115B1d80b88dc8eAB59176FEe57") + AddressV5ParaSwapBase = common.HexToAddress("0x59C7C832e96D2568bea6db468C1aAdcbbDa08A52") + + AddressETH = common.HexToAddress("0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE") + + EventHashV3Swapped = contract.EventHash("SwappedV3(bytes16,address,uint256,address,address,address,address,uint256,uint256,uint256)") + EventHashV3Bought = contract.EventHash("BoughtV3(bytes16,address,uint256,address,address,address,address,uint256,uint256,uint256)") + EventHashSwappedDirect = contract.EventHash("SwappedDirect(bytes16,address,uint256,address,uint8,address,address,address,uint256,uint256,uint256)") +) diff --git a/provider/ethereum/contract/paraswap/contract_v5_paraswap.go b/provider/ethereum/contract/paraswap/contract_v5_paraswap.go new file mode 100644 index 00000000..a9066238 --- /dev/null +++ b/provider/ethereum/contract/paraswap/contract_v5_paraswap.go @@ -0,0 +1,1218 @@ +// Code generated - DO NOT EDIT. +// This file is a generated binding and any manual changes will be lost. + +package paraswap + +import ( + "errors" + "math/big" + "strings" + + ethereum "github.com/ethereum/go-ethereum" + "github.com/ethereum/go-ethereum/accounts/abi" + "github.com/ethereum/go-ethereum/accounts/abi/bind" + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/core/types" + "github.com/ethereum/go-ethereum/event" +) + +// Reference imports to suppress errors if they are not otherwise used. +var ( + _ = errors.New + _ = big.NewInt + _ = strings.NewReader + _ = ethereum.NotFound + _ = bind.Bind + _ = common.Big1 + _ = types.BloomLookup + _ = event.NewSubscription + _ = abi.ConvertType +) + +// IBalancerV2VaultBatchSwapStep is an auto generated low-level Go binding around an user-defined struct. +type IBalancerV2VaultBatchSwapStep struct { + PoolId [32]byte + AssetInIndex *big.Int + AssetOutIndex *big.Int + Amount *big.Int + UserData []byte +} + +// IBalancerV2VaultFundManagement is an auto generated low-level Go binding around an user-defined struct. +type IBalancerV2VaultFundManagement struct { + Sender common.Address + FromInternalBalance bool + Recipient common.Address + ToInternalBalance bool +} + +// UtilsDirectBalancerV2 is an auto generated low-level Go binding around an user-defined struct. +type UtilsDirectBalancerV2 struct { + Swaps []IBalancerV2VaultBatchSwapStep + Assets []common.Address + Funds IBalancerV2VaultFundManagement + Limits []*big.Int + FromAmount *big.Int + ToAmount *big.Int + ExpectedAmount *big.Int + Deadline *big.Int + FeePercent *big.Int + Vault common.Address + Partner common.Address + IsApproved bool + Beneficiary common.Address + Permit []byte + Uuid [16]byte +} + +// UtilsDirectCurveV1 is an auto generated low-level Go binding around an user-defined struct. +type UtilsDirectCurveV1 struct { + FromToken common.Address + ToToken common.Address + Exchange common.Address + FromAmount *big.Int + ToAmount *big.Int + ExpectedAmount *big.Int + FeePercent *big.Int + I *big.Int + J *big.Int + Partner common.Address + IsApproved bool + SwapType uint8 + Beneficiary common.Address + NeedWrapNative bool + Permit []byte + Uuid [16]byte +} + +// UtilsDirectCurveV2 is an auto generated low-level Go binding around an user-defined struct. +type UtilsDirectCurveV2 struct { + FromToken common.Address + ToToken common.Address + Exchange common.Address + PoolAddress common.Address + FromAmount *big.Int + ToAmount *big.Int + ExpectedAmount *big.Int + FeePercent *big.Int + I *big.Int + J *big.Int + Partner common.Address + IsApproved bool + SwapType uint8 + Beneficiary common.Address + NeedWrapNative bool + Permit []byte + Uuid [16]byte +} + +// UtilsDirectUniV3 is an auto generated low-level Go binding around an user-defined struct. +type UtilsDirectUniV3 struct { + FromToken common.Address + ToToken common.Address + Exchange common.Address + FromAmount *big.Int + ToAmount *big.Int + ExpectedAmount *big.Int + FeePercent *big.Int + Deadline *big.Int + Partner common.Address + IsApproved bool + Beneficiary common.Address + Path []byte + Permit []byte + Uuid [16]byte +} + +// V5ParaSwapMetaData contains all meta data concerning the V5ParaSwap contract. +var V5ParaSwapMetaData = &bind.MetaData{ + ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_weth\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_partnerSharePercent\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_maxFeePercent\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_paraswapReferralShare\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_paraswapSlippageShare\",\"type\":\"uint256\"},{\"internalType\":\"contractIFeeClaimer\",\"name\":\"_feeClaimer\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"bytes16\",\"name\":\"uuid\",\"type\":\"bytes16\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"partner\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"feePercent\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"initiator\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"beneficiary\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"srcToken\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"destToken\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"srcAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"receivedAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"expectedAmount\",\"type\":\"uint256\"}],\"name\":\"BoughtV3\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"bytes16\",\"name\":\"uuid\",\"type\":\"bytes16\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"partner\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"feePercent\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"initiator\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"enumDirectSwap.DirectSwapKind\",\"name\":\"kind\",\"type\":\"uint8\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"beneficiary\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"srcToken\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"destToken\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"srcAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"receivedAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"expectedAmount\",\"type\":\"uint256\"}],\"name\":\"SwappedDirect\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"bytes16\",\"name\":\"uuid\",\"type\":\"bytes16\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"partner\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"feePercent\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"initiator\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"beneficiary\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"srcToken\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"destToken\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"srcAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"receivedAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"expectedAmount\",\"type\":\"uint256\"}],\"name\":\"SwappedV3\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"ROUTER_ROLE\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"WHITELISTED_ROLE\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"poolId\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"assetInIndex\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"assetOutIndex\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"userData\",\"type\":\"bytes\"}],\"internalType\":\"structIBalancerV2Vault.BatchSwapStep[]\",\"name\":\"swaps\",\"type\":\"tuple[]\"},{\"internalType\":\"address[]\",\"name\":\"assets\",\"type\":\"address[]\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"internalType\":\"bool\",\"name\":\"fromInternalBalance\",\"type\":\"bool\"},{\"internalType\":\"addresspayable\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"bool\",\"name\":\"toInternalBalance\",\"type\":\"bool\"}],\"internalType\":\"structIBalancerV2Vault.FundManagement\",\"name\":\"funds\",\"type\":\"tuple\"},{\"internalType\":\"int256[]\",\"name\":\"limits\",\"type\":\"int256[]\"},{\"internalType\":\"uint256\",\"name\":\"fromAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"toAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"expectedAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"deadline\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"feePercent\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"vault\",\"type\":\"address\"},{\"internalType\":\"addresspayable\",\"name\":\"partner\",\"type\":\"address\"},{\"internalType\":\"bool\",\"name\":\"isApproved\",\"type\":\"bool\"},{\"internalType\":\"addresspayable\",\"name\":\"beneficiary\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"permit\",\"type\":\"bytes\"},{\"internalType\":\"bytes16\",\"name\":\"uuid\",\"type\":\"bytes16\"}],\"internalType\":\"structUtils.DirectBalancerV2\",\"name\":\"data\",\"type\":\"tuple\"}],\"name\":\"directBalancerV2GivenInSwap\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"poolId\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"assetInIndex\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"assetOutIndex\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"userData\",\"type\":\"bytes\"}],\"internalType\":\"structIBalancerV2Vault.BatchSwapStep[]\",\"name\":\"swaps\",\"type\":\"tuple[]\"},{\"internalType\":\"address[]\",\"name\":\"assets\",\"type\":\"address[]\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"internalType\":\"bool\",\"name\":\"fromInternalBalance\",\"type\":\"bool\"},{\"internalType\":\"addresspayable\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"bool\",\"name\":\"toInternalBalance\",\"type\":\"bool\"}],\"internalType\":\"structIBalancerV2Vault.FundManagement\",\"name\":\"funds\",\"type\":\"tuple\"},{\"internalType\":\"int256[]\",\"name\":\"limits\",\"type\":\"int256[]\"},{\"internalType\":\"uint256\",\"name\":\"fromAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"toAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"expectedAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"deadline\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"feePercent\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"vault\",\"type\":\"address\"},{\"internalType\":\"addresspayable\",\"name\":\"partner\",\"type\":\"address\"},{\"internalType\":\"bool\",\"name\":\"isApproved\",\"type\":\"bool\"},{\"internalType\":\"addresspayable\",\"name\":\"beneficiary\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"permit\",\"type\":\"bytes\"},{\"internalType\":\"bytes16\",\"name\":\"uuid\",\"type\":\"bytes16\"}],\"internalType\":\"structUtils.DirectBalancerV2\",\"name\":\"data\",\"type\":\"tuple\"}],\"name\":\"directBalancerV2GivenOutSwap\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"fromToken\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"toToken\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"exchange\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"fromAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"toAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"expectedAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"feePercent\",\"type\":\"uint256\"},{\"internalType\":\"int128\",\"name\":\"i\",\"type\":\"int128\"},{\"internalType\":\"int128\",\"name\":\"j\",\"type\":\"int128\"},{\"internalType\":\"addresspayable\",\"name\":\"partner\",\"type\":\"address\"},{\"internalType\":\"bool\",\"name\":\"isApproved\",\"type\":\"bool\"},{\"internalType\":\"enumUtils.CurveSwapType\",\"name\":\"swapType\",\"type\":\"uint8\"},{\"internalType\":\"addresspayable\",\"name\":\"beneficiary\",\"type\":\"address\"},{\"internalType\":\"bool\",\"name\":\"needWrapNative\",\"type\":\"bool\"},{\"internalType\":\"bytes\",\"name\":\"permit\",\"type\":\"bytes\"},{\"internalType\":\"bytes16\",\"name\":\"uuid\",\"type\":\"bytes16\"}],\"internalType\":\"structUtils.DirectCurveV1\",\"name\":\"data\",\"type\":\"tuple\"}],\"name\":\"directCurveV1Swap\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"fromToken\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"toToken\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"exchange\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"poolAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"fromAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"toAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"expectedAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"feePercent\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"i\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"j\",\"type\":\"uint256\"},{\"internalType\":\"addresspayable\",\"name\":\"partner\",\"type\":\"address\"},{\"internalType\":\"bool\",\"name\":\"isApproved\",\"type\":\"bool\"},{\"internalType\":\"enumUtils.CurveSwapType\",\"name\":\"swapType\",\"type\":\"uint8\"},{\"internalType\":\"addresspayable\",\"name\":\"beneficiary\",\"type\":\"address\"},{\"internalType\":\"bool\",\"name\":\"needWrapNative\",\"type\":\"bool\"},{\"internalType\":\"bytes\",\"name\":\"permit\",\"type\":\"bytes\"},{\"internalType\":\"bytes16\",\"name\":\"uuid\",\"type\":\"bytes16\"}],\"internalType\":\"structUtils.DirectCurveV2\",\"name\":\"data\",\"type\":\"tuple\"}],\"name\":\"directCurveV2Swap\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"fromToken\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"toToken\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"exchange\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"fromAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"toAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"expectedAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"feePercent\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"deadline\",\"type\":\"uint256\"},{\"internalType\":\"addresspayable\",\"name\":\"partner\",\"type\":\"address\"},{\"internalType\":\"bool\",\"name\":\"isApproved\",\"type\":\"bool\"},{\"internalType\":\"addresspayable\",\"name\":\"beneficiary\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"path\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"permit\",\"type\":\"bytes\"},{\"internalType\":\"bytes16\",\"name\":\"uuid\",\"type\":\"bytes16\"}],\"internalType\":\"structUtils.DirectUniV3\",\"name\":\"data\",\"type\":\"tuple\"}],\"name\":\"directUniV3Buy\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"fromToken\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"toToken\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"exchange\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"fromAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"toAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"expectedAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"feePercent\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"deadline\",\"type\":\"uint256\"},{\"internalType\":\"addresspayable\",\"name\":\"partner\",\"type\":\"address\"},{\"internalType\":\"bool\",\"name\":\"isApproved\",\"type\":\"bool\"},{\"internalType\":\"addresspayable\",\"name\":\"beneficiary\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"path\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"permit\",\"type\":\"bytes\"},{\"internalType\":\"bytes16\",\"name\":\"uuid\",\"type\":\"bytes16\"}],\"internalType\":\"structUtils.DirectUniV3\",\"name\":\"data\",\"type\":\"tuple\"}],\"name\":\"directUniV3Swap\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"feeClaimer\",\"outputs\":[{\"internalType\":\"contractIFeeClaimer\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getKey\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"maxFeePercent\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"paraswapReferralShare\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"paraswapSlippageShare\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"partnerSharePercent\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"weth\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"}]", +} + +// V5ParaSwapABI is the input ABI used to generate the binding from. +// Deprecated: Use V5ParaSwapMetaData.ABI instead. +var V5ParaSwapABI = V5ParaSwapMetaData.ABI + +// V5ParaSwap is an auto generated Go binding around an Ethereum contract. +type V5ParaSwap struct { + V5ParaSwapCaller // Read-only binding to the contract + V5ParaSwapTransactor // Write-only binding to the contract + V5ParaSwapFilterer // Log filterer for contract events +} + +// V5ParaSwapCaller is an auto generated read-only Go binding around an Ethereum contract. +type V5ParaSwapCaller struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// V5ParaSwapTransactor is an auto generated write-only Go binding around an Ethereum contract. +type V5ParaSwapTransactor struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// V5ParaSwapFilterer is an auto generated log filtering Go binding around an Ethereum contract events. +type V5ParaSwapFilterer struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// V5ParaSwapSession is an auto generated Go binding around an Ethereum contract, +// with pre-set call and transact options. +type V5ParaSwapSession struct { + Contract *V5ParaSwap // 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 +} + +// V5ParaSwapCallerSession is an auto generated read-only Go binding around an Ethereum contract, +// with pre-set call options. +type V5ParaSwapCallerSession struct { + Contract *V5ParaSwapCaller // Generic contract caller binding to set the session for + CallOpts bind.CallOpts // Call options to use throughout this session +} + +// V5ParaSwapTransactorSession is an auto generated write-only Go binding around an Ethereum contract, +// with pre-set transact options. +type V5ParaSwapTransactorSession struct { + Contract *V5ParaSwapTransactor // Generic contract transactor binding to set the session for + TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session +} + +// V5ParaSwapRaw is an auto generated low-level Go binding around an Ethereum contract. +type V5ParaSwapRaw struct { + Contract *V5ParaSwap // Generic contract binding to access the raw methods on +} + +// V5ParaSwapCallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract. +type V5ParaSwapCallerRaw struct { + Contract *V5ParaSwapCaller // Generic read-only contract binding to access the raw methods on +} + +// V5ParaSwapTransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract. +type V5ParaSwapTransactorRaw struct { + Contract *V5ParaSwapTransactor // Generic write-only contract binding to access the raw methods on +} + +// NewV5ParaSwap creates a new instance of V5ParaSwap, bound to a specific deployed contract. +func NewV5ParaSwap(address common.Address, backend bind.ContractBackend) (*V5ParaSwap, error) { + contract, err := bindV5ParaSwap(address, backend, backend, backend) + if err != nil { + return nil, err + } + return &V5ParaSwap{V5ParaSwapCaller: V5ParaSwapCaller{contract: contract}, V5ParaSwapTransactor: V5ParaSwapTransactor{contract: contract}, V5ParaSwapFilterer: V5ParaSwapFilterer{contract: contract}}, nil +} + +// NewV5ParaSwapCaller creates a new read-only instance of V5ParaSwap, bound to a specific deployed contract. +func NewV5ParaSwapCaller(address common.Address, caller bind.ContractCaller) (*V5ParaSwapCaller, error) { + contract, err := bindV5ParaSwap(address, caller, nil, nil) + if err != nil { + return nil, err + } + return &V5ParaSwapCaller{contract: contract}, nil +} + +// NewV5ParaSwapTransactor creates a new write-only instance of V5ParaSwap, bound to a specific deployed contract. +func NewV5ParaSwapTransactor(address common.Address, transactor bind.ContractTransactor) (*V5ParaSwapTransactor, error) { + contract, err := bindV5ParaSwap(address, nil, transactor, nil) + if err != nil { + return nil, err + } + return &V5ParaSwapTransactor{contract: contract}, nil +} + +// NewV5ParaSwapFilterer creates a new log filterer instance of V5ParaSwap, bound to a specific deployed contract. +func NewV5ParaSwapFilterer(address common.Address, filterer bind.ContractFilterer) (*V5ParaSwapFilterer, error) { + contract, err := bindV5ParaSwap(address, nil, nil, filterer) + if err != nil { + return nil, err + } + return &V5ParaSwapFilterer{contract: contract}, nil +} + +// bindV5ParaSwap binds a generic wrapper to an already deployed contract. +func bindV5ParaSwap(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) { + parsed, err := V5ParaSwapMetaData.GetAbi() + if err != nil { + return nil, err + } + return bind.NewBoundContract(address, *parsed, caller, transactor, filterer), nil +} + +// Call invokes the (constant) contract method with params as input values and +// sets the output to result. The result type might be a single field for simple +// returns, a slice of interfaces for anonymous returns and a struct for named +// returns. +func (_V5ParaSwap *V5ParaSwapRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { + return _V5ParaSwap.Contract.V5ParaSwapCaller.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 (_V5ParaSwap *V5ParaSwapRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _V5ParaSwap.Contract.V5ParaSwapTransactor.contract.Transfer(opts) +} + +// Transact invokes the (paid) contract method with params as input values. +func (_V5ParaSwap *V5ParaSwapRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _V5ParaSwap.Contract.V5ParaSwapTransactor.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 (_V5ParaSwap *V5ParaSwapCallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { + return _V5ParaSwap.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 (_V5ParaSwap *V5ParaSwapTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _V5ParaSwap.Contract.contract.Transfer(opts) +} + +// Transact invokes the (paid) contract method with params as input values. +func (_V5ParaSwap *V5ParaSwapTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _V5ParaSwap.Contract.contract.Transact(opts, method, params...) +} + +// ROUTERROLE is a free data retrieval call binding the contract method 0x30d643b5. +// +// Solidity: function ROUTER_ROLE() view returns(bytes32) +func (_V5ParaSwap *V5ParaSwapCaller) ROUTERROLE(opts *bind.CallOpts) ([32]byte, error) { + var out []interface{} + err := _V5ParaSwap.contract.Call(opts, &out, "ROUTER_ROLE") + + if err != nil { + return *new([32]byte), err + } + + out0 := *abi.ConvertType(out[0], new([32]byte)).(*[32]byte) + + return out0, err + +} + +// ROUTERROLE is a free data retrieval call binding the contract method 0x30d643b5. +// +// Solidity: function ROUTER_ROLE() view returns(bytes32) +func (_V5ParaSwap *V5ParaSwapSession) ROUTERROLE() ([32]byte, error) { + return _V5ParaSwap.Contract.ROUTERROLE(&_V5ParaSwap.CallOpts) +} + +// ROUTERROLE is a free data retrieval call binding the contract method 0x30d643b5. +// +// Solidity: function ROUTER_ROLE() view returns(bytes32) +func (_V5ParaSwap *V5ParaSwapCallerSession) ROUTERROLE() ([32]byte, error) { + return _V5ParaSwap.Contract.ROUTERROLE(&_V5ParaSwap.CallOpts) +} + +// WHITELISTEDROLE is a free data retrieval call binding the contract method 0x7a3226ec. +// +// Solidity: function WHITELISTED_ROLE() view returns(bytes32) +func (_V5ParaSwap *V5ParaSwapCaller) WHITELISTEDROLE(opts *bind.CallOpts) ([32]byte, error) { + var out []interface{} + err := _V5ParaSwap.contract.Call(opts, &out, "WHITELISTED_ROLE") + + if err != nil { + return *new([32]byte), err + } + + out0 := *abi.ConvertType(out[0], new([32]byte)).(*[32]byte) + + return out0, err + +} + +// WHITELISTEDROLE is a free data retrieval call binding the contract method 0x7a3226ec. +// +// Solidity: function WHITELISTED_ROLE() view returns(bytes32) +func (_V5ParaSwap *V5ParaSwapSession) WHITELISTEDROLE() ([32]byte, error) { + return _V5ParaSwap.Contract.WHITELISTEDROLE(&_V5ParaSwap.CallOpts) +} + +// WHITELISTEDROLE is a free data retrieval call binding the contract method 0x7a3226ec. +// +// Solidity: function WHITELISTED_ROLE() view returns(bytes32) +func (_V5ParaSwap *V5ParaSwapCallerSession) WHITELISTEDROLE() ([32]byte, error) { + return _V5ParaSwap.Contract.WHITELISTEDROLE(&_V5ParaSwap.CallOpts) +} + +// FeeClaimer is a free data retrieval call binding the contract method 0x81cbd3ea. +// +// Solidity: function feeClaimer() view returns(address) +func (_V5ParaSwap *V5ParaSwapCaller) FeeClaimer(opts *bind.CallOpts) (common.Address, error) { + var out []interface{} + err := _V5ParaSwap.contract.Call(opts, &out, "feeClaimer") + + if err != nil { + return *new(common.Address), err + } + + out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) + + return out0, err + +} + +// FeeClaimer is a free data retrieval call binding the contract method 0x81cbd3ea. +// +// Solidity: function feeClaimer() view returns(address) +func (_V5ParaSwap *V5ParaSwapSession) FeeClaimer() (common.Address, error) { + return _V5ParaSwap.Contract.FeeClaimer(&_V5ParaSwap.CallOpts) +} + +// FeeClaimer is a free data retrieval call binding the contract method 0x81cbd3ea. +// +// Solidity: function feeClaimer() view returns(address) +func (_V5ParaSwap *V5ParaSwapCallerSession) FeeClaimer() (common.Address, error) { + return _V5ParaSwap.Contract.FeeClaimer(&_V5ParaSwap.CallOpts) +} + +// GetKey is a free data retrieval call binding the contract method 0x82678dd6. +// +// Solidity: function getKey() pure returns(bytes32) +func (_V5ParaSwap *V5ParaSwapCaller) GetKey(opts *bind.CallOpts) ([32]byte, error) { + var out []interface{} + err := _V5ParaSwap.contract.Call(opts, &out, "getKey") + + if err != nil { + return *new([32]byte), err + } + + out0 := *abi.ConvertType(out[0], new([32]byte)).(*[32]byte) + + return out0, err + +} + +// GetKey is a free data retrieval call binding the contract method 0x82678dd6. +// +// Solidity: function getKey() pure returns(bytes32) +func (_V5ParaSwap *V5ParaSwapSession) GetKey() ([32]byte, error) { + return _V5ParaSwap.Contract.GetKey(&_V5ParaSwap.CallOpts) +} + +// GetKey is a free data retrieval call binding the contract method 0x82678dd6. +// +// Solidity: function getKey() pure returns(bytes32) +func (_V5ParaSwap *V5ParaSwapCallerSession) GetKey() ([32]byte, error) { + return _V5ParaSwap.Contract.GetKey(&_V5ParaSwap.CallOpts) +} + +// Initialize is a free data retrieval call binding the contract method 0x439fab91. +// +// Solidity: function initialize(bytes ) pure returns() +func (_V5ParaSwap *V5ParaSwapCaller) Initialize(opts *bind.CallOpts, arg0 []byte) error { + var out []interface{} + err := _V5ParaSwap.contract.Call(opts, &out, "initialize", arg0) + + if err != nil { + return err + } + + return err + +} + +// Initialize is a free data retrieval call binding the contract method 0x439fab91. +// +// Solidity: function initialize(bytes ) pure returns() +func (_V5ParaSwap *V5ParaSwapSession) Initialize(arg0 []byte) error { + return _V5ParaSwap.Contract.Initialize(&_V5ParaSwap.CallOpts, arg0) +} + +// Initialize is a free data retrieval call binding the contract method 0x439fab91. +// +// Solidity: function initialize(bytes ) pure returns() +func (_V5ParaSwap *V5ParaSwapCallerSession) Initialize(arg0 []byte) error { + return _V5ParaSwap.Contract.Initialize(&_V5ParaSwap.CallOpts, arg0) +} + +// MaxFeePercent is a free data retrieval call binding the contract method 0xd830a05b. +// +// Solidity: function maxFeePercent() view returns(uint256) +func (_V5ParaSwap *V5ParaSwapCaller) MaxFeePercent(opts *bind.CallOpts) (*big.Int, error) { + var out []interface{} + err := _V5ParaSwap.contract.Call(opts, &out, "maxFeePercent") + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// MaxFeePercent is a free data retrieval call binding the contract method 0xd830a05b. +// +// Solidity: function maxFeePercent() view returns(uint256) +func (_V5ParaSwap *V5ParaSwapSession) MaxFeePercent() (*big.Int, error) { + return _V5ParaSwap.Contract.MaxFeePercent(&_V5ParaSwap.CallOpts) +} + +// MaxFeePercent is a free data retrieval call binding the contract method 0xd830a05b. +// +// Solidity: function maxFeePercent() view returns(uint256) +func (_V5ParaSwap *V5ParaSwapCallerSession) MaxFeePercent() (*big.Int, error) { + return _V5ParaSwap.Contract.MaxFeePercent(&_V5ParaSwap.CallOpts) +} + +// ParaswapReferralShare is a free data retrieval call binding the contract method 0xd555d4f9. +// +// Solidity: function paraswapReferralShare() view returns(uint256) +func (_V5ParaSwap *V5ParaSwapCaller) ParaswapReferralShare(opts *bind.CallOpts) (*big.Int, error) { + var out []interface{} + err := _V5ParaSwap.contract.Call(opts, &out, "paraswapReferralShare") + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// ParaswapReferralShare is a free data retrieval call binding the contract method 0xd555d4f9. +// +// Solidity: function paraswapReferralShare() view returns(uint256) +func (_V5ParaSwap *V5ParaSwapSession) ParaswapReferralShare() (*big.Int, error) { + return _V5ParaSwap.Contract.ParaswapReferralShare(&_V5ParaSwap.CallOpts) +} + +// ParaswapReferralShare is a free data retrieval call binding the contract method 0xd555d4f9. +// +// Solidity: function paraswapReferralShare() view returns(uint256) +func (_V5ParaSwap *V5ParaSwapCallerSession) ParaswapReferralShare() (*big.Int, error) { + return _V5ParaSwap.Contract.ParaswapReferralShare(&_V5ParaSwap.CallOpts) +} + +// ParaswapSlippageShare is a free data retrieval call binding the contract method 0xc25ff026. +// +// Solidity: function paraswapSlippageShare() view returns(uint256) +func (_V5ParaSwap *V5ParaSwapCaller) ParaswapSlippageShare(opts *bind.CallOpts) (*big.Int, error) { + var out []interface{} + err := _V5ParaSwap.contract.Call(opts, &out, "paraswapSlippageShare") + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// ParaswapSlippageShare is a free data retrieval call binding the contract method 0xc25ff026. +// +// Solidity: function paraswapSlippageShare() view returns(uint256) +func (_V5ParaSwap *V5ParaSwapSession) ParaswapSlippageShare() (*big.Int, error) { + return _V5ParaSwap.Contract.ParaswapSlippageShare(&_V5ParaSwap.CallOpts) +} + +// ParaswapSlippageShare is a free data retrieval call binding the contract method 0xc25ff026. +// +// Solidity: function paraswapSlippageShare() view returns(uint256) +func (_V5ParaSwap *V5ParaSwapCallerSession) ParaswapSlippageShare() (*big.Int, error) { + return _V5ParaSwap.Contract.ParaswapSlippageShare(&_V5ParaSwap.CallOpts) +} + +// PartnerSharePercent is a free data retrieval call binding the contract method 0x12070a41. +// +// Solidity: function partnerSharePercent() view returns(uint256) +func (_V5ParaSwap *V5ParaSwapCaller) PartnerSharePercent(opts *bind.CallOpts) (*big.Int, error) { + var out []interface{} + err := _V5ParaSwap.contract.Call(opts, &out, "partnerSharePercent") + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// PartnerSharePercent is a free data retrieval call binding the contract method 0x12070a41. +// +// Solidity: function partnerSharePercent() view returns(uint256) +func (_V5ParaSwap *V5ParaSwapSession) PartnerSharePercent() (*big.Int, error) { + return _V5ParaSwap.Contract.PartnerSharePercent(&_V5ParaSwap.CallOpts) +} + +// PartnerSharePercent is a free data retrieval call binding the contract method 0x12070a41. +// +// Solidity: function partnerSharePercent() view returns(uint256) +func (_V5ParaSwap *V5ParaSwapCallerSession) PartnerSharePercent() (*big.Int, error) { + return _V5ParaSwap.Contract.PartnerSharePercent(&_V5ParaSwap.CallOpts) +} + +// Weth is a free data retrieval call binding the contract method 0x3fc8cef3. +// +// Solidity: function weth() view returns(address) +func (_V5ParaSwap *V5ParaSwapCaller) Weth(opts *bind.CallOpts) (common.Address, error) { + var out []interface{} + err := _V5ParaSwap.contract.Call(opts, &out, "weth") + + if err != nil { + return *new(common.Address), err + } + + out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) + + return out0, err + +} + +// Weth is a free data retrieval call binding the contract method 0x3fc8cef3. +// +// Solidity: function weth() view returns(address) +func (_V5ParaSwap *V5ParaSwapSession) Weth() (common.Address, error) { + return _V5ParaSwap.Contract.Weth(&_V5ParaSwap.CallOpts) +} + +// Weth is a free data retrieval call binding the contract method 0x3fc8cef3. +// +// Solidity: function weth() view returns(address) +func (_V5ParaSwap *V5ParaSwapCallerSession) Weth() (common.Address, error) { + return _V5ParaSwap.Contract.Weth(&_V5ParaSwap.CallOpts) +} + +// DirectBalancerV2GivenInSwap is a paid mutator transaction binding the contract method 0xb22f4db8. +// +// Solidity: function directBalancerV2GivenInSwap(((bytes32,uint256,uint256,uint256,bytes)[],address[],(address,bool,address,bool),int256[],uint256,uint256,uint256,uint256,uint256,address,address,bool,address,bytes,bytes16) data) payable returns() +func (_V5ParaSwap *V5ParaSwapTransactor) DirectBalancerV2GivenInSwap(opts *bind.TransactOpts, data UtilsDirectBalancerV2) (*types.Transaction, error) { + return _V5ParaSwap.contract.Transact(opts, "directBalancerV2GivenInSwap", data) +} + +// DirectBalancerV2GivenInSwap is a paid mutator transaction binding the contract method 0xb22f4db8. +// +// Solidity: function directBalancerV2GivenInSwap(((bytes32,uint256,uint256,uint256,bytes)[],address[],(address,bool,address,bool),int256[],uint256,uint256,uint256,uint256,uint256,address,address,bool,address,bytes,bytes16) data) payable returns() +func (_V5ParaSwap *V5ParaSwapSession) DirectBalancerV2GivenInSwap(data UtilsDirectBalancerV2) (*types.Transaction, error) { + return _V5ParaSwap.Contract.DirectBalancerV2GivenInSwap(&_V5ParaSwap.TransactOpts, data) +} + +// DirectBalancerV2GivenInSwap is a paid mutator transaction binding the contract method 0xb22f4db8. +// +// Solidity: function directBalancerV2GivenInSwap(((bytes32,uint256,uint256,uint256,bytes)[],address[],(address,bool,address,bool),int256[],uint256,uint256,uint256,uint256,uint256,address,address,bool,address,bytes,bytes16) data) payable returns() +func (_V5ParaSwap *V5ParaSwapTransactorSession) DirectBalancerV2GivenInSwap(data UtilsDirectBalancerV2) (*types.Transaction, error) { + return _V5ParaSwap.Contract.DirectBalancerV2GivenInSwap(&_V5ParaSwap.TransactOpts, data) +} + +// DirectBalancerV2GivenOutSwap is a paid mutator transaction binding the contract method 0x19fc5be0. +// +// Solidity: function directBalancerV2GivenOutSwap(((bytes32,uint256,uint256,uint256,bytes)[],address[],(address,bool,address,bool),int256[],uint256,uint256,uint256,uint256,uint256,address,address,bool,address,bytes,bytes16) data) payable returns() +func (_V5ParaSwap *V5ParaSwapTransactor) DirectBalancerV2GivenOutSwap(opts *bind.TransactOpts, data UtilsDirectBalancerV2) (*types.Transaction, error) { + return _V5ParaSwap.contract.Transact(opts, "directBalancerV2GivenOutSwap", data) +} + +// DirectBalancerV2GivenOutSwap is a paid mutator transaction binding the contract method 0x19fc5be0. +// +// Solidity: function directBalancerV2GivenOutSwap(((bytes32,uint256,uint256,uint256,bytes)[],address[],(address,bool,address,bool),int256[],uint256,uint256,uint256,uint256,uint256,address,address,bool,address,bytes,bytes16) data) payable returns() +func (_V5ParaSwap *V5ParaSwapSession) DirectBalancerV2GivenOutSwap(data UtilsDirectBalancerV2) (*types.Transaction, error) { + return _V5ParaSwap.Contract.DirectBalancerV2GivenOutSwap(&_V5ParaSwap.TransactOpts, data) +} + +// DirectBalancerV2GivenOutSwap is a paid mutator transaction binding the contract method 0x19fc5be0. +// +// Solidity: function directBalancerV2GivenOutSwap(((bytes32,uint256,uint256,uint256,bytes)[],address[],(address,bool,address,bool),int256[],uint256,uint256,uint256,uint256,uint256,address,address,bool,address,bytes,bytes16) data) payable returns() +func (_V5ParaSwap *V5ParaSwapTransactorSession) DirectBalancerV2GivenOutSwap(data UtilsDirectBalancerV2) (*types.Transaction, error) { + return _V5ParaSwap.Contract.DirectBalancerV2GivenOutSwap(&_V5ParaSwap.TransactOpts, data) +} + +// DirectCurveV1Swap is a paid mutator transaction binding the contract method 0x3865bde6. +// +// Solidity: function directCurveV1Swap((address,address,address,uint256,uint256,uint256,uint256,int128,int128,address,bool,uint8,address,bool,bytes,bytes16) data) payable returns() +func (_V5ParaSwap *V5ParaSwapTransactor) DirectCurveV1Swap(opts *bind.TransactOpts, data UtilsDirectCurveV1) (*types.Transaction, error) { + return _V5ParaSwap.contract.Transact(opts, "directCurveV1Swap", data) +} + +// DirectCurveV1Swap is a paid mutator transaction binding the contract method 0x3865bde6. +// +// Solidity: function directCurveV1Swap((address,address,address,uint256,uint256,uint256,uint256,int128,int128,address,bool,uint8,address,bool,bytes,bytes16) data) payable returns() +func (_V5ParaSwap *V5ParaSwapSession) DirectCurveV1Swap(data UtilsDirectCurveV1) (*types.Transaction, error) { + return _V5ParaSwap.Contract.DirectCurveV1Swap(&_V5ParaSwap.TransactOpts, data) +} + +// DirectCurveV1Swap is a paid mutator transaction binding the contract method 0x3865bde6. +// +// Solidity: function directCurveV1Swap((address,address,address,uint256,uint256,uint256,uint256,int128,int128,address,bool,uint8,address,bool,bytes,bytes16) data) payable returns() +func (_V5ParaSwap *V5ParaSwapTransactorSession) DirectCurveV1Swap(data UtilsDirectCurveV1) (*types.Transaction, error) { + return _V5ParaSwap.Contract.DirectCurveV1Swap(&_V5ParaSwap.TransactOpts, data) +} + +// DirectCurveV2Swap is a paid mutator transaction binding the contract method 0x58f15100. +// +// Solidity: function directCurveV2Swap((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,address,bool,uint8,address,bool,bytes,bytes16) data) payable returns() +func (_V5ParaSwap *V5ParaSwapTransactor) DirectCurveV2Swap(opts *bind.TransactOpts, data UtilsDirectCurveV2) (*types.Transaction, error) { + return _V5ParaSwap.contract.Transact(opts, "directCurveV2Swap", data) +} + +// DirectCurveV2Swap is a paid mutator transaction binding the contract method 0x58f15100. +// +// Solidity: function directCurveV2Swap((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,address,bool,uint8,address,bool,bytes,bytes16) data) payable returns() +func (_V5ParaSwap *V5ParaSwapSession) DirectCurveV2Swap(data UtilsDirectCurveV2) (*types.Transaction, error) { + return _V5ParaSwap.Contract.DirectCurveV2Swap(&_V5ParaSwap.TransactOpts, data) +} + +// DirectCurveV2Swap is a paid mutator transaction binding the contract method 0x58f15100. +// +// Solidity: function directCurveV2Swap((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,address,bool,uint8,address,bool,bytes,bytes16) data) payable returns() +func (_V5ParaSwap *V5ParaSwapTransactorSession) DirectCurveV2Swap(data UtilsDirectCurveV2) (*types.Transaction, error) { + return _V5ParaSwap.Contract.DirectCurveV2Swap(&_V5ParaSwap.TransactOpts, data) +} + +// DirectUniV3Buy is a paid mutator transaction binding the contract method 0x87a63926. +// +// Solidity: function directUniV3Buy((address,address,address,uint256,uint256,uint256,uint256,uint256,address,bool,address,bytes,bytes,bytes16) data) payable returns() +func (_V5ParaSwap *V5ParaSwapTransactor) DirectUniV3Buy(opts *bind.TransactOpts, data UtilsDirectUniV3) (*types.Transaction, error) { + return _V5ParaSwap.contract.Transact(opts, "directUniV3Buy", data) +} + +// DirectUniV3Buy is a paid mutator transaction binding the contract method 0x87a63926. +// +// Solidity: function directUniV3Buy((address,address,address,uint256,uint256,uint256,uint256,uint256,address,bool,address,bytes,bytes,bytes16) data) payable returns() +func (_V5ParaSwap *V5ParaSwapSession) DirectUniV3Buy(data UtilsDirectUniV3) (*types.Transaction, error) { + return _V5ParaSwap.Contract.DirectUniV3Buy(&_V5ParaSwap.TransactOpts, data) +} + +// DirectUniV3Buy is a paid mutator transaction binding the contract method 0x87a63926. +// +// Solidity: function directUniV3Buy((address,address,address,uint256,uint256,uint256,uint256,uint256,address,bool,address,bytes,bytes,bytes16) data) payable returns() +func (_V5ParaSwap *V5ParaSwapTransactorSession) DirectUniV3Buy(data UtilsDirectUniV3) (*types.Transaction, error) { + return _V5ParaSwap.Contract.DirectUniV3Buy(&_V5ParaSwap.TransactOpts, data) +} + +// DirectUniV3Swap is a paid mutator transaction binding the contract method 0xa6886da9. +// +// Solidity: function directUniV3Swap((address,address,address,uint256,uint256,uint256,uint256,uint256,address,bool,address,bytes,bytes,bytes16) data) payable returns() +func (_V5ParaSwap *V5ParaSwapTransactor) DirectUniV3Swap(opts *bind.TransactOpts, data UtilsDirectUniV3) (*types.Transaction, error) { + return _V5ParaSwap.contract.Transact(opts, "directUniV3Swap", data) +} + +// DirectUniV3Swap is a paid mutator transaction binding the contract method 0xa6886da9. +// +// Solidity: function directUniV3Swap((address,address,address,uint256,uint256,uint256,uint256,uint256,address,bool,address,bytes,bytes,bytes16) data) payable returns() +func (_V5ParaSwap *V5ParaSwapSession) DirectUniV3Swap(data UtilsDirectUniV3) (*types.Transaction, error) { + return _V5ParaSwap.Contract.DirectUniV3Swap(&_V5ParaSwap.TransactOpts, data) +} + +// DirectUniV3Swap is a paid mutator transaction binding the contract method 0xa6886da9. +// +// Solidity: function directUniV3Swap((address,address,address,uint256,uint256,uint256,uint256,uint256,address,bool,address,bytes,bytes,bytes16) data) payable returns() +func (_V5ParaSwap *V5ParaSwapTransactorSession) DirectUniV3Swap(data UtilsDirectUniV3) (*types.Transaction, error) { + return _V5ParaSwap.Contract.DirectUniV3Swap(&_V5ParaSwap.TransactOpts, data) +} + +// V5ParaSwapBoughtV3Iterator is returned from FilterBoughtV3 and is used to iterate over the raw logs and unpacked data for BoughtV3 events raised by the V5ParaSwap contract. +type V5ParaSwapBoughtV3Iterator struct { + Event *V5ParaSwapBoughtV3 // 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 *V5ParaSwapBoughtV3Iterator) 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(V5ParaSwapBoughtV3) + 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(V5ParaSwapBoughtV3) + 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 *V5ParaSwapBoughtV3Iterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *V5ParaSwapBoughtV3Iterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// V5ParaSwapBoughtV3 represents a BoughtV3 event raised by the V5ParaSwap contract. +type V5ParaSwapBoughtV3 struct { + Uuid [16]byte + Partner common.Address + FeePercent *big.Int + Initiator common.Address + Beneficiary common.Address + SrcToken common.Address + DestToken common.Address + SrcAmount *big.Int + ReceivedAmount *big.Int + ExpectedAmount *big.Int + Raw types.Log // Blockchain specific contextual infos +} + +// FilterBoughtV3 is a free log retrieval operation binding the contract event 0x4cc7e95e48af62690313a0733e93308ac9a73326bc3c29f1788b1191c376d5b6. +// +// Solidity: event BoughtV3(bytes16 uuid, address partner, uint256 feePercent, address initiator, address indexed beneficiary, address indexed srcToken, address indexed destToken, uint256 srcAmount, uint256 receivedAmount, uint256 expectedAmount) +func (_V5ParaSwap *V5ParaSwapFilterer) FilterBoughtV3(opts *bind.FilterOpts, beneficiary []common.Address, srcToken []common.Address, destToken []common.Address) (*V5ParaSwapBoughtV3Iterator, error) { + + var beneficiaryRule []interface{} + for _, beneficiaryItem := range beneficiary { + beneficiaryRule = append(beneficiaryRule, beneficiaryItem) + } + var srcTokenRule []interface{} + for _, srcTokenItem := range srcToken { + srcTokenRule = append(srcTokenRule, srcTokenItem) + } + var destTokenRule []interface{} + for _, destTokenItem := range destToken { + destTokenRule = append(destTokenRule, destTokenItem) + } + + logs, sub, err := _V5ParaSwap.contract.FilterLogs(opts, "BoughtV3", beneficiaryRule, srcTokenRule, destTokenRule) + if err != nil { + return nil, err + } + return &V5ParaSwapBoughtV3Iterator{contract: _V5ParaSwap.contract, event: "BoughtV3", logs: logs, sub: sub}, nil +} + +// WatchBoughtV3 is a free log subscription operation binding the contract event 0x4cc7e95e48af62690313a0733e93308ac9a73326bc3c29f1788b1191c376d5b6. +// +// Solidity: event BoughtV3(bytes16 uuid, address partner, uint256 feePercent, address initiator, address indexed beneficiary, address indexed srcToken, address indexed destToken, uint256 srcAmount, uint256 receivedAmount, uint256 expectedAmount) +func (_V5ParaSwap *V5ParaSwapFilterer) WatchBoughtV3(opts *bind.WatchOpts, sink chan<- *V5ParaSwapBoughtV3, beneficiary []common.Address, srcToken []common.Address, destToken []common.Address) (event.Subscription, error) { + + var beneficiaryRule []interface{} + for _, beneficiaryItem := range beneficiary { + beneficiaryRule = append(beneficiaryRule, beneficiaryItem) + } + var srcTokenRule []interface{} + for _, srcTokenItem := range srcToken { + srcTokenRule = append(srcTokenRule, srcTokenItem) + } + var destTokenRule []interface{} + for _, destTokenItem := range destToken { + destTokenRule = append(destTokenRule, destTokenItem) + } + + logs, sub, err := _V5ParaSwap.contract.WatchLogs(opts, "BoughtV3", beneficiaryRule, srcTokenRule, destTokenRule) + 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(V5ParaSwapBoughtV3) + if err := _V5ParaSwap.contract.UnpackLog(event, "BoughtV3", 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 +} + +// ParseBoughtV3 is a log parse operation binding the contract event 0x4cc7e95e48af62690313a0733e93308ac9a73326bc3c29f1788b1191c376d5b6. +// +// Solidity: event BoughtV3(bytes16 uuid, address partner, uint256 feePercent, address initiator, address indexed beneficiary, address indexed srcToken, address indexed destToken, uint256 srcAmount, uint256 receivedAmount, uint256 expectedAmount) +func (_V5ParaSwap *V5ParaSwapFilterer) ParseBoughtV3(log types.Log) (*V5ParaSwapBoughtV3, error) { + event := new(V5ParaSwapBoughtV3) + if err := _V5ParaSwap.contract.UnpackLog(event, "BoughtV3", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// V5ParaSwapSwappedDirectIterator is returned from FilterSwappedDirect and is used to iterate over the raw logs and unpacked data for SwappedDirect events raised by the V5ParaSwap contract. +type V5ParaSwapSwappedDirectIterator struct { + Event *V5ParaSwapSwappedDirect // 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 *V5ParaSwapSwappedDirectIterator) 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(V5ParaSwapSwappedDirect) + 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(V5ParaSwapSwappedDirect) + 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 *V5ParaSwapSwappedDirectIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *V5ParaSwapSwappedDirectIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// V5ParaSwapSwappedDirect represents a SwappedDirect event raised by the V5ParaSwap contract. +type V5ParaSwapSwappedDirect struct { + Uuid [16]byte + Partner common.Address + FeePercent *big.Int + Initiator common.Address + Kind uint8 + Beneficiary common.Address + SrcToken common.Address + DestToken common.Address + SrcAmount *big.Int + ReceivedAmount *big.Int + ExpectedAmount *big.Int + Raw types.Log // Blockchain specific contextual infos +} + +// FilterSwappedDirect is a free log retrieval operation binding the contract event 0xd2d73da2b5fd52cd654d8fd1b514ad57355bad741de639e3a1c3a20dd9f17347. +// +// Solidity: event SwappedDirect(bytes16 uuid, address partner, uint256 feePercent, address initiator, uint8 kind, address indexed beneficiary, address indexed srcToken, address indexed destToken, uint256 srcAmount, uint256 receivedAmount, uint256 expectedAmount) +func (_V5ParaSwap *V5ParaSwapFilterer) FilterSwappedDirect(opts *bind.FilterOpts, beneficiary []common.Address, srcToken []common.Address, destToken []common.Address) (*V5ParaSwapSwappedDirectIterator, error) { + + var beneficiaryRule []interface{} + for _, beneficiaryItem := range beneficiary { + beneficiaryRule = append(beneficiaryRule, beneficiaryItem) + } + var srcTokenRule []interface{} + for _, srcTokenItem := range srcToken { + srcTokenRule = append(srcTokenRule, srcTokenItem) + } + var destTokenRule []interface{} + for _, destTokenItem := range destToken { + destTokenRule = append(destTokenRule, destTokenItem) + } + + logs, sub, err := _V5ParaSwap.contract.FilterLogs(opts, "SwappedDirect", beneficiaryRule, srcTokenRule, destTokenRule) + if err != nil { + return nil, err + } + return &V5ParaSwapSwappedDirectIterator{contract: _V5ParaSwap.contract, event: "SwappedDirect", logs: logs, sub: sub}, nil +} + +// WatchSwappedDirect is a free log subscription operation binding the contract event 0xd2d73da2b5fd52cd654d8fd1b514ad57355bad741de639e3a1c3a20dd9f17347. +// +// Solidity: event SwappedDirect(bytes16 uuid, address partner, uint256 feePercent, address initiator, uint8 kind, address indexed beneficiary, address indexed srcToken, address indexed destToken, uint256 srcAmount, uint256 receivedAmount, uint256 expectedAmount) +func (_V5ParaSwap *V5ParaSwapFilterer) WatchSwappedDirect(opts *bind.WatchOpts, sink chan<- *V5ParaSwapSwappedDirect, beneficiary []common.Address, srcToken []common.Address, destToken []common.Address) (event.Subscription, error) { + + var beneficiaryRule []interface{} + for _, beneficiaryItem := range beneficiary { + beneficiaryRule = append(beneficiaryRule, beneficiaryItem) + } + var srcTokenRule []interface{} + for _, srcTokenItem := range srcToken { + srcTokenRule = append(srcTokenRule, srcTokenItem) + } + var destTokenRule []interface{} + for _, destTokenItem := range destToken { + destTokenRule = append(destTokenRule, destTokenItem) + } + + logs, sub, err := _V5ParaSwap.contract.WatchLogs(opts, "SwappedDirect", beneficiaryRule, srcTokenRule, destTokenRule) + 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(V5ParaSwapSwappedDirect) + if err := _V5ParaSwap.contract.UnpackLog(event, "SwappedDirect", 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 +} + +// ParseSwappedDirect is a log parse operation binding the contract event 0xd2d73da2b5fd52cd654d8fd1b514ad57355bad741de639e3a1c3a20dd9f17347. +// +// Solidity: event SwappedDirect(bytes16 uuid, address partner, uint256 feePercent, address initiator, uint8 kind, address indexed beneficiary, address indexed srcToken, address indexed destToken, uint256 srcAmount, uint256 receivedAmount, uint256 expectedAmount) +func (_V5ParaSwap *V5ParaSwapFilterer) ParseSwappedDirect(log types.Log) (*V5ParaSwapSwappedDirect, error) { + event := new(V5ParaSwapSwappedDirect) + if err := _V5ParaSwap.contract.UnpackLog(event, "SwappedDirect", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// V5ParaSwapSwappedV3Iterator is returned from FilterSwappedV3 and is used to iterate over the raw logs and unpacked data for SwappedV3 events raised by the V5ParaSwap contract. +type V5ParaSwapSwappedV3Iterator struct { + Event *V5ParaSwapSwappedV3 // 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 *V5ParaSwapSwappedV3Iterator) 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(V5ParaSwapSwappedV3) + 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(V5ParaSwapSwappedV3) + 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 *V5ParaSwapSwappedV3Iterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *V5ParaSwapSwappedV3Iterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// V5ParaSwapSwappedV3 represents a SwappedV3 event raised by the V5ParaSwap contract. +type V5ParaSwapSwappedV3 struct { + Uuid [16]byte + Partner common.Address + FeePercent *big.Int + Initiator common.Address + Beneficiary common.Address + SrcToken common.Address + DestToken common.Address + SrcAmount *big.Int + ReceivedAmount *big.Int + ExpectedAmount *big.Int + Raw types.Log // Blockchain specific contextual infos +} + +// FilterSwappedV3 is a free log retrieval operation binding the contract event 0xe00361d207b252a464323eb23d45d42583e391f2031acdd2e9fa36efddd43cb0. +// +// Solidity: event SwappedV3(bytes16 uuid, address partner, uint256 feePercent, address initiator, address indexed beneficiary, address indexed srcToken, address indexed destToken, uint256 srcAmount, uint256 receivedAmount, uint256 expectedAmount) +func (_V5ParaSwap *V5ParaSwapFilterer) FilterSwappedV3(opts *bind.FilterOpts, beneficiary []common.Address, srcToken []common.Address, destToken []common.Address) (*V5ParaSwapSwappedV3Iterator, error) { + + var beneficiaryRule []interface{} + for _, beneficiaryItem := range beneficiary { + beneficiaryRule = append(beneficiaryRule, beneficiaryItem) + } + var srcTokenRule []interface{} + for _, srcTokenItem := range srcToken { + srcTokenRule = append(srcTokenRule, srcTokenItem) + } + var destTokenRule []interface{} + for _, destTokenItem := range destToken { + destTokenRule = append(destTokenRule, destTokenItem) + } + + logs, sub, err := _V5ParaSwap.contract.FilterLogs(opts, "SwappedV3", beneficiaryRule, srcTokenRule, destTokenRule) + if err != nil { + return nil, err + } + return &V5ParaSwapSwappedV3Iterator{contract: _V5ParaSwap.contract, event: "SwappedV3", logs: logs, sub: sub}, nil +} + +// WatchSwappedV3 is a free log subscription operation binding the contract event 0xe00361d207b252a464323eb23d45d42583e391f2031acdd2e9fa36efddd43cb0. +// +// Solidity: event SwappedV3(bytes16 uuid, address partner, uint256 feePercent, address initiator, address indexed beneficiary, address indexed srcToken, address indexed destToken, uint256 srcAmount, uint256 receivedAmount, uint256 expectedAmount) +func (_V5ParaSwap *V5ParaSwapFilterer) WatchSwappedV3(opts *bind.WatchOpts, sink chan<- *V5ParaSwapSwappedV3, beneficiary []common.Address, srcToken []common.Address, destToken []common.Address) (event.Subscription, error) { + + var beneficiaryRule []interface{} + for _, beneficiaryItem := range beneficiary { + beneficiaryRule = append(beneficiaryRule, beneficiaryItem) + } + var srcTokenRule []interface{} + for _, srcTokenItem := range srcToken { + srcTokenRule = append(srcTokenRule, srcTokenItem) + } + var destTokenRule []interface{} + for _, destTokenItem := range destToken { + destTokenRule = append(destTokenRule, destTokenItem) + } + + logs, sub, err := _V5ParaSwap.contract.WatchLogs(opts, "SwappedV3", beneficiaryRule, srcTokenRule, destTokenRule) + 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(V5ParaSwapSwappedV3) + if err := _V5ParaSwap.contract.UnpackLog(event, "SwappedV3", 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 +} + +// ParseSwappedV3 is a log parse operation binding the contract event 0xe00361d207b252a464323eb23d45d42583e391f2031acdd2e9fa36efddd43cb0. +// +// Solidity: event SwappedV3(bytes16 uuid, address partner, uint256 feePercent, address initiator, address indexed beneficiary, address indexed srcToken, address indexed destToken, uint256 srcAmount, uint256 receivedAmount, uint256 expectedAmount) +func (_V5ParaSwap *V5ParaSwapFilterer) ParseSwappedV3(log types.Log) (*V5ParaSwapSwappedV3, error) { + event := new(V5ParaSwapSwappedV3) + if err := _V5ParaSwap.contract.UnpackLog(event, "SwappedV3", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} diff --git a/schema/worker/decentralized/platform.go b/schema/worker/decentralized/platform.go index 1731da69..060b2d63 100644 --- a/schema/worker/decentralized/platform.go +++ b/schema/worker/decentralized/platform.go @@ -28,6 +28,7 @@ const ( PlatformOpenSea // OpenSea PlatformOptimism // Optimism PlatformParagraph // Paragraph + PlatformParaswap // Paraswap PlatformRSS3 // RSS3 PlatformSAVM // SAVM PlatformStargate // Stargate @@ -71,6 +72,7 @@ var ToPlatformMap = map[Worker]Platform{ OpenSea: PlatformOpenSea, Optimism: PlatformOptimism, Paragraph: PlatformParagraph, + Paraswap: PlatformParaswap, RSS3: PlatformRSS3, SAVM: PlatformSAVM, Stargate: PlatformStargate, diff --git a/schema/worker/decentralized/platform_string.go b/schema/worker/decentralized/platform_string.go index 25f5cb69..cacfbe35 100644 --- a/schema/worker/decentralized/platform_string.go +++ b/schema/worker/decentralized/platform_string.go @@ -9,11 +9,11 @@ import ( "strings" ) -const _PlatformName = "Unknown1inchAAVEAavegotchiCowArbitrumBendDAOCrossbellCurveENSFarcasterHighlightIQWikiKiwiStandLensLidoLooksRareMattersMirrorOpenSeaOptimismParagraphRSS3SAVMStargateUniswapVSL" +const _PlatformName = "Unknown1inchAAVEAavegotchiCowArbitrumBendDAOCrossbellCurveENSFarcasterHighlightIQWikiKiwiStandLensLidoLooksRareMattersMirrorOpenSeaOptimismParagraphParaswapRSS3SAVMStargateUniswapVSL" -var _PlatformIndex = [...]uint8{0, 7, 12, 16, 26, 29, 37, 44, 53, 58, 61, 70, 79, 85, 94, 98, 102, 111, 118, 124, 131, 139, 148, 152, 156, 164, 171, 174} +var _PlatformIndex = [...]uint8{0, 7, 12, 16, 26, 29, 37, 44, 53, 58, 61, 70, 79, 85, 94, 98, 102, 111, 118, 124, 131, 139, 148, 156, 160, 164, 172, 179, 182} -const _PlatformLowerName = "unknown1inchaaveaavegotchicowarbitrumbenddaocrossbellcurveensfarcasterhighlightiqwikikiwistandlenslidolooksraremattersmirroropenseaoptimismparagraphrss3savmstargateuniswapvsl" +const _PlatformLowerName = "unknown1inchaaveaavegotchicowarbitrumbenddaocrossbellcurveensfarcasterhighlightiqwikikiwistandlenslidolooksraremattersmirroropenseaoptimismparagraphparaswaprss3savmstargateuniswapvsl" func (i Platform) String() string { if i >= Platform(len(_PlatformIndex)-1) { @@ -52,14 +52,15 @@ func _PlatformNoOp() { _ = x[PlatformOpenSea-(19)] _ = x[PlatformOptimism-(20)] _ = x[PlatformParagraph-(21)] - _ = x[PlatformRSS3-(22)] - _ = x[PlatformSAVM-(23)] - _ = x[PlatformStargate-(24)] - _ = x[PlatformUniswap-(25)] - _ = x[PlatformVSL-(26)] + _ = x[PlatformParaswap-(22)] + _ = x[PlatformRSS3-(23)] + _ = x[PlatformSAVM-(24)] + _ = x[PlatformStargate-(25)] + _ = x[PlatformUniswap-(26)] + _ = x[PlatformVSL-(27)] } -var _PlatformValues = []Platform{PlatformUnknown, Platform1Inch, PlatformAAVE, PlatformAavegotchi, PlatformCow, PlatformArbitrum, PlatformBendDAO, PlatformCrossbell, PlatformCurve, PlatformENS, PlatformFarcaster, PlatformHighlight, PlatformIQWiki, PlatformKiwiStand, PlatformLens, PlatformLido, PlatformLooksRare, PlatformMatters, PlatformMirror, PlatformOpenSea, PlatformOptimism, PlatformParagraph, PlatformRSS3, PlatformSAVM, PlatformStargate, PlatformUniswap, PlatformVSL} +var _PlatformValues = []Platform{PlatformUnknown, Platform1Inch, PlatformAAVE, PlatformAavegotchi, PlatformCow, PlatformArbitrum, PlatformBendDAO, PlatformCrossbell, PlatformCurve, PlatformENS, PlatformFarcaster, PlatformHighlight, PlatformIQWiki, PlatformKiwiStand, PlatformLens, PlatformLido, PlatformLooksRare, PlatformMatters, PlatformMirror, PlatformOpenSea, PlatformOptimism, PlatformParagraph, PlatformParaswap, PlatformRSS3, PlatformSAVM, PlatformStargate, PlatformUniswap, PlatformVSL} var _PlatformNameToValueMap = map[string]Platform{ _PlatformName[0:7]: PlatformUnknown, @@ -106,16 +107,18 @@ var _PlatformNameToValueMap = map[string]Platform{ _PlatformLowerName[131:139]: PlatformOptimism, _PlatformName[139:148]: PlatformParagraph, _PlatformLowerName[139:148]: PlatformParagraph, - _PlatformName[148:152]: PlatformRSS3, - _PlatformLowerName[148:152]: PlatformRSS3, - _PlatformName[152:156]: PlatformSAVM, - _PlatformLowerName[152:156]: PlatformSAVM, - _PlatformName[156:164]: PlatformStargate, - _PlatformLowerName[156:164]: PlatformStargate, - _PlatformName[164:171]: PlatformUniswap, - _PlatformLowerName[164:171]: PlatformUniswap, - _PlatformName[171:174]: PlatformVSL, - _PlatformLowerName[171:174]: PlatformVSL, + _PlatformName[148:156]: PlatformParaswap, + _PlatformLowerName[148:156]: PlatformParaswap, + _PlatformName[156:160]: PlatformRSS3, + _PlatformLowerName[156:160]: PlatformRSS3, + _PlatformName[160:164]: PlatformSAVM, + _PlatformLowerName[160:164]: PlatformSAVM, + _PlatformName[164:172]: PlatformStargate, + _PlatformLowerName[164:172]: PlatformStargate, + _PlatformName[172:179]: PlatformUniswap, + _PlatformLowerName[172:179]: PlatformUniswap, + _PlatformName[179:182]: PlatformVSL, + _PlatformLowerName[179:182]: PlatformVSL, } var _PlatformNames = []string{ @@ -141,11 +144,12 @@ var _PlatformNames = []string{ _PlatformName[124:131], _PlatformName[131:139], _PlatformName[139:148], - _PlatformName[148:152], - _PlatformName[152:156], - _PlatformName[156:164], - _PlatformName[164:171], - _PlatformName[171:174], + _PlatformName[148:156], + _PlatformName[156:160], + _PlatformName[160:164], + _PlatformName[164:172], + _PlatformName[172:179], + _PlatformName[179:182], } // PlatformString retrieves an enum value from the enum constants string name. diff --git a/schema/worker/decentralized/worker.go b/schema/worker/decentralized/worker.go index b74f6919..9a31c4de 100644 --- a/schema/worker/decentralized/worker.go +++ b/schema/worker/decentralized/worker.go @@ -31,6 +31,7 @@ const ( OpenSea // opensea Optimism // optimism Paragraph // paragraph + Paraswap // paraswap RSS3 // rss3 SAVM // savm Stargate // stargate @@ -86,6 +87,7 @@ var ToTagsMap = map[Worker][]tag.Tag{ OpenSea: {tag.Collectible}, Optimism: {tag.Transaction}, Paragraph: {tag.Social}, + Paraswap: {tag.Exchange}, RSS3: {tag.Exchange, tag.Collectible}, SAVM: {tag.Transaction}, Stargate: {tag.Transaction}, diff --git a/schema/worker/decentralized/worker_string.go b/schema/worker/decentralized/worker_string.go index a6a4e590..672b8f78 100644 --- a/schema/worker/decentralized/worker_string.go +++ b/schema/worker/decentralized/worker_string.go @@ -9,11 +9,11 @@ import ( "strings" ) -const _WorkerName = "aaveaavegotchiarbitrumbenddaocorecowcrossbellcurveenshighlightiqwikikiwistandlenslidolooksraremattersmirrormomoka1inchopenseaoptimismparagraphrss3savmstargateuniswapvsl" +const _WorkerName = "aaveaavegotchiarbitrumbenddaocorecowcrossbellcurveenshighlightiqwikikiwistandlenslidolooksraremattersmirrormomoka1inchopenseaoptimismparagraphparaswaprss3savmstargateuniswapvsl" -var _WorkerIndex = [...]uint8{0, 4, 14, 22, 29, 33, 36, 45, 50, 53, 62, 68, 77, 81, 85, 94, 101, 107, 113, 118, 125, 133, 142, 146, 150, 158, 165, 168} +var _WorkerIndex = [...]uint8{0, 4, 14, 22, 29, 33, 36, 45, 50, 53, 62, 68, 77, 81, 85, 94, 101, 107, 113, 118, 125, 133, 142, 150, 154, 158, 166, 173, 176} -const _WorkerLowerName = "aaveaavegotchiarbitrumbenddaocorecowcrossbellcurveenshighlightiqwikikiwistandlenslidolooksraremattersmirrormomoka1inchopenseaoptimismparagraphrss3savmstargateuniswapvsl" +const _WorkerLowerName = "aaveaavegotchiarbitrumbenddaocorecowcrossbellcurveenshighlightiqwikikiwistandlenslidolooksraremattersmirrormomoka1inchopenseaoptimismparagraphparaswaprss3savmstargateuniswapvsl" func (i Worker) String() string { i -= 1 @@ -53,14 +53,15 @@ func _WorkerNoOp() { _ = x[OpenSea-(20)] _ = x[Optimism-(21)] _ = x[Paragraph-(22)] - _ = x[RSS3-(23)] - _ = x[SAVM-(24)] - _ = x[Stargate-(25)] - _ = x[Uniswap-(26)] - _ = x[VSL-(27)] + _ = x[Paraswap-(23)] + _ = x[RSS3-(24)] + _ = x[SAVM-(25)] + _ = x[Stargate-(26)] + _ = x[Uniswap-(27)] + _ = x[VSL-(28)] } -var _WorkerValues = []Worker{Aave, Aavegotchi, Arbitrum, BendDAO, Core, Cow, Crossbell, Curve, ENS, Highlight, IQWiki, KiwiStand, Lens, Lido, Looksrare, Matters, Mirror, Momoka, Oneinch, OpenSea, Optimism, Paragraph, RSS3, SAVM, Stargate, Uniswap, VSL} +var _WorkerValues = []Worker{Aave, Aavegotchi, Arbitrum, BendDAO, Core, Cow, Crossbell, Curve, ENS, Highlight, IQWiki, KiwiStand, Lens, Lido, Looksrare, Matters, Mirror, Momoka, Oneinch, OpenSea, Optimism, Paragraph, Paraswap, RSS3, SAVM, Stargate, Uniswap, VSL} var _WorkerNameToValueMap = map[string]Worker{ _WorkerName[0:4]: Aave, @@ -107,16 +108,18 @@ var _WorkerNameToValueMap = map[string]Worker{ _WorkerLowerName[125:133]: Optimism, _WorkerName[133:142]: Paragraph, _WorkerLowerName[133:142]: Paragraph, - _WorkerName[142:146]: RSS3, - _WorkerLowerName[142:146]: RSS3, - _WorkerName[146:150]: SAVM, - _WorkerLowerName[146:150]: SAVM, - _WorkerName[150:158]: Stargate, - _WorkerLowerName[150:158]: Stargate, - _WorkerName[158:165]: Uniswap, - _WorkerLowerName[158:165]: Uniswap, - _WorkerName[165:168]: VSL, - _WorkerLowerName[165:168]: VSL, + _WorkerName[142:150]: Paraswap, + _WorkerLowerName[142:150]: Paraswap, + _WorkerName[150:154]: RSS3, + _WorkerLowerName[150:154]: RSS3, + _WorkerName[154:158]: SAVM, + _WorkerLowerName[154:158]: SAVM, + _WorkerName[158:166]: Stargate, + _WorkerLowerName[158:166]: Stargate, + _WorkerName[166:173]: Uniswap, + _WorkerLowerName[166:173]: Uniswap, + _WorkerName[173:176]: VSL, + _WorkerLowerName[173:176]: VSL, } var _WorkerNames = []string{ @@ -142,11 +145,12 @@ var _WorkerNames = []string{ _WorkerName[118:125], _WorkerName[125:133], _WorkerName[133:142], - _WorkerName[142:146], - _WorkerName[146:150], - _WorkerName[150:158], - _WorkerName[158:165], - _WorkerName[165:168], + _WorkerName[142:150], + _WorkerName[150:154], + _WorkerName[154:158], + _WorkerName[158:166], + _WorkerName[166:173], + _WorkerName[173:176], } // WorkerString retrieves an enum value from the enum constants string name.