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:
52
bindings/uniswap_v2/IUniswapV2Pair.json
Normal file
52
bindings/uniswap_v2/IUniswapV2Pair.json
Normal 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"
|
||||
}
|
||||
]
|
||||
0
bindings/uniswap_v2/IUniswapV2Pair_abi.json
Normal file
0
bindings/uniswap_v2/IUniswapV2Pair_abi.json
Normal file
90
bindings/uniswap_v2/IUniswapV2Router02.json
Normal file
90
bindings/uniswap_v2/IUniswapV2Router02.json
Normal 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
473
bindings/uniswap_v2/pair.go
Normal 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
|
||||
}
|
||||
307
bindings/uniswap_v2/router.go
Normal file
307
bindings/uniswap_v2/router.go
Normal 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)
|
||||
}
|
||||
Reference in New Issue
Block a user