Current location: Current location: Home > python > Web3 Developer in 2024 Roadmap_ Solidity, Smart Contract, and Blockchain Development [Full Course] - Ep54 Text
Web3 Developer in 2024 Roadmap_ Solidity, Smart Contract, and Blockchain Development [Full Course] - Ep54
[python] Time: 2025-07-11 11:43:23 Source: AIHackNode Author: java Click: 165 times
documentshere we're going to look at our callfunction now we'll link this down in thedescription as well but katt williams theo vonyou can see herethe call function we have to supply itthe string of the function name thatwe're calling then an array of thearguments the function takes now what wecan also do is if we come down to thebottom here there are overrides and inoverrides we have something called valueand what value is going to allow us todo is send native currency of theblockchain that we're on along with ourtransaction and if we take a look at ourtip jar here that's what this nativetoken value is here it's not not anargument that we added into our smartcontract function this is because it isa payable function it allows us toselect the amount of the Native currencywe want to send along with the functionand because we are sending .001 Matic weare going to give that the override andpass that into our value here whensomeone clicks on this web 3 button socoming back to our code editor herewe're going to here add valueand again this is going to be in way sowe can use that way converter again andwe will convert to .001 Matic into wheyand paste that as our value so what thisis going to do is allow us to send .001Matic when we call the sendtip functionso if we come back to our applicationhere we now have this button that allowsus to send .001 Matic so if we click onthis button here we're going to get atransaction that comes up now you cansee that we are paying 0.001 Maticbecause this is a payable function we'reactually transferring some of the Nativecurrency here in this case in Matic whenwe execute this function we're going tohit confirm hereand there you go our transaction wentthrough we don't know our balance yetand we don't know if we can withdraw butif we take a look at our our tip jarcontract and we head on over to eventsyou can see that we now have a tipreceived and this is the amount that wejust sent over which is .001 Matic in awayso we know that our tip went through butnow let's work on the next components ofour application here that we can viewthe balance of our contract and we canalso withdraw that balance so before westart coding that section of ourapplication if we come back to our tipchart here and we go to the explore tabif you remember in our read functions wecreated a function called get balanceand this returns us the value in way ofthe balance in our smart contract whatwe're going to be able to do is callthis function and get that informationto display in our application so headingon back to our code editor here that'swhat we're going to display in this tipjar balance we don't have a built-inreact Hook from third web that can getthis tip jar balance because the tip jarsmart contract is a custom Smartcontract that we built so how do we calland execute functionality from our smartcontracts well similar to how we calledthe send tip function here we canactually do the same with our reacthooks so similar to how we did a bunchof the other react hooks to getinformation from our contract we can getour data here we'll just say tip jarbalance and what we're going to doinstead is use the contract read hookand what the contract read Hook is goingto allow us to do is call any readfunction from our contract so what wehave to provide it is the contract thatwe want the read function from so inthis case contract which we establishedup herewe then have to provide it the functionname so the function name is going to beif we come back to our contract here iscalled get balance so in a string herewe'll say get balanceand then just like our other function uhwe would pass it any arguments butbecause we don't have any arguments forthis get balance call we're not going togive it anything here but now in our tipjar balance here we should get back thebalance which is going to be returned inwayso back here in our tip jar balancesection what we can do is create sometext hereand we can just say uh total tipsand below that we will then check theloading status of our call and whatwe're going to get back in return isthat balance in way now we don't want todisplay it in way because if we displayit in way let's just display our we justdo our tip to our balance here and wesave this and go back to our applicationuh it shows us that way number which isa lot more than what we actually have inour tip jar we only technically have.001 Matic so what we'll have to do isconvert this into .001 and to do thatwe're going to use a converter fromethers so we're going to use etherswe're going to do that utils and whatwe're going to do from here is formatether and what format ether does isgoing to take a wave value and give usthe eager value back and after thatwe're just going to put Matic becausethe balance we have is in Matic socoming back to our application here younow see that it displays point001 Matic so again we're able to readany functionality from our smartcontracts and store them into variablesusing the use contract read hook next inthis withdraw balance we want to be ableto withdraw the balance that we havewithin our tip jar but we only want tobe able to show the withdrawal button ifthe wallet connected to our applicationis the owner of the application so howdo we check if the wallet connected isthe owner of the application well in ourtip jar here in our smart contract wedid create a variable here called ownerwhich we can view and read from oursmart contract we can also get thewallet address of the connected walletwe can get the address here using theuse address Hook from third web thatwill give us the wallet address of theconnected wallet and then we can
(Editor in charge: kotlin)
Learn Blockchain, Solidity, and Full Stack Web3 Development with JavaScript – 32-Hour Course - Ep103Web3 Developer in 2024 Roadmap_ Solidity, Smart Contract, and Blockchain Development [Full Course] - Ep2
Related content
- Solana Developer Bootcamp 2024 - Learn Blockchain and Full Stack Web3 Development - Projects 1-9 - Ep7
- Artificial Intelligence Full Course 2024 _ AI Tutorial For Beginners _ AI Full Course_ Intellipaat [DownSub.com](1).txt - Ep9
- Artificial Intelligence Full Course 2024 _ AI Tutorial For Beginners _ AI Full Course_ Intellipaat - Ep50
- The 3 Year AI Reset_ How To Get Ahead While Others Lose Their Jobs (Prepare Now) _ Emad Mostaque - Ep21
- Learn Blockchain, Solidity, and Full Stack Web3 Development with JavaScript – 32-Hour Course - Ep72
- Artificial Intelligence Full Course 2024 _ AI Tutorial For Beginners _ AI Full Course_ Intellipaat - Ep15
- Artificial Intelligence Full Course 2024 _ AI Tutorial For Beginners _ AI Full Course_ Intellipaat [DownSub.com](1).txt - Ep40
- Artificial Intelligence Full Course 2024 _ AI Tutorial For Beginners _ AI Full Course_ Intellipaat [DownSub.com](1).txt - Ep22
- Solana Developer Bootcamp 2024 - Learn Blockchain and Full Stack Web3 Development - Projects 1-9 - Ep5
- [Hindi (auto-generated)] Machine Learning FULL Course with Practical (10 HOURS) _ Learn Free ML in 2025 _ Part-1 - Ep105
- Artificial Intelligence Full Course 2024 _ AI Tutorial For Beginners _ AI Full Course_ Intellipaat [DownSub.com](1).txt - Ep26
- Miley Cyrus_ Something Beautiful, Touring & Stardom _ Zane Lowe Interview - Ep10
- Solidity, Blockchain, and Smart Contract Course – Beginner to Expert Python Tutorial - Ep20
- How to use ChatGPT in 2025 _ ChatGPT Tutorial _ ChatGPT Full Course - Ep37
Wonderful recommendations
- Web3 Developer in 2024 Roadmap_ Solidity, Smart Contract, and Blockchain Development [Full Course] - Ep28
- Screwly G's First Interview! Music Video Shooting, FBG Duck Diss Controversy, Gary Indiana & More - Ep20
- Artificial Intelligence Full Course 2024 _ AI Tutorial For Beginners _ AI Full Course_ Intellipaat - Ep16
- Artificial Intelligence Full Course 2024 _ AI Tutorial For Beginners _ AI Full Course_ Intellipaat [DownSub.com](1).txt - Ep53
- Bloodhound Q50 Tells His Life Story (Full Interview) - Ep13
- Artificial Intelligence Full Course 2024 _ AI Tutorial For Beginners _ AI Full Course_ Intellipaat - Ep20
Popular Clicks