# Overview

Create for each validator corresponding to 1 pool reward. Requirements:

## Problem Statement

Create a staking pool that rewards each user staking %. The reward will be distributed only once at the end of the block:

Block Action Total staking Pool Reward User Reward
i + 0 - - - -
i + 1 ◦ User A: +100 100 100 UserA+=100
i + 2 ◦ User B: +100 200 100 UserA+=50, UserB+=50
i + 3 - 200 100 UserA+=50, UserB+=50
i + 4 - 200 - -
i + 5 ◦ User A: +200 400 -
i + 6 - 400 100 UserA+=75, UserB+=25
i + 7 - 400 - -
Sum 400 UserA=275,UserB=125

### Constraints

# Problem solving

## Outline

Entity Behavior
Pool reward ◦ Record reward at the current block
~~◦ Clear the pending reward (when being slashed)
◦ Commit the pending reward~~
User ◦ Stake/unstake
◦ Claim reward
◦ Peek (pending/claimable) reward

## Reward per share (RPS)

Let $rps_i$ be the reward earned when the user stake 1 token into the pool at block $i$:

$$ rps_i\leftarrow \frac{reward_i}{totalBalance_i} $$