commands

package
v0.0.0-...-7608417 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrPairNotFound            = common.NewError("pair_not_found", "pair not found")
	ErrInvalidPairStatus       = common.NewError("invalid_pair_status", "pair status is not valid for this operation")
	ErrInvalidWalletAddresses  = common.NewError("invalid_wallet_addresses", "wallet addresses are not the same for both participants")
	ErrForbiddenPairForAddress = common.NewError("forbidden_pair_for_address", "pair is not allowed for the address")
)
View Source
var ErrAlreadyHasDeposit = common.NewError("already_has_deposit", "pair already has a deposit for this asset")
View Source
var ErrAlreadyHasLP = common.NewError("already_has_lp", "pair already has LP transactions for this asset")
View Source
var ErrAlreadySetAssurances = common.NewError("already_set_assurances", "assurances are already set")
View Source
var ErrInvalidAssetForPair = common.NewError("invalid_asset_for_pair", "participant asset is not valid for the pair")
View Source
var ErrInvalidAssurances = common.NewError("invalid_assurances", "assurances are not valid")

Functions

func NewAddDepositHandler

func NewAddDepositHandler(repo *eventsourcing.EventRepository) *addDepositHandler

NewAddDepositHandler creates a new AddDepositHandler

func NewConfirmPairWalletHandler

func NewConfirmPairWalletHandler(repo *eventsourcing.EventRepository) *confirmPairWalletHandler

NewConfirmPairWalletHandler creates a new ConfirmPairWalletHandler

func NewCreateNewPlanHandler

func NewCreateNewPlanHandler(repo *eventsourcing.EventRepository) *createNewPlanHandler

NewCreateNewPlanHandler creates a new CreateNewPlanHandler

func NewCreateOrMatchPairHandler

func NewCreateOrMatchPairHandler(repo *eventsourcing.EventRepository, plansQuery *queries.PlansQuery, pairsQueries *queries.PairsQuery) *createOrMatchPairHandler

NewCreateOrMatchPairHandler creates a new CreateOrMatchPairHandler

func NewSetPairAssurancesHandler

func NewSetPairAssurancesHandler(repo *eventsourcing.EventRepository) *setPairAssurancesHandler

NewSetPairAssurancesHandler creates a new SetPairAssurancesHandler

func NewSignWithdrawalHandler

func NewSignWithdrawalHandler(repo *eventsourcing.EventRepository) *signWithdrawalHandler

NewSignWithdrawalHandler creates a new SignWithdrawalHandler

func NewSubmitLPHandler

func NewSubmitLPHandler(repo *eventsourcing.EventRepository) *submitLPHandler

NewSubmitLPHandler creates a new SubmitLPHandler

func NewSubmitWithdrawalHandler

func NewSubmitWithdrawalHandler(repo *eventsourcing.EventRepository) *submitWithdrawalHandler

NewSubmitWithdrawalHandler creates a new SubmitWithdrawalHandler

Types

type AddDeposit

type AddDeposit struct {
	PairId             string         `json:"pair_id" validate:"required,uuid4"`
	ParticipantAddress domain.Address `json:"participant_address" validate:"required"`
	Asset              domain.Asset   `json:"asset" validate:"required"`
	TxHash             domain.TxHash  `json:"tx_hash" validate:"required"`
}

AddDeposit is a command to add a deposit to a pair

type AddDepositHandler

type AddDepositHandler = common.CommandHandler[AddDeposit]

AddDepositHandler is a command handler for AddDeposit

type ConfirmPairWallet

type ConfirmPairWallet struct {
	PairId               string                          `json:"pair_id" validate:"required,uuid4"`
	ParticipantAddress   domain.Address                  `json:"participant_address" validate:"required"`
	ParticipantPublicKey string                          `json:"participant_public_key" validate:"required"`
	WalletAddresses      map[domain.Asset]domain.Address `json:"wallet_addresses" validate:"required,len=2"`
}

ConfirmPairWallet is a command to confirm the shared wallet addresses

type ConfirmPairWalletHandler

type ConfirmPairWalletHandler common.CommandHandler[ConfirmPairWallet]

ConfirmPairWalletHandler is a command handler for ConfirmPairWallet

type CreateNewPlan

type CreateNewPlan struct {
	Assets          []domain.Asset                `json:"assets,omitempty" validate:"required,len=2"`
	Security        domain.MultiSigWalletSecurity `json:"security,omitempty" validate:"required,oneof=2-2"`
	Strategy        domain.ProfitSharingStrategy  `json:"strategy,omitempty" validate:"required,oneof=equal_share"`
	Quantum         int                           `json:"quantum,omitempty" validate:"required,min=1"`
	LossProtection  float64                       `json:"loss_protection,omitempty" validate:"required,min=0.1,max=0.5"`
	InvestingPeriod int                           `json:"investing_period,omitempty" validate:"required,min=1"`
}

CreateNewPlan is a command to create a new plan

type CreateNewPlanHandler

type CreateNewPlanHandler = common.CommandHandler[CreateNewPlan]

CreateNewPlanHandler is a command handler for CreateNewPlan

type CreateOrMatchPair

type CreateOrMatchPair struct {
	PlanId             string         `json:"plan_id" validate:"required,uuid4"`
	ParticipantAsset   domain.Asset   `json:"participant_asset" validate:"required"`
	ParticipantAddress domain.Address `json:"participant_address" validate:"required"`
}

CreateOrMatchPair is a command to create a new pair or match an existing pair.

type CreateOrMatchPairHandler

type CreateOrMatchPairHandler common.CommandHandler[CreateOrMatchPair]

CreateOrMatchPairHandler is a command handler for CreateOrMatchPair

type SetPairAssurances

type SetPairAssurances struct {
	PairId             string            `json:"pair_id" validate:"required,uuid4"`
	ParticipantAddress domain.Address    `json:"participant_address" validate:"required"`
	Asset              domain.Asset      `json:"asset" validate:"required"`
	Assurances         []domain.SignedTx `json:"assurances" validate:"required"`
}

SetPairAssurances is a command to set assurances for a pair

type SetPairAssurancesHandler

type SetPairAssurancesHandler common.CommandHandler[SetPairAssurances]

SetPairAssurancesHandler is a command handler for SetPairAssurances

type SignWithdrawal

type SignWithdrawal struct {
	PairId             string          `json:"pair_id" validate:"required,uuid4"`
	ParticipantAddress domain.Address  `json:"participant_address" validate:"required"`
	Tx                 domain.SignedTx `json:"tx" validate:"required"`
}

SignWithdrawal is a command to sign a withdrawal transaction

type SignWithdrawalHandler

type SignWithdrawalHandler common.CommandHandler[SignWithdrawal]

SignWithdrawalHandler is a command handler for SignWithdrawal

type SubmitLP

type SubmitLP struct {
	PairId             string         `json:"pair_id" validate:"required,uuid4"`
	ParticipantAddress domain.Address `json:"participant_address" validate:"required"`
	Asset              domain.Asset   `json:"asset" validate:"required"`
	TxHash             domain.TxHash  `json:"tx_hash" validate:"required"`
}

SubmitLP is a command to update the pair with LP transactions of both assets

type SubmitLPHandler

type SubmitLPHandler common.CommandHandler[SubmitLP]

SubmitLPHandler is a command handler for SubmitLP

type SubmitWithdrawal

type SubmitWithdrawal struct {
	PairId             string          `json:"pair_id" validate:"required,uuid4"`
	ParticipantAddress *domain.Address `json:"participant_address" validate:"-"`
	TxHash             domain.TxHash   `json:"tx_hash" validate:"required"`
}

SubmitWithdrawal is a command to submit a withdrawal transaction

type SubmitWithdrawalHandler

type SubmitWithdrawalHandler common.CommandHandler[SubmitWithdrawal]

SubmitWithdrawalHandler is a command handler for SubmitWithdrawal

Jump to

Keyboard shortcuts

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