Liquidity Pools

For each supported token, there are two pools, on on the L1, and the other, on the L2.
When a user wishes to bridge funds into the L2 (
fast bridge to L2
), the user deposits funds into the L1 pool, triggering a message to be sent cross-chain to the L2 pool, which then sends the correct amount of funds to the user's L2 wallet. Likewise, the fast bridge to L1
consists of a user depositing funds into the L2 pool, which then triggers the L1 pool to send the user the correct amount of funds to their L1 wallet. For BOBA, there are no delays for users to move funds from L1 to L2, and from L2 to L1.Aside from normal users, the pools offer additional functionality to other parties. Liquidity providers (
stakers
) can deposit and withdraw funds from the pools; they earn rewards in proportion to their stake in the pool. Occasionally, they will withdraw their rewards via a dedicated function.Finally, the pools are controlled by an admin (
OnlyAdmin
) and/or the Boba DAO (OnlyDAO), which is able to set the fees users must pay to use the fast bridges. These fees are the source of the rewards for the liquidity providers.- A deposits 100A infoDeposit AmountRewardPending Reward10000Pool infoTotal RewardsReward Per ShareTotal Deposit Amount00100
- The pool generates 10 rewardsPool infoTotal RewardsReward Per ShareTotal Deposit Amount100100
- B deposits 100First, we update the rewardPerShare without considering the new deposit amount:Pool infoTotal RewardsReward Per ShareTotal Deposit Amount1010/100100Calculate B's informationB infoDeposit AmountRewardPending Reward100rewardPerShare * depositAmount = 10/100 * 100 = 100The total deposit amount of the pool is now 200.Pool infoTotal RewardsReward Per ShareTotal Deposit Amount1010/100200
- The pool generates another 5 rewardsPool infoTotal RewardsReward Per ShareTotal Deposit Amount1510/100200
- If A withdraws 100 tokens, we first update the rewardPerShare:Pool infoTotal RewardsReward Per ShareTotal Deposit Amount1510/100 + increased_rewards / total_deposit_amount = 10/100 + 5/200200The reward for A isdeposit_amount * reward_per_share - reward = 100 * (10/100 + 5/200) - 0 = 12.5
- If B withdraws 100 tokens, we first update the rewardPerShare:Pool infoTotal RewardsReward Per ShareTotal Deposit Amount1510/100 + increased_rewards / total_deposit_amount = 10/100 + 5/200200The rewards for B isdeposit_amount * reward_per_share - reward = 100 * (10/100 + 5/200) - 10 = 2.5
Last modified 8mo ago