bank

package
v0.0.0-...-8776a6a Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 28, 2024 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ZRC20DenomPrefix are ZRC20 cosmos coins prefix.
	ZRC20DenomPrefix = "zrc20/"

	// Write methods.
	DepositMethodName = "deposit"
	DepositMethodGas  = 200_000
	DepositEventName  = "Deposit"

	WithdrawMethodName = "withdraw"
	WithdrawMethodGas  = 200_000
	WithdrawEventName  = "Withdraw"

	// Read methods.
	BalanceOfMethodName = "balanceOf"
	BalanceOfGas        = 10_000

	// Default gas for unknown methods.
	DefaultGas = 0
)

Variables

View Source
var (
	ABI                 abi.ABI
	ContractAddress     = common.HexToAddress("0x0000000000000000000000000000000000000067")
	GasRequiredByMethod = map[[4]byte]uint64{}
	ViewMethod          = map[[4]byte]bool{}
)
View Source
var IBankABI = IBankMetaData.ABI

IBankABI is the input ABI used to generate the binding from. Deprecated: Use IBankMetaData.ABI instead.

View Source
var IBankMetaData = &bind.MetaData{
	ABI: "[{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"zrc20_depositor\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"zrc20_token\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"string\",\"name\":\"cosmos_token\",\"type\":\"string\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"cosmos_address\",\"type\":\"string\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"Deposit\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"zrc20_withdrawer\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"zrc20_token\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"string\",\"name\":\"cosmos_token\",\"type\":\"string\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"cosmos_address\",\"type\":\"string\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"Withdraw\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"zrc20\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"user\",\"type\":\"address\"}],\"name\":\"balanceOf\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"balance\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"zrc20\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"deposit\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"success\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"zrc20\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"withdraw\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"success\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]",
}

IBankMetaData contains all meta data concerning the IBank contract.

Functions

func ZRC20ToCosmosDenom

func ZRC20ToCosmosDenom(ZRC20Address common.Address) string

ZRC20ToCosmosDenom returns the cosmos coin address for a given ZRC20 address. This is converted to "zevm/{ZRC20Address}".

Types

type Contract

type Contract struct {
	ptypes.BaseContract
	// contains filtered or unexported fields
}

func NewIBankContract

func NewIBankContract(
	ctx sdk.Context,
	bankKeeper bank.Keeper,
	fungibleKeeper fungiblekeeper.Keeper,
	cdc codec.Codec,
	kvGasConfig storetypes.GasConfig,
) *Contract

func (*Contract) Abi

func (c *Contract) Abi() abi.ABI

Abi() is required to implement the PrecompiledContract interface.

func (*Contract) Address

func (c *Contract) Address() common.Address

Address() is required to implement the PrecompiledContract interface.

func (*Contract) RequiredGas

func (c *Contract) RequiredGas(input []byte) uint64

RequiredGas is required to implement the PrecompiledContract interface. The gas has to be calculated deterministically based on the input.

func (*Contract) Run

func (c *Contract) Run(evm *vm.EVM, contract *vm.Contract, readOnly bool) ([]byte, error)

Run is the entrypoint of the precompiled contract, it switches over the input method, and execute them accordingly.

type IBank

type IBank struct {
	IBankCaller     // Read-only binding to the contract
	IBankTransactor // Write-only binding to the contract
	IBankFilterer   // Log filterer for contract events
}

IBank is an auto generated Go binding around an Ethereum contract.

func NewIBank

func NewIBank(address common.Address, backend bind.ContractBackend) (*IBank, error)

NewIBank creates a new instance of IBank, bound to a specific deployed contract.

type IBankCaller

type IBankCaller struct {
	// contains filtered or unexported fields
}

IBankCaller is an auto generated read-only Go binding around an Ethereum contract.

func NewIBankCaller

func NewIBankCaller(address common.Address, caller bind.ContractCaller) (*IBankCaller, error)

NewIBankCaller creates a new read-only instance of IBank, bound to a specific deployed contract.

func (*IBankCaller) BalanceOf

func (_IBank *IBankCaller) BalanceOf(opts *bind.CallOpts, zrc20 common.Address, user common.Address) (*big.Int, error)

BalanceOf is a free data retrieval call binding the contract method 0xf7888aec.

Solidity: function balanceOf(address zrc20, address user) view returns(uint256 balance)

type IBankCallerRaw

type IBankCallerRaw struct {
	Contract *IBankCaller // Generic read-only contract binding to access the raw methods on
}

IBankCallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract.

func (*IBankCallerRaw) Call

func (_IBank *IBankCallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error

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.

type IBankCallerSession

type IBankCallerSession struct {
	Contract *IBankCaller  // Generic contract caller binding to set the session for
	CallOpts bind.CallOpts // Call options to use throughout this session
}

IBankCallerSession is an auto generated read-only Go binding around an Ethereum contract, with pre-set call options.

func (*IBankCallerSession) BalanceOf

func (_IBank *IBankCallerSession) BalanceOf(zrc20 common.Address, user common.Address) (*big.Int, error)

BalanceOf is a free data retrieval call binding the contract method 0xf7888aec.

Solidity: function balanceOf(address zrc20, address user) view returns(uint256 balance)

type IBankDeposit

type IBankDeposit struct {
	Zrc20Depositor common.Address
	Zrc20Token     common.Address
	CosmosToken    common.Hash
	CosmosAddress  string
	Amount         *big.Int
	Raw            types.Log // Blockchain specific contextual infos
}

IBankDeposit represents a Deposit event raised by the IBank contract.

type IBankDepositIterator

type IBankDepositIterator struct {
	Event *IBankDeposit // Event containing the contract specifics and raw log
	// contains filtered or unexported fields
}

IBankDepositIterator is returned from FilterDeposit and is used to iterate over the raw logs and unpacked data for Deposit events raised by the IBank contract.

func (*IBankDepositIterator) Close

func (it *IBankDepositIterator) Close() error

Close terminates the iteration process, releasing any pending underlying resources.

func (*IBankDepositIterator) Error

func (it *IBankDepositIterator) Error() error

Error returns any retrieval or parsing error occurred during filtering.

func (*IBankDepositIterator) Next

func (it *IBankDepositIterator) Next() bool

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.

type IBankFilterer

type IBankFilterer struct {
	// contains filtered or unexported fields
}

IBankFilterer is an auto generated log filtering Go binding around an Ethereum contract events.

func NewIBankFilterer

func NewIBankFilterer(address common.Address, filterer bind.ContractFilterer) (*IBankFilterer, error)

NewIBankFilterer creates a new log filterer instance of IBank, bound to a specific deployed contract.

func (*IBankFilterer) FilterDeposit

func (_IBank *IBankFilterer) FilterDeposit(opts *bind.FilterOpts, zrc20_depositor []common.Address, zrc20_token []common.Address, cosmos_token []string) (*IBankDepositIterator, error)

FilterDeposit is a free log retrieval operation binding the contract event 0xbd7d4de0b30a306221956a420cad57737ae9c1ee63072c96a4f1ab81e6eea264.

Solidity: event Deposit(address indexed zrc20_depositor, address indexed zrc20_token, string indexed cosmos_token, string cosmos_address, uint256 amount)

func (*IBankFilterer) FilterWithdraw

func (_IBank *IBankFilterer) FilterWithdraw(opts *bind.FilterOpts, zrc20_withdrawer []common.Address, zrc20_token []common.Address, cosmos_token []string) (*IBankWithdrawIterator, error)

FilterWithdraw is a free log retrieval operation binding the contract event 0x1ad70707c91d850319aeab00514a0166569359f0b8dc5285bdd6e6b9c464b18e.

Solidity: event Withdraw(address indexed zrc20_withdrawer, address indexed zrc20_token, string indexed cosmos_token, string cosmos_address, uint256 amount)

func (*IBankFilterer) ParseDeposit

func (_IBank *IBankFilterer) ParseDeposit(log types.Log) (*IBankDeposit, error)

ParseDeposit is a log parse operation binding the contract event 0xbd7d4de0b30a306221956a420cad57737ae9c1ee63072c96a4f1ab81e6eea264.

Solidity: event Deposit(address indexed zrc20_depositor, address indexed zrc20_token, string indexed cosmos_token, string cosmos_address, uint256 amount)

func (*IBankFilterer) ParseWithdraw

func (_IBank *IBankFilterer) ParseWithdraw(log types.Log) (*IBankWithdraw, error)

ParseWithdraw is a log parse operation binding the contract event 0x1ad70707c91d850319aeab00514a0166569359f0b8dc5285bdd6e6b9c464b18e.

Solidity: event Withdraw(address indexed zrc20_withdrawer, address indexed zrc20_token, string indexed cosmos_token, string cosmos_address, uint256 amount)

func (*IBankFilterer) WatchDeposit

func (_IBank *IBankFilterer) WatchDeposit(opts *bind.WatchOpts, sink chan<- *IBankDeposit, zrc20_depositor []common.Address, zrc20_token []common.Address, cosmos_token []string) (event.Subscription, error)

WatchDeposit is a free log subscription operation binding the contract event 0xbd7d4de0b30a306221956a420cad57737ae9c1ee63072c96a4f1ab81e6eea264.

Solidity: event Deposit(address indexed zrc20_depositor, address indexed zrc20_token, string indexed cosmos_token, string cosmos_address, uint256 amount)

func (*IBankFilterer) WatchWithdraw

func (_IBank *IBankFilterer) WatchWithdraw(opts *bind.WatchOpts, sink chan<- *IBankWithdraw, zrc20_withdrawer []common.Address, zrc20_token []common.Address, cosmos_token []string) (event.Subscription, error)

WatchWithdraw is a free log subscription operation binding the contract event 0x1ad70707c91d850319aeab00514a0166569359f0b8dc5285bdd6e6b9c464b18e.

Solidity: event Withdraw(address indexed zrc20_withdrawer, address indexed zrc20_token, string indexed cosmos_token, string cosmos_address, uint256 amount)

type IBankRaw

type IBankRaw struct {
	Contract *IBank // Generic contract binding to access the raw methods on
}

IBankRaw is an auto generated low-level Go binding around an Ethereum contract.

func (*IBankRaw) Call

func (_IBank *IBankRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error

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 (*IBankRaw) Transact

func (_IBank *IBankRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error)

Transact invokes the (paid) contract method with params as input values.

func (*IBankRaw) Transfer

func (_IBank *IBankRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error)

Transfer initiates a plain transaction to move funds to the contract, calling its default method if one is available.

type IBankSession

type IBankSession struct {
	Contract     *IBank            // 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
}

IBankSession is an auto generated Go binding around an Ethereum contract, with pre-set call and transact options.

func (*IBankSession) BalanceOf

func (_IBank *IBankSession) BalanceOf(zrc20 common.Address, user common.Address) (*big.Int, error)

BalanceOf is a free data retrieval call binding the contract method 0xf7888aec.

Solidity: function balanceOf(address zrc20, address user) view returns(uint256 balance)

func (*IBankSession) Deposit

func (_IBank *IBankSession) Deposit(zrc20 common.Address, amount *big.Int) (*types.Transaction, error)

Deposit is a paid mutator transaction binding the contract method 0x47e7ef24.

Solidity: function deposit(address zrc20, uint256 amount) returns(bool success)

func (*IBankSession) Withdraw

func (_IBank *IBankSession) Withdraw(zrc20 common.Address, amount *big.Int) (*types.Transaction, error)

Withdraw is a paid mutator transaction binding the contract method 0xf3fef3a3.

Solidity: function withdraw(address zrc20, uint256 amount) returns(bool success)

type IBankTransactor

type IBankTransactor struct {
	// contains filtered or unexported fields
}

IBankTransactor is an auto generated write-only Go binding around an Ethereum contract.

func NewIBankTransactor

func NewIBankTransactor(address common.Address, transactor bind.ContractTransactor) (*IBankTransactor, error)

NewIBankTransactor creates a new write-only instance of IBank, bound to a specific deployed contract.

func (*IBankTransactor) Deposit

func (_IBank *IBankTransactor) Deposit(opts *bind.TransactOpts, zrc20 common.Address, amount *big.Int) (*types.Transaction, error)

Deposit is a paid mutator transaction binding the contract method 0x47e7ef24.

Solidity: function deposit(address zrc20, uint256 amount) returns(bool success)

func (*IBankTransactor) Withdraw

func (_IBank *IBankTransactor) Withdraw(opts *bind.TransactOpts, zrc20 common.Address, amount *big.Int) (*types.Transaction, error)

Withdraw is a paid mutator transaction binding the contract method 0xf3fef3a3.

Solidity: function withdraw(address zrc20, uint256 amount) returns(bool success)

type IBankTransactorRaw

type IBankTransactorRaw struct {
	Contract *IBankTransactor // Generic write-only contract binding to access the raw methods on
}

IBankTransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract.

func (*IBankTransactorRaw) Transact

func (_IBank *IBankTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error)

Transact invokes the (paid) contract method with params as input values.

func (*IBankTransactorRaw) Transfer

func (_IBank *IBankTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error)

Transfer initiates a plain transaction to move funds to the contract, calling its default method if one is available.

type IBankTransactorSession

type IBankTransactorSession struct {
	Contract     *IBankTransactor  // Generic contract transactor binding to set the session for
	TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session
}

IBankTransactorSession is an auto generated write-only Go binding around an Ethereum contract, with pre-set transact options.

func (*IBankTransactorSession) Deposit

func (_IBank *IBankTransactorSession) Deposit(zrc20 common.Address, amount *big.Int) (*types.Transaction, error)

Deposit is a paid mutator transaction binding the contract method 0x47e7ef24.

Solidity: function deposit(address zrc20, uint256 amount) returns(bool success)

func (*IBankTransactorSession) Withdraw

func (_IBank *IBankTransactorSession) Withdraw(zrc20 common.Address, amount *big.Int) (*types.Transaction, error)

Withdraw is a paid mutator transaction binding the contract method 0xf3fef3a3.

Solidity: function withdraw(address zrc20, uint256 amount) returns(bool success)

type IBankWithdraw

type IBankWithdraw struct {
	Zrc20Withdrawer common.Address
	Zrc20Token      common.Address
	CosmosToken     common.Hash
	CosmosAddress   string
	Amount          *big.Int
	Raw             types.Log // Blockchain specific contextual infos
}

IBankWithdraw represents a Withdraw event raised by the IBank contract.

type IBankWithdrawIterator

type IBankWithdrawIterator struct {
	Event *IBankWithdraw // Event containing the contract specifics and raw log
	// contains filtered or unexported fields
}

IBankWithdrawIterator is returned from FilterWithdraw and is used to iterate over the raw logs and unpacked data for Withdraw events raised by the IBank contract.

func (*IBankWithdrawIterator) Close

func (it *IBankWithdrawIterator) Close() error

Close terminates the iteration process, releasing any pending underlying resources.

func (*IBankWithdrawIterator) Error

func (it *IBankWithdrawIterator) Error() error

Error returns any retrieval or parsing error occurred during filtering.

func (*IBankWithdrawIterator) Next

func (it *IBankWithdrawIterator) Next() bool

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL