- Run the
npm i
- Run the
npx hardhat compile
command to compile the smart contracts - Run the
npx hardhat test
One strategy includes two contracts: Logic and Storage.
Provides manage depositors tokens ability to admin (oracle) strategy
- E1 - Cannot accept
- E2 - vTokens is not used
- E3 - swap is not used
- E4 - swapMaster is not used
- E5 - vToken is not used
- E6 - blid is already set
- E7 - storage is already set
- E11 - BLID deposit amount should be less
- E12 - withdraw BLID amount less than balance
- E13 - BlidPerBlock should be less
- E14 - Sender is not AccumulatedDepositor
- E15 - LeaveTokenLimit should be increased all the time
This contract is upgradable. Interacts with users, distributes earned BLID, and associates with Logic contract.
- E1 - token is not used
- E2 - is not logicContract
- E3 - Need more amount need than zero
- E4 - Withdraw amount exceeds balance
- E5 - Contracrt hasn't enough for interest fee, please contact the administrator
- E6 - token is already added
- E7 - You can call updateAccumulatedRewardsPerShare one time for token
This contract is UUPS upgradeable, provides cross-chain token deposit.
- CD1 - Token should be added via addStargateToken()
- CD2 - Token address should not be address(0)
- CD3 - Token as been added already
- CD4 - AccumulateDepositor should be added
- CD5 - Some eth is required
- CD6 - Deposit amout should be > 0
- CD7 - Transaction gas fee is too small
- CD8 - AccumulateDepositor has been added already
This contract is UUPS upgradeable, provides cross-chain token accept and associates with Storage contract.
- AD1 - Storage contract has been added already
- AD2 - Token should be added via addStargateToken()
- AD3 - Token address should not be address(0)
- AD4 - Token as been added already
- AD5 - Only StargateRouter can call sgReceive() method
Bolide Low risk Strategy distribute all earned income once X hours (often it is about 6 times a day). Users can deposit their assets and withdraw at any moment regardless of distribution schedule. To support it Bolide’s strategies use following algorithm
Let’s say we have:
- User 1 (U1) at time moment 1 (T1) deposited 2 USD (A1)
- User 2 (U2) at moment 2 (T2) deposited 2 USD (A2)
- The strategy made rewards distribution at moment 3 (t3) with 1 BLID distribution (B1)
The goal is to make an honest distribution 1 BLID between 2 users, the amounts of rewards should depend on the time before distribution and amount of users deposit.
Let's say “Dollar Time” means the amount of deposit multiplied to the time between deposit and distribution
For example
Then “Total Dollar time“
Then “Dollar Time Distribution” means how much BLID should be distributed per 1 DollarTime.
For our example
Or we can calculate DollarTimeDistribution as follows
$$\small DollarTimeDistribution(T) = \frac{B}{\sum_iAiT-\sum_iAiTi}$$
Then
After that, we can calculate user’s rewards as follows
So we have
It's obvious that if user withdraw some amount of deposit than we should use Ai with “-” sign in all calculations.
So the final formula is