# Key Operations Flows

## 1. Key Operation Flows

### 1.1 Staking Flow

This section contains the flows related to the staking part of the protocol.

#### **1.1.1 sPRL1 Flow**

**1.1.1.1 sPRL1 Deposit**

* Transfer PRL tokens to the sPRL1 contract
* Mint sPRL1 tokens to the user equivalent to the amount of PRL tokens transferred

**1.1.1.2 sPRL1 Request Withdraw**

* Burn the amount of sPRL1 tokens that the user wants to withdraw
* Set the unlocking time for this request

**1.1.1.3 sPRL1 Withdraw**

* Calculate the penalty based on the time left before the unlocking time.
* Send the PRL tokens to the user
* mint sPRL1 tokens to the fee receiver equal to the amount slashed from the penalty.

**1.1.1.4 sPRL1 EmergencyWithdraw**

* Burn the amount of sPRL1 tokens that the user wants to withdraw
* Send the PRL tokens to the user without penalties.

#### **1.1.2 sPRL2 Flow**

This section contains the flows related to the sPRL2 contract.

**1.1.2.1 sPRL2 Deposit PRL/WETH or PRL/ETH**

* Transfer PRL/WETH or PRL/ETH to the sPRL2 contract
* Deposit ETH to WETH if needed
* Add PRL/WETH liquidity into the Balancer pool (80PRL/20WETH)
* Receive BPT tokens
* Stake BPT tokens in Aura
* mint sPRL2 tokens to the user equivalent to the amount of Aura BPT lp tokens received

**1.1.2.2 sPRL2 Deposit BPT 80PRL/20WETH**

* Transfer BPT to the sPRL2 contract
* Deposit BPT into Aura pool and stake it
* Mint sPRL2 tokens to the user equivalent to the amount of BPT transferred

**1.1.2.3 sPRL2 Request Withdraw**

* Burn the amount of sPRL2 tokens that the user wants to withdraw
* Set the unlocking time for this request

**1.1.2.4 sPRL2 Withdraw PRL/ETH or PRL/WETH**

* Calculate the penalty based on the time left before the unlocking time.
* Withdraw and unwrap the amount of Aura BPT
* Receive Balancer BPT tokens from Aura
* Withdraw the amount of PRL/WETH from the Balancer pool
* Send the PRL/WETH to the user or PRL/ETH to the user
* Send the BPT lp penalty to the fee receiver

**1.1.2.5 sPRL2 Withdraw BPT 80PRL/20WETH**

* Calculate the penalty based on the time left before the unlocking time.
* Withdraw the amount of Aura BPT from Aura
* Receive Balancer BPT tokens from Aura
* Send the BPT lp tokens to the user
* Send the BPT lp penalty to the fee receiver

**1.1.2.6 sPRL2 EmergencyWithdraw**

* Burn the amount of sPRL2 tokens that the user wants to withdraw
* Withdraw the amount of Aura BPT from Aura
* Receive Balancer BPT tokens from Aura
* Send the BPT tokens to the user without penalties.

### **1**.2 Reward Distribution Flow

* RewardMerkleDistributor will receive the fees from the MainFeeDistributor at any time.
* Using off-chain events and calculations, the protocol retrieve the total amount received during a specific period.
* Protocol will generate a merkle root based on the total amount received and the amount of rewards that will be distributed to the users.
* The merkle root will be updated in the RewardMerkleDistributor contract.
* Users will be able to claim their rewards using the merkle proof.
