Polimec / polimec-node

Decentralized community-driven funding protocol for Web3
https://www.polimec.org/
GNU General Public License v3.0
14 stars 6 forks source link

💥 New decimal-aware price system - Part 1: Business Logic #260

Closed JuaniRios closed 6 months ago

JuaniRios commented 6 months ago

What?

Why?

How?

Change the price of assets instead of being for example PriceOf::from_float(1.5) for a price of 1.5$, we now use a relationship between our USD decimals and the asset decimals like so PriceOf::from_rational(1.5 * 10^6, 1 * 10^10) for the case where our base USD decimals is 6, and the asset being priced has 10 decimals

Testing?

test_usd_price_decimal_aware All other tests are broken and will be fixed in a following PR on the stack

Screenshots (optional)

CleanShot 2024-04-26 at 10.59.50@2x.png

JuaniRios commented 6 months ago

This stack of pull requests is managed by Graphite. Learn more about stacking.

Join @JuaniRios and the rest of your teammates on Graphite Graphite