types

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2020 License: Apache-2.0 Imports: 16 Imported by: 13

Documentation

Index

Constants

View Source
const (
	EventTypeCreateAtomicSwap  = "createAtomicSwap"
	EventTypeDepositAtomicSwap = "depositAtomicSwap"
	EventTypeClaimAtomicSwap   = "claimAtomicSwap"
	EventTypeRefundAtomicSwap  = "refundAtomicSwap"

	// Common
	AttributeKeySender           = "sender"
	AttributeKeyRecipient        = "recipient"
	AttributeKeyAtomicSwapID     = "atomic_swap_id"
	AttributeKeyRandomNumberHash = "random_number_hash"
	AttributeKeyTimestamp        = "timestamp"
	AttributeKeySenderOtherChain = "sender_other_chain"
	AttributeKeyExpireHeight     = "expire_height"
	AttributeKeyAmount           = "amount"
	AttributeKeyExpectedIncome   = "expected_income"
	AttributeKeyDirection        = "direction"

	// Claim
	AttributeKeyClaimSender  = "claim_sender"
	AttributeKeyRandomNumber = "random_number"

	// Refund
	AttributeKeyRefundSender = "refund_sender"

	AttributeValueCategory = ModuleName
)

bep3 module event types

View Source
const (
	// ModuleName is the name of the module
	ModuleName = "bep3"

	// StoreKey to be used when creating the KVStore
	StoreKey = ModuleName

	// RouterKey to be used for routing msgs
	RouterKey = ModuleName

	// QuerierRoute is the querier route for bep3
	QuerierRoute = ModuleName

	// DefaultParamspace default namestore
	DefaultParamspace = ModuleName
)
View Source
const (
	CreateAtomicSwap  = "createAtomicSwap"
	DepositAtomicSwap = "depositAtomicSwap"
	ClaimAtomicSwap   = "claimAtomicSwap"
	RefundAtomicSwap  = "refundAtomicSwap"
	CalcSwapID        = "calcSwapID"

	Int64Size               = 8
	RandomNumberHashLength  = 32
	RandomNumberLength      = 32
	AddrByteCount           = 20
	MaxOtherChainAddrLength = 64
	SwapIDLength            = 32
	MaxExpectedIncomeLength = 64
)
View Source
const (
	// QueryGetAssetSupply command for getting info about an asset's supply
	QueryGetAssetSupply = "supply"
	// QueryGetAtomicSwap command for getting info about an atomic swap
	QueryGetAtomicSwap = "swap"
	// QueryGetAtomicSwaps command for getting a list of atomic swaps
	QueryGetAtomicSwaps = "swaps"
	// QueryGetParams command for getting module params
	QueryGetParams = "parameters"
)
View Source
const DefaultLongtermStorageDuration int64 = 86400

DefaultLongtermStorageDuration is 1 week (assuming a block time of 7 seconds)

Variables

View Source
var (
	AtomicSwapKeyPrefix             = []byte{0x00} // prefix for keys that store AtomicSwaps
	AtomicSwapByBlockPrefix         = []byte{0x01} // prefix for keys of the AtomicSwapsByBlock index
	AssetSupplyKeyPrefix            = []byte{0x02} // prefix for keys that store global asset supply counts
	AtomicSwapLongtermStoragePrefix = []byte{0x03} // prefix for keys of the AtomicSwapLongtermStorage index
)

Key prefixes

View Source
var (
	KeyBnbDeputyAddress = []byte("BnbDeputyAddress")
	KeyMinBlockLock     = []byte("MinBlockLock")
	KeyMaxBlockLock     = []byte("MaxBlockLock")
	KeySupportedAssets  = []byte("SupportedAssets")

	AbsoluteMaximumBlockLock int64 = 10000
	AbsoluteMinimumBlockLock int64 = 50
	DefaultMinBlockLock      int64 = 80
	DefaultMaxBlockLock      int64 = 600
	DefaultSupportedAssets         = AssetParams{
		AssetParam{
			Denom:  "bnb",
			CoinID: 714,
			Limit:  sdk.NewInt(100000000000),
			Active: true,
		},
	}
)

Parameter keys

View Source
var (
	AtomicSwapCoinsAccAddr = sdk.AccAddress(crypto.AddressHash([]byte("KavaAtomicSwapCoins")))
)

ensure Msg interface compliance at compile time

View Source
var ModuleCdc = codec.New()

Functions

func BytesToHex

func BytesToHex(data []byte) string

BytesToHex converts data from []byte to a hex-encoded string

func CalculateRandomHash

func CalculateRandomHash(randomNumber []byte, timestamp int64) []byte

CalculateRandomHash calculates the hash of a number and timestamp

func CalculateSwapID

func CalculateSwapID(randomNumberHash []byte, sender sdk.AccAddress, senderOtherChain string) []byte

CalculateSwapID calculates the hash of a RandomNumberHash, sdk.AccAddress, and string

func ErrAssetNotActive

func ErrAssetNotActive(codespace sdk.CodespaceType, denom string) sdk.Error

ErrAssetNotActive error for when an asset is currently inactive

func ErrAssetNotSupported

func ErrAssetNotSupported(codespace sdk.CodespaceType, denom string) sdk.Error

ErrAssetNotSupported error for when an asset is not supported

func ErrAssetSupplyNotFound

func ErrAssetSupplyNotFound(codespace sdk.CodespaceType, denom string) sdk.Error

ErrAssetSupplyNotFound error for when an asset's supply is not found in the store

func ErrAtomicSwapAlreadyExists

func ErrAtomicSwapAlreadyExists(codespace sdk.CodespaceType, swapID cmn.HexBytes) sdk.Error

ErrAtomicSwapAlreadyExists error for when an AtomicSwap with this swapID already exists

func ErrAtomicSwapNotFound

func ErrAtomicSwapNotFound(codespace sdk.CodespaceType, id []byte) sdk.Error

ErrAtomicSwapNotFound error for when an atomic swap is not found

func ErrExceedsAvailableSupply

func ErrExceedsAvailableSupply(codespace sdk.CodespaceType, increase sdk.Coin, available sdk.Int) sdk.Error

ErrExceedsAvailableSupply error for when the proposed outgoing amount exceeds the total available supply

func ErrExceedsSupplyLimit

func ErrExceedsSupplyLimit(codespace sdk.CodespaceType, increase, current, limit sdk.Coin) sdk.Error

ErrExceedsSupplyLimit error for when the proposed supply increase would put the supply above limit

func ErrInvalidClaimSecret

func ErrInvalidClaimSecret(codespace sdk.CodespaceType, submittedSecret []byte, swapID []byte) sdk.Error

ErrInvalidClaimSecret error when a submitted secret doesn't match an AtomicSwap's swapID

func ErrInvalidCurrentSupply

func ErrInvalidCurrentSupply(codespace sdk.CodespaceType, decrease, current sdk.Coin) sdk.Error

ErrInvalidCurrentSupply error for when the proposed decrease would result in a negative current supply

func ErrInvalidHeightSpan

func ErrInvalidHeightSpan(codespace sdk.CodespaceType, heightspan int64, minLockTime int64, maxLockTime int64) sdk.Error

ErrInvalidHeightSpan error a proposed height span is outside of lock time range

func ErrInvalidIncomingSupply

func ErrInvalidIncomingSupply(codespace sdk.CodespaceType, decrease, incoming sdk.Coin) sdk.Error

ErrInvalidIncomingSupply error for when the proposed decrease would result in a negative incoming supply

func ErrInvalidOutgoingSupply

func ErrInvalidOutgoingSupply(codespace sdk.CodespaceType, decrease, outgoing sdk.Coin) sdk.Error

ErrInvalidOutgoingSupply error for when the proposed decrease would result in a negative outgoing supply

func ErrInvalidTimestamp

func ErrInvalidTimestamp(codespace sdk.CodespaceType) sdk.Error

ErrInvalidTimestamp error for when an timestamp is outside of bounds. Assumes block time of 10 seconds.

func ErrSwapNotClaimable

func ErrSwapNotClaimable(codespace sdk.CodespaceType) sdk.Error

ErrSwapNotClaimable error for when an atomic swap is not open and cannot be claimed

func ErrSwapNotRefundable

func ErrSwapNotRefundable(codespace sdk.CodespaceType) sdk.Error

ErrSwapNotRefundable error for when an AtomicSwap has not expired and cannot be refunded

func GenerateSecureRandomNumber

func GenerateSecureRandomNumber() (*big.Int, error)

GenerateSecureRandomNumber generates cryptographically strong pseudo-random number

func GetAtomicSwapByHeightKey

func GetAtomicSwapByHeightKey(height int64, swapID []byte) []byte

GetAtomicSwapByHeightKey is used by the AtomicSwapByBlock index and AtomicSwapLongtermStorage index

func HexToBytes

func HexToBytes(data string) ([]byte, error)

HexToBytes converts data from a hex-encoded string to []bytes

func ParamKeyTable

func ParamKeyTable() params.KeyTable

ParamKeyTable Key declaration for parameters

func RegisterCodec

func RegisterCodec(cdc *codec.Codec)

RegisterCodec registers concrete types on amino

func Uint64FromBytes

func Uint64FromBytes(bz []byte) uint64

Uint64FromBytes converts some fixed length bytes back into a uint64.

func Uint64ToBytes

func Uint64ToBytes(id uint64) []byte

Uint64ToBytes converts a uint64 into fixed length bytes for use in store keys.

Types

type AssetParam

type AssetParam struct {
	Denom  string  `json:"denom" yaml:"denom"`     // name of the asset
	CoinID int     `json:"coin_id" yaml:"coin_id"` // internationally recognized coin ID
	Limit  sdk.Int `json:"limit" yaml:"limit"`     // asset supply limit
	Active bool    `json:"active" yaml:"active"`   // denotes if asset is available or paused
}

AssetParam governance parameters for each asset within a supported chain

func (AssetParam) String

func (ap AssetParam) String() string

String implements fmt.Stringer

type AssetParams

type AssetParams []AssetParam

AssetParams array of AssetParam

func (AssetParams) String

func (aps AssetParams) String() string

String implements fmt.Stringer

type AssetSupplies

type AssetSupplies []AssetSupply

AssetSupplies is a slice of AssetSupply

func (AssetSupplies) String

func (supplies AssetSupplies) String() string

String implements stringer

type AssetSupply

type AssetSupply struct {
	Denom          string   `json:"denom"  yaml:"denom"`
	IncomingSupply sdk.Coin `json:"incoming_supply"  yaml:"incoming_supply"`
	OutgoingSupply sdk.Coin `json:"outgoing_supply"  yaml:"outgoing_supply"`
	CurrentSupply  sdk.Coin `json:"current_supply"  yaml:"current_supply"`
	Limit          sdk.Coin `json:"limit"  yaml:"limit"`
}

AssetSupply contains information about an asset's supply

func NewAssetSupply

func NewAssetSupply(denom string, incomingSupply, outgoingSupply, currentSupply, limit sdk.Coin) AssetSupply

NewAssetSupply initializes a new AssetSupply

func (AssetSupply) String

func (a AssetSupply) String() string

String implements stringer

type AtomicSwap

type AtomicSwap struct {
	Swap                `json:"swap" yaml:"swap"`
	Amount              sdk.Coins      `json:"amount"  yaml:"amount"`
	RandomNumberHash    cmn.HexBytes   `json:"random_number_hash"  yaml:"random_number_hash"`
	ExpireHeight        int64          `json:"expire_height"  yaml:"expire_height"`
	Timestamp           int64          `json:"timestamp"  yaml:"timestamp"`
	Sender              sdk.AccAddress `json:"sender"  yaml:"sender"`
	Recipient           sdk.AccAddress `json:"recipient"  yaml:"recipient"`
	SenderOtherChain    string         `json:"sender_other_chain"  yaml:"sender_other_chain"`
	RecipientOtherChain string         `json:"recipient_other_chain"  yaml:"recipient_other_chain"`
	ClosedBlock         int64          `json:"closed_block"  yaml:"closed_block"`
	Status              SwapStatus     `json:"status"  yaml:"status"`
	CrossChain          bool           `json:"cross_chain"  yaml:"cross_chain"`
	Direction           SwapDirection  `json:"direction"  yaml:"direction"`
}

AtomicSwap contains the information for an atomic swap

func NewAtomicSwap

func NewAtomicSwap(amount sdk.Coins, randomNumberHash cmn.HexBytes, expireHeight, timestamp int64, sender,
	recipient sdk.AccAddress, senderOtherChain string, recipientOtherChain string, closedBlock int64,
	status SwapStatus, crossChain bool, direction SwapDirection) AtomicSwap

NewAtomicSwap returns a new AtomicSwap

func (AtomicSwap) GetModuleAccountCoins

func (a AtomicSwap) GetModuleAccountCoins() sdk.Coins

GetModuleAccountCoins returns the swap's amount as sdk.Coins

func (AtomicSwap) GetSwapID

func (a AtomicSwap) GetSwapID() cmn.HexBytes

GetSwapID calculates the ID of an atomic swap

func (AtomicSwap) String

func (a AtomicSwap) String() string

String implements stringer

func (AtomicSwap) Validate

func (a AtomicSwap) Validate() error

Validate verifies that recipient is not empty

type AtomicSwaps

type AtomicSwaps []AtomicSwap

AtomicSwaps is a slice of AtomicSwap

func (AtomicSwaps) String

func (swaps AtomicSwaps) String() string

String implements stringer

type CodeType

type CodeType = sdk.CodeType

CodeType is the local code type

const (
	// DefaultCodespace default bep3 codespace
	DefaultCodespace            sdk.CodespaceType = ModuleName
	CodeInvalidTimestamp        CodeType          = 1
	CodeInvalidHeightSpan       CodeType          = 2
	CodeAssetNotSupported       CodeType          = 3
	CodeAssetNotActive          CodeType          = 4
	CodeAssetSupplyNotFound     CodeType          = 5
	CodeExceedsSupplyLimit      CodeType          = 6
	CodeExceedsAvailableSupply  CodeType          = 7
	CodeInvalidCurrentSupply    CodeType          = 8
	CodeInvalidIncomingSupply   CodeType          = 9
	CodeInvalidOutgoingSupply   CodeType          = 10
	CodeInvalidClaimSecret      CodeType          = 11
	CodeAtomicSwapAlreadyExists CodeType          = 12
	CodeAtomicSwapNotFound      CodeType          = 13
	CodeSwapNotRefundable       CodeType          = 14
	CodeSwapNotClaimable        CodeType          = 15
)

type GenesisState

type GenesisState struct {
	Params        Params        `json:"params" yaml:"params"`
	AtomicSwaps   AtomicSwaps   `json:"atomic_swaps" yaml:"atomic_swaps"`
	AssetSupplies AssetSupplies `json:"assets_supplies" yaml:"assets_supplies"`
}

GenesisState - all bep3 state that must be provided at genesis

func DefaultGenesisState

func DefaultGenesisState() GenesisState

DefaultGenesisState - default GenesisState used by Cosmos Hub

func NewGenesisState

func NewGenesisState(params Params, swaps AtomicSwaps, supplies AssetSupplies) GenesisState

NewGenesisState creates a new GenesisState object

func (GenesisState) Equal

func (gs GenesisState) Equal(gs2 GenesisState) bool

Equal checks whether two GenesisState structs are equivalent.

func (GenesisState) IsEmpty

func (gs GenesisState) IsEmpty() bool

IsEmpty returns true if a GenesisState is empty.

func (GenesisState) Validate

func (gs GenesisState) Validate() error

Validate validates genesis inputs. It returns error if validation of any input fails.

type MsgClaimAtomicSwap

type MsgClaimAtomicSwap struct {
	From         sdk.AccAddress `json:"from"  yaml:"from"`
	SwapID       cmn.HexBytes   `json:"swap_id"  yaml:"swap_id"`
	RandomNumber cmn.HexBytes   `json:"random_number"  yaml:"random_number"`
}

MsgClaimAtomicSwap defines a AtomicSwap claim

func NewMsgClaimAtomicSwap

func NewMsgClaimAtomicSwap(from sdk.AccAddress, swapID, randomNumber []byte) MsgClaimAtomicSwap

NewMsgClaimAtomicSwap initializes a new MsgClaimAtomicSwap

func (MsgClaimAtomicSwap) GetInvolvedAddresses

func (msg MsgClaimAtomicSwap) GetInvolvedAddresses() []sdk.AccAddress

GetInvolvedAddresses gets the addresses involved in a MsgClaimAtomicSwap

func (MsgClaimAtomicSwap) GetSignBytes

func (msg MsgClaimAtomicSwap) GetSignBytes() []byte

GetSignBytes gets the sign bytes of a MsgClaimAtomicSwap

func (MsgClaimAtomicSwap) GetSigners

func (msg MsgClaimAtomicSwap) GetSigners() []sdk.AccAddress

GetSigners gets the signers of a MsgClaimAtomicSwap

func (MsgClaimAtomicSwap) Route

func (msg MsgClaimAtomicSwap) Route() string

Route establishes the route for the MsgClaimAtomicSwap

func (MsgClaimAtomicSwap) String

func (msg MsgClaimAtomicSwap) String() string

String prints the MsgClaimAtomicSwap

func (MsgClaimAtomicSwap) Type

func (msg MsgClaimAtomicSwap) Type() string

Type is the name of MsgClaimAtomicSwap

func (MsgClaimAtomicSwap) ValidateBasic

func (msg MsgClaimAtomicSwap) ValidateBasic() sdk.Error

ValidateBasic validates the MsgClaimAtomicSwap

type MsgCreateAtomicSwap

type MsgCreateAtomicSwap struct {
	From                sdk.AccAddress `json:"from"  yaml:"from"`
	To                  sdk.AccAddress `json:"to"  yaml:"to"`
	RecipientOtherChain string         `json:"recipient_other_chain"  yaml:"recipient_other_chain"`
	SenderOtherChain    string         `json:"sender_other_chain"  yaml:"sender_other_chain"`
	RandomNumberHash    cmn.HexBytes   `json:"random_number_hash"  yaml:"random_number_hash"`
	Timestamp           int64          `json:"timestamp"  yaml:"timestamp"`
	Amount              sdk.Coins      `json:"amount"  yaml:"amount"`
	ExpectedIncome      string         `json:"expected_income"  yaml:"expected_income"`
	HeightSpan          int64          `json:"height_span"  yaml:"height_span"`
	CrossChain          bool           `json:"cross_chain"  yaml:"cross_chain"`
}

MsgCreateAtomicSwap contains an AtomicSwap struct

func NewMsgCreateAtomicSwap

func NewMsgCreateAtomicSwap(from sdk.AccAddress, to sdk.AccAddress, recipientOtherChain,
	senderOtherChain string, randomNumberHash cmn.HexBytes, timestamp int64,
	amount sdk.Coins, expectedIncome string, heightSpan int64, crossChain bool) MsgCreateAtomicSwap

NewMsgCreateAtomicSwap initializes a new MsgCreateAtomicSwap

func (MsgCreateAtomicSwap) GetInvolvedAddresses

func (msg MsgCreateAtomicSwap) GetInvolvedAddresses() []sdk.AccAddress

GetInvolvedAddresses gets the addresses involved in a MsgCreateAtomicSwap

func (MsgCreateAtomicSwap) GetSignBytes

func (msg MsgCreateAtomicSwap) GetSignBytes() []byte

GetSignBytes gets the sign bytes of a MsgCreateAtomicSwap

func (MsgCreateAtomicSwap) GetSigners

func (msg MsgCreateAtomicSwap) GetSigners() []sdk.AccAddress

GetSigners gets the signers of a MsgCreateAtomicSwap

func (MsgCreateAtomicSwap) Route

func (msg MsgCreateAtomicSwap) Route() string

Route establishes the route for the MsgCreateAtomicSwap

func (MsgCreateAtomicSwap) String

func (msg MsgCreateAtomicSwap) String() string

String prints the MsgCreateAtomicSwap

func (MsgCreateAtomicSwap) Type

func (msg MsgCreateAtomicSwap) Type() string

Type is the name of MsgCreateAtomicSwap

func (MsgCreateAtomicSwap) ValidateBasic

func (msg MsgCreateAtomicSwap) ValidateBasic() sdk.Error

ValidateBasic validates the MsgCreateAtomicSwap

type MsgRefundAtomicSwap

type MsgRefundAtomicSwap struct {
	From   sdk.AccAddress `json:"from" yaml:"from"`
	SwapID cmn.HexBytes   `json:"swap_id" yaml:"swap_id"`
}

MsgRefundAtomicSwap defines a refund msg

func NewMsgRefundAtomicSwap

func NewMsgRefundAtomicSwap(from sdk.AccAddress, swapID []byte) MsgRefundAtomicSwap

NewMsgRefundAtomicSwap initializes a new MsgRefundAtomicSwap

func (MsgRefundAtomicSwap) GetInvolvedAddresses

func (msg MsgRefundAtomicSwap) GetInvolvedAddresses() []sdk.AccAddress

GetInvolvedAddresses gets the addresses involved in a MsgRefundAtomicSwap

func (MsgRefundAtomicSwap) GetSignBytes

func (msg MsgRefundAtomicSwap) GetSignBytes() []byte

GetSignBytes gets the sign bytes of a MsgRefundAtomicSwap

func (MsgRefundAtomicSwap) GetSigners

func (msg MsgRefundAtomicSwap) GetSigners() []sdk.AccAddress

GetSigners gets the signers of a MsgRefundAtomicSwap

func (MsgRefundAtomicSwap) Route

func (msg MsgRefundAtomicSwap) Route() string

Route establishes the route for the MsgRefundAtomicSwap

func (MsgRefundAtomicSwap) String

func (msg MsgRefundAtomicSwap) String() string

String prints the MsgRefundAtomicSwap

func (MsgRefundAtomicSwap) Type

func (msg MsgRefundAtomicSwap) Type() string

Type is the name of MsgRefundAtomicSwap

func (MsgRefundAtomicSwap) ValidateBasic

func (msg MsgRefundAtomicSwap) ValidateBasic() sdk.Error

ValidateBasic validates the MsgRefundAtomicSwap

type Params

type Params struct {
	BnbDeputyAddress sdk.AccAddress `json:"bnb_deputy_address" yaml:"bnb_deputy_address"` // Bnbchain deputy address
	MinBlockLock     int64          `json:"min_block_lock" yaml:"min_block_lock"`         // AtomicSwap minimum block lock
	MaxBlockLock     int64          `json:"max_block_lock" yaml:"max_block_lock"`         // AtomicSwap maximum block lock
	SupportedAssets  AssetParams    `json:"supported_assets" yaml:"supported_assets"`     // Supported assets
}

Params governance parameters for bep3 module

func DefaultParams

func DefaultParams() Params

DefaultParams returns default params for bep3 module

func NewParams

func NewParams(bnbDeputyAddress sdk.AccAddress, minBlockLock, maxBlockLock int64, supportedAssets AssetParams,
) Params

NewParams returns a new params object

func (*Params) ParamSetPairs

func (p *Params) ParamSetPairs() params.ParamSetPairs

ParamSetPairs implements the ParamSet interface and returns all the key/value pairs pairs of bep3 module's parameters. nolint

func (Params) String

func (p Params) String() string

String implements fmt.Stringer

func (Params) Validate

func (p Params) Validate() error

Validate ensure that params have valid values

type QueryAssetSupply

type QueryAssetSupply struct {
	Denom cmn.HexBytes `json:"denom" yaml:"denom"`
}

QueryAssetSupply contains the params for query 'custom/bep3/supply'

func NewQueryAssetSupply

func NewQueryAssetSupply(denom cmn.HexBytes) QueryAssetSupply

NewQueryAssetSupply creates a new QueryAssetSupply

type QueryAtomicSwapByID

type QueryAtomicSwapByID struct {
	SwapID cmn.HexBytes `json:"swap_id" yaml:"swap_id"`
}

QueryAtomicSwapByID contains the params for query 'custom/bep3/swap'

func NewQueryAtomicSwapByID

func NewQueryAtomicSwapByID(swapBytes cmn.HexBytes) QueryAtomicSwapByID

NewQueryAtomicSwapByID creates a new QueryAtomicSwapByID

type QueryAtomicSwaps

type QueryAtomicSwaps struct {
	Page  int `json:"page" yaml:"page"`
	Limit int `json:"limit" yaml:"limit"`
}

QueryAtomicSwaps contains the params for an AtomicSwaps query

func NewQueryAtomicSwaps

func NewQueryAtomicSwaps(page int, limit int) QueryAtomicSwaps

NewQueryAtomicSwaps creates a new QueryAtomicSwaps

type SupplyKeeper

type SupplyKeeper interface {
	GetModuleAddress(name string) sdk.AccAddress
	GetModuleAccount(ctx sdk.Context, moduleName string) supplyexported.ModuleAccountI

	SendCoinsFromModuleToModule(ctx sdk.Context, sender, recipient string, amt sdk.Coins) sdk.Error
	SendCoinsFromModuleToAccount(ctx sdk.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) sdk.Error
	SendCoinsFromAccountToModule(ctx sdk.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins) sdk.Error

	BurnCoins(ctx sdk.Context, name string, amt sdk.Coins) sdk.Error
	MintCoins(ctx sdk.Context, name string, amt sdk.Coins) sdk.Error
}

SupplyKeeper defines the expected supply Keeper

type Swap

type Swap interface {
	GetSwapID() cmn.HexBytes
	GetModuleAccountCoins() sdk.Coins
	Validate() error
}

Swap is an interface for handling common actions

type SwapDirection

type SwapDirection byte

SwapDirection is the direction of an AtomicSwap

const (
	INVALID  SwapDirection = 0x00
	Incoming SwapDirection = 0x01
	Outgoing SwapDirection = 0x02
)

func NewSwapDirectionFromString

func NewSwapDirectionFromString(str string) SwapDirection

NewSwapDirectionFromString converts string to SwapDirection type

func (SwapDirection) MarshalJSON

func (direction SwapDirection) MarshalJSON() ([]byte, error)

MarshalJSON marshals the SwapDirection

func (SwapDirection) String

func (direction SwapDirection) String() string

String returns the string representation of a SwapDirection

func (*SwapDirection) UnmarshalJSON

func (direction *SwapDirection) UnmarshalJSON(data []byte) error

UnmarshalJSON unmarshals the SwapDirection

type SwapStatus

type SwapStatus byte

SwapStatus is the status of an AtomicSwap

const (
	NULL      SwapStatus = 0x00
	Open      SwapStatus = 0x01
	Completed SwapStatus = 0x02
	Expired   SwapStatus = 0x03
)

func NewSwapStatusFromString

func NewSwapStatusFromString(str string) SwapStatus

NewSwapStatusFromString converts string to SwapStatus type

func (SwapStatus) MarshalJSON

func (status SwapStatus) MarshalJSON() ([]byte, error)

MarshalJSON marshals the SwapStatus

func (SwapStatus) String

func (status SwapStatus) String() string

String returns the string representation of a SwapStatus

func (*SwapStatus) UnmarshalJSON

func (status *SwapStatus) UnmarshalJSON(data []byte) error

UnmarshalJSON unmarshals the SwapStatus

Jump to

Keyboard shortcuts

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