📖
IG On Arbitrum
  • Smilee On Arbitrum
  • Past & Present
    • Smilee v0
    • Smilee v1
    • Smilee v1.69 (current)
  • IMPERMANENT GAIN
    • What are Options?
    • Impermanent Loss & Options
    • Understanding Delta Hedging
    • 📈Trade
      • User Guide
      • Bull, Bear, Smile
      • Initial Price, Breakeven, Expiry
      • Impermanent Gain Pricing
      • Impermanent Gain vs. Vanilla Options
    • 💰Earn
      • User Guide
      • Payoff, APY & Performance
      • Volatility vs Volume
  • Protocol Design
    • Overview
    • DVPs
    • Vaults
    • Liquidity-to-Volatility Engine
    • Synthetic AMM
    • Delta Hedging
    • Maturities & Epochs
    • Fees
    • Oracles & Risks
    • Decentralization Roadmap
  • RESOURCES
    • Smilee FAQs
    • Smart Contracts
    • Media Kit
    • Audits
    • Bug Bounties
  • Developer Documentation
    • Introduction
    • How to Execute a Trade
    • Retrieving DVP Data
    • Read Value of an IG Position
Powered by GitBook
On this page
  1. Developer Documentation

Read Value of an IG Position

To check the state of your positions within a DVP, you can use PositionManager.positionDetail(tokenID) method for looking at the state of the position.

PositionManger is a ERC721Enumerable so you can easily retrieve your position.

// Instantiate the AddressProvider
AddressProvider addressProvider = AddressProvider(0x);
PositionManager posManager = PositionManager(addressProvider.positionManager());

// Get how many token you have.
uint256 balanceOfMyPosition = posManager.balanceOf(myAddress);
// Iterate through all your position and get the position details:
uint256 i = 0;
for (i = 0; i < balanceOfMyPosition; i++) {
	uint256 tokenID = posManager.tokenOfOwnerByIndex(myAddress, i);
	PositionDetail memory positionDetail = posManager.positionDetail(tokenID);
	// The current value of the position (premium at which you can sell / payoff if rexpired). It returns also an estimation of the fee.
	uint256 currentPayoff = dvp.payoff(positionDetail.expiry, positionDetail.strike, positionDetail.notionalUp, positionDetail.notionalDown)
}

/*
posManager.positionDetail(uint256) returns the following struct:
struct PositionDetail {
    address dvpAddr; // DVP associated with the position
    address baseToken; // BaseToken address
    address sideToken; // SideToken address
    uint256 dvpFreq; // DVP maturity frequency in seconds
    bool dvpType; // At the moment only "Impermanent Gain" has been implemented, so it returns always IG
    uint256 strike; // Strike of the position
    uint256 expiry; // Time of expiry of the position
    uint256 premium; // Premium paid including fees
    uint256 leverage; // Leverage of the position
    uint256 notionalUp; // Notional of the position, for Bull Impermanent Gain
    uint256 notionalDown; // Notional of the position, for Bear Impermanent Gain
    // Positions can have both notionalUp and notionalDown > 0 (Smile Impermanent Gain). Please note that only symmetrical positions are accepted 
    uint256 cumulatedPayoff; // Payoff already received due to previus reductions in the size of the position
}
*/
PreviousRetrieving DVP Data

Last updated 1 year ago