Coder Social home page Coder Social logo

ampo's Introduction

Auction-managed perpetual options

A proof-of-concept Uniswap V4 hook that lets users trade perpetual options.

Overview

All functionality is built into a single hook contract in src/AmpoHook.sol. Unit tests are in test/AmpoHook.t.sol.

The main public methods in the AmpoHook contract:

bid(): Called by potential managers to place bids

deposit(), withdraw(): Deposit or withdraw collateral from contract. Collateral is used to pay rent or funding

modifyLiquidity(): Deposit or withdraw liquidity in underlying pool

setFundingRate(): Called by manager to change funding rate

modifyOptionsPosition(): Called by traders to open or close options positions

Mechanism

Perpetual options are options that never expire and can be exercised at any point in the future. They can be synthetically constructed by borrowing a narrow Uniswap concentrated liquidity position and withdrawing the tokens inside it. Users with an open perpetual options position pay funding each block, analogous to funding on perpetual futures.

The pricing of these options is auction-managed. A continuous auction is run where anyone can place bids and modify their bids at any time. The current highest bidder is called the manager. The manager pays their bid amount, called rent, each block to LPs. In return, they get to set the funding rate for options holders and receive funding from all options positions as well as LP fees from all swaps.

In summary:

  • Managers pay rent to LPs each block
  • Managers receive funding from options holders each block
  • Managers receive LP fees each swap

Managers are therefore able to make a profit if they can set the funding in a smart way, not too low which leaves potential income on the table and not too high which discourages users from buying and holding options. They are incentivized to come up with better ways to calculate the best funding in order to maximise their profit and be able to bid more in the manager auction. With a set of competitive managers who are constantly trying to outbid each other, the system should be able to find the best funding rate for options holders and most of the potential revenue should flow to LPs.

Usage

Build

$ forge build

Test

$ forge test

ampo's People

Contributors

mxwtnb avatar

Stargazers

Easy Rider avatar cryptoma20 avatar  avatar steven avatar Michael Demarais avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.