keeper

package
v1.20.0 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2024 License: Apache-2.0 Imports: 28 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FindMissingMdAddr added in v1.8.0

func FindMissingMdAddr(required, entries []types.MetadataAddress) []types.MetadataAddress

FindMissingMdAddr returns all elements of the required list that are not found in the entries list It is exported only so that it can be unit tested.

func GetValueOwnerScopeCacheKey added in v1.20.0

func GetValueOwnerScopeCacheKey(addr sdk.AccAddress, scopeID types.MetadataAddress) []byte

GetValueOwnerScopeCacheKey returns the store key for an address cache entry

func IsBase64 added in v0.3.0

func IsBase64(s string) bool

func NewMsgServerImpl

func NewMsgServerImpl(keeper Keeper) types.MsgServer

NewMsgServerImpl returns an implementation of the distribution MsgServer interface for the provided Keeper.

func ParseContractSpecID added in v1.0.0

func ParseContractSpecID(contractSpecID string) (types.MetadataAddress, error)

ParseContractSpecID parses the provided input into a contract spec MetadataAddress. The input can either be a uuid string, a contract spec address bech32 string, or a record spec address bech32 string.

func ParseRecordAddr added in v1.0.0

func ParseRecordAddr(recordAddr string) (types.MetadataAddress, error)

ParseRecordAddr parses the provided input into a record MetadataAddress. The input must be a record address bech32 string.

func ParseRecordSpecID added in v1.0.0

func ParseRecordSpecID(specID string, name string) (types.MetadataAddress, error)

ParseRecordSpecID parses the provided input into a record spec MetadataAddress. The recordSpecID can either be a uuid string, a record spec address bech32 string, or a contract spec address bech32 string. If it's a contract spec address or a uuid, then a name is required.

func ParseScopeID added in v1.0.0

func ParseScopeID(scopeID string) (types.MetadataAddress, error)

ParseScopeID parses the provided input into a scope MetadataAddress. The input can either be a uuid string or scope address bech32 string.

func ParseScopeSpecID added in v1.0.0

func ParseScopeSpecID(scopeSpecID string) (types.MetadataAddress, error)

ParseScopeSpecID parses the provided input into a scope spec MetadataAddress. The input can either be a uuid string or scope spec address bech32 string.

func ParseSessionAddr added in v1.0.0

func ParseSessionAddr(sessionAddr string) (types.MetadataAddress, error)

ParseSessionAddr parses the provided input into a session MetadataAddress. The input must be a session address bech32 string.

func ParseSessionID added in v1.0.0

func ParseSessionID(scopeID string, sessionID string) (types.MetadataAddress, error)

ParseSessionID parses the provided input into a session MetadataAddress. The scopeID field can be either a uuid or scope address bech32 string. The sessionID field can be either a uuid or session address bech32 string. If the sessionID field is a bech32 address, the scopeID field is ignored. Otherwise, the scope id field is parsed using ParseScopeID and converted to a session MetadataAddress using the uuid in the sessionID field.

func UnwrapMetadataContext added in v1.15.0

func UnwrapMetadataContext(goCtx context.Context) sdk.Context

UnwrapMetadataContext retrieves a Context from a context.Context instance attached with WrapSDKContext. It then adds an types.AuthzCache to it. It panics if a Context was not properly attached, or if the types.AuthzCache can't be added.

This should be used for all Metadata msg server endpoints instead of sdk.UnwrapSDKContext. This should not be used outside of the Metadata module.

Types

type AttrKeeper added in v1.16.0

type AttrKeeper interface {
	GetAccountData(ctx sdk.Context, addr string) (string, error)
	SetAccountData(ctx sdk.Context, addr string, value string) error
}

AttrKeeper defines the attribute functionality needed by the metadata module.

type AuthKeeper added in v1.15.0

type AuthKeeper interface {
	GetAccount(ctx context.Context, addr sdk.AccAddress) sdk.AccountI
}

AuthKeeper is an interface with functions that the auth.Keeper has that are needed in this module.

type AuthzKeeper added in v1.15.0

type AuthzKeeper interface {
	GetAuthorization(ctx context.Context, grantee, granter sdk.AccAddress, msgType string) (authz.Authorization, *time.Time)
	DeleteGrant(ctx context.Context, grantee, granter sdk.AccAddress, msgType string) error
	SaveGrant(ctx context.Context, grantee, granter sdk.AccAddress, authorization authz.Authorization, expiration *time.Time) error
}

AuthzKeeper is an interface with functions that the authz.Keeper has that are needed in this module.

type BankKeeper added in v1.20.0

type BankKeeper interface {
	BlockedAddr(addr sdk.AccAddress) bool
	MintCoins(ctx context.Context, moduleName string, amt sdk.Coins) error
	BurnCoins(ctx context.Context, moduleName string, amt sdk.Coins) error
	SendCoins(ctx context.Context, fromAddr, toAddr sdk.AccAddress, amt sdk.Coins) error

	DenomOwner(ctx context.Context, denom string) (sdk.AccAddress, error)
	GetScopesForValueOwner(ctx context.Context, valueOwner sdk.AccAddress, pageReq *query.PageRequest) (types.AccMDLinks, *query.PageResponse, error)
}

type Keeper

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

Keeper is the concrete state-based API for the metadata module.

func NewKeeper

func NewKeeper(
	cdc codec.BinaryCodec, key storetypes.StoreKey, authKeeper AuthKeeper,
	authzKeeper AuthzKeeper, attrKeeper AttrKeeper, markerKeeper MarkerKeeper,
	bankKeeper bankkeeper.BaseKeeper,
) Keeper

NewKeeper creates new instances of the metadata Keeper.

func (Keeper) AccountData added in v1.16.0

func (Keeper) AddSetNetAssetValues added in v1.18.0

func (k Keeper) AddSetNetAssetValues(ctx sdk.Context, scopeID types.MetadataAddress, netAssetValues []types.NetAssetValue, source string) error

AddSetNetAssetValues adds a set of net asset values to a scope

func (Keeper) ContractSpecification added in v0.1.5

ContractSpecification returns a specific contract specification by id.

func (Keeper) ContractSpecificationsAll added in v1.0.0

ContractSpecificationsAll returns all contract specifications (limited by pagination).

func (Keeper) EmitEvent added in v1.3.0

func (k Keeper) EmitEvent(ctx sdk.Context, event proto.Message)

func (Keeper) ExportGenesis

func (k Keeper) ExportGenesis(ctx sdk.Context) (data *types.GenesisState)

ExportGenesis exports the current keeper state of the metadata module.ExportGenesis

func (Keeper) GetByAddr added in v1.17.0

GetByAddr retrieves metadata given any address(es).

func (Keeper) GetContractSpecification added in v0.1.5

func (k Keeper) GetContractSpecification(ctx sdk.Context, contractSpecID types.MetadataAddress) (spec types.ContractSpecification, found bool)

GetContractSpecification returns the contract specification with the given id.

func (Keeper) GetMaxURILength added in v1.0.0

func (k Keeper) GetMaxURILength(ctx sdk.Context) uint32

GetMaxURILength returns the configured parameter for max URI length on a locator record

func (Keeper) GetNetAssetValue added in v1.20.0

func (k Keeper) GetNetAssetValue(ctx sdk.Context, metadataDenom, priceDenom string) (*types.NetAssetValue, error)

GetNetAssetValue gets the NAV record for the given scopeID with the given price denom. If it doesn't exist then nil, nil is returned.

func (Keeper) GetOSLocatorByScope added in v1.0.0

func (k Keeper) GetOSLocatorByScope(ctx sdk.Context, scopeID string) ([]types.ObjectStoreLocator, error)

GetOSLocatorByScope gets all Object Store Locators associated with a scope.

func (Keeper) GetOSLocatorParams added in v0.3.0

func (k Keeper) GetOSLocatorParams(ctx sdk.Context) (osLocatorParams types.OSLocatorParams)

GetOSLocatorParams returns the metadata OSLocatorParams.

func (Keeper) GetOsLocatorRecord added in v0.3.0

func (k Keeper) GetOsLocatorRecord(ctx sdk.Context, ownerAddr sdk.AccAddress) (osLocator types.ObjectStoreLocator, found bool)

GetOsLocatorRecord Gets the object store locator entry from the kvstore for the given owner address.

func (Keeper) GetRecord

func (k Keeper) GetRecord(ctx sdk.Context, id types.MetadataAddress) (record types.Record, found bool)

GetRecord returns the record with the given id.

func (Keeper) GetRecordSpecification added in v0.2.0

func (k Keeper) GetRecordSpecification(ctx sdk.Context, recordSpecID types.MetadataAddress) (spec types.RecordSpecification, found bool)

GetRecordSpecification returns the record specification with the given id.

func (Keeper) GetRecordSpecificationsForContractSpecificationID added in v0.2.0

func (k Keeper) GetRecordSpecificationsForContractSpecificationID(ctx sdk.Context, contractSpecID types.MetadataAddress) ([]*types.RecordSpecification, error)

GetRecordSpecificationsForContractSpecificationID returns all the record specifications associated with given contractSpecID

func (Keeper) GetRecords added in v0.1.5

func (k Keeper) GetRecords(ctx sdk.Context, scopeAddress types.MetadataAddress, name string) ([]*types.Record, error)

GetRecords returns records for a scope optionally limited to a name.

func (Keeper) GetScope

func (k Keeper) GetScope(ctx sdk.Context, id types.MetadataAddress) (types.Scope, bool)

GetScope returns the scope with the given id. The ValueOwnerAddress field will always be empty from this method. See also: GetScopeWithValueOwner, PopulateScopeValueOwner and GetScopeValueOwner.

func (Keeper) GetScopeSpecification

func (k Keeper) GetScopeSpecification(ctx sdk.Context, scopeSpecID types.MetadataAddress) (spec types.ScopeSpecification, found bool)

GetScopeSpecification returns the scope specification with the given id.

func (Keeper) GetScopeValueOwner added in v1.20.0

func (k Keeper) GetScopeValueOwner(ctx sdk.Context, id types.MetadataAddress) (sdk.AccAddress, error)

GetScopeValueOwner gets the value owner of a given scope.

func (Keeper) GetScopeValueOwners added in v1.20.0

func (k Keeper) GetScopeValueOwners(ctx sdk.Context, ids []types.MetadataAddress) (types.AccMDLinks, error)

GetScopeValueOwners gets the value owners for each given scope. The AccAddr will be nil for any scope that does not have a value owner.

func (Keeper) GetScopeWithValueOwner added in v1.20.0

func (k Keeper) GetScopeWithValueOwner(ctx sdk.Context, id types.MetadataAddress) (scope types.Scope, found bool)

GetScopeWithValueOwner will get a scope from state and also look up and set its value owner field.

func (Keeper) GetSession added in v0.2.0

func (k Keeper) GetSession(ctx sdk.Context, id types.MetadataAddress) (session types.Session, found bool)

GetSession returns the session with the given id.

func (Keeper) ImportOSLocatorRecord added in v1.3.0

func (k Keeper) ImportOSLocatorRecord(ctx sdk.Context, ownerAddr, encryptionKey sdk.AccAddress, uri string) error

ImportOSLocatorRecord binds a name to an address in the kvstore. Different from SetOSLocator in that there is less validation here. The uri format is not checked, and the owner address account is not looked up. This also does not emit any events.

func (Keeper) InitGenesis

func (k Keeper) InitGenesis(ctx sdk.Context, data *types.GenesisState)

InitGenesis creates the initial genesis state for the metadata module.

func (Keeper) IterateContractSpecs added in v0.1.5

func (k Keeper) IterateContractSpecs(ctx sdk.Context, handler func(specification types.ContractSpecification) (stop bool)) error

IterateContractSpecs processes all contract specs using a given handler.

func (Keeper) IterateContractSpecsForOwner added in v0.1.5

func (k Keeper) IterateContractSpecsForOwner(ctx sdk.Context, ownerAddress sdk.AccAddress, handler func(contractSpecID types.MetadataAddress) (stop bool)) error

IterateContractSpecsForOwner processes all contract specs owned by an address using a given handler.

func (Keeper) IterateNetAssetValues added in v1.18.0

func (k Keeper) IterateNetAssetValues(ctx sdk.Context, scopeID types.MetadataAddress, handler func(state types.NetAssetValue) (stop bool)) error

IterateNetAssetValues iterates net asset values for scope

func (Keeper) IterateOSLocators added in v1.3.0

func (k Keeper) IterateOSLocators(ctx sdk.Context, cb func(account types.ObjectStoreLocator) (stop bool)) error

IterateOSLocators runs a function for every ObjectStoreLocator entry in the kvstore.

func (Keeper) IterateRecordSpecs added in v0.2.0

func (k Keeper) IterateRecordSpecs(ctx sdk.Context, handler func(specification types.RecordSpecification) (stop bool)) error

IterateRecordSpecs processes all record specs using a given handler.

func (Keeper) IterateRecordSpecsForContractSpec added in v0.2.0

func (k Keeper) IterateRecordSpecsForContractSpec(ctx sdk.Context, contractSpecID types.MetadataAddress, handler func(recordSpecID types.MetadataAddress) (stop bool)) error

IterateRecordSpecsForContractSpec processes all record specs for a contract spec using a given handler.

func (Keeper) IterateRecordSpecsForOwner added in v0.2.0

func (k Keeper) IterateRecordSpecsForOwner(ctx sdk.Context, ownerAddress sdk.AccAddress, handler func(recordSpecID types.MetadataAddress) (stop bool)) error

IterateRecordSpecsForOwner processes all record specs owned by an address using a given handler.

func (Keeper) IterateRecords

func (k Keeper) IterateRecords(ctx sdk.Context, scopeID types.MetadataAddress, handler func(types.Record) (stop bool)) error

IterateRecords processes stored records with the given handler. If the scopeID is an empty MetadataAddress, all records will be processed. Otherwise, just the records for the given scopeID will be processed.

func (Keeper) IterateScopeSpecs added in v0.1.5

func (k Keeper) IterateScopeSpecs(ctx sdk.Context, handler func(specification types.ScopeSpecification) (stop bool)) error

IterateScopeSpecs processes all scope specs using a given handler.

func (Keeper) IterateScopeSpecsForContractSpec added in v0.1.5

func (k Keeper) IterateScopeSpecsForContractSpec(ctx sdk.Context, contractSpecID types.MetadataAddress, handler func(scopeSpecID types.MetadataAddress) (stop bool)) error

IterateScopeSpecsForContractSpec processes all scope specs associated with a contract spec id using a given handler.

func (Keeper) IterateScopeSpecsForOwner added in v0.1.5

func (k Keeper) IterateScopeSpecsForOwner(ctx sdk.Context, ownerAddress sdk.AccAddress, handler func(scopeSpecID types.MetadataAddress) (stop bool)) error

IterateScopeSpecsForOwner processes all scope specs owned by an address using a given handler.

func (Keeper) IterateScopes

func (k Keeper) IterateScopes(ctx sdk.Context, handler func(types.Scope) (stop bool)) error

IterateScopes processes all stored scopes with the given handler.

func (Keeper) IterateScopesForAddress

func (k Keeper) IterateScopesForAddress(ctx sdk.Context, address sdk.AccAddress, handler func(scopeID types.MetadataAddress) (stop bool)) error

IterateScopesForAddress processes scopes associated with the provided address with the given handler.

func (Keeper) IterateScopesForScopeSpec

func (k Keeper) IterateScopesForScopeSpec(ctx sdk.Context, scopeSpecID types.MetadataAddress,
	handler func(scopeID types.MetadataAddress) (stop bool),
) error

IterateScopesForScopeSpec processes scopes associated with the provided scope specification id with the given handler.

func (Keeper) IterateSessions added in v0.2.0

func (k Keeper) IterateSessions(ctx sdk.Context, scopeID types.MetadataAddress, handler func(types.Session) (stop bool)) error

IterateSessions processes stored sessions with the given handler. If the scopeID is an empty MetadataAddress, all sessions will be processed. Otherwise, just the sessions for the given scopeID will be processed.

func (Keeper) Logger

func (k Keeper) Logger(ctx sdk.Context) log.Logger

Logger returns a module-specific logger.

func (Keeper) ModifyOSLocator added in v1.3.0

func (k Keeper) ModifyOSLocator(ctx sdk.Context, ownerAddr, encryptionKey sdk.AccAddress, uri string) error

ModifyOSLocator updates an existing os locator entry in the kvstore, returns an error if it doesn't exist.

func (Keeper) OSAllLocators added in v0.3.0

func (k Keeper) OSAllLocators(ctx context.Context, request *types.OSAllLocatorsRequest) (*types.OSAllLocatorsResponse, error)

func (Keeper) OSLocator added in v0.3.0

func (Keeper) OSLocatorExists added in v0.3.0

func (k Keeper) OSLocatorExists(ctx sdk.Context, ownerAddr sdk.AccAddress) bool

OSLocatorExists checks if the provided bech32 owner address has a OSL entry in the kvstore.

func (Keeper) OSLocatorParams added in v0.3.0

func (Keeper) OSLocatorsByScope added in v1.0.0

func (Keeper) OSLocatorsByURI added in v1.0.0

func (Keeper) Ownership

Ownership returns a list of scope identifiers that list the given address as a data or value owner.

func (Keeper) Params

Params queries params of metadata module.

func (Keeper) PopulateScopeValueOwner added in v1.20.0

func (k Keeper) PopulateScopeValueOwner(ctx sdk.Context, scope *types.Scope)

PopulateScopeValueOwner will look up and set the ValueOwnerAddress in the provided scope.

func (Keeper) RecordSpecification added in v0.2.0

RecordSpecification returns a specific record specification.

func (Keeper) RecordSpecificationsAll added in v1.0.0

RecordSpecificationsAll returns all record specifications (limited by pagination).

func (Keeper) RecordSpecificationsForContractSpecification added in v0.2.0

RecordSpecificationsForContractSpecification returns the record specifications associated with a contract specification.

func (Keeper) Records added in v1.0.0

Records returns records based on the provided request.

func (Keeper) RecordsAll added in v1.0.0

RecordsAll returns all records (limited by pagination).

func (Keeper) RemoveContractSpecification added in v0.1.5

func (k Keeper) RemoveContractSpecification(ctx sdk.Context, contractSpecID types.MetadataAddress) error

RemoveContractSpecification removes a contract specification from the module kv store.

func (Keeper) RemoveNetAssetValues added in v1.18.0

func (k Keeper) RemoveNetAssetValues(ctx sdk.Context, scopeID types.MetadataAddress)

RemoveNetAssetValues removes all net asset values for a scope

func (Keeper) RemoveOSLocator added in v1.3.0

func (k Keeper) RemoveOSLocator(ctx sdk.Context, ownerAddr sdk.AccAddress) error

RemoveOSLocator removes an os locator record from the kvstore.

func (Keeper) RemoveRecord

func (k Keeper) RemoveRecord(ctx sdk.Context, id types.MetadataAddress)

RemoveRecord removes a record from the module kv store.

func (Keeper) RemoveRecordSpecification added in v0.2.0

func (k Keeper) RemoveRecordSpecification(ctx sdk.Context, recordSpecID types.MetadataAddress) error

RemoveRecordSpecification removes a record specification from the module kv store.

func (Keeper) RemoveScope added in v0.1.5

func (k Keeper) RemoveScope(ctx sdk.Context, id types.MetadataAddress) error

RemoveScope removes a scope from the module kv store along with all its records and sessions.

func (Keeper) RemoveScopeSpecification added in v0.1.5

func (k Keeper) RemoveScopeSpecification(ctx sdk.Context, scopeSpecID types.MetadataAddress) error

RemoveScopeSpecification removes a scope specification from the module kv store.

func (Keeper) RemoveSession added in v0.2.0

func (k Keeper) RemoveSession(ctx sdk.Context, id types.MetadataAddress)

RemoveSession removes a session from the module kv store if there are no records associated with it.

func (Keeper) Scope

Scope returns a specific scope by id.

func (Keeper) ScopeNetAssetValues added in v1.18.0

NetAssetValues query for returning net asset values for a marker

func (Keeper) ScopeSpecification added in v0.1.5

ScopeSpecification returns a specific scope specification by id.

func (Keeper) ScopeSpecificationsAll added in v1.0.0

ScopeSpecificationsAll returns all scope specifications (limited by pagination).

func (Keeper) ScopesAll added in v1.0.0

ScopesAll returns all scopes (limited by pagination).

func (Keeper) Sessions added in v1.0.0

Sessions returns sessions based on the provided request.

func (Keeper) SessionsAll added in v1.0.0

SessionsAll returns all sessions (limited by pagination).

func (Keeper) SetContractSpecification added in v0.1.5

func (k Keeper) SetContractSpecification(ctx sdk.Context, spec types.ContractSpecification)

SetContractSpecification stores a contract specification in the module kv store.

func (Keeper) SetNetAssetValue added in v1.18.0

func (k Keeper) SetNetAssetValue(ctx sdk.Context, scopeID types.MetadataAddress, netAssetValue types.NetAssetValue, source string) error

SetNetAssetValue adds/updates a net asset value to scope

func (Keeper) SetNetAssetValueWithBlockHeight added in v1.19.0

func (k Keeper) SetNetAssetValueWithBlockHeight(ctx sdk.Context, scopeID types.MetadataAddress, netAssetValue types.NetAssetValue, source string, blockHeight uint64) error

SetNetAssetValueWithBlockHeight adds/updates a net asset value to scope with a specific block height

func (Keeper) SetOSLocator added in v1.3.0

func (k Keeper) SetOSLocator(ctx sdk.Context, ownerAddr, encryptionKey sdk.AccAddress, uri string) error

SetOSLocator binds an OS Locator to an address in the kvstore. An error is returned if no account exists for the address. An error is returned if an OS Locator already exists for the address.

func (Keeper) SetOSLocatorParams added in v0.3.0

func (k Keeper) SetOSLocatorParams(ctx sdk.Context, params types.OSLocatorParams)

SetOSLocatorParams sets the metadata OSLocator parameters to the store.

func (Keeper) SetRecord

func (k Keeper) SetRecord(ctx sdk.Context, record types.Record)

SetRecord stores a record in the module kv store.

func (Keeper) SetRecordSpecification added in v0.2.0

func (k Keeper) SetRecordSpecification(ctx sdk.Context, spec types.RecordSpecification)

SetRecordSpecification stores a record specification in the module kv store.

func (Keeper) SetScope

func (k Keeper) SetScope(ctx sdk.Context, scope types.Scope) error

SetScope stores a scope in the module kv store.

func (Keeper) SetScopeSpecification

func (k Keeper) SetScopeSpecification(ctx sdk.Context, spec types.ScopeSpecification)

SetScopeSpecification stores a scope specification in the module kv store.

func (Keeper) SetScopeValueOwner added in v1.20.0

func (k Keeper) SetScopeValueOwner(ctx sdk.Context, scopeID types.MetadataAddress, newValueOwner string) error

SetScopeValueOwner updates the value owner of a scope. If there's no current value owner, the coin will be minted for the scope. If there's no new value owner, the coin will be burned for the scope.

func (Keeper) SetScopeValueOwners added in v1.16.0

func (k Keeper) SetScopeValueOwners(ctx sdk.Context, links types.AccMDLinks, newValueOwner string) error

SetScopeValueOwners updates the value owner of one or more scopes.

func (Keeper) SetSession added in v0.2.0

func (k Keeper) SetSession(ctx sdk.Context, session types.Session)

SetSession stores a session in the module kv store.

func (Keeper) UnionDistinct added in v1.4.0

func (k Keeper) UnionDistinct(sets ...[]string) []string

unionUnique gets a union of the provided sets of strings without any duplicates.

func (Keeper) V3WriteNewScope added in v1.20.0

func (k Keeper) V3WriteNewScope(ctx sdk.Context, scope types.Scope) error

V3WriteNewScope writes a new scope to state in the way v3 of the metadata module did. Deprecated: Only exists to facilitate testing of the migration of the metadata module from v3 to v4.

func (Keeper) ValidateAddScopeDataAccess added in v1.15.0

func (k Keeper) ValidateAddScopeDataAccess(
	ctx sdk.Context,
	existing types.Scope,
	msg *types.MsgAddScopeDataAccessRequest,
) error

ValidateAddScopeDataAccess checks the current scope and the proposed

func (Keeper) ValidateAuditUpdate added in v0.2.1

func (k Keeper) ValidateAuditUpdate(_ sdk.Context, existing, proposed *types.AuditFields) error

ValidateAuditUpdate ensure that a given reference to audit fields represents no changes to existing audit field data. NOTE: A nil proposed is considered "no update" and not an attempt to unset.

func (Keeper) ValidateDeleteRecord added in v1.15.0

func (k Keeper) ValidateDeleteRecord(ctx sdk.Context, proposedID types.MetadataAddress, msg types.MetadataMsg) error

ValidateDeleteRecord checks the current record and the proposed removal scope to determine if the proposed remove is valid based on the existing state

func (Keeper) ValidateDeleteScope added in v1.15.0

func (k Keeper) ValidateDeleteScope(ctx sdk.Context, msg *types.MsgDeleteScopeRequest) ([]sdk.AccAddress, error)

ValidateDeleteScope checks the current scope and the proposed removal scope to determine if the proposed remove is valid based on the existing state

func (Keeper) ValidateDeleteScopeDataAccess added in v1.15.0

func (k Keeper) ValidateDeleteScopeDataAccess(
	ctx sdk.Context,
	existing types.Scope,
	msg *types.MsgDeleteScopeDataAccessRequest,
) error

ValidateDeleteScopeDataAccess checks the current scope data access and the proposed removed items

func (Keeper) ValidateScopeValueOwnersSigners added in v1.20.0

func (k Keeper) ValidateScopeValueOwnersSigners(
	ctx sdk.Context,
	existingOwners []sdk.AccAddress,
	proposed string,
	msg types.MetadataMsg,
) ([]sdk.AccAddress, types.UsedSignersMap, error)

ValidateScopeValueOwnersSigners ensures that all of the existingOwners are signers of the provided msg for the purposes of updating a value owner. Returns the list of possible transfer agents and a map indicating which signers were used.

func (Keeper) ValidateSetAccountData added in v1.16.0

func (k Keeper) ValidateSetAccountData(ctx sdk.Context, msg *types.MsgSetAccountDataRequest) error

ValidateSetAccountData makes sure that the msg signers have proper authority to set the account data of the provided metadata address.

func (Keeper) ValidateSetScopeAccountData added in v1.16.0

func (k Keeper) ValidateSetScopeAccountData(ctx sdk.Context, msg *types.MsgSetAccountDataRequest) error

ValidateSetScopeAccountData makes sure that the msg signers have proper authority to set the account data of the provided metadata address. Assumes that msg.MetadataAddr is a scope id.

func (Keeper) ValidateSignersWithParties added in v1.15.0

func (k Keeper) ValidateSignersWithParties(
	ctx sdk.Context,
	reqParties, availableParties []types.Party,
	reqRoles []types.PartyType,
	msg types.MetadataMsg,
) error

ValidateSignersWithParties ensures the following:

  • All optional=false reqParties have signed.
  • All required roles are present in availableParties and are signers.
  • All available parties with the PROVENANCE role are a smart contract account.
  • All available parties with a smart contract account have the PROVENANCE role.
  • All signers that are smart contracts are allowed to sign.

The x/authz module is utilized to help facilitate signer checking.

  • reqParties are the parties that might be required to sign, but might not necessarily fulfill a required role. They can only fulfill a required role if also provided in availableParties. Parties in reqParties with optional=true, are ignored. Parties in reqParties with optional=false are required to be in the msg signers.
  • availableParties are the parties available to fulfill required roles. Entries in here with optional=false are NOT required to sign (unless they're in reqParties like that too).
  • reqRoles are all the roles that are required.

If a party is in both reqParties and availableParties, they are only optional if both have optional=true. Only parties in availableParties that are in the msg signers list are able to fulfill an entry in reqRoles, and each such party can only fulfill one required role entry.

When parties and roles aren't involved, use ValidateSignersWithoutParties.

func (Keeper) ValidateSignersWithoutParties added in v1.15.0

func (k Keeper) ValidateSignersWithoutParties(
	ctx sdk.Context,
	required []string,
	msg types.MetadataMsg,
) error

ValidateSignersWithoutParties makes sure that each entry in the required list are either signers of the msg, or have granted an authz authorization to one of the signers. It then makes sure that any signers that are smart contracts are allowed to sign.

When parties (and/or roles) are involved, use ValidateSignersWithParties.

func (Keeper) ValidateUpdateScopeOwners added in v1.15.0

func (k Keeper) ValidateUpdateScopeOwners(
	ctx sdk.Context,
	existing,
	proposed types.Scope,
	msg types.MetadataMsg,
) error

ValidateUpdateScopeOwners checks the current scopes owners and the proposed update

func (Keeper) ValidateUpdateValueOwners added in v1.16.0

func (k Keeper) ValidateUpdateValueOwners(
	ctx sdk.Context,
	links types.AccMDLinks,
	proposed string,
	msg types.MetadataMsg,
) ([]sdk.AccAddress, error)

ValidateUpdateValueOwners checks that the signer(s) of the provided msg are authorized to change the value owner of the scopes in the links provided. Also checks that the provided links are valid. Returns the transfer agents available for the SendCoins.

func (Keeper) ValidateWriteContractSpecification added in v1.15.0

func (k Keeper) ValidateWriteContractSpecification(_ sdk.Context, existing *types.ContractSpecification, proposed types.ContractSpecification) error

ValidateWriteContractSpecification compare the proposed contract spec with the existing to make sure the proposed is valid. This assumes that proposed.ValidateBasic() has been run and did not return an error.

func (Keeper) ValidateWriteRecord added in v1.15.0

func (k Keeper) ValidateWriteRecord(
	ctx sdk.Context,
	existing *types.Record,
	msg *types.MsgWriteRecordRequest,
) error

ValidateWriteRecord checks the current record and the proposed record to determine if the proposed changes are valid based on the existing state Note: The proposed parameter is a reference here so that the SpecificationId can be set in cases when it's not provided.

func (Keeper) ValidateWriteRecordSpecification added in v1.15.0

func (k Keeper) ValidateWriteRecordSpecification(_ sdk.Context, existing *types.RecordSpecification, proposed types.RecordSpecification) error

ValidateWriteRecordSpecification compare the proposed contract spec with the existing to make sure the proposed is valid. This assumes that proposed.ValidateBasic() has been run and did not return an error.

func (Keeper) ValidateWriteScope added in v1.15.0

func (k Keeper) ValidateWriteScope(
	ctx sdk.Context,
	msg *types.MsgWriteScopeRequest,
) ([]sdk.AccAddress, error)

ValidateWriteScope checks the current scope and the proposed scope to determine if the proposed changes are valid based on the existing state. Returns the addresses allowed to act as transfer agents.

func (Keeper) ValidateWriteScopeSpecification added in v1.15.0

func (k Keeper) ValidateWriteScopeSpecification(ctx sdk.Context, existing *types.ScopeSpecification, proposed types.ScopeSpecification) error

ValidateWriteScopeSpecification compare the proposed scope spec with the existing to make sure the proposed is valid. This assumes that proposed.ValidateBasic() has been run and did not return an error.

func (Keeper) ValidateWriteSession added in v1.15.0

func (k Keeper) ValidateWriteSession(ctx sdk.Context, existing *types.Session, msg *types.MsgWriteSessionRequest) error

ValidateWriteSession checks the current session and the proposed session to determine if the proposed changes are valid based on the existing state

func (Keeper) ValueOwnership

ValueOwnership returns a list of scope identifiers that list the given address as a value owner.

func (Keeper) VerifyCorrectOwner added in v0.3.0

func (k Keeper) VerifyCorrectOwner(ctx sdk.Context, ownerAddr sdk.AccAddress) bool

VerifyCorrectOwner to determines whether the signer resolves to the owner of the OSLocator record.

type MDBankKeeper added in v1.20.0

type MDBankKeeper struct {
	bankkeeper.BaseKeeper
}

MDBankKeeper extends the SDK's bank keeper to add methods that act on fields so that we can mock all of it.

func NewMDBankKeeper added in v1.20.0

func NewMDBankKeeper(bk bankkeeper.BaseKeeper) *MDBankKeeper

func (*MDBankKeeper) DenomOwner added in v1.20.0

func (k *MDBankKeeper) DenomOwner(ctx context.Context, denom string) (sdk.AccAddress, error)

DenomOwner gets the singular owner of a denom. An error is returned if more than one account owns some of the denom. If no one owns the denom, this will return nil, nil.

func (*MDBankKeeper) GetScopesForValueOwner added in v1.20.0

func (k *MDBankKeeper) GetScopesForValueOwner(ctx context.Context, valueOwner sdk.AccAddress, pageReq *query.PageRequest) (types.AccMDLinks, *query.PageResponse, error)

GetScopesForValueOwner will get the scopes owned by a specific value owner. If the pageReq is nil, this will get all their scopes and the resulting PageResponse will be nil. If a pageReq is provided, this will get just the requested page and it will return a PageResponse.

type MarkerKeeper added in v1.18.0

type MarkerKeeper interface {
	GetMarkerByDenom(ctx sdk.Context, denom string) (markertypes.MarkerAccountI, error)
	IsMarkerAccount(ctx sdk.Context, addr sdk.AccAddress) bool
}

MarkerKeeper defines the attribute functionality needed by the metadata module.

type Migrator added in v1.7.0

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

Migrator is a struct for handling in-place store migrations.

func NewMigrator added in v1.7.0

func NewMigrator(keeper Keeper) Migrator

NewMigrator returns a new Migrator.

func (Migrator) Migrate3To4 added in v1.20.0

func (m Migrator) Migrate3To4(ctx sdk.Context) error

Migrate3To4 will update the metadata store from version 3 to version 4. This should be part of the viridian upgrade.

type SignersWrapper added in v1.15.0

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

SignersWrapper stores the signers as strings and acc addresses. One is created by providing the strings. They are then converted to acc addresses if they're needed that way.

func NewSignersWrapper added in v1.15.0

func NewSignersWrapper(signers []string) *SignersWrapper

func (*SignersWrapper) Accs added in v1.15.0

func (s *SignersWrapper) Accs() []sdk.AccAddress

Accs gets the sdk.AccAddress versions of the signers. Conversion happens if it hasn't already been done yet. Any strings that fail to convert are simply ignored.

func (*SignersWrapper) Strings added in v1.15.0

func (s *SignersWrapper) Strings() []string

Strings gets the string versions of the signers.

Jump to

Keyboard shortcuts

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