Git Product home page Git Product logo

squeeth-vol-oracle's Introduction

Squeeth Vol Oracle

squeeth

Built with foundry template

Deployments

The contract is deployed on Goerli and Mainnet:

Chain Address
Mainnet 0x5caec004f1378fbfd54a11e9f00e2aad32796b33
Goerli 0x5caec004f1378fbfd54a11e9f00e2aad32796b33

Using the contract

You can use cast to directly query the value as follow (mainnet rpc example):

cast call 0x5caec004f1378fbfd54a11e9f00e2aad32796b33  "getEthTwaIV(uint32)(uint256)" 120 --rpc-url https://rpc.ankr.com/eth

Development

Getting Started

Compile and run tests

forge build

forge test

Estimation

You can clone the contract, tune in a bit and use the following script to estimate real world vol value.

forge script scripts/Deploy.sol --fork-url <mainnet rpc>

Output:

== Logs ==
  implied volatility: 959347350657613352
  gas cost:           97612
  implied funding:    2521499559489813

Gas Cost

The gas cost is around 46K ~ 140K, depends on:

  • secondsAgo to calculate twap
  • current state of Uniswap pool, how many records are in the last secondsAgo seconds

It costs least (around 46K) while querying the implied vol by the current spot price.

Contract Interface

/// @dev return implied vol with 18 decimals (1e18 = 100%)
function getEthTwaIV(uint256 secondsAgo) external view returns (uint256 vol);

/// @dev return daily implied funding with 18 decimals (1e18 = 100%)
function getImpliedFunding(uint32 secondsAgo) external view returns (uint256 impliedFunding);

squeeth-vol-oracle's People

Contributors

antoncoding avatar gakonst avatar transmissions11 avatar mds1 avatar tarrencev avatar onbjerg avatar odyslam avatar gg2001 avatar xmxanuel avatar ncitron avatar patrickalphac avatar samwilsn avatar 0xruhum avatar sambacha avatar

Stargazers

namikaze avatar nikhil avatar bloc13k avatar eth_sign avatar Javed Khan avatar clandestine.eth avatar Yahsin avatar wiasliaw avatar chiny avatar Bakuchi avatar Ben Burns avatar Security.eth avatar  avatar Lungoupao Khongsai avatar Michael Demarais avatar John Johnson avatar Koda avatar Haythem Sellami avatar Brett Henderson avatar sudo rm -rf --no-preserve-root / avatar Shun Kakinoki avatar Nick Beattie avatar Etch avatar  avatar Dan avatar

Watchers

James Cloos avatar Michael Demarais avatar  avatar  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.