- 
                Notifications
    
You must be signed in to change notification settings  - Fork 389
 
Closed
Description
This is a new package with the following goals:
- Versioning independent of cosmwasm-std, such that CosmWasm 0.16 and 1.0 developers can use the same library
 - Add features required by defi users and implement them in a correct and heavility tested way
 - Ensure a small footprint in terms of code size and performance
 - Ensure we don't pull in float operations
 
TODOs:
-  Implement 
Sumfor all types consistently (Use the same Sum implementation for all number types #1187) -  Create 
checked_multiply_ratioreturning anOptionallowing to recover from overflow - Implement floor/ceil for all decimals
 - Copy over Uint64, Uint128, Uint256, Uint512, Decimal and Decimal256
 -  Let all the 
checked_*functions returnsOptioninstead ofStdResultfor better stdard library complience and avoiding performance hit (see Mark more Uint128, Uint64 and Decimal operations as const #1157). - Consider using macros to ensure API and implementation consistency across types
 - Signed integers
 - Signed decimals?
 -  
constify all the things -  Find a consistent way to convert 
Uint64/Uin128to the primitivesu64andu128. Are we happy with the current API? -  Deprecate 
cosmwasm_std:{Decimal, Decimal256, Uint128, Uint256, Uint512, Uint64}and point the users to the math library 
| Feature | Uint64 | Uint128 | Uint256 | Uint512 | Decimal | Decimal256 | 
|---|---|---|---|---|---|---|
| const zero | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | 
| const one | ✅ (#1333) | ✅ (#1333) | ✅ (#1333) | ✅ (#1333) | ✅ | ✅ | 
| Sum | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | 
| Add | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | 
| AddAssign | ✅ | ✅ | ✅ | ✅ | ✅ (#1253) | ✅ (#1253) | 
| Sub | ✅ (#1242) | ✅ | ✅ | ✅ | ✅ | ✅ | 
| SubAssign | ✅ (#1242) | ✅ | ✅ | ✅ | ✅ (#1253) | ✅ (#1253) | 
| Mul | ✅ (#1245) | ✅ | ✅ | ✅ | ✅ | ✅ | 
| MulAssign | ✅ (#1245) | ✅ | ✅ | ✅ | ✅ (#1255) | ✅ (#1255) | 
| Div | ✅ | ✅ | ✅ | ✅ | ✅ (#1279) | ✅ (#1279) | 
| DivAssign | ✅ | ✅ | ✅ | ✅ | ✅ (#1279) | ✅ (#1279) | 
| Rem | ✅ | ✅ | ✅ | ✅ | ✅ (#1340 ) | ✅ (#1340) | 
| RemAssign | ✅ (#1250) | ✅ (#1250) | ✅ (#1250) | ✅ (#1250) | ✅ (#1340 ) | ✅ (#1340) | 
| floor/ceil | N/A | N/A | N/A | N/A | ✅ (#1347 ) | ✅ (#1347) | 
| pow | ✅ (#1251) | ✅ (#1251) | ✅ | ✅ (#1251) | ✅ (#1342 ) | ✅ (#1342) | 
| checked_add | ✅ | ✅ | ✅ | ✅ | ✅ (#1341 ) | ✅ (#1341) | 
| checked_sub | ✅ | ✅ | ✅ | ✅ | ✅ (#1341 ) | ✅ (#1341) | 
| checked_rem | ✅ | ✅ | ✅ | ✅ | ✅ (#1341 ) | ✅ (#1341) | 
| checked_mul | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | 
| checked_div | ✅ | ✅ | ✅ | ✅ | ✅ (#1341 ) | ✅ (#1341) | 
| checked_div_euclid | ✅ | ✅ | (#1376) | (#1376) | N/A | N/A | 
| checked_pow | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | 
| saturating_add | ✅ | ✅ | ✅ | ✅ | ✅ (#1343 ) | ✅ (#1343) | 
| saturating_sub | ✅ | ✅ | ✅ | ✅ | ✅ (#1343 ) | ✅ (#1343) | 
| saturating_mul | ✅ | ✅ | ✅ | ✅ | ✅ (#1343 ) | ✅ (#1343) | 
| saturating_pow | ✅ | ✅ | ✅ (#1343 ) | ✅ (#1343) | ✅ (#1342 ) | ✅ (#1342) | 
| wrapping_add | ✅ | ✅ | ✅ (#1459) | ✅ (#1459) | ||
| wrapping_sub | ✅ | ✅ | ✅ (#1459) | ✅ (#1459) | ||
| wrapping_mul | ✅ | ✅ | ✅ (#1459) | ✅ (#1459) | ||
| wrapping_pow | ✅ | ✅ | ✅ (#1459) | ✅ (#1459) | ||
| checked_from_ratio | N/A | N/A | N/A | N/A | ✅ (#1281) | ✅ (#1281) | 
| checked_multiply_ratio | ✅ (#1280) | ✅ (#1280) | ✅ (#1280) | N/A | N/A | N/A | 
A const constructor | 
✅ | ✅ | ✅ | ✅ (#1256) | ✅ (#1264) | ✅ (#1264) | 
| const is_zero | ✅ (#1256) | ✅ (#1256) | ✅ (#1256) | ✅ (#1256) | ✅ (#1256) | ✅ (#1256) | 
| const fn atomics | N/A | N/A | N/A | N/A | ✅ (#1256) | ✅ (#1256) | 
| const fn decimal_places | N/A | N/A | N/A | N/A | ✅ (#1256) | ✅ (#1256) | 
| pub const MAX: Self | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | 
| pub const MIN: Self | ✅ (#1366) | ✅ (#1366) | ✅ (#1366) | ✅ (#1366) | ✅ (#1366) | ✅ (#1366) | 
Metadata
Metadata
Assignees
Labels
No labels