Vaults
As with other perennial protocols, Fuji uses Vaults to house the collateral (in ETH) which allows anyone to borrow stablecoins.
At the moment Fuji only has the following Vaults:
Vault Name | Action |
ETH/DAI | Provider |
ETH/USDC | Provider |
The following events are emitted to the console when an action is performed in Fuji's smart contract interface:
Code |
|
|
|
|
Deposit
The deposit function transfers an asset into the protocol, which begins accumulating interest based on the protocol where it is deposited. The user receives an equivalent amount of ERC1155 fujiToken representing 1-to-1 the underlying collateral supplied.
msg.sender:
The account shall supply the collateral asset, and own the newly minted Fuji tokens.
_collateralAmount
: The amount of the asset to be supplied, in units of the underlying asset.
RETURN:
0 on success, otherwise an Error code
Before supplying an asset, users must first approve the Fuji tokens to access their token balance. For Vaults where ETH is provided as collateral ensure _collateralAmount
is equal to the value of Ether sent in the transaction.
Withdraw
The withdraw function converts Fuji tokens into a specified quantity of the underlying asset and returns them to the user. The amount withdrawn must be less than the user's neededCollateral
to keep their Vault healthy.
The protocol requires the user to keep their vault's healthy factor from going under the threshold. To withdraw the full amount at the liquidation threshold pass a negative value as an argument.
Borrow
The borrow function transfers an asset from the protocol to the user and creates a borrow balance which begins accumulating interest based on the Borrow Rate for the asset. The amount borrowed must be less than the user's Account Liquidity and the market's available liquidity.
To borrow Ether, the borrower must be 'payable' (solidity).
msg.sender:
The account where the borrowed funds shall be transferred.
_borrowAmount:
The number of Fuji tokens to be borrowed
RETURN:
0 on success, otherwise an Error code
Payback
The payback function transfers an asset into the protocol, reducing the user's borrow balance.
_repayAmount
The amount of ether to be repaid, in wei.
msg.sender:
The account which borrowed the asset, and shall repay the balance.
RETURN:
0 on success, otherwise an Error code
Last updated