router.go 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211
  1. // Code generated - DO NOT EDIT.
  2. // This file is a generated binding and any manual changes will be lost.
  3. package util
  4. import (
  5. "errors"
  6. "math/big"
  7. "strings"
  8. ethereum "github.com/ethereum/go-ethereum"
  9. "github.com/ethereum/go-ethereum/accounts/abi"
  10. "github.com/ethereum/go-ethereum/accounts/abi/bind"
  11. "github.com/ethereum/go-ethereum/common"
  12. "github.com/ethereum/go-ethereum/core/types"
  13. "github.com/ethereum/go-ethereum/event"
  14. )
  15. // Reference imports to suppress errors if they are not otherwise used.
  16. var (
  17. _ = errors.New
  18. _ = big.NewInt
  19. _ = strings.NewReader
  20. _ = ethereum.NotFound
  21. _ = bind.Bind
  22. _ = common.Big1
  23. _ = types.BloomLookup
  24. _ = event.NewSubscription
  25. )
  26. // RouterMetaData contains all meta data concerning the Router contract.
  27. var RouterMetaData = &bind.MetaData{
  28. 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\"}]",
  29. }
  30. // RouterABI is the input ABI used to generate the binding from.
  31. // Deprecated: Use RouterMetaData.ABI instead.
  32. var RouterABI = RouterMetaData.ABI
  33. // Router is an auto generated Go binding around an Ethereum contract.
  34. type Router struct {
  35. RouterCaller // Read-only binding to the contract
  36. RouterTransactor // Write-only binding to the contract
  37. RouterFilterer // Log filterer for contract events
  38. }
  39. // RouterCaller is an auto generated read-only Go binding around an Ethereum contract.
  40. type RouterCaller struct {
  41. contract *bind.BoundContract // Generic contract wrapper for the low level calls
  42. }
  43. // RouterTransactor is an auto generated write-only Go binding around an Ethereum contract.
  44. type RouterTransactor struct {
  45. contract *bind.BoundContract // Generic contract wrapper for the low level calls
  46. }
  47. // RouterFilterer is an auto generated log filtering Go binding around an Ethereum contract events.
  48. type RouterFilterer struct {
  49. contract *bind.BoundContract // Generic contract wrapper for the low level calls
  50. }
  51. // RouterSession is an auto generated Go binding around an Ethereum contract,
  52. // with pre-set call and transact options.
  53. type RouterSession struct {
  54. Contract *Router // Generic contract binding to set the session for
  55. CallOpts bind.CallOpts // Call options to use throughout this session
  56. TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session
  57. }
  58. // RouterCallerSession is an auto generated read-only Go binding around an Ethereum contract,
  59. // with pre-set call options.
  60. type RouterCallerSession struct {
  61. Contract *RouterCaller // Generic contract caller binding to set the session for
  62. CallOpts bind.CallOpts // Call options to use throughout this session
  63. }
  64. // RouterTransactorSession is an auto generated write-only Go binding around an Ethereum contract,
  65. // with pre-set transact options.
  66. type RouterTransactorSession struct {
  67. Contract *RouterTransactor // Generic contract transactor binding to set the session for
  68. TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session
  69. }
  70. // RouterRaw is an auto generated low-level Go binding around an Ethereum contract.
  71. type RouterRaw struct {
  72. Contract *Router // Generic contract binding to access the raw methods on
  73. }
  74. // RouterCallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract.
  75. type RouterCallerRaw struct {
  76. Contract *RouterCaller // Generic read-only contract binding to access the raw methods on
  77. }
  78. // RouterTransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract.
  79. type RouterTransactorRaw struct {
  80. Contract *RouterTransactor // Generic write-only contract binding to access the raw methods on
  81. }
  82. // NewRouter creates a new instance of Router, bound to a specific deployed contract.
  83. func NewRouter(address common.Address, backend bind.ContractBackend) (*Router, error) {
  84. contract, err := bindRouter(address, backend, backend, backend)
  85. if err != nil {
  86. return nil, err
  87. }
  88. return &Router{RouterCaller: RouterCaller{contract: contract}, RouterTransactor: RouterTransactor{contract: contract}, RouterFilterer: RouterFilterer{contract: contract}}, nil
  89. }
  90. // NewRouterCaller creates a new read-only instance of Router, bound to a specific deployed contract.
  91. func NewRouterCaller(address common.Address, caller bind.ContractCaller) (*RouterCaller, error) {
  92. contract, err := bindRouter(address, caller, nil, nil)
  93. if err != nil {
  94. return nil, err
  95. }
  96. return &RouterCaller{contract: contract}, nil
  97. }
  98. // NewRouterTransactor creates a new write-only instance of Router, bound to a specific deployed contract.
  99. func NewRouterTransactor(address common.Address, transactor bind.ContractTransactor) (*RouterTransactor, error) {
  100. contract, err := bindRouter(address, nil, transactor, nil)
  101. if err != nil {
  102. return nil, err
  103. }
  104. return &RouterTransactor{contract: contract}, nil
  105. }
  106. // NewRouterFilterer creates a new log filterer instance of Router, bound to a specific deployed contract.
  107. func NewRouterFilterer(address common.Address, filterer bind.ContractFilterer) (*RouterFilterer, error) {
  108. contract, err := bindRouter(address, nil, nil, filterer)
  109. if err != nil {
  110. return nil, err
  111. }
  112. return &RouterFilterer{contract: contract}, nil
  113. }
  114. // bindRouter binds a generic wrapper to an already deployed contract.
  115. func bindRouter(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) {
  116. parsed, err := abi.JSON(strings.NewReader(RouterABI))
  117. if err != nil {
  118. return nil, err
  119. }
  120. return bind.NewBoundContract(address, parsed, caller, transactor, filterer), nil
  121. }
  122. // Call invokes the (constant) contract method with params as input values and
  123. // sets the output to result. The result type might be a single field for simple
  124. // returns, a slice of interfaces for anonymous returns and a struct for named
  125. // returns.
  126. func (_Router *RouterRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error {
  127. return _Router.Contract.RouterCaller.contract.Call(opts, result, method, params...)
  128. }
  129. // Transfer initiates a plain transaction to move funds to the contract, calling
  130. // its default method if one is available.
  131. func (_Router *RouterRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {
  132. return _Router.Contract.RouterTransactor.contract.Transfer(opts)
  133. }
  134. // Transact invokes the (paid) contract method with params as input values.
  135. func (_Router *RouterRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) {
  136. return _Router.Contract.RouterTransactor.contract.Transact(opts, method, params...)
  137. }
  138. // Call invokes the (constant) contract method with params as input values and
  139. // sets the output to result. The result type might be a single field for simple
  140. // returns, a slice of interfaces for anonymous returns and a struct for named
  141. // returns.
  142. func (_Router *RouterCallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error {
  143. return _Router.Contract.contract.Call(opts, result, method, params...)
  144. }
  145. // Transfer initiates a plain transaction to move funds to the contract, calling
  146. // its default method if one is available.
  147. func (_Router *RouterTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {
  148. return _Router.Contract.contract.Transfer(opts)
  149. }
  150. // Transact invokes the (paid) contract method with params as input values.
  151. func (_Router *RouterTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) {
  152. return _Router.Contract.contract.Transact(opts, method, params...)
  153. }
  154. // GetAmountsOut is a free data retrieval call binding the contract method 0xd06ca61f.
  155. //
  156. // Solidity: function getAmountsOut(uint256 amountIn, address[] path) view returns(uint256[] amounts)
  157. func (_Router *RouterCaller) GetAmountsOut(opts *bind.CallOpts, amountIn *big.Int, path []common.Address) ([]*big.Int, error) {
  158. var out []interface{}
  159. err := _Router.contract.Call(opts, &out, "getAmountsOut", amountIn, path)
  160. if err != nil {
  161. return *new([]*big.Int), err
  162. }
  163. out0 := *abi.ConvertType(out[0], new([]*big.Int)).(*[]*big.Int)
  164. return out0, err
  165. }
  166. // GetAmountsOut is a free data retrieval call binding the contract method 0xd06ca61f.
  167. //
  168. // Solidity: function getAmountsOut(uint256 amountIn, address[] path) view returns(uint256[] amounts)
  169. func (_Router *RouterSession) GetAmountsOut(amountIn *big.Int, path []common.Address) ([]*big.Int, error) {
  170. return _Router.Contract.GetAmountsOut(&_Router.CallOpts, amountIn, path)
  171. }
  172. // GetAmountsOut is a free data retrieval call binding the contract method 0xd06ca61f.
  173. //
  174. // Solidity: function getAmountsOut(uint256 amountIn, address[] path) view returns(uint256[] amounts)
  175. func (_Router *RouterCallerSession) GetAmountsOut(amountIn *big.Int, path []common.Address) ([]*big.Int, error) {
  176. return _Router.Contract.GetAmountsOut(&_Router.CallOpts, amountIn, path)
  177. }