Documentation ¶
Index ¶
- Variables
- func DepositID(txHash string, logIndex uint) string
- func IsInvalidGetDepositRequest(err error) bool
- type Block
- type Deposit
- type Observer
- func (o Observer) GetBlockByNumber(ctx context.Context, blockNumber uint64) (Block, error)
- func (o Observer) GetDeposit(ctx context.Context, txHash string, logIndex uint) (Deposit, error)
- func (o Observer) GetLatestBlock(ctx context.Context) (Block, error)
- func (o Observer) GetRequestStatus(ctx context.Context, requestID common.Hash) (RequestStatus, error)
- type RequestStatus
- type Signer
Constants ¶
This section is empty.
Variables ¶
var ( // ErrLogNotFound is returned by GetDeposit when the log // with the given block index cannot be found ErrLogNotFound = fmt.Errorf("log not found") // ErrLogNotFromBridge is returned by GetDeposit when the log // with the given block index is not emitted from the bridge contract ErrLogNotFromBridge = fmt.Errorf("log is not from bridge") // ErrLogNotDepositEvent is returned by GetDeposit when the log // with the given block index is not a DepositETH or DepositERC20 event ErrLogNotDepositEvent = fmt.Errorf("log is not a deposit event") // ErrTxHashNotFound is returned by GetDeposit when the given transaction // hash is not found ErrTxHashNotFound = fmt.Errorf("deposit tx hash not found") )
Functions ¶
func IsInvalidGetDepositRequest ¶
IsInvalidGetDepositRequest returns true if the given error from GetDeposit indicates that the provided transaction hash or log index is invalid
Types ¶
type Block ¶
type Block struct { // Number is the sequence number of the block Number uint64 // Time is the timestamp when the block was executed Time time.Time }
Block represents an ethereum block
type Deposit ¶
type Deposit struct { // Token is the address (0x0 in the case that eth was deposited) // of the tokens which were deposited to the bridge Token common.Address // Sender is the address of the account which deposited the tokens Sender common.Address // Destination is the intended recipient of the bridge transfer Destination *big.Int // Amount is the amount of tokens which were deposited to the bridge // contract Amount *big.Int // TxHash is the hash of the transaction containing the deposit TxHash common.Hash // LogIndex is the log index within the ethereum block of the deposit event // emitted by the bridge contract LogIndex uint // BlockNumber is the sequence number of the block containing the deposit // transaction BlockNumber uint64 // Time is the timestamp of the deposit Time time.Time }
Deposit is a deposit to the bridge smart contract
type Observer ¶
type Observer struct {
// contains filtered or unexported fields
}
Observer is used to inspect the ethereum blockchain to for all information relevant to bridge interactions
func NewObserver ¶
NewObserver constructs a new Observer instance
func (Observer) GetBlockByNumber ¶
GetBlockByNumber finds an ethereum block by its sequence number
func (Observer) GetDeposit ¶
GetDeposit returns a Deposit instance identified by the given transaction hash and log index
func (Observer) GetLatestBlock ¶
GetLatestBlock returns the latest ethereum block
func (Observer) GetRequestStatus ¶
func (o Observer) GetRequestStatus(ctx context.Context, requestID common.Hash) (RequestStatus, error)
GetRequestStatus calls the requestStatus() view function on the bridge contract to determine the status of a bridge withdrawal
type RequestStatus ¶
type RequestStatus struct { // Fulfilled is true if the withdrawal was executed Fulfilled bool // BlockNumber is the latst block at the time the // request status was queried BlockNumber uint64 }
RequestStatus is the status of a withdrawal on the bridge contract
type Signer ¶
type Signer struct {
// contains filtered or unexported fields
}
Signer represents an ethereum validator account which is authorized to approve withdrawals from the bridge smart contract.