⛓️Internals and Architecture

This outlines the high-level system architecture for our platform that facilitates user borrowing through CDPs with dynamic and fixed collateralization options. The platform leverages a governance token (smUSD) to empower stakeholders in crucial decision-making processes.

User Borrowing:

  • The user interacts with the deposit function on the Archway Vault smart contract.

  • The contract dynamically calculates the collateralization/interest ratio based on the user's selection:

    • Dynamic Interest Collateral: A pre-defined mathematical model assesses asset volatility and demand to determine the required collateral amount for the desired loan size.

    • Fixed Interest Collateral: A pre-set fixed collateralization/interest ratio is applied to the loan size to determine the collateral requirement.

  • The contract validates if the deposited collateral meets or surpasses the calculated minimum.

  • Upon successful verification, a new CDP data structure is created within the system, encapsulating:

    • User address

    • Deposited collateral details (amount and type)

    • Borrowed asset details (amount and type)

    • Real-time collateralization ratio

    • Loan status (active or liquidated)

  • The borrowed asset is minted or transferred to the user's account, initiating the loan.

Interest and Rewards:

  • A portion of the borrower's interest payments are allocated as staking rewards, incentivizing platform participation.

  • Users who stake their assets on the platform are rewarded with smUSD tokens, the platform's governance token.

Liquidation Module:

  • The liquidation module continuously monitors the health of all active CDPs by tracking their collateralization ratios.

  • Liquidation Trigger: If a CDP's collateralization ratio falls below the liquidation threshold due to a decrease in collateral value or missed interest payments, the liquidation module is automatically triggered.

  • Liquidation Auction: A smart contract auction is initiated to sell the collateral associated with the liquidated CDP.

  • Debt Repayment: The proceeds from the auction are used to repay the outstanding loan amount, including accrued interest, to the lender.

  • Surplus Funds: Any remaining funds after debt repayment are returned to the liquidated CDP owner, mitigating potential losses beyond their loan default.

User Withdrawal:

  • The user initiates a withdrawal request through the platform's interface.

  • The smart contract calculates the minimum collateral requirement to uphold the user's CDP health after the withdrawal.

  • Partial Withdrawal: If the remaining collateral surpasses the minimum requirement, the user can withdraw a portion of their collateral. The withdrawn amount and remaining collateral balance are reflected in the user's CDP data structure.

  • Full Withdrawal (Payoff): To fully withdraw their collateral, the user must first repay the entire loan amount along with accrued interest. Upon successful repayment, the user's CDP is closed, and the deposited collateral is returned.

  • Liquidation Protection: Withdrawal requests are restricted if they cause the CDP's collateralization ratio to fall below a pre-defined liquidation threshold. This threshold acts as a safeguard to prevent cascading loan defaults and ensures platform stability.

Governance:

  • The platform operates on a cyclical governance process (e.g., weekly).

  • smUSD token holders are empowered to participate in the governance process.

  • Base Collateral Ratio Adjustment: Proposals can be submitted to adjust the base collateralization ratio for dynamic CDPs. This ratio acts as a minimum threshold for dynamic collateral calculations, ensuring platform stability.

  • Loan Re-Auction: In the event of loan default (failure to meet interest payments), proposals can be submitted to re-auction the collateral associated with the defaulted CDP. This allows the platform to recover the outstanding loan balance and mitigate risk for other users.

  • Voting Process: smUSD token holders can vote on submitted proposals. Voting power is directly proportional to the amount of smUSD tokens staked by a user (weighted voting). Proposals that garner a pre-defined consensus threshold within the governance cycle are implemented.

Main Contracts:

  1. Staking Contract: Provides staking rewards on the deposited collateral in the form of smUSD, the governance token.

  2. Vault Contract: Manages the stablecoins given back when Archway tokens (ARCH) are submitted and calculates the collateralization ratios.

  3. Governance Contract: Manages all voting propositions and governance processes.

This high-level architecture provides a foundation for a secure and decentralized lending platform with dynamic and fixed fee loan options, fostering user participation through a robust governance mechanism.

Last updated