When a collateralRate
is greater than COLLATERAL_RATE_DECIMAL_SCALER
, PreMarkets
can amplify the total number of tokens pulled from the caller by increasing the inbound depositAmount
. However, only the original unamplified depositAmount
is actually accounted for, even though more tokens than this have been transferred from the caller.
When creating an offer, the caller must specify at a minimum a collateralRate
of COLLATERAL_RATE_DECIMAL_SCALER
, but this value can be arbitrarily larger:
During calls to createTaker(address,uint256)
, the inbound depositAmount
is explicitly amplified by this amount via _depositTokenWhenCreateTaker
when the collateralRate
is over COLLATERAL_RATE_DECIMAL_SCALER
via the underlying call to getDepositAmount
:
It is this amplified amount which is actually charged to the caller:
However, when crediting account balances in _updateTokenBalanceWhenCreateTaker
, only the original unscaled depositAmount is actually accounted for:
Consequently, although we may pull expressly more tokens from the caller than the depositAmount
, these excess tokens are not actually accounted for.
Claims to token deposits are devalued when an offer's collateralRate
is greater than COLLATERAL_RATE_DECIMAL_SCALER
, resulting in an accounting imbalance which impacts upon rightful claims to the accrued capital.
This eventually materializes as stuck tokens.
Manual Review
To prevent the devaluation of token balances, instead of crediting depositAmount
in sales revenue, we should be crediting result of the call to getDepositAmount
:
Valid high, the additional collateral based on collateralRate is not updated to taker balance for protected mode. This results in incorrect collateral refunded to taker during settlement.
Valid high, the additional collateral based on collateralRate is not updated to taker balance for protected mode. This results in incorrect collateral refunded to taker during settlement.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.