Staking Process

The Towns token can be staked on Base to contribute to the security and decentralization of the Towns proof-of-stake network. Any holder of Towns tokens can participate by delegating their tokens to node operators within the ecosystem. Staking can be done directly on the contracts or via an interface at towns.com/staking.

Rewards for staking are continuously accrued and distributed on a biweekly schedule. Each operator receives rewards proportionally based on the total tokens staked to their node. Operators retain a defined commission, after which the remaining rewards are passed to delegators. Delegators then receive their portion of rewards proportional to the number of tokens they have staked with that operator.

Delegators rewards can be claimed at any time. Upon initiating an unstaking request, a 30-day cooldown period is enforced before the staked tokens become fully withdrawable.

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.