You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As explained in #11376, using floats to pass amounts from UI to the backend is unreliable in some cases and should be replaced by usage of integer amounts in the base units (like wei for eth). The problem seems to occur whenever conversion::eth2Wei is used to convert floats to amount's base units.
#11353 adds minting assets. CommunityTokenDto::suply is changed from int to Uint256 to handle amounts in weis. But when returned to the user supplyByType is used to convert amount to float (precision is lost here). The proposition is to return amount in basic unit instead of floats (as a string) and add additional field for storing multiplier (0 for collectibles and 18 for assets). UI side should take care for proper presentation using utilities provided in #11487.
That approach will allow conducting operations like e.g. airdrop (where UI should check if remaining supply is sufficient to airdrop given amount to X recipients), and others, in a reliable way with no risk for e.g. constructing operation exceeding available supply.
Description
As explained in #11376, using floats to pass amounts from UI to the backend is unreliable in some cases and should be replaced by usage of integer amounts in the base units (like wei for eth). The problem seems to occur whenever
conversion::eth2Wei
is used to convert floats to amount's base units.#11353 adds minting assets.
CommunityTokenDto::suply
is changed fromint
toUint256
to handle amounts in weis. But when returned to the usersupplyByType
is used to convert amount to float (precision is lost here). The proposition is to return amount in basic unit instead of floats (as a string) and add additional field for storing multiplier (0 for collectibles and 18 for assets). UI side should take care for proper presentation using utilities provided in #11487.That approach will allow conducting operations like e.g. airdrop (where UI should check if remaining supply is sufficient to airdrop given amount to X recipients), and others, in a reliable way with no risk for e.g. constructing operation exceeding available supply.
Depends on: #11353
Related to: #11489
Relates to: #11376
The text was updated successfully, but these errors were encountered: