# Tokenomic v3.0
## 1. vDF Time-weighted Lock-up
### Requirements
- [ ] `COMP` style governance token, support deleaget and vote
- [ ] support time-weighted lock-up
- [ ] longer lock-up peroid, bigger voting power
- [ ] longer lock-up peroid, bigger DF reward
### How to do
#### Time-weighted lock up (describe in linear model, can extend to any model)
1. Create lock-up to get vDF
- [ ] minimal lock-up peroid is 1 week (7 * 86400)/ maximal is 4 years (4 * 365 * 86400 seconds), the interval unit is week
> WEEK = 7 * 86400 // week
> MAXTIME = 4 * 365 * 86400 // 4 years
>
> user creat lock in:
> amount = _a (DF)
> peroid = _p (weeks in secs)
>
> then, user get vDF in:
> f(_a, _p) = _a * _p / MAXTIME
>
> example:
> userA creat 1000 DF lock in 1 years
> userB creat 1000 DF lock in 4 years,
> vDF.balance(userA) = 250
> vDF.balance(userB) = 1000,
>
> that means the same amount with longer locking peroid has bigger voting powering.
- [ ] support continue increasing amount to a lock-up only the lock-up is not expired, additional vDF balance calculated by remain lock-up peroid
> lock-up is:
> amount = 1000 (DF)
> peroid = 2 year weeks
>
> then, get vDF in:
> 1000 * 2 / 4 = 500
>
> add 2400 DF in the lock-up when lock-up has passed 1 year, then
> 2400 * 1 / 4 + 500 = 600 + 500 = 1100
- [ ] support extend lock-up peroid only the lock-up is not expired, maximal is 4 years, then additional vDF balance calculated by extend lock-up peroid
> lock-up is:
> amount = 1000 (DF)
> peroid = 2 year weeks
>
> then, get vDF in:
> 1000 * 2 / 4 = 500
>
> extend the lock-up to 3 years, then new vDF balance is:
> 1000 * 1 / 4 + 500 = 250 + 500 = 750
- [ ] support re-create lock-up only if the current is expired
> there are three cases:
> A. re-create and supplement DF
> B. just re-create with the current non-withdrawed DF
> C. re-create and withdraw part of DF
>
> allocate new vDF balance based on new amount and locking peroid
2. Staking strategy based on user's vDF balance
> lp token: vDF
> reward: DF
>
> when vDF balance changes, settle reward
3. one lock-up for one user, one can deposit OR extend end time to(only creator) an exiting lock-up, and exit OR re-create when it expired.
4. increase amount does not change vDF/DF exchange rate, extend end time increase vDF/DF exchange rate, up to 1.
5. lock-up expired wouldn't effect voting power and gaining reward, that means in this situation, vDF balance wouldn't change.
6. exit vDF will exit reward strategy and lost voting power
### Eg:
- Increase Staking Amount:
Alice stakes 100 DF for 4 years, she will get: `vDF_Amount = 100 * 4/4 = 100 vDF`, before reaching the endtime, stakes 50 DF again, she will get `vDF_Amount = 100 + 50 * timeDelta / 4`
(*timeDelta=endtime-currentTime*)
- Extend Staking Peroid:
Bob stakes 100 DF for 1 years, he will get: `vDF_Amount = 100 * 1/4 = 25 vDF`, before reaching the endtime, increases the locked time to 2 years, he will get `vDF_Amount = 25 + 100 * timeDelta / 4`
(*timeDelta=newEndtime-currentEndTime*)
### Features
#### vDF
- [ ] ERC20 compliant functions
- [ ] `COMP` functions: delegate / vote
- [ ] create lock-up
- [ ] increase amount of existing lock-up
- [ ] extend end time of existing lock-up
- [ ] exit lock-up
#### Staking
- [ ] deposit
- [ ] withdraw
- [ ] claim
- [ ] exit
#### System
- [ ] *monitor system incomes to control reward rate per block ???*
### Reference
- veCrv: https://etherscan.io/address/0x5f3b5dfeb7b28cdbd7faba78963ee202a494e2a2
## 2. on-chain Governance
1. vDF voting
2. multi-signer emergency executing proposal
3. guardian (only engage to cancel malicious proposal)
## 3. PDLP
### 3.1 Direct Liquidity (DL)

### 3.2 Cross Liquidity (CL)

### 3.3 Bridge Liquidity (BL)

## 4. Protocol Owned Operator (POO)
operator holds DF => mint USX by demands => buy back DF => supply liquidity(USX/DF)
(Eg: Uniswap V2 on Mainnet)

*liquidity bond*, allow user buy DF by LP or stablecoin with a discount (vDF holder with bigger discount, maybe!)
## 5. OHM like protocol to boot strap Lending

## 6. DF/USX Price Peg

### Reference
- safeMoon Token: https://github.com/safemoonprotocol/Safemoon.sol/blob/main/Safemoon.sol