Supplying WETH (Flexible duration)

ZBond Contract
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 information
struct SupplySnapshot {
uint256 principalSupply; // the principle deposit
uint256 startDate; // the start date of the deposit
uint256 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=deposit duration270 days\text{portion of the interest} = \frac{\text{deposit duration}}{270 \text{ days}}
. 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 deposit
function mint(uint256 amount) external override nonReentrant returns (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 redeem
function 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 metadata
function tokenURI(uint256 _tokenId) public view override returns (string memory)
// @notice Gets the rate between the total supply of ZBondToken: totalSupply
// @return The exchange rate of the virtual balance vs underlying
function getExchangeRateMantissa() public view override returns (uint256)
// @notice A caller gets how much WETH
// @param tokenIds The ZBond tokenIds that the caller would like to query
// @return The amount of WETH that can be redeemed from these ZBonds
function redeemable(uint256[] calldata tokenIds) public view override returns (uint256)