In the case that feeToken = POL, it is highly likely that _buyBack will revert.
Summary
In a defiSwap, the process first transfers feeToken from the users' wallets to the AmirX contract, where the received feeToken is swapped for telcoin. However, if feeToken = POL, POLs from SWAPPER_ROLE are used for the swap instead of the POL received from the users' wallets. This is highly likely to revert due to a mismatch with swapData.
Root Cause
As noted in line 232 of the AmirX._buyBack() function, msg.value is swapped for telcoin. This msg.value comes from SWAPPER_ROLE, not from the users' wallets. As a result, the defiSwap is executed incorrectly and is highly likely to revert due to a mismatch with swapData.
whitehair0330
High
In the case that
feeToken = POL
, it is highly likely that_buyBack
will revert.Summary
In a
defiSwap
, the process first transfersfeeToken
from the users' wallets to theAmirX
contract, where the receivedfeeToken
is swapped fortelcoin
. However, iffeeToken = POL
,POL
s fromSWAPPER_ROLE
are used for the swap instead of thePOL
received from the users' wallets. This is highly likely to revert due to a mismatch withswapData
.Root Cause
As noted in line 232 of the
AmirX._buyBack()
function,msg.value
is swapped fortelcoin
. Thismsg.value
comes fromSWAPPER_ROLE
, not from the users' wallets. As a result, thedefiSwap
is executed incorrectly and is highly likely to revert due to a mismatch withswapData
.Internal pre-conditions
No response
External pre-conditions
No response
Attack Path
No response
Impact
defiSwap
is performed incorrectly and is highly likely to revert, breaking the core functionality of the protocol.PoC
No response
Mitigation
Use the contract's balance instead of
msg.value
.