Comments (4)
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:
- Remove this RPC from the parachain
- 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.
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.
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.
Closing this issue. It doesn't make sense to calculate a total collateralization level for the system.
from interbtc.
Related Issues (20)
- Document try-runtime / chopsticks testing
- RPC for max stakable amount
- XCM does withdraw without deposit HOT 1
- Support manual-seal
- Allow sending of arbitrary xcm messages
- Add support for `rust-bitcoin` in ink! smart contracts HOT 4
- Runtime for testing Bitcoin smart contracts HOT 1
- Add EVM precompiles
- upgrade to polkadot v1.0.0 HOT 2
- Parachain peers HOT 1
- qToken Vaults
- EVM Compatibility
- Rust smart contracts via ink! and the contract pallet
- Remove griefing collateral from mandatory replace request HOT 1
- Benchmarking for sudo pallet
- Usage of longest-chain instead of most-work HOT 2
- Add XCM Test
- Set the max PoV size
- Add update_inflation extrinsic in supply pallet HOT 1
- InsufficientVaultCollateralAmount error when trying to withdraw an amount takes the vault below MinimumCollateral HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from interbtc.