message

package
v0.5.4 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2025 License: LGPL-3.0 Imports: 34 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TIMEOUT     = 10 * time.Minute
	BLOCK_RANGE = 1000
)
View Source
const (
	DOMAIN_NAME = "OIFEscrowLIFI"
	VERSION     = "1"
)
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 NewLifiEscrowData added in v0.5.0

func NewLifiEscrowData(source, destination uint64, lifiData *LifiEscrowData) *message.Message

func NewLifiUnlockMessage added in v0.5.0

func NewLifiUnlockMessage(source, destination uint64, lifiData *LifiUnlockData) *message.Message

func NewMayanMessage added in v0.2.0

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

func NewRhinestoneMessage added in v0.3.0

func NewRhinestoneMessage(source, destination uint64, rhinestoneData *RhinestoneData) *message.Message

Types

type AcrossData

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

	DepositTxHash    common.Hash
	DepositId        *big.Int
	Nonce            *big.Int
	LiquidityPool    common.Address
	RepaymentChainID uint64
	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,
	pools map[uint64]common.Address,
	repayers map[uint64]common.Address,
	coordinator Coordinator,
	host host.Host,
	comm comm.Communication,
	fetcher signing.SaveDataFetcher,
	depositFetcher DepositFetcher,
	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 BundleFetcher added in v0.3.0

type BundleFetcher interface {
	GetBundle(bundleID string) (*rhinestone.Bundle, error)
}

type ConfirmationWatcher added in v0.2.0

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

type Coordinator

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

type DepositFetcher added in v0.3.0

type DepositFetcher interface {
	Deposit(ctx context.Context, hash common.Hash, depositID *big.Int) (*events.AcrossDeposit, 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 LifiEscrowData added in v0.5.0

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

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

type LifiEscrowMessageHandler added in v0.5.0

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

func NewLifiEscrowMessageHandler added in v0.5.0

func NewLifiEscrowMessageHandler(
	chainID uint64,
	mpcAddress common.Address,
	lifiAddresses map[uint64]common.Address,
	coordinator Coordinator,
	host host.Host,
	comm comm.Communication,
	fetcher signing.SaveDataFetcher,
	confirmationWatcher ConfirmationWatcher,
	tokenStore config.TokenStore,
	orderFetcher OrderFetcher,
	orderPricer pricing.OrderPricer,
	router router.OrderRouter,
	validator OrderValidator,
	sigChn chan any,
) *LifiEscrowMessageHandler

func (*LifiEscrowMessageHandler) HandleMessage added in v0.5.0

HandleMessage verifies the lifi escrow order on-chain and signs the order if it is valid

func (*LifiEscrowMessageHandler) Listen added in v0.5.0

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

type LifiUnlockData added in v0.5.0

type LifiUnlockData struct {
	SigChn chan interface{} `json:"-"`

	OrderID string
	Settler common.Address

	Coordinator peer.ID
	Source      uint64
	Destination uint64
}

type LifiUnlockHandler added in v0.5.0

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

func NewLifiUnlockHandler added in v0.5.0

func NewLifiUnlockHandler(
	chainID uint64,
	repayers map[uint64]common.Address,
	coordinator Coordinator,
	host host.Host,
	comm comm.Communication,
	fetcher signing.SaveDataFetcher,
) *LifiUnlockHandler

func (*LifiUnlockHandler) HandleMessage added in v0.5.0

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

HandleMessage signs the unlock request to the address of the repayer.

func (*LifiUnlockHandler) Listen added in v0.5.0

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

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:"-"`

	OrderHash     string
	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 OrderFetcher added in v0.5.0

type OrderFetcher interface {
	GetOrder(orderID string) (*lifi.LifiOrder, error)
}

type OrderValidator added in v0.5.0

type OrderValidator interface {
	Validate(order *lifi.AugmentedLifiOrder) error
}

type RhinestoneData added in v0.3.0

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

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

type RhinestoneMessageHandler added in v0.3.0

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

func NewRhinestoneMessageHandler added in v0.3.0

func NewRhinestoneMessageHandler(
	chainID uint64,
	coordinator Coordinator,
	host host.Host,
	comm comm.Communication,
	fetcher signing.SaveDataFetcher,
	tokenStore config.TokenStore,
	rhinestoneContract contracts.RhinestoneContract,
	bundleFetcher BundleFetcher,
	sigChn chan any,
) *RhinestoneMessageHandler

func (*RhinestoneMessageHandler) HandleMessage added in v0.3.0

HandleMessage verifies the bundle data and signs the unlock hash to use liquidity for the Rhinestone protocol

func (*RhinestoneMessageHandler) Listen added in v0.3.0

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

type SwapFetcher added in v0.2.0

type SwapFetcher interface {
	GetSwap(hash string) (*mayan.MayanSwap, 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) WaitForOrderConfirmations added in v0.5.0

func (w *Watcher) WaitForOrderConfirmations(
	ctx context.Context,
	chainID uint64,
	txHash common.Hash,
	orderValue float64,
) error

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

func (*Watcher) WaitForTokenConfirmations added in v0.5.0

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

WaitForTokenConfirmations 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