package arbitrage import ( "math/big" "github.com/ethereum/go-ethereum/accounts/abi" "github.com/ethereum/go-ethereum/common" ) type flashSwapCallback struct { TokenPath []common.Address PoolPath []common.Address Fees []*big.Int MinAmountOut *big.Int } func encodeFlashSwapCallback(tokenPath []common.Address, poolPath []common.Address, fees []*big.Int, minAmountOut *big.Int) ([]byte, error) { tupleType, err := abi.NewType("tuple", "flashSwapCallback", []abi.ArgumentMarshaling{ {Name: "tokenPath", Type: "address[]"}, {Name: "poolPath", Type: "address[]"}, {Name: "fees", Type: "uint256[]"}, {Name: "minAmountOut", Type: "uint256"}, }) if err != nil { return nil, err } arguments := abi.Arguments{{Type: tupleType}} callback := flashSwapCallback{ TokenPath: tokenPath, PoolPath: poolPath, Fees: fees, MinAmountOut: minAmountOut, } return arguments.Pack(callback) }