I am trying to learn Solidity and write a contract that accepts USDC for my token which has 18 decimals.
I'm getting confused as how to treat the amount being sent when I buy my ERC20.
eg.
function buyToken(IERC20 token, uint256 amount) public payable
Where token
is the address of USDC and amount
is the total USDC I will pay/exchange for my ERC20 Token. Should I convert the amount provided (6 decimals) to 18 decimals? How? What is the best practice for this?