#47313 [SC-Insight] Transfer(...) function doesn't account for current USDC price
Description
Brief/Intro
Vulnerability Details
fn transfer(
ref self: ContractState,
recipient: ContractAddress,
token_address: ContractAddress,
amount: felt252,
) -> felt252 {
let sender = get_caller_address();
self.account._add_new_account_if_not_exists(recipient);
self.token._transfer(sender, recipient, token_address, amount);
let account_state = self._load_account_v2(sender);
let free_balance: i128 = account_state.free_balance().try_into().unwrap();
@> assert!(free_balance >= 0, "Transfer: Sender is unhealthy after transfer");
return 1;
}Impact Details
References
Proof of Concept
Proof of Concept
Previous#47314 [SC-Medium] account_transfer_partial(...) function doesn't check sender's health after transferring balancesNext#47316 [SC-Low] account_transfer_partial(...) function doesn't check that receiver has a registered account in the system
Was this helpful?