New Ethereum talks, every Monday. The week's conference uploads by event, in your inbox.

Loading player…

Build Your First Contract with the Wizard of OZ

DevconMon, Oct 9, 2023, 12:00 AM

Visit the https://archive.devcon.org/ to gain access to the entire library of Devcon talks with the ease of filtering, playlists, personalized suggestions, decentralized access on Swarm, IPFS and more. https://archive.devcon.org/archive/watch/6/build-your-first-contract-with-the-wizard-of-oz/ Whether you are a new developer writing your first contract, or an advanced one starting a new project, the OpenZepplin wizard is here to help you bootstrap your smart contract contracts. Let's see how to use it, from the basic contract idea to its deployment, in under 5 minutes! Speaker(s): Hadrien Croubois Track: Developer Infrastructure Keywords: Smart contract,Solidity,Cairo Follow us: https://twitter.com/efdevcon, https://twitter.com/ethereum Learn more about devcon: https://www.devcon.org/ Learn more about ethereum: https://ethereum.org/ Devcon is the Ethereum conference for developers, researchers, thinkers, and makers. Devcon 6 was held in Bogotá, Colombia on Oct 11 - 14, 2022. Devcon is organized and presented by the Ethereum Foundation, with the support of our sponsors. To find out more, please visit https://ethereum.foundation/

Transcript

foreign [Music] thank you for coming I'm Adrian I work at open Zeppelin and today I'm going to show you how you can very quickly build your first contract with open ziplin Wizards very quickly a few points about open Zeppelin you may know us but our testis now is that there is a trillion dollar open economy being built on Smart contracts and we are not the one that are going to build it you guys the builders are going to do that through your dabs through device through everything but in order to do that you will need a set of two products and services that will allow you to do it in a safe and effective way and that's where we're coming uh trying to be the leader providers the leading providers for for solutions for for that developers and people in this web 3 space uh we do that through many offerings or it's obviously a Defender that I encourage you to try if you haven't tried it already for for managing your contract uh and and also the open the print contract Library obviously and we support a lot of network so last year one thing we did on the contract team is create the the contract Wizard and basically so it should be animated but it's a PDF so sorry you'll see interaction later uh the contract with are basically a website that allows you to bootstrap basically a lot of contract trc20 721s Governors we'll see that together and the idea is to remove as much pain as possible in the early stage of building your contract by providing what is common to everybody what is easy so that you can then focus on either just deploying them and building your your app on top of it or customizing it with some logic so yeah we don't have much time so let's just go to a demi so you know how the network is so I'm just running a local instance here but you can get that through wizard.thensepin.com and for example today I propose that we both create a governor Dao that we could all be participating and our participation in this Dio will be represented by an nft so we'll start by building an nft contract so we're going to take a nearest 721 contract we're going to make it mintable and you see the code change so if you are teaching solidity like using that is also a great tool for for for showcasing how like adding features modifies your contract so I'm putting the vote module obviously because that will help us a lot I'm using roles instead of own ability but you see that the wizard updates everything very nicely and and that's it that's a very simple maybe make it burnable that's a very simple uh nft contract so once you have that you can just copy paste uh download it but what we're going to do is open it in remix and it's also a local instance of freemix because Network um and if this one and and here you see that your your code is here uh it just got put into into this part here so we have the file and we are ready to work on it but we want to do a governor so we just need more than than just an nft so we're going to go back to Here and Now go to the governor and let's make a governor that is pretty simple with a current that's at least 10 nft holders we need to participate obviously we are going to use erc721 votes we don't want a time lock but we want to make it upgradable to your UPS so yeah so that's a governor that is upgradable and since it's upgradable maybe we don't want to have the setting updatable you will update and to upgrade you do what you want that's that's just our code so it turns out to be a pretty small piece of code but uh if if I had put that like you see that there is a lot of overall specifically some overrides that are sometimes painful so the wizard is here to to help you figure that out and so know that I'm happy with my Governor I'm going to just open that in mix leave this one remix is a bit strange but now I should have both files here my token and my Governor so let's let's deploy so I'm going to use a local compiler because authorize it's not going to work without network and I'm going to compile this file this is possibly the longest part of deploying a contract is actually compiling it's in the remix in this case hopefully it doesn't take too long because I only have three minutes left okay it's good one thing we could do is like this is ownable but here we could just modify that and make it only governance so that uh your your great ability would be managed not by the owner that we can remove uh but by the by the governor's Governor itself so this is a good time for you to like modify your contract a bits I hope you hopefully I haven't made any type on it will compile again always the longest part yes it's good I also need to compile this which is my token so here and now that this is compiled yes I can just go here take my token so my token is here it's on your system 21 I can just deploy it again to a local instance we're not going to wait for for girly oh I removed it yeah this is okay this is my token here uh I've got a lot of features so I can just take my address here and paste it into safe mint to Mint myself one to three tokens yeah I've got three tokens uh if you could look at my balance I've got three tokens I need to delegate this to myself so I'm just calling the delegate function and right now if I go to get votes here you'll see that my wallet has also three votes so that's good know that we have this we are going to deploy the second part which is our governor where is the governor it's not here uh do I need to yeah okay my Governor is here uh we remember that the governor was an upgradable contract so basically what is going to happen is that freemix is going to understand that and is going to deploy first implementation and then the proxy which it's great from remix to support that so now you see that I have to contracts the governor and this and if I go there and I just again copy paste the address of my my account and I see is the get passed vote where is it um oh it's in the view function I've got the get votes that allows me to check what were my votes at block number six and I broke number six I had three votes that was after I I delegated that book number three I had zero votes that was before my delegation so we're not going to do a proposal or anything we are out of time but you could take this put it into Defender to propose easily from open the plane Defender you could also link that to tally so that your user and your nft holders can vote easily and so basically in seven minutes we managed to to deploy an entire governance system Benson nft and that wouldn't have been possible without the wizard so yeah that's what we are very proud of that we want you to use and yeah and I should have put the advice the address is wizard.openzaplin.com thank you

Automatic transcript — names and jargon may be misspelled.