Documentation
¶
Index ¶
- Constants
- Variables
- func AppendSelfInitiatedIncomingApproval(currApprovals []*types.UserIncomingApproval, userAddress string) []*types.UserIncomingApproval
- func AppendSelfInitiatedOutgoingApproval(currApprovals []*types.UserOutgoingApproval, userAddress string) []*types.UserOutgoingApproval
- func CheckMerklePath(leaf string, expectedRoot string, aunts []*types.MerklePathItem) error
- func CheckNotForbidden(ctx sdk.Context, permission *types.UniversalPermissionDetails, ...) error
- func CheckNotForbiddenForAllOverlaps(ctx sdk.Context, castedPermissions []*types.UniversalPermission, ...) error
- func ConstructAddressListKey(addressListId string) string
- func ConstructApprovalTrackerKey(collectionID sdkmath.Uint, ...) string
- func ConstructBalanceKey(address string, id sdkmath.Uint) string
- func ConstructUsedClaimChallengeKey(collectionId sdkmath.Uint, addressForChallenge string, approvalLevel string, ...) string
- func ConstructUsedClaimDataKey(collectionId sdkmath.Uint, claimId sdkmath.Uint) string
- func GetDefaultBalanceStoreForCollection(collection *types.BadgeCollection) *types.UserBalanceStore
- func GetFirstMatchOnlyWithApprovalCriteria(ctx sdk.Context, permissions []*types.UniversalPermission) []*types.UniversalPermissionDetails
- func GetLeafIndex(aunts []*types.MerklePathItem) sdkmath.Uint
- func GetPotentialUpdatesForTimelineValues(ctx sdk.Context, times [][]*types.UintRange, values []interface{}) []*types.UniversalPermissionDetails
- func GetUpdateCombinationsToCheck(ctx sdk.Context, firstMatchesForOld []*types.UniversalPermissionDetails, ...) ([]*types.UniversalPermissionDetails, error)
- func GetUpdateStringArrayCombinations(ctx sdk.Context, oldValue interface{}, newValue interface{}) ([]*types.UniversalPermissionDetails, error)
- func GetUpdatedBoolCombinations(ctx sdk.Context, oldValue interface{}, newValue interface{}) ([]*types.UniversalPermissionDetails, error)
- func GetUpdatedCollectionMetadataCombinations(ctx sdk.Context, oldValue interface{}, newValue interface{}) ([]*types.UniversalPermissionDetails, error)
- func GetUpdatedOffChainBalancesMetadataCombinations(ctx sdk.Context, oldValue interface{}, newValue interface{}) ([]*types.UniversalPermissionDetails, error)
- func GetUpdatedStringCombinations(ctx sdk.Context, oldValue interface{}, newValue interface{}) ([]*types.UniversalPermissionDetails, error)
- func IsNonIndexedBalances(collection *types.BadgeCollection) bool
- func IsNonPublicBalances(collection *types.BadgeCollection) bool
- func IsOffChainBalances(collection *types.BadgeCollection) bool
- func IsStandardBalances(collection *types.BadgeCollection) bool
- func NewMsgServerImpl(keeper Keeper) types.MsgServer
- func SortViaPrioritizedApprovals(_approvals []*types.CollectionApproval, transfer *types.Transfer, ...) []*types.CollectionApproval
- type ApprovalCriteriaWithIsApproved
- type BalanceKeyDetails
- type Keeper
- func (k Keeper) CastActionPermissionToUniversalPermission(actionPermission []*types.ActionPermission) ([]*types.UniversalPermission, error)
- func (k Keeper) CastBadgeIdsActionPermissionToUniversalPermission(BadgeIdsActionPermission []*types.BadgeIdsActionPermission) ([]*types.UniversalPermission, error)
- func (k Keeper) CastBadgeMetadataToUniversalPermission(badgeMetadata []*types.BadgeMetadata) []*types.UniversalPermission
- func (k Keeper) CastCollectionApprovalPermissionToUniversalPermission(ctx sdk.Context, ...) ([]*types.UniversalPermission, error)
- func (k Keeper) CastCollectionApprovalToUniversalPermission(ctx sdk.Context, approvals []*types.CollectionApproval) ([]*types.UniversalPermission, error)
- func (k Keeper) CastTimedUpdatePermissionToUniversalPermission(timedUpdatePermission []*types.TimedUpdatePermission) ([]*types.UniversalPermission, error)
- func (k Keeper) CastTimedUpdateWithBadgeIdsPermissionToUniversalPermission(timedUpdateWithBadgeIdsPermission []*types.TimedUpdateWithBadgeIdsPermission) ([]*types.UniversalPermission, error)
- func (k Keeper) CastUserIncomingApprovalPermissionToUniversalPermission(ctx sdk.Context, permissions []*types.UserIncomingApprovalPermission) ([]*types.UniversalPermission, error)
- func (k Keeper) CastUserOutgoingApprovalPermissionToUniversalPermission(ctx sdk.Context, permissions []*types.UserOutgoingApprovalPermission) ([]*types.UniversalPermission, error)
- func (k Keeper) CheckAddresses(ctx sdk.Context, addressListId string, addressToCheck string) (bool, error)
- func (k Keeper) CheckIfActionPermissionPermits(ctx sdk.Context, permissions []*types.ActionPermission, permissionStr string) error
- func (k Keeper) CheckIfAddressesMatchCollectionListIds(ctx sdk.Context, collectionApproval *types.CollectionApproval, from string, ...) bool
- func (k Keeper) CheckIfBadgeIdsActionPermissionPermits(ctx sdk.Context, detailsToCheck []*types.UniversalPermissionDetails, ...) error
- func (k Keeper) CheckIfCollectionApprovalPermissionPermits(ctx sdk.Context, detailsToCheck []*types.UniversalPermissionDetails, ...) error
- func (k Keeper) CheckIfTimedUpdatePermissionPermits(ctx sdk.Context, detailsToCheck []*types.UniversalPermissionDetails, ...) error
- func (k Keeper) CheckIfTimedUpdateWithBadgeIdsPermissionPermits(ctx sdk.Context, detailsToCheck []*types.UniversalPermissionDetails, ...) error
- func (k Keeper) CheckIfUserIncomingApprovalPermissionPermits(ctx sdk.Context, detailsToCheck []*types.UniversalPermissionDetails, ...) error
- func (k Keeper) CheckIfUserOutgoingApprovalPermissionPermits(ctx sdk.Context, detailsToCheck []*types.UniversalPermissionDetails, ...) error
- func (k Keeper) CreateAddressList(ctx sdk.Context, addressList *types.AddressList) error
- func (k Keeper) CreateBadges(ctx sdk.Context, collection *types.BadgeCollection, ...) (*types.BadgeCollection, error)
- func (k Keeper) DeductAndGetUserApprovals(ctx sdk.Context, collection *types.BadgeCollection, ...) ([]*UserApprovalsToCheck, error)
- func (k Keeper) DeductCollectionApprovalsAndGetUserApprovalsToCheck(ctx sdk.Context, collection *types.BadgeCollection, transfer *types.Transfer, ...) ([]*UserApprovalsToCheck, error)
- func (k Keeper) DeductUserIncomingApprovals(ctx sdk.Context, collection *types.BadgeCollection, ...) error
- func (k Keeper) DeductUserOutgoingApprovals(ctx sdk.Context, collection *types.BadgeCollection, ...) error
- func (k Keeper) DeleteAddressListFromStore(ctx sdk.Context, addressListId string)
- func (k Keeper) DeleteApprovalTrackerFromStore(ctx sdk.Context, collectionId sdkmath.Uint, addressForApproval string, ...)
- func (k Keeper) DeleteCollectionFromStore(ctx sdk.Context, collectionId sdkmath.Uint)
- func (k Keeper) DeleteUserBalanceFromStore(ctx sdk.Context, balanceKey string)
- func (k Keeper) GetAddressList(goCtx context.Context, req *types.QueryGetAddressListRequest) (*types.QueryGetAddressListResponse, error)
- func (k Keeper) GetAddressListById(ctx sdk.Context, addressListId string) (*types.AddressList, error)
- func (k Keeper) GetAddressListFromStore(ctx sdk.Context, addressListId string) (types.AddressList, bool)
- func (k Keeper) GetAddressListsFromStore(ctx sdk.Context) (addressLists []*types.AddressList)
- func (k Keeper) GetApprovalTracker(goCtx context.Context, req *types.QueryGetApprovalTrackerRequest) (*types.QueryGetApprovalTrackerResponse, error)
- func (k Keeper) GetApprovalTrackerFromStore(ctx sdk.Context, collectionId sdkmath.Uint, addressForApproval string, ...) (types.ApprovalTracker, bool)
- func (k Keeper) GetApprovalTrackersFromStore(ctx sdk.Context) (approvalTrackers []*types.ApprovalTracker, ids []string)
- func (k Keeper) GetAuthority() string
- func (k Keeper) GetBalance(goCtx context.Context, req *types.QueryGetBalanceRequest) (*types.QueryGetBalanceResponse, error)
- func (k Keeper) GetBalanceOrApplyDefault(ctx sdk.Context, collection *types.BadgeCollection, userAddress string) *types.UserBalanceStore
- func (k Keeper) GetChallengeTracker(goCtx context.Context, req *types.QueryGetChallengeTrackerRequest) (*types.QueryGetChallengeTrackerResponse, error)
- func (k Keeper) GetChallengeTrackerFromStore(ctx sdk.Context, collectionId sdkmath.Uint, addressForChallenge string, ...) (sdkmath.Uint, error)
- func (k Keeper) GetChallengeTrackersFromStore(ctx sdk.Context) (numUsed []sdkmath.Uint, ids []string)
- func (k Keeper) GetCollection(goCtx context.Context, req *types.QueryGetCollectionRequest) (*types.QueryGetCollectionResponse, error)
- func (k Keeper) GetCollectionFromStore(ctx sdk.Context, collectionId sdkmath.Uint) (*types.BadgeCollection, bool)
- func (k Keeper) GetCollectionsFromStore(ctx sdk.Context) (collections []*types.BadgeCollection)
- func (k Keeper) GetDetailsToCheck(ctx sdk.Context, collection *types.BadgeCollection, ...) ([]*types.UniversalPermissionDetails, error)
- func (k Keeper) GetMaxPossible(ctx sdk.Context, collection *types.BadgeCollection, ...) ([]*types.Balance, error)
- func (k Keeper) GetNextAddressListCounter(ctx sdk.Context) sdkmath.Uint
- func (k Keeper) GetNextCollectionId(ctx sdk.Context) sdkmath.Uint
- func (k Keeper) GetParams(ctx context.Context) (params types.Params)
- func (k Keeper) GetPredeterminedBalancesForPrecalculationId(ctx sdk.Context, collection *types.BadgeCollection, ...) ([]*types.Balance, error)
- func (k Keeper) GetTrackerListById(ctx sdk.Context, trackerListId string) (*types.AddressList, error)
- func (k Keeper) GetUserBalanceFromStore(ctx sdk.Context, balanceKey string) (*types.UserBalanceStore, bool)
- func (k Keeper) GetUserBalanceIdsFromStore(ctx sdk.Context) (ids []string)
- func (k Keeper) GetUserBalancesFromStore(ctx sdk.Context) (balances []*types.UserBalanceStore, addresses []string, ids []sdkmath.Uint)
- func (k Keeper) HandleCoinTransfers(ctx sdk.Context, coinTransfers []*types.CoinTransfer, initiatedBy string, ...) error
- func (k Keeper) HandleMerkleChallenges(ctx sdk.Context, collectionId sdkmath.Uint, transfer *types.Transfer, ...) (sdkmath.Uint, error)
- func (k Keeper) HandleTransfer(ctx sdk.Context, collection *types.BadgeCollection, transfer *types.Transfer, ...) (*types.UserBalanceStore, *types.UserBalanceStore, error)
- func (k Keeper) HandleTransfers(ctx sdk.Context, collection *types.BadgeCollection, ...) error
- func (k Keeper) IncrementApprovalsAndAssertWithinThreshold(ctx sdk.Context, collection *types.BadgeCollection, ...) error
- func (k Keeper) IncrementChallengeTrackerInStore(ctx sdk.Context, collectionId sdkmath.Uint, addressForChallenge string, ...) (sdkmath.Uint, error)
- func (k Keeper) IncrementNextAddressListCounter(ctx sdk.Context)
- func (k Keeper) IncrementNextCollectionId(ctx sdk.Context)
- func (k Keeper) Logger() log.Logger
- func (k Keeper) Params(c context.Context, req *types.QueryParamsRequest) (*types.QueryParamsResponse, error)
- func (k Keeper) SetAddressListInStore(ctx sdk.Context, addressList types.AddressList) error
- func (k Keeper) SetApprovalTrackerInStore(ctx sdk.Context, collectionId sdkmath.Uint, addressForApproval string, ...) error
- func (k Keeper) SetApprovalTrackerInStoreViaKey(ctx sdk.Context, key string, approvalTracker types.ApprovalTracker) error
- func (k Keeper) SetBalanceForAddress(ctx sdk.Context, collection *types.BadgeCollection, userAddress string, ...) error
- func (k Keeper) SetChallengeTrackerInStore(ctx sdk.Context, key string, numUsed sdkmath.Uint) error
- func (k Keeper) SetCollectionInStore(ctx sdk.Context, collection *types.BadgeCollection) error
- func (k Keeper) SetNextAddressListCounter(ctx sdk.Context, nextID sdkmath.Uint)
- func (k Keeper) SetNextCollectionId(ctx sdk.Context, nextID sdkmath.Uint)
- func (k Keeper) SetParams(ctx context.Context, params types.Params) error
- func (k Keeper) SetUserBalanceInStore(ctx sdk.Context, balanceKey string, UserBalance *types.UserBalanceStore) error
- func (k Keeper) StoreHasAddressList(ctx sdk.Context, addressListId string) bool
- func (k Keeper) StoreHasApprovalTracker(ctx sdk.Context, collectionId sdkmath.Uint, addressForApproval string, ...) bool
- func (k Keeper) StoreHasCollectionID(ctx sdk.Context, collectionId sdkmath.Uint) bool
- func (k Keeper) StoreHasUserBalance(ctx sdk.Context, balanceKey string) bool
- func (k Keeper) UniversalValidate(ctx sdk.Context, collection *types.BadgeCollection, ...) error
- func (k Keeper) ValidateActionPermissionUpdate(ctx sdk.Context, oldPermissions []*types.ActionPermission, ...) error
- func (k Keeper) ValidateBadgeIdsActionPermissionUpdate(ctx sdk.Context, oldPermissions []*types.BadgeIdsActionPermission, ...) error
- func (k Keeper) ValidateBadgeMetadataUpdate(ctx sdk.Context, oldBadgeMetadata []*types.BadgeMetadataTimeline, ...) error
- func (k Keeper) ValidateCollectionApprovalPermissionsUpdate(ctx sdk.Context, oldPermissions []*types.CollectionApprovalPermission, ...) error
- func (k Keeper) ValidateCollectionApprovalsUpdate(ctx sdk.Context, collection *types.BadgeCollection, ...) error
- func (k Keeper) ValidateCollectionMetadataUpdate(ctx sdk.Context, oldCollectionMetadata []*types.CollectionMetadataTimeline, ...) error
- func (k Keeper) ValidateCustomDataUpdate(ctx sdk.Context, oldCustomData []*types.CustomDataTimeline, ...) error
- func (k Keeper) ValidateIsArchivedUpdate(ctx sdk.Context, oldIsArchived []*types.IsArchivedTimeline, ...) error
- func (k Keeper) ValidateManagerUpdate(ctx sdk.Context, oldManager []*types.ManagerTimeline, ...) error
- func (k Keeper) ValidateOffChainBalancesMetadataUpdate(ctx sdk.Context, collection *types.BadgeCollection, ...) error
- func (k Keeper) ValidatePermissionsUpdate(ctx sdk.Context, oldPermissions *types.CollectionPermissions, ...) error
- func (k Keeper) ValidateStandardsUpdate(ctx sdk.Context, oldStandards []*types.StandardsTimeline, ...) error
- func (k Keeper) ValidateTimedUpdatePermissionUpdate(ctx sdk.Context, oldPermissions []*types.TimedUpdatePermission, ...) error
- func (k Keeper) ValidateTimedUpdateWithBadgeIdsPermissionUpdate(ctx sdk.Context, oldPermissions []*types.TimedUpdateWithBadgeIdsPermission, ...) error
- func (k Keeper) ValidateUserIncomingApprovalPermissionsUpdate(ctx sdk.Context, oldPermissions []*types.UserIncomingApprovalPermission, ...) error
- func (k Keeper) ValidateUserIncomingApprovalsUpdate(ctx sdk.Context, collection *types.BadgeCollection, ...) error
- func (k Keeper) ValidateUserOutgoingApprovalPermissionsUpdate(ctx sdk.Context, oldPermissions []*types.UserOutgoingApprovalPermission, ...) error
- func (k Keeper) ValidateUserOutgoingApprovalsUpdate(ctx sdk.Context, collection *types.BadgeCollection, ...) error
- func (k Keeper) ValidateUserPermissionsUpdate(ctx sdk.Context, oldPermissions *types.UserPermissions, ...) error
- type UniversalValidationParams
- type UserApprovalsToCheck
Constants ¶
const StoreKey = types.ModuleName
StoreKey is the store key string for nft
Variables ¶
var ( ErrCollectionNotExists = sdkerrors.Register(types.ModuleName, 4, "collection does not exist") ErrForbiddenTime = sdkerrors.Register(types.ModuleName, 5, "this permission is forbidden at this time") ErrUserBalanceNotExists = sdkerrors.Register(types.ModuleName, 8, "user balance is empty or does not exist") ErrSupplyEqualsZero = sdkerrors.Register(types.ModuleName, 13, "can't create a badge with zero supply") ErrSenderIsNotManager = sdkerrors.Register(types.ModuleName, 14, "sender of tx is not the manager of the badge. must be manager to access this privilege") ErrAccountCanNotEqualCreator = sdkerrors.Register(types.ModuleName, 35, "account can not equal creator") ErrRootHashInvalid = sdkerrors.Register(types.ModuleName, 49, "root hash invalid") ErrDecodingHexString = sdkerrors.Register(types.ModuleName, 53, "couldn't decode hex string") ErrWrongBalancesType = sdkerrors.Register(types.ModuleName, 64, "wrong balances type ") ErrCollectionIsArchived = sdkerrors.Register(types.ModuleName, 67, "collection is currently archived (read-only)") ErrNotImplemented = sdkerrors.Register(types.ModuleName, 69, "not implemented") ErrInadequateApprovals = sdkerrors.Register(types.ModuleName, 71, "inadequate approvals") ErrInvalidAddressListId = sdkerrors.Register(types.ModuleName, 72, "invalid address list id") ErrAddressListNotFound = sdkerrors.Register(types.ModuleName, 73, "address list not found") ErrCircularDependency = sdkerrors.Register(types.ModuleName, 75, "circular dependency") ErrDisallowedTransfer = sdkerrors.Register(types.ModuleName, 76, "disallowed transfer") ErrNoValidSolutionForChallenge = sdkerrors.Register(types.ModuleName, 77, "challenge failed") ErrExceedsThreshold = sdkerrors.Register(types.ModuleName, 78, "exceeds threshold") ErrCircularInheritance = sdkerrors.Register(types.ModuleName, 79, "circular inheritance") ErrAddressListAlreadyExists = sdkerrors.Register(types.ModuleName, 80, "address list already exists") ErrGlobalArchive = sdkerrors.Register(types.ModuleName, 81, "global halt is active") ErrNoMatchingChallengeForChallengeTrackerId = sdkerrors.Register(types.ModuleName, 82, "no matching challenge for challenge tracker id") )
var ( CollectionKey = []byte{0x01} UserBalanceKey = []byte{0x02} NextCollectionIdKey = []byte{0x03} UsedClaimChallengeKey = []byte{0x04} AddressListKey = []byte{0x06} ApprovalTrackerKey = []byte{0x07} AccountGenerationPrefix = []byte{0x08} AddressGenerationPrefix = []byte{0x09} NextAddressListIdKey = []byte{0x0A} Delimiter = []byte{0xDD} Placeholder = []byte{0xFF} IDLength = 8 BalanceKeyDelimiter = "-" )
Functions ¶
func AppendSelfInitiatedIncomingApproval ¶
func AppendSelfInitiatedIncomingApproval(currApprovals []*types.UserIncomingApproval, userAddress string) []*types.UserIncomingApproval
func AppendSelfInitiatedOutgoingApproval ¶
func AppendSelfInitiatedOutgoingApproval(currApprovals []*types.UserOutgoingApproval, userAddress string) []*types.UserOutgoingApproval
By default, we approve all transfers if from === initiatedBy
func CheckMerklePath ¶
func CheckMerklePath(leaf string, expectedRoot string, aunts []*types.MerklePathItem) error
func CheckNotForbidden ¶
func CheckNotForbiddenForAllOverlaps ¶
func CheckNotForbiddenForAllOverlaps(ctx sdk.Context, castedPermissions []*types.UniversalPermission, detailsToCheck []*types.UniversalPermissionDetails, permissionStr string) error
func ConstructAddressListKey ¶
func ConstructBalanceKey ¶
Creates the balance key from an address and collectionId. Note this is not prefixed yet. It is just performing a delimited string concatenation.
func ConstructUsedClaimDataKey ¶
Creates the used claim data key from an id and data. Note this is not prefixed yet. It is just performing a delimited string concatenation.
func GetDefaultBalanceStoreForCollection ¶
func GetDefaultBalanceStoreForCollection(collection *types.BadgeCollection) *types.UserBalanceStore
func GetFirstMatchOnlyWithApprovalCriteria ¶
func GetFirstMatchOnlyWithApprovalCriteria(ctx sdk.Context, permissions []*types.UniversalPermission) []*types.UniversalPermissionDetails
func GetLeafIndex ¶
func GetLeafIndex(aunts []*types.MerklePathItem) sdkmath.Uint
func GetPotentialUpdatesForTimelineValues ¶
func GetPotentialUpdatesForTimelineValues(ctx sdk.Context, times [][]*types.UintRange, values []interface{}) []*types.UniversalPermissionDetails
To make it easier, we first
func GetUpdateCombinationsToCheck ¶
func GetUpdateCombinationsToCheck( ctx sdk.Context, firstMatchesForOld []*types.UniversalPermissionDetails, firstMatchesForNew []*types.UniversalPermissionDetails, emptyValue interface{}, compareAndGetUpdateCombosToCheck func(ctx sdk.Context, oldValue interface{}, newValue interface{}) ([]*types.UniversalPermissionDetails, error), ) ([]*types.UniversalPermissionDetails, error)
Precondition: Assumes that all passed-in matches have .ArbitraryValue set
This is a generic function that is used to get the "updated" field combinations Ex: If we go from [badgeIDs 1 to 10 -> www.example.com] to [badgeIDs 1 to 2 -> www.example2.com, badgeIDs 3 to 10 -> www.example.com]
This will return a UniversalPermissionDetails with badgeIDs 1 to 2 because they changed and are the ones we need to check ¶
Note that updates are field-specific, so the comparison logic is handled via a custom passed-in function - compareAndGetUpdateCombosToCheck
func GetUpdateStringArrayCombinations ¶
func GetUpdateStringArrayCombinations(ctx sdk.Context, oldValue interface{}, newValue interface{}) ([]*types.UniversalPermissionDetails, error)
func GetUpdatedBoolCombinations ¶
func GetUpdatedBoolCombinations(ctx sdk.Context, oldValue interface{}, newValue interface{}) ([]*types.UniversalPermissionDetails, error)
func GetUpdatedCollectionMetadataCombinations ¶
func GetUpdatedCollectionMetadataCombinations(ctx sdk.Context, oldValue interface{}, newValue interface{}) ([]*types.UniversalPermissionDetails, error)
func GetUpdatedOffChainBalancesMetadataCombinations ¶
func GetUpdatedOffChainBalancesMetadataCombinations(ctx sdk.Context, oldValue interface{}, newValue interface{}) ([]*types.UniversalPermissionDetails, error)
func GetUpdatedStringCombinations ¶
func GetUpdatedStringCombinations(ctx sdk.Context, oldValue interface{}, newValue interface{}) ([]*types.UniversalPermissionDetails, error)
func IsNonIndexedBalances ¶
func IsNonIndexedBalances(collection *types.BadgeCollection) bool
func IsNonPublicBalances ¶
func IsNonPublicBalances(collection *types.BadgeCollection) bool
func IsOffChainBalances ¶
func IsOffChainBalances(collection *types.BadgeCollection) bool
func IsStandardBalances ¶
func IsStandardBalances(collection *types.BadgeCollection) bool
func NewMsgServerImpl ¶
NewMsgServerImpl returns an implementation of the MsgServer interface for the provided Keeper.
func SortViaPrioritizedApprovals ¶
func SortViaPrioritizedApprovals(_approvals []*types.CollectionApproval, transfer *types.Transfer, approvalLevel string, approverAddress string) []*types.CollectionApproval
Types ¶
type ApprovalCriteriaWithIsApproved ¶
type ApprovalCriteriaWithIsApproved struct {
ApprovalCriteria *types.ApprovalCriteria
}
Make a struct with a bool flag isApproved and an approval details arr
type BalanceKeyDetails ¶
type BalanceKeyDetails struct {
// contains filtered or unexported fields
}
func GetDetailsFromBalanceKey ¶
func GetDetailsFromBalanceKey(id string) BalanceKeyDetails
Helper function to unparse a balance key and get the information from it.
type Keeper ¶
type Keeper struct {
// contains filtered or unexported fields
}
func NewKeeper ¶
func NewKeeper( cdc codec.BinaryCodec, storeService store.KVStoreService, logger log.Logger, authority string, bankKeeper types.BankKeeper, ) Keeper
func (Keeper) CastActionPermissionToUniversalPermission ¶
func (k Keeper) CastActionPermissionToUniversalPermission(actionPermission []*types.ActionPermission) ([]*types.UniversalPermission, error)
func (Keeper) CastBadgeIdsActionPermissionToUniversalPermission ¶
func (k Keeper) CastBadgeIdsActionPermissionToUniversalPermission(BadgeIdsActionPermission []*types.BadgeIdsActionPermission) ([]*types.UniversalPermission, error)
func (Keeper) CastBadgeMetadataToUniversalPermission ¶
func (k Keeper) CastBadgeMetadataToUniversalPermission(badgeMetadata []*types.BadgeMetadata) []*types.UniversalPermission
func (Keeper) CastCollectionApprovalPermissionToUniversalPermission ¶
func (k Keeper) CastCollectionApprovalPermissionToUniversalPermission(ctx sdk.Context, collectionUpdatePermission []*types.CollectionApprovalPermission) ([]*types.UniversalPermission, error)
func (Keeper) CastCollectionApprovalToUniversalPermission ¶
func (k Keeper) CastCollectionApprovalToUniversalPermission(ctx sdk.Context, approvals []*types.CollectionApproval) ([]*types.UniversalPermission, error)
func (Keeper) CastTimedUpdatePermissionToUniversalPermission ¶
func (k Keeper) CastTimedUpdatePermissionToUniversalPermission(timedUpdatePermission []*types.TimedUpdatePermission) ([]*types.UniversalPermission, error)
func (Keeper) CastTimedUpdateWithBadgeIdsPermissionToUniversalPermission ¶
func (k Keeper) CastTimedUpdateWithBadgeIdsPermissionToUniversalPermission(timedUpdateWithBadgeIdsPermission []*types.TimedUpdateWithBadgeIdsPermission) ([]*types.UniversalPermission, error)
func (Keeper) CastUserIncomingApprovalPermissionToUniversalPermission ¶
func (k Keeper) CastUserIncomingApprovalPermissionToUniversalPermission(ctx sdk.Context, permissions []*types.UserIncomingApprovalPermission) ([]*types.UniversalPermission, error)
func (Keeper) CastUserOutgoingApprovalPermissionToUniversalPermission ¶
func (k Keeper) CastUserOutgoingApprovalPermissionToUniversalPermission(ctx sdk.Context, permissions []*types.UserOutgoingApprovalPermission) ([]*types.UniversalPermission, error)
func (Keeper) CheckAddresses ¶
func (Keeper) CheckIfActionPermissionPermits ¶
func (Keeper) CheckIfAddressesMatchCollectionListIds ¶
func (k Keeper) CheckIfAddressesMatchCollectionListIds(ctx sdk.Context, collectionApproval *types.CollectionApproval, from string, to string, initiatedBy string) bool
Checks if the addresses in the (to, from, initiatedBy) are approved
func (Keeper) CheckIfBadgeIdsActionPermissionPermits ¶
func (k Keeper) CheckIfBadgeIdsActionPermissionPermits(ctx sdk.Context, detailsToCheck []*types.UniversalPermissionDetails, permissions []*types.BadgeIdsActionPermission, permissionStr string) error
func (Keeper) CheckIfCollectionApprovalPermissionPermits ¶
func (k Keeper) CheckIfCollectionApprovalPermissionPermits(ctx sdk.Context, detailsToCheck []*types.UniversalPermissionDetails, permissions []*types.CollectionApprovalPermission, permissionStr string) error
func (Keeper) CheckIfTimedUpdatePermissionPermits ¶
func (k Keeper) CheckIfTimedUpdatePermissionPermits(ctx sdk.Context, detailsToCheck []*types.UniversalPermissionDetails, permissions []*types.TimedUpdatePermission, permissionStr string) error
func (Keeper) CheckIfTimedUpdateWithBadgeIdsPermissionPermits ¶
func (k Keeper) CheckIfTimedUpdateWithBadgeIdsPermissionPermits(ctx sdk.Context, detailsToCheck []*types.UniversalPermissionDetails, permissions []*types.TimedUpdateWithBadgeIdsPermission, permissionStr string) error
func (Keeper) CheckIfUserIncomingApprovalPermissionPermits ¶
func (k Keeper) CheckIfUserIncomingApprovalPermissionPermits(ctx sdk.Context, detailsToCheck []*types.UniversalPermissionDetails, permissions []*types.UserIncomingApprovalPermission, permissionStr string) error
func (Keeper) CheckIfUserOutgoingApprovalPermissionPermits ¶
func (k Keeper) CheckIfUserOutgoingApprovalPermissionPermits(ctx sdk.Context, detailsToCheck []*types.UniversalPermissionDetails, permissions []*types.UserOutgoingApprovalPermission, permissionStr string) error
func (Keeper) CreateAddressList ¶
func (Keeper) CreateBadges ¶
func (k Keeper) CreateBadges(ctx sdk.Context, collection *types.BadgeCollection, newBadgeIdsToAdd []*types.UintRange) (*types.BadgeCollection, error)
Create badges and update the unminted / total supplys for the collection
func (Keeper) DeductAndGetUserApprovals ¶
func (k Keeper) DeductAndGetUserApprovals( ctx sdk.Context, collection *types.BadgeCollection, originalTransferBalances []*types.Balance, transfer *types.Transfer, _approvals []*types.CollectionApproval, toAddress string, initiatedBy string, approvalLevel string, approverAddress string, ) ([]*UserApprovalsToCheck, error)
All in one approval deduction function. We also return the user approvals to check (only used when collection approvals)
func (Keeper) DeductCollectionApprovalsAndGetUserApprovalsToCheck ¶
func (k Keeper) DeductCollectionApprovalsAndGetUserApprovalsToCheck( ctx sdk.Context, collection *types.BadgeCollection, transfer *types.Transfer, toAddress string, initiatedBy string, ) ([]*UserApprovalsToCheck, error)
DeductCollectionApprovalsAndGetUserApprovalsToCheck will check if the current transfer is allowed via the collection's approved transfers and handle any tallying accordingly
func (Keeper) DeductUserIncomingApprovals ¶
func (k Keeper) DeductUserIncomingApprovals( ctx sdk.Context, collection *types.BadgeCollection, originalTransferBalances []*types.Balance, transfer *types.Transfer, to string, initiatedBy string, userBalance *types.UserBalanceStore, ) error
DeductUserIncomingApprovals will check if the current transfer is approved from the to's outgoing approvals and handle the approval tallying accordingly
func (Keeper) DeductUserOutgoingApprovals ¶
func (k Keeper) DeductUserOutgoingApprovals( ctx sdk.Context, collection *types.BadgeCollection, originalTransferBalances []*types.Balance, transfer *types.Transfer, from string, to string, requester string, userBalance *types.UserBalanceStore, ) error
DeductUserOutgoingApprovals will check if the current transfer is approved from the from's outgoing approvals and handle the approval tallying accordingly
func (Keeper) DeleteAddressListFromStore ¶
func (Keeper) DeleteApprovalTrackerFromStore ¶
func (Keeper) DeleteCollectionFromStore ¶
DeleteCollectionFromStore deletes a badge from the store.
func (Keeper) DeleteUserBalanceFromStore ¶
DeleteUserBalanceFromStore deletes a user balance from the store.
func (Keeper) GetAddressList ¶
func (k Keeper) GetAddressList(goCtx context.Context, req *types.QueryGetAddressListRequest) (*types.QueryGetAddressListResponse, error)
Queries a balance for the given address and badgeId and returns its contents.
func (Keeper) GetAddressListById ¶
func (Keeper) GetAddressListFromStore ¶
func (Keeper) GetAddressListsFromStore ¶
func (k Keeper) GetAddressListsFromStore(ctx sdk.Context) (addressLists []*types.AddressList)
func (Keeper) GetApprovalTracker ¶
func (k Keeper) GetApprovalTracker(goCtx context.Context, req *types.QueryGetApprovalTrackerRequest) (*types.QueryGetApprovalTrackerResponse, error)
Queries a balance for the given address and badgeId and returns its contents.
func (Keeper) GetApprovalTrackerFromStore ¶
func (Keeper) GetApprovalTrackersFromStore ¶
func (Keeper) GetAuthority ¶
GetAuthority returns the module's authority.
func (Keeper) GetBalance ¶
func (k Keeper) GetBalance(goCtx context.Context, req *types.QueryGetBalanceRequest) (*types.QueryGetBalanceResponse, error)
Queries a balance for the given address and badgeId and returns its contents.
func (Keeper) GetBalanceOrApplyDefault ¶
func (k Keeper) GetBalanceOrApplyDefault(ctx sdk.Context, collection *types.BadgeCollection, userAddress string) *types.UserBalanceStore
func (Keeper) GetChallengeTracker ¶
func (k Keeper) GetChallengeTracker(goCtx context.Context, req *types.QueryGetChallengeTrackerRequest) (*types.QueryGetChallengeTrackerResponse, error)
Queries how many times a leaf has been used for a challenge
func (Keeper) GetChallengeTrackerFromStore ¶
func (Keeper) GetChallengeTrackersFromStore ¶
func (Keeper) GetCollection ¶
func (k Keeper) GetCollection(goCtx context.Context, req *types.QueryGetCollectionRequest) (*types.QueryGetCollectionResponse, error)
Queries a collection by its ID and returns its contents.
func (Keeper) GetCollectionFromStore ¶
func (k Keeper) GetCollectionFromStore(ctx sdk.Context, collectionId sdkmath.Uint) (*types.BadgeCollection, bool)
Gets a badge from the store according to the collectionId.
func (Keeper) GetCollectionsFromStore ¶
func (k Keeper) GetCollectionsFromStore(ctx sdk.Context) (collections []*types.BadgeCollection)
GetCollectionsFromStore defines a method for returning all badges information by key.
func (Keeper) GetDetailsToCheck ¶
func (k Keeper) GetDetailsToCheck(ctx sdk.Context, collection *types.BadgeCollection, oldApprovals []*types.CollectionApproval, newApprovals []*types.CollectionApproval) ([]*types.UniversalPermissionDetails, error)
func (Keeper) GetMaxPossible ¶
func (k Keeper) GetMaxPossible( ctx sdk.Context, collection *types.BadgeCollection, approval *types.CollectionApproval, transfer *types.Transfer, originalTransferBalances []*types.Balance, approvedAmount sdkmath.Uint, challengeNumIncrements sdkmath.Uint, approverAddress string, approvalLevel string, trackerType string, address string, simulate bool, ) ([]*types.Balance, error)
GetMaxPossible calculates the maximum possible transfer amounts based on approval criteria
func (Keeper) GetNextAddressListCounter ¶
Gets the next collection ID.
func (Keeper) GetNextCollectionId ¶
Gets the next collection ID.
func (Keeper) GetPredeterminedBalancesForPrecalculationId ¶
func (Keeper) GetTrackerListById ¶
func (Keeper) GetUserBalanceFromStore ¶
func (k Keeper) GetUserBalanceFromStore(ctx sdk.Context, balanceKey string) (*types.UserBalanceStore, bool)
Gets a user balance from the store according to the balanceID.
func (Keeper) GetUserBalanceIdsFromStore ¶
GetUserBalanceIdsFromStore defines a method for returning all keys of all user balances.
func (Keeper) GetUserBalancesFromStore ¶
func (k Keeper) GetUserBalancesFromStore(ctx sdk.Context) (balances []*types.UserBalanceStore, addresses []string, ids []sdkmath.Uint)
GetUserBalancesFromStore defines a method for returning all user balances information by key.
func (Keeper) HandleCoinTransfers ¶
func (Keeper) HandleMerkleChallenges ¶
func (Keeper) HandleTransfer ¶
func (k Keeper) HandleTransfer( ctx sdk.Context, collection *types.BadgeCollection, transfer *types.Transfer, fromUserBalance *types.UserBalanceStore, toUserBalance *types.UserBalanceStore, from string, to string, initiatedBy string, ) (*types.UserBalanceStore, *types.UserBalanceStore, error)
Step 1: Check if transfer is allowed on collection level (deducting collection approvals if needed). Will return what userApprovals we need to check. Step 2: Check necessary approvals on user level (deducting corresponding approvals if needed) Step 3: If all good, we can transfer the balances
func (Keeper) HandleTransfers ¶
func (Keeper) IncrementApprovalsAndAssertWithinThreshold ¶
func (k Keeper) IncrementApprovalsAndAssertWithinThreshold( ctx sdk.Context, collection *types.BadgeCollection, approval *types.CollectionApproval, originalTransferBalances []*types.Balance, approvedAmount sdkmath.Uint, maxNumTransfers sdkmath.Uint, transferBalances []*types.Balance, challengeNumIncrements sdkmath.Uint, approverAddress string, approvalLevel string, trackerType string, address string, simulate bool, ) error
IncrementApprovalsAndAssertWithinThreshold handles approval tracking and threshold checks
func (Keeper) IncrementChallengeTrackerInStore ¶
func (k Keeper) IncrementChallengeTrackerInStore(ctx sdk.Context, collectionId sdkmath.Uint, addressForChallenge string, approvalLevel string, approvalId, challengeId string, leafIndex sdkmath.Uint) (sdkmath.Uint, error)
****************************************************************************** Sets a usedClaimData in the store using UsedClaimDataKey ([]byte{0x07}) as the prefix. No check if store has key already.
func (Keeper) IncrementNextAddressListCounter ¶
Increments the next collection ID by 1.
func (Keeper) IncrementNextCollectionId ¶
Increments the next collection ID by 1.
func (Keeper) Params ¶
func (k Keeper) Params(c context.Context, req *types.QueryParamsRequest) (*types.QueryParamsResponse, error)
func (Keeper) SetAddressListInStore ¶
func (Keeper) SetApprovalTrackerInStore ¶
func (Keeper) SetApprovalTrackerInStoreViaKey ¶
func (Keeper) SetBalanceForAddress ¶
func (k Keeper) SetBalanceForAddress(ctx sdk.Context, collection *types.BadgeCollection, userAddress string, balance *types.UserBalanceStore) error
func (Keeper) SetChallengeTrackerInStore ¶
func (Keeper) SetCollectionInStore ¶
Sets a badge in the store using BadgeKey ([]byte{0x01}) as the prefix. No check if store has key already.
func (Keeper) SetNextAddressListCounter ¶
Sets the next asset ID. Should only be used in InitGenesis. Everything else should call IncrementNextAssetID()
func (Keeper) SetNextCollectionId ¶
Sets the next asset ID. Should only be used in InitGenesis. Everything else should call IncrementNextAssetID()
func (Keeper) SetUserBalanceInStore ¶
func (k Keeper) SetUserBalanceInStore(ctx sdk.Context, balanceKey string, UserBalance *types.UserBalanceStore) error
Sets a user balance in the store using UserBalanceKey ([]byte{0x02}) as the prefix. No check if store has key already.
func (Keeper) StoreHasAddressList ¶
func (Keeper) StoreHasApprovalTracker ¶
func (Keeper) StoreHasCollectionID ¶
StoreHasCollectionID determines whether the specified collectionId exists
func (Keeper) StoreHasUserBalance ¶
StoreHasUserBalanceID determines whether the specified user balanceID exists in the store
func (Keeper) UniversalValidate ¶
func (k Keeper) UniversalValidate(ctx sdk.Context, collection *types.BadgeCollection, params UniversalValidationParams) error
Validates everything about the Msg is valid and returns (creatorNum, collection, permissions, error).
func (Keeper) ValidateActionPermissionUpdate ¶
func (k Keeper) ValidateActionPermissionUpdate(ctx sdk.Context, oldPermissions []*types.ActionPermission, newPermissions []*types.ActionPermission) error
func (Keeper) ValidateBadgeIdsActionPermissionUpdate ¶
func (k Keeper) ValidateBadgeIdsActionPermissionUpdate(ctx sdk.Context, oldPermissions []*types.BadgeIdsActionPermission, newPermissions []*types.BadgeIdsActionPermission) error
func (Keeper) ValidateBadgeMetadataUpdate ¶
func (k Keeper) ValidateBadgeMetadataUpdate(ctx sdk.Context, oldBadgeMetadata []*types.BadgeMetadataTimeline, newBadgeMetadata []*types.BadgeMetadataTimeline, canUpdateBadgeMetadata []*types.TimedUpdateWithBadgeIdsPermission) error
func (Keeper) ValidateCollectionApprovalPermissionsUpdate ¶
func (k Keeper) ValidateCollectionApprovalPermissionsUpdate(ctx sdk.Context, oldPermissions []*types.CollectionApprovalPermission, newPermissions []*types.CollectionApprovalPermission) error
func (Keeper) ValidateCollectionApprovalsUpdate ¶
func (k Keeper) ValidateCollectionApprovalsUpdate(ctx sdk.Context, collection *types.BadgeCollection, oldApprovals []*types.CollectionApproval, newApprovals []*types.CollectionApproval, CanUpdateCollectionApprovals []*types.CollectionApprovalPermission) error
func (Keeper) ValidateCollectionMetadataUpdate ¶
func (k Keeper) ValidateCollectionMetadataUpdate(ctx sdk.Context, oldCollectionMetadata []*types.CollectionMetadataTimeline, newCollectionMetadata []*types.CollectionMetadataTimeline, canUpdateCollectionMetadata []*types.TimedUpdatePermission) error
func (Keeper) ValidateCustomDataUpdate ¶
func (k Keeper) ValidateCustomDataUpdate(ctx sdk.Context, oldCustomData []*types.CustomDataTimeline, newCustomData []*types.CustomDataTimeline, canUpdateCustomData []*types.TimedUpdatePermission) error
func (Keeper) ValidateIsArchivedUpdate ¶
func (k Keeper) ValidateIsArchivedUpdate(ctx sdk.Context, oldIsArchived []*types.IsArchivedTimeline, newIsArchived []*types.IsArchivedTimeline, canUpdateIsArchived []*types.TimedUpdatePermission) error
func (Keeper) ValidateManagerUpdate ¶
func (k Keeper) ValidateManagerUpdate(ctx sdk.Context, oldManager []*types.ManagerTimeline, newManager []*types.ManagerTimeline, canUpdateManager []*types.TimedUpdatePermission) error
func (Keeper) ValidateOffChainBalancesMetadataUpdate ¶
func (k Keeper) ValidateOffChainBalancesMetadataUpdate(ctx sdk.Context, collection *types.BadgeCollection, oldOffChainBalancesMetadata []*types.OffChainBalancesMetadataTimeline, newOffChainBalancesMetadata []*types.OffChainBalancesMetadataTimeline, canUpdateOffChainBalancesMetadata []*types.TimedUpdatePermission) error
func (Keeper) ValidatePermissionsUpdate ¶
func (k Keeper) ValidatePermissionsUpdate(ctx sdk.Context, oldPermissions *types.CollectionPermissions, newPermissions *types.CollectionPermissions) error
Validate that the new permissions are valid and is not changing anything that they can't.
func (Keeper) ValidateStandardsUpdate ¶
func (k Keeper) ValidateStandardsUpdate(ctx sdk.Context, oldStandards []*types.StandardsTimeline, newStandards []*types.StandardsTimeline, canUpdateStandards []*types.TimedUpdatePermission) error
func (Keeper) ValidateTimedUpdatePermissionUpdate ¶
func (k Keeper) ValidateTimedUpdatePermissionUpdate(ctx sdk.Context, oldPermissions []*types.TimedUpdatePermission, newPermissions []*types.TimedUpdatePermission) error
func (Keeper) ValidateTimedUpdateWithBadgeIdsPermissionUpdate ¶
func (k Keeper) ValidateTimedUpdateWithBadgeIdsPermissionUpdate(ctx sdk.Context, oldPermissions []*types.TimedUpdateWithBadgeIdsPermission, newPermissions []*types.TimedUpdateWithBadgeIdsPermission) error
func (Keeper) ValidateUserIncomingApprovalPermissionsUpdate ¶
func (k Keeper) ValidateUserIncomingApprovalPermissionsUpdate(ctx sdk.Context, oldPermissions []*types.UserIncomingApprovalPermission, newPermissions []*types.UserIncomingApprovalPermission) error
func (Keeper) ValidateUserIncomingApprovalsUpdate ¶
func (k Keeper) ValidateUserIncomingApprovalsUpdate(ctx sdk.Context, collection *types.BadgeCollection, oldApprovals []*types.UserIncomingApproval, newApprovals []*types.UserIncomingApproval, CanUpdateCollectionApprovals []*types.UserIncomingApprovalPermission, toAddress string) error
func (Keeper) ValidateUserOutgoingApprovalPermissionsUpdate ¶
func (k Keeper) ValidateUserOutgoingApprovalPermissionsUpdate(ctx sdk.Context, oldPermissions []*types.UserOutgoingApprovalPermission, newPermissions []*types.UserOutgoingApprovalPermission) error
func (Keeper) ValidateUserOutgoingApprovalsUpdate ¶
func (k Keeper) ValidateUserOutgoingApprovalsUpdate(ctx sdk.Context, collection *types.BadgeCollection, oldApprovals []*types.UserOutgoingApproval, newApprovals []*types.UserOutgoingApproval, CanUpdateCollectionApprovals []*types.UserOutgoingApprovalPermission, fromAddress string) error
func (Keeper) ValidateUserPermissionsUpdate ¶
func (k Keeper) ValidateUserPermissionsUpdate(ctx sdk.Context, oldPermissions *types.UserPermissions, newPermissions *types.UserPermissions) error
type UniversalValidationParams ¶
Determines what to validate for each Msg
Source Files
¶
- address_lists.go
- approved_transfers.go
- approved_transfers_utils.go
- badges.go
- balance_types.go
- challenges.go
- coin_transfers.go
- errors.go
- grpc_query.go
- grpc_query_get_address_mapping.go
- grpc_query_get_approvals_tracker.go
- grpc_query_get_balance.go
- grpc_query_get_collection.go
- grpc_query_get_num_used_for_challenge.go
- grpc_query_params.go
- keeper.go
- keys.go
- msg_server.go
- msg_server_create_address_mappings.go
- msg_server_create_collection.go
- msg_server_delete_collection.go
- msg_server_transfer_badge.go
- msg_server_universal_update_collection.go
- msg_server_update_collection.go
- msg_server_update_user_approved_transfers.go
- msg_update_params.go
- params.go
- permission_casts.go
- permissions_validate_updates.go
- query.go
- store.go
- timeline_casts.go
- transfers.go
- transfers_expanders.go
- update_checks.go
- update_checks_helpers.go
- validation.go