stellar

package
v3.0.0-...-e8b7a4c Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2023 License: GPL-3.0 Imports: 2 Imported by: 0

Documentation

Overview

Package eth test eth router by implementing `tokens.IBridge` interface. this testing implementation is using the product `token/eth` impl. this way implementation is just an example, in reality we need impl the `tokens.IBridge` interface from scratch, and take it into the product implementation after this testing is passed.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bridge

type Bridge struct {
	*stellar.Bridge
}

Bridge bridge impl struct

func NewCrossChainBridge

func NewCrossChainBridge(chainID string) *Bridge

NewCrossChainBridge new bridge instance

func (*Bridge) BuildRawTransaction

func (b *Bridge) BuildRawTransaction(args *tokens.BuildTxArgs) (rawTx interface{}, err error)

BuildRawTransaction build tx with specified args.

func (*Bridge) GetLatestBlockNumber

func (b *Bridge) GetLatestBlockNumber() (uint64, error)

GetLatestBlockNumber get latest block number through gateway urls. used in `GetRouterSwap` server rpc.

func (*Bridge) GetLatestBlockNumberOf

func (b *Bridge) GetLatestBlockNumberOf(url string) (uint64, error)

GetLatestBlockNumberOf get latest block number of specified url. used in `AdjustGatewayOrder` function.

func (*Bridge) GetTransaction

func (b *Bridge) GetTransaction(txHash string) (interface{}, error)

GetTransaction get tx by hash.

func (*Bridge) GetTransactionStatus

func (b *Bridge) GetTransactionStatus(txHash string) (*tokens.TxStatus, error)

GetTransactionStatus get tx status by hash. get tx related infos like block height, confirmations, receipts etc. These infos is used to verify tx is acceptable. you can extend `TxStatus` if fields in it is not enough to do the checking.

func (*Bridge) InitAfterConfig

func (b *Bridge) InitAfterConfig()

InitAfterConfig init variables (ie. extra members) after loading config

func (*Bridge) IsValidAddress

func (b *Bridge) IsValidAddress(address string) bool

IsValidAddress check if given `address` is valid on this chain. prevent swap to an invalid `bind` address which will make assets loss.

func (*Bridge) MPCSignTransaction

func (b *Bridge) MPCSignTransaction(rawTx interface{}, args *tokens.BuildTxArgs) (signedTx interface{}, txHash string, err error)

MPCSignTransaction mpc sign tx.

func (*Bridge) RegisterSwap

func (b *Bridge) RegisterSwap(txHash string, args *tokens.RegisterArgs) ([]*tokens.SwapTxInfo, []error)

RegisterSwap register swap. used in `RegisterRouterSwap` server rpc.

func (*Bridge) SendTransaction

func (b *Bridge) SendTransaction(signedTx interface{}) (txHash string, err error)

SendTransaction send signed raw tx.

func (*Bridge) VerifyMsgHash

func (b *Bridge) VerifyMsgHash(rawTx interface{}, msgHash []string) error

VerifyMsgHash verify message hash is same. 'message hash' here is the real content (usually a hash) which will be signed. used in `accept` work for oracles to replay the same tx on destination chain. oracle will only accept a sign info if and only if the oracle can verify the tx and rebuild a tx and ensure the message hash is same.

func (*Bridge) VerifyTransaction

func (b *Bridge) VerifyTransaction(txHash string, ars *tokens.VerifyArgs) (*tokens.SwapTxInfo, error)

VerifyTransaction verify swap tx is valid and success on chain with needed confirmations.

Jump to

Keyboard shortcuts

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