message

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2025 License: LGPL-3.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AcrossMessage = "AcrossMessage"
	MayanMessage  = "MayanMessage"

	ZERO_HASH   = "0000000000000000000000000000000000000000000000000000000000000000"
	DOMAIN_NAME = "LiquidityPool"
	VERSION     = "1.0.0"
	TIMEOUT     = 10 * time.Minute
	BLOCK_RANGE = 1000
)
View Source
const (
	TRANSACTION_TIMEOUT = 30 * time.Second
)

Variables

View Source
var (
	BPS_DENOMINATOR = big.NewInt(10000)
)

Functions

func NewAcrossMessage

func NewAcrossMessage(source, destination uint64, acrossData *AcrossData) *message.Message

func NewMayanMessage added in v0.2.0

func NewMayanMessage(source, destination uint64, mayanData *MayanData) *message.Message

Types

type AcrossData

type AcrossData struct {
	ErrChn chan error `json:"-"`

	DepositTxHash common.Hash
	DepositId     *big.Int
	Nonce         *big.Int
	LiquidityPool common.Address
	Caller        common.Address
	Coordinator   peer.ID
	Source        uint64
	Destination   uint64
}

type AcrossMessageHandler

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

func NewAcrossMessageHandler

func NewAcrossMessageHandler(
	chainID uint64,
	client EventFilterer,
	pools map[uint64]common.Address,
	coordinator Coordinator,
	host host.Host,
	comm comm.Communication,
	fetcher signing.SaveDataFetcher,
	tokenMatcher TokenMatcher,
	tokenStore config.TokenStore,
	confirmationWatcher ConfirmationWatcher,
	sigChn chan any,
) *AcrossMessageHandler

func (*AcrossMessageHandler) HandleMessage

func (h *AcrossMessageHandler) HandleMessage(m *message.Message) (*proposal.Proposal, error)

HandleMessage finds the Across deposit with the according deposit ID and starts the MPC signature process for it. The result will be saved into the signature cache through the result channel.

func (*AcrossMessageHandler) Listen

func (h *AcrossMessageHandler) Listen(ctx context.Context)

type ConfirmationWatcher added in v0.2.0

type ConfirmationWatcher interface {
	WaitForConfirmations(
		ctx context.Context,
		chainID uint64,
		txHash common.Hash,
		token common.Address,
		amount *big.Int) error
}

type Coordinator

type Coordinator interface {
	Execute(ctx context.Context, tssProcesses []tss.TssProcess, resultChn chan interface{}, coordinator peer.ID) error
}

type EventFilterer

type EventFilterer interface {
	FilterLogs(ctx context.Context, q ethereum.FilterQuery) ([]types.Log, error)
	LatestBlock() (*big.Int, error)
	TransactionReceipt(ctx context.Context, txHash common.Hash) (*types.Receipt, error)
}

type MayanContract added in v0.2.0

type MayanContract interface {
	DecodeFulfillCall(calldata []byte) (*contracts.MayanFulfillParams, *contracts.MayanFulfillMsg, error)
	GetOrder(
		msg *contracts.MayanFulfillMsg,
		swap *mayan.MayanSwap,
		srcTokenDecimals uint8,
	) (*contracts.MayanOrder, error)
}

type MayanData added in v0.2.0

type MayanData struct {
	ErrChn chan error `json:"-"`

	Coordinator   peer.ID
	LiquidityPool common.Address
	Caller        common.Address
	DepositTxHash string
	Calldata      string
	Nonce         *big.Int
	BorrowAmount  *big.Int
	Source        uint64
	Destination   uint64
}

type MayanMessageHandler added in v0.2.0

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

func NewMayanMessageHandler added in v0.2.0

func NewMayanMessageHandler(
	chainID uint64,
	client EventFilterer,
	liquidityPools map[uint64]common.Address,
	mayanPools map[uint64]common.Address,
	coordinator Coordinator,
	host host.Host,
	comm comm.Communication,
	fetcher signing.SaveDataFetcher,
	confirmationWatcher ConfirmationWatcher,
	tokenStore config.TokenStore,
	mayanDecoder MayanContract,
	swapFetcher SwapFetcher,
	sigChn chan any,
) *MayanMessageHandler

func (*MayanMessageHandler) HandleMessage added in v0.2.0

func (h *MayanMessageHandler) HandleMessage(m *message.Message) (*proposal.Proposal, error)

HandleMessage finds the Mayan deposit with the according deposit ID and starts the MPC signature process for it. The result will be saved into the signature cache through the result channel.

func (*MayanMessageHandler) Listen added in v0.2.0

func (h *MayanMessageHandler) Listen(ctx context.Context)

type SwapFetcher added in v0.2.0

type SwapFetcher interface {
	GetSwap(hash string) (*mayan.MayanSwap, error)
}

type TokenMatcher

type TokenMatcher interface {
	DestinationToken(destinationChainId *big.Int, symbol string) (common.Address, error)
}

type TokenPricer

type TokenPricer interface {
	TokenPrice(symbol string) (float64, error)
}

type Watcher added in v0.2.0

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

func NewWatcher added in v0.2.0

func NewWatcher(
	client EventFilterer,
	tokenPricer TokenPricer,
	tokenStore config.TokenStore,
	confirmations map[uint64]uint64,
	blocktime time.Duration,
) *Watcher

func (*Watcher) WaitForConfirmations added in v0.2.0

func (w *Watcher) WaitForConfirmations(
	ctx context.Context,
	chainID uint64,
	txHash common.Hash,
	token common.Address,
	amount *big.Int,
) error

WaitForConfirmations blocks until the transaction hash has enough on-chain confirmations.

Directories

Path Synopsis
Package mock_message is a generated GoMock package.
Package mock_message is a generated GoMock package.

Jump to

Keyboard shortcuts

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