evm/aave/contracts/lendingpool.go

330 lines
19 KiB
Go

// Code generated - DO NOT EDIT.
// This file is a generated binding and any manual changes will be lost.
package contracts
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
)
// LendingPoolMetaData contains all meta data concerning the LendingPool contract.
var LendingPoolMetaData = &bind.MetaData{
ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"asset\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"interestRateMode\",\"type\":\"uint256\"},{\"internalType\":\"uint16\",\"name\":\"referralCode\",\"type\":\"uint16\"},{\"internalType\":\"address\",\"name\":\"onBehalfOf\",\"type\":\"address\"}],\"name\":\"borrow\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"asset\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"onBehalfOf\",\"type\":\"address\"},{\"internalType\":\"uint16\",\"name\":\"referralCode\",\"type\":\"uint16\"}],\"name\":\"deposit\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"user\",\"type\":\"address\"}],\"name\":\"getUserAccountData\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"totalCollateralETH\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"totalDebtETH\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"availableBorrowsETH\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"currentLiquidationThreshold\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"ltv\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"healthFactor\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"asset\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"rateMode\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"onBehalfOf\",\"type\":\"address\"}],\"name\":\"repay\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"asset\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"}],\"name\":\"withdraw\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]",
}
// LendingPoolABI is the input ABI used to generate the binding from.
// Deprecated: Use LendingPoolMetaData.ABI instead.
var LendingPoolABI = LendingPoolMetaData.ABI
// LendingPool is an auto generated Go binding around an Ethereum contract.
type LendingPool struct {
LendingPoolCaller // Read-only binding to the contract
LendingPoolTransactor // Write-only binding to the contract
LendingPoolFilterer // Log filterer for contract events
}
// LendingPoolCaller is an auto generated read-only Go binding around an Ethereum contract.
type LendingPoolCaller struct {
contract *bind.BoundContract // Generic contract wrapper for the low level calls
}
// LendingPoolTransactor is an auto generated write-only Go binding around an Ethereum contract.
type LendingPoolTransactor struct {
contract *bind.BoundContract // Generic contract wrapper for the low level calls
}
// LendingPoolFilterer is an auto generated log filtering Go binding around an Ethereum contract events.
type LendingPoolFilterer struct {
contract *bind.BoundContract // Generic contract wrapper for the low level calls
}
// LendingPoolSession is an auto generated Go binding around an Ethereum contract,
// with pre-set call and transact options.
type LendingPoolSession struct {
Contract *LendingPool // 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
}
// LendingPoolCallerSession is an auto generated read-only Go binding around an Ethereum contract,
// with pre-set call options.
type LendingPoolCallerSession struct {
Contract *LendingPoolCaller // Generic contract caller binding to set the session for
CallOpts bind.CallOpts // Call options to use throughout this session
}
// LendingPoolTransactorSession is an auto generated write-only Go binding around an Ethereum contract,
// with pre-set transact options.
type LendingPoolTransactorSession struct {
Contract *LendingPoolTransactor // Generic contract transactor binding to set the session for
TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session
}
// LendingPoolRaw is an auto generated low-level Go binding around an Ethereum contract.
type LendingPoolRaw struct {
Contract *LendingPool // Generic contract binding to access the raw methods on
}
// LendingPoolCallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract.
type LendingPoolCallerRaw struct {
Contract *LendingPoolCaller // Generic read-only contract binding to access the raw methods on
}
// LendingPoolTransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract.
type LendingPoolTransactorRaw struct {
Contract *LendingPoolTransactor // Generic write-only contract binding to access the raw methods on
}
// NewLendingPool creates a new instance of LendingPool, bound to a specific deployed contract.
func NewLendingPool(address common.Address, backend bind.ContractBackend) (*LendingPool, error) {
contract, err := bindLendingPool(address, backend, backend, backend)
if err != nil {
return nil, err
}
return &LendingPool{LendingPoolCaller: LendingPoolCaller{contract: contract}, LendingPoolTransactor: LendingPoolTransactor{contract: contract}, LendingPoolFilterer: LendingPoolFilterer{contract: contract}}, nil
}
// NewLendingPoolCaller creates a new read-only instance of LendingPool, bound to a specific deployed contract.
func NewLendingPoolCaller(address common.Address, caller bind.ContractCaller) (*LendingPoolCaller, error) {
contract, err := bindLendingPool(address, caller, nil, nil)
if err != nil {
return nil, err
}
return &LendingPoolCaller{contract: contract}, nil
}
// NewLendingPoolTransactor creates a new write-only instance of LendingPool, bound to a specific deployed contract.
func NewLendingPoolTransactor(address common.Address, transactor bind.ContractTransactor) (*LendingPoolTransactor, error) {
contract, err := bindLendingPool(address, nil, transactor, nil)
if err != nil {
return nil, err
}
return &LendingPoolTransactor{contract: contract}, nil
}
// NewLendingPoolFilterer creates a new log filterer instance of LendingPool, bound to a specific deployed contract.
func NewLendingPoolFilterer(address common.Address, filterer bind.ContractFilterer) (*LendingPoolFilterer, error) {
contract, err := bindLendingPool(address, nil, nil, filterer)
if err != nil {
return nil, err
}
return &LendingPoolFilterer{contract: contract}, nil
}
// bindLendingPool binds a generic wrapper to an already deployed contract.
func bindLendingPool(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) {
parsed, err := abi.JSON(strings.NewReader(LendingPoolABI))
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 (_LendingPool *LendingPoolRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error {
return _LendingPool.Contract.LendingPoolCaller.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 (_LendingPool *LendingPoolRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {
return _LendingPool.Contract.LendingPoolTransactor.contract.Transfer(opts)
}
// Transact invokes the (paid) contract method with params as input values.
func (_LendingPool *LendingPoolRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) {
return _LendingPool.Contract.LendingPoolTransactor.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 (_LendingPool *LendingPoolCallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error {
return _LendingPool.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 (_LendingPool *LendingPoolTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {
return _LendingPool.Contract.contract.Transfer(opts)
}
// Transact invokes the (paid) contract method with params as input values.
func (_LendingPool *LendingPoolTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) {
return _LendingPool.Contract.contract.Transact(opts, method, params...)
}
// GetUserAccountData is a free data retrieval call binding the contract method 0xbf92857c.
//
// Solidity: function getUserAccountData(address user) view returns(uint256 totalCollateralETH, uint256 totalDebtETH, uint256 availableBorrowsETH, uint256 currentLiquidationThreshold, uint256 ltv, uint256 healthFactor)
func (_LendingPool *LendingPoolCaller) GetUserAccountData(opts *bind.CallOpts, user common.Address) (struct {
TotalCollateralETH *big.Int
TotalDebtETH *big.Int
AvailableBorrowsETH *big.Int
CurrentLiquidationThreshold *big.Int
Ltv *big.Int
HealthFactor *big.Int
}, error) {
var out []interface{}
err := _LendingPool.contract.Call(opts, &out, "getUserAccountData", user)
outstruct := new(struct {
TotalCollateralETH *big.Int
TotalDebtETH *big.Int
AvailableBorrowsETH *big.Int
CurrentLiquidationThreshold *big.Int
Ltv *big.Int
HealthFactor *big.Int
})
if err != nil {
return *outstruct, err
}
outstruct.TotalCollateralETH = *abi.ConvertType(out[0], new(*big.Int)).(**big.Int)
outstruct.TotalDebtETH = *abi.ConvertType(out[1], new(*big.Int)).(**big.Int)
outstruct.AvailableBorrowsETH = *abi.ConvertType(out[2], new(*big.Int)).(**big.Int)
outstruct.CurrentLiquidationThreshold = *abi.ConvertType(out[3], new(*big.Int)).(**big.Int)
outstruct.Ltv = *abi.ConvertType(out[4], new(*big.Int)).(**big.Int)
outstruct.HealthFactor = *abi.ConvertType(out[5], new(*big.Int)).(**big.Int)
return *outstruct, err
}
// GetUserAccountData is a free data retrieval call binding the contract method 0xbf92857c.
//
// Solidity: function getUserAccountData(address user) view returns(uint256 totalCollateralETH, uint256 totalDebtETH, uint256 availableBorrowsETH, uint256 currentLiquidationThreshold, uint256 ltv, uint256 healthFactor)
func (_LendingPool *LendingPoolSession) GetUserAccountData(user common.Address) (struct {
TotalCollateralETH *big.Int
TotalDebtETH *big.Int
AvailableBorrowsETH *big.Int
CurrentLiquidationThreshold *big.Int
Ltv *big.Int
HealthFactor *big.Int
}, error) {
return _LendingPool.Contract.GetUserAccountData(&_LendingPool.CallOpts, user)
}
// GetUserAccountData is a free data retrieval call binding the contract method 0xbf92857c.
//
// Solidity: function getUserAccountData(address user) view returns(uint256 totalCollateralETH, uint256 totalDebtETH, uint256 availableBorrowsETH, uint256 currentLiquidationThreshold, uint256 ltv, uint256 healthFactor)
func (_LendingPool *LendingPoolCallerSession) GetUserAccountData(user common.Address) (struct {
TotalCollateralETH *big.Int
TotalDebtETH *big.Int
AvailableBorrowsETH *big.Int
CurrentLiquidationThreshold *big.Int
Ltv *big.Int
HealthFactor *big.Int
}, error) {
return _LendingPool.Contract.GetUserAccountData(&_LendingPool.CallOpts, user)
}
// Borrow is a paid mutator transaction binding the contract method 0xa415bcad.
//
// Solidity: function borrow(address asset, uint256 amount, uint256 interestRateMode, uint16 referralCode, address onBehalfOf) returns()
func (_LendingPool *LendingPoolTransactor) Borrow(opts *bind.TransactOpts, asset common.Address, amount *big.Int, interestRateMode *big.Int, referralCode uint16, onBehalfOf common.Address) (*types.Transaction, error) {
return _LendingPool.contract.Transact(opts, "borrow", asset, amount, interestRateMode, referralCode, onBehalfOf)
}
// Borrow is a paid mutator transaction binding the contract method 0xa415bcad.
//
// Solidity: function borrow(address asset, uint256 amount, uint256 interestRateMode, uint16 referralCode, address onBehalfOf) returns()
func (_LendingPool *LendingPoolSession) Borrow(asset common.Address, amount *big.Int, interestRateMode *big.Int, referralCode uint16, onBehalfOf common.Address) (*types.Transaction, error) {
return _LendingPool.Contract.Borrow(&_LendingPool.TransactOpts, asset, amount, interestRateMode, referralCode, onBehalfOf)
}
// Borrow is a paid mutator transaction binding the contract method 0xa415bcad.
//
// Solidity: function borrow(address asset, uint256 amount, uint256 interestRateMode, uint16 referralCode, address onBehalfOf) returns()
func (_LendingPool *LendingPoolTransactorSession) Borrow(asset common.Address, amount *big.Int, interestRateMode *big.Int, referralCode uint16, onBehalfOf common.Address) (*types.Transaction, error) {
return _LendingPool.Contract.Borrow(&_LendingPool.TransactOpts, asset, amount, interestRateMode, referralCode, onBehalfOf)
}
// Deposit is a paid mutator transaction binding the contract method 0xe8eda9df.
//
// Solidity: function deposit(address asset, uint256 amount, address onBehalfOf, uint16 referralCode) returns()
func (_LendingPool *LendingPoolTransactor) Deposit(opts *bind.TransactOpts, asset common.Address, amount *big.Int, onBehalfOf common.Address, referralCode uint16) (*types.Transaction, error) {
return _LendingPool.contract.Transact(opts, "deposit", asset, amount, onBehalfOf, referralCode)
}
// Deposit is a paid mutator transaction binding the contract method 0xe8eda9df.
//
// Solidity: function deposit(address asset, uint256 amount, address onBehalfOf, uint16 referralCode) returns()
func (_LendingPool *LendingPoolSession) Deposit(asset common.Address, amount *big.Int, onBehalfOf common.Address, referralCode uint16) (*types.Transaction, error) {
return _LendingPool.Contract.Deposit(&_LendingPool.TransactOpts, asset, amount, onBehalfOf, referralCode)
}
// Deposit is a paid mutator transaction binding the contract method 0xe8eda9df.
//
// Solidity: function deposit(address asset, uint256 amount, address onBehalfOf, uint16 referralCode) returns()
func (_LendingPool *LendingPoolTransactorSession) Deposit(asset common.Address, amount *big.Int, onBehalfOf common.Address, referralCode uint16) (*types.Transaction, error) {
return _LendingPool.Contract.Deposit(&_LendingPool.TransactOpts, asset, amount, onBehalfOf, referralCode)
}
// Repay is a paid mutator transaction binding the contract method 0x573ade81.
//
// Solidity: function repay(address asset, uint256 amount, uint256 rateMode, address onBehalfOf) returns(uint256)
func (_LendingPool *LendingPoolTransactor) Repay(opts *bind.TransactOpts, asset common.Address, amount *big.Int, rateMode *big.Int, onBehalfOf common.Address) (*types.Transaction, error) {
return _LendingPool.contract.Transact(opts, "repay", asset, amount, rateMode, onBehalfOf)
}
// Repay is a paid mutator transaction binding the contract method 0x573ade81.
//
// Solidity: function repay(address asset, uint256 amount, uint256 rateMode, address onBehalfOf) returns(uint256)
func (_LendingPool *LendingPoolSession) Repay(asset common.Address, amount *big.Int, rateMode *big.Int, onBehalfOf common.Address) (*types.Transaction, error) {
return _LendingPool.Contract.Repay(&_LendingPool.TransactOpts, asset, amount, rateMode, onBehalfOf)
}
// Repay is a paid mutator transaction binding the contract method 0x573ade81.
//
// Solidity: function repay(address asset, uint256 amount, uint256 rateMode, address onBehalfOf) returns(uint256)
func (_LendingPool *LendingPoolTransactorSession) Repay(asset common.Address, amount *big.Int, rateMode *big.Int, onBehalfOf common.Address) (*types.Transaction, error) {
return _LendingPool.Contract.Repay(&_LendingPool.TransactOpts, asset, amount, rateMode, onBehalfOf)
}
// Withdraw is a paid mutator transaction binding the contract method 0x69328dec.
//
// Solidity: function withdraw(address asset, uint256 amount, address to) returns(uint256)
func (_LendingPool *LendingPoolTransactor) Withdraw(opts *bind.TransactOpts, asset common.Address, amount *big.Int, to common.Address) (*types.Transaction, error) {
return _LendingPool.contract.Transact(opts, "withdraw", asset, amount, to)
}
// Withdraw is a paid mutator transaction binding the contract method 0x69328dec.
//
// Solidity: function withdraw(address asset, uint256 amount, address to) returns(uint256)
func (_LendingPool *LendingPoolSession) Withdraw(asset common.Address, amount *big.Int, to common.Address) (*types.Transaction, error) {
return _LendingPool.Contract.Withdraw(&_LendingPool.TransactOpts, asset, amount, to)
}
// Withdraw is a paid mutator transaction binding the contract method 0x69328dec.
//
// Solidity: function withdraw(address asset, uint256 amount, address to) returns(uint256)
func (_LendingPool *LendingPoolTransactorSession) Withdraw(asset common.Address, amount *big.Int, to common.Address) (*types.Transaction, error) {
return _LendingPool.Contract.Withdraw(&_LendingPool.TransactOpts, asset, amount, to)
}