---
# System prepended metadata

title: Math Spec for Ethix Stock & Flow

---

# Math Spec for Ethix Stock & Flow

## Introduction 

EthicHub protocol aims to be an engine to improve the lives of farmers in developing econonomies by improving the value flows of their current financial opportunities, and creating a shared collateral via the ETHIX token, that rewards and incentivizes risk reduction in the system. 

- ETHIX is a fixed supply token with an unvesting schedule for founders and incentives.
- Half of ETHIX supply (50M) is staked in the **Compensation Reserve**

- **Lenders** will deposit DAI in pools to get a stable interest with low risk profile.
- **Originator Hubs** (entities representing farmers like coops, agtech companies, DAOs... ), when collateralized, will be able to borrow from the pool (like a credit line), as much as the initial value of the collateral posted, for a year. Terms will be modified deppending performance/needs.
    - Originator hubs will stake 20% of the needed collateral, 20% more by an auditor and 60% by the Originator backers.
    - This tokens will be locked during the duration of the borrowing period
    - Originator stake will be locked 5 years
    - Backers will be incentivized by ETHIX inflation at first, DAI fees later
    - Initial Originator Collateralization Factor: $Cf_0$ (for example, 150% of collateralization is needed to request the loan, adding )
    - Collateralization Factor = Staked Ethix in favor of the originator (Orig + Auditor + Backers ) * Price of Ethix in DAI / Borrowed DAI
    - In case of default in the loans, staked ETHIX will be sold in AMM for DAI to cover the deficit in the Lending Pool. The order of liquidation is
        - 1 Originator
        - 2 Auditor
        - 3 Backers
        - 4 Compensation Reserve
    - An Originator deigned malicious / unethical by auditors and governance will be liquidated.
    - Originators will be considered Defaulting if they have not repayed their loans after a certain period of time pass the return date of the loan (90 days)
    - Since Ethix price is volatile, a mechanism involving the **Compensation Reserve** (may be governance triggered intially) will keep the Originator collateralized (by staking tokens if needed)
    - Loan request will have fees in DAI


| - | year 1 | year 2 | year 3 | year 4 | year 5 |
| -------- | -------- | -------- | -------- | -------- | -------- 
| Max Borrow increment (limit) | 1 | 200% | 150% | 133% | 125% |
| LP Interest | 8% | 7.5% | 7% | 6.5% |6% |
| DAO fee | 3% | 2.5% | 2% | 1.5% | 1% |
| Auditor fee | 2% | 1.75% | 1.5% | 1.25% | 1% |
| Stakers | 2% | 2% | 2% | 2% | 2% |
| Total cost for originator | 15% | 13.75% | 12.5% | 11.25% | 10% |


- Stakers may stake ETHIX in the general compensation pool, being rewarded with ETHIX inflation
- Liquidity not borrowed by the Originator Hubs will be placed in liquid DeFi strategies.


## Assumptions

- Compensation Reserve and the staking mechanisms will keep the system under defined Health (collateralization) parameters
- There are a set of parameters that allows the lenders to have stable interest for DAI locked for a certain period of time in the liquidity pool (i.e fixed interest fixed maturity bond)




## Global State

### Staker Compensation Reserve


## Global Parameters

- Target Utilization Ratio: $\alpha$
    - Desired % of $P_l^d$ borrowed by Originator Hubs
- Target DeFi placement Ratio: $\beta$
    - Desired % of $P_l^d$ deposited in DeFi
- System Health: $H_s$
- Originator unstake lock time: $t_u$
- Originator skin in the game factor: $\gamma$
    - $\gamma∈R∣0<x<1$
    - Value: 0.2
- Auditor skin in the game factor: $\theta$
    - $\theta∈R∣0<x<1$
    - Value: 0.2
- Originator skin in the game factor: $\eta$
    - $\eta∈R∣0<x<1$
    - Value: 0.6
- $\gamma + \theta + \eta = 1$
- $daoFee$
- $stakersFee$
- $auditorFee$

## Mechanism Actions

### Related to Ethix

- Liquidation: $\Delta P^{el}$
    - Originator State must be default (loan unpayed passed dates)
    - $\Delta P^{el}=\frac{L_b^d}{Price_e^d}$
    - $\Delta P^{el} \begin{cases} P_o^e & \quad  P_o^e·Price_e^d \ge L_b^d\\
P_o^e+Pa^e & \quad (P_o^e+P_a^e)·Price_e^d \ge L_b^d\\ P_o^e+P_a^e+P_d^e & \quad (P_o^e+P_a^e+P_v^e)·Price_e^d \ge L_b^d\\ P_o^e+P_a^e+P_d^e+\Delta P_r^{el} & \quad (P_o^e+P_a^e+P_v^e)·Price_e^d < L_b^d\\
\end{cases}$

- Compensation Reserve: $P_r^{e}$
    - 
    - $P_r^{e}(t_0)= 50M Ethix$
    - Compensate undercollateralized originator: $\Delta P_r^{el}$
        - $\Delta P_r^{e} \begin{cases} 0 & \quad (P_o^e+P_a^e+P_v^e)·Price_e^d \ge L_b^d \\ \frac{L_b^d}{Price_e^d } - (P_o^e+P_a^e+P_v^e) & \quad  (P_o^e+P_a^e+P_v^e)·Price_e^d < L_b^d \end{cases}$

  
- Governance Events
    - Authorize / Unauthorize Originators 
    - Liquidation of Malicious Originator by its Auditor (won't burn liquidator stake)
    - Authorize / Unauthorize Auditors 
    - Set Originator Hub parameters
        - MaxLending capacity?
    - Adjust Lender parameters
        - Interest
        - % of Liquidity in DeFi
        - Target utilization in Originator Borrowing
    - Adjust ETHIX rewards
    - Approve / Retire DeFi strategies
- Release Schedule
    - [Link](https://docs.google.com/spreadsheets/d/1cZKwW4h5JRYgJ6XYgVFARFq1T0XzSnS65hHWJfpari0/edit?usp=sharing)
- Incentives Flow
- Compensator Incentive
- Originator Incentive
- Buy and Stake Ethix (from fees)

#### Compensation reserve

### Related to DAI


- DeFi Pool: $P_d^d$
    - Invest: $\Delta P_d^{d+} \in \mathbb{R}^+$
        - $\Delta P_d^{d+} \le P_l^d · \alpha$
    - Divest: $\Delta P_d^{d-} \in \mathbb{R}^+$
        - $\Delta P_d^{d-} \le P_d^{d+}$
        - If borrowing does not have enough liquidity, this should be triggered
    - $P_d^d(t) = \sum_\tau (\Delta P_d^{d+} - \Delta P_d^{d-})$


## Agents State

### Originator

- #### Onboarding
![](https://i.imgur.com/X8gK9EH.jpg)

- #### Borrowing
![](https://i.imgur.com/AWvxMFf.jpg)

- #### Liquidation
![](https://i.imgur.com/DfaBEV9.jpg)


### Lender
- ### Bond purchase
![](https://i.imgur.com/3n4SdDN.jpg)


### Originator Staker




## Agents Parameters

### Originator

- MaxBorrowingCapacity: $Lmax^d$
    - $Lmax^d = \min (LmaxAudited^d, P^e·Price_e^d)$
    - $LmaxAudited^d$: Max borrowing capacity deigned by auditors according to productive capacity
- Originator Collateralization Factor: $Cf$
- Time of originator onboarding creation: $t_0$
- Bond maturity: $t_b$
- Bond interest: $I_b$
- Loan maturity: $t_l$ 
- Loan interest: $I_l$


## Agents Actions

### Related to DAI
- Liquidity Pool: $P_L^d$
    - $P_L^d(t) = \sum_\tau(B^{d+}(\tau) - B^{d-}(\tau) + \Delta P_l^{d+}(\tau) - \Delta P_l^{d-}(\tau) - L_b^d(\tau) + L_r^d(\tau))$

#### Flows from Lender stock to  Liquidity Pool $P_L^d$
  - Buy bond: $B^{d+}$
      - (fixed interest, fixed maturity, liquidity will be locked. This is also because )
  - Withdraw bond: $B^{d-}$
      - $B^{d-} \begin{cases} 0 & \quad  t < t_b\\
B^{d+} * (1 + L_b * t) & \quad t \geq t_b\\ \end{cases}$
- Provide liquidity: $\Delta P_l^{d+}$
- ("liquid" liquidity providing could be incentivice via farming to improve Liquidity)
- Withdraw liquidity: $\Delta P_l^{d-}$
#### Flows from Liquidity Pool $P_L^d$ to OriginatorDai $P_o^d$
- Borrowed: $L_b^d$
    - $L_b^d \in \mathbb{R}^+$
    - $L_b^d <= Lmax^d  - DaoFee - AuditorFee - StakersFee$
        - There is a repayDate and a defaultDelay

- Repay: $L_r^d \in \mathbb{R}^+$
    - $L_r^d(t) \begin{cases} 0 & \quad  t< t_l\\L_b^d
  & \quad t \ge t_l\\ \end{cases}$
        

- OriginatorDai: $P_o^d$ 
    - DAI in/out: $\Delta P_o^d \in \mathbb{R}$
    - $P_o^d(t) = \sum_\tau (\Delta P_o^d(\tau) + L_b^d - L_r^d)$
    
### Related to Ethix


- Stake / Unstake on Originators Pool $P_o$
    - Stake: $\Delta P_o^{e+} \in \mathbb{R}^+$
        - $\Delta P_o^{e+} \leq \gamma ·P^e$
    - Unstake:
    - $\Delta P_o^{e-}(t) \begin{cases} 0 & \quad  t < t_u\\
\Delta P_o^+ & \quad t \geq tu\\ \end{cases}$
    - $\Delta P_o^{e-} <= \Delta P_o^{e+}$
    - Liquidation: 
        - $\Delta P_o^{el} \leq P_o^{e+}$
    - $P_o^e(t) = \sum_\tau (\Delta P_o^{e+}(\tau) - \Delta P_o^{e-}(\tau) - \Delta P_o^{el}(\tau))$
- Stake / Unstake on Auditors Pool $P_a$
    - Stake: 
        - $\Delta P_a^{e+} \leq \theta ·P^e$
    - Unstake: 
        - $\Delta P_a^{e-}(t) \begin{cases} 0 & \quad  t < t_u\\
\Delta P_a^{e+} & \quad t \geq tu\\ \end{cases}$
        - $\Delta P_a^{e-} <= \Delta P_a^{e+}$
    - Liquidation: 
        - $\Delta P_a^{el} \leq P_a^{e+}$
        - 
    - $P_a^e(t) = \sum_\tau (\Delta P_a^{e+}(\tau) - \Delta P_a^{e-}(\tau) - \Delta P_a^{el}(\tau))$

- Stake / Unstake on Originator's Community Pool $P_v^e$
    - Stock: $P_v^e$
    - Stake: 
        - $\Delta P_v^{e+} \in \mathbb{R}^+$
        - $\Delta P_v^{e+} \leq \eta ·P^e$
    - Unstake:
        - $\Delta P_v^{e-}(t) \begin{cases} 0 & \quad  t < t_u\\
\Delta P_v^{e+} & \quad t \geq tu\\ \end{cases}$
        - $\Delta P_v^{e-} <= \Delta P_v^{e+}$
    - Liquidation: 
        $\Delta P_v^{el} \leq \Delta P_v^{e+}$
    - $P_v^e(t) = \sum_\tau (\Delta P_v^{e+}(\tau) - \Delta P_v^{e-}(\tau) - \Delta P_v^{el}(\tau))$
    
    
- Incentives Pool: $P_i$
    - Incentive allocation: $\Delta P_i^-$
        - Ethix reward per second compensators: $E_rc$
        - Ethix reward per second originator backers: $E_rb$
        - Unvesting incentives schedule: $\Delta P_i^u$
            - //TODO link schedule
        - $\Delta P_i^- \in \mathbb{R}^+$
        - $P_i(t) = \sum_\tau (\Delta P_i^u(\tau) - E_rc(\tau) - E_rb(\tau))$
- Ethics Yield Compensators: $E_yc$
    - Claim Rewards = $\Delta E_yc^-$
    - // Rewards for compensators is Ethix reward per seconds...individual rewards is $\frac{E_rs(t)}{P_c(t)}$





## Stock & Flow Consistency Equations

- $P_{amm}$: Ethix on AMM
- CS: Circulating Supply
- ATB: Sum over Agents Balance
- $b_i$: Agent $i$ balance

$P_c(t) + P_v(t) + P_a(t) + P_o(t) + P_i(t) + P_{amm}(t) + \sum_i b_i(t) - CS(t) = 0$

$b_i(t) >= 0$

- Originator Collateralization: 
$C_o = \frac{(Orig + Auditor + Backers)·Price_e^d}{P_o^d}$
- Originator total Ethix staked: $P^e$
    - $P^e = P_v^e+P_a^e+P_o^e$
    - $Lmax^d <= (P^e ·\gamma+P^e ·\theta+P^e ·\eta)·Price_e^d(t_0)$
    - 
- Ethix / DAI price: $Price_e^d$
- $AvailableLiquidityForBorrowing(t) = \sum_\tau (B^{d+}(\tau) - L_r^d(\tau))$

- What happens if an originator hub wants to join but AvailableLiquidityForBorrowing < Lmax for that hub?

