Hello I'm pretty new to ERC20 and i try to research something but maybe concept in my head is not correct. I'm trying to create smart contract that is receiving some amount of ERC20, validating the input amount and if it's ok it continue with logic below. Smart contract looks something like this:
contract Orders {
uint256 public counter;
function deposit() public payable {
// Here we validate if sended USDT for example is higher than 50, and if so we increment the counter
counter = counter + 1
}
}
How to validate sended amount of ERC20 for each individual deposit
Best Answer
Try this:
NOTE: Remember to approve the smart contract to spend your tokens.