osmosis
osmosis copied to clipboard
feat(osmomath): BigDec TruncateSDKInt helper
Background
Currently, to return an SDK Int from BigDec one must go BigDec -> Dec -> SDK Int
Suggested Design
Introduce a helpers TruncateSDKInt and TruncateSDKIntMut where the latter mutates the BigDec buffer directly and does not do reallocations.
Acceptance Criteria
- 2 helpers implemented
- one does not do reallocations
- each unit tested
- backported to release branch and state-compat confirmed
We also need a RountInt helper
NewIntFromBigInt always allocates new big.Int pointer
return Int{new(big.Int).Set(i)}
Waiting for https://github.com/cosmos/cosmos-sdk/pull/18030