github.com/cwntr/go-defi@v0.0.0-20210629134751-07f9ec2f7e66/binding/swapper/swapper.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 swapper 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 // SwapperABI is the input ABI used to generate the binding from. 30 const SwapperABI = "[{\"inputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"payable\":true,\"stateMutability\":\"payable\",\"type\":\"fallback\"},{\"constant\":false,\"inputs\":[],\"name\":\"postProcess\",\"outputs\":[],\"payable\":true,\"stateMutability\":\"payable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"internalType\":\"address\",\"name\":\"_tokenBorrow\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"_tokenPay\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"_userData\",\"type\":\"bytes\"}],\"name\":\"startSwap\",\"outputs\":[],\"payable\":true,\"stateMutability\":\"payable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"internalType\":\"address\",\"name\":\"_sender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_amount0\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_amount1\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"_data\",\"type\":\"bytes\"}],\"name\":\"uniswapV2Call\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]" 31 32 // Swapper is an auto generated Go binding around an Ethereum contract. 33 type Swapper struct { 34 SwapperCaller // Read-only binding to the contract 35 SwapperTransactor // Write-only binding to the contract 36 SwapperFilterer // Log filterer for contract events 37 } 38 39 // SwapperCaller is an auto generated read-only Go binding around an Ethereum contract. 40 type SwapperCaller struct { 41 contract *bind.BoundContract // Generic contract wrapper for the low level calls 42 } 43 44 // SwapperTransactor is an auto generated write-only Go binding around an Ethereum contract. 45 type SwapperTransactor struct { 46 contract *bind.BoundContract // Generic contract wrapper for the low level calls 47 } 48 49 // SwapperFilterer is an auto generated log filtering Go binding around an Ethereum contract events. 50 type SwapperFilterer struct { 51 contract *bind.BoundContract // Generic contract wrapper for the low level calls 52 } 53 54 // SwapperSession is an auto generated Go binding around an Ethereum contract, 55 // with pre-set call and transact options. 56 type SwapperSession struct { 57 Contract *Swapper // 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 // SwapperCallerSession is an auto generated read-only Go binding around an Ethereum contract, 63 // with pre-set call options. 64 type SwapperCallerSession struct { 65 Contract *SwapperCaller // Generic contract caller binding to set the session for 66 CallOpts bind.CallOpts // Call options to use throughout this session 67 } 68 69 // SwapperTransactorSession is an auto generated write-only Go binding around an Ethereum contract, 70 // with pre-set transact options. 71 type SwapperTransactorSession struct { 72 Contract *SwapperTransactor // Generic contract transactor binding to set the session for 73 TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session 74 } 75 76 // SwapperRaw is an auto generated low-level Go binding around an Ethereum contract. 77 type SwapperRaw struct { 78 Contract *Swapper // Generic contract binding to access the raw methods on 79 } 80 81 // SwapperCallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract. 82 type SwapperCallerRaw struct { 83 Contract *SwapperCaller // Generic read-only contract binding to access the raw methods on 84 } 85 86 // SwapperTransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract. 87 type SwapperTransactorRaw struct { 88 Contract *SwapperTransactor // Generic write-only contract binding to access the raw methods on 89 } 90 91 // NewSwapper creates a new instance of Swapper, bound to a specific deployed contract. 92 func NewSwapper(address common.Address, backend bind.ContractBackend) (*Swapper, error) { 93 contract, err := bindSwapper(address, backend, backend, backend) 94 if err != nil { 95 return nil, err 96 } 97 return &Swapper{SwapperCaller: SwapperCaller{contract: contract}, SwapperTransactor: SwapperTransactor{contract: contract}, SwapperFilterer: SwapperFilterer{contract: contract}}, nil 98 } 99 100 // NewSwapperCaller creates a new read-only instance of Swapper, bound to a specific deployed contract. 101 func NewSwapperCaller(address common.Address, caller bind.ContractCaller) (*SwapperCaller, error) { 102 contract, err := bindSwapper(address, caller, nil, nil) 103 if err != nil { 104 return nil, err 105 } 106 return &SwapperCaller{contract: contract}, nil 107 } 108 109 // NewSwapperTransactor creates a new write-only instance of Swapper, bound to a specific deployed contract. 110 func NewSwapperTransactor(address common.Address, transactor bind.ContractTransactor) (*SwapperTransactor, error) { 111 contract, err := bindSwapper(address, nil, transactor, nil) 112 if err != nil { 113 return nil, err 114 } 115 return &SwapperTransactor{contract: contract}, nil 116 } 117 118 // NewSwapperFilterer creates a new log filterer instance of Swapper, bound to a specific deployed contract. 119 func NewSwapperFilterer(address common.Address, filterer bind.ContractFilterer) (*SwapperFilterer, error) { 120 contract, err := bindSwapper(address, nil, nil, filterer) 121 if err != nil { 122 return nil, err 123 } 124 return &SwapperFilterer{contract: contract}, nil 125 } 126 127 // bindSwapper binds a generic wrapper to an already deployed contract. 128 func bindSwapper(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) { 129 parsed, err := abi.JSON(strings.NewReader(SwapperABI)) 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 (_Swapper *SwapperRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { 141 return _Swapper.Contract.SwapperCaller.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 (_Swapper *SwapperRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { 147 return _Swapper.Contract.SwapperTransactor.contract.Transfer(opts) 148 } 149 150 // Transact invokes the (paid) contract method with params as input values. 151 func (_Swapper *SwapperRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { 152 return _Swapper.Contract.SwapperTransactor.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 (_Swapper *SwapperCallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { 160 return _Swapper.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 (_Swapper *SwapperTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { 166 return _Swapper.Contract.contract.Transfer(opts) 167 } 168 169 // Transact invokes the (paid) contract method with params as input values. 170 func (_Swapper *SwapperTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { 171 return _Swapper.Contract.contract.Transact(opts, method, params...) 172 } 173 174 // PostProcess is a paid mutator transaction binding the contract method 0xc2722916. 175 // 176 // Solidity: function postProcess() payable returns() 177 func (_Swapper *SwapperTransactor) PostProcess(opts *bind.TransactOpts) (*types.Transaction, error) { 178 return _Swapper.contract.Transact(opts, "postProcess") 179 } 180 181 // PostProcess is a paid mutator transaction binding the contract method 0xc2722916. 182 // 183 // Solidity: function postProcess() payable returns() 184 func (_Swapper *SwapperSession) PostProcess() (*types.Transaction, error) { 185 return _Swapper.Contract.PostProcess(&_Swapper.TransactOpts) 186 } 187 188 // PostProcess is a paid mutator transaction binding the contract method 0xc2722916. 189 // 190 // Solidity: function postProcess() payable returns() 191 func (_Swapper *SwapperTransactorSession) PostProcess() (*types.Transaction, error) { 192 return _Swapper.Contract.PostProcess(&_Swapper.TransactOpts) 193 } 194 195 // StartSwap is a paid mutator transaction binding the contract method 0xcd7cebc9. 196 // 197 // Solidity: function startSwap(address _tokenBorrow, uint256 _amount, address _tokenPay, bytes _userData) payable returns() 198 func (_Swapper *SwapperTransactor) StartSwap(opts *bind.TransactOpts, _tokenBorrow common.Address, _amount *big.Int, _tokenPay common.Address, _userData []byte) (*types.Transaction, error) { 199 return _Swapper.contract.Transact(opts, "startSwap", _tokenBorrow, _amount, _tokenPay, _userData) 200 } 201 202 // StartSwap is a paid mutator transaction binding the contract method 0xcd7cebc9. 203 // 204 // Solidity: function startSwap(address _tokenBorrow, uint256 _amount, address _tokenPay, bytes _userData) payable returns() 205 func (_Swapper *SwapperSession) StartSwap(_tokenBorrow common.Address, _amount *big.Int, _tokenPay common.Address, _userData []byte) (*types.Transaction, error) { 206 return _Swapper.Contract.StartSwap(&_Swapper.TransactOpts, _tokenBorrow, _amount, _tokenPay, _userData) 207 } 208 209 // StartSwap is a paid mutator transaction binding the contract method 0xcd7cebc9. 210 // 211 // Solidity: function startSwap(address _tokenBorrow, uint256 _amount, address _tokenPay, bytes _userData) payable returns() 212 func (_Swapper *SwapperTransactorSession) StartSwap(_tokenBorrow common.Address, _amount *big.Int, _tokenPay common.Address, _userData []byte) (*types.Transaction, error) { 213 return _Swapper.Contract.StartSwap(&_Swapper.TransactOpts, _tokenBorrow, _amount, _tokenPay, _userData) 214 } 215 216 // UniswapV2Call is a paid mutator transaction binding the contract method 0x10d1e85c. 217 // 218 // Solidity: function uniswapV2Call(address _sender, uint256 _amount0, uint256 _amount1, bytes _data) returns() 219 func (_Swapper *SwapperTransactor) UniswapV2Call(opts *bind.TransactOpts, _sender common.Address, _amount0 *big.Int, _amount1 *big.Int, _data []byte) (*types.Transaction, error) { 220 return _Swapper.contract.Transact(opts, "uniswapV2Call", _sender, _amount0, _amount1, _data) 221 } 222 223 // UniswapV2Call is a paid mutator transaction binding the contract method 0x10d1e85c. 224 // 225 // Solidity: function uniswapV2Call(address _sender, uint256 _amount0, uint256 _amount1, bytes _data) returns() 226 func (_Swapper *SwapperSession) UniswapV2Call(_sender common.Address, _amount0 *big.Int, _amount1 *big.Int, _data []byte) (*types.Transaction, error) { 227 return _Swapper.Contract.UniswapV2Call(&_Swapper.TransactOpts, _sender, _amount0, _amount1, _data) 228 } 229 230 // UniswapV2Call is a paid mutator transaction binding the contract method 0x10d1e85c. 231 // 232 // Solidity: function uniswapV2Call(address _sender, uint256 _amount0, uint256 _amount1, bytes _data) returns() 233 func (_Swapper *SwapperTransactorSession) UniswapV2Call(_sender common.Address, _amount0 *big.Int, _amount1 *big.Int, _data []byte) (*types.Transaction, error) { 234 return _Swapper.Contract.UniswapV2Call(&_Swapper.TransactOpts, _sender, _amount0, _amount1, _data) 235 } 236 237 // Fallback is a paid mutator transaction binding the contract fallback function. 238 // 239 // Solidity: fallback() payable returns() 240 func (_Swapper *SwapperTransactor) Fallback(opts *bind.TransactOpts, calldata []byte) (*types.Transaction, error) { 241 return _Swapper.contract.RawTransact(opts, calldata) 242 } 243 244 // Fallback is a paid mutator transaction binding the contract fallback function. 245 // 246 // Solidity: fallback() payable returns() 247 func (_Swapper *SwapperSession) Fallback(calldata []byte) (*types.Transaction, error) { 248 return _Swapper.Contract.Fallback(&_Swapper.TransactOpts, calldata) 249 } 250 251 // Fallback is a paid mutator transaction binding the contract fallback function. 252 // 253 // Solidity: fallback() payable returns() 254 func (_Swapper *SwapperTransactorSession) Fallback(calldata []byte) (*types.Transaction, error) { 255 return _Swapper.Contract.Fallback(&_Swapper.TransactOpts, calldata) 256 }