#47318 [SC-Insight] If the counterparty happens to be their own referrer, the protocol does not take the referral fee into account during the risk check.
Description
Brief/Intro
Vulnerability Details
let maker_token_balance = *maker_state
.token_balances
.at(maker_state.settlement_token_index);
let taker_token_balance = *taker_state
.token_balances
.at(taker_state.settlement_token_index);
// Note: _fee_payments will also write maker and taker token balance into the storage to
// include pnl and funding previously calculated
self
._fee_payments(
maker_account,
@maker_token_balance,
maker_trade_fee_in_settlement_token,
maker_referrer,
maker_fee_commission_in_settlement_token,
taker_account,
@taker_token_balance,
taker_trade_fee_in_settlement_token,
taker_referrer,
taker_fee_commission_in_settlement_token,
);Impact Details
References
Proof of Concept
Proof of Concept
Previous#47330 [SC-Low] The fee calculation in `settle_market` is unreasonable.Next#47370 [SC-Critical] `account_transfer_partial` should not be enabled when `transfer_registry_address` is not configured.
Was this helpful?