Function: deposit(address token, address to, uint256 amount)
This function deposits native or ERC-20 tokens to to’s account (using balance before/after for fee-on-transfer tokens) and records the actual amount received.
Inputs
tokenControl: Fully controlled by the caller.
Constraints: If native,
msg.valuemust equal the amount; if ERC-20,msg.valuemust be 0.Impact: Selects native vs ERC-20 deposit path.
toControl: Fully controlled by the caller.
Constraints: Must be nonzero.
Impact: Account to credit with the deposit.
amountControl: Fully controlled by the caller.
Constraints: If native,
msg.valuemust equal the amount; if ERC-20,msg.valuemust be 0.Impact: Nominal amount to deposit (actual amount may be reduced by fee-on-transfer tokens).
Branches and code coverage
Intended branches
Native token path.
ERC-20 token path (fee-on-transfer supported).