Fund Pool

TreasuryVault is used for managing liquidity funds, including deposits, certificate minting, certificate burning, and debt investment management. Users can mint Yield Token and Position Token...

TreasuryVault is used for managing liquidity funds, including deposits, certificate minting, certificate burning, and debt investment management. Users can mint Yield Token and Position Token by depositing Native-Tokens such as ETH or BNB on the corresponding public blockchain. They can also redeem corresponding liquidity assets by burning the certificates whenever needed.

Contract Functions:

  • Increase Liquidity and Certificate Minting: Users can mint Yield Tokens and Position Tokens by adding liquidity in Native-Tokens such as ETH or BNB on the corresponding public blockchain. For example, 1 ETH could mint 500 Yield Tokens and 500 Position Tokens, or 1 ETH could mint 1000 Position Tokens.

  • Redeem Liquidity: Users can redeem liquidity by burning corresponding amounts of Yield Tokens and Position Tokens from the contract. For example, redeeming 500 Position Tokens and 500 Yield Tokens could yield 1 ETH.

  • Debt Management: The "Cheque Contract" can access funds within the contract based on financing permissions.

  • Repayment Management: The "Cheque Contract" can execute repayment operations through distribution modes to recover debt funds from the contract.

Certificate Usage Scenarios:

  • Position Token (PT): Minted by providing liquidity assets, Alpha Voucher utilizes Position Tokens for decision-making proofs, verifying project financing cheques, and incentivizing investments based on guarantees or quantified proofs. Beta Miners can lend Position Tokens to Alpha Voucher on platforms like Uniswap to earn additional liquidity rewards.

  • Yield Token (YT): Beta Miners stake Yield Tokens to earn farming rewards. These rewards originate from the "interest" and dividends generated by Position Token business activities.

Contract Variables:

  • sellFee: Fee percentage when destroying certificates, default is disabled.

  • buyFee: Fee percentage when minting certificates, default is disabled.

  • feeTo: Address to receive fee income, used in conjunction with fees when enabled.

  • totalDebt: Total accumulated debt amount.

  • totalRepay: Total accumulated repayment amount.

  • PToken: Address of the Position Token.

  • YToken: Address of the Yield Token.

  • BaseRate: Base exchange rate for conversions, e.g., ETH to Position Token and Yield Token.

  • totalDeposit: Accumulated liquidity added.

  • totalWithdraw: Accumulated amount withdrawn for debt.

Events:

  • Deposit: Triggered when a user adds liquidity and mints certificates.

  • Withdrawal: Triggered when a user burns certificates and withdraws liquidity.

  • Borrow: Triggered when the "cheque contract" executes a borrowing operation.

  • Repayment: Triggered when the "cheque contract" executes a repayment operation.

Function:

  • initialize(address _ptoken, address _ytoken): Initializes the contract by setting the addresses of the Position Token (PT) and Yield Token (YT).

  • deposit(uint8 _type): Allows a user to deposit ETH and mint Position Token (PT) and Yield Token (YT) based on the _type parameter. For _type equal to 1, mints 500 YT and 500 PT; for _type equal to 2, mints 1000 PT.

  • withdraw(uint wad): Allows a user to burn a corresponding amount of YT and PT to withdraw wad amount of liquidity. For example, wad * 500 PT + wad * 500 YT = 1 ETH.

  • borrow(uint256 _amount): Allows the "cheque contract" to borrow financing funds from the contract based on the legitimate rights amount.

  • repayment(): Allows the "cheque contract" to execute a repayment operation, reclaiming liquidity funds from the contract.

  • updateSellFee(uint256 _sellFee): Updates the fee percentage for selling certificates.

  • updateBuyFee(uint256 _buyFee): Updates the fee percentage for buying certificates.

  • updateFeeTo(address _feeTo): Updates the address where fee income is received.

  • updatePT(address _pt): Updates the address of the Position Token contract.

  • updateYT(address _yt): Updates the address of the Yield Token contract.

  • updateBaseRate(uint256 _base): Updates the base exchange rate for conversion, such as ETH to Position Token and Yield Token.

  • totalSupply(): Returns the total supply of the contract.

  • balance(): Returns the liquidity balance of the contract.

Safety and Upgradability

Utilize the SafeMath library to prevent integer overflow.

Interface


/// SPDX-License-Identifier: MIT
pragma solidity >=0.8.12;

interface ISETH {
    /**
     * Event emitted when a user deposits.
     * @param from The address of the depositor.
     * @param value The amount deposited.
     */
    event Deposit(address indexed from, uint value);

    /**
     * Event emitted when a user withdraws.
     * @param from The address of the withdrawer.
     * @param value The amount withdrawn.
     */
    event Withdrawal(address indexed from, uint value);

    /**
     * Allows users to deposit ETH and mint YT or PT tokens.
     * @param _type The minting type: 
     *              1: 1 ETH = 500 YT + 500 PT, 
     *              2: 1 ETH = 1000 PT
     */
    function deposit(uint8 _type) external payable;

    /**
     * Withdraws ETH by burning 500 YT + 500 PT tokens.
     * @param wad The amount to withdraw.
     * @notice Supports fees; no need to authorize YT and PT, only asset verification is required.
     */
    function withdraw(uint wad) external;

    /**
     * Returns the sell/unlock fee.
     * @return The amount of the fee.
     */
    function sellFee() external view returns (uint256);

    /**
     * Returns the buy/stake fee.
     * @return The amount of the fee.
     */
    function buyFee() external view returns (uint256);

    /**
     * Returns the fee address.
     * @return The address that receives the fees.
     */
    function feeTo() external view returns (address);

    /**
     * Sets the percentage fee for selling/unlocking, as an integer percentage where 1 equals 1%.
     * @param _fee The percentage fee.
     */
    function updateSellFee(uint256 _fee) external;

    /**
     * Sets the percentage fee for buying/staking, as an integer percentage where 1 equals 1%.
     * @param _fee The percentage fee.
     */
    function updateBuyFee(uint256 _fee) external;

    /**
     * Sets the fee address.
     * @param _to The new address to receive fees.
     */
    function updateFeeTo(address _to) external;

    /**
     * Updates the PT token address.
     * @param _pt The new PT token address.
     */
    function updatePT(address _pt) external;

    /**
     * Updates the YT token address.
     * @param _yt The new YT token address.
     */
    function updateYT(address _yt) external;

    /**
     * Updates the base interest rate.
     * @param _base The new base interest rate.
     */
    function updateBaseRate(uint256 _base) external;

    // -------------- Contract operations

    /**
     * Manages the withdrawal address.
     * @param _amount The amount to withdraw.
     */
    function borrow(uint256 _amount) external;
}

Last updated