Margin Account
Last updated
Last updated
A Margin Account is an isolated Margin contract that contains both the user funds and the borrowed funds. It functions much like a decentralized finance (DeFi) wallet where you not only keep positions, but can also program it the way you want. The Margin Account remains under the ownership of the User/Borrower, but withdrawing funds isn't as straightforward due to predefined rules within the Margin Account. The Margin Account allows traders to execute trading strategies across derivatives options, and futures markets seamlessly. so all the operations go through this account At its core, the Margin Account acts as a central hub where Users/Borrower can pool their assets and access leverage without the need for traditional intermediaries like KYC or Credit Score. It provides borrowers with the flexibility to borrow capital against their undercollateralized position which they provide as collateral in SamrtAccount and engage in leveraged trading.
The "deposit" function transfers a specified amount of tokens from the owner to the Margin Account. These tokens must be allowed by the contract. The deposited amount serves as the user's initial margin, acting as a security deposit.
The "borrow" function allows users to borrow undercollateralized funds from passive lenders' liquidity. It transfers a specified amount of tokens from the liquidity pool to the Margin Account. Before borrowing, the function checks that the account will remain healthy after the borrowing operation; otherwise, borrowing is not permitted. Additionally, it verifies that the borrowed assets have sufficient liquidity within the liquidity pool.
The "repay" function transfers a specified amount of tokens from the Margin Account to the liquidity pool. This amount should cover the borrowed amount plus any accrued interest.
The "withdraw" function allows users to retrieve their initial deposit along with any profit or loss generated from their trading strategy. It transfers a specified amount of tokens from the Margin Account to the owner's account. Users can withdraw at any time, but they must ensure that the account remains healthy after the withdrawal.
Vanna implements an interest rate model where borrowers pay interest to Vanna's liquidity providers (LPs). The interest rate calculation in Vanna follows a formula that ensures fair compensation for LPs while maintaining an attractive borrowing environment for users.
The interest rate is determined based on several factors, including the supply and demand dynamics within the platform, the utilization rate of assets in the liquidity pool, and prevailing market conditions.
Util is the utilization ratio calculated as described below.
Where:
Total Borrowed is the total amount of funds borrowed by all users from the liquidity pool.
Total Liquidity is the total amount of unborrowed funds available in the liquidity pool.
, and are constants that are predefined within the Vanna platform to shape the interest rate curve.