123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211 |
- package util
- 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"
- )
- var (
- _ = errors.New
- _ = big.NewInt
- _ = strings.NewReader
- _ = ethereum.NotFound
- _ = bind.Bind
- _ = common.Big1
- _ = types.BloomLookup
- _ = event.NewSubscription
- )
- var RouterMetaData = &bind.MetaData{
- ABI: "[{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"amountIn\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"path\",\"type\":\"address[]\"}],\"name\":\"getAmountsOut\",\"outputs\":[{\"internalType\":\"uint256[]\",\"name\":\"amounts\",\"type\":\"uint256[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"}]",
- }
- var RouterABI = RouterMetaData.ABI
- type Router struct {
- RouterCaller
- RouterTransactor
- RouterFilterer
- }
- type RouterCaller struct {
- contract *bind.BoundContract
- }
- type RouterTransactor struct {
- contract *bind.BoundContract
- }
- type RouterFilterer struct {
- contract *bind.BoundContract
- }
- type RouterSession struct {
- Contract *Router
- CallOpts bind.CallOpts
- TransactOpts bind.TransactOpts
- }
- type RouterCallerSession struct {
- Contract *RouterCaller
- CallOpts bind.CallOpts
- }
- type RouterTransactorSession struct {
- Contract *RouterTransactor
- TransactOpts bind.TransactOpts
- }
- type RouterRaw struct {
- Contract *Router
- }
- type RouterCallerRaw struct {
- Contract *RouterCaller
- }
- type RouterTransactorRaw struct {
- Contract *RouterTransactor
- }
- func NewRouter(address common.Address, backend bind.ContractBackend) (*Router, error) {
- contract, err := bindRouter(address, backend, backend, backend)
- if err != nil {
- return nil, err
- }
- return &Router{RouterCaller: RouterCaller{contract: contract}, RouterTransactor: RouterTransactor{contract: contract}, RouterFilterer: RouterFilterer{contract: contract}}, nil
- }
- func NewRouterCaller(address common.Address, caller bind.ContractCaller) (*RouterCaller, error) {
- contract, err := bindRouter(address, caller, nil, nil)
- if err != nil {
- return nil, err
- }
- return &RouterCaller{contract: contract}, nil
- }
- func NewRouterTransactor(address common.Address, transactor bind.ContractTransactor) (*RouterTransactor, error) {
- contract, err := bindRouter(address, nil, transactor, nil)
- if err != nil {
- return nil, err
- }
- return &RouterTransactor{contract: contract}, nil
- }
- func NewRouterFilterer(address common.Address, filterer bind.ContractFilterer) (*RouterFilterer, error) {
- contract, err := bindRouter(address, nil, nil, filterer)
- if err != nil {
- return nil, err
- }
- return &RouterFilterer{contract: contract}, nil
- }
- func bindRouter(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) {
- parsed, err := abi.JSON(strings.NewReader(RouterABI))
- if err != nil {
- return nil, err
- }
- return bind.NewBoundContract(address, parsed, caller, transactor, filterer), nil
- }
- func (_Router *RouterRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error {
- return _Router.Contract.RouterCaller.contract.Call(opts, result, method, params...)
- }
- func (_Router *RouterRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {
- return _Router.Contract.RouterTransactor.contract.Transfer(opts)
- }
- func (_Router *RouterRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) {
- return _Router.Contract.RouterTransactor.contract.Transact(opts, method, params...)
- }
- func (_Router *RouterCallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error {
- return _Router.Contract.contract.Call(opts, result, method, params...)
- }
- func (_Router *RouterTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {
- return _Router.Contract.contract.Transfer(opts)
- }
- func (_Router *RouterTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) {
- return _Router.Contract.contract.Transact(opts, method, params...)
- }
- func (_Router *RouterCaller) GetAmountsOut(opts *bind.CallOpts, amountIn *big.Int, path []common.Address) ([]*big.Int, error) {
- var out []interface{}
- err := _Router.contract.Call(opts, &out, "getAmountsOut", amountIn, path)
- if err != nil {
- return *new([]*big.Int), err
- }
- out0 := *abi.ConvertType(out[0], new([]*big.Int)).(*[]*big.Int)
- return out0, err
- }
- func (_Router *RouterSession) GetAmountsOut(amountIn *big.Int, path []common.Address) ([]*big.Int, error) {
- return _Router.Contract.GetAmountsOut(&_Router.CallOpts, amountIn, path)
- }
- func (_Router *RouterCallerSession) GetAmountsOut(amountIn *big.Int, path []common.Address) ([]*big.Int, error) {
- return _Router.Contract.GetAmountsOut(&_Router.CallOpts, amountIn, path)
- }
|