{"id":15888281,"url":"https://github.com/antoncoding/squeeth-vol-oracle","last_synced_at":"2025-03-20T10:30:40.603Z","repository":{"id":104220432,"uuid":"525840140","full_name":"antoncoding/squeeth-vol-oracle","owner":"antoncoding","description":"on-chain vol oracle from squeeth","archived":false,"fork":false,"pushed_at":"2022-10-24T07:53:10.000Z","size":197,"stargazers_count":25,"open_issues_count":0,"forks_count":0,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-02-28T23:52:36.057Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Solidity","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/antoncoding.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-08-17T14:55:50.000Z","updated_at":"2023-02-10T09:18:50.000Z","dependencies_parsed_at":null,"dependency_job_id":"e72ec23a-217f-4736-b7b6-8df4908912da","html_url":"https://github.com/antoncoding/squeeth-vol-oracle","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/antoncoding%2Fsqueeth-vol-oracle","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/antoncoding%2Fsqueeth-vol-oracle/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/antoncoding%2Fsqueeth-vol-oracle/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/antoncoding%2Fsqueeth-vol-oracle/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/antoncoding","download_url":"https://codeload.github.com/antoncoding/squeeth-vol-oracle/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244066180,"owners_count":20392406,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-06T06:06:56.884Z","updated_at":"2025-03-20T10:30:40.598Z","avatar_url":"https://github.com/antoncoding.png","language":"Solidity","readme":"\u003cdiv align=\"center\"\u003e\n  \u003ch1 align=\"center\"\u003e Squeeth Vol Oracle\u003c/h1\u003e\n\n\u003cp align='center'\u003e\n    \u003c!-- pics go here --\u003e\n    \u003cimg src='https://i.imgur.com/Qf6Ga0N.jpg' alt='squeeth' width=\"350\" /\u003e\n\u003c/p\u003e \n\u003ca href=\"https://github.com/antoncoding/squeeth-vol-oracle/actions/workflows/CI.yml\"\u003e\u003cimg src=\"https://github.com/antoncoding/squeeth-vol-oracle/workflows/CI/badge.svg\"\u003e \u003c/a\u003e\n\n\u003ch6 align=\"center\"\u003e Built with \u003ca href=\"https://github.com/foundry-rs/forge-template\"\u003e foundry template\u003c/a\u003e\n\n\u003c/div\u003e\n\n\n## Deployments\n\nThe contract is deployed on Goerli and Mainnet:\n\n| Chain | Address | \n| -------- | -------- |\n| Mainnet    |   [0x5caec004f1378fbfd54a11e9f00e2aad32796b33](https://etherscan.io/address/0x5caec004f1378fbfd54a11e9f00e2aad32796b33#readContract)   |\n| Goerli    |   [0x5caec004f1378fbfd54a11e9f00e2aad32796b33](https://goerli.etherscan.io/address/0x5caec004f1378fbfd54a11e9f00e2aad32796b33#readContract)  |\n\n### Using the contract\n\nYou can use cast to directly query the value as follow (mainnet rpc example):\n\n```\ncast call 0x5caec004f1378fbfd54a11e9f00e2aad32796b33  \"getEthTwaIV(uint32)(uint256)\" 120 --rpc-url https://rpc.ankr.com/eth\n```\n\n## Development\n\n### Getting Started\n\nCompile and run tests\n\n```sh\nforge build\n\nforge test\n```\n\n\n### Estimation\n\nYou can clone the contract, tune in a bit and use the following script to estimate real world vol value.\n\n```shell\nforge script scripts/Deploy.sol --fork-url \u003cmainnet rpc\u003e\n```\n\nOutput:\n\n```shell\n== Logs ==\n  implied volatility: 959347350657613352\n  gas cost:           97612\n  implied funding:    2521499559489813\n\n```\n\n#### Gas Cost\n\nThe gas cost is around 46K ~ 140K, depends on:\n\n- `secondsAgo` to calculate twap\n- current state of Uniswap pool, how many records are in the last `secondsAgo` seconds\n\nIt costs least (around 46K) while querying the implied vol by the current spot price.\n\n### Contract Interface\n\n```solidity\n/// @dev return implied vol with 18 decimals (1e18 = 100%)\nfunction getEthTwaIV(uint256 secondsAgo) external view returns (uint256 vol);\n\n/// @dev return daily implied funding with 18 decimals (1e18 = 100%)\nfunction getImpliedFunding(uint32 secondsAgo) external view returns (uint256 impliedFunding);\n\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fantoncoding%2Fsqueeth-vol-oracle","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fantoncoding%2Fsqueeth-vol-oracle","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fantoncoding%2Fsqueeth-vol-oracle/lists"}