Submitted by kenzo, also found by 0x52, 0xkowloon, cccz, Alex the Entreprenerd, hansfriese, kirk-baird, Metatron, and WatchPug
The Swivel lend method adds to fees[u] the order fee, but does not pull that fee from the user. It only pulls the order-post-fee amount.
withdrawFee will fail, as it tries to transfer more tokens than are in the contract.
The Swivel lend method sums up the fees to totalFee, and the amount to send to Swivel in lent:
It then increments fees[u] by totalFee, but only pulls from the user lent:
Therefore, totalFee has not been pulled from the user.
The fees variable now includes tokens which are not in the contract, and withdrawFee will fail as it tries to transfer fees[u].
Pull lent + totalFee from the user.
sourabhmarathe (Illuminate) confirmed and commented:
