423 lines
19 KiB
Go
423 lines
19 KiB
Go
// Code generated - DO NOT EDIT.
|
|
// This file is a generated binding and any manual changes will be lost.
|
|
|
|
package interfaces
|
|
|
|
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
|
|
)
|
|
|
|
// IFlashSwapperFlashSwapParams is an auto generated low-level Go binding around an user-defined struct.
|
|
type IFlashSwapperFlashSwapParams struct {
|
|
Token0 common.Address
|
|
Token1 common.Address
|
|
Amount0 *big.Int
|
|
Amount1 *big.Int
|
|
To common.Address
|
|
Data []byte
|
|
}
|
|
|
|
// IFlashSwapperMetaData contains all meta data concerning the IFlashSwapper contract.
|
|
var IFlashSwapperMetaData = &bind.MetaData{
|
|
ABI: "[{\"type\":\"function\",\"name\":\"calculateFlashSwapFee\",\"inputs\":[{\"name\":\"pool\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"amount0\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"amount1\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"outputs\":[{\"name\":\"fee0\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"fee1\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"executeFlashSwap\",\"inputs\":[{\"name\":\"pool\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"params\",\"type\":\"tuple\",\"internalType\":\"structIFlashSwapper.FlashSwapParams\",\"components\":[{\"name\":\"token0\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"token1\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"amount0\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"amount1\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"to\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"data\",\"type\":\"bytes\",\"internalType\":\"bytes\"}]}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"event\",\"name\":\"FlashSwapExecuted\",\"inputs\":[{\"name\":\"pool\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"token0\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"token1\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"amount0\",\"type\":\"uint256\",\"indexed\":false,\"internalType\":\"uint256\"},{\"name\":\"amount1\",\"type\":\"uint256\",\"indexed\":false,\"internalType\":\"uint256\"},{\"name\":\"to\",\"type\":\"address\",\"indexed\":false,\"internalType\":\"address\"}],\"anonymous\":false}]",
|
|
}
|
|
|
|
// IFlashSwapperABI is the input ABI used to generate the binding from.
|
|
// Deprecated: Use IFlashSwapperMetaData.ABI instead.
|
|
var IFlashSwapperABI = IFlashSwapperMetaData.ABI
|
|
|
|
// IFlashSwapper is an auto generated Go binding around an Ethereum contract.
|
|
type IFlashSwapper struct {
|
|
IFlashSwapperCaller // Read-only binding to the contract
|
|
IFlashSwapperTransactor // Write-only binding to the contract
|
|
IFlashSwapperFilterer // Log filterer for contract events
|
|
}
|
|
|
|
// IFlashSwapperCaller is an auto generated read-only Go binding around an Ethereum contract.
|
|
type IFlashSwapperCaller struct {
|
|
contract *bind.BoundContract // Generic contract wrapper for the low level calls
|
|
}
|
|
|
|
// IFlashSwapperTransactor is an auto generated write-only Go binding around an Ethereum contract.
|
|
type IFlashSwapperTransactor struct {
|
|
contract *bind.BoundContract // Generic contract wrapper for the low level calls
|
|
}
|
|
|
|
// IFlashSwapperFilterer is an auto generated log filtering Go binding around an Ethereum contract events.
|
|
type IFlashSwapperFilterer struct {
|
|
contract *bind.BoundContract // Generic contract wrapper for the low level calls
|
|
}
|
|
|
|
// IFlashSwapperSession is an auto generated Go binding around an Ethereum contract,
|
|
// with pre-set call and transact options.
|
|
type IFlashSwapperSession struct {
|
|
Contract *IFlashSwapper // 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
|
|
}
|
|
|
|
// IFlashSwapperCallerSession is an auto generated read-only Go binding around an Ethereum contract,
|
|
// with pre-set call options.
|
|
type IFlashSwapperCallerSession struct {
|
|
Contract *IFlashSwapperCaller // Generic contract caller binding to set the session for
|
|
CallOpts bind.CallOpts // Call options to use throughout this session
|
|
}
|
|
|
|
// IFlashSwapperTransactorSession is an auto generated write-only Go binding around an Ethereum contract,
|
|
// with pre-set transact options.
|
|
type IFlashSwapperTransactorSession struct {
|
|
Contract *IFlashSwapperTransactor // Generic contract transactor binding to set the session for
|
|
TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session
|
|
}
|
|
|
|
// IFlashSwapperRaw is an auto generated low-level Go binding around an Ethereum contract.
|
|
type IFlashSwapperRaw struct {
|
|
Contract *IFlashSwapper // Generic contract binding to access the raw methods on
|
|
}
|
|
|
|
// IFlashSwapperCallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract.
|
|
type IFlashSwapperCallerRaw struct {
|
|
Contract *IFlashSwapperCaller // Generic read-only contract binding to access the raw methods on
|
|
}
|
|
|
|
// IFlashSwapperTransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract.
|
|
type IFlashSwapperTransactorRaw struct {
|
|
Contract *IFlashSwapperTransactor // Generic write-only contract binding to access the raw methods on
|
|
}
|
|
|
|
// NewIFlashSwapper creates a new instance of IFlashSwapper, bound to a specific deployed contract.
|
|
func NewIFlashSwapper(address common.Address, backend bind.ContractBackend) (*IFlashSwapper, error) {
|
|
contract, err := bindIFlashSwapper(address, backend, backend, backend)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return &IFlashSwapper{IFlashSwapperCaller: IFlashSwapperCaller{contract: contract}, IFlashSwapperTransactor: IFlashSwapperTransactor{contract: contract}, IFlashSwapperFilterer: IFlashSwapperFilterer{contract: contract}}, nil
|
|
}
|
|
|
|
// NewIFlashSwapperCaller creates a new read-only instance of IFlashSwapper, bound to a specific deployed contract.
|
|
func NewIFlashSwapperCaller(address common.Address, caller bind.ContractCaller) (*IFlashSwapperCaller, error) {
|
|
contract, err := bindIFlashSwapper(address, caller, nil, nil)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return &IFlashSwapperCaller{contract: contract}, nil
|
|
}
|
|
|
|
// NewIFlashSwapperTransactor creates a new write-only instance of IFlashSwapper, bound to a specific deployed contract.
|
|
func NewIFlashSwapperTransactor(address common.Address, transactor bind.ContractTransactor) (*IFlashSwapperTransactor, error) {
|
|
contract, err := bindIFlashSwapper(address, nil, transactor, nil)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return &IFlashSwapperTransactor{contract: contract}, nil
|
|
}
|
|
|
|
// NewIFlashSwapperFilterer creates a new log filterer instance of IFlashSwapper, bound to a specific deployed contract.
|
|
func NewIFlashSwapperFilterer(address common.Address, filterer bind.ContractFilterer) (*IFlashSwapperFilterer, error) {
|
|
contract, err := bindIFlashSwapper(address, nil, nil, filterer)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return &IFlashSwapperFilterer{contract: contract}, nil
|
|
}
|
|
|
|
// bindIFlashSwapper binds a generic wrapper to an already deployed contract.
|
|
func bindIFlashSwapper(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) {
|
|
parsed, err := IFlashSwapperMetaData.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 (_IFlashSwapper *IFlashSwapperRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error {
|
|
return _IFlashSwapper.Contract.IFlashSwapperCaller.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 (_IFlashSwapper *IFlashSwapperRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {
|
|
return _IFlashSwapper.Contract.IFlashSwapperTransactor.contract.Transfer(opts)
|
|
}
|
|
|
|
// Transact invokes the (paid) contract method with params as input values.
|
|
func (_IFlashSwapper *IFlashSwapperRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) {
|
|
return _IFlashSwapper.Contract.IFlashSwapperTransactor.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 (_IFlashSwapper *IFlashSwapperCallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error {
|
|
return _IFlashSwapper.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 (_IFlashSwapper *IFlashSwapperTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {
|
|
return _IFlashSwapper.Contract.contract.Transfer(opts)
|
|
}
|
|
|
|
// Transact invokes the (paid) contract method with params as input values.
|
|
func (_IFlashSwapper *IFlashSwapperTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) {
|
|
return _IFlashSwapper.Contract.contract.Transact(opts, method, params...)
|
|
}
|
|
|
|
// CalculateFlashSwapFee is a free data retrieval call binding the contract method 0x62e0cd29.
|
|
//
|
|
// Solidity: function calculateFlashSwapFee(address pool, uint256 amount0, uint256 amount1) view returns(uint256 fee0, uint256 fee1)
|
|
func (_IFlashSwapper *IFlashSwapperCaller) CalculateFlashSwapFee(opts *bind.CallOpts, pool common.Address, amount0 *big.Int, amount1 *big.Int) (struct {
|
|
Fee0 *big.Int
|
|
Fee1 *big.Int
|
|
}, error) {
|
|
var out []interface{}
|
|
err := _IFlashSwapper.contract.Call(opts, &out, "calculateFlashSwapFee", pool, amount0, amount1)
|
|
|
|
outstruct := new(struct {
|
|
Fee0 *big.Int
|
|
Fee1 *big.Int
|
|
})
|
|
if err != nil {
|
|
return *outstruct, err
|
|
}
|
|
|
|
outstruct.Fee0 = *abi.ConvertType(out[0], new(*big.Int)).(**big.Int)
|
|
outstruct.Fee1 = *abi.ConvertType(out[1], new(*big.Int)).(**big.Int)
|
|
|
|
return *outstruct, err
|
|
|
|
}
|
|
|
|
// CalculateFlashSwapFee is a free data retrieval call binding the contract method 0x62e0cd29.
|
|
//
|
|
// Solidity: function calculateFlashSwapFee(address pool, uint256 amount0, uint256 amount1) view returns(uint256 fee0, uint256 fee1)
|
|
func (_IFlashSwapper *IFlashSwapperSession) CalculateFlashSwapFee(pool common.Address, amount0 *big.Int, amount1 *big.Int) (struct {
|
|
Fee0 *big.Int
|
|
Fee1 *big.Int
|
|
}, error) {
|
|
return _IFlashSwapper.Contract.CalculateFlashSwapFee(&_IFlashSwapper.CallOpts, pool, amount0, amount1)
|
|
}
|
|
|
|
// CalculateFlashSwapFee is a free data retrieval call binding the contract method 0x62e0cd29.
|
|
//
|
|
// Solidity: function calculateFlashSwapFee(address pool, uint256 amount0, uint256 amount1) view returns(uint256 fee0, uint256 fee1)
|
|
func (_IFlashSwapper *IFlashSwapperCallerSession) CalculateFlashSwapFee(pool common.Address, amount0 *big.Int, amount1 *big.Int) (struct {
|
|
Fee0 *big.Int
|
|
Fee1 *big.Int
|
|
}, error) {
|
|
return _IFlashSwapper.Contract.CalculateFlashSwapFee(&_IFlashSwapper.CallOpts, pool, amount0, amount1)
|
|
}
|
|
|
|
// ExecuteFlashSwap is a paid mutator transaction binding the contract method 0x87d103b2.
|
|
//
|
|
// Solidity: function executeFlashSwap(address pool, (address,address,uint256,uint256,address,bytes) params) returns()
|
|
func (_IFlashSwapper *IFlashSwapperTransactor) ExecuteFlashSwap(opts *bind.TransactOpts, pool common.Address, params IFlashSwapperFlashSwapParams) (*types.Transaction, error) {
|
|
return _IFlashSwapper.contract.Transact(opts, "executeFlashSwap", pool, params)
|
|
}
|
|
|
|
// ExecuteFlashSwap is a paid mutator transaction binding the contract method 0x87d103b2.
|
|
//
|
|
// Solidity: function executeFlashSwap(address pool, (address,address,uint256,uint256,address,bytes) params) returns()
|
|
func (_IFlashSwapper *IFlashSwapperSession) ExecuteFlashSwap(pool common.Address, params IFlashSwapperFlashSwapParams) (*types.Transaction, error) {
|
|
return _IFlashSwapper.Contract.ExecuteFlashSwap(&_IFlashSwapper.TransactOpts, pool, params)
|
|
}
|
|
|
|
// ExecuteFlashSwap is a paid mutator transaction binding the contract method 0x87d103b2.
|
|
//
|
|
// Solidity: function executeFlashSwap(address pool, (address,address,uint256,uint256,address,bytes) params) returns()
|
|
func (_IFlashSwapper *IFlashSwapperTransactorSession) ExecuteFlashSwap(pool common.Address, params IFlashSwapperFlashSwapParams) (*types.Transaction, error) {
|
|
return _IFlashSwapper.Contract.ExecuteFlashSwap(&_IFlashSwapper.TransactOpts, pool, params)
|
|
}
|
|
|
|
// IFlashSwapperFlashSwapExecutedIterator is returned from FilterFlashSwapExecuted and is used to iterate over the raw logs and unpacked data for FlashSwapExecuted events raised by the IFlashSwapper contract.
|
|
type IFlashSwapperFlashSwapExecutedIterator struct {
|
|
Event *IFlashSwapperFlashSwapExecuted // 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 *IFlashSwapperFlashSwapExecutedIterator) 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(IFlashSwapperFlashSwapExecuted)
|
|
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(IFlashSwapperFlashSwapExecuted)
|
|
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 *IFlashSwapperFlashSwapExecutedIterator) Error() error {
|
|
return it.fail
|
|
}
|
|
|
|
// Close terminates the iteration process, releasing any pending underlying
|
|
// resources.
|
|
func (it *IFlashSwapperFlashSwapExecutedIterator) Close() error {
|
|
it.sub.Unsubscribe()
|
|
return nil
|
|
}
|
|
|
|
// IFlashSwapperFlashSwapExecuted represents a FlashSwapExecuted event raised by the IFlashSwapper contract.
|
|
type IFlashSwapperFlashSwapExecuted struct {
|
|
Pool common.Address
|
|
Token0 common.Address
|
|
Token1 common.Address
|
|
Amount0 *big.Int
|
|
Amount1 *big.Int
|
|
To common.Address
|
|
Raw types.Log // Blockchain specific contextual infos
|
|
}
|
|
|
|
// FilterFlashSwapExecuted is a free log retrieval operation binding the contract event 0xbb6869143c8313bafd99561992525080ebbf80680bcb6d01e342850dcf9caa85.
|
|
//
|
|
// Solidity: event FlashSwapExecuted(address indexed pool, address indexed token0, address indexed token1, uint256 amount0, uint256 amount1, address to)
|
|
func (_IFlashSwapper *IFlashSwapperFilterer) FilterFlashSwapExecuted(opts *bind.FilterOpts, pool []common.Address, token0 []common.Address, token1 []common.Address) (*IFlashSwapperFlashSwapExecutedIterator, error) {
|
|
|
|
var poolRule []interface{}
|
|
for _, poolItem := range pool {
|
|
poolRule = append(poolRule, poolItem)
|
|
}
|
|
var token0Rule []interface{}
|
|
for _, token0Item := range token0 {
|
|
token0Rule = append(token0Rule, token0Item)
|
|
}
|
|
var token1Rule []interface{}
|
|
for _, token1Item := range token1 {
|
|
token1Rule = append(token1Rule, token1Item)
|
|
}
|
|
|
|
logs, sub, err := _IFlashSwapper.contract.FilterLogs(opts, "FlashSwapExecuted", poolRule, token0Rule, token1Rule)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return &IFlashSwapperFlashSwapExecutedIterator{contract: _IFlashSwapper.contract, event: "FlashSwapExecuted", logs: logs, sub: sub}, nil
|
|
}
|
|
|
|
// WatchFlashSwapExecuted is a free log subscription operation binding the contract event 0xbb6869143c8313bafd99561992525080ebbf80680bcb6d01e342850dcf9caa85.
|
|
//
|
|
// Solidity: event FlashSwapExecuted(address indexed pool, address indexed token0, address indexed token1, uint256 amount0, uint256 amount1, address to)
|
|
func (_IFlashSwapper *IFlashSwapperFilterer) WatchFlashSwapExecuted(opts *bind.WatchOpts, sink chan<- *IFlashSwapperFlashSwapExecuted, pool []common.Address, token0 []common.Address, token1 []common.Address) (event.Subscription, error) {
|
|
|
|
var poolRule []interface{}
|
|
for _, poolItem := range pool {
|
|
poolRule = append(poolRule, poolItem)
|
|
}
|
|
var token0Rule []interface{}
|
|
for _, token0Item := range token0 {
|
|
token0Rule = append(token0Rule, token0Item)
|
|
}
|
|
var token1Rule []interface{}
|
|
for _, token1Item := range token1 {
|
|
token1Rule = append(token1Rule, token1Item)
|
|
}
|
|
|
|
logs, sub, err := _IFlashSwapper.contract.WatchLogs(opts, "FlashSwapExecuted", poolRule, token0Rule, token1Rule)
|
|
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(IFlashSwapperFlashSwapExecuted)
|
|
if err := _IFlashSwapper.contract.UnpackLog(event, "FlashSwapExecuted", 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
|
|
}
|
|
|
|
// ParseFlashSwapExecuted is a log parse operation binding the contract event 0xbb6869143c8313bafd99561992525080ebbf80680bcb6d01e342850dcf9caa85.
|
|
//
|
|
// Solidity: event FlashSwapExecuted(address indexed pool, address indexed token0, address indexed token1, uint256 amount0, uint256 amount1, address to)
|
|
func (_IFlashSwapper *IFlashSwapperFilterer) ParseFlashSwapExecuted(log types.Log) (*IFlashSwapperFlashSwapExecuted, error) {
|
|
event := new(IFlashSwapperFlashSwapExecuted)
|
|
if err := _IFlashSwapper.contract.UnpackLog(event, "FlashSwapExecuted", log); err != nil {
|
|
return nil, err
|
|
}
|
|
event.Raw = log
|
|
return event, nil
|
|
}
|