Function: convertTokens()
The function converts a specified amount of tokenA to tokenB at a predefined conversion rate, transferring tokenA from the user to the contract and sending the equivalent amount of tokenB to the user.
Inputs
_amountAValidation: The caller should have enough tokens to convert.
Impact: The amount of tokenA to send to this contract.
Branches and code coverage (including function calls)
Intended branches
Negative behavior
Function call analysis
tokenA.safeTransferFrom(msg.sender, address(this), _amountA)External/Internal? External.
Argument control:
_amountA.Impact: Collects
_amountAof tokenA needed for the token conversion.
tokenB.safeTransfer(msg.sender, amountB);External/Internal? External.
Argument control:
amountB.Impact: Sends
amountBof tokenB, which is the equivalent amount after conversion, to the user.