Xeon Protocol
  • 🪐Welcome to Xeon
    • Introduction
    • Challenges
    • Mission
    • Ecosystem
    • Products
  • ✨OTC Tools
    • Features
    • Equity Swaps
    • Call Options
    • Put Options
  • 💻How It Works
    • Use Cases
    • Quick Guide
    • What Happened
    • P/L Calculations
  • 🔓Staking NEON
    • How to Stake
    • Assignments
    • Rewards
  • 🌾Real Yield
    • Protocol Income
    • Yield Farming
    • Farming Pools
    • Native Hedge Liquidity
    • Native Loan Collateral
  • 👨‍🌾EARN WITH US
    • How to Earn
    • Hedge Mining
  • ☄️Fees
    • Model
    • Cashier Fees
    • Settlement Fees
  • ⚡Costing and Valuation
    • Highlights
    • Value in Pair Currency
    • Underlying Value
  • 💸ERC20 Hedging
    • Traditional Hedging
    • Blockchain Hedging
    • Neon Hedging Model
    • Traditional Costing Models
      • Binomial VS Monte Carlo
      • Binomial Model
      • Costing Example
      • Conclusion
    • Neon Costing Model
    • Writing Approach
    • Settlement
  • 🪶ERC20 Lending
    • Crypto Lending
    • Neon Lending Model
    • Neon Valuation Model
    • Writing Approach
    • Settlement
  • ⚙️Mechanics
    • ERC20 Vault Model
    • ERC20 Deposit/Withdraw
    • getPairAddress
    • Underlying Value
    • Write
    • Buy
    • Topup
    • Zap
    • Settlement
    • Mining
    • LockedInUse
    • 🧑‍🚀Development
      • Page 1
Powered by GitBook
On this page
  • Types of deals to write:
  • Writing conditions:
  • writeHedge Function

Was this helpful?

  1. Mechanics

Write

Creating a OTC deal using deposited token balance

PreviousUnderlying ValueNextBuy

Last updated 1 year ago

Was this helpful?

To write a hedge the msg.sender must have a sufficient balance of the tokens being hedged, under the userBalanceMap[msg.sender] storage.

All deals on our platform are collateralized fully by both parties, amounts and type of collateral to be put up for each deal depend on the type of hedge.

Types of deals to write:

  • Call Option

  • Put Option

  • Equity Swap

  • Loan Request

Writing a deal (hedge or loan) utilizes the lockedinuse storage under userBalanceMap[msg.sender] as described in the below topic.

Writing conditions:

  • Every deal has to have underlying assets, these are the tokens being hedged or loaned.

  • Hedge writer always has to provide collateral, thus the payoff (if any) to the taker is always in underlying assets.

  • Hedge taker collateral type is determined by the type of deal. Options taker collateral is asked in the form of underlying tokens paired currency. Swap taker collateral is asked in the form of underlying tokens being hedged.

  • Premium or cost must be stipulated, depending on the type of deal the currency of the premium is determined automatically and fixed.

  • A duration must be stipulated, which is the lifespan of the deal being written, and should be a value > block.timestamp.

writeHedge Function

This function is unified to handle the writing of all hedge types (options and swaps) and will also handle loan request writing.

All deals written have an incrementing global ID counter to avoid same storage saving in the mapping hedgeMap.

Two helper functions are used in the process getWithdrawableBalance to check if writer has sufficient balance, and getUnderlyingValue to determine the startValue of the deal in its paired currency.

All inputs should meet requirement and if successful, a hedgeCreated event is emitted to signify the writing of the deal.

Currently the writeHedge function only supports a single token type as the underlying asset of collateral for a deal, in future equity swaps and loans will have the capability to bundle a group of tokens into a basket of underlying assets for a deal.

⚙️
LockedInUse