types

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2021 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EventTypeRegister             = "register_name"
	EventTypeRenew                = "renew_name"
	EventTypeSetPrice             = "set_price"
	EventTypeDelete               = "delete_name"
	EventTypeBuy                  = "buy_name"
	EventTypeTransferName         = "transfer_name"
	EventTypeRegisterAddress      = "register_address"
	EventTypeRemoveAddress        = "remove_address"
	EventTypeExpiredName          = "expired_name"
	EventTypeRegisterBlockchainId = "RegisterBlockchainId"
	EventTypeRemoveBlockchainId   = "RemoveBlockchainId"

	AttributeKeySender            = "sender"
	AttributeKeyName              = "name"
	AttributeKeyExpires           = "expires"
	AttributeKeyNewOwner          = "new_owner"
	AttributeKeyPrice             = "price"
	AttributeKeyBlockchainAddress = "blockchain_address"
	AttributeKeyBlockchainId      = "blockchain_id"
	AttributeKeyIndex             = "index"
	AttributeKeyTitle             = "title"
	AttributeKeyDescription       = "description"

	AttributeValueModule = ModuleName
)
View Source
const (
	ModuleName = "hra"

	StoreKey = ModuleName

	RouterKey = ModuleName

	QuerierRoute = ModuleName

	Separator = ":"
)
View Source
const (
	DefaultParamspace = ModuleName

	DefaultNameInfoDuration = time.Hour * 24 * 365

	DefaultNameInfoMaxDuration = time.Hour * 24 * 365 * 3

	NameConstraintBlock = 750
)
View Source
const (
	ProposalTypeRegisterBlockchainId = "RegisterBlockchainId"
	ProposalTypeRemoveBlockchainId   = "RemoveBlockchainId"
)

Variables

View Source
var (
	ErrNameRegistered            = sdkerrors.Register(ModuleName, 101, "Name already registered.")
	ErrNameNotRegistered         = sdkerrors.Register(ModuleName, 102, "Name not registered.")
	ErrNotOwner                  = sdkerrors.Register(ModuleName, 103, "Initiator is not the owner.")
	ErrExpiredNameRenewal        = sdkerrors.Register(ModuleName, 104, "Expired name renewal.")
	ErrNotForSale                = sdkerrors.Register(ModuleName, 105, "Name is not for sale.")
	ErrAlreadyOwned              = sdkerrors.Register(ModuleName, 106, "Name is already owned by the buyer.")
	ErrBlockchainIdNotValid      = sdkerrors.Register(ModuleName, 107, "Blockchain ID not valid.")
	ErrAddressIndexNotValid      = sdkerrors.Register(ModuleName, 108, "Address Index not valid.")
	ErrBlockchainAddressNotValid = sdkerrors.Register(ModuleName, 109, "Blockchain Address not valid.")
	ErrNameNotValid              = sdkerrors.Register(ModuleName, 110, "Invalid name provided.")
	ErrBlockchainAddressNotFound = sdkerrors.Register(ModuleName, 111, "Blockchain Address not found.")
	ErrNoNamesRegistered         = sdkerrors.Register(ModuleName, 112, "No names registered.")
	ErrMaximumDurationExceeded   = sdkerrors.Register(ModuleName, 113, "Maximum Name Info duration exceeded.")
)
View Source
var (
	NameInfoByNameKeyPrefix         = []byte{0x10}
	StatusByAddressAndNameKeyPrefix = []byte{0x11}
	ExpiredNameInfoQueueKeyPrefix   = []byte{0x12}
	AddressKeyPrefix                = []byte{0x13}
	CreditsKeyPrefix                = []byte{0x14}
	RegisteredBlockchainIdKeyPrefix = []byte{0x15}

	StatusPresent = []byte{0x01}
	StatusAbsent  = []byte{0x00}
)

Keys for HRA store Items are stored with the following key: values

- 0x10<Name_Bytes>: NameInfo - 0x11<Addr_Bytes><Separator><Name_Bytes>: boolean - 0x12<endTime_Bytes><Name_Bytes>: Name - 0x13<Addr_Bytes><Separator><BlockchainId_Bytes><Separator><AddressIndex_Bytes>: BlockchainAddress - 0x14<Addr_Bytes>: Int - 0x15<BlockchainId_Bytes>: boolean

View Source
var (
	DefaultAddressCredits = sdk.NewInt(20)

	DefaultRegisteredBlockchainIds = []string{
		"omg",
		"tusd",
		"zrx",
		"btc",
		"bch",
		"eth",
		"dash",
		"ltc",
		"atom",
		"xrp",
		"bnb",
	}

	KeyNameInfoDuration = []byte("NameInfoDuration")

	KeyNameInfoRegistrationFee = []byte("NameInfoRegistrationFee")
	KeyNameInfoRenewalFee      = []byte("NameInfoRenewalFee")

	KeyAddressCredits         = []byte("AddressCredits")
	KeyAddressRegistrationFee = []byte("AddressRegistrationFee")

	KeyNameInfoMaxDuration = []byte("NameInfoMaxDuration")
)
View Source
var ModuleCdc = codec.New()

Functions

func ExpiredNameInfoByTimeKey

func ExpiredNameInfoByTimeKey(endTime time.Time) []byte

ExpiredNameInfoByTimeKey gets the inactive proposal queue key by endTime

func ExpiredNameInfoQueueKey

func ExpiredNameInfoQueueKey(name string, endTime time.Time) []byte

func GetAddressKey

func GetAddressKey(address sdk.AccAddress, blockchainId string, index string) []byte

Address

func GetBlockchainAddressIteratorKey

func GetBlockchainAddressIteratorKey(address sdk.AccAddress) []byte

func GetCreditsKey

func GetCreditsKey(address sdk.AccAddress) []byte

func GetNameInfoByNameKey

func GetNameInfoByNameKey(name string) []byte

func GetRegisteredBlockchainIdIteratorKey

func GetRegisteredBlockchainIdIteratorKey() []byte

func GetRegisteredBlockchainIdKey

func GetRegisteredBlockchainIdKey(blockchainId string) []byte

func GetStatusByAddressAndNameIteratorKey

func GetStatusByAddressAndNameIteratorKey(address sdk.AccAddress) []byte

func GetStatusByAddressAndNameKey

func GetStatusByAddressAndNameKey(address sdk.AccAddress, name string) []byte

func NewRegisterBlockchainIdProposal

func NewRegisterBlockchainIdProposal(title string, description string, blockchainId string) gov.Content

func NewRemoveBlockchainIdProposal

func NewRemoveBlockchainIdProposal(title string, description string, blockchainId string) gov.Content

func ParamKeyTable

func ParamKeyTable() params.KeyTable

func RegisterCodec

func RegisterCodec(cdc *codec.Codec)

func SplitExpiredNameInfoQueueKey

func SplitExpiredNameInfoQueueKey(key []byte) (name string, endTime time.Time)

func SplitRegisteredBlockchainIdKey

func SplitRegisteredBlockchainIdKey(key []byte) string

func ValidateGenesis

func ValidateGenesis(data GenesisState) error

Types

type AddressCreditsInfo

type AddressCreditsInfo struct {
	Address sdk.AccAddress `json:"address" yaml:"address"`
	Credits sdk.Int        `json:"credits" yaml:"credits"`
}

func NewAddressCreditsInfo

func NewAddressCreditsInfo(address sdk.AccAddress, credits sdk.Int) AddressCreditsInfo

func (AddressCreditsInfo) String

func (a AddressCreditsInfo) String() string

type BlockchainAddressInfo

type BlockchainAddressInfo struct {
	BlockchainId      string `json:"blockchain_id" yaml:"blockchain_id"`
	Index             string `json:"index" yaml:"index"`
	BlockchainAddress string `json:"blockchain_address" yaml:"blockchain_address"`
}

func NewBlockchainAddressInfo

func NewBlockchainAddressInfo(blockchainId string, index string, blockchainAddress string) BlockchainAddressInfo

func SplitBlockchainAddressKey

func SplitBlockchainAddressKey(key []byte) (blockchainAddress BlockchainAddressInfo)

func (BlockchainAddressInfo) String

func (a BlockchainAddressInfo) String() string

type BlockchainAddressRecordInfo

type BlockchainAddressRecordInfo struct {
	Address               sdk.AccAddress        `json:"address" yaml:"address"`
	BlockchainAddressInfo BlockchainAddressInfo `json:"blockchain_address_info" yaml:"blockchain_address_info"`
}

func NewBlockchainAddressRecordInfo

func NewBlockchainAddressRecordInfo(address sdk.AccAddress, blockchainAddress BlockchainAddressInfo) BlockchainAddressRecordInfo

func SplitBlockchainAddressRecordKey

func SplitBlockchainAddressRecordKey(key []byte) (blockchainAddressRecord BlockchainAddressRecordInfo)

func (BlockchainAddressRecordInfo) String

type GenesisState

type GenesisState struct {
	Params                  Params                        `json:"params" yaml:"params"`
	NameRecords             []NameInfo                    `json:"name_records" yaml:"name_records"`
	AddressRecords          []BlockchainAddressRecordInfo `json:"address_records" yaml:"address_records"`
	AddressCredits          []AddressCreditsInfo          `json:"address_credits" yaml:"address_credits"`
	RegisteredBlockchainIds []string                      `json:"registered_blockchain_ids" yaml:"registered_blockchain_ids"`
}

func DefaultGenesisState

func DefaultGenesisState() GenesisState

func NewGenesisState

func NewGenesisState(params Params, nameRecords []NameInfo, addressRecords []BlockchainAddressRecordInfo, addressCredits []AddressCreditsInfo, registeredBlockchainIds []string) GenesisState

type MsgBuyName

type MsgBuyName struct {
	Name  string         `json:"name" yaml:"name"`
	Buyer sdk.AccAddress `json:"buyer" yaml:"buyer"`
}

MsgBuyName

func NewMsgBuyName

func NewMsgBuyName(name string, buyer sdk.AccAddress) MsgBuyName

func (MsgBuyName) GetSignBytes

func (msg MsgBuyName) GetSignBytes() []byte

func (MsgBuyName) GetSigners

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

func (MsgBuyName) Route

func (msg MsgBuyName) Route() string

func (MsgBuyName) Type

func (msg MsgBuyName) Type() string

func (MsgBuyName) ValidateBasic

func (msg MsgBuyName) ValidateBasic() error

type MsgDeleteName

type MsgDeleteName struct {
	Name  string         `json:"name" yaml:"name"`
	Owner sdk.AccAddress `json:"owner" yaml:"owner"`
}

MsgDeleteName

func NewMsgDeleteName

func NewMsgDeleteName(name string, owner sdk.AccAddress) MsgDeleteName

func (MsgDeleteName) GetSignBytes

func (msg MsgDeleteName) GetSignBytes() []byte

func (MsgDeleteName) GetSigners

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

func (MsgDeleteName) Route

func (msg MsgDeleteName) Route() string

func (MsgDeleteName) Type

func (msg MsgDeleteName) Type() string

func (MsgDeleteName) ValidateBasic

func (msg MsgDeleteName) ValidateBasic() error

type MsgRegisterAddress

type MsgRegisterAddress struct {
	Owner             sdk.AccAddress `json:"owner" yaml:"owner"`
	BlockchainId      string         `json:"blockchain_id" yaml:"blockchain_id"`
	Index             string         `json:"index" yaml:"index"`
	BlockchainAddress string         `json:"blockchain_address" yaml:"blockchain_address"`
}

MsgRegisterAddress

func NewMsgRegisterAddress

func NewMsgRegisterAddress(owner sdk.AccAddress, blockchainId string, index string, blockchainAddress string) MsgRegisterAddress

func (MsgRegisterAddress) GetSignBytes

func (msg MsgRegisterAddress) GetSignBytes() []byte

func (MsgRegisterAddress) GetSigners

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

func (MsgRegisterAddress) Route

func (msg MsgRegisterAddress) Route() string

func (MsgRegisterAddress) Type

func (msg MsgRegisterAddress) Type() string

func (MsgRegisterAddress) ValidateBasic

func (msg MsgRegisterAddress) ValidateBasic() error

type MsgRegisterName

type MsgRegisterName struct {
	Name  string         `json:"name" yaml:"name"`
	Owner sdk.AccAddress `json:"owner" yaml:"owner"`
}

MsgRegisterName

func NewMsgRegisterName

func NewMsgRegisterName(name string, owner sdk.AccAddress) MsgRegisterName

func (MsgRegisterName) GetSignBytes

func (msg MsgRegisterName) GetSignBytes() []byte

func (MsgRegisterName) GetSigners

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

func (MsgRegisterName) Route

func (msg MsgRegisterName) Route() string

func (MsgRegisterName) Type

func (msg MsgRegisterName) Type() string

func (MsgRegisterName) ValidateBasic

func (msg MsgRegisterName) ValidateBasic() error

type MsgRemoveAddress

type MsgRemoveAddress struct {
	Owner        sdk.AccAddress `json:"owner" yaml:"owner"`
	BlockchainId string         `json:"blockchain_id" yaml:"blockchain_id"`
	Index        string         `json:"index" yaml:"index"`
}

MsgRemoveAddress

func NewMsgRemoveAddress

func NewMsgRemoveAddress(owner sdk.AccAddress, blockchainId string, index string) MsgRemoveAddress

func (MsgRemoveAddress) GetSignBytes

func (msg MsgRemoveAddress) GetSignBytes() []byte

func (MsgRemoveAddress) GetSigners

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

func (MsgRemoveAddress) Route

func (msg MsgRemoveAddress) Route() string

func (MsgRemoveAddress) Type

func (msg MsgRemoveAddress) Type() string

func (MsgRemoveAddress) ValidateBasic

func (msg MsgRemoveAddress) ValidateBasic() error

type MsgRemoveAllAddresses

type MsgRemoveAllAddresses struct {
	Owner sdk.AccAddress `json:"owner" yaml:"owner"`
}

MsgRemoveAllAddresses

func NewMsgRemoveAllAddresses

func NewMsgRemoveAllAddresses(owner sdk.AccAddress) MsgRemoveAllAddresses

func (MsgRemoveAllAddresses) GetSignBytes

func (msg MsgRemoveAllAddresses) GetSignBytes() []byte

func (MsgRemoveAllAddresses) GetSigners

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

func (MsgRemoveAllAddresses) Route

func (msg MsgRemoveAllAddresses) Route() string

func (MsgRemoveAllAddresses) Type

func (msg MsgRemoveAllAddresses) Type() string

func (MsgRemoveAllAddresses) ValidateBasic

func (msg MsgRemoveAllAddresses) ValidateBasic() error

type MsgRenewName

type MsgRenewName struct {
	Name  string         `json:"name" yaml:"name"`
	Owner sdk.AccAddress `json:"owner" yaml:"owner"`
}

MsgRenewName

func NewMsgRenewName

func NewMsgRenewName(name string, owner sdk.AccAddress) MsgRenewName

func (MsgRenewName) GetSignBytes

func (msg MsgRenewName) GetSignBytes() []byte

func (MsgRenewName) GetSigners

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

func (MsgRenewName) Route

func (msg MsgRenewName) Route() string

func (MsgRenewName) Type

func (msg MsgRenewName) Type() string

func (MsgRenewName) ValidateBasic

func (msg MsgRenewName) ValidateBasic() error

type MsgSetPrice

type MsgSetPrice struct {
	Name  string         `json:"name" yaml:"name"`
	Owner sdk.AccAddress `json:"owner" yaml:"owner"`
	Price sdk.Coins      `json:"price" yaml:"price"`
}

MsgSetPrice

func NewMsgSetPrice

func NewMsgSetPrice(name string, owner sdk.AccAddress, price sdk.Coins) MsgSetPrice

func (MsgSetPrice) GetSignBytes

func (msg MsgSetPrice) GetSignBytes() []byte

func (MsgSetPrice) GetSigners

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

func (MsgSetPrice) Route

func (msg MsgSetPrice) Route() string

func (MsgSetPrice) Type

func (msg MsgSetPrice) Type() string

func (MsgSetPrice) ValidateBasic

func (msg MsgSetPrice) ValidateBasic() error

type MsgTransferName

type MsgTransferName struct {
	Name     string         `json:"name" yaml:"name"`
	Owner    sdk.AccAddress `json:"owner" yaml:"owner"`
	NewOwner sdk.AccAddress `json:"new_owner" yaml:"new_owner"`
}

MsgTransferName

func NewMsgTransferName

func NewMsgTransferName(name string, owner sdk.AccAddress, newOwner sdk.AccAddress) MsgTransferName

func (MsgTransferName) GetSignBytes

func (msg MsgTransferName) GetSignBytes() []byte

func (MsgTransferName) GetSigners

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

func (MsgTransferName) Route

func (msg MsgTransferName) Route() string

func (MsgTransferName) Type

func (msg MsgTransferName) Type() string

func (MsgTransferName) ValidateBasic

func (msg MsgTransferName) ValidateBasic() error

type MultiNameHooks

type MultiNameHooks []NameHooks

func NewMultiNameHooks

func NewMultiNameHooks(hooks ...NameHooks) MultiNameHooks

func (MultiNameHooks) AfterFirstNameCreated

func (h MultiNameHooks) AfterFirstNameCreated(ctx sdk.Context, address sdk.AccAddress) error

func (MultiNameHooks) AfterLastNameRemoved

func (h MultiNameHooks) AfterLastNameRemoved(ctx sdk.Context, address sdk.AccAddress) error

type NameHooks

type NameHooks interface {
	AfterFirstNameCreated(ctx sdk.Context, address sdk.AccAddress) error
	AfterLastNameRemoved(ctx sdk.Context, address sdk.AccAddress) error
}

type NameInfo

type NameInfo struct {
	Name         string         `json:"name" yaml:"name"`
	Owner        sdk.AccAddress `json:"owner" yaml:"owner"`
	Price        sdk.Coins      `json:"price" yaml:"price"`
	CreationTime time.Time      `json:"creation_time" yaml:"creation_time"`
	ExpiryTime   time.Time      `json:"expiry_time" yaml:"expiry_time"`
}

func NewNameInfo

func NewNameInfo(name string) NameInfo

func (NameInfo) String

func (h NameInfo) String() string

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)
}

type Params

type Params struct {
	NameInfoDuration        time.Duration `json:"nameinfo_duration" yaml:"nameinfo_duration"`
	NameInfoMaxDuration     time.Duration `json:"nameinfo_max_duration" yaml:"nameinfo_max_duration"`
	NameInfoRegistrationFee sdk.Coins     `json:"registration_fee" yaml:"registration_fee"`
	NameInfoRenewalFee      sdk.Coins     `json:"renewal_fee" yaml:"renewal_fee"`
	AddressCredits          sdk.Int       `json:"address_credits" yaml:"address_credits"`
	AddressRegistrationFee  sdk.Coins     `json:"address_registration_fee" yaml:"address_registration_fee"`
}

func DefaultParams

func DefaultParams() Params

DefaultParams defines the parameters for this module

func NewParams

func NewParams(nameInfoDuration time.Duration, nameInfoMaxDuration time.Duration, nameInfoRegistrationFee sdk.Coins,
	nameInfoRenewalFee sdk.Coins, addressCredits sdk.Int, addressRegistrationFee sdk.Coins) Params

func (*Params) ParamSetPairs

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

ParamSetPairs - Implements params.ParamSet

func (Params) String

func (p Params) String() string

String implements the stringer interface for Params

func (Params) Validate

func (p Params) Validate() error

type QueryResAddress

type QueryResAddress string

func (QueryResAddress) String

func (n QueryResAddress) String() string

type QueryResAddressCredits

type QueryResAddressCredits string

func (QueryResAddressCredits) String

func (n QueryResAddressCredits) String() string

type QueryResBlockchainAddresses

type QueryResBlockchainAddresses []BlockchainAddressInfo

func (QueryResBlockchainAddresses) String

type QueryResNameInfo

type QueryResNameInfo struct {
	NameInfo  NameInfo                `json:"name_info" yaml:"name_info"`
	Credits   sdk.Int                 `json:"credits" yaml:"credits"`
	Addresses []BlockchainAddressInfo `json:"addresses" yaml:"addresses"`
}

func (QueryResNameInfo) String

func (n QueryResNameInfo) String() string

type QueryResNameInfos

type QueryResNameInfos []NameInfo

func (QueryResNameInfos) String

func (n QueryResNameInfos) String() string

type QueryResNames

type QueryResNames []string

func (QueryResNames) String

func (n QueryResNames) String() string

type QueryResRegisteredBlockchainIds

type QueryResRegisteredBlockchainIds []string

func (QueryResRegisteredBlockchainIds) String

type RegisterBlockchainIdProposal

type RegisterBlockchainIdProposal struct {
	Title        string `json:"title" yaml:"title"`
	Description  string `json:"description" yaml:"description"`
	BlockchainId string `json:"blockchain_id" yaml:"blockchain_id"`
}

RegisterBlockchainIdProposal

func (RegisterBlockchainIdProposal) GetDescription

func (p RegisterBlockchainIdProposal) GetDescription() string

func (RegisterBlockchainIdProposal) GetTitle

func (p RegisterBlockchainIdProposal) GetTitle() string

nolint

func (RegisterBlockchainIdProposal) ProposalRoute

func (p RegisterBlockchainIdProposal) ProposalRoute() string

func (RegisterBlockchainIdProposal) ProposalType

func (p RegisterBlockchainIdProposal) ProposalType() string

func (RegisterBlockchainIdProposal) String

func (RegisterBlockchainIdProposal) ValidateBasic

func (p RegisterBlockchainIdProposal) ValidateBasic() error

type RemoveBlockchainIdProposal

type RemoveBlockchainIdProposal struct {
	Title        string `json:"title" yaml:"title"`
	Description  string `json:"description" yaml:"description"`
	BlockchainId string `json:"blockchain_id" yaml:"blockchain_id"`
}

RemoveBlockchainIdProposal

func (RemoveBlockchainIdProposal) GetDescription

func (p RemoveBlockchainIdProposal) GetDescription() string

func (RemoveBlockchainIdProposal) GetTitle

func (p RemoveBlockchainIdProposal) GetTitle() string

nolint

func (RemoveBlockchainIdProposal) ProposalRoute

func (p RemoveBlockchainIdProposal) ProposalRoute() string

func (RemoveBlockchainIdProposal) ProposalType

func (p RemoveBlockchainIdProposal) ProposalType() string

func (RemoveBlockchainIdProposal) String

func (RemoveBlockchainIdProposal) ValidateBasic

func (p RemoveBlockchainIdProposal) ValidateBasic() error

Jump to

Keyboard shortcuts

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