@PatrickAlphaC 📚In this lesson we see how to withdraw the deposited funds from our contract. 🤑
We cover:
- for loop
- ways to transfer eth
- constructors
- modifiers
- the call() function returns more than 1 variable but we're only interested in knowing if the call went through or not.
- Revert the state if call fails ⚠️
@PatrickAlphaC BASIC SOLIDITY CONSTRUCTOR 💻
- A constructor is a function that gets immediately called in the same transaction that we create the contract.
- use the "constructor" keyword. ✔️
@PatrickAlphaC 🚨Note:
Only the owner must be able to withdraw the funds.
See how to ensure that below 👇🏽
💡 The underscore _ after the first statement within the modifier implies that the rest of the code of the function is executed after the first statement of the modifier only.
@PatrickAlphaC Now, modify the withdraw function as shown 👇🏽
✅function withdraw() public onlyOwner{
....
}
@PatrickAlphaC Now, you can go ahead and try to fund/ withdraw on the testnet 🎉
@PatrickAlphaC That was 30 mins🕢 of the course summarized for you. 🙃
@PatrickAlphaC If you're a web3 enthusiast, wanting to explore, learn and grow as a developer, do watch this video and learn along with me. ✨
@PatrickAlphaC Digest 13 (summarizing the next few minutes of the course) coming soon... 😉
If you found this thread informative, retweet, like, and share the tweet below.👇
@PatrickAlphaC SOLIDITY ✨
- It is a programming language developed by Ethereum developers. 🔗
- Helps build smart contracts that run on Ethereum blockchain.