A repository to store everything related to Mean's oracles

Overview

Lint Tests Slither Analysis

Mean Finance Oracles

This repository will hold all Mean Finance's oracle infrastructure. It aims to have a sufficiently flexible architecture as to support a wide amount of tokens composition, and therefore enabling quoting pairs that couldn't be done before.

Some of this is achieved by leveraging already existing oracles like Uniswap V3 Static Oracle.

Package

The package will contain:

  • Artifacts can be found under @mean-finance/mean-oracles/artifacts
  • Compatible deployments for hardhat-deploy plugin under the @mean-finance/mean-oracles/deployments folder.
  • Typescript smart contract typings under @mean-finance/mean-oracles/typechained

Documentation

Everything that you need to know as a developer on how to use all repository smart contracts can be found in the documented interfaces.

Installation

To install with Hardhat or Truffle:

YARN

yarn install @mean-finance/mean-oracles

NPM

npm install @mean-finance/mean-oracles

Deployment Registry

Contracts are deployed at the same address on all available networks via the deterministic contract factory

Available networks: Optimism, Optimism Kovan, Arbitrum Rinkeby, Polygon, Mumbai (Polygon testnet).

  • OracleAggregator: 0xFD8aD08F7e35FA949c6dEB9B58623345Faa5D3EF
  • StatefulChainlinkOracleAdapter: 0x4708433c4EF50544e7a37e2903c434F293A21aaC
  • UniswapV3Adapter: 0xdd18E04096c5E974B23d6205e2138EDA139848D3
Comments
  • fix: configure oracle when forced

    fix: configure oracle when forced

    We realized that we were not configuring the oracle when it was forced. This left us in a weird state, because if it was forced and it hadn't been configured before, it couldn't be reconfigured through addOrModifySupportForPair (on the aggregator).

    The only thing to do, would be to go to the underlying oracle, and configure it there. This was not a big issue, but it was a UX problem

    opened by 0xsambugs 1
  • feat: add force oracle

    feat: add force oracle

    We are now implementing forceOracle. This will allow admins to force a specific oracle, for a specific pair of tokens. When an oracle is forced, only other admins will be able to set a new oracle for the pair.

    We are doing this so that if an oracle with lower precedence is better for a specific pair, we can adjust

    opened by 0xsambugs 1
  • feat: set specific mapping config

    feat: set specific mapping config

    We are now adding the possibility to set pair-specific mappings config. The idea is that we will check if a pair has some specific mapping set. If it doesn't, then we will check the global config

    opened by 0xsambugs 0
  • refactor: increase var size in uni oracle

    refactor: increase var size in uni oracle

    We are now increasing the size of the storage variables, basically because we can. Since we have a storage slot (256 bits) to spend, we can increase the size of each var

    We increased period from 16b to 32b and gasPerCardinality from 32b to 104b

    Note: we are leaving 112b for a next PR

    opened by 0xsambugs 0
  • refactor: simplify quote in transformer oracle

    refactor: simplify quote in transformer oracle

    We are now just simplifying quote for the Transformer Oracle. Instead of having multiple if/else statements, we simply transform the input if needed, and then transform the output if needed

    opened by 0xsambugs 0
  • fix: use int16 for decimals

    fix: use int16 for decimals

    If a token were to have decimals between type(int8).max < decimals <= type(uint8).max, then we would overflow. By using int16, we can avoid this problem

    opened by 0xsambugs 0
  • refactor: make max delay constant

    refactor: make max delay constant

    Before this change, we were able to configure the max delay allowed for Chainlink feeds. The thing is that for all networks, the max delay was 24hs 😅

    I went over most Chainlink feeds and in fact, the max delay is 24hs. But, at the same time, maxDelay was mutable, so we were reading storage once for each read feed. And we could potentially read 4 feeds per pair

    So the idea is to simplify everything by just hardcoding the max 24hs delay. In an ideal world (alpha drop), we would use the actual feed heartbeat instead of a max delay that covers all feeds

    opened by 0xsambugs 0
  • refactor: support same tokens pair

    refactor: support same tokens pair

    Before this change, we couldn't quote two tokens that mapped to the same address. It would work only if they had their own individual feeds

    So the idea here is that if two tokens maps to the same address, then we consider them the same, and we will quote 1:1. We should now be very careful in what we map to other addresses

    opened by 0xsambugs 0
  • refactor: store plan for mapped

    refactor: store plan for mapped

    We are now making a change so that plans are stored for the mapped version of a pair. This has a few benefits:

    1. If a register the pair WETH/DAI, then it will associated to ETH/USD
    2. This means that WETH/USDT already has a plan calculated
    3. If we remove the mapping USDT => USDT, then all pairs X/USDT will stop working, until they are reconfigured

    Note: if two tokens are mapped to the same address, then we will use their original version. This is so that stablecoin to stablecoin pairs used their feeds, and we don't assume that they are 1:1

    opened by 0xsambugs 0
  • chore: update docs and dependencies

    chore: update docs and dependencies

    We are now doing a few things:

    • Removed the dependency to mean-finance/dca-v2-core (will allow us to avoid circular dependencies)
    • Updating the package version
    • Updating the docs to our new format
    opened by 0xsambugs 0
  • fix: add ability to lose support

    fix: add ability to lose support

    Thanks to @0xged , we realized that we had a corner case where the oracle wouldn't work as expected. This scenario could happen if we removed a mapping (to USD or another token) and suddenly a pair lost support.

    In that case, the pricing plan was already set, and we couldn't remove it by reconfiguring the pair (because it reverted). With this change, we can now lose support

    opened by 0xsambugs 0
Owner
Mean Finance
Mean Finance
Primary repository for all information related to Fast-Floward Bootcamp session 1

⏩ Fast Floward Welcome to Fast Floward! We are excited to have you here. This repository is where you will find all content, resources, and links for

Decentology 44 Dec 23, 2022
Find related repository by stars.

Related Repos Find related repository by stars. How it works? By analyzing the star activities of users who have starred a specific repository, this t

JustSong 7 May 10, 2023
Official repository hosting the Runtipi App Store. Submit apps and updates here.

Tipi App Store ⛺️ This is the official repository for the Tipi App Store. It contains all the apps that are available for download on Tipi. Apps avail

Nicolas Meienberger 59 Jan 3, 2023
🍞📅A JavaScript calendar that has everything you need.

A JavaScript schedule calendar that is full featured. Now your service just got the customizable calendar. ?? Table of Contents Collect statistics on

NHN 10.4k Jan 5, 2023
🤪 A linter, prettier, and test suite that does everything as-simple-as-possible.

Features Fully Featured Code Grading Knowing if you need to work on your code is important- that's why we grade your code automatically. But, unlike o

Fairfield Programming Association 18 Sep 25, 2022
Everything about note management. All in Zotero.

Zotero Better Notes Everything about note management. All in Zotero. User Guide(EN) | 用户指引(中文) All in Zotero: Best Note Practice Review.Writing.Best.P

null 1.3k Jan 9, 2023
Vision is a complete project manager where you can colaborate with your team. Everything is still in development phase.

This is a Next.js project bootstrapped with create-next-app. Getting Started First, run the development server: npm run dev # or yarn dev Open http://

Nikko Abucejo 4 Jun 4, 2022
Everything you need to use NextJS with Brownie!

Brownie NextJS Mix This mix comes with everything you need to start using NextJS with a Brownie project. Installation Install Brownie, if you haven't

Rafael Abuawad 9 Jun 20, 2022
In this project, I built a simple HTML list of To-Do tasks. This simple web page was built using Webpack, creating everything from a JavaScript index file that imported all the modules and assets

To Do List In this project, I built a simple HTML list of To-Do tasks. This simple web page was built using Webpack, creating everything from a JavaSc

Andrés Felipe Arroyave Naranjo 10 Mar 31, 2022
Can see everything, beware of its omniscience, kneel before its greatness.

Can see everything, beware of its omniscience, kneel before its greatness. Summary Presentation Installation Removing Credits Presentation Main goal T

Duc Justin 3 Sep 30, 2022
Eventually* Everything you'll need for successful feature flagging

remix-flags Eventually* Everything you'll need for successful feature flagging What's inside? This repo uses npm as a package manager. It includes the

Jacob Ebey 16 Jun 10, 2022
A full documentation on everything we know about Alpha 1.0.16 versions.

Minecraft's Alpha 1.0.16 Versions Before you start, make sure to watch RetroGamingNow's video about this first. Highly influenced (technically a port

_NexTre_ 44 Dec 23, 2022
Zero Two Bot,A fully Modular Whatsapp Bot to do everything possible in WhatsApp by Team Zero Two

?? ???????? ?????? ???? ?? A Moduler WhatsApp Bot designed for both PM and Groups - To take your boring WhatsApp usage into a whole different level. T

Sam Pandey 69 Dec 25, 2022
A curated collection of free resources from across the web for front-end developers, covering everything from design to deployment.

A curated collection of free resources from across the web for front-end developers, covering everything from design to deployment.

Robert McAbee 6 Jul 11, 2022
Hash.js is a 0.5 KB script that lets you in a super simple way manipulate everything behind # in urls.

Hash.js - URL Hash Manipulation Hash.js is a 0.5 KB script that lets you in a super simple way manipulate everything behind # in urls. Tested in lates

Jonny Strömberg 152 Aug 1, 2022
A Virtual Interactive Keyboard which replicates every key you press and a Text-Area in which everything is written and can be copied to the clipboard with a click of a button.

A Virtual Interactive Keyboard which replicates every key you press and a Text-Area in which everything is written and can be copied to the clipboard with a click of a button.

Devang Joshi 1 Mar 1, 2021
Discord.js v14 bot that logs everything on your Discord server

Discord Server Logger Bot Discord bot that logs all changes on your Discord server! When using this code please give credits to DEEM#6666! Deployment

DEEM 24 Dec 26, 2022
This will create a REST API using Express JS and MongoDB removing the hassle of creating everything from scratch.

rest-api-init Fastest way to create REST API with Node.js, Express.js & MongoDB. Prerequisites Node.js needs to be installed. MongoDB Compass needs to

Souvik Das 7 Dec 3, 2022