types

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2020 License: AGPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EthereumAddressLength = 20
	EthereumTxHashLength  = 32
)
View Source
const (
	// ModuleName is the name of the module
	ModuleName = "tokenswap"

	// StoreKey is used to register the module's store
	StoreKey = ModuleName

	// QuerierRoute is the querier route for the tokenswap module
	QuerierRoute = ModuleName
)
View Source
const (
	// default paramspace for params keeper
	DefaultParamspace = ModuleName
)
View Source
const (
	GetTokenSwapRoute = "get"
)

query endpoints supported by the Querier

View Source
const RouterKey = "tokenswap"

RouterKey is used to route messages and queriers to the greeter module

Variables

View Source
var (
	ParamStoreKeyMultisigApproveAddress = []byte("MultisigApproveAddress")
	ParamStoreKeyMintingMultiplier      = []byte("MintingMultiplier")
	ParamStoreKeyMintingEnabled         = []byte("MintingEnabled")
)

Parameter keys

View Source
var ModuleCdc *codec.Codec

Functions

func EncodeHex

func EncodeHex(b []byte) string

Encode encodes b as a hex string with 0x prefix.

func FromHex

func FromHex(s string) []byte

FromHex returns the bytes represented by the hexadecimal string s. s may be prefixed with "0x".

func Hex2Bytes

func Hex2Bytes(str string) []byte

Hex2Bytes returns the bytes represented by the hexadecimal string str.

func ParamKeyTable

func ParamKeyTable() paramtypes.KeyTable

ParamKeyTable returns the parameter key table.

func RegisterCodec

func RegisterCodec(cdc *codec.Codec)

func ValidateGenesis

func ValidateGenesis(gs GenesisState) error

ValidateGenesis validates the genesis state of distribution genesis input

Types

type AccountKeeper

type AccountKeeper interface {
	GetAccount(sdk.Context, sdk.AccAddress) authexported.Account
}

AccountKeeper defines the expected account keeper

type EthAddr

type EthAddr interface {
	Equals(EthAddr) bool
	Empty() bool
	Marshal() ([]byte, error)
	MarshalJSON() ([]byte, error)
	MarshalYAML() (interface{}, error)
	Bytes() []byte
	String() string
	Format(s fmt.State, verb rune)
}

Address is a common interface for different types of addresses used by the SDK

type EthHash

type EthHash interface {
	Equals(EthHash) bool
	Empty() bool
	Marshal() ([]byte, error)
	MarshalJSON() ([]byte, error)
	MarshalYAML() (interface{}, error)
	Bytes() []byte
	String() string
	Format(s fmt.State, verb rune)
}

type EthereumAddress

type EthereumAddress [EthereumAddressLength]byte

func BytesToAddress

func BytesToAddress(b []byte) EthereumAddress

func HexToAddress

func HexToAddress(s string) (addr EthereumAddress, err error)

func (EthereumAddress) Bytes

func (a EthereumAddress) Bytes() []byte

func (EthereumAddress) Empty

func (a EthereumAddress) Empty() bool

func (EthereumAddress) Equals

func (a EthereumAddress) Equals(other EthAddr) bool

func (EthereumAddress) Format

func (a EthereumAddress) Format(s fmt.State, verb rune)

func (EthereumAddress) Hex

func (a EthereumAddress) Hex() string

Hex returns an EIP55-compliant hex string representation of the address.

func (EthereumAddress) Marshal

func (a EthereumAddress) Marshal() ([]byte, error)

func (EthereumAddress) MarshalJSON

func (a EthereumAddress) MarshalJSON() ([]byte, error)

func (EthereumAddress) MarshalYAML

func (a EthereumAddress) MarshalYAML() (interface{}, error)

func (*EthereumAddress) SetBytes

func (a *EthereumAddress) SetBytes(b []byte)

func (EthereumAddress) String

func (a EthereumAddress) String() string

func (*EthereumAddress) Unmarshal

func (a *EthereumAddress) Unmarshal(data []byte) error

Unmarshal sets the address to the given data. It is needed for protobuf compatibility.

func (*EthereumAddress) UnmarshalJSON

func (a *EthereumAddress) UnmarshalJSON(data []byte) error

UnmarshalJSON unmarshals from JSON assuming Bech32 encoding.

func (*EthereumAddress) UnmarshalYAML

func (a *EthereumAddress) UnmarshalYAML(data []byte) error

type EthereumTxHash

type EthereumTxHash [EthereumTxHashLength]byte

func BytesToTxHash

func BytesToTxHash(b []byte) EthereumTxHash

func HexToTxHash

func HexToTxHash(s string) (addr EthereumTxHash, err error)

func (EthereumTxHash) Bytes

func (h EthereumTxHash) Bytes() []byte

func (EthereumTxHash) Empty

func (h EthereumTxHash) Empty() bool

func (EthereumTxHash) Equals

func (h EthereumTxHash) Equals(other EthHash) bool

func (EthereumTxHash) Format

func (h EthereumTxHash) Format(s fmt.State, verb rune)

func (EthereumTxHash) Hex

func (h EthereumTxHash) Hex() string

func (EthereumTxHash) Marshal

func (h EthereumTxHash) Marshal() ([]byte, error)

func (EthereumTxHash) MarshalJSON

func (h EthereumTxHash) MarshalJSON() ([]byte, error)

func (EthereumTxHash) MarshalYAML

func (h EthereumTxHash) MarshalYAML() (interface{}, error)

func (*EthereumTxHash) SetBytes

func (h *EthereumTxHash) SetBytes(b []byte)

func (EthereumTxHash) String

func (h EthereumTxHash) String() string

func (*EthereumTxHash) Unmarshal

func (h *EthereumTxHash) Unmarshal(data []byte) error

Unmarshal sets the address to the given data. It is needed for protobuf compatibility.

func (*EthereumTxHash) UnmarshalJSON

func (h *EthereumTxHash) UnmarshalJSON(data []byte) error

UnmarshalJSON unmarshals from JSON assuming Bech32 encoding.

func (*EthereumTxHash) UnmarshalYAML

func (h *EthereumTxHash) UnmarshalYAML(data []byte) error

type GenesisState

type GenesisState struct {
	Params Params `json:"params" yaml:"params"`
}

GenesisState - all distribution state that must be provided at genesis

func DefaultGenesisState

func DefaultGenesisState() GenesisState

get raw genesis raw message for testing

func NewGenesisState

func NewGenesisState(params Params) GenesisState

type GetTokenSwapParams

type GetTokenSwapParams struct {
	EthereumTxHash EthereumTxHash `json:"ethereum_tx_hash"`
}

GetTokenSwapParams defines the params for the following queries: - 'custom/tokenswap/get/'

func NewGetTokenSwapParams

func NewGetTokenSwapParams(ethereumTxHash EthereumTxHash) GetTokenSwapParams

NewGetTokenSwapParams creates a new GetTokenSwapParams

type MsgSwapRequest

type MsgSwapRequest struct {
	BurnTxHash     EthereumTxHash
	EthereumSender EthereumAddress
	Receiver       sdk.AccAddress
	AmountENG      sdk.Dec
	SignerAddr     sdk.AccAddress
}

MsgSwapRequest defines the MsgSwapRequest Message

func NewMsgSwapRequest

func NewMsgSwapRequest(burnTxHash EthereumTxHash, ethereumSender EthereumAddress, receiver sdk.AccAddress, signerAddr sdk.AccAddress, amountENG sdk.Dec) MsgSwapRequest

NewMsgSwapRequest Returns a new MsgSwapRequest

func (MsgSwapRequest) GetSignBytes

func (msg MsgSwapRequest) GetSignBytes() []byte

GetSignBytes encodes the message for signing

func (MsgSwapRequest) GetSigners

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

GetSigners returns the addresses of those required to sign the message

func (MsgSwapRequest) Route

func (msg MsgSwapRequest) Route() string

Route should return the name of the module

func (MsgSwapRequest) Type

func (msg MsgSwapRequest) Type() string

Type should return the action

func (MsgSwapRequest) ValidateAmount

func (msg MsgSwapRequest) ValidateAmount() error

func (MsgSwapRequest) ValidateBasic

func (msg MsgSwapRequest) ValidateBasic() error

ValidateBasic runs stateless checks on the message

func (MsgSwapRequest) ValidateReceiver

func (msg MsgSwapRequest) ValidateReceiver() error

func (MsgSwapRequest) ValidateTxHash

func (msg MsgSwapRequest) ValidateTxHash() error

type Params

type Params struct {
	MultisigApproveAddress sdk.AccAddress `json:"minting_approver_address" yaml:"minting_approver_address"`
	MintingMultiplier      sdk.Dec        `json:"minting_multiplier" yaml:"minting_multiplier"`
	MintingEnabled         bool           `json:"minting_enabled" yaml:"minting_enabled"`
}

TokenSwap struct containing the data of the TokenSwap. json and yaml tags are used to specify field names when marshalled

func DefaultParams

func DefaultParams() Params

DefaultParams returns default distribution parameters

func (*Params) ParamSetPairs

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

ParamSetPairs returns the parameter set pairs.

func (Params) String

func (p Params) String() string

func (Params) ValidateBasic

func (p Params) ValidateBasic() error

ValidateBasic performs basic validation on distribution parameters.

type SupplyKeeper

type SupplyKeeper interface {
	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
	MintCoins(ctx sdk.Context, name string, amt sdk.Coins) error
	BurnCoins(ctx sdk.Context, name string, amt sdk.Coins) error
	SetModuleAccount(sdk.Context, supplyexported.ModuleAccountI)
}

SupplyKeeper defines the expected supply keeper

type TokenSwapRecord

type TokenSwapRecord struct {
	BurnTxHash     EthereumTxHash  `json:"ethereum_tx_hash" yaml:"ethereum_tx_hash"`
	EthereumSender EthereumAddress `json:"ethereum_sender" yaml:"ethereum_sender"`
	Receiver       sdk.AccAddress  `json:"receiver" yaml:"receiver"`
	AmountUSCRT    sdk.Coins       `json:"amount_uscrt" yaml:"amount_uscrt"`
	Done           bool            `json:"done" yaml:"done"`
}

TokenSwap struct containing the data of the TokenSwap. json and yaml tags are used to specify field names when marshalled

func NewTokenSwapRecord

func NewTokenSwapRecord(burnTxHash EthereumTxHash, ethereumSender EthereumAddress, receiver sdk.AccAddress, AmountUSCRT sdk.Coins, done bool) TokenSwapRecord

NewTokenSwap Returns a new TokenSwap

func (TokenSwapRecord) String

func (s TokenSwapRecord) String() string

String implement fmt.Stringer

Jump to

Keyboard shortcuts

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