Documentation ¶
Index ¶
- Constants
- Variables
- func AddRecordToNameMapping(store sdk.KVStore, codec *amino.Codec, id types.ID, wrn string)
- func AllInvariants(k Keeper) sdk.Invariant
- func GetAuctionToAuthorityIndexKey(auctionID auction.ID) []byte
- func GetBlockChangesetIndexKey(height int64) []byte
- func GetCIDToNamesIndexKey(id types.ID) []byte
- func GetNameAuthority(store sdk.KVStore, codec *amino.Codec, name string) *types.NameAuthority
- func GetNameAuthorityIndexKey(name string) []byte
- func GetNameRecord(store sdk.KVStore, codec *amino.Codec, wrn string) *types.NameRecord
- func GetNameRecordIndexKey(wrn string) []byte
- func GetRecord(store sdk.KVStore, codec *amino.Codec, id types.ID) types.Record
- func GetRecordIndexKey(id types.ID) []byte
- func HasNameAuthority(store sdk.KVStore, name string) bool
- func HasRecord(store sdk.KVStore, id types.ID) bool
- func MatchRecords(store sdk.KVStore, codec *amino.Codec, matchFn func(*types.Record) bool) []*types.Record
- func ModuleAccountInvariant(k Keeper) sdk.Invariant
- func NewQuerier(keeper Keeper) sdk.Querier
- func RecordInvariants(k Keeper) sdk.Invariant
- func RegisterInvariants(ir sdk.InvariantRegistry, k Keeper)
- func RemoveBondToAuthorityIndexEntry(store sdk.KVStore, bondID bond.ID, name string)
- func RemoveRecordToNameMapping(store sdk.KVStore, codec *amino.Codec, id types.ID, wrn string)
- func ResolveWRN(store sdk.KVStore, codec *amino.Codec, wrn string) (*types.Record, *types.NameRecord)
- func SetNameAuthority(ctx sdk.Context, store sdk.KVStore, codec *amino.Codec, name string, ...)
- func SetNameRecord(store sdk.KVStore, codec *amino.Codec, wrn string, id types.ID, height int64)
- type Keeper
- func (k Keeper) AddAuctionToAuthorityMapping(ctx sdk.Context, auctionID auction.ID, name string)
- func (k Keeper) AddBondToAuthorityIndexEntry(ctx sdk.Context, bondID bond.ID, name string)
- func (k Keeper) AddBondToRecordIndexEntry(ctx sdk.Context, bondID bond.ID, id types.ID)
- func (k Keeper) AuthorityExpiryQueueIterator(ctx sdk.Context, endTime time.Time) sdk.Iterator
- func (k Keeper) DeleteAuthorityExpiryQueue(ctx sdk.Context, name string, authority types.NameAuthority)
- func (k Keeper) DeleteAuthorityExpiryQueueTimeSlice(ctx sdk.Context, timestamp time.Time)
- func (k Keeper) DeleteRecordExpiryQueue(ctx sdk.Context, record types.Record)
- func (k Keeper) DeleteRecordExpiryQueueTimeSlice(ctx sdk.Context, timestamp time.Time)
- func (k Keeper) GetAllExpiredAuthorities(ctx sdk.Context, currTime time.Time) (expiredAuthorityNames []string)
- func (k Keeper) GetAllExpiredRecords(ctx sdk.Context, currTime time.Time) (expiredRecordCIDs []types.ID)
- func (k Keeper) GetAuthorityExpiryQueue(ctx sdk.Context) (expired map[string][]string)
- func (k Keeper) GetAuthorityExpiryQueueTimeSlice(ctx sdk.Context, timestamp time.Time) (names []string)
- func (k Keeper) GetModuleBalances(ctx sdk.Context) map[string]sdk.Coins
- func (k Keeper) GetNameAuthority(ctx sdk.Context, name string) *types.NameAuthority
- func (k Keeper) GetNameRecord(ctx sdk.Context, wrn string) *types.NameRecord
- func (k Keeper) GetParams(ctx sdk.Context) (params types.Params)
- func (k Keeper) GetRecord(ctx sdk.Context, id types.ID) types.Record
- func (k Keeper) GetRecordExpiryQueue(ctx sdk.Context) (expired map[string][]types.ID)
- func (k Keeper) GetRecordExpiryQueueTimeSlice(ctx sdk.Context, timestamp time.Time) (cids []types.ID)
- func (k Keeper) HasNameAuthority(ctx sdk.Context, name string) bool
- func (k Keeper) HasNameRecord(ctx sdk.Context, wrn string) bool
- func (k Keeper) HasRecord(ctx sdk.Context, id types.ID) bool
- func (k Keeper) InsertAuthorityExpiryQueue(ctx sdk.Context, name string, expiryTime time.Time)
- func (k Keeper) InsertRecordExpiryQueue(ctx sdk.Context, val types.Record)
- func (k Keeper) ListNameAuthorityRecords(ctx sdk.Context) map[string]types.NameAuthority
- func (k Keeper) ListNameRecords(ctx sdk.Context) map[string]types.NameRecord
- func (k Keeper) ListRecords(ctx sdk.Context) []types.Record
- func (k Keeper) MatchRecords(ctx sdk.Context, matchFn func(*types.Record) bool) []*types.Record
- func (k Keeper) ProcessAssociateBond(ctx sdk.Context, msg types.MsgAssociateBond) (*types.Record, error)
- func (k Keeper) ProcessAuthorityExpiryQueue(ctx sdk.Context)
- func (k Keeper) ProcessDeleteName(ctx sdk.Context, msg types.MsgDeleteName) error
- func (k Keeper) ProcessDissociateBond(ctx sdk.Context, msg types.MsgDissociateBond) (*types.Record, error)
- func (k Keeper) ProcessDissociateRecords(ctx sdk.Context, msg types.MsgDissociateRecords) (*bond.Bond, error)
- func (k Keeper) ProcessReassociateRecords(ctx sdk.Context, msg types.MsgReassociateRecords) (*bond.Bond, error)
- func (k Keeper) ProcessRecordExpiryQueue(ctx sdk.Context)
- func (k Keeper) ProcessRenewRecord(ctx sdk.Context, msg types.MsgRenewRecord) (*types.Record, error)
- func (k Keeper) ProcessReserveAuthority(ctx sdk.Context, msg types.MsgReserveAuthority) (string, error)
- func (k Keeper) ProcessReserveSubAuthority(ctx sdk.Context, name string, msg types.MsgReserveAuthority) (string, error)
- func (k Keeper) ProcessSetAuthorityBond(ctx sdk.Context, msg types.MsgSetAuthorityBond) (string, error)
- func (k Keeper) ProcessSetName(ctx sdk.Context, msg types.MsgSetName) error
- func (k Keeper) ProcessSetRecord(ctx sdk.Context, msg types.MsgSetRecord) (*types.Record, error)
- func (k Keeper) PutRecord(ctx sdk.Context, record types.Record)
- func (k Keeper) RecordExpiryQueueIterator(ctx sdk.Context, endTime time.Time) sdk.Iterator
- func (k Keeper) RemoveAuctionToAuthorityMapping(ctx sdk.Context, auctionID auction.ID)
- func (k Keeper) RemoveBondToAuthorityIndexEntry(ctx sdk.Context, bondID bond.ID, name string)
- func (k Keeper) RemoveBondToRecordIndexEntry(ctx sdk.Context, bondID bond.ID, id types.ID)
- func (k Keeper) ResolveWRN(ctx sdk.Context, wrn string) *types.Record
- func (k Keeper) SetAuthorityExpiryQueueTimeSlice(ctx sdk.Context, timestamp time.Time, names []string)
- func (k Keeper) SetNameAuthority(ctx sdk.Context, name string, authority types.NameAuthority)
- func (k Keeper) SetNameRecord(ctx sdk.Context, wrn string, id types.ID)
- func (k Keeper) SetParams(ctx sdk.Context, params types.Params)
- func (k Keeper) SetRecordExpiryQueueTimeSlice(ctx sdk.Context, timestamp time.Time, cids []types.ID)
- func (k Keeper) TryTakeAuthorityRent(ctx sdk.Context, name string, authority types.NameAuthority)
- func (k Keeper) TryTakeRecordRent(ctx sdk.Context, record types.Record)
- type RecordKeeper
- func (k RecordKeeper) GetAuctionToAuthorityMapping(ctx sdk.Context, auctionID auction.ID) string
- func (k RecordKeeper) ModuleName() string
- func (k RecordKeeper) OnAuction(ctx sdk.Context, auctionID auction.ID)
- func (k RecordKeeper) OnAuctionBid(ctx sdk.Context, auctionID auction.ID, bidderAddress string)
- func (k RecordKeeper) OnAuctionWinnerSelected(ctx sdk.Context, auctionID auction.ID)
- func (k RecordKeeper) QueryRecordsByBond(ctx sdk.Context, bondID bond.ID) []types.Record
- func (k RecordKeeper) UsesAuction(ctx sdk.Context, auctionID auction.ID) bool
- func (k RecordKeeper) UsesBond(ctx sdk.Context, bondID bond.ID) bool
Constants ¶
const ( ListRecordsPath = "list" GetRecordPath = "get" QueryRecordsByBondPath = "query-by-bond" QueryParametersPath = "parameters" Balance = "balance" WhoIsPath = "whois" LookUpWRNPath = "lookup" ListNamesPath = "names" ResolveNamePath = "resolve" RecordExpiryQueue = "record-expiry" AuthorityExpiryQueue = "authority-expiry" )
query endpoints supported by the nameservice Querier
const NoExpiry = time.Hour * 24 * 365 * 100
NoExpiry => really long duration (used to indicate no-expiry).
Variables ¶
var KeySyncStatus = []byte{0xff}
KeySyncStatus is the key for the sync status record. Only used by WNS lite but defined here to prevent conflicts with existing prefixes.
var PrefixAuctionToAuthorityNameIndex = []byte{0x05}
PrefixAuctionToAuthorityNameIndex is the prefix for the auction ID -> authority name index.
var PrefixBlockChangesetIndex = []byte{0x04}
PrefixBlockChangesetIndex is the prefix for the block changeset index.
var PrefixBondIDToAuthoritiesIndex = []byte{0x06}
PrefixBondIDToAuthoritiesIndex is the prefix for the Bond ID -> [Authority] index.
var PrefixBondIDToRecordsIndex = []byte{0x03}
PrefixBondIDToRecordsIndex is the prefix for the Bond ID -> [Record] index.
var PrefixCIDToNamesIndex = []byte{0xe0}
PrefixCIDToNamesIndex the the reverse index for naming, i.e. maps CID -> []Names. TODO(ashwin): Move out of WNS once we have an indexing service.
var PrefixCIDToRecordIndex = []byte{0x00}
PrefixCIDToRecordIndex is the prefix for CID -> Record index. Note: This is the primary index in the system. Note: Golang doesn't support const arrays.
var PrefixExpiryTimeToAuthoritiesIndex = []byte{0x11}
PrefixExpiryTimeToAuthoritiesIndex is the prefix for the Expiry Time -> [Authority] index.
var PrefixExpiryTimeToRecordsIndex = []byte{0x10}
PrefixExpiryTimeToRecordsIndex is the prefix for the Expiry Time -> [Record] index.
var PrefixNameAuthorityRecordIndex = []byte{0x01}
PrefixNameAuthorityRecordIndex is the prefix for the name -> NameAuthority index.
var PrefixWRNToNameRecordIndex = []byte{0x02}
PrefixWRNToNameRecordIndex is the prefix for the WRN -> NamingRecord index.
Functions ¶
func AddRecordToNameMapping ¶
AddRecordToNameMapping adds a name to the record ID -> []names index.
func AllInvariants ¶
AllInvariants runs all invariants of the nameservice module.
func GetCIDToNamesIndexKey ¶
func GetNameAuthority ¶
func GetNameAuthority(store sdk.KVStore, codec *amino.Codec, name string) *types.NameAuthority
GetNameAuthority - gets a name authority from the store.
func GetNameAuthorityIndexKey ¶
Generates name -> NameAuthority index key.
func GetNameRecord ¶
func GetNameRecord(store sdk.KVStore, codec *amino.Codec, wrn string) *types.NameRecord
GetNameRecord - gets a name record from the store.
func GetNameRecordIndexKey ¶
Generates WRN -> NameRecord index key.
func GetRecordIndexKey ¶
Generates Bond ID -> Bond index key.
func HasNameAuthority ¶
HasNameAuthority - checks if a name authority entry exists.
func MatchRecords ¶
func MatchRecords(store sdk.KVStore, codec *amino.Codec, matchFn func(*types.Record) bool) []*types.Record
MatchRecords - get all matching records.
func ModuleAccountInvariant ¶
ModuleAccountInvariant checks that the 'bond' module account balance is non-negative.
func NewQuerier ¶
NewQuerier is the module level router for state queries
func RecordInvariants ¶
RecordInvariants checks that every record: (1) has a corresponding naming record & (2) associated bond exists, if bondID is not null.
func RegisterInvariants ¶
func RegisterInvariants(ir sdk.InvariantRegistry, k Keeper)
RegisterInvariants registers all nameservice module invariants.
func RemoveRecordToNameMapping ¶
RemoveRecordToNameMapping removes a name from the record ID -> []names index.
func ResolveWRN ¶
func ResolveWRN(store sdk.KVStore, codec *amino.Codec, wrn string) (*types.Record, *types.NameRecord)
ResolveWRN resolves a WRN to a record.
func SetNameAuthority ¶
Types ¶
type Keeper ¶
type Keeper struct {
// contains filtered or unexported fields
}
Keeper maintains the link to storage and exposes getter/setter methods for the various parts of the state machine
func NewKeeper ¶
func NewKeeper(accountKeeper auth.AccountKeeper, supplyKeeper supply.Keeper, recordKeeper RecordKeeper, bondKeeper bond.BondClientKeeper, auctionKeeper auction.Keeper, storeKey sdk.StoreKey, cdc *codec.Codec, paramstore params.Subspace) Keeper
NewKeeper creates new instances of the nameservice Keeper
func (Keeper) AddAuctionToAuthorityMapping ¶
func (Keeper) AddBondToAuthorityIndexEntry ¶
AddBondToAuthorityIndexEntry adds the Bond ID -> [Authority] index entry.
func (Keeper) AddBondToRecordIndexEntry ¶
AddBondToRecordIndexEntry adds the Bond ID -> [Record] index entry.
func (Keeper) AuthorityExpiryQueueIterator ¶
AuthorityExpiryQueueIterator returns all the authority expiry queue timeslices from time 0 until endTime.
func (Keeper) DeleteAuthorityExpiryQueue ¶
func (k Keeper) DeleteAuthorityExpiryQueue(ctx sdk.Context, name string, authority types.NameAuthority)
DeleteAuthorityExpiryQueue deletes an authority name from the authority expiry queue.
func (Keeper) DeleteAuthorityExpiryQueueTimeSlice ¶
DeleteAuthorityExpiryQueueTimeSlice deletes a specific authority expiry queue timeslice.
func (Keeper) DeleteRecordExpiryQueue ¶
DeleteRecordExpiryQueue deletes a record CID from the record expiry queue.
func (Keeper) DeleteRecordExpiryQueueTimeSlice ¶
DeleteRecordExpiryQueueTimeSlice deletes a specific record expiry queue timeslice.
func (Keeper) GetAllExpiredAuthorities ¶
func (k Keeper) GetAllExpiredAuthorities(ctx sdk.Context, currTime time.Time) (expiredAuthorityNames []string)
GetAllExpiredAuthorities returns a concatenated list of all the timeslices before currTime.
func (Keeper) GetAllExpiredRecords ¶
func (k Keeper) GetAllExpiredRecords(ctx sdk.Context, currTime time.Time) (expiredRecordCIDs []types.ID)
GetAllExpiredRecords returns a concatenated list of all the timeslices before currTime.
func (Keeper) GetAuthorityExpiryQueue ¶
func (Keeper) GetAuthorityExpiryQueueTimeSlice ¶
func (Keeper) GetModuleBalances ¶
GetModuleBalances gets the nameservice module account(s) balances.
func (Keeper) GetNameAuthority ¶
GetNameAuthority - gets a name authority from the store.
func (Keeper) GetNameRecord ¶
GetNameRecord - gets a name record from the store.
func (Keeper) GetRecordExpiryQueue ¶
func (Keeper) GetRecordExpiryQueueTimeSlice ¶
func (k Keeper) GetRecordExpiryQueueTimeSlice(ctx sdk.Context, timestamp time.Time) (cids []types.ID)
GetRecordExpiryQueueTimeSlice gets a specific record queue timeslice. A timeslice is a slice of CIDs corresponding to records that expire at a certain time.
func (Keeper) HasNameAuthority ¶
HasNameAuthority - checks if a name/authority exists.
func (Keeper) HasNameRecord ¶
HasNameRecord - checks if a name record exists.
func (Keeper) InsertAuthorityExpiryQueue ¶
func (Keeper) InsertRecordExpiryQueue ¶
InsertRecordExpiryQueue inserts a record CID to the appropriate timeslice in the record expiry queue.
func (Keeper) ListNameAuthorityRecords ¶
ListNameAuthorityRecords - get all name authority records.
func (Keeper) ListNameRecords ¶
ListNameRecords - get all name records.
func (Keeper) ListRecords ¶
ListRecords - get all records.
func (Keeper) MatchRecords ¶
MatchRecords - get all matching records.
func (Keeper) ProcessAssociateBond ¶
func (k Keeper) ProcessAssociateBond(ctx sdk.Context, msg types.MsgAssociateBond) (*types.Record, error)
ProcessAssociateBond associates a record with a bond.
func (Keeper) ProcessAuthorityExpiryQueue ¶
ProcessAuthorityExpiryQueue tries to renew expiring authorities (by collecting rent) else marks them as expired.
func (Keeper) ProcessDeleteName ¶
ProcessDeleteName removes a WRN -> Record ID mapping.
func (Keeper) ProcessDissociateBond ¶
func (k Keeper) ProcessDissociateBond(ctx sdk.Context, msg types.MsgDissociateBond) (*types.Record, error)
ProcessDissociateBond dissociates a record from its bond.
func (Keeper) ProcessDissociateRecords ¶
func (k Keeper) ProcessDissociateRecords(ctx sdk.Context, msg types.MsgDissociateRecords) (*bond.Bond, error)
ProcessDissociateRecords dissociates all records associated with a given bond.
func (Keeper) ProcessReassociateRecords ¶
func (k Keeper) ProcessReassociateRecords(ctx sdk.Context, msg types.MsgReassociateRecords) (*bond.Bond, error)
ProcessReassociateRecords switches records from and old to new bond.
func (Keeper) ProcessRecordExpiryQueue ¶
ProcessRecordExpiryQueue tries to renew expiring records (by collecting rent) else marks them as deleted.
func (Keeper) ProcessRenewRecord ¶
func (k Keeper) ProcessRenewRecord(ctx sdk.Context, msg types.MsgRenewRecord) (*types.Record, error)
ProcessRenewRecord renews a record.
func (Keeper) ProcessReserveAuthority ¶
func (k Keeper) ProcessReserveAuthority(ctx sdk.Context, msg types.MsgReserveAuthority) (string, error)
ProcessReserveAuthority reserves a name authority.
func (Keeper) ProcessReserveSubAuthority ¶
func (k Keeper) ProcessReserveSubAuthority(ctx sdk.Context, name string, msg types.MsgReserveAuthority) (string, error)
ProcessReserveSubAuthority reserves a sub-authority.
func (Keeper) ProcessSetAuthorityBond ¶
func (k Keeper) ProcessSetAuthorityBond(ctx sdk.Context, msg types.MsgSetAuthorityBond) (string, error)
ProcessSetAuthorityBond sets a bond on an authority.
func (Keeper) ProcessSetName ¶
ProcessSetName creates a WRN -> Record ID mapping.
func (Keeper) ProcessSetRecord ¶
ProcessSetRecord creates a record.
func (Keeper) RecordExpiryQueueIterator ¶
RecordExpiryQueueIterator returns all the record expiry queue timeslices from time 0 until endTime.
func (Keeper) RemoveAuctionToAuthorityMapping ¶
func (Keeper) RemoveBondToAuthorityIndexEntry ¶
RemoveBondToAuthorityIndexEntry removes the Bond ID -> [Authority] index entry.
func (Keeper) RemoveBondToRecordIndexEntry ¶
RemoveBondToRecordIndexEntry removes the Bond ID -> [Record] index entry.
func (Keeper) ResolveWRN ¶
ResolveWRN resolves a WRN to a record.
func (Keeper) SetAuthorityExpiryQueueTimeSlice ¶
func (Keeper) SetNameAuthority ¶
SetNameAuthority creates the NameAutority record.
func (Keeper) SetNameRecord ¶
SetNameRecord - sets a name record.
func (Keeper) SetRecordExpiryQueueTimeSlice ¶
func (k Keeper) SetRecordExpiryQueueTimeSlice(ctx sdk.Context, timestamp time.Time, cids []types.ID)
SetRecordExpiryQueueTimeSlice sets a specific record expiry queue timeslice.
func (Keeper) TryTakeAuthorityRent ¶
TryTakeAuthorityRent tries to take rent from the authority bond.
type RecordKeeper ¶
type RecordKeeper struct {
// contains filtered or unexported fields
}
RecordKeeper exposes the bare minimal read-only API for other modules.
func NewRecordKeeper ¶
func NewRecordKeeper(auctionKeeper auction.Keeper, storeKey sdk.StoreKey, cdc *codec.Codec) RecordKeeper
NewRecordKeeper creates new instances of the nameservice RecordKeeper
func (RecordKeeper) GetAuctionToAuthorityMapping ¶
func (RecordKeeper) ModuleName ¶
func (k RecordKeeper) ModuleName() string
ModuleName returns the module name.
func (RecordKeeper) OnAuction ¶
func (k RecordKeeper) OnAuction(ctx sdk.Context, auctionID auction.ID)
func (RecordKeeper) OnAuctionBid ¶
func (RecordKeeper) OnAuctionWinnerSelected ¶
func (k RecordKeeper) OnAuctionWinnerSelected(ctx sdk.Context, auctionID auction.ID)
OnAuctionWinnerSelected is called when an auction winner is selected.
func (RecordKeeper) QueryRecordsByBond ¶
QueryRecordsByBond - get all records for the given bond.
func (RecordKeeper) UsesAuction ¶
UsesAuction returns true if the auction is used for an name authority.