Code Monkey home page Code Monkey logo

defi_aggregator's Introduction

Defi aggregator

image

image

Notes:

Oracle external ICP/USD ETH/USD BTC/USD, market caps, and volume are pushed from outside. These values stay in their tracks and are not used unless XRC fetching the same stops working for more than 4 hours. They are refreshed every 5 seconds and someone can use them if they want faster updates. XRC prices are updated once per minute.

Sonic volume not included - no on-chain API for it. Sonic also doesn’t seem to record its pool prices and provide API for it, on or off-chain. There is only the current price available.

ICDex reports volume in tokens and not USD, which changes price. Then it becomes hard to tell what is the actual volume. When keeping track of volume by adding the transaction value not in tokens but in a stable currency like USD - it is more accurate. Example: Trades happen all day at a price of 2.3 (for a total of 30k USD) and at the end of the day the price goes to 4.6 (10k USD). If you convert volume 24 with the current token price, you will get a total volume (70k USD) - almost double what it really is. It will also be halved if the price goes down. Our API can record the total volume and use that to fix the issue, but it’s still good to have volume in USD.

ICPSwap We are currently ****using TVL to determine liquidity (depth -50%). The other way of doing it is complicated and may not even be possible without implementing a good portion of their dex algorithm. Some tokens aren’t tagged to count towards TVL, probably to discourage users from trying to cheat the reward system by filling it with custom coins without value. However, XTC and Ghost don’t count towards it too at the time of writing. Making the stat we are providing not very accurate. We have contacted them and asked for a multi_quote function, which could be used to amend that.

Conclusion: We will need to create a standard for fetching information from DEXes that will work for both order book and AMM DEXes and also for both single and multiple tokens inside one canister. This will ensure the stability of systems relying on such information. The functions we currently use are most likely made to serve the developer’s web apps. We will also need another standard for getting locked & unlocking(optional) tokens from non-SNS contracts.

Verify build

Run inside dev container using VSCode for safer verification OR install these before you run the command.

./verify.sh

defi_aggregator's People

Contributors

infu avatar furs 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.