types

package
v0.5.0-rc1 Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2021 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AttributeKeyTxHash  = "tx_hash"
	AttributeKeyAddress = "address"
	AttributeKeyAmount  = "amount"
)
View Source
const (
	ModuleName        = "swap"
	QuerierRoute      = ModuleName
	DefaultParamspace = ModuleName
)
View Source
const (
	DefaultSwapEnabled = false
	DefaultSwapDenom   = "tsent"
)
View Source
const (
	QuerySwap  = "Swap"
	QuerySwaps = "Swaps"
)
View Source
const (
	EthereumHashLength = 32
)

Variables

View Source
var (
	ErrorMarshal          = errors.Register(ModuleName, 101, "error occurred while marshalling")
	ErrorUnmarshal        = errors.Register(ModuleName, 102, "error occurred while unmarshalling")
	ErrorUnknownMsgType   = errors.Register(ModuleName, 103, "unknown message type")
	ErrorUnknownQueryType = errors.Register(ModuleName, 104, "unknown query type")
	ErrorInvalidField     = errors.Register(ModuleName, 105, "invalid field")
	ErrorSwapIsDisabled   = errors.Register(ModuleName, 106, "swap is disabled")
	ErrorUnauthorized     = errors.Register(ModuleName, 107, "unauthorized")
	ErrorDuplicateSwap    = errors.Register(ModuleName, 108, "duplicate swap")
)
View Source
var (
	ParamsSubspace = ModuleName
	RouterKey      = ModuleName
	StoreKey       = ModuleName
)
View Source
var (
	KeySwapEnabled = []byte("SwapEnabled")
	KeySwapDenom   = []byte("SwapDenom")
	KeyApproveBy   = []byte("ApproveBy")
)
View Source
var (
	DefaultApproveBy = sdk.AccAddress(rand.Bytes(20))
)
View Source
var (
	EventTypeSet = fmt.Sprintf("%s:set", ModuleName)
)
View Source
var (
	ModuleCdc *codec.Codec
)
View Source
var (
	SwapKeyPrefix = []byte{0x10}
)

Functions

func ParamsKeyTable

func ParamsKeyTable() params.KeyTable

func RegisterCodec

func RegisterCodec(cdc *codec.Codec)

func SwapKey

func SwapKey(hash EthereumHash) []byte

Types

type EthereumHash

type EthereumHash [EthereumHashLength]byte

func BytesToHash

func BytesToHash(b []byte) EthereumHash

func (EthereumHash) Bytes

func (e EthereumHash) Bytes() []byte

func (EthereumHash) Hex

func (e EthereumHash) Hex() string

func (EthereumHash) Marshal

func (e EthereumHash) Marshal() ([]byte, error)

func (EthereumHash) MarshalJSON

func (e EthereumHash) MarshalJSON() ([]byte, error)

func (*EthereumHash) SetBytes

func (e *EthereumHash) SetBytes(b []byte)

func (EthereumHash) String

func (e EthereumHash) String() string

func (*EthereumHash) Unmarshal

func (e *EthereumHash) Unmarshal(data []byte) error

func (*EthereumHash) UnmarshalJSON

func (e *EthereumHash) UnmarshalJSON(data []byte) error

type GenesisState

type GenesisState struct {
	Swaps  Swaps  `json:"_"`
	Params Params `json:"params"`
}

func DefaultGenesisState

func DefaultGenesisState() GenesisState

func NewGenesisState

func NewGenesisState(swaps Swaps, params Params) GenesisState

type MsgSwap

type MsgSwap struct {
	From     sdk.AccAddress `json:"from"`
	TxHash   EthereumHash   `json:"tx_hash"`
	Receiver sdk.AccAddress `json:"receiver"`
	Amount   sdk.Int        `json:"amount"`
}

func NewMsgSwap

func NewMsgSwap(from sdk.AccAddress, txHash EthereumHash, receiver sdk.AccAddress, amount sdk.Int) MsgSwap

func (MsgSwap) GetSignBytes

func (m MsgSwap) GetSignBytes() []byte

func (MsgSwap) GetSigners

func (m MsgSwap) GetSigners() []sdk.AccAddress

func (MsgSwap) Route

func (m MsgSwap) Route() string

func (MsgSwap) Type

func (m MsgSwap) Type() string

func (MsgSwap) ValidateBasic

func (m MsgSwap) ValidateBasic() error

type Params

type Params struct {
	SwapEnabled bool           `json:"swap_enabled"`
	SwapDenom   string         `json:"swap_denom"`
	ApproveBy   sdk.AccAddress `json:"approve_by"`
}

func DefaultParams

func DefaultParams() Params

func NewParams

func NewParams(swapEnabled bool, swapDenom string, approveBy sdk.AccAddress) Params

func (*Params) ParamSetPairs

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

func (Params) String

func (p Params) String() string

func (Params) Validate

func (p Params) Validate() error

type QuerySwapParams

type QuerySwapParams struct {
	TxHash EthereumHash `json:"tx_hash"`
}

func NewQuerySwapParams

func NewQuerySwapParams(txHash EthereumHash) QuerySwapParams

type QuerySwapsParams

type QuerySwapsParams struct {
	Skip  int `json:"skip"`
	Limit int `json:"limit"`
}

func NewQuerySwapsParams

func NewQuerySwapsParams(skip, limit int) QuerySwapsParams

type Swap

type Swap struct {
	TxHash   EthereumHash   `json:"tx_hash"`
	Receiver sdk.AccAddress `json:"receiver"`
	Amount   sdk.Coin       `json:"amount"`
}

func (Swap) String

func (s Swap) String() string

func (Swap) Validate

func (s Swap) Validate() error

type Swaps

type Swaps []Swap

Jump to

Keyboard shortcuts

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