Code Monkey home page Code Monkey logo

Comments (4)

nud3l avatar nud3l commented on May 24, 2024 2

Instead of a single value, return a Vec<(CurrencyId, UnsignedFixedPoint)> and let the UI figure out how to display and aggregate it.

What is the returned fixed point there?

I am also leaning towards implementing this on the lib level rather than on the parachain. The RPC calls have proven to be not the greatest for UI optimization but rather we should go for a caching layer. So my suggestion would be:

  1. Remove this RPC from the parachain
  2. Implement a function on the lib that reflects the system collateralization. (cc @savudani8 @theodorebugnet). For the lib function, my suggestion would be two-fold:
  • on the user facing side (dashboard, list of vaults) -> show a weighted aggregate of the collateralization: collateralization = (to_btc(ksm) * issued_interbtc_from_ksm + to_btc(dot) * issued_interbtc_from_dot) / total_issued_interbtc
  • on the vault facing side (vault dashboard) -> show collateralization per collateral asset: collateralization(asset) = to_btc(asset)/interbtc_from_asset

from interbtc.

gregdhill avatar gregdhill commented on May 24, 2024

The returned value would be (total_collateral / exchange_rate) / issued_tokens as it is now but for each currency. I agree that this can / should be removed in favour of something more performant on the caching layer.

@sander2 I think this would allow us to remove the TotalUserVaultCollateral storage item as well.

from interbtc.

nud3l avatar nud3l commented on May 24, 2024

The only thing that might prove tricky in the caching layer is how to figure out how many tokens are issued from which collateral asset. Do we have that on-chain available other than iterating over all vaults and figuring out their collateral currency and issued_tokens?

from interbtc.

nud3l avatar nud3l commented on May 24, 2024

Closing this issue. It doesn't make sense to calculate a total collateralization level for the system.

from interbtc.

Related Issues (20)

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.