All Artifacts, including Items, Matches and Players can be joined and then cached to a Namespace. This extends to other Namespaces. Namespaces within namespaces allow you to create hierarchies/groupings of artifacts for fine-grained organization and indexability of your Artifacts. This greatly speeds up query speeds and accessibility within a large collection of Artifacts.
When an Artifact is first created, the creator can define the number of Namespaces an Artifact may join, which can be changed at any time through the UpdateNamespace instruction.
initializeNamespace: Create a Namespace with the desired configuration
updateNamespace: Update the Namespace configuration
cacheArtifact: Add a Raindrops Artifact to the Namespace's cache, remember the Artifact can be another Namespace.
uncacheArtifact: Remove an Artifact from the Namespace cache, this is necessary to remove an Artifact from a Namespace completely.
createNamespaceGatekeeper: Initialize a Gatekeeper which can store Artifact Filters, only one Gatekeeper is associated to a Namespace at a time.
addToNamespaceGatekeeper: Add an Artifact Filter to the Gatekeeper
removeFromNamespaceGatekeeper: Remove an Artifact Filter from a Gatekeeper
joinNamespace: Add an Artifact to a Namespace, this must be done first before caching
leaveNamespace: Remove an Artifact completely from a Namespace, must already be removed from the cache.
Full list of Artifacts that are joinable and cachable to any Namespace.
Item
Match
Namespace
Player
It is possible to Stake tokens of your choice to a Namespace, when a Namespace is initialized, token mints can be provided which are whitelisted to be eligible to be staked to the Namespace. These mints can be updated at any time over the course of a Namespaces lifecycle.
Staking is a generic term here, because we believe staking tokens can mean a lot of different things depending on the game and situation. Maybe a Namespace is a house, and to build a new floor you would need to have a player gather wood, wood in this case can be tokenized, for example a $WOOD token. Once a Player has staked enough $WOOD tokens to a Namespace, it is possible to build another floor!
Creating a Namespace should be the first step when designing how to store state with Raindrops. During Namespace creation, it's possible to configure many variables, like which Staking mints are allowed to be staked, caching parameters and naming schemes. Creating Namespace Gatekeepers is also a configurable aspect to initialization, these Gatekeepers can have filters that determine which Artifacts are eligible to be joined to your new Namespace.
After a Namespace is created, next create a Raindrops artifact, these can be Item's, Matches or Players. After an Artifact is created, try joining it to a Namespace. Joining artifacts to a namespace allow you to associate and index them in different ways depending on your use case. It's possible to query for all Artifacts that belong to a given Namespace very easily.
Artifacts which are joined to a Namespace can subsequently be cached to the same Namespace. If an Artifact needs to be removed from a Namespace, it's first removed from the namespace's cache. Caching enables easy lookup of an Artifact's Namespaces.
These directions use the CLI, the example configuration is simply to understand the JSON structure you need to provider, use your own payloads.
Setup
Artifact Created
Namespace Initialized
Namespace Gatekeeper created
Artifact Joins a Namespace
Cache Artifact to the Namespace
Artifact Removed from Namespace Cache
Artifact Leaves a Namspace
Namespace Gatekeepers are responsible for filtering which artifacts are allowed to be joined to a given Namespace. Each Namespace can only have one Gatekeeper but the Gatekeeper can have multiple filters attached, an artifact must pass all filters to be eligible to join a Namespace. To reiterate, Gatekeepers only filter on initial Joining actions to Namespaces, they do not filter on caching artifacts.
There are 2 different filter types and each type can be applied independently to each different type of artifact.
Namespace: Filters on an array of Namespaces
Key: PARTIALLY_IMPLEMENTED, Filters on arbitrary accounts, currently only mint
is implemented.
Permissiveness defines how the Filter Types are applied to a given Artifact when joining a Namespace
All: Automatically passes the filter, nothing is checked
Whitelist: Artifact must match the filter
Blacklist: Artifact must not match the filter
Namespace: Artifact token holder must sign the transaction for it to be joined to the Namespace.
During the initialization of a Namespace, PermissivenessSettings are defined for each artifact that can be joined to a Namespace. This allows granular permissives to be applied. For example, an Item can have a Permissiveness set to Whitelist while a Match can be set to Blacklist, both of these artifacts will run through the same set of filters but evaluated in opposite ways.