Documentation ¶
Index ¶
- Constants
- Variables
- func CalculateRandomHash(randomNumber []byte, timestamp int64) []byte
- func CalculateSwapID(randomNumberHash []byte, sender sdk.AccAddress, senderOtherChain string) []byte
- func GenerateSecureRandomNumber() ([]byte, error)
- func GetAtomicSwapByHeightKey(height uint64, swapID []byte) []byte
- func ParamKeyTable() params.KeyTable
- func RegisterCodec(cdc *codec.Codec)
- type AccountKeeper
- type AssetParam
- type AssetParams
- type AssetSupplies
- type AssetSupply
- type AtomicSwap
- type AtomicSwaps
- type AugmentedAtomicSwap
- type AugmentedAtomicSwaps
- type GenesisState
- type MsgClaimAtomicSwap
- func (msg MsgClaimAtomicSwap) GetInvolvedAddresses() []sdk.AccAddress
- func (msg MsgClaimAtomicSwap) GetSignBytes() []byte
- func (msg MsgClaimAtomicSwap) GetSigners() []sdk.AccAddress
- func (msg MsgClaimAtomicSwap) Route() string
- func (msg MsgClaimAtomicSwap) String() string
- func (msg MsgClaimAtomicSwap) Type() string
- func (msg MsgClaimAtomicSwap) ValidateBasic() error
- type MsgCreateAtomicSwap
- func (msg MsgCreateAtomicSwap) GetInvolvedAddresses() []sdk.AccAddress
- func (msg MsgCreateAtomicSwap) GetSignBytes() []byte
- func (msg MsgCreateAtomicSwap) GetSigners() []sdk.AccAddress
- func (msg MsgCreateAtomicSwap) Route() string
- func (msg MsgCreateAtomicSwap) String() string
- func (msg MsgCreateAtomicSwap) Type() string
- func (msg MsgCreateAtomicSwap) ValidateBasic() error
- type MsgRefundAtomicSwap
- func (msg MsgRefundAtomicSwap) GetInvolvedAddresses() []sdk.AccAddress
- func (msg MsgRefundAtomicSwap) GetSignBytes() []byte
- func (msg MsgRefundAtomicSwap) GetSigners() []sdk.AccAddress
- func (msg MsgRefundAtomicSwap) Route() string
- func (msg MsgRefundAtomicSwap) String() string
- func (msg MsgRefundAtomicSwap) Type() string
- func (msg MsgRefundAtomicSwap) ValidateBasic() error
- type Params
- type QueryAssetSupplies
- type QueryAssetSupply
- type QueryAtomicSwapByID
- type QueryAtomicSwaps
- type SupplyKeeper
- type SupplyLimit
- type SwapDirection
- type SwapStatus
Constants ¶
const ( EventTypeCreateAtomicSwap = "create_atomic_swap" EventTypeClaimAtomicSwap = "claim_atomic_swap" EventTypeRefundAtomicSwap = "refund_atomic_swap" EventTypeSwapsExpired = "swaps_expired" AttributeValueCategory = ModuleName AttributeKeySender = "sender" AttributeKeyRecipient = "recipient" AttributeKeyAtomicSwapID = "atomic_swap_id" AttributeKeyRandomNumberHash = "random_number_hash" AttributeKeyTimestamp = "timestamp" AttributeKeySenderOtherChain = "sender_other_chain" AttributeKeyExpireHeight = "expire_height" AttributeKeyAmount = "amount" AttributeKeyDirection = "direction" AttributeKeyClaimSender = "claim_sender" AttributeKeyRandomNumber = "random_number" AttributeKeyRefundSender = "refund_sender" AttributeKeyAtomicSwapIDs = "atomic_swap_ids" AttributeExpirationBlock = "expiration_block" )
Events for bep3 module
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 // DefaultLongtermStorageDuration is 1 week (assuming a block time of 7 seconds) DefaultLongtermStorageDuration uint64 = 86400 )
const ( CreateAtomicSwap = "createAtomicSwap" ClaimAtomicSwap = "claimAtomicSwap" RefundAtomicSwap = "refundAtomicSwap" CalcSwapID = "calcSwapID" Int64Size = 8 RandomNumberHashLength = 32 RandomNumberLength = 32 AddrByteCount = 20 MaxOtherChainAddrLength = 64 SwapIDLength = 32 MaxExpectedIncomeLength = 64 )
const ( // QueryGetAssetSupply command for getting info about an asset's supply QueryGetAssetSupply = "supply" // QueryGetAssetSupplies command for getting a list of asset supplies QueryGetAssetSupplies = "supplies" // 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" )
Variables ¶
var ( // ErrInvalidTimestamp error for when an timestamp is outside of bounds. Assumes block time of 10 seconds. ErrInvalidTimestamp = sdkerrors.Register(ModuleName, 2, "timestamp can neither be 15 minutes ahead of the current time, nor 30 minutes later") // ErrInvalidHeightSpan error for when a proposed height span is outside of lock time range ErrInvalidHeightSpan = sdkerrors.Register(ModuleName, 3, "height span is outside acceptable range") // ErrInsufficientAmount error for when a swap's amount cannot cover the deputy's fixed fee ErrInsufficientAmount = sdkerrors.Register(ModuleName, 4, "amount cannot cover the deputy fixed fee") // ErrAssetNotSupported error for when an asset is not supported ErrAssetNotSupported = sdkerrors.Register(ModuleName, 5, "asset not found") // ErrAssetNotActive error for when an asset is currently inactive ErrAssetNotActive = sdkerrors.Register(ModuleName, 6, "asset is currently inactive") // ErrAssetSupplyNotFound error for when an asset's supply is not found in the store ErrAssetSupplyNotFound = sdkerrors.Register(ModuleName, 7, "asset supply not found in store") // ErrExceedsSupplyLimit error for when the proposed supply increase would put the supply above limit ErrExceedsSupplyLimit = sdkerrors.Register(ModuleName, 8, "asset supply over limit") // ErrExceedsAvailableSupply error for when the proposed outgoing amount exceeds the total available supply ErrExceedsAvailableSupply = sdkerrors.Register(ModuleName, 9, "outgoing swap exceeds total available supply") // ErrInvalidCurrentSupply error for when the proposed decrease would result in a negative current supplyx ErrInvalidCurrentSupply = sdkerrors.Register(ModuleName, 10, "supply decrease puts current asset supply below 0") // ErrInvalidIncomingSupply error for when the proposed decrease would result in a negative incoming supply ErrInvalidIncomingSupply = sdkerrors.Register(ModuleName, 11, "supply decrease puts incoming asset supply below 0") // ErrInvalidOutgoingSupply error for when the proposed decrease would result in a negative outgoing supply ErrInvalidOutgoingSupply = sdkerrors.Register(ModuleName, 12, "supply decrease puts outgoing asset supply below 0") // ErrInvalidClaimSecret error when a submitted secret doesn't match an AtomicSwap's swapID ErrInvalidClaimSecret = sdkerrors.Register(ModuleName, 13, "hashed claim attempt does not match") // ErrAtomicSwapAlreadyExists error for when an AtomicSwap with this swapID already exists ErrAtomicSwapAlreadyExists = sdkerrors.Register(ModuleName, 14, "atomic swap already exists") // ErrAtomicSwapNotFound error for when an atomic swap is not found ErrAtomicSwapNotFound = sdkerrors.Register(ModuleName, 15, "atomic swap not found") // ErrSwapNotRefundable error for when an AtomicSwap has not expired and cannot be refunded ErrSwapNotRefundable = sdkerrors.Register(ModuleName, 16, "atomic swap is still active and cannot be refunded") // ErrSwapNotClaimable error for when an atomic swap is not open and cannot be claimed ErrSwapNotClaimable = sdkerrors.Register(ModuleName, 17, "atomic swap is not claimable") // ErrInvalidAmount error for when a swap's amount is outside acceptable range ErrInvalidAmount = sdkerrors.Register(ModuleName, 18, "amount is outside acceptable range") // ErrInvalidSwapAccount error for when a swap involves an invalid account ErrInvalidSwapAccount = sdkerrors.Register(ModuleName, 19, "atomic swap has invalid account") // ErrExceedsTimeBasedSupplyLimit error for when the proposed supply increase would put the supply above limit for the current time period ErrExceedsTimeBasedSupplyLimit = sdkerrors.Register(ModuleName, 20, "asset supply over limit for current time period") )
var ( // ModulePermissionsUpgradeTime is the block time after which the bep3 module account's permissions are synced with the supply module. ModulePermissionsUpgradeTime time.Time = time.Date(2020, 11, 3, 10, 0, 0, 0, time.UTC) AtomicSwapKeyPrefix = []byte{0x00} // prefix for keys that store AtomicSwaps AtomicSwapByBlockPrefix = []byte{0x01} // prefix for keys of the AtomicSwapsByBlock index AtomicSwapLongtermStoragePrefix = []byte{0x02} // prefix for keys of the AtomicSwapLongtermStorage index AssetSupplyPrefix = []byte{0x03} PreviousBlockTimeKey = []byte{0x04} )
Key prefixes
var ( KeyAssetParams = []byte("AssetParams") DefaultBnbDeputyFixedFee sdk.Int = sdk.NewInt(1000) // 0.00001 BNB DefaultMinAmount sdk.Int = sdk.ZeroInt() DefaultMaxAmount sdk.Int = sdk.NewInt(1000000000000) // 10,000 BNB DefaultMinBlockLock uint64 = 220 DefaultMaxBlockLock uint64 = 270 DefaultPreviousBlockTime = tmtime.Canonical(time.Unix(1, 0)) )
Parameter keys
var (
AtomicSwapCoinsAccAddr = sdk.AccAddress(crypto.AddressHash([]byte("KavaAtomicSwapCoins")))
)
ensure Msg interface compliance at compile time
var ModuleCdc = codec.New()
Functions ¶
func CalculateRandomHash ¶
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 GenerateSecureRandomNumber ¶
GenerateSecureRandomNumber generates cryptographically strong pseudo-random number
func GetAtomicSwapByHeightKey ¶
GetAtomicSwapByHeightKey is used by the AtomicSwapByBlock index and AtomicSwapLongtermStorage index
func ParamKeyTable ¶
ParamKeyTable Key declaration for parameters
func RegisterCodec ¶
RegisterCodec registers concrete types on amino
Types ¶
type AccountKeeper ¶ added in v0.8.0
type AccountKeeper interface { GetAccount(ctx sdk.Context, addr sdk.AccAddress) authexported.Account NewAccountWithAddress(ctx sdk.Context, addr sdk.AccAddress) authexported.Account SetAccount(ctx sdk.Context, acc authexported.Account) }
AccountKeeper defines the expected account keeper (noalias)
type AssetParam ¶
type AssetParam struct { Denom string `json:"denom" yaml:"denom"` // name of the asset CoinID int `json:"coin_id" yaml:"coin_id"` // SLIP-0044 registered coin type - see https://github.com/satoshilabs/slips/blob/master/slip-0044.md SupplyLimit SupplyLimit `json:"supply_limit" yaml:"supply_limit"` // asset supply limit Active bool `json:"active" yaml:"active"` // denotes if asset is available or paused DeputyAddress sdk.AccAddress `json:"deputy_address" yaml:"deputy_address"` // the address of the relayer process FixedFee sdk.Int `json:"fixed_fee" yaml:"fixed_fee"` // the fixed fee charged by the relayer process for outgoing swaps MinSwapAmount sdk.Int `json:"min_swap_amount" yaml:"min_swap_amount"` // Minimum swap amount MaxSwapAmount sdk.Int `json:"max_swap_amount" yaml:"max_swap_amount"` // Maximum swap amount MinBlockLock uint64 `json:"min_block_lock" yaml:"min_block_lock"` // Minimum swap block lock MaxBlockLock uint64 `json:"max_block_lock" yaml:"max_block_lock"` // Maximum swap block lock }
AssetParam parameters that must be specified for each bep3 asset
func NewAssetParam ¶ added in v0.11.0
func NewAssetParam( denom string, coinID int, limit SupplyLimit, active bool, deputyAddr sdk.AccAddress, fixedFee sdk.Int, minSwapAmount sdk.Int, maxSwapAmount sdk.Int, minBlockLock uint64, maxBlockLock uint64, ) AssetParam
NewAssetParam returns a new AssetParam
type AssetSupply ¶
type AssetSupply struct { 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"` TimeLimitedCurrentSupply sdk.Coin `json:"time_limited_current_supply" yaml:"time_limited_current_supply"` TimeElapsed time.Duration `json:"time_elapsed" yaml:"time_elapsed"` }
AssetSupply contains information about an asset's supply
func NewAssetSupply ¶
func NewAssetSupply(incomingSupply, outgoingSupply, currentSupply, timeLimitedSupply sdk.Coin, timeElapsed time.Duration) AssetSupply
NewAssetSupply initializes a new AssetSupply
func (AssetSupply) Equal ¶ added in v0.11.0
func (a AssetSupply) Equal(b AssetSupply) bool
Equal returns if two asset supplies are equal
func (AssetSupply) GetDenom ¶ added in v0.11.0
func (a AssetSupply) GetDenom() string
GetDenom getter method for the denom of the asset supply
func (AssetSupply) Validate ¶ added in v0.8.0
func (a AssetSupply) Validate() error
Validate performs a basic validation of an asset supply fields.
type AtomicSwap ¶
type AtomicSwap struct { Amount sdk.Coins `json:"amount" yaml:"amount"` RandomNumberHash tmbytes.HexBytes `json:"random_number_hash" yaml:"random_number_hash"` ExpireHeight uint64 `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 tmbytes.HexBytes, expireHeight uint64, 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) GetCoins ¶ added in v0.8.0
func (a AtomicSwap) GetCoins() sdk.Coins
GetCoins returns the swap's amount as sdk.Coins
func (AtomicSwap) GetSwapID ¶
func (a AtomicSwap) GetSwapID() tmbytes.HexBytes
GetSwapID calculates the ID of an atomic swap
func (AtomicSwap) Validate ¶
func (a AtomicSwap) Validate() error
Validate performs a basic validation of an atomic swap fields.
type AugmentedAtomicSwap ¶ added in v0.11.0
type AugmentedAtomicSwap struct { ID string `json:"id" yaml:"id"` // Embed AtomicSwap fields explicity in order to output as top level JSON fields // This prevents breaking changes for clients using REST API Amount sdk.Coins `json:"amount" yaml:"amount"` RandomNumberHash tmbytes.HexBytes `json:"random_number_hash" yaml:"random_number_hash"` ExpireHeight uint64 `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"` }
func NewAugmentedAtomicSwap ¶ added in v0.11.0
func NewAugmentedAtomicSwap(swap AtomicSwap) AugmentedAtomicSwap
type AugmentedAtomicSwaps ¶ added in v0.11.0
type AugmentedAtomicSwaps []AugmentedAtomicSwap
type GenesisState ¶
type GenesisState struct { Params Params `json:"params" yaml:"params"` AtomicSwaps AtomicSwaps `json:"atomic_swaps" yaml:"atomic_swaps"` Supplies AssetSupplies `json:"supplies" yaml:"supplies"` PreviousBlockTime time.Time `json:"previous_block_time" yaml:"previous_block_time"` }
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, previousBlockTime time.Time) 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 tmbytes.HexBytes `json:"swap_id" yaml:"swap_id"` RandomNumber tmbytes.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() 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 tmbytes.HexBytes `json:"random_number_hash" yaml:"random_number_hash"` Timestamp int64 `json:"timestamp" yaml:"timestamp"` Amount sdk.Coins `json:"amount" yaml:"amount"` HeightSpan uint64 `json:"height_span" yaml:"height_span"` }
MsgCreateAtomicSwap contains an AtomicSwap struct
func NewMsgCreateAtomicSwap ¶
func NewMsgCreateAtomicSwap(from sdk.AccAddress, to sdk.AccAddress, recipientOtherChain, senderOtherChain string, randomNumberHash tmbytes.HexBytes, timestamp int64, amount sdk.Coins, heightSpan uint64) 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() error
ValidateBasic validates the MsgCreateAtomicSwap
type MsgRefundAtomicSwap ¶
type MsgRefundAtomicSwap struct { From sdk.AccAddress `json:"from" yaml:"from"` SwapID tmbytes.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() error
ValidateBasic validates the MsgRefundAtomicSwap
type Params ¶
type Params struct {
AssetParams AssetParams `json:"asset_params" yaml:"asset_params"`
}
Params governance parameters for bep3 module
func DefaultParams ¶
func DefaultParams() Params
DefaultParams returns default params for bep3 module
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
type QueryAssetSupplies ¶ added in v0.8.0
type QueryAssetSupplies struct { Page int `json:"page" yaml:"page"` Limit int `json:"limit" yaml:"limit"` }
QueryAssetSupplies contains the params for an AssetSupplies query
func NewQueryAssetSupplies ¶ added in v0.8.0
func NewQueryAssetSupplies(page int, limit int) QueryAssetSupplies
NewQueryAssetSupplies creates a new QueryAssetSupplies
type QueryAssetSupply ¶
type QueryAssetSupply struct {
Denom string `json:"denom" yaml:"denom"`
}
QueryAssetSupply contains the params for query 'custom/bep3/supply'
func NewQueryAssetSupply ¶
func NewQueryAssetSupply(denom string) QueryAssetSupply
NewQueryAssetSupply creates a new QueryAssetSupply
type QueryAtomicSwapByID ¶
QueryAtomicSwapByID contains the params for query 'custom/bep3/swap'
func NewQueryAtomicSwapByID ¶
func NewQueryAtomicSwapByID(swapBytes tmbytes.HexBytes) QueryAtomicSwapByID
NewQueryAtomicSwapByID creates a new QueryAtomicSwapByID
type QueryAtomicSwaps ¶
type QueryAtomicSwaps struct { Page int `json:"page" yaml:"page"` Limit int `json:"limit" yaml:"limit"` Involve sdk.AccAddress `json:"involve" yaml:"involve"` Expiration uint64 `json:"expiration" yaml:"expiration"` Status SwapStatus `json:"status" yaml:"status"` Direction SwapDirection `json:"direction" yaml:"direction"` }
QueryAtomicSwaps contains the params for an AtomicSwaps query
func NewQueryAtomicSwaps ¶
func NewQueryAtomicSwaps(page, limit int, involve sdk.AccAddress, expiration uint64, status SwapStatus, direction SwapDirection) QueryAtomicSwaps
NewQueryAtomicSwaps creates a new instance of QueryAtomicSwaps
type SupplyKeeper ¶
type SupplyKeeper interface { GetModuleAddress(name string) sdk.AccAddress GetModuleAccount(ctx sdk.Context, moduleName string) supplyexported.ModuleAccountI GetModuleAddressAndPermissions(moduleName string) (sdk.AccAddress, []string) SetModuleAccount(ctx sdk.Context, macc supplyexported.ModuleAccountI) SendCoinsFromModuleToAccount(ctx sdk.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) error SendCoinsFromAccountToModule(ctx sdk.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins) error BurnCoins(ctx sdk.Context, name string, amt sdk.Coins) error MintCoins(ctx sdk.Context, name string, amt sdk.Coins) error }
SupplyKeeper defines the expected supply keeper (noalias)
type SupplyLimit ¶ added in v0.11.0
type SupplyLimit struct { Limit sdk.Int `json:"limit" yaml:"limit"` // the absolute supply limit for an asset TimeLimited bool `json:"time_limited" yaml:"time_limited"` // boolean for if the supply is also limited by time TimePeriod time.Duration `json:"time_period" yaml:"time_period"` // the duration for which the supply time limit applies TimeBasedLimit sdk.Int `json:"time_based_limit" yaml:"time_based_limit"` // the supply limit for an asset for each time period }
SupplyLimit parameters that control the absolute and time-based limits for an assets's supply
func (SupplyLimit) Equals ¶ added in v0.11.0
func (sl SupplyLimit) Equals(sl2 SupplyLimit) bool
Equals returns true if two supply limits are equal
func (SupplyLimit) String ¶ added in v0.11.0
func (sl SupplyLimit) String() string
String implements fmt.Stringer
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) IsValid ¶ added in v0.8.0
func (direction SwapDirection) IsValid() bool
IsValid returns true if the swap direction is valid and false otherwise.
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 )
swap statuses
func NewSwapStatusFromString ¶
func NewSwapStatusFromString(str string) SwapStatus
NewSwapStatusFromString converts string to SwapStatus type
func (SwapStatus) IsValid ¶ added in v0.8.0
func (status SwapStatus) IsValid() bool
IsValid returns true if the swap status is valid and false otherwise.
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