Unless otherwise indicated, the ZBond contract only deals with ERC-20s. Currently, we support WETH only.
Supplying WETH
Users can deposit WETH to the ZBond contracts of their choice. Because of our unique risk management system, the supplied WETH is covered by the provisioning pool funds. Users who deposit WETH to the ZBond contract receive a bond-like ERC-721 that contains the following information:
// @notice Container for supply balance informationstructSupplySnapshot {uint256 principalSupply; // the principle deposit uint256 startDate; // the start date of the deposituint256 virtualBalance; // see below}
Users can immediately start to receive part of the interest payment from the borrowers by depositing. The depositor receives interest payment by a ratio correlating to the length of their deposits: portion of the interest=270 daysdeposit duration. After depositing for 270 days, the depositor receives the entire portion of the interest payment they deserve.
To supply WETH:
// @notice A caller can deposit underlying tokens into ZBond and receive a ZBond Nft// @param amount The amount of underlying tokens the caller would like to deposit// @return The ZBond NFT tokenId minted for this depositfunctionmint(uint256 amount) externaloverridenonReentrantreturns (uint256 tokenId)
Redeeming WETH
In the normal ZBond pool, user can redeem their WETH at any time.
To redeem WETH:
// @notice A caller can redeem his deposit from the ZBond by burning multiple ZBond Nft, until reaching a specified balance to burn
// @param tokenIds The ZBonds tokenIds that the caller would like to redeem// @param totalRedeemedUnderlyingAmount The target underlying amount to redeemfunction redeem(uint256[] calldata tokenIds, uint256 totalRedeemedUnderlyingAmount) external override nonReentrant returns (uint256)
Helper functions
A couple of helper view functions are useful in checking the balance that the contract owes to specific addresses.
// @notice Gets the tokenURI of a specified ZBond nft tokenId// @return The ZBond Nft metadatafunctiontokenURI(uint256_tokenId) publicviewoverridereturns (stringmemory)// @noticeGetstheratebetweenthetotalsupplyofZBondToken: totalSupply// @returnTheexchangerateofthevirtualbalancevsunderlyingfunctiongetExchangeRateMantissa() publicviewoverridereturns (uint256)// @noticeAcallergetshowmuchWETH// @paramtokenIdsTheZBondtokenIdsthatthecallerwouldliketoquery// @returnTheamountofWETHthatcanberedeemedfromtheseZBondsfunctionredeemable(uint256[] calldatatokenIds) publicviewoverridereturns (uint256)