PuffinSwap Rug Pull
What happened
PuffinSwap's yield-farming contract takes more of a depositor's LP tokens than it credits, never gives LP tokens back on withdrawal, and lets its owner sweep every pool's LP balance to a developer address. De.Fi's REKT database lists PuffinSwap (PUFFIN) as an Exit Scam/Rugpull dated 2021-08-31 on BNB Chain, with no loss figure. The verified farm contract is at 0x387ab2f2…991C0D, deployed on 2021-07-15 by 0x0b03db60…57F3e5, which is also the address in De.Fi's proof link.
The code shows what the contract allows; no transaction was opened that shows the sweep function being called.
How it happened
- A user approves the farm and calls
deposit(_pid, _amount, _referrer). The function reads the caller's whole LP balance withuint256 balLp = pool.lpToken.balanceOf(address(msg.sender));and pulls all of it withpool.lpToken.safeTransferFrom(address(msg.sender), address(this), balLp);, regardless of_amount. - Only
_amount(minus any deposit fee) is written to the user's record:user.amount = user.amount.add(_amount);. Any LP tokens held beyond_amountare transferred into the contract without being credited to anyone. - The user then earns PUFFIN rewards as usual.
payOrLockupPendingPuffinpays rewards throughsafePuffinTransfer, so the farm appears to work and PUFFIN is minted to depositors. withdraw(_pid, _amount)only lowers the bookkeeping:user.amount = user.amount.sub(_amount);. The function contains no token transfer, andemergencyWithdrawonly setsuser.amount = 0;. The onlysafeTransfercalls on LP tokens in the contract send tofeeAddress(deposit fee) and todevAddress(dynamic()), so no code path returns LP tokens to a depositor.- The owner can call
dynamic(): it loops over every pool and runslpToken.safeTransfer(devAddress, balLp);for the contract's entire LP balance. The owner can also make this call at any time, andrenounceOwnership()exists but would only matter if it had been called. - What happened: De.Fi's REKT database lists the project as an Exit Scam/Rugpull on 2021-08-31. The BscScan proof link could not be opened, so the amount and the transactions involved are not established here.
Protocol details
Build your security review skills
Work through hands-on labs covering real exploit mechanics, review techniques, and defensive patterns.