Learn Blockchain, Solidity, and Full Stack Web3 Development with JavaScript – 32-Hour Course - Ep49
2025-07-11 11:20:58 [python] Source: ByteGenius
after this transaction goesthrough we should see this number gofrom 0.02 to0.04 now after we wait a brief delay wedo indeed see the balance has gone up to0.04 which is zane lowe mileyexactly what we we'dexpect awesome so our funding mechanismis working correctly and if we go downinto our array and ourmapping we do address to array and wepaste our address we should see the fournumber show up and if we go to fundersof zero we see our address and if we goto funders of one we also see ouraddress and we see that and we see thiscall going through if we go to fundersof two in our log over here we actuallysee that we get an error an optimizationthat we could make to our contract inthe future is to check to see if anaddress is already in the funders arrayand then not add it if it's alreadythere now let's go ahead and try to callthis withdraw function but let's try tocall it with a different address thanthe address we originally deployed thiscontract with so to do that scroll allthe way to the top of this here and I'mgoing to go to mymetamask and I'm going to switch to asecond account and hitconnect now our remix should be updatedwith the new account that's in hereyou'll see that if I switch back toaccount one it switches back to accountone so long as they're both connectedyou can see which accounts are connectedto Applications by clicking thisconnected button and see which ones areconnected if you ever want todisconnected account you can click thethree little dots and hit disconnect theaccount and now we can see that thisthis account is not connected howeveraccount two is connected let's go backto account one and connect account oneso that both of them are now account areconnected but we'll switch to accounttwo let's switch to account two becauseagain account two isn't the owner ofthis contract we scroll down to owner wecan see owner is 0x1 066 somethingsomething and account two is 0x 043something somethingawesome so what do you think will happenwhen we hit withdraw here well ourmodifier only owner should kick in andwe should get notified that if we sendthe transaction we'll get this errorsender is not owner so let's try it ahgas estimation failed we do get thiserror sender is not owner which isperfect this is exactly what we want wecould absolutely send this transactionif we wanted to but that would just be awaste of gas because this transaction isgoing to fail however if we switch backto accountone and we hitwithdraw menam mask will pop up enablingus to hit confirm and withdraw The Etherout of this contract address now if welook at this contract address on etherscan after a brief delay we'll see thebalance go from0.04 back down to zero and we'll see ourWallet balance go up from what it isback to 0 .04 plus what it was and aftera brief delay you can see our balance isindeed back down to zero in our contractnow if we do address to amount for ourwallet address that was doing thefunding it's back down to zero and if wetry to check the address of funders atindex zero we get call to funders fundmeered execution revertedwe've completed all the basics of thesection that I wanted to go through andyou should be incredibly proud ofyourself for getting this far you'vejust deployed a really Advanced smartcontract we're using a library and chainlink contracts to build some of the mostpowerful applications in the planetwe've learned to use a library for anytype we want in our smart contractswe've learned more about multiplicationand then units of measure in solidity insmart contracts we've learned aboutmappings more about arrays what theConstructor does we've learned how tosend money we've learned about for Loopswe've learned about the different wayswe can actually send money at least froma low level and we've learned aboutmodifiers this section is one of thetoughest sections in this course so ifyou completed this you should beincredibly excited we're going to gothrough our code now and we're going tomake a number of tweaks now this sectionwe are going to do a little bit moreadvanced solidity here so if you get alittle bit lost don't sweat it too muchand feel free to try some of this stuffin the future on yourown we're going to modify this contractto make it a little bit moreprofessional it's not going to be end toend amazing but it's going to be alittle bit better and you'll see why ina minute so the first thing that we'regoing to do is we're looking we're goingto look at some of these variables herein particular owner and minimum USDowner gets set one time in our contracthere and then it never changes againminimum USD gets set one time evenoutside of the Constructor if we havevariables that only get set one time wecan actually use some tools and solidityto make them more gas efficient for nowlet's compile our fundme contract andthen deploy it to a JavaScript viralmachine remember we can go ahead anddeploy it right now however funding andwithdrawing and doing any of the moneystuff isn't going to work because againwe don't have a chain Lake Network onour JavaScript VM so those aren't goingto work so well but for what we're goingto do right now we don't really care somuch here's what we do care about we docare about how much gas this costs toactually send we do care about how muchgas this costs to create right nowcreating this contract costs about$859,000 gas and we're going to add acouple of Tricks right now to bring thisnumber down we're going to add somestuff back in in a bit which will bringit back up but for now we're going tolearn some tricks to bring this numberdown the two tricks that we're going tolearn are the constant keyword and theimmutable key keyword in their soliditythere are two keywords that make it sothat your variables can't be changed andthose keywords are constant andimmutable you can learn more about themin the solidity documentation if youassign a variable once
(Editor: ai)
Related content
Learn Blockchain, Solidity, and Full Stack Web3 Development with JavaScript – 32-Hour Course - Ep58
[Hindi (auto-generated)] Machine Learning FULL Course with Practical (10 HOURS) _ Learn Free ML in 2025 _ Part-1 - Ep82
50 Cent Goes In on Diddy, Drake, Jay Z, Snoop, Eminem, Trump 2024, Vegas Shows +More Scandals - Ep1
How to use ChatGPT in 2025 _ ChatGPT Tutorial _ ChatGPT Full Course - Ep71
Solana Developer Bootcamp 2024 - Learn Blockchain and Full Stack Web3 Development - Projects 1-9 - Ep81
- Solidity, Blockchain, and Smart Contract Course – Beginner to Expert Python Tutorial - Ep2
- How to use ChatGPT in 2025 _ ChatGPT Tutorial _ ChatGPT Full Course - Ep45
- [Hindi (auto-generated)] Machine Learning FULL Course with Practical (10 HOURS) _ Learn Free ML in 2025 _ Part-1 - Ep100
- How to use ChatGPT in 2025 _ ChatGPT Tutorial _ ChatGPT Full Course - Ep28
- Learn Blockchain, Solidity, and Full Stack Web3 Development with JavaScript – 32-Hour Course - Ep64
- [Hindi (auto-generated)] Machine Learning FULL Course with Practical (10 HOURS) _ Learn Free ML in 2025 _ Part-1 - Ep98
- The 3 Year AI Reset_ How To Get Ahead While Others Lose Their Jobs (Prepare Now) _ Emad Mostaque - Ep20
- Artificial Intelligence Full Course 2024 _ AI Tutorial For Beginners _ AI Full Course_ Intellipaat - Ep40
Recommended articles
-
GenAI Essentials – Full Course for Beginners - Ep61
for uh movie night would be theLord of the Rings Fellowship of theRings this Epic Fantasy Adventure ...[Details]
-
How to use ChatGPT in 2025 _ ChatGPT Tutorial _ ChatGPT Full Course - Ep2
task eachand every day that's why generative AIis evolvingrapidly and that's why is close to Magicfo ...[Details]
-
और टेस्टिंग साइज होगी 0.2अगला होगा हमारा रैंडम स्टेट रैंडम स्टेटकी वैल्यू कर देता हूं 42 चलिए ये हमा ...[Details]
-
uhactivation functions if my activationfunction is a continuous activationfunction right let's say a ...[Details]
-
GenAI Essentials – Full Course for Beginners - Ep28
positive axis is linear and thenegative axis has a gentle gradientcloser to zero do you notice that ...[Details]
-
Chris Langan - The Interview THEY Didn't Want You To See - CTMU [Full Version; Timestamps] - Ep20
do have certainconstraints you know reality is full ofconstraints and we're better offrecognizing wh ...[Details]
-
y train of thatparticular Index right so if I do ytrain zero so y train zero should comeout to be wh ...[Details]
-
How to use ChatGPT in 2025 _ ChatGPT Tutorial _ ChatGPT Full Course - Ep26
so now it's our turn to checkout how does the chat GPT 4 will work soI'll take a new chat here I'll ...[Details]
-
quick allright so that the image wasn'tgenerating because it's actually the URIis supposed to be a J ...[Details]
-
time you will have toinstall tensorflow and caras right sojust go ahead and uncomment this and youca ...[Details]
Hot reading
Random content
- Learn Blockchain, Solidity, and Full Stack Web3 Development with JavaScript – 32-Hour Course - Ep29
- How to use ChatGPT in 2025 _ ChatGPT Tutorial _ ChatGPT Full Course - Ep17
- The 3 Year AI Reset_ How To Get Ahead While Others Lose Their Jobs (Prepare Now) _ Emad Mostaque - Ep26
- Artificial Intelligence Full Course 2024 _ AI Tutorial For Beginners _ AI Full Course_ Intellipaat [DownSub.com](1).txt - Ep96
- Solana Developer Bootcamp 2024 - Learn Blockchain and Full Stack Web3 Development - Projects 1-9 - Ep47
- How to use ChatGPT in 2025 _ ChatGPT Tutorial _ ChatGPT Full Course - Ep70
- How to use ChatGPT in 2025 _ ChatGPT Tutorial _ ChatGPT Full Course - Ep3