Documentation ¶
Index ¶
- Constants
- Variables
- func UnpackDepositProposal(args ...interface{}) (depositProposal, error)
- func UnpackErc20DepositRecord(args ...interface{}) (erc20DepositRecord, error)
- func UnpackGenericDepositRecord(args ...interface{}) (genericDepositRecord, error)
- type ActiveSubscription
- type BridgeCaller
- type BridgeContract
- type BridgeFilterer
- type BridgeRaw
- type Chain
- type Config
- type Connection
- func (c *Connection) Close()
- func (c *Connection) Connect() error
- func (c *Connection) LatestBlock() (*ethtypes.Block, error)
- func (c *Connection) NetworkId() (*big.Int, error)
- func (c *Connection) NonceAt(account [20]byte, blockNum *big.Int) (uint64, error)
- func (c *Connection) PendingNonceAt(account [20]byte) (*Nonce, error)
- func (c *Connection) SubmitTx(data []byte) error
- type DeployedContracts
- type EventSig
- type Listener
- func (l *Listener) GetSubscriptions() []*Subscription
- func (l *Listener) RegisterEventHandler(subscription string, handler evtHandlerFn) error
- func (l *Listener) SetBridgeContract(contract BridgeContract)
- func (l *Listener) SetRouter(r chains.Router)
- func (l *Listener) Start() error
- func (l *Listener) Stop() error
- func (l *Listener) Unsubscribe(sig EventSig)
- type Nonce
- type Subscription
- type Writer
Constants ¶
const ( DepositAsset = "DepositAsset" NftTransfer = "NftTransfer" ErcTransfer = "ErcTransfer" DepositProposalCreated = "DepositProposalCreated" DepositedErc20 = "DepositedErc20" DepositedErc20Signature = "ERC20Deposited(uint256,uint256)" DepositAssetSignature = "DepositAsset(address,bytes32)" NftTransferSignature = "NFTTransfer(uint256,uint256,address,address,uint256,bytes)" ErcTransferSignature = "ERCTransfer(uint256,uint256,address,uint256,address)" DepositProposalCreatedSignature = "DepositProposalCreated(uint256,uint256,bytes32)" )
const CreateDepositProposalMethod = "createDepositProposal"
const DefaultGasLimit = 6721975
const DefaultGasPrice = 20000000000
const ExecuteDepositMethod = "executeDepositProposal"
const StoreMethod = "store"
const VoteDepositProposalMethod = "voteDepositProposal"
Variables ¶
var ( RELAYER_ADDRESS = []string{ keystore.TestKeyRing.EthereumKeys[keystore.AliceKey].Address(), keystore.TestKeyRing.EthereumKeys[keystore.BobKey].Address(), keystore.TestKeyRing.EthereumKeys[keystore.CharlieKey].Address(), keystore.TestKeyRing.EthereumKeys[keystore.DaveKey].Address(), keystore.TestKeyRing.EthereumKeys[keystore.EveKey].Address(), } ZERO_ADDRESS = common.HexToAddress("0x0000000000000000000000000000000000000000") )
Functions ¶
func UnpackDepositProposal ¶
func UnpackDepositProposal(args ...interface{}) (depositProposal, error)
func UnpackErc20DepositRecord ¶
func UnpackErc20DepositRecord(args ...interface{}) (erc20DepositRecord, error)
func UnpackGenericDepositRecord ¶
func UnpackGenericDepositRecord(args ...interface{}) (genericDepositRecord, error)
Types ¶
type ActiveSubscription ¶
type ActiveSubscription struct {
// contains filtered or unexported fields
}
type BridgeCaller ¶
type BridgeCaller interface { GetGenericDepositRecord(opts *bind.CallOpts, originChainID *big.Int, depositNonce *big.Int) (common.Address, common.Address, *big.Int, common.Address, common.Address, []byte, error) GetERC20DepositRecord(opts *bind.CallOpts, originChainID *big.Int, depositNonce *big.Int) (common.Address, common.Address, *big.Int, common.Address, common.Address, *big.Int, error) GetDepositProposal(opts *bind.CallOpts, destinationChainID *big.Int, depositNonce *big.Int) (*big.Int, *big.Int, [32]byte, []common.Address, []common.Address, string, error) }
type BridgeContract ¶
type BridgeContract struct { BridgeFilterer BridgeCaller BridgeRaw }
type BridgeFilterer ¶
type BridgeFilterer interface { }
type BridgeRaw ¶
type BridgeRaw interface { Call(opts *bind.CallOpts, result interface{}, method string, params ...interface{}) error Transfer(opts *bind.TransactOpts) (*types.Transaction, error) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) }
type Chain ¶
type Chain struct {
// contains filtered or unexported fields
}
func InitializeChain ¶
func InitializeChain(chainCfg *core.ChainConfig) (*Chain, error)
type Config ¶
type Config struct {
// contains filtered or unexported fields
}
Config encapsulates all necessary parameters in ethereum compatible forms
type Connection ¶
type Connection struct {
// contains filtered or unexported fields
}
func NewConnection ¶
func NewConnection(cfg *Config, kp *secp256k1.Keypair) *Connection
func (*Connection) Connect ¶
func (c *Connection) Connect() error
Connect starts the ethereum WS connection
func (*Connection) LatestBlock ¶
func (c *Connection) LatestBlock() (*ethtypes.Block, error)
LatestBlock returns the latest block from the current chain
func (*Connection) PendingNonceAt ¶
func (c *Connection) PendingNonceAt(account [20]byte) (*Nonce, error)
PendingNonceAt returns the pending nonce of the given account and the given block
func (*Connection) SubmitTx ¶
func (c *Connection) SubmitTx(data []byte) error
SubmitTx submits a transaction to the chain It assumes the input data is an ethtypes.Transaction, marshalled as JSON
type DeployedContracts ¶
type DeployedContracts struct { BridgeAddress common.Address RelayerAddress common.Address ERC20HandlerAddress common.Address ERC721HandlerAddress common.Address CentrifugeHandlerAddress common.Address }
func DeployContracts ¶
type Listener ¶
type Listener struct {
// contains filtered or unexported fields
}
func NewListener ¶
func NewListener(conn *Connection, cfg *Config) *Listener
func (*Listener) GetSubscriptions ¶
func (l *Listener) GetSubscriptions() []*Subscription
func (*Listener) RegisterEventHandler ¶
RegisterEventHandler creates a subscription for the provided event on the bridge contract. Handler will be called for every instance of event.
func (*Listener) SetBridgeContract ¶
func (l *Listener) SetBridgeContract(contract BridgeContract)
func (*Listener) Unsubscribe ¶
Unsubscribe cancels a subscription for the given event
type Nonce ¶
type Nonce struct {
// contains filtered or unexported fields
}
Nonce is a struct that wraps the Nonce with a mutex lock this struct was implemented to prevent race conditions where two transactions try to transact at the same time and recieve the same nonce, causing one to be rejected.
type Subscription ¶
type Subscription struct {
// contains filtered or unexported fields
}
type Writer ¶
type Writer struct {
// contains filtered or unexported fields
}
func NewWriter ¶
func NewWriter(conn *Connection, cfg *Config) *Writer
func (*Writer) ResolveMessage ¶
ResolveMessage handles any given message based on type A bool is returned to indicate failure/success, this should be ignored except for within tests.
func (*Writer) SetBridgeContract ¶
func (w *Writer) SetBridgeContract(bridge BridgeContract)