[ETH Seoul 2024] Building Dapps on Ethereum with ScaffoldETHv2 by Eda Akturk
ETH Seoul 2024 · 11 Apr 2024 · 41:53
Eda Akturk of BuidlGuidl introduces Scaffold-ETH 2, a toolkit for building decentralized applications on Ethereum, as a live demo aimed at hackathon builders. The walkthrough covers the stack (Hardhat or Foundry, Next.js, wagmi, viem, RainbowKit), a burner wallet and local faucet, deploying a sample contract and wiring it to the front end. It also introduces Speedrun Ethereum and the BuidlGuidl community.
Speakers
Topics
From ETH Seoul 2024, hosted by Kryptoplanet.
Transcript
uh hi everybody so um I guess it's been a long day so I'm not going to take a lot of time but I want to present to you a toolkit which you can potentially use at the hackaton today to kind of make your life easier to develop really fast because it can get like quite hard when you want to work on your front end work on your back end how are they going to integrate you have like a limited amount of time so today I'm going to be presenting scaffold eth version 2 uh and kind of what you can do with it it's going to be a live demo so I hope everything works out if everything doesn't work out I am will be around so I will be happy to help you out I know Hunter is here too um so let's directly get to it it's going to be like a short
introduction and then we're going to directly get to it live uh and for my introduction my name is Eda and I it's my first time in Stall I'm loving it so um yeah I'm part of Bill Guild which is a developer Community bidle gitt I just say build Guild because it's easier to say um so I'm going to tell you a bit about build Guild as well and hopefully you will join us together and we will work on together on projects okay and a short outline we're going to quickly go around with SCA 2 just explaining what the tech stack looks like and then I'm going to show you speedrun ethereum and then we're going to talk about build Guild again it's going to be a live demo so I'm going to be trying speedr running all the things I do
uh so first of all what is scaffold e version 2 uh now scaffold e you can scan the QR code to directly go to the link as well uh so scaffold is a toolkit for you to build decentralized applications on ethereum uh it uses it has a teex stack which uses uh different components that I'm going to talk about but basically what it allows you to do it gives you a front end and a backend smart contract and you can directly edit your smart contract and then go and see it on your front end as well so you don't need to like do all the all the redeploying it will directly be available for you to test I mean you do need to do the redeploying but it gives you like an interface to directly test your smart contract so we're going to do like a demo of this so it's going to
hopefully be more clear but just to give you like a background on the text that we use is it gives you two flavors so you can choose hard hat or Foundry you're not bound to one uh you basically have the option we use wagm VM nextjs so it's a nextjs toolkit we use types script uh and then it's integrated with rainbow kit and we use Daisy UI so for some built-in Tailwind CSS components uh which make life very easy for those who don't like to build front ends like myself um okay and speedrun ethereum so uh we will after I present SCA version 2 you might want to go to speedrun ethereum which I highly recommend you to do so it basically gives you a set of challenges with SCA 2o so what it gives
you is it gives gives you different challenges including like building an nft application decentralized taking app token vendor dice game so you build all these and it provides you the set of in instructions to go through very easily uh and after kind of completing I think until after Challenge three then you can join build Guild as well um and there's actually like almost 9,000 people which completed speedrun ethereum which is quite an impressive number uh and basically you kind of sign in with your wallet so it's a very native web3 crypto experience and then once you're like okay this is really cool I kind of want to get to it what do I do next is then that's where come where b g or beld comes in so we are basically a group of developers
working in the ethereum ecosystem building different tools and products one of them which is scaff version 2 uh and we kind of build these products we're a developer organization and we give bounties small bounties for developers to continue to build uh different tools uh so you can see like for example people can kind of have their statuses they can say you know I'm building this application I build like a token vendor I build like a soulbound token example Etc so you can kind of have all these and you can have your profile and then you can earn some money while you're learning as well uh we have different like educational content like we do some video series those kind of stuff which we will I will try and show as well and now for the demo which I think is going to be the most exciting
one and since it's going to be a live demo I hope it works out uh I have it downloaded in case it doesn't but I'm going to try and do it all live right now together okay so the first thing that we do is we go to scaffold eat.io so you can just write scal version 2 on your browser Google it or if you scan the code you can go there but the first thing I'm going to do is I'm going to just get to this okay opening my terminal let's I have that Soul folder and then I directly create it with MPX so it kind of makes my life easier here I'm going to name this up let's call it live demo and then you can choose you can choose
hard at or Foundry I'm going to choose hard at but you can completely choose whichever one you want and then I'm going to say yes install all the packages because I want it to directly come out of the package with everything and then once this is going to load it's going to give me two packages so we're going to have your next JS and then your hard hat package or if you chose Foundry you will have your Foundry uh we have a doc SL so while this is loaded let me show you the doc side doc um so the doc side has almost everything you need as well it shows you like it has a quick start so you can directly go here it tells you what you need to have downloaded before you begin it gives you the setup like you can use git clone but I would suggest to
directly use the MPX option uh just like we did here and then it gives you the option to choose it shows you how to set up your environment one thing which I did not mention but we will get to is you can deploy your contracts to different Networks works so I'll be deploying to Local Host but you can say you know I want to deploy to base I want to deploy to optimism you directly have all those options built in and the docs are pretty good to show you kind of how that works and then you can launch your xjs application and it kind of gives you like all the components interacting with your smart contract Etc okay so we have our application loaded let's go into what did we call it oops live demo um so I'm going to directly open this in my editor
okay let's kind of pull this here so let's look at what this has so I'm going to make this bigger I have my packages oh let's kind of zoom in um okay this is better I hope so uh this is what we just downloaded um it's is called live demo cuz I named my app live demo and then what we're going to look at is you also have the read me which presents you all the instructions kind of what we have in this application over here uh and then it also gives you the requirements so one thing which we kind
of wrapped through was uh you basically need node yarn and git to have this all working it actually initializes you a git repository so it gives you like the flexibility to do that and then it gives you like all the setup over here and what we have which is important and which we're going to look through is the packages so you have two different packages we have the hard hat and the nextjs hard hat is our smart contract development environment and we actually have like a sample smart contract here so it gives you like the deployment script the tests and then a sample smart contract which we will be editing and then the second folder which we're going to look at is a nextjs folder so this is like a sample nextjs app and it has all the like binaries which you need for
your smart contract so when we make like changes for your smart contract the nextjs app will automatically detect that the CH the changes were made and then it will display it on your front end okay we're actually going really good so I have 32 minutes so I think it will work out for us um okay so before like actually editing let's go ahead and look at what this looks like cuz I talked a lot but I feel like I haven't shown you what it actually is oops because I didn't start my application so once I kind of load this I need to start a few things I need to do like a yarn start I need to do both a yarn start to start my next CH application I need to do a yarn chain to start my hard hat uh
local environments and then I need to do a yarn deploy to actually deploy my smart contracts so let's do a yarn start and then I open a new terminal window over here so I basically now have two terminal Windows I'm going to do like a yarn chain over here so this is going to start my local hard hat environment if I did not do this it would give me an error um actually I can show what error it gives as well so it will basically tell me that I don't have an environment when I try to connect you see uh I don't have a yarn chain started so let's start this uh this is all on my Local Host so um no real money included right now and one thing which we kind of walk
through really fast is now what this has is it has like a burner wallet so you don't need to have like metamask or any wallet connected to your application burner wallets are basically stored in your browser so every time you open a new browser it will generate you a new wallet uh it also has a local faucet so you don't need to like think about okay like where do I get those funds like how is it going to work etc you will just create like grab funds from faucet over there on the right side and then it will give you it actually has like a built-in block Explorer as well so it kind of gives you okay like this is your app just focus on editing your smart contract or your front end and so what happens is I will go to deploy smart contracts but we did not deploy our
smart contract so I mentioned that we need three terminals right so we right now have two we have the yarn starts running we have the yarn chain running over here so I'm going to open a new one oops wrong I'm going to open a new one over here so now three Terminals and I'm going to do a yarn deploy so yarn deploy will deploy my smart contract which is the sample your I think it's your contract. soul um so I do like a yarn deploy and then hopefully it will deploy my smart contract okay awesome so uh it give me a greeting initial greeting building Unstoppable apps um okay this is a fun one so this is now my smart contract which is deployed uh let's
actually look at the Smart contract okay I'm going to make this bigger uh is this oh this is the wrong one this was Workshop this was my backup plan uh where is our application okay perfect um I am going to go to contracts your contract. song okay so this is our initial smart contract this is just a very basic smart contract which has some like uh variables stored and then it has like a few set like a few uh functions uh now what it has over here it's called your contract and it's under your contract. you can find it under either your hard hat fold or your Foundry
folder it's going to be the same uh hard hat contracts your contract. so and then it has like an address there is an owner of this contract there's like a greeting which is set to building Unstoppable apps there's a premium there's a total counter so basically when we do like a change the counter will increase it kind of showcases you like a sample smart contract and let's interact so uh what shall we do let's change our greeting right right now it's building Unstoppable apps let's call it building un stoppable apps at8 so okay uh I'm going to do this okay but it did not work because I don't have any money in my wallet so you can see it's zero e so I need to pay for
this transaction so I'm going to just grab funds from the faucets uh it's all on Local Host so it will give me like one e so now I have one e on hard hat again it's not real money so now I can basically make the transaction okay so the greeting change we made the transaction you can see on my like you will see uh on our hard hard chain that all the call has been displayed uh and now it's called building Unstoppable apps at e so and then the total counter has increased cuz we changed like our value and then let's call it like something else um let's uh let's make new greeting not very creative um okay and then so basically
I'm now interacting with my smart contract I'm following the function called set greeting in my smart contract without actually having to edit the smart contract I'm just changing this from the front end so let's go back over here uh you see this is the function called set greeting uh it displays a console log which you know you can just erase uh it update it sets the greeting to the new greeting which we pass inside over here it increases the counter we have like a total counter uh value and then it basically like sets like Records who is the sender and then uh it kind of sends that message you know greeting has been changed now there's also this premium flag which I can show uh basically this is a payable function and
in solidity payable function means that you can send money to the function as well um so what this means that when we're actually doing this we can say okay like let me send like one e or 01 0.1 e into the contract and then if someone actually sends money the premium flag will turn true so I can just show that before we actually start editing our smart contract and then let's say it's so again and then let's say like 0.1 and this is going to we're going to convert to way so I do this it automatically converts and then I send and what I'm expecting to do is I'm expecting that the premium flag will become true because as you can see over here if there's a message. value if there's like
some money passed into the contract it is going to be um coming here so it's going to come to the first if statement and the premium flag is going to be set to True let's try this yes okay it worked cuz sometimes live demos don't work um but basically now you can see we actually sent money to this contract and then it changed our premium flag so this is kind of an overview and all the transactions we can actually see on the Block Explorer over here so this is a built-in block Explorer you don't need to do anything this is available to you just as you start the application so you know just like ether scan or like optimism has their own scanner you kind of go there to see your transactions this is basically your Local Host so I can see okay like what are the functions
which have been called who call them and all that information is available to you over here I kind of want to show that because I mentioned you know uh you don't need metamask and you have different wallets which come up for you let's open like an incognito window and it would actually give me like an oops not LinkedIn uh it will actually give me like a new wallet so this is like purple person with one B ending this is let's say this is like a green person with a 67 so the wallets are on your browser so you don't need to do anything like as you can see I don't have metamask I don't need anything I'm not connecting I don't need to do that to actually test my function and to run my application so it's directly coming to you out of the box and we're doing really good on time
so uh now you have this and you're building like something for the hackaton what do you do right like that's the main question we have um so I'm going to go I actually have like a small kit of what actually wanted to build you and I'm going to share this here so that anyone can actually follow oh I have it here so we're going to like build some many tool I have this eat Soul Workshop which I prepared before for this hakon um and again it gives you the step it gives you how to Smart your um start your chain and update your contract so let's do that okay so I'm going to go to my smart contract this is my smart contract and I want to add a new function so what we do
over what we have over here is we have an owner when you come over here to your okay let's open Local Host let's actually make this bigger there is I come to my contract there is an owner right like this 2267 so when the when this app is deployed someone is set to the owner and let's grab funds but I have no way to change this owner so let's say I want to change this owner and you can actually use like directly built-in like uh smart contracts from open Zeppelin to like update your owner but we're going to write something ourselves um so I come over here to my code and I want to write a change owner and even before that so you know you you are kind of thinking what shall I do you can directly go to solidity by
example to kind of see what is available to so it gives you like all the things which you can do like it gives you different variables um it gives you more advanced stuff as well like it talks about we talked about the payable function so what does payable functions do how you can write a payable function you can so you can get like code Snippets directly from solidity by example.org it's kind of very easy to use there are other tools too but I think this is like really simple and easy so I usually go there and okay so I came here I figured out what I want to do what I want to do is basically have a function what changed the owner because currently there is one owner and I cannot change it so that's kind of a sad thing and I'm going to go here to my smart contract
and I'm going to write a new function okay I am not changing anything else I just want to write a function I want to call it update owner and what it's going to do is it's going to input like a new owner which you can you know change the owner will now become the new owner so I say function uh update owner okay so actually my co-pilot is doing the work for me so if you have get up co-pilot which I definitely think you should uh it kind of gives you the code already so uh we can directly take this this is it's giving me an error and I actually know why this error is but basically update owner will take a new owner we're going to remove this for now it's going to be a public function and
then the owner is going to be set the new owner which is what we pass into this function as a parameter now why this owner is giving me an error is uh it tells me so the owner is currently immutable so uh the owner is set and you cannot change it so I'm basically going to make it mutable um so that's what the error was now basically we can have an owner but we can also change it and this is not a good function because anyone can change the owner now so like if you are not the owner of this contract you can just go in and change it as well but let's kind of see what it is and then we'll add like the key so that not everyone can change it once I make changes to my contract I do need to redeploy so I come over here I do
another yarn deploy every time you make changes to your contract make sure to do yarn deploy I'm actually going to do a reset to make sure that nothing is saved okay so basically now we should have like a new function called update owner when we go to our up this is the problem of too many windows um okay so it's here another function in our right so there's the read box and then there's the right box you basically have like a function called update owner so anyone can come in and change the owner and let's see if this actually works because we don't know if it works yet so I'm going to copy this address I'm going to add it here and then let's do a send okay as
you can see the owner now changed so the owner is now this address let's let's make like retalic the owner okay you can directly write ens so we're going to make ralic the owner of this smart contract on our Local Host so he will actually not be able to see it but let's do it and as you can see vitalic is now the owner of our smart contract you can come you can change it uh what we did was we only added like a new function to my smart contract and then it directly reflected to our front end so I don't need to go on like it just makes my life easier as a developer developing at a hackaton when you have 48 hours to build something or 36 depending on when you get started um okay so we did this this is
great but this is not very safe because everyone can come in and change the owner right like if someone else opens this application they can change it well they they do need to be connected to my local host um but I want to make it so that the owner current owner can only change it so in solidity we have something called modifiers these are basically like um conditions you can add to a function so it will check if it's correct it's basically like an if statement um it's called like a modifier so you can add like a modifier and if that modifier is true it will only go into the function and we actually have a modifier it's called is owner you see yes where this is own owner defined so there's this modile called is owner already defined here which basically
checks like require means like only if the sender of only if the person making the transaction is the owner can do it otherwise display like a word like a string called not the owner so I directly copy this is owner and actually my GitHub pilot knew that I needed that so it gave it to me before but we wanted to see that we can do it this way um so I just added that is owner modifier into our function you can add multiple modifiers by the way you can say like is owner is ed. e for example which is actually not my enss but you can kind of do like different modifiers multiple modifiers for your functions to make sure that they all pass the check okay so I basically added this new uh is owner modifier over here so now what
it's going to do is only if the person making the transaction is the owner of the smart contract they can do the transaction uh but we actually don't know who the owner is right the owner is a set by the hard at local account who deploys this function and you can do that you can go to kind of see and change this you go to your deploy scripts so I have my deploy script over here so you can see it gets like a um the script is basically run when you deploy like when you run yarn deploy um and then what it does it it gets like one of your hard hat local accounts and then it sets like the ARs which is the arguments which take like the arguments which are pass
then over here uh to the Constructor um is set on that deployment script so it's kind of taking like a hardhead account and then it's passing that over here um and all the documentation also gives you this by the way so if I'm going really fast like I will the documentation kind of goes through that as well but let's kind of make this account like let's let's open on my Brave browser let's open a local host here and let's just make this 92 account the owner right so like now um did we redeploy we didn't redeploy but like let's redeploy first to see now that because only the owner can make the change not everyone can do it okay so uh
let's see let's make this account the owner is currently like with 66 I'm going to say I want to make this account the owner let's see if this works oh wait okay the uh the contract function update owner reverted because not the owner so as we added the modifier now it's not going to like make allow everyone to update who the owner is um and let's make it so that this oh let's make our okay this is the brav brave browser I'm going to copy this address I'm going to make only the brave browser uh the person who can actually uh update the owner so I come over here um I add it here do I need to add like quotes I'm not sure let's try it so now this is basically going to be passed I might
need to quotes but we can try so this is going to be passed as our argument to our your contract. soul and to our Constructor as an owner let's see if it doesn't work it will just give us an error okay it didn't work so I think I needed to add it this quotes yes let's see okay so yes now basically we were able to set the brave browser as the owner let's see okay as you can see the account with 92 is the owner so only they can actually change it so let's make it again metallic okay uh again this ens matching is a cool feature because you can just
write the ens and it will automatically um resolve to the address so I do a send uh uh it didn't work because I have no funds I grabbed some funds from my faucet now I have one e on hard hat now let's close this because they are kind of annoying and then I do a send okay as you can see now vitalic is the owner but let's say like there's like this other uh Google Chrome account which is like I want to send the change the owner um so I go over here to deu contracts let's see if they can change it let's make it my ens and. tweets. e but this is again the account who is not the owner so now only vitalic can actually change the
owner yes it fails because they are not the owner so this is kind of how like what we did over here is we added like a new function to our smart contract we made some changes the way we test it was in our frontend in our nextjs which automatically reflected the changes so it kind of made our lives easier and this is done from the debug contracts tab uh we didn't really make anything we have our own uh burner wallets which were able to kind of make our lives easier because we don't need to constantly connect to metamask right like if you're doing this with metamask or like another wallet you always need to connect to that wallet um so that kind of doesn't get you the best developer experience um and what else should we do
let's since we have a bit more time we can actually go ahead and edit our smart contract and I'll try to do that in like 8 nine minutes which is actually really hard for me CU I'm not a front-end Guru but let's try so I'm going to go into now I'm going to go to my next just folder so what I'm going to do is not components sorry going to go to my app and I'm going to go to my page. TSX uh it's written in typescript so this is the welcome page this is the page we have over here so the welcome page is basic basically on your page.
TSX and let's what shall we do let's let's delete all this let's actually delete all of this right think I have like some missing diffs okay okay so I deleted all of this let's go ahead and see that it's delete yes so what I'm going to do is we added like this new uh function right to our smart contract so let's display like like let's make some small front end which allows you to actually run that function on your a bit nicer looking front end so scaffold basically has some hooks which makes your life easy to build like nicer looking UI uh so what I'm going to do is um I'm going to first
like display let's display the account address over here so this is uh wag's used account and let's go to wagm docs to kind of see it you can basically go to wag me uh which is basically your react hooks uh I already know what use account is but it's super easy to use you can use like how to get um information from your smart contract for example your account so it basically allows us to get the account like use account and then you basically use like you can understand which account is connected to your application with this hook uh so I'm going to directly use that that's kind of display okay we call this already connected address so I'm going to like directly like say connected address so if there's a
connected address this is basically going to display but it's not going to be very pretty okay so this is basically my connected address uh as you can see it doesn't show me the ens right like we had like thee in the previous debug contracts tab we had like this ens Avatar which is pretty cute and we want to have on our actually um homepage as well so what scaff gives you is it actually gives you like some components like it has like an um address component and let's go to the sca two docs I go to the docks I go to components you actually have the address component so this address component allows us to actually have that mini ens resolver as well if we have an ens tied so I'm going to do
this I'm going to go back to my uh app I'm going to say you know I want to use the address component and I'm going to call it address equals and connected address why is this giving me an air did we not import that let's there we get this one here okay so this should Now give me like a nicer UI with the small okay as you can see now we have the mini ens resolver over there as well so if this actually is ANS you know it has like
vital. e it will actually display as vital. e so kind of makes our life easier but this again is not a pretty UI um I don't think it's very uh yeah I I I find it really difficult to build frontend application so I find it very convenient to directly use the hooks in scaff E and again you can come over here you can see like the different components available to you uh we try to make the documentation uh a bit more user friendly but if you have any questions or anything you can always let us know uh so what we're going to do is let's actually make make like a small card component let's and let's call this connected address right so I'm I want to see which address this is this is my connected address and then okay I'm going to cheat a bit and
look at what I had before to make sure we do the steps and I'm not missing anything we did this we made we eded our smart contract deployed it we added like uh a a user component Okay add a so I mentioned we use da UI daui basically gives you some components buil with Tailwind CSS so it makes it kind of easier to um build like it it just gives you like out of the box uh tools which you can use for your front end um and let's kind of show how that works that's a mouthful I said Daisy UI I can go directly to Daisy UI it's yeah it's a library for Tailwind CSS and this is what we use and I want to build a card so I'm going to directly
go over here I'm going to get a card uh there's this let's directly get this shoes one are these different I directly get here I'm just going to copy this I'm going to move here I'm going to paste this uh by the way my uh code editor automatically formats my code when I save so that's why it's automatically formatting I really find that uh really helpful so would suggest to have that setting on okay so I mean we could have this too but this is just going to display the Nike shoe so let's again how it work looks now so now I go okay shoes which we obviously want to change uh but this is kind of the component which we have here so I'm going to edit this component and I'm going to try to do that in a few
minutes okay so I'm deleting this uh we're going to do update on or like let's call it yay or okay yay e so and let's call it a bit more professional building and need Sal okay and if a dog choose shoes who Sho okay this is not good um so now we have this and then we're going to change this to update now here I just made some quick changes it's actually not going to change anything it's just okay it just displayed a card so be um building in Soul and then you have this update now but nothing works right now it's just
like we just what we did was we went to Daisy y we took a card we added it to our application we have only one minute passed so that's good uh so what I'm going to do is I'm going to like have a small div um sorry oops is okay let's say this and then we're going to say I'm going to do what we did before which is the connected address and thank you for making my life easier get up co-pilot so it will automatically display a connected address and then let's actually also display the owner address
right like since we want to change the owner in this function we'll actually show how that works um so I come over here you can see connected address is this one and then let's show the owner address now the owner address is specified on the smart contract so what we need to do is we need to have uh some some method to actually read from our smart contract which we don't have right now but which we will add so the owner address is going to be like another address that's called this like uh 0 x0 for now just to kind of see out oops this is not working okay this is give me an error which is fine um let's just have this okay so it's basically going to give us okay two components but this is not the owner address right now
we directly added the connected address what I want to do is I want to read from our smart contract to directly get who the owner is what I what I mean by read is as you can see the owner is over here so there's like an address public owner in our smart contract and I directly want to get this so what I can do is I will basically have to use uh I can use wagm to do that or I can use the the components we have in uh scaffold e to do that and let's kind of let's go and look at that I'm going to go to scaffold e Doc's not here okay since I have 5 minutes I'm going to try and make it a bit fast
um so you have basically interacting with your smart contract so we have use scaffold contract read so this basically gives us like the hook to directly read from my smart contract without making a lot and let's go over here so let's say cost and then it's trying to suggest something which is not what I need right now but let's say Okay use I think it's scaffold contract read okay okay it's going to give me let's directly ask this and then let's we need the function why is this giving me an error um and then function name I think and then the function is going to be what is our function up owner is it owner okay I think this should
work right and then it's going to pass some data which is going to be the owner so basically what we're trying to do is here we're trying to read who the owner is and we're going to pass it over here and then I think this is actually address okay it's actually data um awesome and then what we want to do is we want to also have this button to basically update when we have a new owner is going to work I'm not [Music] sure okay so as you can see we were Direct able to get our owner from our
smart contract we it from there and it's displaying its ens directly so I basically what I did was only pull in use scaffold contract read uh get up co-pilot did most of it for me so thank you for that um and then it basically gives us like our owner you passing your contract if it had some arguments passed in you were able to do it like like this args and then kind of passed them in here but it didn't so we didn't need to do that um oops and and basically you can kind of see all the instructions over here so you don't need to memorize all this as you can see this is actually an example with arcs so it does that but now because I have three and a half minutes left I am going to actually kind of copy my previous code over here so
basically what we want to do is when we um we we basically want to like now have a function to update the owner directly in the application right I think we can actually like build this here few minutes so I want to have oops that's not it so now I'm going to kind of call read over here we are only doing reading so we are only getting value for my smart contract we're not making any changes uh I'm going to first of all add like an input component let's add let's copy this first let's like add a new owner component over here um new owner new address this is going to be address
inputs so we're going to allow the user to add an um an input and I think it takes some value so let's see value equals um as this value think I'm doing something wrong here quick fix okay okay this is not it am I doing it wrong let's see what I have to still um it should be address input let's check our docs can we search
here okay let's I'm not trusting myself so I'm just going to copy paste from here um on change okay we can do that address we're going to do this owner value is the owner and then we're going to we going to do like a new owner we're going to add this oops not like this and the placeholder is the twice just giving us we actually got do that's do we not have address input ined we actually do um so let's try go okay so it actually gave me displayed
to me the address input it's giving me some errors but we'll solve that a bit later uh so basically on change it's going to change to a new owner and um basically what we want to do is we want to use like a used contract rights so basically we want to kind of change our smart contract directly from this user application and for that I actually have my function over here so we're going to call use contract rights which takes in a contract name previously we took on the function owner which basically just pulled in like a value for my contract and then now we want to have it uh you know actually change it so I'm going to copy this from here due to very limited time constraints I do like use this is probably going to be imported it's missing an import we do
this new address I didn't add I think GitHub Cella will actually tell me to add that okay no so basically I needed to add like con new address and set a new address over here I probably need to input react oops okay so basically what I did was I basically now have like a new address and set new address uh State function in react so I added this I added the use contract right because um this is what is going to allow me to actually update edit my you know call the right function on my Smart contract it's calling your contract it's calling update owner and it passes in the new address so what we need to do is now we need to add uh
awesome uh so my time is up but I kind of just want to leave with a last note over here so what we basically need to do is we need to add like that small function an on click function which allows us to change the owner directly on our front end and I'm really sorry I couldn't get to it uh but I'll be here around afterwards so feel free to come and I will finish this code uh you can directly run yarn deploy and select the network you want to deploy to so now we're doing it all on Local Host but you can directly deploy to B directly mainnet uh optimism Etc and then one thing to remember from this talk is to go to speedrun ethereum.org [Applause]
