If a user directly sents ETH to this contract, why do we want to execute fallback function instead of receive function (and then call the deposit function)?
@@smartcontractprogrammer indeed but if you send the ethers to another smart contract that has to do some work with it, couldn't the transaction get reverted?
@@viktorlavrenenko1713 You made a good point here. If we refer to security tips from Consensys, they advocate to use call since gas costs are not arbitrary. Re-entrancy can be avoided using check-effect-interact pattern
Another excellent tutorial. You totally demystify smart contracts.
Yeah!
More ERC20 related tutorials please! Maybe about some basic swap contracts. Or ERC20 hacks what we should be careful about.
I've been watching content for months and just realized u have a course website. You should definitely pin "Take a course" comment on each videos
Ok thanks for the tip
Vey cool, thank you for the lesson
Keep them coming! Good job!
another immutable data writed in my mind.
If a user directly sents ETH to this contract, why do we want to execute fallback function instead of receive function (and then call the deposit function)?
Both works. I've followed the code for WETH on mainnet. It uses the fallback
Hi, I’m just curious is the solmate erc20 better than openzeppelin erc20?
It's less bloated and consumes less gas
Every chain alrdy has their own WETH contract... is it better to use their WETH contract or create another my own WETH contract in my own defi?
Use their WETH. This video shows how it's coded / works
any more use case or example for 'fallback and change function from external to public'?
Great🙌... Make a video on erc1155
wouldn't it be better to use "payable(msg.sender).call{value: ...}()" instead of "payable(msg.sender).transfer(amount)"?
Both is fine.
_burn is called before transfer ETH so it's protected from re-entrancy
@@smartcontractprogrammer, but is it protected from 2300 gas?
@@smartcontractprogrammer indeed but if you send the ethers to another smart contract that has to do some work with it, couldn't the transaction get reverted?
@@viktorlavrenenko1713 You made a good point here. If we refer to security tips from Consensys, they advocate to use call since gas costs are not arbitrary. Re-entrancy can be avoided using check-effect-interact pattern
Truee