withdrawalhandler

package
v0.0.0-...-e9c30ff Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2024 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Handler

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

Handler handles withdrawals

func New

func New(log *log.Logger,
	statsClient *statsd.Client,
	collectorAccountQueue chan func(*wallet.Account, *rpc.Client, *rpc.Client),
	rpcClient *rpc.Client,
	modLogWebhook api.WebhookClient) *Handler

func (*Handler) AutoWithdrawBalances

func (w *Handler) AutoWithdrawBalances(ctxCtx context.Context) error

AutoWithdrawBalances initiates withdrawals for all balances that match the automatic withdrawal criteria

func (*Handler) CompleteAllPendingWithdrawals

func (w *Handler) CompleteAllPendingWithdrawals(ctxCtx context.Context) error

CompleteAllPendingWithdrawals completes all pending withdrawals If the process is interrupted, it's possible that not all pending withdrawals will have gone out In that case, the ones that did not go out will remain as pending withdrawals

func (*Handler) CompleteWithdrawal

func (w *Handler) CompleteWithdrawal(ctxCtx context.Context, pending *types.PendingWithdrawal, recvPending bool) error

CompleteWithdrawal completes the specified withdrawal in a fully separate database transaction (do not pass a transaction as context) It removes the pending withdrawal, sends the transaction to the network and creates a matching completed withdrawal

func (*Handler) CompleteWithdrawals

func (w *Handler) CompleteWithdrawals(ctxCtx context.Context, pending []*types.PendingWithdrawal) error

CompleteWithdrawals completes the specified pending withdrawals (do not pass a transaction as context) If the process is interrupted, it's possible that not all pending withdrawals will have gone out In that case, the ones that did not go out will remain as pending withdrawals

func (*Handler) PendingWithdrawalsCreated

func (w *Handler) PendingWithdrawalsCreated() event.Event[[]*types.PendingWithdrawal]

PendingWithdrawalsCreated is the event that is fired when new pending withdrawals are created

func (*Handler) WithdrawBalances

func (w *Handler) WithdrawBalances(ctxCtx context.Context, balances []*types.RewardBalance) error

WithdrawBalances initiates withdraws for the specified balances

func (*Handler) Worker

func (w *Handler) Worker(ctx context.Context) error

Worker waits for pending withdrawals and completes them

Jump to

Keyboard shortcuts

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