Staking Process

Towns token can be staked on Base to earn periodic rewards emitted by the protocol. Rewards are issued every two weeks to active operators and their delegates. Anyone with Towns tokens therefore can participate in staking by delegating to an active operator.

Staking Contracts

Staking is handled by the v2 version of the RewardsDistribution contract.

External methods from RewardsDistribution can be called from the BaseRegistry diamond contract directly using any ethereum compatible client such as cast.

The BaseRegistry diamond is deployed on Base (see contracts).

Staking Execution

Though we illustrate programmatic instructions below, interacting with the staking contract is best performed through the staking site available in www.towns.com/staking.

To stake, the user must call the stake(uint96 amount, address delegatee, address beneficiary)(uint256 depositIds) method of the RewardsDistribution facet from the BaseRegistry diamond contract.

Users must select a delegatee, for instance an active operator (active operators are listed on www.towns.com/staking), to delegate to in order to earn periodic rewards.

Users must also select a beneficiary, which is the address that will receive the rewards.

Once stake() is called, a unique depositId is returned to track the stake for the owner. A given address can have multiple deposits or can manage a single deposit.

To increase the amount of stake, the deposit owner can call increaseStake(uint256 depositId, uint96 amount).

Users can switch their delegatee at any time without withdrawing their stake by calling redelegate(uint256 depositId, address delegatee).

Withdrawing Stake

To withdraw stake, the owner of the depositId should follow the below steps or use the staking site available in towns.com.

  1. Call getDepositsByDepositor(address depositor) to get the list of depositIds for the depositor.
  2. Call initiateWithdraw(uint256 depositId) with the depositId to start the withdrawal process.
  3. Wait for the withdrawal to be processed subject to token lockup period.
  4. Call withdraw(uint256 depositId) to complete the withdrawal process transferring the stake back to the owner.