Platform: Code4rena
Start Date: 21/10/2021
End Date: 27/10/2021
Period: 7 days
Status: Completed
Reporters: CloudEllie, moneylegobatman
Pot Size: $80,000 ETH
Participants: 15
Reporters: CloudEllie, moneylegobatman
Judge: ghoulsol
Id: 42
League: ETH
Auditor per page
Glossary | |
---|---|
USDM | $1 peg-target stable coin minted through MochiVault |
CSSR | Price feed for getting the price of certain collateral |
Stability Fee | Fee charged per year for minting USDM |
Credit Cap | Max amount of usdm minted for collateral |
Utilization Ratio | ratio of used credit cap (debt generated by collateral / credit cap) |
Long-Tail Assets | assets that have traditionally low liquidity |
Dutch Auction | the bidding starts at the highest asking amount and gets lowered until the winning bid |
Representatives from Mochi.fi will be available in the Code Arena Discord to answer any questions during the contest period. The main focus will be to find bugs, logic errors and vulnerabilities. Another important goal is to find ways to optimise gas costs for users interacting with the protocol and specifically with the Mochi CSSR as outlined here.
Mochi puts your NFTs and long-tail assets to work as collateral while maintaining exposure to their long-term value. An autonomously governed protocol, Mochi bridges the gap between NFTs and DeFi to pioneer a new way to maximize the utility of emerging digital assets.
By using CSSR, Mochi can use any tokens with appropriate liquidity on dexes to enable minting of the USDM stable coin.
MochiVault
. Flash minting is supported. Minting can only be executed through USDMMinter
USDM
can only be minted through this contract. Initially, any vaults deployed through MochiVaultFactory
can execute mint function.MochiVault
, it actually means the action occurs in position. Every action of MochiVault
requires NFT position. NFT minting should only be able through MochiVault
deployed through MochiVaultFactory
.MochiVaultFactory
to reduce deployment cost.notice executing any of the functions below should invoke fee accuration calcualting collateral factor involves CSSR interaction
MochiNFT
which represents the positionliquidate
function. this should be done by, repaying debt on behalf of position and get the collateral. this can only be called through DucthAuctionLiquidator
MochiVault
as template.liquidate
function for vaults. DutchAuctionLiquidator has two steps for liquidation. (1) trigger (2) settle. (1) trigger will start the dutch auction for liquidation, (2) settle will be done through buying out the dutch auction. buyout price is calcualted throught simple linearCSSR is composed of 3 parts (1) router : routes request to appropriate adapter/source to get the price (2) adapter : data processing unit to convert the price for certain token. (ex. uniswapV2LPAdapter is for calculating uniswap v2 lp token price) (3) source: data source for getting the price for token.(ex. uniswap v2 cssr, sushiswap v2 cssr)
float
typeinvalid extension node
while fetching exchange ratio for Ren token(0x408e41876cccdc0f92210600ef50372656052a38) which does not happens on original Keydonix oracleWhat we are currently experiencing is the high gas fee while interacting with our protocol and most of them is related to MochiCSSR
. If collateral token is not supported by chainlink, it should query through UniswapV2CSSR/SushiswapV2CSSR and it requires reconstructing the block merkle patricia trie.
Also, while using the oracle, we are facing issue while querying price data of Ren with Sushi weth <> Ren pool.
for every repository, setup the environment first
cp .env.example .env
and fill the environment variables
ETHERSCAN_API_KEY= MAINNET_RPC_URL= MAINNET_FORK_BLOCK= MAINNET_PRIVATE_KEY= RINKEBY_RPC_URL= RINKEBY_FORK_BLOCK= RINKEBY_PRIVATE_KEY=
mochi-library
$ cd projects/mochi-library $ npm install
mochi-core
$ cd projects/mochi-library $ npm install $ cd ../mochi-core $ npm install
mochi-cssr
$ cd projects/mochi-library $ npm install $ cd ../mochi-cssr $ npm install
npm run test