Documentation ¶
Index ¶
- Constants
- Variables
- func Ecrecover(sighash [32]byte, R, S, Vb *big.Int) (ethcmn.Address, error)
- func ErrAlreadyRedeemed() *sdkerrors.Error
- func ErrAlreadyRefunded() *sdkerrors.Error
- func ErrChainNotExist(chain string) *sdkerrors.Error
- func ErrDeprecated() *sdkerrors.Error
- func ErrExpired() *sdkerrors.Error
- func ErrFromFieldNotEqual(fromMsg string, fromSwap string) *sdkerrors.Error
- func ErrInsufficientPoolFunds(want string, exists string) *sdkerrors.Error
- func ErrInvalidServiceAddress(want string, receive string) *sdkerrors.Error
- func ErrInvalidTransactionNumber() *sdkerrors.Error
- func ErrNotExpired() *sdkerrors.Error
- func ErrSwapAlreadyExist(hash string) *sdkerrors.Error
- func ErrSwapNotFound() *sdkerrors.Error
- func ErrWrongSecret() *sdkerrors.Error
- func GetChainKey(chain int) []byte
- func GetSwapKey(hash [32]byte) []byte
- func GetSwapV2Key(hash [32]byte) []byte
- func RegisterCodec(cdc *codec.Codec)
- type Chain
- type CodeType
- type GenesisState
- type Hash
- type MsgChainActivate
- type MsgChainDeactivate
- type MsgHTLT
- type MsgRedeem
- type MsgRedeemV2
- type MsgRefund
- type MsgSwapInitialize
- type ParamSubspace
- type Params
- type QuerySwapParams
- type Secret
- type Swap
- type Swaps
- type TransferType
Constants ¶
View Source
const ( // Default validator codespace DefaultCodespace string = ModuleName CodeSwapNotFound = 100 CodeSwapAlreadyExist = 101 CodeFromFieldNotEqual = 102 CodeAlreadyRefunded = 103 CodeAlreadyRedeemed = 104 CodeNotExpired = 105 CodeExpired = 106 CodeWrongSecret = 107 CodeChainNotExist = 200 CodeInvalidServiceAddress = 201 CodeInsufficientPoolFunds = 202 CodeInvalidTransactionNumber = 203 CodeDeprecated = 300 )
View Source
const ( AttributeValueCategory = "swap" AttributeKeyTimeLocked = "time_locked" AttributeKeyTransferType = "transfer_type" AttributeKeyHashedSecret = "hashed_secret" AttributeKeyRecipient = "recipient" AttributeKeyAmount = "amount" AttributeKeySecret = "secret" AttributeKeyTokenSymbol = "token_symbol" AttributeKeyTransactionNumber = "transaction_number" AttributeKeyFrom = "from" AttributeKeyDestChain = "dest_chain" )
View Source
const ( // ModuleName is the name of the module ModuleName = "swap" // RouterKey is the message route for swap RouterKey = ModuleName // StoreKey to be used when creating the KVStore StoreKey = coin.StoreKey QuerierRoute = ModuleName )
View Source
const ( TypeMsgHTLT = "htlt" TypeMsgRedeem = "redeem" TypeMsgRefund = "refund" )
Swap message types and routes
View Source
const ( TransferTypeOut = 1 TransferTypeIn = 2 )
View Source
const ( TypeMsgSwapInitialize = "swap_initialize" TypeMsgRedeemV2 = "redeem_v2" TypeMsgChainActivate = "chain_activate" TypeMsgChainDeactivate = "chain_deactivate" )
Swap message types and routes
View Source
const ( DefaultLockedTimeOut = time.Hour * 24 DefaultLockedTimeIn = time.Hour * 12 )
View Source
const ( QuerySwap = "swap" QueryActiveSwaps = "active_swaps" QueryPool = "pool" )
View Source
const ChainActivatorAddress = "dx16aeq4ypsx5ar4076v507ch5z8ryd6usx32tnru"
View Source
const CheckingAddress = "d2d9207a88982ecffec424709ff2b02f6c95a9ba"
View Source
const PoolName = "atomic_swap_pool"
View Source
const ServiceAddress = "dx1p844kydt9eljvuef4nk52dm6lcgj5c42q4zmvd"
Variables ¶
View Source
var ( SwapKey = []byte{0x50, 0x01} SwapV2Key = []byte{0x50, 0x02} ChainKey = []byte{0x50, 0x03} )
View Source
var ( KeyLockedTimeOut = []byte("LockedTimeOut") KeyLockedTimeIn = []byte("LockedTimeIn") )
View Source
var ModuleCdc *codec.Codec
ModuleCdc defines the module codec
View Source
var ServiceAccAddress, _ = sdk.AccAddressFromBech32("dx1jqx7chw0faswfmw78cdejzzery5akzmk5zc5x5")
Functions ¶
func ErrAlreadyRedeemed ¶
func ErrAlreadyRefunded ¶
func ErrChainNotExist ¶
func ErrDeprecated ¶
func ErrExpired ¶
func ErrFromFieldNotEqual ¶
func ErrNotExpired ¶
func ErrSwapAlreadyExist ¶
func ErrSwapNotFound ¶
func ErrWrongSecret ¶
func GetChainKey ¶
func GetSwapKey ¶
func GetSwapV2Key ¶
func RegisterCodec ¶
RegisterCodec registers concrete types on codec
Types ¶
type GenesisState ¶
type GenesisState struct { Swaps Swaps `json:"swaps" yaml:"swaps"` Params Params `json:"params" yaml:"params"` }
func DefaultGenesisState ¶
func DefaultGenesisState() GenesisState
get raw genesis raw message for testing
func NewGenesisState ¶
func NewGenesisState(params Params, swaps Swaps) GenesisState
type Hash ¶
type Hash [32]byte
func (Hash) MarshalJSON ¶
func (*Hash) UnmarshalJSON ¶
type MsgChainActivate ¶
type MsgChainActivate struct { From sdk.AccAddress `json:"from"` ChainNumber int `json:"chain_number"` ChainName string `json:"chain_name"` }
func NewMsgChainActivate ¶
func NewMsgChainActivate(from sdk.AccAddress, chainNumber int, chainName string) MsgChainActivate
func (MsgChainActivate) GetSignBytes ¶
func (msg MsgChainActivate) GetSignBytes() []byte
func (MsgChainActivate) GetSigners ¶
func (msg MsgChainActivate) GetSigners() []sdk.AccAddress
func (MsgChainActivate) Route ¶
func (msg MsgChainActivate) Route() string
func (MsgChainActivate) Type ¶
func (msg MsgChainActivate) Type() string
func (MsgChainActivate) ValidateBasic ¶
func (msg MsgChainActivate) ValidateBasic() error
type MsgChainDeactivate ¶
type MsgChainDeactivate struct { From sdk.AccAddress `json:"from"` ChainNumber int `json:"chain_number"` }
func NewMsgChainDeactivate ¶
func NewMsgChainDeactivate(from sdk.AccAddress, chainNumber int) MsgChainDeactivate
func (MsgChainDeactivate) GetSignBytes ¶
func (msg MsgChainDeactivate) GetSignBytes() []byte
func (MsgChainDeactivate) GetSigners ¶
func (msg MsgChainDeactivate) GetSigners() []sdk.AccAddress
func (MsgChainDeactivate) Route ¶
func (msg MsgChainDeactivate) Route() string
func (MsgChainDeactivate) Type ¶
func (msg MsgChainDeactivate) Type() string
func (MsgChainDeactivate) ValidateBasic ¶
func (msg MsgChainDeactivate) ValidateBasic() error
type MsgHTLT ¶
type MsgHTLT struct { TransferType TransferType `json:"transfer_type"` From sdk.AccAddress `json:"from"` Recipient string `json:"recipient"` HashedSecret Hash `json:"hashed_secret"` Amount sdk.Coins `json:"amount"` }
func NewMsgHTLT ¶
func NewMsgHTLT(transferType TransferType, from sdk.AccAddress, recipient string, hashedSecret Hash, amount sdk.Coins) MsgHTLT
func (MsgHTLT) GetSignBytes ¶
func (MsgHTLT) GetSigners ¶
func (msg MsgHTLT) GetSigners() []sdk.AccAddress
func (MsgHTLT) ValidateBasic ¶
type MsgRedeem ¶
type MsgRedeem struct { From sdk.AccAddress `json:"from"` Secret Secret `json:"secret"` }
func NewMsgRedeem ¶
func NewMsgRedeem(from sdk.AccAddress, secret Secret) MsgRedeem
func (MsgRedeem) GetSignBytes ¶
func (MsgRedeem) GetSigners ¶
func (msg MsgRedeem) GetSigners() []sdk.AccAddress
func (MsgRedeem) ValidateBasic ¶
type MsgRedeemV2 ¶
type MsgRedeemV2 struct { Sender sdk.AccAddress `json:"sender"` From string `json:"from"` Recipient sdk.AccAddress `json:"recipient"` Amount sdk.Int `json:"amount"` TokenSymbol string `json:"token_symbol"` TransactionNumber string `json:"transaction_number"` FromChain int `json:"from_chain"` DestChain int `json:"dest_chain"` V uint8 `json:"v"` R Hash `json:"r"` S Hash `json:"s"` }
func NewMsgRedeemV2 ¶
func NewMsgRedeemV2(sender, recipient sdk.AccAddress, from string, amount sdk.Int, tokenSymbol, transactionNumber string, fromChain, destChain int, v uint8, r, s [32]byte) MsgRedeemV2
func (MsgRedeemV2) GetSignBytes ¶
func (msg MsgRedeemV2) GetSignBytes() []byte
func (MsgRedeemV2) GetSigners ¶
func (msg MsgRedeemV2) GetSigners() []sdk.AccAddress
func (MsgRedeemV2) Route ¶
func (msg MsgRedeemV2) Route() string
func (MsgRedeemV2) Type ¶
func (msg MsgRedeemV2) Type() string
func (MsgRedeemV2) ValidateBasic ¶
func (msg MsgRedeemV2) ValidateBasic() error
type MsgRefund ¶
type MsgRefund struct { From sdk.AccAddress `json:"from"` HashedSecret Hash `json:"hashed_secret"` }
func NewMsgRefund ¶
func NewMsgRefund(from sdk.AccAddress, hash [32]byte) MsgRefund
func (MsgRefund) GetSignBytes ¶
func (MsgRefund) GetSigners ¶
func (msg MsgRefund) GetSigners() []sdk.AccAddress
func (MsgRefund) ValidateBasic ¶
type MsgSwapInitialize ¶
type MsgSwapInitialize struct { From sdk.AccAddress `json:"from"` Recipient string `json:"recipient"` Amount sdk.Int `json:"amount"` TokenSymbol string `json:"token_symbol"` TransactionNumber string `json:"transaction_number"` FromChain int `json:"from_chain"` DestChain int `json:"dest_chain"` }
func NewMsgSwapInitialize ¶
func NewMsgSwapInitialize(from sdk.AccAddress, recipient string, amount sdk.Int, tokenSymbol, transactionNumber string, fromChain, destChain int) MsgSwapInitialize
func (MsgSwapInitialize) GetSignBytes ¶
func (msg MsgSwapInitialize) GetSignBytes() []byte
func (MsgSwapInitialize) GetSigners ¶
func (msg MsgSwapInitialize) GetSigners() []sdk.AccAddress
func (MsgSwapInitialize) Route ¶
func (msg MsgSwapInitialize) Route() string
func (MsgSwapInitialize) Type ¶
func (msg MsgSwapInitialize) Type() string
func (MsgSwapInitialize) ValidateBasic ¶
func (msg MsgSwapInitialize) ValidateBasic() error
type ParamSubspace ¶
type ParamSubspace interface { WithKeyTable(table params.KeyTable) params.Subspace Get(ctx sdk.Context, key []byte, ptr interface{}) GetParamSet(ctx sdk.Context, ps params.ParamSet) SetParamSet(ctx sdk.Context, ps params.ParamSet) }
ParamSubspace defines the expected Subspace interfacace
type Params ¶
type Params struct { LockedTimeOut time.Duration `json:"locked_time_out"` LockedTimeIn time.Duration `json:"locked_time_in"` }
func DefaultParams ¶
func DefaultParams() Params
func (*Params) ParamSetPairs ¶
func (p *Params) ParamSetPairs() params.ParamSetPairs
Implements params.ParamSet
type QuerySwapParams ¶
type QuerySwapParams struct {
HashedSecret Hash `json:"hashed_secret"`
}
func NewQuerySwapParams ¶
func NewQuerySwapParams(hashedSecret Hash) QuerySwapParams
type Swap ¶
type Swap struct { TransferType TransferType `json:"transfer_type"` HashedSecret Hash `json:"hashed_secret"` From sdk.AccAddress `json:"from"` Recipient string `json:"recipient"` Amount sdk.Coins `json:"amount"` Timestamp uint64 `json:"timestamp"` Redeemed bool `json:"redeemed"` Refunded bool `json:"refunded"` }
type TransferType ¶
type TransferType int
func TransferTypeFromString ¶
func TransferTypeFromString(transferType string) (TransferType, error)
func (TransferType) String ¶
func (t TransferType) String() string
Click to show internal directories.
Click to hide internal directories.