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, permissionDetails []*types.UniversalPermissionDetails, ...) error
- func ConstructAddressListKey(addressListId string) string
- func ConstructApprovalTrackerKey(collectionId sdkmath.Uint, addressForApproval string, amountTrackerId string, ...) string
- func ConstructBalanceKey(address string, id sdkmath.Uint) string
- func ConstructUsedClaimChallengeKey(collectionId sdkmath.Uint, addressForChallenge string, challengeLevel string, ...) string
- func ConstructUsedClaimDataKey(collectionId sdkmath.Uint, claimId sdkmath.Uint) string
- func GetFirstMatchOnlyWithApprovalCriteria(permissions []*types.UniversalPermission) []*types.UniversalPermissionDetails
- func GetLeafIndex(aunts []*types.MerklePathItem) sdkmath.Uint
- func GetPotentialUpdatesForTimelineValues(times [][]*types.UintRange, values []interface{}) []*types.UniversalPermissionDetails
- func GetUpdateCombinationsToCheck(ctx sdk.Context, firstMatchesForOld []*types.UniversalPermissionDetails, ...) ([]*types.UniversalPermissionDetails, error)
- func GetUpdatedBoolCombinations(ctx sdk.Context, oldValue interface{}, newValue interface{}) ([]*types.UniversalPermissionDetails, error)
- func GetUpdatedStringCombinations(ctx sdk.Context, oldValue interface{}, newValue interface{}) ([]*types.UniversalPermissionDetails, error)
- func IncrementBalances(startBalances []*types.Balance, numIncrements sdkmath.Uint, ...) ([]*types.Balance, error)
- func IsInheritedBalances(collection *types.BadgeCollection) bool
- func IsNonIndexedBalances(collection *types.BadgeCollection) bool
- func IsOffChainBalances(collection *types.BadgeCollection) bool
- func IsStandardBalances(collection *types.BadgeCollection) bool
- func NewMsgServerImpl(keeper Keeper) types.MsgServer
- type ApprovalCriteriaWithIsApproved
- type BalanceKeyDetails
- type Keeper
- func (k Keeper) AssertValidSolutionForEveryChallenge(ctx sdk.Context, collectionId sdkmath.Uint, challengeId string, ...) (sdkmath.Uint, error)
- func (k Keeper) AuthenticateCapability(ctx sdk.Context, cap *capabilitytypes.Capability, name string) bool
- func (k Keeper) BindPort(ctx sdk.Context, portID string) error
- func (k Keeper) CastActionPermissionToUniversalPermission(actionPermission []*types.ActionPermission) ([]*types.UniversalPermission, error)
- func (k Keeper) CastBadgeMetadataToUniversalPermission(badgeMetadata []*types.BadgeMetadata) []*types.UniversalPermission
- func (k Keeper) CastBalancesActionPermissionToUniversalPermission(BalancesActionPermission []*types.BalancesActionPermission) ([]*types.UniversalPermission, error)
- 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) ChanCloseInit(ctx sdk.Context, portID, channelID string) 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) CheckIfBalancesActionPermissionPermits(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) ClaimCapability(ctx sdk.Context, cap *capabilitytypes.Capability, name string) 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(overallTransferBalances []*types.Balance, ...) ([]*UserApprovalsToCheck, error)
- func (k Keeper) DeductCollectionApprovalsAndGetUserApprovalsToCheck(ctx sdk.Context, overallTransferBalances []*types.Balance, ...) ([]*UserApprovalsToCheck, error)
- func (k Keeper) DeductUserIncomingApprovals(ctx sdk.Context, overallTransferBalances []*types.Balance, ...) error
- func (k Keeper) DeductUserOutgoingApprovals(ctx sdk.Context, overallTransferBalances []*types.Balance, ...) 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) GetBalance(goCtx context.Context, req *types.QueryGetBalanceRequest) (*types.QueryGetBalanceResponse, error)
- 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, transferVal *types.CollectionApproval, ...) ([]*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 sdk.Context) types.Params
- func (k Keeper) GetPort(ctx sdk.Context) string
- func (k Keeper) GetPredeterminedBalancesForPrecalculationId(ctx sdk.Context, approvals []*types.CollectionApproval, ...) ([]*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) HandleTransfer(ctx sdk.Context, collection *types.BadgeCollection, ...) (*types.UserBalanceStore, *types.UserBalanceStore, error)
- func (k Keeper) HandleTransfers(ctx sdk.Context, collection *types.BadgeCollection, ...) error
- func (k Keeper) IncrementApprovalsAndAssertWithinThreshold(ctx sdk.Context, transferVal *types.CollectionApproval, ...) 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) IsBound(ctx sdk.Context, portID string) bool
- func (k Keeper) Logger(ctx sdk.Context) 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) 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 sdk.Context, params types.Params)
- func (k Keeper) SetPort(ctx sdk.Context, portID string)
- 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(oldPermissions []*types.ActionPermission, ...) error
- func (k Keeper) ValidateBadgeMetadataUpdate(ctx sdk.Context, oldBadgeMetadata []*types.BadgeMetadataTimeline, ...) error
- func (k Keeper) ValidateBalancesActionPermissionUpdate(oldPermissions []*types.BalancesActionPermission, ...) 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(oldPermissions []*types.TimedUpdatePermission, ...) error
- func (k Keeper) ValidateTimedUpdateWithBadgeIdsPermissionUpdate(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") )
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
By default, we approve all transfers if to === initiatedBy
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, permissionDetails []*types.UniversalPermissionDetails, 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 GetFirstMatchOnlyWithApprovalCriteria ¶
func GetFirstMatchOnlyWithApprovalCriteria(permissions []*types.UniversalPermission) []*types.UniversalPermissionDetails
func GetLeafIndex ¶
func GetLeafIndex(aunts []*types.MerklePathItem) sdkmath.Uint
func GetPotentialUpdatesForTimelineValues ¶
func GetPotentialUpdatesForTimelineValues(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
We do this by getting from GetPotentialUpdatesForTimelineValues
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 are the only ones that changed
Note that updates are field-specific, so the comparison logic is handled via a custom passed-in function - compareAndGetUpdateCombosToCheck
func GetUpdatedBoolCombinations ¶
func GetUpdatedBoolCombinations(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 IncrementBalances ¶
func IsInheritedBalances ¶
func IsInheritedBalances(collection *types.BadgeCollection) bool
func IsNonIndexedBalances ¶
func IsNonIndexedBalances(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.
Types ¶
type ApprovalCriteriaWithIsApproved ¶
type ApprovalCriteriaWithIsApproved struct {
ApprovalCriteria *types.ApprovalCriteria
}
Make a struct witha 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, storeKey, memKey storetypes.StoreKey, ps paramtypes.Subspace, channelKeeper types.ChannelKeeper, portKeeper types.PortKeeper, scopedKeeper exported.ScopedKeeper, accKeeper types.AccountKeeper, ) *Keeper
func (Keeper) AssertValidSolutionForEveryChallenge ¶
func (k Keeper) AssertValidSolutionForEveryChallenge(ctx sdk.Context, collectionId sdkmath.Uint, challengeId string, challenges []*types.MerkleChallenge, merkleProofs []*types.MerkleProof, creatorAddress string, simulation bool, approverAddress string, challengeLevel string, challengeIdsIncremented *[]string, approval *types.CollectionApproval) (sdkmath.Uint, error)
func (Keeper) AuthenticateCapability ¶
func (k Keeper) AuthenticateCapability(ctx sdk.Context, cap *capabilitytypes.Capability, name string) bool
AuthenticateCapability wraps the scopedKeeper's AuthenticateCapability function
func (Keeper) BindPort ¶
BindPort defines a wrapper function for the port Keeper's function in order to expose it to module's InitGenesis function
func (Keeper) CastActionPermissionToUniversalPermission ¶
func (k Keeper) CastActionPermissionToUniversalPermission(actionPermission []*types.ActionPermission) ([]*types.UniversalPermission, error)
func (Keeper) CastBadgeMetadataToUniversalPermission ¶
func (k Keeper) CastBadgeMetadataToUniversalPermission(badgeMetadata []*types.BadgeMetadata) []*types.UniversalPermission
func (Keeper) CastBalancesActionPermissionToUniversalPermission ¶
func (k Keeper) CastBalancesActionPermissionToUniversalPermission(BalancesActionPermission []*types.BalancesActionPermission) ([]*types.UniversalPermission, error)
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) ChanCloseInit ¶
ChanCloseInit defines a wrapper function for the channel Keeper's function.
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
Note addresses matching does not mean the transfer is allowed. It just means the addresses match. All other criteria must also be met.
func (Keeper) CheckIfBalancesActionPermissionPermits ¶
func (k Keeper) CheckIfBalancesActionPermissionPermits(ctx sdk.Context, detailsToCheck []*types.UniversalPermissionDetails, permissions []*types.BalancesActionPermission, 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) ClaimCapability ¶
func (k Keeper) ClaimCapability(ctx sdk.Context, cap *capabilitytypes.Capability, name string) error
ClaimCapability allows the IBC app module to claim a capability that core IBC passes to it
func (Keeper) CreateAddressList ¶
func (Keeper) CreateBadges ¶
func (k Keeper) CreateBadges(ctx sdk.Context, collection *types.BadgeCollection, badgesToCreate []*types.Balance) (*types.BadgeCollection, error)
Create badges and update the unminted / total supplys for the collection
func (Keeper) DeductAndGetUserApprovals ¶
func (k Keeper) DeductAndGetUserApprovals(overallTransferBalances []*types.Balance, _approvals []*types.CollectionApproval, ctx sdk.Context, collection *types.BadgeCollection, badgeIds []*types.UintRange, times []*types.UintRange, fromAddress string, toAddress string, initiatedBy string, amount sdkmath.Uint, solutions []*types.MerkleProof, approvalLevel string, approverAddress string, challengeIdsIncremented *[]string, trackerIdsIncremented *[]string, prioritizedApprovals []*types.ApprovalIdentifierDetails, onlyCheckPrioritized bool) ([]*UserApprovalsToCheck, error)
func (Keeper) DeductCollectionApprovalsAndGetUserApprovalsToCheck ¶
func (k Keeper) DeductCollectionApprovalsAndGetUserApprovalsToCheck(ctx sdk.Context, overallTransferBalances []*types.Balance, collection *types.BadgeCollection, badgeIds []*types.UintRange, times []*types.UintRange, fromAddress string, toAddress string, initiatedBy string, amount sdkmath.Uint, solutions []*types.MerkleProof, challengeIdsIncremented *[]string, trackerIdsIncremented *[]string, prioritizedApprovals []*types.ApprovalIdentifierDetails, onlyCheckPrioritized bool) ([]*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, overallTransferBalances []*types.Balance, collection *types.BadgeCollection, userBalance *types.UserBalanceStore, badgeIds []*types.UintRange, times []*types.UintRange, from string, to string, requester string, amount sdkmath.Uint, solutions []*types.MerkleProof, challengeIdsIncremented *[]string, trackerIdsIncremented *[]string, prioritizedApprovals []*types.ApprovalIdentifierDetails, onlyCheckPrioritized bool) 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, overallTransferBalances []*types.Balance, collection *types.BadgeCollection, userBalance *types.UserBalanceStore, badgeIds []*types.UintRange, times []*types.UintRange, from string, to string, requester string, amount sdkmath.Uint, solutions []*types.MerkleProof, challengeIdsIncremented *[]string, trackerIdsIncremented *[]string, prioritizedApprovals []*types.ApprovalIdentifierDetails, onlyCheckPrioritized bool) 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) 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) 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, transferVal *types.CollectionApproval, approvalCriteria *types.ApprovalCriteria, overallTransferBalances []*types.Balance, collection *types.BadgeCollection, approvedAmount sdkmath.Uint, maxNumTransfers sdkmath.Uint, transferBalances []*types.Balance, challengeNumIncrements sdkmath.Uint, approverAddress string, approvalLevel string, trackerType string, address string, simulate bool, trackerIdsIncremented *[]string, ) ([]*types.Balance, error)
func (Keeper) GetNextAddressListCounter ¶
Gets the next collection ID.
func (Keeper) GetNextCollectionId ¶
Gets the next collection ID.
func (Keeper) GetPredeterminedBalancesForPrecalculationId ¶
func (k Keeper) GetPredeterminedBalancesForPrecalculationId(ctx sdk.Context, approvals []*types.CollectionApproval, collection *types.BadgeCollection, approverAddress string, precalculationId string, approvalLevel string, address string, solutions []*types.MerkleProof, initiatedBy string) ([]*types.Balance, error)
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) HandleTransfer ¶
func (k Keeper) HandleTransfer(ctx sdk.Context, collection *types.BadgeCollection, transferBalances []*types.Balance, fromUserBalance *types.UserBalanceStore, toUserBalance *types.UserBalanceStore, from string, to string, initiatedBy string, solutions []*types.MerkleProof, challengeIdsIncremented *[]string, trackerIdsIncremented *[]string, prioritizedApprovals []*types.ApprovalIdentifierDetails, onlyCheckPrioritized bool) (*types.UserBalanceStore, *types.UserBalanceStore, error)
Step 1: Check if transfer is allowed on collection level (deducting approvals if needed) Step 2: If not overriden by collection, check necessary approvals on user level (deducting 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, transferVal *types.CollectionApproval, approvalCriteria *types.ApprovalCriteria, overallTransferBalances []*types.Balance, collection *types.BadgeCollection, approvedAmount sdkmath.Uint, maxNumTransfers sdkmath.Uint, transferBalances []*types.Balance, challengeNumIncrements sdkmath.Uint, approverAddress string, approvalLevel string, trackerType string, address string, simulate bool, trackerIdsIncremented *[]string, ) error
func (Keeper) IncrementChallengeTrackerInStore ¶
func (k Keeper) IncrementChallengeTrackerInStore(ctx sdk.Context, collectionId sdkmath.Uint, addressForChallenge string, challengeLevel string, 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) 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(oldPermissions []*types.ActionPermission, newPermissions []*types.ActionPermission) error
func (Keeper) ValidateBadgeMetadataUpdate ¶
func (k Keeper) ValidateBadgeMetadataUpdate(ctx sdk.Context, oldBadgeMetadata []*types.BadgeMetadataTimeline, newBadgeMetadata []*types.BadgeMetadataTimeline, canUpdateBadgeMetadata []*types.TimedUpdateWithBadgeIdsPermission) error
func (Keeper) ValidateBalancesActionPermissionUpdate ¶
func (k Keeper) ValidateBalancesActionPermissionUpdate(oldPermissions []*types.BalancesActionPermission, newPermissions []*types.BalancesActionPermission) 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(oldPermissions []*types.TimedUpdatePermission, newPermissions []*types.TimedUpdatePermission) error
func (Keeper) ValidateTimedUpdateWithBadgeIdsPermissionUpdate ¶
func (k Keeper) ValidateTimedUpdateWithBadgeIdsPermissionUpdate(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
- badges.go
- balance_types.go
- challenges.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
- params.go
- permission_casts.go
- permissions_validate_updates.go
- store.go
- timeline_casts.go
- transfers.go
- transfers_expanders.go
- update_checks.go
- update_checks_helpers.go
- validation.go