Staking and Governance
Stake DEEP tokens from your balance_manager into a DeepBook pool; the stake becomes active in the following epoch. When your active stake is greater than the pool's stake required, you get reduced taker fees and can accumulate trading fee rebates, and you can submit and vote on proposals that change the pool's taker fee rate, maker fee rate, and stake required.
You can stake DEEP tokens in a DeepBook pool, submit and vote on the governance proposals that set the pool's fees and stake required, and claim trading fee rebates.
DeepBook's novel approach to governance allows users to update a single pool's three parameters:
- Taker fee rate
- Maker fee rate
- Stake required
Stake required is the amount of DEEP tokens a user must have staked in the pool to take advantage of taker and maker incentives. Each individual DeepBook pool has independent governance, and governance can take place every epoch. See Design to learn more about governance.
How do I stake DEEP?
- Make sure the DEEP tokens you want to stake are available in your
balance_manager. - Call
stakeon thePool(see API). The new stake is not active yet. - In the following epoch, the first action you perform updates your account, and your stake from the previous epoch becomes active.
- From that epoch on, you can submit and vote on proposals for that pool.
- While your active stake is greater than the pool's stake required, you get reduced taker fees and can accumulate trading fee rebates during that epoch.
- Call
claim_rebatesto claim the rewards that yourbalance_manageraccumulates.
For example, if you stake during epoch N, your stake becomes active with your first action in epoch N+1, and you can start submitting and voting on proposals in epoch N+1.
What do maker and taker incentives give me?
While your active stake is greater than the pool's stake required, you get reduced taker fees and can accumulate trading fee rebates during that epoch. A maker is eligible for rebates in an epoch as long as their DEEP staked is over the stake required and they have contributed maker volume. See Claim rebates to learn how to claim rebates.
How do I vote on a DeepBook proposal?
- Have a nonzero active stake in the pool. You can start submitting and voting on proposals the epoch following your stake.
- To propose a new taker fee rate, maker fee rate, and stake required, call
submit_proposal(see API). You automatically vote for the proposal you submit, and eachbalance_managercan only submit one proposal per epoch in a given pool. - To vote on an existing proposal, call
vote. The call uses all of your voting power on a single proposal; if you already voted on a different proposal during this epoch, the call removes that vote and recasts it into the new proposal.
API
Pool exposes the following endpoints for staking and governance.
Stake
DEEP tokens must be available in the balance_manager for staking. A user's stake becomes active in the following epoch: the first action the user performs in the new epoch updates their account, at which point any new stakes from the previous epoch become active. Users can start submitting and voting on proposals the epoch following their stake. If the user's active stake is greater than the stake required, the user can get reduced taker fees and can accumulate trading fee rebates during that epoch.
The following is the stake function from packages/deepbook/sources/pool.move in the MystenLabs/deepbookv3 repository. It stakes DEEP tokens from the balance_manager in the pool.
packages/deepbook/sources/pool.move. You probably need to run `pnpm prebuild` and restart the site.Unstake
The function removes all of the user's active and inactive stake and adds it back into the BalanceManager. It also removes any cast votes. The user forfeits maker rebates for the epoch, and the function disables any reduced taker fees for the remaining epoch.
The balance_manager must have enough staked DEEP tokens. The function updates the balance_manager data with the unstaked amount. The function transfers the balance to the balance_manager immediately.
The following is the unstake function from packages/deepbook/sources/pool.move in the MystenLabs/deepbookv3 repository. It removes all of the user's active and inactive stake and returns it to the balance_manager.
packages/deepbook/sources/pool.move. You probably need to run `pnpm prebuild` and restart the site.Submit proposal
Users with a nonzero active stake can submit proposals. One proposal per user. The user automatically votes for the proposal they submit.
Submit a proposal to change the taker fee, maker fee, and stake required. The balance_manager must have enough staked DEEP tokens to participate. Each balance_manager can only submit one proposal per epoch in a given pool, because each individual DeepBook pool has independent governance, and the proposed fees have bounds. If the pool reaches the maximum number of proposals, the function removes the proposal with the lowest vote. If the balance_manager has less voting power than the lowest voted proposal, the function does not add the proposal.
The following is the submit_proposal function from packages/deepbook/sources/pool.move in the MystenLabs/deepbookv3 repository. It submits a proposal for a new taker fee, maker fee, and stake required for the pool.
packages/deepbook/sources/pool.move. You probably need to run `pnpm prebuild` and restart the site.Vote
Users with nonzero voting power can vote on a proposal. The vote uses all voting power on a single proposal. If the user has voted on a different proposal during this epoch, then the function removes that vote and recasts it into the new proposal. The balance_manager must have enough staked DEEP tokens to participate. A user's voting power derives from the amount they have staked, with a current voting power cutoff of 100,000 DEEP, and quorum is equivalent to half of the total voting power.
The following is the vote function from packages/deepbook/sources/pool.move in the MystenLabs/deepbookv3 repository. It casts all of the balance_manager's voting power on a single proposal.
packages/deepbook/sources/pool.move. You probably need to run `pnpm prebuild` and restart the site.Claim rebates
Use claim_rebates to claim the rewards for the balance_manager. The balance_manager must have rewards to claim: during every epoch, a maker is eligible for rebates as long as their DEEP staked is over the stake required and they have contributed maker volume, and the maximum amount of rebates for an epoch is equivalent to the total amount of DEEP collected during that epoch, and DeepBook burns the remaining DEEP. The function updates the balance_manager data with the claimed rewards.
The following is the claim_rebates function from packages/deepbook/sources/pool.move in the MystenLabs/deepbookv3 repository. It claims the rebates accumulated by the balance_manager.
packages/deepbook/sources/pool.move. You probably need to run `pnpm prebuild` and restart the site.