github.com/cwntr/go-defi@v0.0.0-20210629134751-07f9ec2f7e66/binding/hkyber/hkyber.go (about) 1 // Code generated - DO NOT EDIT. 2 // This file is a generated binding and any manual changes will be lost. 3 4 package hkyber 5 6 import ( 7 "math/big" 8 "strings" 9 10 ethereum "github.com/ethereum/go-ethereum" 11 "github.com/ethereum/go-ethereum/accounts/abi" 12 "github.com/ethereum/go-ethereum/accounts/abi/bind" 13 "github.com/ethereum/go-ethereum/common" 14 "github.com/ethereum/go-ethereum/core/types" 15 "github.com/ethereum/go-ethereum/event" 16 ) 17 18 // Reference imports to suppress errors if they are not otherwise used. 19 var ( 20 _ = big.NewInt 21 _ = strings.NewReader 22 _ = ethereum.NotFound 23 _ = bind.Bind 24 _ = common.Big1 25 _ = types.BloomLookup 26 _ = event.NewSubscription 27 ) 28 29 // HkyberABI is the input ABI used to generate the binding from. 30 const HkyberABI = "[{\"constant\":false,\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"minRate\",\"type\":\"uint256\"}],\"name\":\"swapEtherToToken\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"destAmount\",\"type\":\"uint256\"}],\"payable\":true,\"stateMutability\":\"payable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"tokenQty\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"minRate\",\"type\":\"uint256\"}],\"name\":\"swapTokenToEther\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"destAmount\",\"type\":\"uint256\"}],\"payable\":true,\"stateMutability\":\"payable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"internalType\":\"address\",\"name\":\"srcToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"srcQty\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"destToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"minRate\",\"type\":\"uint256\"}],\"name\":\"swapTokenToToken\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"destAmount\",\"type\":\"uint256\"}],\"payable\":true,\"stateMutability\":\"payable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"tokens\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"}]" 31 32 // Hkyber is an auto generated Go binding around an Ethereum contract. 33 type Hkyber struct { 34 HkyberCaller // Read-only binding to the contract 35 HkyberTransactor // Write-only binding to the contract 36 HkyberFilterer // Log filterer for contract events 37 } 38 39 // HkyberCaller is an auto generated read-only Go binding around an Ethereum contract. 40 type HkyberCaller struct { 41 contract *bind.BoundContract // Generic contract wrapper for the low level calls 42 } 43 44 // HkyberTransactor is an auto generated write-only Go binding around an Ethereum contract. 45 type HkyberTransactor struct { 46 contract *bind.BoundContract // Generic contract wrapper for the low level calls 47 } 48 49 // HkyberFilterer is an auto generated log filtering Go binding around an Ethereum contract events. 50 type HkyberFilterer struct { 51 contract *bind.BoundContract // Generic contract wrapper for the low level calls 52 } 53 54 // HkyberSession is an auto generated Go binding around an Ethereum contract, 55 // with pre-set call and transact options. 56 type HkyberSession struct { 57 Contract *Hkyber // Generic contract binding to set the session for 58 CallOpts bind.CallOpts // Call options to use throughout this session 59 TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session 60 } 61 62 // HkyberCallerSession is an auto generated read-only Go binding around an Ethereum contract, 63 // with pre-set call options. 64 type HkyberCallerSession struct { 65 Contract *HkyberCaller // Generic contract caller binding to set the session for 66 CallOpts bind.CallOpts // Call options to use throughout this session 67 } 68 69 // HkyberTransactorSession is an auto generated write-only Go binding around an Ethereum contract, 70 // with pre-set transact options. 71 type HkyberTransactorSession struct { 72 Contract *HkyberTransactor // Generic contract transactor binding to set the session for 73 TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session 74 } 75 76 // HkyberRaw is an auto generated low-level Go binding around an Ethereum contract. 77 type HkyberRaw struct { 78 Contract *Hkyber // Generic contract binding to access the raw methods on 79 } 80 81 // HkyberCallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract. 82 type HkyberCallerRaw struct { 83 Contract *HkyberCaller // Generic read-only contract binding to access the raw methods on 84 } 85 86 // HkyberTransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract. 87 type HkyberTransactorRaw struct { 88 Contract *HkyberTransactor // Generic write-only contract binding to access the raw methods on 89 } 90 91 // NewHkyber creates a new instance of Hkyber, bound to a specific deployed contract. 92 func NewHkyber(address common.Address, backend bind.ContractBackend) (*Hkyber, error) { 93 contract, err := bindHkyber(address, backend, backend, backend) 94 if err != nil { 95 return nil, err 96 } 97 return &Hkyber{HkyberCaller: HkyberCaller{contract: contract}, HkyberTransactor: HkyberTransactor{contract: contract}, HkyberFilterer: HkyberFilterer{contract: contract}}, nil 98 } 99 100 // NewHkyberCaller creates a new read-only instance of Hkyber, bound to a specific deployed contract. 101 func NewHkyberCaller(address common.Address, caller bind.ContractCaller) (*HkyberCaller, error) { 102 contract, err := bindHkyber(address, caller, nil, nil) 103 if err != nil { 104 return nil, err 105 } 106 return &HkyberCaller{contract: contract}, nil 107 } 108 109 // NewHkyberTransactor creates a new write-only instance of Hkyber, bound to a specific deployed contract. 110 func NewHkyberTransactor(address common.Address, transactor bind.ContractTransactor) (*HkyberTransactor, error) { 111 contract, err := bindHkyber(address, nil, transactor, nil) 112 if err != nil { 113 return nil, err 114 } 115 return &HkyberTransactor{contract: contract}, nil 116 } 117 118 // NewHkyberFilterer creates a new log filterer instance of Hkyber, bound to a specific deployed contract. 119 func NewHkyberFilterer(address common.Address, filterer bind.ContractFilterer) (*HkyberFilterer, error) { 120 contract, err := bindHkyber(address, nil, nil, filterer) 121 if err != nil { 122 return nil, err 123 } 124 return &HkyberFilterer{contract: contract}, nil 125 } 126 127 // bindHkyber binds a generic wrapper to an already deployed contract. 128 func bindHkyber(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) { 129 parsed, err := abi.JSON(strings.NewReader(HkyberABI)) 130 if err != nil { 131 return nil, err 132 } 133 return bind.NewBoundContract(address, parsed, caller, transactor, filterer), nil 134 } 135 136 // Call invokes the (constant) contract method with params as input values and 137 // sets the output to result. The result type might be a single field for simple 138 // returns, a slice of interfaces for anonymous returns and a struct for named 139 // returns. 140 func (_Hkyber *HkyberRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { 141 return _Hkyber.Contract.HkyberCaller.contract.Call(opts, result, method, params...) 142 } 143 144 // Transfer initiates a plain transaction to move funds to the contract, calling 145 // its default method if one is available. 146 func (_Hkyber *HkyberRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { 147 return _Hkyber.Contract.HkyberTransactor.contract.Transfer(opts) 148 } 149 150 // Transact invokes the (paid) contract method with params as input values. 151 func (_Hkyber *HkyberRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { 152 return _Hkyber.Contract.HkyberTransactor.contract.Transact(opts, method, params...) 153 } 154 155 // Call invokes the (constant) contract method with params as input values and 156 // sets the output to result. The result type might be a single field for simple 157 // returns, a slice of interfaces for anonymous returns and a struct for named 158 // returns. 159 func (_Hkyber *HkyberCallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { 160 return _Hkyber.Contract.contract.Call(opts, result, method, params...) 161 } 162 163 // Transfer initiates a plain transaction to move funds to the contract, calling 164 // its default method if one is available. 165 func (_Hkyber *HkyberTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { 166 return _Hkyber.Contract.contract.Transfer(opts) 167 } 168 169 // Transact invokes the (paid) contract method with params as input values. 170 func (_Hkyber *HkyberTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { 171 return _Hkyber.Contract.contract.Transact(opts, method, params...) 172 } 173 174 // Tokens is a free data retrieval call binding the contract method 0x4f64b2be. 175 // 176 // Solidity: function tokens(uint256 ) view returns(address) 177 func (_Hkyber *HkyberCaller) Tokens(opts *bind.CallOpts, arg0 *big.Int) (common.Address, error) { 178 var out []interface{} 179 err := _Hkyber.contract.Call(opts, &out, "tokens", arg0) 180 181 if err != nil { 182 return *new(common.Address), err 183 } 184 185 out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) 186 187 return out0, err 188 189 } 190 191 // Tokens is a free data retrieval call binding the contract method 0x4f64b2be. 192 // 193 // Solidity: function tokens(uint256 ) view returns(address) 194 func (_Hkyber *HkyberSession) Tokens(arg0 *big.Int) (common.Address, error) { 195 return _Hkyber.Contract.Tokens(&_Hkyber.CallOpts, arg0) 196 } 197 198 // Tokens is a free data retrieval call binding the contract method 0x4f64b2be. 199 // 200 // Solidity: function tokens(uint256 ) view returns(address) 201 func (_Hkyber *HkyberCallerSession) Tokens(arg0 *big.Int) (common.Address, error) { 202 return _Hkyber.Contract.Tokens(&_Hkyber.CallOpts, arg0) 203 } 204 205 // SwapEtherToToken is a paid mutator transaction binding the contract method 0x43ac1dc6. 206 // 207 // Solidity: function swapEtherToToken(uint256 value, address token, uint256 minRate) payable returns(uint256 destAmount) 208 func (_Hkyber *HkyberTransactor) SwapEtherToToken(opts *bind.TransactOpts, value *big.Int, token common.Address, minRate *big.Int) (*types.Transaction, error) { 209 return _Hkyber.contract.Transact(opts, "swapEtherToToken", value, token, minRate) 210 } 211 212 // SwapEtherToToken is a paid mutator transaction binding the contract method 0x43ac1dc6. 213 // 214 // Solidity: function swapEtherToToken(uint256 value, address token, uint256 minRate) payable returns(uint256 destAmount) 215 func (_Hkyber *HkyberSession) SwapEtherToToken(value *big.Int, token common.Address, minRate *big.Int) (*types.Transaction, error) { 216 return _Hkyber.Contract.SwapEtherToToken(&_Hkyber.TransactOpts, value, token, minRate) 217 } 218 219 // SwapEtherToToken is a paid mutator transaction binding the contract method 0x43ac1dc6. 220 // 221 // Solidity: function swapEtherToToken(uint256 value, address token, uint256 minRate) payable returns(uint256 destAmount) 222 func (_Hkyber *HkyberTransactorSession) SwapEtherToToken(value *big.Int, token common.Address, minRate *big.Int) (*types.Transaction, error) { 223 return _Hkyber.Contract.SwapEtherToToken(&_Hkyber.TransactOpts, value, token, minRate) 224 } 225 226 // SwapTokenToEther is a paid mutator transaction binding the contract method 0x3bba21dc. 227 // 228 // Solidity: function swapTokenToEther(address token, uint256 tokenQty, uint256 minRate) payable returns(uint256 destAmount) 229 func (_Hkyber *HkyberTransactor) SwapTokenToEther(opts *bind.TransactOpts, token common.Address, tokenQty *big.Int, minRate *big.Int) (*types.Transaction, error) { 230 return _Hkyber.contract.Transact(opts, "swapTokenToEther", token, tokenQty, minRate) 231 } 232 233 // SwapTokenToEther is a paid mutator transaction binding the contract method 0x3bba21dc. 234 // 235 // Solidity: function swapTokenToEther(address token, uint256 tokenQty, uint256 minRate) payable returns(uint256 destAmount) 236 func (_Hkyber *HkyberSession) SwapTokenToEther(token common.Address, tokenQty *big.Int, minRate *big.Int) (*types.Transaction, error) { 237 return _Hkyber.Contract.SwapTokenToEther(&_Hkyber.TransactOpts, token, tokenQty, minRate) 238 } 239 240 // SwapTokenToEther is a paid mutator transaction binding the contract method 0x3bba21dc. 241 // 242 // Solidity: function swapTokenToEther(address token, uint256 tokenQty, uint256 minRate) payable returns(uint256 destAmount) 243 func (_Hkyber *HkyberTransactorSession) SwapTokenToEther(token common.Address, tokenQty *big.Int, minRate *big.Int) (*types.Transaction, error) { 244 return _Hkyber.Contract.SwapTokenToEther(&_Hkyber.TransactOpts, token, tokenQty, minRate) 245 } 246 247 // SwapTokenToToken is a paid mutator transaction binding the contract method 0x7409e2eb. 248 // 249 // Solidity: function swapTokenToToken(address srcToken, uint256 srcQty, address destToken, uint256 minRate) payable returns(uint256 destAmount) 250 func (_Hkyber *HkyberTransactor) SwapTokenToToken(opts *bind.TransactOpts, srcToken common.Address, srcQty *big.Int, destToken common.Address, minRate *big.Int) (*types.Transaction, error) { 251 return _Hkyber.contract.Transact(opts, "swapTokenToToken", srcToken, srcQty, destToken, minRate) 252 } 253 254 // SwapTokenToToken is a paid mutator transaction binding the contract method 0x7409e2eb. 255 // 256 // Solidity: function swapTokenToToken(address srcToken, uint256 srcQty, address destToken, uint256 minRate) payable returns(uint256 destAmount) 257 func (_Hkyber *HkyberSession) SwapTokenToToken(srcToken common.Address, srcQty *big.Int, destToken common.Address, minRate *big.Int) (*types.Transaction, error) { 258 return _Hkyber.Contract.SwapTokenToToken(&_Hkyber.TransactOpts, srcToken, srcQty, destToken, minRate) 259 } 260 261 // SwapTokenToToken is a paid mutator transaction binding the contract method 0x7409e2eb. 262 // 263 // Solidity: function swapTokenToToken(address srcToken, uint256 srcQty, address destToken, uint256 minRate) payable returns(uint256 destAmount) 264 func (_Hkyber *HkyberTransactorSession) SwapTokenToToken(srcToken common.Address, srcQty *big.Int, destToken common.Address, minRate *big.Int) (*types.Transaction, error) { 265 return _Hkyber.Contract.SwapTokenToToken(&_Hkyber.TransactOpts, srcToken, srcQty, destToken, minRate) 266 }