keeper

package
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: Feb 6, 2021 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Overview

Package keeper specifies the keeper for the cert module.

Index

Constants

View Source
const MaxTimestamp = 253402300799

Max timestamp supported by Amino. Dec 31, 9999 - 23:59:59 GMT

Variables

This section is empty.

Functions

func HandleCertifierUpdateProposal

func HandleCertifierUpdateProposal(ctx sdk.Context, k Keeper, p types.CertifierUpdateProposal) error

HandleCertifierUpdateProposal is a handler for executing a passed certifier update proposal

func NewQuerier

func NewQuerier(keeper Keeper) sdk.Querier

NewQuerier is the module level router for state queries.

func RandomDelegator

func RandomDelegator(r *rand.Rand, k Keeper, ctx sdk.Context) (sdk.AccAddress, bool)

RandomDelegator returns a random delegator address given access to the keeper and ctx.

func RandomValidator

func RandomValidator(r *rand.Rand, k Keeper, ctx sdk.Context) (staking.Validator, bool)

RandomValidator returns a random validator given access to the keeper and ctx.

Types

type Keeper

type Keeper struct {
	// contains filtered or unexported fields
}

Keeper manages certifier & security council related logics.

func NewKeeper

func NewKeeper(cdc *codec.Codec, storeKey sdk.StoreKey, slashingKeeper types.SlashingKeeper, stakingKeeper types.StakingKeeper) Keeper

NewKeeper creates a new instance of the certifier keeper.

func (Keeper) CertifyPlatform

func (k Keeper) CertifyPlatform(ctx sdk.Context, certifier sdk.AccAddress, validator crypto.PubKey, description string) error

CertifyPlatform certifies a validator host platform by a certifier.

func (Keeper) CertifyValidator

func (k Keeper) CertifyValidator(ctx sdk.Context, validator crypto.PubKey, certifier sdk.AccAddress) error

CertifyValidator certifies a validator.

func (Keeper) DecertifyValidator

func (k Keeper) DecertifyValidator(ctx sdk.Context, valPubKey crypto.PubKey, decertifier sdk.AccAddress) error

DecertifyValidator de-certifies a certified validator.

func (Keeper) DeleteCertificate

func (k Keeper) DeleteCertificate(ctx sdk.Context, certificate types.Certificate) error

DeleteCertificate deletes a certificate using its ID field.

func (Keeper) GetAllCertificates

func (k Keeper) GetAllCertificates(ctx sdk.Context) (certificates []types.Certificate)

GetAllCertificates gets all certificates.

func (Keeper) GetAllCertifiers

func (k Keeper) GetAllCertifiers(ctx sdk.Context) types.Certifiers

GetAllCertifiers gets all certifiers.

func (Keeper) GetAllLibraries

func (k Keeper) GetAllLibraries(ctx sdk.Context) (libraries types.Libraries)

GetAllLibraries gets all libraries.

func (Keeper) GetAllLibraryAddresses

func (k Keeper) GetAllLibraryAddresses(ctx sdk.Context) (libraryAddresses []sdk.AccAddress)

GetAllLibraryAddresses gets all library addresses.

func (Keeper) GetAllPlatforms

func (k Keeper) GetAllPlatforms(ctx sdk.Context) (platforms []types.Platform)

GetAllPlatforms gets all platform certificates for genesis export

func (Keeper) GetAllValidatorPubkeys

func (k Keeper) GetAllValidatorPubkeys(ctx sdk.Context) (validatorAddresses []string)

GetAllValidatorPubkeys gets all validator pubkeys.

func (Keeper) GetAllValidators

func (k Keeper) GetAllValidators(ctx sdk.Context) (validators types.Validators)

GetAllValidators gets all validators.

func (Keeper) GetCertificateByID

func (k Keeper) GetCertificateByID(ctx sdk.Context, id types.CertificateID) (types.Certificate, error)

GetCertificateByID retrieves a certificate given an ID.

func (Keeper) GetCertificateType

func (k Keeper) GetCertificateType(ctx sdk.Context, id types.CertificateID) (types.CertificateType, error)

GetCertificateType gets type of a certificate by certificate ID.

func (Keeper) GetCertificatesByCertifier

func (k Keeper) GetCertificatesByCertifier(ctx sdk.Context, certifier sdk.AccAddress) []types.Certificate

GetCertificatesByCertifier gets certificates certified by a given certifier.

func (Keeper) GetCertificatesByContent

func (k Keeper) GetCertificatesByContent(ctx sdk.Context, requestContent types.RequestContent) []types.Certificate

GetCertificatesByContent retrieves all certificates with given content.

func (Keeper) GetCertificatesByTypeAndContent

func (k Keeper) GetCertificatesByTypeAndContent(ctx sdk.Context, certType types.CertificateType,
	requestContent types.RequestContent) []types.Certificate

GetCertificatesByTypeAndContent retrieves all certificates with given certificate type and content.

func (Keeper) GetCertificatesFiltered

func (k Keeper) GetCertificatesFiltered(ctx sdk.Context, params types.QueryCertificatesParams) (uint64, []types.Certificate, error)

GetCertificatesFiltered gets certificates filtered.

func (Keeper) GetCertifiedIdentities

func (k Keeper) GetCertifiedIdentities(ctx sdk.Context) []sdk.AccAddress

GetCertifiedIdentities returns a list of addresses certified as identities.

func (Keeper) GetCertifier

func (k Keeper) GetCertifier(ctx sdk.Context, certifierAddress sdk.AccAddress) (types.Certifier, error)

GetCertifier returns the certification information for a certifier.

func (Keeper) GetCertifierByAlias

func (k Keeper) GetCertifierByAlias(ctx sdk.Context, alias string) (types.Certifier, error)

GetCertifierByAlias returns the certification information for a certifier by its alias.

func (Keeper) GetNewCertificateID

func (k Keeper) GetNewCertificateID(ctx sdk.Context, certType types.CertificateType,
	certContent types.RequestContent) (types.CertificateID, error)

GetNewCertificateID gets an unused certificate ID for a new certificate.

func (Keeper) GetPlatform

func (k Keeper) GetPlatform(ctx sdk.Context, validator crypto.PubKey) (string, bool)

GetPlatform returns the host platform of the validator.

func (Keeper) GetValidator

func (k Keeper) GetValidator(ctx sdk.Context, validator crypto.PubKey) ([]byte, bool)

GetValidator returns the validator.

func (Keeper) GetValidatorCertifier

func (k Keeper) GetValidatorCertifier(ctx sdk.Context, validator crypto.PubKey) (sdk.AccAddress, error)

GetValidatorCertifier gets the original certifier of the validator.

func (Keeper) HasCertificateByID

func (k Keeper) HasCertificateByID(ctx sdk.Context, id types.CertificateID) bool

HasCertificateByID checks if a certificate exists given an ID.

func (Keeper) HasCertifierAlias

func (k Keeper) HasCertifierAlias(ctx sdk.Context, alias string) bool

HasCertifierAlias checks if the alias of a certifier exists.

func (Keeper) InvalidateLibrary

func (k Keeper) InvalidateLibrary(ctx sdk.Context, library sdk.AccAddress, invalidator sdk.AccAddress) error

InvalidateLibrary invalidate a Certificate library.

func (Keeper) IsCertified

func (k Keeper) IsCertified(ctx sdk.Context, requestContentType string, content string, certType string) bool

IsCertified checks if a certificate of given type and content exists.

func (Keeper) IsCertifier

func (k Keeper) IsCertifier(ctx sdk.Context, address sdk.AccAddress) bool

IsCertifier checks if an address is a certifier.

func (Keeper) IsContentCertified

func (k Keeper) IsContentCertified(ctx sdk.Context, requestContent string) bool

IsContentCertified checks if a certificate of given content exists.

func (Keeper) IsLibrary

func (k Keeper) IsLibrary(ctx sdk.Context, library sdk.AccAddress) bool

IsLibrary checks if an address is a Certificate library.

func (Keeper) IsValidatorCertified

func (k Keeper) IsValidatorCertified(ctx sdk.Context, validator crypto.PubKey) bool

IsValidatorCertified checks if the validator is current certified.

func (Keeper) IssueCertificate

func (k Keeper) IssueCertificate(ctx sdk.Context, c types.Certificate) (types.CertificateID, error)

IssueCertificate issues a certificate.

func (Keeper) IterateAllCertificate

func (k Keeper) IterateAllCertificate(ctx sdk.Context, callback func(certificate types.Certificate) (stop bool))

IterateAllCertificate iterates over the all the stored certificates and performs a callback function.

func (Keeper) IterateAllCertifiers

func (k Keeper) IterateAllCertifiers(ctx sdk.Context, callback func(certifier types.Certifier) (stop bool))

IterateAllCertifiers iterates over the all the stored certifiers and performs a callback function.

func (Keeper) IterateAllLibraries

func (k Keeper) IterateAllLibraries(ctx sdk.Context, callback func(library types.Library) (stop bool))

IterateAllLibraries iterates over the all the stored libraries and performs a callback function.

func (Keeper) IterateAllValidators

func (k Keeper) IterateAllValidators(ctx sdk.Context, callback func(validator types.Validator) (stop bool))

IterateAllValidators iterates over the all the stored validators and performs a callback function.

func (Keeper) IterateCertificatesByContent

func (k Keeper) IterateCertificatesByContent(ctx sdk.Context, certType types.CertificateType,
	content types.RequestContent, callback func(certificate types.Certificate) (stop bool))

IterateCertificatesByContent iterates over certificates with identical given certifier, certificate type, and certificate content.

func (Keeper) IterateCertificatesByType

func (k Keeper) IterateCertificatesByType(ctx sdk.Context, certType types.CertificateType, callback func(certificate types.Certificate) (stop bool))

IterateCertificatesByType iterates over certificates with identical given certificate type.

func (Keeper) PublishLibrary

func (k Keeper) PublishLibrary(ctx sdk.Context, library sdk.AccAddress, publisher sdk.AccAddress) error

PublishLibrary publishes a new Certificate library.

func (Keeper) RevokeCertificate

func (k Keeper) RevokeCertificate(ctx sdk.Context, certificate types.Certificate, revoker sdk.AccAddress) error

RevokeCertificate revokes a certificate.

func (Keeper) SetCertificate

func (k Keeper) SetCertificate(ctx sdk.Context, certificate types.Certificate)

SetCertificate stores a certificate using its ID field.

func (Keeper) SetCertifier

func (k Keeper) SetCertifier(ctx sdk.Context, certifier types.Certifier)

SetCertifier sets a certifier.

func (Keeper) SetLibrary

func (k Keeper) SetLibrary(ctx sdk.Context, library sdk.AccAddress, publisher sdk.AccAddress)

SetLibrary sets a new Certificate library registry.

func (Keeper) SetValidator

func (k Keeper) SetValidator(ctx sdk.Context, validator crypto.PubKey, certifier sdk.AccAddress)

SetValidator sets a certified validator.

type QueryResCertificate

type QueryResCertificate struct {
	CertificateID      string                 `json:"certificate_id"`
	CertificateType    string                 `json:"certificate_type"`
	RequestContent     QueryResRequestContent `json:"request_content"`
	CertificateContent []types.KVPair         `json:"certificate_content"`
	Description        string                 `json:"description"`
	Certifier          string                 `json:"certifier"`
	TxHash             string                 `json:"txhash"`
}

func NewQueryResCertificate

func NewQueryResCertificate(
	certificateID string,
	certificateType string,
	requestContent types.RequestContent,
	certificateContent []types.KVPair,
	description string,
	certifier string,
	txhash string,
) QueryResCertificate

type QueryResCertificates

type QueryResCertificates struct {
	Total        uint64                `json:"total"`
	Certificates []QueryResCertificate `json:"certificates"`
}

type QueryResRequestContent

type QueryResRequestContent struct {
	RequestContentType     types.RequestContentType `json:"request_content_type"`
	RequestContentTypeName string                   `json:"request_content_type_name"`
	RequestContent         string                   `json:"request_content"`
}

func NewQueryResRequestContent

func NewQueryResRequestContent(
	requestContentType types.RequestContentType,
	requestContentTypeName string,
	requestContent string,
) QueryResRequestContent

Jump to

Keyboard shortcuts

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