HyperCore auditing checklist π§΅
tokenInfo().evmExtraWeiDecimals β Can be NEGATIVE
evmExtraWeiDecimals is an int8, not a uint.
A negative value (e.g. -2) means the EVM amount has fewer decimals than the spot amount.
Incorrectly assuming it is always positive can cause conversion logic to break by powers of 10, leading to incorrect accounting, pricing, or settlement calculations.
// β Wrong β breaks if value is negative
uint64 evmAmt = spotAmt * (10 ** ti.evmExtraWeiDecimals);
// β
Correct
int8 extra = ti.evmExtraWeiDecimals;
if (extra >= 0) {
evmAmt =
spotAmt *
uint64(10 ** uint8(extra));
} else {
evmAmt =
spotAmt /
uint64(10 ** uint8(-extra));
}