The Paladin Stake program manages the delegation of tokens to a particular validator of the system. This allows stakers to earn additional shares of rewards proportional to their share of staked tokens and to participate in governance.
A Config
account essentially represents the staking system and it is the first account that needs to be created. Once a Config
account is created, ValidatorStake
accounts can be added to the system. A ValidatorStake
represents a validator of the network (coupled to a VoteState
account in the native Solana vote program). Anybody can create the stake account for a validator. For new accounts, the authority is initialized to the validator vote account's withdraw authority.
After ValidatorStake
accounts are added to the system, SolStakerStake
accounts can be created. These accounts represent individual SOL stakers (coupled to StakeState
accounts in the native Solana stake program). Similarly to ValidatorStake
, anybody can create the stake account for a SOL staker. For new accounts, the authority is initialized to the SOL stake account's withdrawer. When stake is added to a SolStakerStake
, it will update the total amount of staked tokens both on the corresponding ValidatorStake
and Config
. Therefore each ValidatorStake
tracks the amount of staked tokens that its individual stakers are currently staking, while the Config
tracks the total of staked tokens on the system. The system also keeps track of the SOL amount staked on the network to determine the share of the rewards and enforce that the proportion of tokens and SOL staked are within the expected limits.
Staking rewards are paid directly to the program via the DistributeRewards
instruction while holder rewards are accumulated on the Stake program's vault
token account. For both cases, the program offer instructions for stakers to harvest their rewards.
Important
There can be only one SOL staker stake account per SOL stake account and config account, since the SOL stake account is part of the SOL staker stake account seeds. Similarly, there can be only one validator stake account since the vote account is part of the validator stake account seeds.
The program makes use of three types of accounts to track staked amounts and manage parameters of the system.
The Config
account tracks the total amount of staked tokens and holds the parameters for the staking system:
authority
: Authority that can modify any elements in the config.slash authority
: Optional authority that can slash any stake account.cooldown time seconds
: After a deactivation, defines the number of seconds that must pass before the stake is inactive and able to be withdrawn.sync rewards lamports
: Lamports amount paid as a reward for syncing a SOL stake account.maximum deactivation basis points
: The maximum proportion that can be deactivated at once, given as basis points (1 / 10000
).
Each Config
account is associated with a particular mint account, determined by the mint of its vault
token account. The vault
token account holds all the staked tokens and it is controlled by the vault authority
of the Config
account.
Note
While staked tokens are escrowed by the Config
account, they still accrue holder rewards in addition to the staking. There are specific instructions on the program that allows holders to claim both their "holder" and "staking" rewards.
The SolStakerStake
accounts hold the delegation information of individual SOL stakers. The delegation holds the amount of staked tokens as well as their SOL stake state.
The maximum amount of tokens that a SOL staker is allowed to stake is currently proportional to the amount of SOL staked, given by 1.3 * SOL amount staked
.
The ValidatorStake
accounts hold the delegation information for the tokens staked by a validator. It also tracks the total amount of SOL and tokens staked by its stakers.
The total amount of SOL staked on a validator is used to determine that maximum amount of tokens that the validator is allowed to stake β currently the limit is given by 1.3 * SOL amount staked
.
- Paladin Stake Program
- Overview
- ποΈ Accounts
- π Instructions
DeactivateStake
InactivateSolStakerStake
InactivateValidatorStake
InitializeConfig
InitializeSolStakerStake
InitializeValidatorStake
HarvestHolderRewards
HarvestSolStakerRewards
HarvestValidatorRewards
SetAuthority
SlashSolStakerStake
SlashValidatorStake
SolStakerStakeTokens
UpdateConfig
ValidatorStakeTokens
WithdrawInactiveStake
Deactivate staked tokens for a stake delegation, either ValidatorStake
or SolStakerStake
. Only one deactivation may be in-flight at once, so if this is called with an active deactivation, it will succeed, but reset the amount and timestamp. An active deactivation can be cancelled by executing this instruction with a 0
(zero) amount.
Move tokens from deactivating to inactive. This effectively reduces the total voting power for the SOL staker stake account, the total staked amount on the corresponding validator stake and config accounts. This instruction is used prior to withdraw staked tokens.
Note
This instruction is permissionless, so anybody can finish deactivating someone's tokens, preparing them to be withdrawn.
Move tokens from deactivating to inactive. Reduces the total voting power for the validator stake account and the total staked amount on the system. This instruction is used prior to withdraw staked tokens.
Note
This instruction is permissionless, so anybody can finish deactivating validator's tokens, preparing them to be withdrawn.
Creates stake Config
account which controls staking parameters. This is the first instruction required to set up the staking system. In addition to the staking configuration, the instruction expects the mint
and vault
accounts. The mint
determines the type of tokens to be staked while the vault
is the escrow token account to hold the staked tokens.
Initializes SolStakerStake
account data for a SOL staker. This instruction can be used multiple times to add a new staker to the stake system. Stakers are uniquely identified by their StakeState
, i.e., there is only one SolStakerStake
account for each (StakeState
, Config
) pair.
The SolStakerStake
serves the purpose of managing the stake amount of an individual staker, tracking the SOL amount staked on the network to determine the allowed limit of tokens staked.
Note
Anybody can create the stake account for a SOL staker. For new accounts, the authority is initialized to the stake state account's withdrawer.
Initializes ValidatorStake
account data for a validator. This instruction can be used multiple times to add validators to the stake system. Validators are uniquely identified by their VoteState
, i.e., there is only one ValidatorStake
account for each (VoteState
, Config
) pair.
The ValidatorStake
serves two purposes on the staking system: (1) it allows individual staker (SolStakerStake
account) to stake tokens on the system; and (2) it allows validators to stake tokens on the system. Each validator tracks the SOL amount staked on the network of its stakers, which in turn determines the amount of tokens that a validator and its stakers are allowed to stake.
Note
Anybody can create the stake account for a validator. For new accounts, the authority is initialized to the validator vote account's withdraw authority.
Harvests holder SOL rewards earned by the given stake account. This instruction supports claiming rewards for both ValidatorStake
and SolStakerStake
accounts.
Harvests staker SOL rewards earned by the given SOL staker stake account.
Harvests staker SOL rewards earned by the given validator stake account.
Sets new authority on a config or stake account.
Slashes a SolStakerStake
account for the given amount. Burns the given amount of tokens from the vault account, and reduces the amount in the stake account. This instruction is executed by the Config
's slash authority, usually determined by a governance proposal.
Slashes a ValidatorStake
account for the given amount. Burns the given amount of tokens from the vault account, and reduces the amount in the stake account. This instruction is executed by the Config
's slash authority, usually determined by a governance proposal.
Stakes tokens with the given config. This instruction is used by SOL staker stake accounts. The total amount of staked tokens is limited to the 1.3 * current amount of SOL
staked by the SOL staker.
Updates configuration parameters of the stake system.
Stakes tokens with the given config. This instruction is used by validator stake accounts. The total amount of staked tokens is currently limited to the 1.3 * current amount of SOL
staked to the validator.
Withdraw inactive staked tokens from the vault. After a deactivation has gone through the cooldown period and been "inactivated", the authority may move the tokens out of the vault. This instruction support both ValidatorStake
and SolStakerStake
accounts.