relayer

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2022 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrSourceBlockAhead is returned when the source blocks are ahead of the destination blocks
	ErrSourceBlockAhead = errors.New("source block must have a timestamp less than the last destination block")
	// ErrInvalidBlockHeight is returned when an invalid block height is added
	ErrInvalidBlockHeight = errors.New("block height must be 1 greater than last block")
	// ErrInvalidBlockTime is returned when an invalid block time is added
	ErrInvalidBlockTime = errors.New("timestamp must be greater than last timestamp")
	// ErrUnkownBlockOrigin is returned when in invalid block origin is added
	ErrUnknownBlockOrigin = errors.New("unknown block type")
)
View Source
var BridgeABI = BridgeMetaData.ABI

BridgeABI is the input ABI used to generate the binding from. Deprecated: Use BridgeMetaData.ABI instead.

View Source
var BridgeBin = BridgeMetaData.Bin

BridgeBin is the compiled bytecode used for deploying new contracts. Deprecated: Use BridgeMetaData.Bin instead.

View Source
var BridgeMetaData = &bind.MetaData{
	ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"relayer_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"toKavaAddr\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"lockSequence\",\"type\":\"uint256\"}],\"name\":\"Lock\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"toAddr\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"unlockSequence\",\"type\":\"uint256\"}],\"name\":\"Unlock\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"toKavaAddr\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"lock\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"relayer\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"toAddr\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"unlockSequence\",\"type\":\"uint256\"}],\"name\":\"unlock\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]",
	Bin: "0x608060405234801561001057600080fd5b506040516107a23803806107a283398101604081905261002f9161005d565b600160008181559055600280546001600160a01b0319166001600160a01b039290921691909117905561008d565b60006020828403121561006f57600080fd5b81516001600160a01b038116811461008657600080fd5b9392505050565b6107068061009c6000396000f3fe608060405234801561001057600080fd5b50600436106100415760003560e01c80634202e907146100465780637750c9f01461005b5780638406c0791461006e575b600080fd5b6100596100543660046105b5565b61008d565b005b6100596100693660046105f7565b6101b9565b600254604080516001600160a01b039092168252519081900360200190f35b600260005414156100e55760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064015b60405180910390fd5b60026000819055546001600160a01b031633146101445760405162461bcd60e51b815260206004820152601960248201527f4272696467653a20756e7472757374656420616464726573730000000000000060448201526064016100dc565b6101586001600160a01b038516848461029e565b826001600160a01b0316846001600160a01b03167fc1640cf787ea538af4a68163da63c6da8b4577194278080f5b040a75df00389984846040516101a6929190918252602082015260400190565b60405180910390a3505060016000555050565b6002600054141561020c5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016100dc565b600260005561021e6001805481019055565b6102336001600160a01b038416333084610306565b816001600160a01b0316336001600160a01b0316846001600160a01b03167f749e347e95185169edffb86e003abcbf08f3510641663b00600acf707f098f478461027c60015490565b6040805192835260208301919091520160405180910390a45050600160005550565b6040516001600160a01b03831660248201526044810182905261030190849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152610344565b505050565b6040516001600160a01b038085166024830152831660448201526064810182905261033e9085906323b872dd60e01b906084016102ca565b50505050565b6000610399826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166104169092919063ffffffff16565b80519091501561030157808060200190518101906103b79190610633565b6103015760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016100dc565b6060610425848460008561042f565b90505b9392505050565b6060824710156104905760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b60648201526084016100dc565b6001600160a01b0385163b6104e75760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016100dc565b600080866001600160a01b031685876040516105039190610681565b60006040518083038185875af1925050503d8060008114610540576040519150601f19603f3d011682016040523d82523d6000602084013e610545565b606091505b5091509150610555828286610560565b979650505050505050565b6060831561056f575081610428565b82511561057f5782518084602001fd5b8160405162461bcd60e51b81526004016100dc919061069d565b80356001600160a01b03811681146105b057600080fd5b919050565b600080600080608085870312156105cb57600080fd5b6105d485610599565b93506105e260208601610599565b93969395505050506040820135916060013590565b60008060006060848603121561060c57600080fd5b61061584610599565b925061062360208501610599565b9150604084013590509250925092565b60006020828403121561064557600080fd5b8151801515811461042857600080fd5b60005b83811015610670578181015183820152602001610658565b8381111561033e5750506000910152565b60008251610693818460208701610655565b9190910192915050565b60208152600082518060208401526106bc816040850160208701610655565b601f01601f1916919091016040019291505056fea2646970667358221220b5376e1fd0eccc27196aa613da565619399b75112f6b6ea195dc52e3685e7c2864736f6c63430008090033",
}

BridgeMetaData contains all meta data concerning the Bridge contract.

View Source
var ERC20ABI = ERC20MetaData.ABI

ERC20ABI is the input ABI used to generate the binding from. Deprecated: Use ERC20MetaData.ABI instead.

View Source
var ERC20MetaData = &bind.MetaData{
	ABI: "[{\"inputs\":[{\"internalType\":\"string\",\"name\":\"name_\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"symbol_\",\"type\":\"string\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"}],\"name\":\"Approval\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"}],\"name\":\"Transfer\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"}],\"name\":\"allowance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"approve\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"balanceOf\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"decimals\",\"outputs\":[{\"internalType\":\"uint8\",\"name\":\"\",\"type\":\"uint8\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"subtractedValue\",\"type\":\"uint256\"}],\"name\":\"decreaseAllowance\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"addedValue\",\"type\":\"uint256\"}],\"name\":\"increaseAllowance\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"name\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"symbol\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"totalSupply\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"transfer\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"transferFrom\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]",
}

ERC20MetaData contains all meta data concerning the ERC20 contract.

Functions

This section is empty.

Types

type Block

type Block struct {
	Origin   BlockOrigin
	Height   uint64
	Time     time.Time
	Payloads []Payload
}

Block represents a block from a source or destiatnion chain with height, time, and zero or more payloads

func NewBlock

func NewBlock(origin BlockOrigin, height uint64, time time.Time, payloads []Payload) Block

NewBlock instantiates a new block with a origin, heigh, time, and payloads

type BlockOrigin

type BlockOrigin uint8

BlockOrigin determines if a block is a Source or Desitation block. The coordinator uses this type to determine how to process an incoming block.

const (
	// Source represents a block origin of the source chain.
	Source BlockOrigin = iota + 1
	// Destination represents a block origin of the destinatino chain.
	Destination
)

type Bridge

type Bridge struct {
	BridgeCaller     // Read-only binding to the contract
	BridgeTransactor // Write-only binding to the contract
	BridgeFilterer   // Log filterer for contract events
}

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

func DeployBridge

func DeployBridge(auth *bind.TransactOpts, backend bind.ContractBackend, relayer_ common.Address) (common.Address, *types.Transaction, *Bridge, error)

DeployBridge deploys a new Ethereum contract, binding an instance of Bridge to it.

func NewBridge

func NewBridge(address common.Address, backend bind.ContractBackend) (*Bridge, error)

NewBridge creates a new instance of Bridge, bound to a specific deployed contract.

type BridgeCaller

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

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

func NewBridgeCaller

func NewBridgeCaller(address common.Address, caller bind.ContractCaller) (*BridgeCaller, error)

NewBridgeCaller creates a new read-only instance of Bridge, bound to a specific deployed contract.

func (*BridgeCaller) Relayer

func (_Bridge *BridgeCaller) Relayer(opts *bind.CallOpts) (common.Address, error)

Relayer is a free data retrieval call binding the contract method 0x8406c079.

Solidity: function relayer() view returns(address)

type BridgeCallerRaw

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

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

func (*BridgeCallerRaw) Call

func (_Bridge *BridgeCallerRaw) 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 BridgeCallerSession

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

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

func (*BridgeCallerSession) Relayer

func (_Bridge *BridgeCallerSession) Relayer() (common.Address, error)

Relayer is a free data retrieval call binding the contract method 0x8406c079.

Solidity: function relayer() view returns(address)

type BridgeFilterer

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

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

func NewBridgeFilterer

func NewBridgeFilterer(address common.Address, filterer bind.ContractFilterer) (*BridgeFilterer, error)

NewBridgeFilterer creates a new log filterer instance of Bridge, bound to a specific deployed contract.

func (*BridgeFilterer) FilterLock

func (_Bridge *BridgeFilterer) FilterLock(opts *bind.FilterOpts, token []common.Address, sender []common.Address, toKavaAddr []common.Address) (*BridgeLockIterator, error)

FilterLock is a free log retrieval operation binding the contract event 0x749e347e95185169edffb86e003abcbf08f3510641663b00600acf707f098f47.

Solidity: event Lock(address indexed token, address indexed sender, address indexed toKavaAddr, uint256 amount, uint256 lockSequence)

func (*BridgeFilterer) FilterUnlock

func (_Bridge *BridgeFilterer) FilterUnlock(opts *bind.FilterOpts, token []common.Address, toAddr []common.Address) (*BridgeUnlockIterator, error)

FilterUnlock is a free log retrieval operation binding the contract event 0xc1640cf787ea538af4a68163da63c6da8b4577194278080f5b040a75df003899.

Solidity: event Unlock(address indexed token, address indexed toAddr, uint256 amount, uint256 unlockSequence)

func (*BridgeFilterer) ParseLock

func (_Bridge *BridgeFilterer) ParseLock(log types.Log) (*BridgeLock, error)

ParseLock is a log parse operation binding the contract event 0x749e347e95185169edffb86e003abcbf08f3510641663b00600acf707f098f47.

Solidity: event Lock(address indexed token, address indexed sender, address indexed toKavaAddr, uint256 amount, uint256 lockSequence)

func (*BridgeFilterer) ParseUnlock

func (_Bridge *BridgeFilterer) ParseUnlock(log types.Log) (*BridgeUnlock, error)

ParseUnlock is a log parse operation binding the contract event 0xc1640cf787ea538af4a68163da63c6da8b4577194278080f5b040a75df003899.

Solidity: event Unlock(address indexed token, address indexed toAddr, uint256 amount, uint256 unlockSequence)

func (*BridgeFilterer) WatchLock

func (_Bridge *BridgeFilterer) WatchLock(opts *bind.WatchOpts, sink chan<- *BridgeLock, token []common.Address, sender []common.Address, toKavaAddr []common.Address) (event.Subscription, error)

WatchLock is a free log subscription operation binding the contract event 0x749e347e95185169edffb86e003abcbf08f3510641663b00600acf707f098f47.

Solidity: event Lock(address indexed token, address indexed sender, address indexed toKavaAddr, uint256 amount, uint256 lockSequence)

func (*BridgeFilterer) WatchUnlock

func (_Bridge *BridgeFilterer) WatchUnlock(opts *bind.WatchOpts, sink chan<- *BridgeUnlock, token []common.Address, toAddr []common.Address) (event.Subscription, error)

WatchUnlock is a free log subscription operation binding the contract event 0xc1640cf787ea538af4a68163da63c6da8b4577194278080f5b040a75df003899.

Solidity: event Unlock(address indexed token, address indexed toAddr, uint256 amount, uint256 unlockSequence)

type BridgeLock

type BridgeLock struct {
	Token        common.Address
	Sender       common.Address
	ToKavaAddr   common.Address
	Amount       *big.Int
	LockSequence *big.Int
	Raw          types.Log // Blockchain specific contextual infos
}

BridgeLock represents a Lock event raised by the Bridge contract.

type BridgeLockIterator

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

BridgeLockIterator is returned from FilterLock and is used to iterate over the raw logs and unpacked data for Lock events raised by the Bridge contract.

func (*BridgeLockIterator) Close

func (it *BridgeLockIterator) Close() error

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

func (*BridgeLockIterator) Error

func (it *BridgeLockIterator) Error() error

Error returns any retrieval or parsing error occurred during filtering.

func (*BridgeLockIterator) Next

func (it *BridgeLockIterator) 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 BridgeRaw

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

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

func (*BridgeRaw) Call

func (_Bridge *BridgeRaw) 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 (*BridgeRaw) Transact

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

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

func (*BridgeRaw) Transfer

func (_Bridge *BridgeRaw) 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 BridgeSession

type BridgeSession struct {
	Contract     *Bridge           // 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
}

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

func (*BridgeSession) Lock

func (_Bridge *BridgeSession) Lock(token common.Address, toKavaAddr common.Address, amount *big.Int) (*types.Transaction, error)

Lock is a paid mutator transaction binding the contract method 0x7750c9f0.

Solidity: function lock(address token, address toKavaAddr, uint256 amount) returns()

func (*BridgeSession) Relayer

func (_Bridge *BridgeSession) Relayer() (common.Address, error)

Relayer is a free data retrieval call binding the contract method 0x8406c079.

Solidity: function relayer() view returns(address)

func (*BridgeSession) Unlock

func (_Bridge *BridgeSession) Unlock(token common.Address, toAddr common.Address, amount *big.Int, unlockSequence *big.Int) (*types.Transaction, error)

Unlock is a paid mutator transaction binding the contract method 0x4202e907.

Solidity: function unlock(address token, address toAddr, uint256 amount, uint256 unlockSequence) returns()

type BridgeTransactor

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

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

func NewBridgeTransactor

func NewBridgeTransactor(address common.Address, transactor bind.ContractTransactor) (*BridgeTransactor, error)

NewBridgeTransactor creates a new write-only instance of Bridge, bound to a specific deployed contract.

func (*BridgeTransactor) Lock

func (_Bridge *BridgeTransactor) Lock(opts *bind.TransactOpts, token common.Address, toKavaAddr common.Address, amount *big.Int) (*types.Transaction, error)

Lock is a paid mutator transaction binding the contract method 0x7750c9f0.

Solidity: function lock(address token, address toKavaAddr, uint256 amount) returns()

func (*BridgeTransactor) Unlock

func (_Bridge *BridgeTransactor) Unlock(opts *bind.TransactOpts, token common.Address, toAddr common.Address, amount *big.Int, unlockSequence *big.Int) (*types.Transaction, error)

Unlock is a paid mutator transaction binding the contract method 0x4202e907.

Solidity: function unlock(address token, address toAddr, uint256 amount, uint256 unlockSequence) returns()

type BridgeTransactorRaw

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

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

func (*BridgeTransactorRaw) Transact

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

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

func (*BridgeTransactorRaw) Transfer

func (_Bridge *BridgeTransactorRaw) 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 BridgeTransactorSession

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

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

func (*BridgeTransactorSession) Lock

func (_Bridge *BridgeTransactorSession) Lock(token common.Address, toKavaAddr common.Address, amount *big.Int) (*types.Transaction, error)

Lock is a paid mutator transaction binding the contract method 0x7750c9f0.

Solidity: function lock(address token, address toKavaAddr, uint256 amount) returns()

func (*BridgeTransactorSession) Unlock

func (_Bridge *BridgeTransactorSession) Unlock(token common.Address, toAddr common.Address, amount *big.Int, unlockSequence *big.Int) (*types.Transaction, error)

Unlock is a paid mutator transaction binding the contract method 0x4202e907.

Solidity: function unlock(address token, address toAddr, uint256 amount, uint256 unlockSequence) returns()

type BridgeUnlock

type BridgeUnlock struct {
	Token          common.Address
	ToAddr         common.Address
	Amount         *big.Int
	UnlockSequence *big.Int
	Raw            types.Log // Blockchain specific contextual infos
}

BridgeUnlock represents a Unlock event raised by the Bridge contract.

type BridgeUnlockIterator

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

BridgeUnlockIterator is returned from FilterUnlock and is used to iterate over the raw logs and unpacked data for Unlock events raised by the Bridge contract.

func (*BridgeUnlockIterator) Close

func (it *BridgeUnlockIterator) Close() error

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

func (*BridgeUnlockIterator) Error

func (it *BridgeUnlockIterator) Error() error

Error returns any retrieval or parsing error occurred during filtering.

func (*BridgeUnlockIterator) Next

func (it *BridgeUnlockIterator) 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 Coordinator

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

Coordinator sequences source and destination blocks between chains and outputs deterministicly ordered signing outputs

func NewCoordinator

func NewCoordinator() *Coordinator

NewCoordinator returns a new coordinator TODO: nonce and block initialization

func (*Coordinator) AddBlock

func (c *Coordinator) AddBlock(ctx context.Context, block Block) (err error)

AddBlock process a new source or destination block. This is not go routine safe, as only one go routine should call this method.

When adding a source block, it may block if there are no avaible routines to read from the signing output channel. If an error is returned, no signing outputs are generated and blocks may be safely retried.

func (*Coordinator) Close

func (c *Coordinator) Close()

Close closes the signing outputs channel. This should used the upstream process adding blocks to signal downstream output readers to stop. Calling AddBlock after Close will result in an error. TODO: add internal state to prevent writing to closed channel.

func (*Coordinator) SigningOutputs

func (c *Coordinator) SigningOutputs() <-chan []SigningOutput

SigningOutputs returns the output channel for all signing outputs. This channel must be read from in order to process blocks in AddBlock.

type ERC20

type ERC20 struct {
	ERC20Caller     // Read-only binding to the contract
	ERC20Transactor // Write-only binding to the contract
	ERC20Filterer   // Log filterer for contract events
}

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

func NewERC20

func NewERC20(address common.Address, backend bind.ContractBackend) (*ERC20, error)

NewERC20 creates a new instance of ERC20, bound to a specific deployed contract.

type ERC20Approval

type ERC20Approval struct {
	Owner   common.Address
	Spender common.Address
	Value   *big.Int
	Raw     types.Log // Blockchain specific contextual infos
}

ERC20Approval represents a Approval event raised by the ERC20 contract.

type ERC20ApprovalIterator

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

ERC20ApprovalIterator is returned from FilterApproval and is used to iterate over the raw logs and unpacked data for Approval events raised by the ERC20 contract.

func (*ERC20ApprovalIterator) Close

func (it *ERC20ApprovalIterator) Close() error

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

func (*ERC20ApprovalIterator) Error

func (it *ERC20ApprovalIterator) Error() error

Error returns any retrieval or parsing error occurred during filtering.

func (*ERC20ApprovalIterator) Next

func (it *ERC20ApprovalIterator) 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 ERC20Caller

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

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

func NewERC20Caller

func NewERC20Caller(address common.Address, caller bind.ContractCaller) (*ERC20Caller, error)

NewERC20Caller creates a new read-only instance of ERC20, bound to a specific deployed contract.

func (*ERC20Caller) Allowance

func (_ERC20 *ERC20Caller) Allowance(opts *bind.CallOpts, owner common.Address, spender common.Address) (*big.Int, error)

Allowance is a free data retrieval call binding the contract method 0xdd62ed3e.

Solidity: function allowance(address owner, address spender) view returns(uint256)

func (*ERC20Caller) BalanceOf

func (_ERC20 *ERC20Caller) BalanceOf(opts *bind.CallOpts, account common.Address) (*big.Int, error)

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

Solidity: function balanceOf(address account) view returns(uint256)

func (*ERC20Caller) Decimals

func (_ERC20 *ERC20Caller) Decimals(opts *bind.CallOpts) (uint8, error)

Decimals is a free data retrieval call binding the contract method 0x313ce567.

Solidity: function decimals() view returns(uint8)

func (*ERC20Caller) Name

func (_ERC20 *ERC20Caller) Name(opts *bind.CallOpts) (string, error)

Name is a free data retrieval call binding the contract method 0x06fdde03.

Solidity: function name() view returns(string)

func (*ERC20Caller) Symbol

func (_ERC20 *ERC20Caller) Symbol(opts *bind.CallOpts) (string, error)

Symbol is a free data retrieval call binding the contract method 0x95d89b41.

Solidity: function symbol() view returns(string)

func (*ERC20Caller) TotalSupply

func (_ERC20 *ERC20Caller) TotalSupply(opts *bind.CallOpts) (*big.Int, error)

TotalSupply is a free data retrieval call binding the contract method 0x18160ddd.

Solidity: function totalSupply() view returns(uint256)

type ERC20CallerRaw

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

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

func (*ERC20CallerRaw) Call

func (_ERC20 *ERC20CallerRaw) 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 ERC20CallerSession

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

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

func (*ERC20CallerSession) Allowance

func (_ERC20 *ERC20CallerSession) Allowance(owner common.Address, spender common.Address) (*big.Int, error)

Allowance is a free data retrieval call binding the contract method 0xdd62ed3e.

Solidity: function allowance(address owner, address spender) view returns(uint256)

func (*ERC20CallerSession) BalanceOf

func (_ERC20 *ERC20CallerSession) BalanceOf(account common.Address) (*big.Int, error)

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

Solidity: function balanceOf(address account) view returns(uint256)

func (*ERC20CallerSession) Decimals

func (_ERC20 *ERC20CallerSession) Decimals() (uint8, error)

Decimals is a free data retrieval call binding the contract method 0x313ce567.

Solidity: function decimals() view returns(uint8)

func (*ERC20CallerSession) Name

func (_ERC20 *ERC20CallerSession) Name() (string, error)

Name is a free data retrieval call binding the contract method 0x06fdde03.

Solidity: function name() view returns(string)

func (*ERC20CallerSession) Symbol

func (_ERC20 *ERC20CallerSession) Symbol() (string, error)

Symbol is a free data retrieval call binding the contract method 0x95d89b41.

Solidity: function symbol() view returns(string)

func (*ERC20CallerSession) TotalSupply

func (_ERC20 *ERC20CallerSession) TotalSupply() (*big.Int, error)

TotalSupply is a free data retrieval call binding the contract method 0x18160ddd.

Solidity: function totalSupply() view returns(uint256)

type ERC20Filterer

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

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

func NewERC20Filterer

func NewERC20Filterer(address common.Address, filterer bind.ContractFilterer) (*ERC20Filterer, error)

NewERC20Filterer creates a new log filterer instance of ERC20, bound to a specific deployed contract.

func (*ERC20Filterer) FilterApproval

func (_ERC20 *ERC20Filterer) FilterApproval(opts *bind.FilterOpts, owner []common.Address, spender []common.Address) (*ERC20ApprovalIterator, error)

FilterApproval is a free log retrieval operation binding the contract event 0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925.

Solidity: event Approval(address indexed owner, address indexed spender, uint256 value)

func (*ERC20Filterer) FilterTransfer

func (_ERC20 *ERC20Filterer) FilterTransfer(opts *bind.FilterOpts, from []common.Address, to []common.Address) (*ERC20TransferIterator, error)

FilterTransfer is a free log retrieval operation binding the contract event 0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef.

Solidity: event Transfer(address indexed from, address indexed to, uint256 value)

func (*ERC20Filterer) ParseApproval

func (_ERC20 *ERC20Filterer) ParseApproval(log types.Log) (*ERC20Approval, error)

ParseApproval is a log parse operation binding the contract event 0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925.

Solidity: event Approval(address indexed owner, address indexed spender, uint256 value)

func (*ERC20Filterer) ParseTransfer

func (_ERC20 *ERC20Filterer) ParseTransfer(log types.Log) (*ERC20Transfer, error)

ParseTransfer is a log parse operation binding the contract event 0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef.

Solidity: event Transfer(address indexed from, address indexed to, uint256 value)

func (*ERC20Filterer) WatchApproval

func (_ERC20 *ERC20Filterer) WatchApproval(opts *bind.WatchOpts, sink chan<- *ERC20Approval, owner []common.Address, spender []common.Address) (event.Subscription, error)

WatchApproval is a free log subscription operation binding the contract event 0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925.

Solidity: event Approval(address indexed owner, address indexed spender, uint256 value)

func (*ERC20Filterer) WatchTransfer

func (_ERC20 *ERC20Filterer) WatchTransfer(opts *bind.WatchOpts, sink chan<- *ERC20Transfer, from []common.Address, to []common.Address) (event.Subscription, error)

WatchTransfer is a free log subscription operation binding the contract event 0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef.

Solidity: event Transfer(address indexed from, address indexed to, uint256 value)

type ERC20Raw

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

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

func (*ERC20Raw) Call

func (_ERC20 *ERC20Raw) 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 (*ERC20Raw) Transact

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

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

func (*ERC20Raw) Transfer

func (_ERC20 *ERC20Raw) 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 ERC20Session

type ERC20Session struct {
	Contract     *ERC20            // 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
}

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

func (*ERC20Session) Allowance

func (_ERC20 *ERC20Session) Allowance(owner common.Address, spender common.Address) (*big.Int, error)

Allowance is a free data retrieval call binding the contract method 0xdd62ed3e.

Solidity: function allowance(address owner, address spender) view returns(uint256)

func (*ERC20Session) Approve

func (_ERC20 *ERC20Session) Approve(spender common.Address, amount *big.Int) (*types.Transaction, error)

Approve is a paid mutator transaction binding the contract method 0x095ea7b3.

Solidity: function approve(address spender, uint256 amount) returns(bool)

func (*ERC20Session) BalanceOf

func (_ERC20 *ERC20Session) BalanceOf(account common.Address) (*big.Int, error)

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

Solidity: function balanceOf(address account) view returns(uint256)

func (*ERC20Session) Decimals

func (_ERC20 *ERC20Session) Decimals() (uint8, error)

Decimals is a free data retrieval call binding the contract method 0x313ce567.

Solidity: function decimals() view returns(uint8)

func (*ERC20Session) DecreaseAllowance

func (_ERC20 *ERC20Session) DecreaseAllowance(spender common.Address, subtractedValue *big.Int) (*types.Transaction, error)

DecreaseAllowance is a paid mutator transaction binding the contract method 0xa457c2d7.

Solidity: function decreaseAllowance(address spender, uint256 subtractedValue) returns(bool)

func (*ERC20Session) IncreaseAllowance

func (_ERC20 *ERC20Session) IncreaseAllowance(spender common.Address, addedValue *big.Int) (*types.Transaction, error)

IncreaseAllowance is a paid mutator transaction binding the contract method 0x39509351.

Solidity: function increaseAllowance(address spender, uint256 addedValue) returns(bool)

func (*ERC20Session) Name

func (_ERC20 *ERC20Session) Name() (string, error)

Name is a free data retrieval call binding the contract method 0x06fdde03.

Solidity: function name() view returns(string)

func (*ERC20Session) Symbol

func (_ERC20 *ERC20Session) Symbol() (string, error)

Symbol is a free data retrieval call binding the contract method 0x95d89b41.

Solidity: function symbol() view returns(string)

func (*ERC20Session) TotalSupply

func (_ERC20 *ERC20Session) TotalSupply() (*big.Int, error)

TotalSupply is a free data retrieval call binding the contract method 0x18160ddd.

Solidity: function totalSupply() view returns(uint256)

func (*ERC20Session) Transfer

func (_ERC20 *ERC20Session) Transfer(to common.Address, amount *big.Int) (*types.Transaction, error)

Transfer is a paid mutator transaction binding the contract method 0xa9059cbb.

Solidity: function transfer(address to, uint256 amount) returns(bool)

func (*ERC20Session) TransferFrom

func (_ERC20 *ERC20Session) TransferFrom(from common.Address, to common.Address, amount *big.Int) (*types.Transaction, error)

TransferFrom is a paid mutator transaction binding the contract method 0x23b872dd.

Solidity: function transferFrom(address from, address to, uint256 amount) returns(bool)

type ERC20Transactor

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

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

func NewERC20Transactor

func NewERC20Transactor(address common.Address, transactor bind.ContractTransactor) (*ERC20Transactor, error)

NewERC20Transactor creates a new write-only instance of ERC20, bound to a specific deployed contract.

func (*ERC20Transactor) Approve

func (_ERC20 *ERC20Transactor) Approve(opts *bind.TransactOpts, spender common.Address, amount *big.Int) (*types.Transaction, error)

Approve is a paid mutator transaction binding the contract method 0x095ea7b3.

Solidity: function approve(address spender, uint256 amount) returns(bool)

func (*ERC20Transactor) DecreaseAllowance

func (_ERC20 *ERC20Transactor) DecreaseAllowance(opts *bind.TransactOpts, spender common.Address, subtractedValue *big.Int) (*types.Transaction, error)

DecreaseAllowance is a paid mutator transaction binding the contract method 0xa457c2d7.

Solidity: function decreaseAllowance(address spender, uint256 subtractedValue) returns(bool)

func (*ERC20Transactor) IncreaseAllowance

func (_ERC20 *ERC20Transactor) IncreaseAllowance(opts *bind.TransactOpts, spender common.Address, addedValue *big.Int) (*types.Transaction, error)

IncreaseAllowance is a paid mutator transaction binding the contract method 0x39509351.

Solidity: function increaseAllowance(address spender, uint256 addedValue) returns(bool)

func (*ERC20Transactor) Transfer

func (_ERC20 *ERC20Transactor) Transfer(opts *bind.TransactOpts, to common.Address, amount *big.Int) (*types.Transaction, error)

Transfer is a paid mutator transaction binding the contract method 0xa9059cbb.

Solidity: function transfer(address to, uint256 amount) returns(bool)

func (*ERC20Transactor) TransferFrom

func (_ERC20 *ERC20Transactor) TransferFrom(opts *bind.TransactOpts, from common.Address, to common.Address, amount *big.Int) (*types.Transaction, error)

TransferFrom is a paid mutator transaction binding the contract method 0x23b872dd.

Solidity: function transferFrom(address from, address to, uint256 amount) returns(bool)

type ERC20TransactorRaw

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

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

func (*ERC20TransactorRaw) Transact

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

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

func (*ERC20TransactorRaw) Transfer

func (_ERC20 *ERC20TransactorRaw) 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 ERC20TransactorSession

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

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

func (*ERC20TransactorSession) Approve

func (_ERC20 *ERC20TransactorSession) Approve(spender common.Address, amount *big.Int) (*types.Transaction, error)

Approve is a paid mutator transaction binding the contract method 0x095ea7b3.

Solidity: function approve(address spender, uint256 amount) returns(bool)

func (*ERC20TransactorSession) DecreaseAllowance

func (_ERC20 *ERC20TransactorSession) DecreaseAllowance(spender common.Address, subtractedValue *big.Int) (*types.Transaction, error)

DecreaseAllowance is a paid mutator transaction binding the contract method 0xa457c2d7.

Solidity: function decreaseAllowance(address spender, uint256 subtractedValue) returns(bool)

func (*ERC20TransactorSession) IncreaseAllowance

func (_ERC20 *ERC20TransactorSession) IncreaseAllowance(spender common.Address, addedValue *big.Int) (*types.Transaction, error)

IncreaseAllowance is a paid mutator transaction binding the contract method 0x39509351.

Solidity: function increaseAllowance(address spender, uint256 addedValue) returns(bool)

func (*ERC20TransactorSession) Transfer

func (_ERC20 *ERC20TransactorSession) Transfer(to common.Address, amount *big.Int) (*types.Transaction, error)

Transfer is a paid mutator transaction binding the contract method 0xa9059cbb.

Solidity: function transfer(address to, uint256 amount) returns(bool)

func (*ERC20TransactorSession) TransferFrom

func (_ERC20 *ERC20TransactorSession) TransferFrom(from common.Address, to common.Address, amount *big.Int) (*types.Transaction, error)

TransferFrom is a paid mutator transaction binding the contract method 0x23b872dd.

Solidity: function transferFrom(address from, address to, uint256 amount) returns(bool)

type ERC20Transfer

type ERC20Transfer struct {
	From  common.Address
	To    common.Address
	Value *big.Int
	Raw   types.Log // Blockchain specific contextual infos
}

ERC20Transfer represents a Transfer event raised by the ERC20 contract.

type ERC20TransferIterator

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

ERC20TransferIterator is returned from FilterTransfer and is used to iterate over the raw logs and unpacked data for Transfer events raised by the ERC20 contract.

func (*ERC20TransferIterator) Close

func (it *ERC20TransferIterator) Close() error

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

func (*ERC20TransferIterator) Error

func (it *ERC20TransferIterator) Error() error

Error returns any retrieval or parsing error occurred during filtering.

func (*ERC20TransferIterator) Next

func (it *ERC20TransferIterator) 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 Payload

type Payload interface{}

Payload represents any data that needs to be transferred cross-chain.

type Service

type Service struct {
}

func NewService

func NewService(ethRpc string, ethBridgeAddr string, kavaGrpc string, relayerMnemonic string) (*Service, error)

func (*Service) Run

func (s *Service) Run() error

type SigningOutput

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

SigningOutput maps a payload in a block to an account nonce on the destination chain. The coordinator is responsible for determining which nonce to assign to each payload.

func NewSigningOutput

func NewSigningOutput(nonce uint64, payload Payload) SigningOutput

NewSigningOutput returns a new signing output for a nonce and payload

func (SigningOutput) Nonce

func (s SigningOutput) Nonce() uint64

Nonce returns the nonce of the signing output

func (SigningOutput) Payload

func (s SigningOutput) Payload() Payload

Payload returns the payload of the signing output

Directories

Path Synopsis
p2p

Jump to

Keyboard shortcuts

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