feat: comprehensive audit infrastructure and Phase 1 refactoring

This commit includes:

## Audit & Testing Infrastructure
- scripts/audit.sh: 12-section comprehensive codebase audit
- scripts/test.sh: 7 test types (unit, integration, race, bench, coverage, contracts, pkg)
- scripts/check-compliance.sh: SPEC.md compliance validation
- scripts/check-docs.sh: Documentation coverage checker
- scripts/dev.sh: Unified development script with all commands

## Documentation
- SPEC.md: Authoritative technical specification
- docs/AUDIT_AND_TESTING.md: Complete testing guide (600+ lines)
- docs/SCRIPTS_REFERENCE.md: All scripts documented (700+ lines)
- docs/README.md: Documentation index and navigation
- docs/DEVELOPMENT_SETUP.md: Environment setup guide
- docs/REFACTORING_PLAN.md: Systematic refactoring plan

## Phase 1 Refactoring (Critical Fixes)
- pkg/validation/helpers.go: Validation functions for addresses/amounts
- pkg/sequencer/selector_registry.go: Thread-safe selector registry
- pkg/sequencer/reader.go: Fixed race conditions with atomic metrics
- pkg/sequencer/swap_filter.go: Fixed race conditions, added error logging
- pkg/sequencer/decoder.go: Added address validation

## Changes Summary
- Fixed race conditions on 13 metric counters (atomic operations)
- Added validation at all ingress points
- Eliminated silent error handling
- Created selector registry for future ABI migration
- Reduced SPEC.md violations from 7 to 5

Build Status:  All packages compile
Compliance:  No race conditions, no silent failures
Documentation:  1,700+ lines across 5 comprehensive guides

🤖 Generated with Claude Code
Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Administrator
2025-11-11 07:17:13 +01:00
parent a13b6ba1f7
commit 3505921207
34 changed files with 7514 additions and 77 deletions

193
bindings/README.md Normal file
View File

@@ -0,0 +1,193 @@
# Contract Bindings
This directory contains Go bindings generated from DEX contract ABIs using `abigen`.
## Generated Bindings
### UniswapV2
- **Router** (`uniswap_v2/router.go`): UniswapV2Router02 interface
- `SwapExactTokensForTokens()`
- `SwapTokensForExactTokens()`
- `SwapExactETHForTokens()`
- `SwapETHForExactTokens()`
- `SwapExactTokensForETH()`
- `SwapTokensForExactETH()`
- **Pair** (`uniswap_v2/pair.go`): UniswapV2Pair interface
- `Swap()` - Direct pool swap function
- `GetReserves()` - Get pool reserves
- `Token0()`, `Token1()` - Get token addresses
- Swap event for parsing logs
### UniswapV3
- **Router** (`uniswap_v3/router.go`): SwapRouter interface
- `ExactInputSingle()` - Single-hop exact input swap
- `ExactInput()` - Multi-hop exact input swap
- `ExactOutputSingle()` - Single-hop exact output swap
- `ExactOutput()` - Multi-hop exact output swap
## Usage
### Detecting Swaps Using ABIs
Instead of hardcoding function selectors, use the generated bindings to parse transaction data:
```go
import (
"github.com/ethereum/go-ethereum/accounts/abi"
"github.com/your-org/mev-bot/bindings/uniswap_v2"
)
// Parse UniswapV2 router ABI
routerABI, err := abi.JSON(strings.NewReader(uniswap_v2.UniswapV2RouterABI))
if err != nil {
log.Fatal(err)
}
// Detect swap function from calldata
method, err := routerABI.MethodById(txData[:4])
if err != nil {
// Not a known method
return
}
// Check if it's a swap function
isSwap := strings.Contains(method.Name, "swap") ||
strings.Contains(method.Name, "Swap")
// Decode swap parameters
if isSwap {
params, err := method.Inputs.Unpack(txData[4:])
if err != nil {
return err
}
// Access typed parameters
// For swapExactTokensForTokens: amountIn, amountOutMin, path, to, deadline
amountIn := params[0].(*big.Int)
path := params[2].([]common.Address)
// ... etc
}
```
### Parsing Swap Events
```go
import (
"github.com/ethereum/go-ethereum/accounts/abi"
"github.com/your-org/mev-bot/bindings/uniswap_v2"
)
// Parse swap event from logs
pairABI, _ := abi.JSON(strings.NewReader(uniswap_v2.UniswapV2PairABI))
for _, log := range receipt.Logs {
event, err := pairABI.EventByID(log.Topics[0])
if err != nil {
continue
}
if event.Name == "Swap" {
// Decode swap event
var swapEvent struct {
Sender common.Address
Amount0In *big.Int
Amount1In *big.Int
Amount0Out *big.Int
Amount1Out *big.Int
To common.Address
}
err = pairABI.UnpackIntoInterface(&swapEvent, "Swap", log.Data)
if err == nil {
// Process swap event
fmt.Printf("Swap: %s -> %s\n", swapEvent.Amount0In, swapEvent.Amount1Out)
}
}
}
```
## Adding New Bindings
### 1. Create ABI File
Save the contract ABI in JSON format to the appropriate subdirectory:
```bash
mkdir -p bindings/camelot
# Create bindings/camelot/ICamelotRouter.json
```
### 2. Generate Binding
Run `abigen` to generate Go code:
```bash
podman exec mev-go-dev sh -c "cd /workspace && \
/go/bin/abigen \
--abi=bindings/camelot/ICamelotRouter.json \
--pkg=camelot \
--type=CamelotRouter \
--out=bindings/camelot/router.go"
```
### 3. Import in Your Code
```go
import "github.com/your-org/mev-bot/bindings/camelot"
// Use the generated ABI
routerABI, _ := abi.JSON(strings.NewReader(camelot.CamelotRouterABI))
```
## ABI Sources
Contract ABIs can be obtained from:
1. **Etherscan/Arbiscan**: Verified contract → Contract → Code → Contract ABI
2. **GitHub Repositories**: Official DEX repositories
3. **npm Packages**: `@uniswap/v2-periphery`, `@uniswap/v3-periphery`, etc.
## Regenerating All Bindings
To regenerate all bindings after updating ABIs:
```bash
./scripts/generate-bindings.sh
```
Or manually:
```bash
podman exec mev-go-dev sh -c "cd /workspace && \
/go/bin/abigen --abi=bindings/uniswap_v2/IUniswapV2Router02.json \
--pkg=uniswap_v2 \
--type=UniswapV2Router \
--out=bindings/uniswap_v2/router.go && \
/go/bin/abigen --abi=bindings/uniswap_v2/IUniswapV2Pair.json \
--pkg=uniswap_v2 \
--type=UniswapV2Pair \
--out=bindings/uniswap_v2/pair.go && \
/go/bin/abigen --abi=bindings/uniswap_v3/ISwapRouter.json \
--pkg=uniswap_v3 \
--type=SwapRouter \
--out=bindings/uniswap_v3/router.go"
```
## Benefits of Using Bindings
1. **Type Safety**: Compile-time verification of parameters
2. **No Hardcoded Selectors**: Function signatures derived from ABIs
3. **Automatic Encoding/Decoding**: Built-in parameter packing/unpacking
4. **Event Parsing**: Type-safe event decoding
5. **Maintainability**: Single source of truth (ABI files)
## Next Steps
To fully integrate ABI-based swap detection:
1. Replace hardcoded selectors in `pkg/sequencer/decoder.go` with ABI lookups
2. Use `MethodById()` to identify swap functions dynamically
3. Parse swap parameters using typed binding structs
4. Add bindings for Balancer, Curve, Kyber, Camelot
5. Implement event-based swap detection for pools

View File

@@ -0,0 +1,52 @@
[
{
"inputs": [
{"internalType": "uint256", "name": "amount0Out", "type": "uint256"},
{"internalType": "uint256", "name": "amount1Out", "type": "uint256"},
{"internalType": "address", "name": "to", "type": "address"},
{"internalType": "bytes", "name": "data", "type": "bytes"}
],
"name": "swap",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"anonymous": false,
"inputs": [
{"indexed": true, "internalType": "address", "name": "sender", "type": "address"},
{"indexed": false, "internalType": "uint256", "name": "amount0In", "type": "uint256"},
{"indexed": false, "internalType": "uint256", "name": "amount1In", "type": "uint256"},
{"indexed": false, "internalType": "uint256", "name": "amount0Out", "type": "uint256"},
{"indexed": false, "internalType": "uint256", "name": "amount1Out", "type": "uint256"},
{"indexed": true, "internalType": "address", "name": "to", "type": "address"}
],
"name": "Swap",
"type": "event"
},
{
"inputs": [],
"name": "token0",
"outputs": [{"internalType": "address", "name": "", "type": "address"}],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "token1",
"outputs": [{"internalType": "address", "name": "", "type": "address"}],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "getReserves",
"outputs": [
{"internalType": "uint112", "name": "reserve0", "type": "uint112"},
{"internalType": "uint112", "name": "reserve1", "type": "uint112"},
{"internalType": "uint32", "name": "blockTimestampLast", "type": "uint32"}
],
"stateMutability": "view",
"type": "function"
}
]

View File

@@ -0,0 +1,90 @@
[
{
"inputs": [
{"internalType": "uint256", "name": "amountIn", "type": "uint256"},
{"internalType": "uint256", "name": "amountOutMin", "type": "uint256"},
{"internalType": "address[]", "name": "path", "type": "address[]"},
{"internalType": "address", "name": "to", "type": "address"},
{"internalType": "uint256", "name": "deadline", "type": "uint256"}
],
"name": "swapExactTokensForTokens",
"outputs": [
{"internalType": "uint256[]", "name": "amounts", "type": "uint256[]"}
],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{"internalType": "uint256", "name": "amountOut", "type": "uint256"},
{"internalType": "uint256", "name": "amountInMax", "type": "uint256"},
{"internalType": "address[]", "name": "path", "type": "address[]"},
{"internalType": "address", "name": "to", "type": "address"},
{"internalType": "uint256", "name": "deadline", "type": "uint256"}
],
"name": "swapTokensForExactTokens",
"outputs": [
{"internalType": "uint256[]", "name": "amounts", "type": "uint256[]"}
],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{"internalType": "uint256", "name": "amountOutMin", "type": "uint256"},
{"internalType": "address[]", "name": "path", "type": "address[]"},
{"internalType": "address", "name": "to", "type": "address"},
{"internalType": "uint256", "name": "deadline", "type": "uint256"}
],
"name": "swapExactETHForTokens",
"outputs": [
{"internalType": "uint256[]", "name": "amounts", "type": "uint256[]"}
],
"stateMutability": "payable",
"type": "function"
},
{
"inputs": [
{"internalType": "uint256", "name": "amountOut", "type": "uint256"},
{"internalType": "address[]", "name": "path", "type": "address[]"},
{"internalType": "address", "name": "to", "type": "address"},
{"internalType": "uint256", "name": "deadline", "type": "uint256"}
],
"name": "swapETHForExactTokens",
"outputs": [
{"internalType": "uint256[]", "name": "amounts", "type": "uint256[]"}
],
"stateMutability": "payable",
"type": "function"
},
{
"inputs": [
{"internalType": "uint256", "name": "amountIn", "type": "uint256"},
{"internalType": "uint256", "name": "amountOutMin", "type": "uint256"},
{"internalType": "address[]", "name": "path", "type": "address[]"},
{"internalType": "address", "name": "to", "type": "address"},
{"internalType": "uint256", "name": "deadline", "type": "uint256"}
],
"name": "swapExactTokensForETH",
"outputs": [
{"internalType": "uint256[]", "name": "amounts", "type": "uint256[]"}
],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{"internalType": "uint256", "name": "amountOut", "type": "uint256"},
{"internalType": "uint256", "name": "amountInMax", "type": "uint256"},
{"internalType": "address[]", "name": "path", "type": "address[]"},
{"internalType": "address", "name": "to", "type": "address"},
{"internalType": "uint256", "name": "deadline", "type": "uint256"}
],
"name": "swapTokensForExactETH",
"outputs": [
{"internalType": "uint256[]", "name": "amounts", "type": "uint256[]"}
],
"stateMutability": "nonpayable",
"type": "function"
}
]

473
bindings/uniswap_v2/pair.go Normal file
View File

@@ -0,0 +1,473 @@
// Code generated - DO NOT EDIT.
// This file is a generated binding and any manual changes will be lost.
package uniswap_v2
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
)
// UniswapV2PairMetaData contains all meta data concerning the UniswapV2Pair contract.
var UniswapV2PairMetaData = &bind.MetaData{
ABI: "[{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"amount0Out\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"amount1Out\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"swap\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount0In\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount1In\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount0Out\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount1Out\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"}],\"name\":\"Swap\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"token0\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"token1\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getReserves\",\"outputs\":[{\"internalType\":\"uint112\",\"name\":\"reserve0\",\"type\":\"uint112\"},{\"internalType\":\"uint112\",\"name\":\"reserve1\",\"type\":\"uint112\"},{\"internalType\":\"uint32\",\"name\":\"blockTimestampLast\",\"type\":\"uint32\"}],\"stateMutability\":\"view\",\"type\":\"function\"}]",
}
// UniswapV2PairABI is the input ABI used to generate the binding from.
// Deprecated: Use UniswapV2PairMetaData.ABI instead.
var UniswapV2PairABI = UniswapV2PairMetaData.ABI
// UniswapV2Pair is an auto generated Go binding around an Ethereum contract.
type UniswapV2Pair struct {
UniswapV2PairCaller // Read-only binding to the contract
UniswapV2PairTransactor // Write-only binding to the contract
UniswapV2PairFilterer // Log filterer for contract events
}
// UniswapV2PairCaller is an auto generated read-only Go binding around an Ethereum contract.
type UniswapV2PairCaller struct {
contract *bind.BoundContract // Generic contract wrapper for the low level calls
}
// UniswapV2PairTransactor is an auto generated write-only Go binding around an Ethereum contract.
type UniswapV2PairTransactor struct {
contract *bind.BoundContract // Generic contract wrapper for the low level calls
}
// UniswapV2PairFilterer is an auto generated log filtering Go binding around an Ethereum contract events.
type UniswapV2PairFilterer struct {
contract *bind.BoundContract // Generic contract wrapper for the low level calls
}
// UniswapV2PairSession is an auto generated Go binding around an Ethereum contract,
// with pre-set call and transact options.
type UniswapV2PairSession struct {
Contract *UniswapV2Pair // 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
}
// UniswapV2PairCallerSession is an auto generated read-only Go binding around an Ethereum contract,
// with pre-set call options.
type UniswapV2PairCallerSession struct {
Contract *UniswapV2PairCaller // Generic contract caller binding to set the session for
CallOpts bind.CallOpts // Call options to use throughout this session
}
// UniswapV2PairTransactorSession is an auto generated write-only Go binding around an Ethereum contract,
// with pre-set transact options.
type UniswapV2PairTransactorSession struct {
Contract *UniswapV2PairTransactor // Generic contract transactor binding to set the session for
TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session
}
// UniswapV2PairRaw is an auto generated low-level Go binding around an Ethereum contract.
type UniswapV2PairRaw struct {
Contract *UniswapV2Pair // Generic contract binding to access the raw methods on
}
// UniswapV2PairCallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract.
type UniswapV2PairCallerRaw struct {
Contract *UniswapV2PairCaller // Generic read-only contract binding to access the raw methods on
}
// UniswapV2PairTransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract.
type UniswapV2PairTransactorRaw struct {
Contract *UniswapV2PairTransactor // Generic write-only contract binding to access the raw methods on
}
// NewUniswapV2Pair creates a new instance of UniswapV2Pair, bound to a specific deployed contract.
func NewUniswapV2Pair(address common.Address, backend bind.ContractBackend) (*UniswapV2Pair, error) {
contract, err := bindUniswapV2Pair(address, backend, backend, backend)
if err != nil {
return nil, err
}
return &UniswapV2Pair{UniswapV2PairCaller: UniswapV2PairCaller{contract: contract}, UniswapV2PairTransactor: UniswapV2PairTransactor{contract: contract}, UniswapV2PairFilterer: UniswapV2PairFilterer{contract: contract}}, nil
}
// NewUniswapV2PairCaller creates a new read-only instance of UniswapV2Pair, bound to a specific deployed contract.
func NewUniswapV2PairCaller(address common.Address, caller bind.ContractCaller) (*UniswapV2PairCaller, error) {
contract, err := bindUniswapV2Pair(address, caller, nil, nil)
if err != nil {
return nil, err
}
return &UniswapV2PairCaller{contract: contract}, nil
}
// NewUniswapV2PairTransactor creates a new write-only instance of UniswapV2Pair, bound to a specific deployed contract.
func NewUniswapV2PairTransactor(address common.Address, transactor bind.ContractTransactor) (*UniswapV2PairTransactor, error) {
contract, err := bindUniswapV2Pair(address, nil, transactor, nil)
if err != nil {
return nil, err
}
return &UniswapV2PairTransactor{contract: contract}, nil
}
// NewUniswapV2PairFilterer creates a new log filterer instance of UniswapV2Pair, bound to a specific deployed contract.
func NewUniswapV2PairFilterer(address common.Address, filterer bind.ContractFilterer) (*UniswapV2PairFilterer, error) {
contract, err := bindUniswapV2Pair(address, nil, nil, filterer)
if err != nil {
return nil, err
}
return &UniswapV2PairFilterer{contract: contract}, nil
}
// bindUniswapV2Pair binds a generic wrapper to an already deployed contract.
func bindUniswapV2Pair(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) {
parsed, err := UniswapV2PairMetaData.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 (_UniswapV2Pair *UniswapV2PairRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error {
return _UniswapV2Pair.Contract.UniswapV2PairCaller.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 (_UniswapV2Pair *UniswapV2PairRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {
return _UniswapV2Pair.Contract.UniswapV2PairTransactor.contract.Transfer(opts)
}
// Transact invokes the (paid) contract method with params as input values.
func (_UniswapV2Pair *UniswapV2PairRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) {
return _UniswapV2Pair.Contract.UniswapV2PairTransactor.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 (_UniswapV2Pair *UniswapV2PairCallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error {
return _UniswapV2Pair.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 (_UniswapV2Pair *UniswapV2PairTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {
return _UniswapV2Pair.Contract.contract.Transfer(opts)
}
// Transact invokes the (paid) contract method with params as input values.
func (_UniswapV2Pair *UniswapV2PairTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) {
return _UniswapV2Pair.Contract.contract.Transact(opts, method, params...)
}
// GetReserves is a free data retrieval call binding the contract method 0x0902f1ac.
//
// Solidity: function getReserves() view returns(uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast)
func (_UniswapV2Pair *UniswapV2PairCaller) GetReserves(opts *bind.CallOpts) (struct {
Reserve0 *big.Int
Reserve1 *big.Int
BlockTimestampLast uint32
}, error) {
var out []interface{}
err := _UniswapV2Pair.contract.Call(opts, &out, "getReserves")
outstruct := new(struct {
Reserve0 *big.Int
Reserve1 *big.Int
BlockTimestampLast uint32
})
if err != nil {
return *outstruct, err
}
outstruct.Reserve0 = *abi.ConvertType(out[0], new(*big.Int)).(**big.Int)
outstruct.Reserve1 = *abi.ConvertType(out[1], new(*big.Int)).(**big.Int)
outstruct.BlockTimestampLast = *abi.ConvertType(out[2], new(uint32)).(*uint32)
return *outstruct, err
}
// GetReserves is a free data retrieval call binding the contract method 0x0902f1ac.
//
// Solidity: function getReserves() view returns(uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast)
func (_UniswapV2Pair *UniswapV2PairSession) GetReserves() (struct {
Reserve0 *big.Int
Reserve1 *big.Int
BlockTimestampLast uint32
}, error) {
return _UniswapV2Pair.Contract.GetReserves(&_UniswapV2Pair.CallOpts)
}
// GetReserves is a free data retrieval call binding the contract method 0x0902f1ac.
//
// Solidity: function getReserves() view returns(uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast)
func (_UniswapV2Pair *UniswapV2PairCallerSession) GetReserves() (struct {
Reserve0 *big.Int
Reserve1 *big.Int
BlockTimestampLast uint32
}, error) {
return _UniswapV2Pair.Contract.GetReserves(&_UniswapV2Pair.CallOpts)
}
// Token0 is a free data retrieval call binding the contract method 0x0dfe1681.
//
// Solidity: function token0() view returns(address)
func (_UniswapV2Pair *UniswapV2PairCaller) Token0(opts *bind.CallOpts) (common.Address, error) {
var out []interface{}
err := _UniswapV2Pair.contract.Call(opts, &out, "token0")
if err != nil {
return *new(common.Address), err
}
out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address)
return out0, err
}
// Token0 is a free data retrieval call binding the contract method 0x0dfe1681.
//
// Solidity: function token0() view returns(address)
func (_UniswapV2Pair *UniswapV2PairSession) Token0() (common.Address, error) {
return _UniswapV2Pair.Contract.Token0(&_UniswapV2Pair.CallOpts)
}
// Token0 is a free data retrieval call binding the contract method 0x0dfe1681.
//
// Solidity: function token0() view returns(address)
func (_UniswapV2Pair *UniswapV2PairCallerSession) Token0() (common.Address, error) {
return _UniswapV2Pair.Contract.Token0(&_UniswapV2Pair.CallOpts)
}
// Token1 is a free data retrieval call binding the contract method 0xd21220a7.
//
// Solidity: function token1() view returns(address)
func (_UniswapV2Pair *UniswapV2PairCaller) Token1(opts *bind.CallOpts) (common.Address, error) {
var out []interface{}
err := _UniswapV2Pair.contract.Call(opts, &out, "token1")
if err != nil {
return *new(common.Address), err
}
out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address)
return out0, err
}
// Token1 is a free data retrieval call binding the contract method 0xd21220a7.
//
// Solidity: function token1() view returns(address)
func (_UniswapV2Pair *UniswapV2PairSession) Token1() (common.Address, error) {
return _UniswapV2Pair.Contract.Token1(&_UniswapV2Pair.CallOpts)
}
// Token1 is a free data retrieval call binding the contract method 0xd21220a7.
//
// Solidity: function token1() view returns(address)
func (_UniswapV2Pair *UniswapV2PairCallerSession) Token1() (common.Address, error) {
return _UniswapV2Pair.Contract.Token1(&_UniswapV2Pair.CallOpts)
}
// Swap is a paid mutator transaction binding the contract method 0x022c0d9f.
//
// Solidity: function swap(uint256 amount0Out, uint256 amount1Out, address to, bytes data) returns()
func (_UniswapV2Pair *UniswapV2PairTransactor) Swap(opts *bind.TransactOpts, amount0Out *big.Int, amount1Out *big.Int, to common.Address, data []byte) (*types.Transaction, error) {
return _UniswapV2Pair.contract.Transact(opts, "swap", amount0Out, amount1Out, to, data)
}
// Swap is a paid mutator transaction binding the contract method 0x022c0d9f.
//
// Solidity: function swap(uint256 amount0Out, uint256 amount1Out, address to, bytes data) returns()
func (_UniswapV2Pair *UniswapV2PairSession) Swap(amount0Out *big.Int, amount1Out *big.Int, to common.Address, data []byte) (*types.Transaction, error) {
return _UniswapV2Pair.Contract.Swap(&_UniswapV2Pair.TransactOpts, amount0Out, amount1Out, to, data)
}
// Swap is a paid mutator transaction binding the contract method 0x022c0d9f.
//
// Solidity: function swap(uint256 amount0Out, uint256 amount1Out, address to, bytes data) returns()
func (_UniswapV2Pair *UniswapV2PairTransactorSession) Swap(amount0Out *big.Int, amount1Out *big.Int, to common.Address, data []byte) (*types.Transaction, error) {
return _UniswapV2Pair.Contract.Swap(&_UniswapV2Pair.TransactOpts, amount0Out, amount1Out, to, data)
}
// UniswapV2PairSwapIterator is returned from FilterSwap and is used to iterate over the raw logs and unpacked data for Swap events raised by the UniswapV2Pair contract.
type UniswapV2PairSwapIterator struct {
Event *UniswapV2PairSwap // 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 *UniswapV2PairSwapIterator) 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(UniswapV2PairSwap)
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(UniswapV2PairSwap)
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 *UniswapV2PairSwapIterator) Error() error {
return it.fail
}
// Close terminates the iteration process, releasing any pending underlying
// resources.
func (it *UniswapV2PairSwapIterator) Close() error {
it.sub.Unsubscribe()
return nil
}
// UniswapV2PairSwap represents a Swap event raised by the UniswapV2Pair contract.
type UniswapV2PairSwap struct {
Sender common.Address
Amount0In *big.Int
Amount1In *big.Int
Amount0Out *big.Int
Amount1Out *big.Int
To common.Address
Raw types.Log // Blockchain specific contextual infos
}
// FilterSwap is a free log retrieval operation binding the contract event 0xd78ad95fa46c994b6551d0da85fc275fe613ce37657fb8d5e3d130840159d822.
//
// Solidity: event Swap(address indexed sender, uint256 amount0In, uint256 amount1In, uint256 amount0Out, uint256 amount1Out, address indexed to)
func (_UniswapV2Pair *UniswapV2PairFilterer) FilterSwap(opts *bind.FilterOpts, sender []common.Address, to []common.Address) (*UniswapV2PairSwapIterator, error) {
var senderRule []interface{}
for _, senderItem := range sender {
senderRule = append(senderRule, senderItem)
}
var toRule []interface{}
for _, toItem := range to {
toRule = append(toRule, toItem)
}
logs, sub, err := _UniswapV2Pair.contract.FilterLogs(opts, "Swap", senderRule, toRule)
if err != nil {
return nil, err
}
return &UniswapV2PairSwapIterator{contract: _UniswapV2Pair.contract, event: "Swap", logs: logs, sub: sub}, nil
}
// WatchSwap is a free log subscription operation binding the contract event 0xd78ad95fa46c994b6551d0da85fc275fe613ce37657fb8d5e3d130840159d822.
//
// Solidity: event Swap(address indexed sender, uint256 amount0In, uint256 amount1In, uint256 amount0Out, uint256 amount1Out, address indexed to)
func (_UniswapV2Pair *UniswapV2PairFilterer) WatchSwap(opts *bind.WatchOpts, sink chan<- *UniswapV2PairSwap, sender []common.Address, to []common.Address) (event.Subscription, error) {
var senderRule []interface{}
for _, senderItem := range sender {
senderRule = append(senderRule, senderItem)
}
var toRule []interface{}
for _, toItem := range to {
toRule = append(toRule, toItem)
}
logs, sub, err := _UniswapV2Pair.contract.WatchLogs(opts, "Swap", senderRule, toRule)
if err != nil {
return nil, err
}
return event.NewSubscription(func(quit <-chan struct{}) error {
defer sub.Unsubscribe()
for {
select {
case log := <-logs:
// New log arrived, parse the event and forward to the user
event := new(UniswapV2PairSwap)
if err := _UniswapV2Pair.contract.UnpackLog(event, "Swap", 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
}
// ParseSwap is a log parse operation binding the contract event 0xd78ad95fa46c994b6551d0da85fc275fe613ce37657fb8d5e3d130840159d822.
//
// Solidity: event Swap(address indexed sender, uint256 amount0In, uint256 amount1In, uint256 amount0Out, uint256 amount1Out, address indexed to)
func (_UniswapV2Pair *UniswapV2PairFilterer) ParseSwap(log types.Log) (*UniswapV2PairSwap, error) {
event := new(UniswapV2PairSwap)
if err := _UniswapV2Pair.contract.UnpackLog(event, "Swap", log); err != nil {
return nil, err
}
event.Raw = log
return event, nil
}

View File

@@ -0,0 +1,307 @@
// Code generated - DO NOT EDIT.
// This file is a generated binding and any manual changes will be lost.
package uniswap_v2
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
)
// UniswapV2RouterMetaData contains all meta data concerning the UniswapV2Router contract.
var UniswapV2RouterMetaData = &bind.MetaData{
ABI: "[{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"amountIn\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"amountOutMin\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"path\",\"type\":\"address[]\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"deadline\",\"type\":\"uint256\"}],\"name\":\"swapExactTokensForTokens\",\"outputs\":[{\"internalType\":\"uint256[]\",\"name\":\"amounts\",\"type\":\"uint256[]\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"amountOut\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"amountInMax\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"path\",\"type\":\"address[]\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"deadline\",\"type\":\"uint256\"}],\"name\":\"swapTokensForExactTokens\",\"outputs\":[{\"internalType\":\"uint256[]\",\"name\":\"amounts\",\"type\":\"uint256[]\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"amountOutMin\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"path\",\"type\":\"address[]\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"deadline\",\"type\":\"uint256\"}],\"name\":\"swapExactETHForTokens\",\"outputs\":[{\"internalType\":\"uint256[]\",\"name\":\"amounts\",\"type\":\"uint256[]\"}],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"amountOut\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"path\",\"type\":\"address[]\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"deadline\",\"type\":\"uint256\"}],\"name\":\"swapETHForExactTokens\",\"outputs\":[{\"internalType\":\"uint256[]\",\"name\":\"amounts\",\"type\":\"uint256[]\"}],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"amountIn\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"amountOutMin\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"path\",\"type\":\"address[]\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"deadline\",\"type\":\"uint256\"}],\"name\":\"swapExactTokensForETH\",\"outputs\":[{\"internalType\":\"uint256[]\",\"name\":\"amounts\",\"type\":\"uint256[]\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"amountOut\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"amountInMax\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"path\",\"type\":\"address[]\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"deadline\",\"type\":\"uint256\"}],\"name\":\"swapTokensForExactETH\",\"outputs\":[{\"internalType\":\"uint256[]\",\"name\":\"amounts\",\"type\":\"uint256[]\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]",
}
// UniswapV2RouterABI is the input ABI used to generate the binding from.
// Deprecated: Use UniswapV2RouterMetaData.ABI instead.
var UniswapV2RouterABI = UniswapV2RouterMetaData.ABI
// UniswapV2Router is an auto generated Go binding around an Ethereum contract.
type UniswapV2Router struct {
UniswapV2RouterCaller // Read-only binding to the contract
UniswapV2RouterTransactor // Write-only binding to the contract
UniswapV2RouterFilterer // Log filterer for contract events
}
// UniswapV2RouterCaller is an auto generated read-only Go binding around an Ethereum contract.
type UniswapV2RouterCaller struct {
contract *bind.BoundContract // Generic contract wrapper for the low level calls
}
// UniswapV2RouterTransactor is an auto generated write-only Go binding around an Ethereum contract.
type UniswapV2RouterTransactor struct {
contract *bind.BoundContract // Generic contract wrapper for the low level calls
}
// UniswapV2RouterFilterer is an auto generated log filtering Go binding around an Ethereum contract events.
type UniswapV2RouterFilterer struct {
contract *bind.BoundContract // Generic contract wrapper for the low level calls
}
// UniswapV2RouterSession is an auto generated Go binding around an Ethereum contract,
// with pre-set call and transact options.
type UniswapV2RouterSession struct {
Contract *UniswapV2Router // 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
}
// UniswapV2RouterCallerSession is an auto generated read-only Go binding around an Ethereum contract,
// with pre-set call options.
type UniswapV2RouterCallerSession struct {
Contract *UniswapV2RouterCaller // Generic contract caller binding to set the session for
CallOpts bind.CallOpts // Call options to use throughout this session
}
// UniswapV2RouterTransactorSession is an auto generated write-only Go binding around an Ethereum contract,
// with pre-set transact options.
type UniswapV2RouterTransactorSession struct {
Contract *UniswapV2RouterTransactor // Generic contract transactor binding to set the session for
TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session
}
// UniswapV2RouterRaw is an auto generated low-level Go binding around an Ethereum contract.
type UniswapV2RouterRaw struct {
Contract *UniswapV2Router // Generic contract binding to access the raw methods on
}
// UniswapV2RouterCallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract.
type UniswapV2RouterCallerRaw struct {
Contract *UniswapV2RouterCaller // Generic read-only contract binding to access the raw methods on
}
// UniswapV2RouterTransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract.
type UniswapV2RouterTransactorRaw struct {
Contract *UniswapV2RouterTransactor // Generic write-only contract binding to access the raw methods on
}
// NewUniswapV2Router creates a new instance of UniswapV2Router, bound to a specific deployed contract.
func NewUniswapV2Router(address common.Address, backend bind.ContractBackend) (*UniswapV2Router, error) {
contract, err := bindUniswapV2Router(address, backend, backend, backend)
if err != nil {
return nil, err
}
return &UniswapV2Router{UniswapV2RouterCaller: UniswapV2RouterCaller{contract: contract}, UniswapV2RouterTransactor: UniswapV2RouterTransactor{contract: contract}, UniswapV2RouterFilterer: UniswapV2RouterFilterer{contract: contract}}, nil
}
// NewUniswapV2RouterCaller creates a new read-only instance of UniswapV2Router, bound to a specific deployed contract.
func NewUniswapV2RouterCaller(address common.Address, caller bind.ContractCaller) (*UniswapV2RouterCaller, error) {
contract, err := bindUniswapV2Router(address, caller, nil, nil)
if err != nil {
return nil, err
}
return &UniswapV2RouterCaller{contract: contract}, nil
}
// NewUniswapV2RouterTransactor creates a new write-only instance of UniswapV2Router, bound to a specific deployed contract.
func NewUniswapV2RouterTransactor(address common.Address, transactor bind.ContractTransactor) (*UniswapV2RouterTransactor, error) {
contract, err := bindUniswapV2Router(address, nil, transactor, nil)
if err != nil {
return nil, err
}
return &UniswapV2RouterTransactor{contract: contract}, nil
}
// NewUniswapV2RouterFilterer creates a new log filterer instance of UniswapV2Router, bound to a specific deployed contract.
func NewUniswapV2RouterFilterer(address common.Address, filterer bind.ContractFilterer) (*UniswapV2RouterFilterer, error) {
contract, err := bindUniswapV2Router(address, nil, nil, filterer)
if err != nil {
return nil, err
}
return &UniswapV2RouterFilterer{contract: contract}, nil
}
// bindUniswapV2Router binds a generic wrapper to an already deployed contract.
func bindUniswapV2Router(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) {
parsed, err := UniswapV2RouterMetaData.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 (_UniswapV2Router *UniswapV2RouterRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error {
return _UniswapV2Router.Contract.UniswapV2RouterCaller.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 (_UniswapV2Router *UniswapV2RouterRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {
return _UniswapV2Router.Contract.UniswapV2RouterTransactor.contract.Transfer(opts)
}
// Transact invokes the (paid) contract method with params as input values.
func (_UniswapV2Router *UniswapV2RouterRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) {
return _UniswapV2Router.Contract.UniswapV2RouterTransactor.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 (_UniswapV2Router *UniswapV2RouterCallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error {
return _UniswapV2Router.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 (_UniswapV2Router *UniswapV2RouterTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {
return _UniswapV2Router.Contract.contract.Transfer(opts)
}
// Transact invokes the (paid) contract method with params as input values.
func (_UniswapV2Router *UniswapV2RouterTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) {
return _UniswapV2Router.Contract.contract.Transact(opts, method, params...)
}
// SwapETHForExactTokens is a paid mutator transaction binding the contract method 0xfb3bdb41.
//
// Solidity: function swapETHForExactTokens(uint256 amountOut, address[] path, address to, uint256 deadline) payable returns(uint256[] amounts)
func (_UniswapV2Router *UniswapV2RouterTransactor) SwapETHForExactTokens(opts *bind.TransactOpts, amountOut *big.Int, path []common.Address, to common.Address, deadline *big.Int) (*types.Transaction, error) {
return _UniswapV2Router.contract.Transact(opts, "swapETHForExactTokens", amountOut, path, to, deadline)
}
// SwapETHForExactTokens is a paid mutator transaction binding the contract method 0xfb3bdb41.
//
// Solidity: function swapETHForExactTokens(uint256 amountOut, address[] path, address to, uint256 deadline) payable returns(uint256[] amounts)
func (_UniswapV2Router *UniswapV2RouterSession) SwapETHForExactTokens(amountOut *big.Int, path []common.Address, to common.Address, deadline *big.Int) (*types.Transaction, error) {
return _UniswapV2Router.Contract.SwapETHForExactTokens(&_UniswapV2Router.TransactOpts, amountOut, path, to, deadline)
}
// SwapETHForExactTokens is a paid mutator transaction binding the contract method 0xfb3bdb41.
//
// Solidity: function swapETHForExactTokens(uint256 amountOut, address[] path, address to, uint256 deadline) payable returns(uint256[] amounts)
func (_UniswapV2Router *UniswapV2RouterTransactorSession) SwapETHForExactTokens(amountOut *big.Int, path []common.Address, to common.Address, deadline *big.Int) (*types.Transaction, error) {
return _UniswapV2Router.Contract.SwapETHForExactTokens(&_UniswapV2Router.TransactOpts, amountOut, path, to, deadline)
}
// SwapExactETHForTokens is a paid mutator transaction binding the contract method 0x7ff36ab5.
//
// Solidity: function swapExactETHForTokens(uint256 amountOutMin, address[] path, address to, uint256 deadline) payable returns(uint256[] amounts)
func (_UniswapV2Router *UniswapV2RouterTransactor) SwapExactETHForTokens(opts *bind.TransactOpts, amountOutMin *big.Int, path []common.Address, to common.Address, deadline *big.Int) (*types.Transaction, error) {
return _UniswapV2Router.contract.Transact(opts, "swapExactETHForTokens", amountOutMin, path, to, deadline)
}
// SwapExactETHForTokens is a paid mutator transaction binding the contract method 0x7ff36ab5.
//
// Solidity: function swapExactETHForTokens(uint256 amountOutMin, address[] path, address to, uint256 deadline) payable returns(uint256[] amounts)
func (_UniswapV2Router *UniswapV2RouterSession) SwapExactETHForTokens(amountOutMin *big.Int, path []common.Address, to common.Address, deadline *big.Int) (*types.Transaction, error) {
return _UniswapV2Router.Contract.SwapExactETHForTokens(&_UniswapV2Router.TransactOpts, amountOutMin, path, to, deadline)
}
// SwapExactETHForTokens is a paid mutator transaction binding the contract method 0x7ff36ab5.
//
// Solidity: function swapExactETHForTokens(uint256 amountOutMin, address[] path, address to, uint256 deadline) payable returns(uint256[] amounts)
func (_UniswapV2Router *UniswapV2RouterTransactorSession) SwapExactETHForTokens(amountOutMin *big.Int, path []common.Address, to common.Address, deadline *big.Int) (*types.Transaction, error) {
return _UniswapV2Router.Contract.SwapExactETHForTokens(&_UniswapV2Router.TransactOpts, amountOutMin, path, to, deadline)
}
// SwapExactTokensForETH is a paid mutator transaction binding the contract method 0x18cbafe5.
//
// Solidity: function swapExactTokensForETH(uint256 amountIn, uint256 amountOutMin, address[] path, address to, uint256 deadline) returns(uint256[] amounts)
func (_UniswapV2Router *UniswapV2RouterTransactor) SwapExactTokensForETH(opts *bind.TransactOpts, amountIn *big.Int, amountOutMin *big.Int, path []common.Address, to common.Address, deadline *big.Int) (*types.Transaction, error) {
return _UniswapV2Router.contract.Transact(opts, "swapExactTokensForETH", amountIn, amountOutMin, path, to, deadline)
}
// SwapExactTokensForETH is a paid mutator transaction binding the contract method 0x18cbafe5.
//
// Solidity: function swapExactTokensForETH(uint256 amountIn, uint256 amountOutMin, address[] path, address to, uint256 deadline) returns(uint256[] amounts)
func (_UniswapV2Router *UniswapV2RouterSession) SwapExactTokensForETH(amountIn *big.Int, amountOutMin *big.Int, path []common.Address, to common.Address, deadline *big.Int) (*types.Transaction, error) {
return _UniswapV2Router.Contract.SwapExactTokensForETH(&_UniswapV2Router.TransactOpts, amountIn, amountOutMin, path, to, deadline)
}
// SwapExactTokensForETH is a paid mutator transaction binding the contract method 0x18cbafe5.
//
// Solidity: function swapExactTokensForETH(uint256 amountIn, uint256 amountOutMin, address[] path, address to, uint256 deadline) returns(uint256[] amounts)
func (_UniswapV2Router *UniswapV2RouterTransactorSession) SwapExactTokensForETH(amountIn *big.Int, amountOutMin *big.Int, path []common.Address, to common.Address, deadline *big.Int) (*types.Transaction, error) {
return _UniswapV2Router.Contract.SwapExactTokensForETH(&_UniswapV2Router.TransactOpts, amountIn, amountOutMin, path, to, deadline)
}
// SwapExactTokensForTokens is a paid mutator transaction binding the contract method 0x38ed1739.
//
// Solidity: function swapExactTokensForTokens(uint256 amountIn, uint256 amountOutMin, address[] path, address to, uint256 deadline) returns(uint256[] amounts)
func (_UniswapV2Router *UniswapV2RouterTransactor) SwapExactTokensForTokens(opts *bind.TransactOpts, amountIn *big.Int, amountOutMin *big.Int, path []common.Address, to common.Address, deadline *big.Int) (*types.Transaction, error) {
return _UniswapV2Router.contract.Transact(opts, "swapExactTokensForTokens", amountIn, amountOutMin, path, to, deadline)
}
// SwapExactTokensForTokens is a paid mutator transaction binding the contract method 0x38ed1739.
//
// Solidity: function swapExactTokensForTokens(uint256 amountIn, uint256 amountOutMin, address[] path, address to, uint256 deadline) returns(uint256[] amounts)
func (_UniswapV2Router *UniswapV2RouterSession) SwapExactTokensForTokens(amountIn *big.Int, amountOutMin *big.Int, path []common.Address, to common.Address, deadline *big.Int) (*types.Transaction, error) {
return _UniswapV2Router.Contract.SwapExactTokensForTokens(&_UniswapV2Router.TransactOpts, amountIn, amountOutMin, path, to, deadline)
}
// SwapExactTokensForTokens is a paid mutator transaction binding the contract method 0x38ed1739.
//
// Solidity: function swapExactTokensForTokens(uint256 amountIn, uint256 amountOutMin, address[] path, address to, uint256 deadline) returns(uint256[] amounts)
func (_UniswapV2Router *UniswapV2RouterTransactorSession) SwapExactTokensForTokens(amountIn *big.Int, amountOutMin *big.Int, path []common.Address, to common.Address, deadline *big.Int) (*types.Transaction, error) {
return _UniswapV2Router.Contract.SwapExactTokensForTokens(&_UniswapV2Router.TransactOpts, amountIn, amountOutMin, path, to, deadline)
}
// SwapTokensForExactETH is a paid mutator transaction binding the contract method 0x4a25d94a.
//
// Solidity: function swapTokensForExactETH(uint256 amountOut, uint256 amountInMax, address[] path, address to, uint256 deadline) returns(uint256[] amounts)
func (_UniswapV2Router *UniswapV2RouterTransactor) SwapTokensForExactETH(opts *bind.TransactOpts, amountOut *big.Int, amountInMax *big.Int, path []common.Address, to common.Address, deadline *big.Int) (*types.Transaction, error) {
return _UniswapV2Router.contract.Transact(opts, "swapTokensForExactETH", amountOut, amountInMax, path, to, deadline)
}
// SwapTokensForExactETH is a paid mutator transaction binding the contract method 0x4a25d94a.
//
// Solidity: function swapTokensForExactETH(uint256 amountOut, uint256 amountInMax, address[] path, address to, uint256 deadline) returns(uint256[] amounts)
func (_UniswapV2Router *UniswapV2RouterSession) SwapTokensForExactETH(amountOut *big.Int, amountInMax *big.Int, path []common.Address, to common.Address, deadline *big.Int) (*types.Transaction, error) {
return _UniswapV2Router.Contract.SwapTokensForExactETH(&_UniswapV2Router.TransactOpts, amountOut, amountInMax, path, to, deadline)
}
// SwapTokensForExactETH is a paid mutator transaction binding the contract method 0x4a25d94a.
//
// Solidity: function swapTokensForExactETH(uint256 amountOut, uint256 amountInMax, address[] path, address to, uint256 deadline) returns(uint256[] amounts)
func (_UniswapV2Router *UniswapV2RouterTransactorSession) SwapTokensForExactETH(amountOut *big.Int, amountInMax *big.Int, path []common.Address, to common.Address, deadline *big.Int) (*types.Transaction, error) {
return _UniswapV2Router.Contract.SwapTokensForExactETH(&_UniswapV2Router.TransactOpts, amountOut, amountInMax, path, to, deadline)
}
// SwapTokensForExactTokens is a paid mutator transaction binding the contract method 0x8803dbee.
//
// Solidity: function swapTokensForExactTokens(uint256 amountOut, uint256 amountInMax, address[] path, address to, uint256 deadline) returns(uint256[] amounts)
func (_UniswapV2Router *UniswapV2RouterTransactor) SwapTokensForExactTokens(opts *bind.TransactOpts, amountOut *big.Int, amountInMax *big.Int, path []common.Address, to common.Address, deadline *big.Int) (*types.Transaction, error) {
return _UniswapV2Router.contract.Transact(opts, "swapTokensForExactTokens", amountOut, amountInMax, path, to, deadline)
}
// SwapTokensForExactTokens is a paid mutator transaction binding the contract method 0x8803dbee.
//
// Solidity: function swapTokensForExactTokens(uint256 amountOut, uint256 amountInMax, address[] path, address to, uint256 deadline) returns(uint256[] amounts)
func (_UniswapV2Router *UniswapV2RouterSession) SwapTokensForExactTokens(amountOut *big.Int, amountInMax *big.Int, path []common.Address, to common.Address, deadline *big.Int) (*types.Transaction, error) {
return _UniswapV2Router.Contract.SwapTokensForExactTokens(&_UniswapV2Router.TransactOpts, amountOut, amountInMax, path, to, deadline)
}
// SwapTokensForExactTokens is a paid mutator transaction binding the contract method 0x8803dbee.
//
// Solidity: function swapTokensForExactTokens(uint256 amountOut, uint256 amountInMax, address[] path, address to, uint256 deadline) returns(uint256[] amounts)
func (_UniswapV2Router *UniswapV2RouterTransactorSession) SwapTokensForExactTokens(amountOut *big.Int, amountInMax *big.Int, path []common.Address, to common.Address, deadline *big.Int) (*types.Transaction, error) {
return _UniswapV2Router.Contract.SwapTokensForExactTokens(&_UniswapV2Router.TransactOpts, amountOut, amountInMax, path, to, deadline)
}

View File

@@ -0,0 +1,88 @@
[
{
"inputs": [
{
"components": [
{"internalType": "address", "name": "tokenIn", "type": "address"},
{"internalType": "address", "name": "tokenOut", "type": "address"},
{"internalType": "uint24", "name": "fee", "type": "uint24"},
{"internalType": "address", "name": "recipient", "type": "address"},
{"internalType": "uint256", "name": "deadline", "type": "uint256"},
{"internalType": "uint256", "name": "amountIn", "type": "uint256"},
{"internalType": "uint256", "name": "amountOutMinimum", "type": "uint256"},
{"internalType": "uint160", "name": "sqrtPriceLimitX96", "type": "uint160"}
],
"internalType": "struct ISwapRouter.ExactInputSingleParams",
"name": "params",
"type": "tuple"
}
],
"name": "exactInputSingle",
"outputs": [{"internalType": "uint256", "name": "amountOut", "type": "uint256"}],
"stateMutability": "payable",
"type": "function"
},
{
"inputs": [
{
"components": [
{"internalType": "bytes", "name": "path", "type": "bytes"},
{"internalType": "address", "name": "recipient", "type": "address"},
{"internalType": "uint256", "name": "deadline", "type": "uint256"},
{"internalType": "uint256", "name": "amountIn", "type": "uint256"},
{"internalType": "uint256", "name": "amountOutMinimum", "type": "uint256"}
],
"internalType": "struct ISwapRouter.ExactInputParams",
"name": "params",
"type": "tuple"
}
],
"name": "exactInput",
"outputs": [{"internalType": "uint256", "name": "amountOut", "type": "uint256"}],
"stateMutability": "payable",
"type": "function"
},
{
"inputs": [
{
"components": [
{"internalType": "address", "name": "tokenIn", "type": "address"},
{"internalType": "address", "name": "tokenOut", "type": "address"},
{"internalType": "uint24", "name": "fee", "type": "uint24"},
{"internalType": "address", "name": "recipient", "type": "address"},
{"internalType": "uint256", "name": "deadline", "type": "uint256"},
{"internalType": "uint256", "name": "amountOut", "type": "uint256"},
{"internalType": "uint256", "name": "amountInMaximum", "type": "uint256"},
{"internalType": "uint160", "name": "sqrtPriceLimitX96", "type": "uint160"}
],
"internalType": "struct ISwapRouter.ExactOutputSingleParams",
"name": "params",
"type": "tuple"
}
],
"name": "exactOutputSingle",
"outputs": [{"internalType": "uint256", "name": "amountIn", "type": "uint256"}],
"stateMutability": "payable",
"type": "function"
},
{
"inputs": [
{
"components": [
{"internalType": "bytes", "name": "path", "type": "bytes"},
{"internalType": "address", "name": "recipient", "type": "address"},
{"internalType": "uint256", "name": "deadline", "type": "uint256"},
{"internalType": "uint256", "name": "amountOut", "type": "uint256"},
{"internalType": "uint256", "name": "amountInMaximum", "type": "uint256"}
],
"internalType": "struct ISwapRouter.ExactOutputParams",
"name": "params",
"type": "tuple"
}
],
"name": "exactOutput",
"outputs": [{"internalType": "uint256", "name": "amountIn", "type": "uint256"}],
"stateMutability": "payable",
"type": "function"
}
]

View File

View File

@@ -0,0 +1,307 @@
// Code generated - DO NOT EDIT.
// This file is a generated binding and any manual changes will be lost.
package uniswap_v3
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
)
// ISwapRouterExactInputParams is an auto generated low-level Go binding around an user-defined struct.
type ISwapRouterExactInputParams struct {
Path []byte
Recipient common.Address
Deadline *big.Int
AmountIn *big.Int
AmountOutMinimum *big.Int
}
// ISwapRouterExactInputSingleParams is an auto generated low-level Go binding around an user-defined struct.
type ISwapRouterExactInputSingleParams struct {
TokenIn common.Address
TokenOut common.Address
Fee *big.Int
Recipient common.Address
Deadline *big.Int
AmountIn *big.Int
AmountOutMinimum *big.Int
SqrtPriceLimitX96 *big.Int
}
// ISwapRouterExactOutputParams is an auto generated low-level Go binding around an user-defined struct.
type ISwapRouterExactOutputParams struct {
Path []byte
Recipient common.Address
Deadline *big.Int
AmountOut *big.Int
AmountInMaximum *big.Int
}
// ISwapRouterExactOutputSingleParams is an auto generated low-level Go binding around an user-defined struct.
type ISwapRouterExactOutputSingleParams struct {
TokenIn common.Address
TokenOut common.Address
Fee *big.Int
Recipient common.Address
Deadline *big.Int
AmountOut *big.Int
AmountInMaximum *big.Int
SqrtPriceLimitX96 *big.Int
}
// SwapRouterMetaData contains all meta data concerning the SwapRouter contract.
var SwapRouterMetaData = &bind.MetaData{
ABI: "[{\"inputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"tokenIn\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"tokenOut\",\"type\":\"address\"},{\"internalType\":\"uint24\",\"name\":\"fee\",\"type\":\"uint24\"},{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"deadline\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"amountIn\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"amountOutMinimum\",\"type\":\"uint256\"},{\"internalType\":\"uint160\",\"name\":\"sqrtPriceLimitX96\",\"type\":\"uint160\"}],\"internalType\":\"structISwapRouter.ExactInputSingleParams\",\"name\":\"params\",\"type\":\"tuple\"}],\"name\":\"exactInputSingle\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"amountOut\",\"type\":\"uint256\"}],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"bytes\",\"name\":\"path\",\"type\":\"bytes\"},{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"deadline\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"amountIn\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"amountOutMinimum\",\"type\":\"uint256\"}],\"internalType\":\"structISwapRouter.ExactInputParams\",\"name\":\"params\",\"type\":\"tuple\"}],\"name\":\"exactInput\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"amountOut\",\"type\":\"uint256\"}],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"tokenIn\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"tokenOut\",\"type\":\"address\"},{\"internalType\":\"uint24\",\"name\":\"fee\",\"type\":\"uint24\"},{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"deadline\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"amountOut\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"amountInMaximum\",\"type\":\"uint256\"},{\"internalType\":\"uint160\",\"name\":\"sqrtPriceLimitX96\",\"type\":\"uint160\"}],\"internalType\":\"structISwapRouter.ExactOutputSingleParams\",\"name\":\"params\",\"type\":\"tuple\"}],\"name\":\"exactOutputSingle\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"amountIn\",\"type\":\"uint256\"}],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"bytes\",\"name\":\"path\",\"type\":\"bytes\"},{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"deadline\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"amountOut\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"amountInMaximum\",\"type\":\"uint256\"}],\"internalType\":\"structISwapRouter.ExactOutputParams\",\"name\":\"params\",\"type\":\"tuple\"}],\"name\":\"exactOutput\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"amountIn\",\"type\":\"uint256\"}],\"stateMutability\":\"payable\",\"type\":\"function\"}]",
}
// SwapRouterABI is the input ABI used to generate the binding from.
// Deprecated: Use SwapRouterMetaData.ABI instead.
var SwapRouterABI = SwapRouterMetaData.ABI
// SwapRouter is an auto generated Go binding around an Ethereum contract.
type SwapRouter struct {
SwapRouterCaller // Read-only binding to the contract
SwapRouterTransactor // Write-only binding to the contract
SwapRouterFilterer // Log filterer for contract events
}
// SwapRouterCaller is an auto generated read-only Go binding around an Ethereum contract.
type SwapRouterCaller struct {
contract *bind.BoundContract // Generic contract wrapper for the low level calls
}
// SwapRouterTransactor is an auto generated write-only Go binding around an Ethereum contract.
type SwapRouterTransactor struct {
contract *bind.BoundContract // Generic contract wrapper for the low level calls
}
// SwapRouterFilterer is an auto generated log filtering Go binding around an Ethereum contract events.
type SwapRouterFilterer struct {
contract *bind.BoundContract // Generic contract wrapper for the low level calls
}
// SwapRouterSession is an auto generated Go binding around an Ethereum contract,
// with pre-set call and transact options.
type SwapRouterSession struct {
Contract *SwapRouter // 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
}
// SwapRouterCallerSession is an auto generated read-only Go binding around an Ethereum contract,
// with pre-set call options.
type SwapRouterCallerSession struct {
Contract *SwapRouterCaller // Generic contract caller binding to set the session for
CallOpts bind.CallOpts // Call options to use throughout this session
}
// SwapRouterTransactorSession is an auto generated write-only Go binding around an Ethereum contract,
// with pre-set transact options.
type SwapRouterTransactorSession struct {
Contract *SwapRouterTransactor // Generic contract transactor binding to set the session for
TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session
}
// SwapRouterRaw is an auto generated low-level Go binding around an Ethereum contract.
type SwapRouterRaw struct {
Contract *SwapRouter // Generic contract binding to access the raw methods on
}
// SwapRouterCallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract.
type SwapRouterCallerRaw struct {
Contract *SwapRouterCaller // Generic read-only contract binding to access the raw methods on
}
// SwapRouterTransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract.
type SwapRouterTransactorRaw struct {
Contract *SwapRouterTransactor // Generic write-only contract binding to access the raw methods on
}
// NewSwapRouter creates a new instance of SwapRouter, bound to a specific deployed contract.
func NewSwapRouter(address common.Address, backend bind.ContractBackend) (*SwapRouter, error) {
contract, err := bindSwapRouter(address, backend, backend, backend)
if err != nil {
return nil, err
}
return &SwapRouter{SwapRouterCaller: SwapRouterCaller{contract: contract}, SwapRouterTransactor: SwapRouterTransactor{contract: contract}, SwapRouterFilterer: SwapRouterFilterer{contract: contract}}, nil
}
// NewSwapRouterCaller creates a new read-only instance of SwapRouter, bound to a specific deployed contract.
func NewSwapRouterCaller(address common.Address, caller bind.ContractCaller) (*SwapRouterCaller, error) {
contract, err := bindSwapRouter(address, caller, nil, nil)
if err != nil {
return nil, err
}
return &SwapRouterCaller{contract: contract}, nil
}
// NewSwapRouterTransactor creates a new write-only instance of SwapRouter, bound to a specific deployed contract.
func NewSwapRouterTransactor(address common.Address, transactor bind.ContractTransactor) (*SwapRouterTransactor, error) {
contract, err := bindSwapRouter(address, nil, transactor, nil)
if err != nil {
return nil, err
}
return &SwapRouterTransactor{contract: contract}, nil
}
// NewSwapRouterFilterer creates a new log filterer instance of SwapRouter, bound to a specific deployed contract.
func NewSwapRouterFilterer(address common.Address, filterer bind.ContractFilterer) (*SwapRouterFilterer, error) {
contract, err := bindSwapRouter(address, nil, nil, filterer)
if err != nil {
return nil, err
}
return &SwapRouterFilterer{contract: contract}, nil
}
// bindSwapRouter binds a generic wrapper to an already deployed contract.
func bindSwapRouter(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) {
parsed, err := SwapRouterMetaData.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 (_SwapRouter *SwapRouterRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error {
return _SwapRouter.Contract.SwapRouterCaller.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 (_SwapRouter *SwapRouterRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {
return _SwapRouter.Contract.SwapRouterTransactor.contract.Transfer(opts)
}
// Transact invokes the (paid) contract method with params as input values.
func (_SwapRouter *SwapRouterRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) {
return _SwapRouter.Contract.SwapRouterTransactor.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 (_SwapRouter *SwapRouterCallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error {
return _SwapRouter.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 (_SwapRouter *SwapRouterTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {
return _SwapRouter.Contract.contract.Transfer(opts)
}
// Transact invokes the (paid) contract method with params as input values.
func (_SwapRouter *SwapRouterTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) {
return _SwapRouter.Contract.contract.Transact(opts, method, params...)
}
// ExactInput is a paid mutator transaction binding the contract method 0xc04b8d59.
//
// Solidity: function exactInput((bytes,address,uint256,uint256,uint256) params) payable returns(uint256 amountOut)
func (_SwapRouter *SwapRouterTransactor) ExactInput(opts *bind.TransactOpts, params ISwapRouterExactInputParams) (*types.Transaction, error) {
return _SwapRouter.contract.Transact(opts, "exactInput", params)
}
// ExactInput is a paid mutator transaction binding the contract method 0xc04b8d59.
//
// Solidity: function exactInput((bytes,address,uint256,uint256,uint256) params) payable returns(uint256 amountOut)
func (_SwapRouter *SwapRouterSession) ExactInput(params ISwapRouterExactInputParams) (*types.Transaction, error) {
return _SwapRouter.Contract.ExactInput(&_SwapRouter.TransactOpts, params)
}
// ExactInput is a paid mutator transaction binding the contract method 0xc04b8d59.
//
// Solidity: function exactInput((bytes,address,uint256,uint256,uint256) params) payable returns(uint256 amountOut)
func (_SwapRouter *SwapRouterTransactorSession) ExactInput(params ISwapRouterExactInputParams) (*types.Transaction, error) {
return _SwapRouter.Contract.ExactInput(&_SwapRouter.TransactOpts, params)
}
// ExactInputSingle is a paid mutator transaction binding the contract method 0x414bf389.
//
// Solidity: function exactInputSingle((address,address,uint24,address,uint256,uint256,uint256,uint160) params) payable returns(uint256 amountOut)
func (_SwapRouter *SwapRouterTransactor) ExactInputSingle(opts *bind.TransactOpts, params ISwapRouterExactInputSingleParams) (*types.Transaction, error) {
return _SwapRouter.contract.Transact(opts, "exactInputSingle", params)
}
// ExactInputSingle is a paid mutator transaction binding the contract method 0x414bf389.
//
// Solidity: function exactInputSingle((address,address,uint24,address,uint256,uint256,uint256,uint160) params) payable returns(uint256 amountOut)
func (_SwapRouter *SwapRouterSession) ExactInputSingle(params ISwapRouterExactInputSingleParams) (*types.Transaction, error) {
return _SwapRouter.Contract.ExactInputSingle(&_SwapRouter.TransactOpts, params)
}
// ExactInputSingle is a paid mutator transaction binding the contract method 0x414bf389.
//
// Solidity: function exactInputSingle((address,address,uint24,address,uint256,uint256,uint256,uint160) params) payable returns(uint256 amountOut)
func (_SwapRouter *SwapRouterTransactorSession) ExactInputSingle(params ISwapRouterExactInputSingleParams) (*types.Transaction, error) {
return _SwapRouter.Contract.ExactInputSingle(&_SwapRouter.TransactOpts, params)
}
// ExactOutput is a paid mutator transaction binding the contract method 0xf28c0498.
//
// Solidity: function exactOutput((bytes,address,uint256,uint256,uint256) params) payable returns(uint256 amountIn)
func (_SwapRouter *SwapRouterTransactor) ExactOutput(opts *bind.TransactOpts, params ISwapRouterExactOutputParams) (*types.Transaction, error) {
return _SwapRouter.contract.Transact(opts, "exactOutput", params)
}
// ExactOutput is a paid mutator transaction binding the contract method 0xf28c0498.
//
// Solidity: function exactOutput((bytes,address,uint256,uint256,uint256) params) payable returns(uint256 amountIn)
func (_SwapRouter *SwapRouterSession) ExactOutput(params ISwapRouterExactOutputParams) (*types.Transaction, error) {
return _SwapRouter.Contract.ExactOutput(&_SwapRouter.TransactOpts, params)
}
// ExactOutput is a paid mutator transaction binding the contract method 0xf28c0498.
//
// Solidity: function exactOutput((bytes,address,uint256,uint256,uint256) params) payable returns(uint256 amountIn)
func (_SwapRouter *SwapRouterTransactorSession) ExactOutput(params ISwapRouterExactOutputParams) (*types.Transaction, error) {
return _SwapRouter.Contract.ExactOutput(&_SwapRouter.TransactOpts, params)
}
// ExactOutputSingle is a paid mutator transaction binding the contract method 0xdb3e2198.
//
// Solidity: function exactOutputSingle((address,address,uint24,address,uint256,uint256,uint256,uint160) params) payable returns(uint256 amountIn)
func (_SwapRouter *SwapRouterTransactor) ExactOutputSingle(opts *bind.TransactOpts, params ISwapRouterExactOutputSingleParams) (*types.Transaction, error) {
return _SwapRouter.contract.Transact(opts, "exactOutputSingle", params)
}
// ExactOutputSingle is a paid mutator transaction binding the contract method 0xdb3e2198.
//
// Solidity: function exactOutputSingle((address,address,uint24,address,uint256,uint256,uint256,uint160) params) payable returns(uint256 amountIn)
func (_SwapRouter *SwapRouterSession) ExactOutputSingle(params ISwapRouterExactOutputSingleParams) (*types.Transaction, error) {
return _SwapRouter.Contract.ExactOutputSingle(&_SwapRouter.TransactOpts, params)
}
// ExactOutputSingle is a paid mutator transaction binding the contract method 0xdb3e2198.
//
// Solidity: function exactOutputSingle((address,address,uint24,address,uint256,uint256,uint256,uint160) params) payable returns(uint256 amountIn)
func (_SwapRouter *SwapRouterTransactorSession) ExactOutputSingle(params ISwapRouterExactOutputSingleParams) (*types.Transaction, error) {
return _SwapRouter.Contract.ExactOutputSingle(&_SwapRouter.TransactOpts, params)
}