ArtifactClass
and Artifact
ArtifactClass
is an alias of ItemClass
/ PlayerClass
and Artifact
is an alias of Item
/ Player
. In other words, ArtifactClass
can be ItemClass
or PlayerClass
and Artifact
can be Item
or Player
. Artifacts and ArtifactClasses are not actually stored on-chain. They are only used for deserialize them to the same structure as they have their own structure in their own contracts and make them easy to manage in the staking contract.
StakingCounter
StakingCounter
records the type and start time of every staking process. If event_type
is 0, the staking process is in warmup state and if event_type
is 1, the staking process is in cooldown state.
Staking contract is the program that allows users to stake their own items and players. Staking items/players allows for the gamification of artifacts on-chain. For example, you can upgrade an item level, game character level, etc.
Staking has two states, warmup and cooldown.
In warmup state, the staking tokens will be transferred from the wallet to a controlled escrow account and then to the controlled internal bank account of artifact. In cooldown state, on the contrary, the tokens will be transferred from the controlled internal back account of artifact to the controlled escrow account and then back to the wallet.
Warmup has two instructions.
begin_artifact_stake_warmup
end_artifact_stake_warmup
Here, begin_artifact_stake_warmup
will transfer tokens from the user wallet to the controlled escrow account and end_artifact_stake_warmup
will transfer tokens from the controlled escrow account to the artifact bank account.
And cooldown has two instructions.
begin_artifact_stake_cooldown
end_artifact_stake_cooldown
Here, begin_artifact_stake_cooldown
will transfer tokens from the artifact bank account to the controlled escrow account and end_artifact_stake_cooldown
will finally transfer tokens back to the user wallet.
To stake artifact, artifact must be joined to the namespace and the staking token must be whitelisted in that namespace.
Example config JSON: (stake.json)
To begin stake warmup:
To end stake warmup:
To begin stake cooldown:
To end stake cooldown: