I have a couple of questions relating ERC20...
why is allowance needed ? It would be the same as if instead of approving my 10 tokens to some address to spend, I could directly transfer 10 tokens to that same address. Hence, no allowance necessary and the same result.
I am looking at the following contract... https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/ERC20.sol . I don't seem to figure out why
transferFromis written like this. That way, anyone can call the function and pass other 2 addresses, which means that If I call it, I can make a transfer from userA's to userB, even though I am userC and I shouldn't have the permission to do so.Where can I find the actual ERC20 compliant contract with all the functions(including mint) and with the correct implementation and not the one i linked above ?
msg.valueto the contract function). But when transferring tokens, you actually need to call a function in another contract (the token contract). So instead, you call functionapprove(in the token contract), and then call a function in the contract itself, which performs the token transfer (by callingtranferFrom) on your behalf.