Vanna Finance
  • Overview
  • Protocol overview
    • Earn
    • Margin Account
    • Strategy
      • Strategy Example(Future and Spot)
      • Strategy Example with Option Protocol
      • With Option, Future, and Spot Protocol
    • Prop DashBord
    • Risk Management
  • Vanna WhitePaper
  • Protocol Fees
  • Security
  • Link Tree
Powered by GitBook
On this page
  • Introduction
  • Open and close Account
  • Deposit
  • Borrow
  • Repay
  • Withdraw
  • Borrow Interest Rate
  1. Protocol overview

Margin Account

PreviousEarnNextStrategy

Last updated 9 months ago

Introduction

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.

Open and close Account

The Margin Account serves as the entry and exit point for borrowers. When opening an account, it mints a predefined contract whose ownership remains with the borrower. Upon closing, the account becomes a zero address, also Borrowers/users can only close their Margin Account if there is no outstanding debt associated with it. while closing the account Deposited amounts are directly swapped to the borrower's (EOA) address. Users have the flexibility to open and close multiple accounts as needed.

Deposit

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.

Borrow

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.

Repay

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.

Withdraw

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.

Borrow Interest Rate

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.

In this formula:

  • c1c1c1, c2c2c2and c3c3c3 are constants that are predefined within the Vanna platform to shape the interest rate curve.

  • Util is the utilization ratio calculated as described below.

Utilization Ratio

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.