ERC20TokenEmitter lacks slippage protection #150
Labels
2 (Med Risk)
Assets not at direct risk, but function/availability of the protocol could be impacted or leak value
bug
Something isn't working
duplicate-397
satisfactory
satisfies C4 submission criteria; eligible for awards
sufficient quality report
This report is of sufficient quality
Lines of code
https://github.com/code-423n4/2023-12-revolutionprotocol/blob/main/packages/revolution/src/ERC20TokenEmitter.sol#L152
Vulnerability details
Impact
ERC20TokenEmitter
uses VRGDA model to get the current price of the ERC20 token issued in exchange for ETH. Buyers are vulnerable to the price slippage due to price adjustments incurred by the VRGDA algorithm (price increases if amount sold is ahead of schedule and vice versa).Proof of Concept
When user calls payable
buyToken
function, the contract calculates the amount it will mint to the user based on msg.value and the amount of emitted tokenshttps://github.com/code-423n4/2023-12-revolutionprotocol/blob/main/packages/revolution/src/ERC20TokenEmitter.sol#L184
If this transaction was frontrunned or executed later, the user may receive fewer tokens than he expected (e.g. the transaction was executed when the amount sold is ahead of schedule).
Tools Used
Manual review
Recommended Mitigation Steps
Consider adding
deadline
andminAmountOut
checksAssessed type
Token-Transfer
The text was updated successfully, but these errors were encountered: