AmbireTech / adex-validator-stack-rust

The Ambire AdEx Validator Stack implemented in Rust: sentry, validator worker, adapter, adview manager
https://adex.network
GNU Affero General Public License v3.0
11 stars 10 forks source link

AIP #61 v5: Unified precision (8) #384

Closed elpiel closed 3 years ago

elpiel commented 3 years ago

https://github.com/AdExNetwork/aips/issues/61

Create a Unified Precision number (UnifiedNum) with precision of 8 that will be used for all calculations, except when we are creating the MerkleTree, where we need the actual precision of the token in order of the MerkleTree to be calculated properly.

elpiel commented 3 years ago

Postgres: Since we are using a u64 to store the UnifiedNum we can use bigint (max of 9_223_372_036_854_775_807) and although we can handle half of what u64::MAX = 184_467_440_737.09551615, it should not cause any issues. Otherwise an error will be raised by the database and caught in Sentry.