ddchain

package
v0.2.6 Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

Functions

func FetchAddress

func FetchAddress(ctx cosmos.Context, keeper keeper.Keeper, name string, chain common.Chain) (common.Address, error)

func GetPart

func GetPart(parts []string, idx int) string

Safe accessor for split memo parts - always returns empty string for indices that are out of bounds.

func ParseAffiliateBasisPoints

func ParseAffiliateBasisPoints(ctx cosmos.Context, keeper keeper.Keeper, affBasisPoints string) (cosmos.Uint, error)

Types

type AddLiquidityMemo

type AddLiquidityMemo struct {
	MemoBase
	Address              common.Address
	AffiliateAddress     common.Address
	AffiliateBasisPoints cosmos.Uint
}

func NewAddLiquidityMemo

func NewAddLiquidityMemo(asset common.Asset, addr, affAddr common.Address, affPts cosmos.Uint) AddLiquidityMemo

func ParseAddLiquidityMemoV1

func ParseAddLiquidityMemoV1(ctx cosmos.Context, keeper keeper.Keeper, asset common.Asset, parts []string) (AddLiquidityMemo, error)

func ParseAddLiquidityMemoV104

func ParseAddLiquidityMemoV104(ctx cosmos.Context, keeper keeper.Keeper, asset common.Asset, parts []string) (AddLiquidityMemo, error)

func (AddLiquidityMemo) GetDestination

func (m AddLiquidityMemo) GetDestination() common.Address

func (AddLiquidityMemo) String

func (m AddLiquidityMemo) String() string

type BondMemo

type BondMemo struct {
	MemoBase
	NodeAddress         cosmos.AccAddress
	BondProviderAddress cosmos.AccAddress
	NodeOperatorFee     int64
}

func NewBondMemo

func NewBondMemo(addr, additional cosmos.AccAddress, operatorFee int64) BondMemo

func ParseBondMemoV81

func ParseBondMemoV81(parts []string) (BondMemo, error)

func ParseBondMemoV88

func ParseBondMemoV88(parts []string) (BondMemo, error)

func (BondMemo) GetAccAddress

func (m BondMemo) GetAccAddress() cosmos.AccAddress

type ConsolidateMemo

type ConsolidateMemo struct {
	MemoBase
}

func NewConsolidateMemo

func NewConsolidateMemo() ConsolidateMemo

NewConsolidateMemo create a new instance of ConsolidateMemo

func (ConsolidateMemo) String

func (m ConsolidateMemo) String() string

String implement fmt.Stringer

type DonateMemo

type DonateMemo struct{ MemoBase }

func ParseDonateMemoV1

func ParseDonateMemoV1(asset common.Asset) (DonateMemo, error)

func (DonateMemo) String

func (m DonateMemo) String() string

type LeaveMemo

type LeaveMemo struct {
	MemoBase
	NodeAddress cosmos.AccAddress
}

func NewLeaveMemo

func NewLeaveMemo(addr cosmos.AccAddress) LeaveMemo

func ParseLeaveMemoV1

func ParseLeaveMemoV1(parts []string) (LeaveMemo, error)

func (LeaveMemo) GetAccAddress

func (m LeaveMemo) GetAccAddress() cosmos.AccAddress

type LoanOpenMemo

type LoanOpenMemo struct {
	MemoBase
	TargetAsset          common.Asset
	TargetAddress        common.Address
	MinOut               cosmos.Uint
	AffiliateAddress     common.Address
	AffiliateBasisPoints cosmos.Uint
	DexAggregator        string
	DexTargetAddress     string
	DexTargetLimit       cosmos.Uint
}

func NewLoanOpenMemo

func NewLoanOpenMemo(targetAsset common.Asset, targetAddr common.Address, minOut cosmos.Uint, affAddr common.Address, affPts cosmos.Uint, dexAgg, dexTargetAddr string, dexTargetLimit cosmos.Uint) LoanOpenMemo

func ParseLoanOpenMemoV1

func ParseLoanOpenMemoV1(ctx cosmos.Context, keeper keeper.Keeper, targetAsset common.Asset, parts []string) (LoanOpenMemo, error)

func ParseLoanOpenMemoV112

func ParseLoanOpenMemoV112(ctx cosmos.Context, keeper keeper.Keeper, targetAsset common.Asset, parts []string) (LoanOpenMemo, error)

func (LoanOpenMemo) GetAffiliateAddress

func (m LoanOpenMemo) GetAffiliateAddress() common.Address

func (LoanOpenMemo) GetAffiliateBasisPoints

func (m LoanOpenMemo) GetAffiliateBasisPoints() cosmos.Uint

func (LoanOpenMemo) GetDexAggregator

func (m LoanOpenMemo) GetDexAggregator() string

func (LoanOpenMemo) GetDexTargetAddress

func (m LoanOpenMemo) GetDexTargetAddress() string

func (LoanOpenMemo) GetMinOut

func (m LoanOpenMemo) GetMinOut() cosmos.Uint

func (LoanOpenMemo) GetTargetAddress

func (m LoanOpenMemo) GetTargetAddress() common.Address

func (LoanOpenMemo) GetTargetAsset

func (m LoanOpenMemo) GetTargetAsset() common.Asset

func (LoanOpenMemo) String

func (m LoanOpenMemo) String() string

type LoanRepaymentMemo

type LoanRepaymentMemo struct {
	MemoBase
	Owner  common.Address
	MinOut cosmos.Uint
}

func NewLoanRepaymentMemo

func NewLoanRepaymentMemo(asset common.Asset, owner common.Address, minOut cosmos.Uint) LoanRepaymentMemo

func ParseLoanRepaymentMemoV1

func ParseLoanRepaymentMemoV1(ctx cosmos.Context, keeper keeper.Keeper, asset common.Asset, parts []string) (LoanRepaymentMemo, error)

func ParseLoanRepaymentMemoV112

func ParseLoanRepaymentMemoV112(ctx cosmos.Context, keeper keeper.Keeper, asset common.Asset, parts []string) (LoanRepaymentMemo, error)

func (LoanRepaymentMemo) String

func (m LoanRepaymentMemo) String() string

type ManageDDNameMemo

type ManageDDNameMemo struct {
	MemoBase
	Name           string
	Chain          common.Chain
	Address        common.Address
	PreferredAsset common.Asset
	Expire         int64
	Owner          cosmos.AccAddress
}

func NewManageDDNameMemo

func NewManageDDNameMemo(name string, chain common.Chain, addr common.Address, expire int64, asset common.Asset, owner cosmos.AccAddress) ManageDDNameMemo

func ParseManageDDNameMemoV1

func ParseManageDDNameMemoV1(parts []string) (ManageDDNameMemo, error)

func (ManageDDNameMemo) GetAddress

func (m ManageDDNameMemo) GetAddress() common.Address

func (ManageDDNameMemo) GetBlockExpire

func (m ManageDDNameMemo) GetBlockExpire() int64

func (ManageDDNameMemo) GetChain

func (m ManageDDNameMemo) GetChain() common.Chain

func (ManageDDNameMemo) GetName

func (m ManageDDNameMemo) GetName() string

type Memo

type Memo interface {
	IsType(tx TxType) bool
	GetType() TxType
	IsEmpty() bool
	IsInbound() bool
	IsOutbound() bool
	IsInternal() bool
	String() string
	GetAsset() common.Asset
	GetAmount() cosmos.Uint
	GetDestination() common.Address
	GetSlipLimit() cosmos.Uint
	GetTxID() common.TxID
	GetAccAddress() cosmos.AccAddress
	GetBlockHeight() int64
	GetDexAggregator() string
	GetDexTargetAddress() string
	GetDexTargetLimit() *cosmos.Uint
	GetAffiliateDDName() *types.DDName
}

func ParseMemo

func ParseMemo(version semver.Version, memo string) (mem Memo, err error)

func ParseMemoWithDDNames

func ParseMemoWithDDNames(ctx cosmos.Context, keeper keeper.Keeper, memo string) (mem Memo, err error)

type MemoBase

type MemoBase struct {
	TxType TxType
	Asset  common.Asset
}

func (MemoBase) GetAccAddress

func (m MemoBase) GetAccAddress() cosmos.AccAddress

func (MemoBase) GetAffiliateDDName

func (m MemoBase) GetAffiliateDDName() *types.DDName

func (MemoBase) GetAmount

func (m MemoBase) GetAmount() cosmos.Uint

func (MemoBase) GetAsset

func (m MemoBase) GetAsset() common.Asset

func (MemoBase) GetBlockHeight

func (m MemoBase) GetBlockHeight() int64

func (MemoBase) GetDestination

func (m MemoBase) GetDestination() common.Address

func (MemoBase) GetDexAggregator

func (m MemoBase) GetDexAggregator() string

func (MemoBase) GetDexTargetAddress

func (m MemoBase) GetDexTargetAddress() string

func (MemoBase) GetDexTargetLimit

func (m MemoBase) GetDexTargetLimit() *cosmos.Uint

func (MemoBase) GetSlipLimit

func (m MemoBase) GetSlipLimit() cosmos.Uint

func (MemoBase) GetTxID

func (m MemoBase) GetTxID() common.TxID

func (MemoBase) GetType

func (m MemoBase) GetType() TxType

func (MemoBase) IsEmpty

func (m MemoBase) IsEmpty() bool

func (MemoBase) IsInbound

func (m MemoBase) IsInbound() bool

func (MemoBase) IsInternal

func (m MemoBase) IsInternal() bool

func (MemoBase) IsOutbound

func (m MemoBase) IsOutbound() bool

func (MemoBase) IsType

func (m MemoBase) IsType(tx TxType) bool

func (MemoBase) String

func (m MemoBase) String() string

type MigrateMemo

type MigrateMemo struct {
	MemoBase
	BlockHeight int64
}

func NewMigrateMemo

func NewMigrateMemo(blockHeight int64) MigrateMemo

func ParseMigrateMemoV1

func ParseMigrateMemoV1(parts []string) (MigrateMemo, error)

func (MigrateMemo) GetBlockHeight

func (m MigrateMemo) GetBlockHeight() int64

func (MigrateMemo) String

func (m MigrateMemo) String() string

type NoOpMemo

type NoOpMemo struct {
	MemoBase
	Action string
}

func NewNoOpMemo

func NewNoOpMemo(action string) NoOpMemo

NewNoOpMemo create a new instance of NoOpMemo

func ParseNoOpMemoV1

func ParseNoOpMemoV1(parts []string) (NoOpMemo, error)

func (NoOpMemo) String

func (m NoOpMemo) String() string

String implement fmt.Stringer

type OutboundMemo

type OutboundMemo struct {
	MemoBase
	TxID common.TxID
}

func NewOutboundMemo

func NewOutboundMemo(txID common.TxID) OutboundMemo

func ParseOutboundMemoV1

func ParseOutboundMemoV1(parts []string) (OutboundMemo, error)

func (OutboundMemo) GetTxID

func (m OutboundMemo) GetTxID() common.TxID

func (OutboundMemo) String

func (m OutboundMemo) String() string

type RagnarokMemo

type RagnarokMemo struct {
	MemoBase
	BlockHeight int64
}

func NewRagnarokMemo

func NewRagnarokMemo(blockHeight int64) RagnarokMemo

func ParseRagnarokMemoV1

func ParseRagnarokMemoV1(parts []string) (RagnarokMemo, error)

func (RagnarokMemo) GetBlockHeight

func (m RagnarokMemo) GetBlockHeight() int64

func (RagnarokMemo) String

func (m RagnarokMemo) String() string

type RefundMemo

type RefundMemo struct {
	MemoBase
	TxID common.TxID
}

func NewRefundMemo

func NewRefundMemo(txID common.TxID) RefundMemo

NewRefundMemo create a new RefundMemo

func ParseRefundMemoV1

func ParseRefundMemoV1(parts []string) (RefundMemo, error)

func (RefundMemo) GetTxID

func (m RefundMemo) GetTxID() common.TxID

func (RefundMemo) String

func (m RefundMemo) String() string

String implement fmt.Stringer

type ReserveMemo

type ReserveMemo struct {
	MemoBase
}

type SwapMemo

type SwapMemo struct {
	MemoBase
	Destination          common.Address
	SlipLimit            cosmos.Uint
	AffiliateAddress     common.Address
	AffiliateBasisPoints cosmos.Uint
	DexAggregator        string
	DexTargetAddress     string
	DexTargetLimit       *cosmos.Uint
	OrderType            types.OrderType
	StreamInterval       uint64
	StreamQuantity       uint64
	AffiliateDDName      *types.DDName
}

func NewSwapMemo

func NewSwapMemo(asset common.Asset, dest common.Address, slip cosmos.Uint, affAddr common.Address, affPts cosmos.Uint, dexAgg, dexTargetAddress string, dexTargetLimit cosmos.Uint, orderType types.OrderType, quan, interval uint64, tn types.DDName) SwapMemo

func ParseSwapMemoV1

func ParseSwapMemoV1(ctx cosmos.Context, keeper keeper.Keeper, asset common.Asset, parts []string) (SwapMemo, error)

func ParseSwapMemoV104

func ParseSwapMemoV104(ctx cosmos.Context, keeper keeper.Keeper, asset common.Asset, parts []string) (SwapMemo, error)

func ParseSwapMemoV112

func ParseSwapMemoV112(ctx cosmos.Context, keeper keeper.Keeper, asset common.Asset, parts []string) (SwapMemo, error)

func ParseSwapMemoV115

func ParseSwapMemoV115(ctx cosmos.Context, keeper keeper.Keeper, asset common.Asset, parts []string) (SwapMemo, error)

func ParseSwapMemoV92

func ParseSwapMemoV92(ctx cosmos.Context, keeper keeper.Keeper, asset common.Asset, parts []string) (SwapMemo, error)

func ParseSwapMemoV98

func ParseSwapMemoV98(ctx cosmos.Context, keeper keeper.Keeper, asset common.Asset, parts []string) (SwapMemo, error)

func (SwapMemo) GetAffiliateAddress

func (m SwapMemo) GetAffiliateAddress() common.Address

func (SwapMemo) GetAffiliateBasisPoints

func (m SwapMemo) GetAffiliateBasisPoints() cosmos.Uint

func (SwapMemo) GetAffiliateDDName

func (m SwapMemo) GetAffiliateDDName() *types.DDName

func (SwapMemo) GetDestination

func (m SwapMemo) GetDestination() common.Address

func (SwapMemo) GetDexAggregator

func (m SwapMemo) GetDexAggregator() string

func (SwapMemo) GetDexTargetAddress

func (m SwapMemo) GetDexTargetAddress() string

func (SwapMemo) GetDexTargetLimit

func (m SwapMemo) GetDexTargetLimit() *cosmos.Uint

func (SwapMemo) GetOrderType

func (m SwapMemo) GetOrderType() types.OrderType

func (SwapMemo) GetSlipLimit

func (m SwapMemo) GetSlipLimit() cosmos.Uint

func (SwapMemo) GetStreamInterval

func (m SwapMemo) GetStreamInterval() uint64

func (SwapMemo) GetStreamQuantity

func (m SwapMemo) GetStreamQuantity() uint64

func (SwapMemo) String

func (m SwapMemo) String() string

type SwitchMemo

type SwitchMemo struct {
	MemoBase
	Destination common.Address
}

func NewSwitchMemo

func NewSwitchMemo(addr common.Address) SwitchMemo

func ParseSwitchMemoV1

func ParseSwitchMemoV1(ctx cosmos.Context, keeper keeper.Keeper, parts []string) (SwitchMemo, error)

func (SwitchMemo) GetDestination

func (m SwitchMemo) GetDestination() common.Address

type TxType

type TxType uint8
const (
	TxUnknown TxType = iota
	TxAdd
	TxWithdraw
	TxSwap
	TxLimitOrder
	TxOutbound
	TxDonate
	TxBond
	TxUnbond
	TxLeave
	TxYggdrasilFund
	TxYggdrasilReturn
	TxReserve
	TxRefund
	TxMigrate
	TxRagnarok
	TxSwitch // TODO remove on hard fork
	TxNoOp
	TxConsolidate
	TxDDName
	TxLoanOpen
	TxLoanRepayment
)

func StringToTxType

func StringToTxType(s string) (TxType, error)

converts a string into a txType

func (TxType) Equals

func (tx TxType) Equals(tx2 TxType) bool

Check if two txTypes are the same

func (TxType) HasOutbound

func (tx TxType) HasOutbound() bool

HasOutbound whether the txtype might trigger outbound tx

func (TxType) IsEmpty

func (tx TxType) IsEmpty() bool

func (TxType) IsInbound

func (tx TxType) IsInbound() bool

func (TxType) IsInternal

func (tx TxType) IsInternal() bool

func (TxType) IsOutbound

func (tx TxType) IsOutbound() bool

func (TxType) String

func (tx TxType) String() string

Converts a txType into a string

type UnbondMemo

type UnbondMemo struct {
	MemoBase
	NodeAddress         cosmos.AccAddress
	Amount              cosmos.Uint
	BondProviderAddress cosmos.AccAddress
}

func NewUnbondMemo

func NewUnbondMemo(addr, additional cosmos.AccAddress, amt cosmos.Uint) UnbondMemo

func ParseUnbondMemoV81

func ParseUnbondMemoV81(parts []string) (UnbondMemo, error)

func (UnbondMemo) GetAccAddress

func (m UnbondMemo) GetAccAddress() cosmos.AccAddress

func (UnbondMemo) GetAmount

func (m UnbondMemo) GetAmount() cosmos.Uint

type WithdrawLiquidityMemo

type WithdrawLiquidityMemo struct {
	MemoBase
	Amount          cosmos.Uint
	WithdrawalAsset common.Asset
}

func NewWithdrawLiquidityMemo

func NewWithdrawLiquidityMemo(asset common.Asset, amt cosmos.Uint, withdrawalAsset common.Asset) WithdrawLiquidityMemo

func ParseWithdrawLiquidityMemoV1

func ParseWithdrawLiquidityMemoV1(asset common.Asset, parts []string) (WithdrawLiquidityMemo, error)

func (WithdrawLiquidityMemo) GetAmount

func (m WithdrawLiquidityMemo) GetAmount() cosmos.Uint

func (WithdrawLiquidityMemo) GetWithdrawalAsset

func (m WithdrawLiquidityMemo) GetWithdrawalAsset() common.Asset

type YggdrasilFundMemo

type YggdrasilFundMemo struct {
	MemoBase
	BlockHeight int64
}

func NewYggdrasilFund

func NewYggdrasilFund(blockHeight int64) YggdrasilFundMemo

func ParseYggdrasilFundMemoV1

func ParseYggdrasilFundMemoV1(parts []string) (YggdrasilFundMemo, error)

func (YggdrasilFundMemo) GetBlockHeight

func (m YggdrasilFundMemo) GetBlockHeight() int64

func (YggdrasilFundMemo) String

func (m YggdrasilFundMemo) String() string

type YggdrasilReturnMemo

type YggdrasilReturnMemo struct {
	MemoBase
	BlockHeight int64
}

func NewYggdrasilReturn

func NewYggdrasilReturn(blockHeight int64) YggdrasilReturnMemo

func ParseYggdrasilReturnMemoV1

func ParseYggdrasilReturnMemoV1(parts []string) (YggdrasilReturnMemo, error)

func (YggdrasilReturnMemo) GetBlockHeight

func (m YggdrasilReturnMemo) GetBlockHeight() int64

func (YggdrasilReturnMemo) String

func (m YggdrasilReturnMemo) String() string

Jump to

Keyboard shortcuts

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