Protocol Algorithm Design
Last updated
Last updated
BoC provides USD Stablecoins Farming and ETH Farming.
“Deposit” - The BoC protocol supports users with the deposit
function - to deposit the three major stablecoins (USDT, USDC, DAI) in any desired combination and amount. BoC also allows minting of USDi of the corresponding value to be returned to the user.
“Withdraw” - Users can withdraw
USDi which consists of the three major stablecoins at their convenience through the BoC protocol. By default, they will be returned according to the proportion of the three major stablecoins in the Vault at that time, or they can specify a certain currency to be returned.
After the Vault receives the stablecoin, queryTokenPrice
queries the price of the user's transfer of the stablecoin through an external oracle. Token prices follow the prices provided by the oracle.
Based on the calculated value, mint/burn
will mint/burn an equivalent value of USDi tickets.
The Keeper module reaches the trigger condition doHardWork
and triggers doHardWork
.
After the Keeper trigger doHardWork
the vault allocates the funds and exchanges the USDi tickets (burn) for USDi (mint).
Vault calls the aggregate exchange module swapTokenToWants
.
The aggregated exchange module swapTokens
completes the exchange.
Vault receives the targetted currency exchanged by the aggregate exchange module.
Vault puts stablecoin deposits
into the strategy according to the currency required by the strategy.
The strategy invests stablecoin deposits
into third-party protocols.
The Keeper module reaches the harvest
trigger condition and triggers the harvest
.
Harvester triggers each strategy to execute harvest
.
Each strategy executes claimRewards
to collect mining.
Each strategy transfers mining coins transferRewards
to Harvester.
Harvester sells miners sellRewards
into stablecoins through the aggregated exchange.
Harvester sendProfitToVault
transfers stablecoins into Vault.
The Keeper module reaches the rebase
trigger condition and triggers the rebase
.
Vault calls changeTotalSupply
to issue additional USDi.
Vault collects 20% of the yield, which is transferred to the Treasury
.
The treasury will benefit users by using buyback
to repurchase the BoC governance token.
Note:
The rewards (mining coins) will be swapped into USDT, and this could be changed (controlled) by the Keeper, which means the token to sell will be determined manually.
The collateral of USD stablecoins is USDi, whereas that of ETH is called ETHi.
In general, the mechanism of ETH farming is almost the same as that of the USD stablecoins farming. However, there are still slight differences as listed below:
The Harvest mechanism of ETHi farming is slightly different; harvest and reallocations are not carried out uniformly by Harvester (as USDi Farming), instead each strategy is harvest and reallocated individually.
During queryTokenPrice
, all tokens should follow the Chainlink price directly. However for ETHi farming, there will be cases where certain tokens involved are not priced on Chainlink, so instead the 1-hour weighted average price of that token on UniswapV3 TWAP will be used as reference.