Current location: Homepage > rust > Solidity, Blockchain, and Smart Contract Course – Beginner to Expert Python Tutorial - Ep72

Solidity, Blockchain, and Smart Contract Course – Beginner to Expert Python Tutorial - Ep72

2025-07-11 11:49:11 [go] Source: MetaScripta
and if we sit on career advice podcastthis contract ifwe go to transactions and we refresh wecan actually see some of these differentmethod calls over you can see we did acontract creation we started the lotterywe entered the lottery and then werecently ended the lottery and you'llsee in our script here it says 0x blahblah blah is the new winner which isperfect right that means that the chainlck node actually responded we canactually verify that by looking in thecontract we'll go to read contract wecan go to the recent win and seesomebody did indeed recently win we canalso go to events and we can see some ofthe events that we created you can seethis first event right here is thisrequested Randomness event this is theevent that we called we have this endLottery here you can also see anownership transferred function that gocall this was called when we actuallydeployed this in the first place now alittle bit more on these events AKAthese logs right so topic zero this hashrepresents this entire event right herein this bit is going to be our topic oneour first topic which represents thatrequest ID so this is going to be therequest ID awesome we have successfullycreated a working smart contract Lotterywith true provable Randomness this isabsolutely insane incredible job herenow one additional piece that I want totalk about before we jump off here isagain in our testing a file that you'reoften going to see what's called conftestPi python automatically knows to lookfor this comp test file and we'll grabdifferent functions from it we can alsoadd external plugins fixtures hookstesting root path it adds a lot ofreally fantastic features and is acommon thing that you'll see we skippedover in here for Simplicity but infuture projects you'll probably see thiscomp test file which has a lot of reallynice testing configuration pieces init now that was a lot of stuff to codeand quite frankly I don't think any ofus want to have to do that every singletime have to code everything fromscratch now you can absolutely get Clonall of these repositories right fromtheir GitHub but there's actually aneven easier way for us to start with ablank project here and this is withbrownie mixes so if we Google browniemixes GitHub we'll get this mixesorganization which just has a ton ofboilerplate code for us to go ahead getstarted and start developing the onewe're going to be working with is thischain lick mix piece which is forkedfrom this official one here this givesus some wonderful contracts some tests abrownie config and really everythingthat we need to do to get started so ifyou have brownie installed we can justbake this mix so we'll do brownie bakechain link mix and in our new emptydirectory here we'll get this new chainlink folder with everything inside of itso then we can CD to chain link and wecan see it has all all these pieces inhere here already in the contracts wehave a whole bunch of different samplesof working with the vrf working with aprice feed working with this thingcalled Keepers to automate our smartcontracts and making API calls anddelivering any API call that we want tothe blockchain it also has a brownieconfig which already has a number ofwonderful pieces in each one of thesenetworks so that we don't have to gocopy paste and add it in here it's evengot support for test Nets like Avalanchepoon finance and more it has a number ofreally powerful tests including testingsome price feeds it has a whole bunch ofdeployment scripts some mocking scriptssome helpful scripts and reallyeverything that we need to get startedand get going for starters we could runbrownietest and it's going to compileeverything and then on a developmentchain run all these unit tests and if wewanted to test this on a real test netwe could do brownie test D- Network ringor any network that we wanted if you'relooking for a good starter place thathas a lot of really powerful smartcontracts for you to get started Ihighly recommend using this mix as aboilerplate starting point for any ofyour contracts or any of your projectshere now we are cooking so we've learneda ton of the fundamentals of workingwith Brownie and working with smartcontracts now that we have kind of allthe building blocks though we canactually code a lot of these much fasterand much more efficiently than beforeone of the things that we've seen overand over and over again is working withtokens and the erc20 token standardwe're going to learn how to build ourown token but before we do that let'sunderstand why we'd even want to do thisnow first let's define even what are ERc20s so er c20s are tokens that aredeployed on a chain using What's calledthe erc20 token standard you can readmore about it in the erc20 tokenstandard here Link in the description aswell but basically it's a smart contractthat actually represents a token so it'stoken but it's a smart contract it'sboth it's really cool tether chain linkuni token and die are all examples ofERC 20s technically chain link is an ERC677 as there are upgrades to the ec20that some tokens take that are stillbackwards compatible with ear c20s andso basically you can think of them as ec20s with a little additionalfunctionality now why would I even careto want to make an ec20 well you can doa lot of really cool stuff with it youcan make governance token you can securean underlying Network you can createsome type of synthetic asset or reallyanything else in any case how do webuild one of these ER c20s how do webuild one of these tokens well all wehave to do is build a smart contractthat follows the token standard all wehave to do is build a smart contractthat has these functions it has a namefunction a symbol function decimalsfunction Etc all these functions we needto be able to transfer it we need to beable to get the balance of it Etc andagain if you want to check out some ofthe improvements that are still erc20compatible like the ERC 677 or the ERC777 you definitely go

(Editor: java)

Recommended articles
Hot reading