Smart Contract Overview
Last updated
Last updated
Assets Deposit Contract: The Deposit Contract manages the deposit and withdrawal of collateral assets tokens, coordinating the minting and burning of xUSD stablecoins.
On-chain USD Deposit Functionality: Deposits USDC or USDT into the deposit contract on L1 and mints an equivalent amount of xUSD at a 1:1 ratio on L2.
Collateral Deposit Functionality: Deposits on-chain assets like BNB, WBTC, or stETH into the corresponding contract on L2 as collateral and mints xUSD in the appropriate ratio.
Withdrawal Functionality: Burns xUSD tokens on Layer 2 and redeems USDC, USDT, or other on-chain assets.
Security Features: Implements features like reentrancy guards to prevent recursive calls and role-based access control to restrict sensitive operations.
Oracle Integration Contract: This contract interacts with external oracle services to fetch current exchange rates for USDT/USDC to xUSD conversions.
Rate Fetching: Periodically retrieves and stores exchange rates from a decentralized network of trusted oracles.
Rate Update Mechanism: Incorporates mechanisms to update the exchange rate securely and timely, preventing outdated or incorrect data from affecting the system.
Governance Contract: The Governance Contract manages protocol rule changes and parameter updates, allowing X token holders to vote on important decisions.
$veX Distribution: Lock X tokens to get $veX (voting escrowed X tokens) for a specified period, which grant voting power in the governance system. $veX is not transferable and can only be used for voting.
Proposal Submission: Stakeholders can submit proposals for changes or upgrades to the protocol, once they have enough $veX tokens.
Voting system: Allows stakeholders to submit and vote on proposals for changes or upgrades to the protocol using their $veX tokens. The voting power is weighted by the amount of $veX held.
Liquidity and Rewards Contract: This contract facilitates the distribution of rewards and manages the liquidity pools that support xUSD’s stability and usability.
Reward Distribution: Distributes rewards to xUSD holders (stakers) from OTC deal fees within the xMoney framework, and collateral-related fees from the collateral assets.
Liquidity Provisioning: Manages interactions with decentralized finance platforms to ensure equivalent liquidity for USD and USDC/USDT assets backing xUSD.
By integrating these technical components, X Finance establishes a robust and efficient financial ecosystem. This architecture not only enhances the usability and accessibility of financial services but also ensures security, transparency, and scalability.