The app write path already uses @tap/units (scaleShares / scaleAmount / uuidToBytes16 / validateShareCaps) — BigInt 1e10 math that matches the poller unscale.
The server still has a second implementation:
server/utils/convertToFixedPointDecimals.js — toScaledBigNumber does Math.round(price * 1e10) (IEEE float). There is a leftover TODO: might not be refactored correctly from ethers v5 to v6 on toDecimal.
server/utils/convertUUID.js — same UUID↔bytes16 job as @tap/units.
Controllers (issuanceController, transferController, stockClassController, seed, etc.) import the local helpers. That is a real drift risk (float rounding vs BigInt) and it fights the agent rule: do not reintroduce local scaleAmount copies.
What to do
Do not change onchain behavior in a drive-by. Make the server utils thin wrappers around @tap/units, then delete the local math once call sites compile and a couple of issuance/transfer seed paths are checked.
Keep convertTimeStampToUint40 (not in @tap/units). USDC 1e6 branch in getScale — confirm it is still used before dropping it.
Out of scope
The app write path already uses
@tap/units(scaleShares/scaleAmount/uuidToBytes16/validateShareCaps) — BigInt 1e10 math that matches the poller unscale.The server still has a second implementation:
server/utils/convertToFixedPointDecimals.js—toScaledBigNumberdoesMath.round(price * 1e10)(IEEE float). There is a leftoverTODO: might not be refactored correctly from ethers v5 to v6ontoDecimal.server/utils/convertUUID.js— same UUID↔bytes16 job as@tap/units.Controllers (
issuanceController,transferController,stockClassController, seed, etc.) import the local helpers. That is a real drift risk (float rounding vs BigInt) and it fights the agent rule: do not reintroduce localscaleAmountcopies.What to do
Do not change onchain behavior in a drive-by. Make the server utils thin wrappers around
@tap/units, then delete the local math once call sites compile and a couple of issuance/transfer seed paths are checked.Keep
convertTimeStampToUint40(not in@tap/units). USDC1e6branch ingetScale— confirm it is still used before dropping it.Out of scope
server/