PR: #36 feat(contracts): Foundry workspace + CharonLiquidator skeleton
Problem — two related issues in the same function pair:
-
receive() external payable {} at line 254 accepts any amount of native BNB from any sender with no event emission. No way for off-chain monitoring to detect accidental BNB accumulation or attacker front-running a flash-loan repayment by sending dust.
-
rescue() at line 235 uses payable(to).transfer(amount) to send native BNB. transfer() forwards exactly 2300 gas. Any recipient that is a multisig (e.g., Gnosis Safe) or contract with non-trivial fallback runs out of gas and reverts, permanently locking BNB.
Impact:
- Silent BNB accumulation creates unmonitored attack surface.
- If
owner rotated to multisig cold wallet (recommended ops-sec posture), rescue() becomes permanently bricked for native BNB with no recovery path.
Fix: In receive(), emit event:
event BNBReceived(address indexed sender, uint256 amount);
receive() external payable {
emit BNBReceived(msg.sender, msg.value);
}
In rescue(), replace transfer with low-level call + return check:
(bool ok, ) = payable(to).call{value: amount}("");
require(ok, "rescue: BNB transfer failed");
PR: #36 feat(contracts): Foundry workspace + CharonLiquidator skeleton
Problem — two related issues in the same function pair:
receive() external payable {}at line 254 accepts any amount of native BNB from any sender with no event emission. No way for off-chain monitoring to detect accidental BNB accumulation or attacker front-running a flash-loan repayment by sending dust.rescue()at line 235 usespayable(to).transfer(amount)to send native BNB.transfer()forwards exactly 2300 gas. Any recipient that is a multisig (e.g., Gnosis Safe) or contract with non-trivial fallback runs out of gas and reverts, permanently locking BNB.Impact:
ownerrotated to multisig cold wallet (recommended ops-sec posture),rescue()becomes permanently bricked for native BNB with no recovery path.Fix: In
receive(), emit event:In
rescue(), replacetransferwith low-level call + return check: