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

Loading player…

Writing Cairo Smart Contract on Starknet II

Web3BridgeWed, Oct 9, 2024, 12:00 AM

Transcript

I'm going to Shas are you seen the screen so uh today we are Contin with writing smart contract I don't know what have you guys have done before now it's there some few uh Stu the same that I should take you guys so have you have you the maintenance tab can do that one now everybody's okay with that one some people online According to some people are join online so yeah I want to like everybody and then I don't think this is conting to just one let just a minute please e e yeah so let's continue like just on stab I want to like show us just one way of setting up stab very easily then we continue with other things so see the terminal right okay yeah on my system so uh have you guys installed this SM for yeah I have you have you anybody as to install for found forting oh okay so if if you like you want to create a new project in of going to like do manual setting of sm4 and SC and those ones can just run sm4 name of your project and then you everything for you on on the you see your dependencies and everything set up already for yeah so something like [Music] this open so if you look at this the T file everything is already there have your your SM for dependency your St package and everything is there even theet version is there too uh he is raising his we can ask a question if question just ask yeah check the check the the shat you see somebody you can ask a question are you the person okay so I'm not going to go into configur for I think everybody already with that one I just be a time wasting so creating interface have you done anything on interfaces on kro no so okay it's just like normal your normal interface in solidity differ it's now on Cairo so Works same way and everything we just going to do a simple demo okay look you guys know this ones now AB like if you want to use uh if you want to you don't want to use uh like that's what they call library binary and Library so some people use men in of using Library they prefer to use men like that's what they call men function in Rust and you know that Kyro is similar to rust so this is just the basic if you want to create if you want to have multiple files you go this route so this one is just the name of the file here mod before the name then you come here and then you can do what you want do and it will now be connected to the system through the library that is here so so let just write this small oh okay let's do a small interface just something basic so first of all you have to like set an annotation that you are creating an interface that's why you have this this first line if it's a contract you want to create this one this be a contract like in of interface I have a contract so it's telling the compiler that okay we are creating an interface it can now generate both your dispatchers and everything for you still come to that so the name of the of the interface maybe i r if you have any question just ask so this is the basic setup if you have set it up like this you can now Define your function signatures you know what is function signatures right so when you have something like this can EAS def your signatures inside that you now use in the contract so maybe you have something like uh St [Music] so I did something inside this inside this uh inside this function you guys see highlighted this stet now this stet contract address so contract address you don't have it by default unlike in solidity you know when you are writing Sol you don't have to import your contract address is there by default like it's like a a type not contract type it's like a type so you have your address in solidity is way you have contract address in K so instead of saying nor in solidity you just import but now in you have to import the contact it so that's either you do this way you do this way or come here how many of you know Rost like basic Ro anybody okay so the same way you the same way you import modules in Rost yeah is the same way you import modules into a contract so you do use import if solidity you didn't import this one other one using use just use it now so use so if you have it this way if import it like this add this here again can just do can just set the Ty without having to like include the stet in front so that's it s question we solid where address is the type right is that is that what you're trying to explain nwork was breaking up can you just repeat once okay contract address I don't understand this have address yes yes so now is it that we don't have type here you have to import it it's a type actually but it's not there by default it so because the reason is because it's not yeah it's not all the time you might need to use a contract address as a type in your contract or your program there the difference between a Kyo program and the stet contract you guys know thought that one okay yeah so sometimes you not actually need to use an address as a type in your contract so there I think maybe later in the future they might add it as a default type I have to import it okay so this contract address now is it pointing to the contract address for my own person that is deploying it or I have to do some computation inside now to let it know that is my own or like wait what am I even saying see don't worry the way you like you know okay let me do something okay I have [Music] Tobe is your address yes yeah the same you pass this address is pass this it's not like it's not pointing to anything specifically right now you're just telling the contract that okay this is a contract address you have your integer and your maybe your boo okay I guess it now thank you okay so we passing the address and then [Music] amount so and and K have useed integer I don't know okay use your so instead of writing we just use and 26 that that's understood yes you mean this one I'm writing now this is just an interface just if you if you look here you see it's just an interface so we are designing the contract signatures the function signatures one minute I need to like restart this this so inside if you writing interface you don't like you don't need you don't have this so there's no implementation I hope you all of us know now right if you're writing interace no implementation like you don't have this PO braces so just finish and put your semicolon so maybe is it clear you guys yes sir yes so this is just an interface Just A Min like basic uh be demonstration of what an interface is how to write in okay let just let me just go further if you want to like use it in a contract have you you guys have done something on contract right like how to write contract in AB not really are you serious I thought they have done like with basic introductions foram we've like what you doing now is making it so okay so let's just use this two contract functions in the contract from interface let's do something else um if you have question do ask are you following yes sir and we don't have anything like mod mod but now we have mod inside the contract because each each contract is a mod on his own sir is it is it possible for us to write this uh contract inside of that place we have the interface yes it's possible okay maybe we can just start it then move to the other I think we can just continue with doing it in separate f was able to is it SC like like I'm to SC test so it's comp how did you inst it like how did you use ASDF SDF or just did normal IED and you made it like if you're putting documentation after the installation have to make it so that you can assess it from anywhere in the system so please who was talking your [Music] question yeah so I was saying that you can just continue with doing it in separate files because the example that F showed us she did it in the same file so it's be nice to know that we can do it in separate FES okay just do it if if we do both okay let that with this then we move it to the other side so we are going to need just two two uh two modules from this uh interface the tricky thing is once once you an interface in gyo the compiler will generate your dispatchers for you what they call dispatchers is like uh do you guys know anything about delegate call so if you want to make any external call in Cairo what you use is dispacher dispatcher is like how do explain it is like a system call that makes that call for you so we call it dispatcher you have Library dispatcher and contract dispatchers so I think okay okay if you want to use you calling the contract already deployed on chain maybe on testet or maybe menet what to use his contract hisers so just passing the normal interfaces passing the address to the interface then make your call yeah if you fing an maybe have declared it if you have declared the contract but you have not deployed have you done anything on how to declare contract and Deploy on stet okay all right please go go on with your question no no no okay so if if you have the contract is declared that's what they called to declare contract to declare a contract in in St is when you want to like it's the first process before can now deploy if you declare uploading the bite code you know what is bite code hello you know what is bite code very good yes if de uploading the B code to the stack net database like protocol so now you don't you have not deployed you don't have contract address but then the class Ash what they call class as is already deployed then you can make external C to that class Ash assess the functions inside that contract have to deploying it so that's that's how when you do library calls in of contract calls but we just maybe lat before we end I'll show you guys how it works so to use the this interface that we have the already cont use are you following yes question so you have to use super super is okay want to use other Ty that is not withing this yeah so if it's outside use key yeah do you see uses there no it depends on how you use it if you want to use if you want import it like this is okay but then if you want to use it maybe I want to like implement this interface you can pass Super here Ting like yes so I just yeah yeah can hear you so my question is how do you if I'm to import from another file will this super work or if I'm just so what do I don't wor just attention after this we just move to another file and I show you how to report it in another file thank you yeah so if you're importing more than one mod or more than one functions from a particular maybe a particular file or anything you open it with and then separate it with Comm doing it in many FES many lines you just do it in one line yeah so use super I need a I need the dispatcher dispatcher and then okay [Music] bringing so you see there's no way that we that we deplay all these things we are seeing there's no way that I wrote all these things but once you once you like home your interface the comp will generate most of these things for you man please if you have a person just ask let continue so the reason this this is throwing error is because I have not uh I've not declared my storage like I don't know if if he compos in in solidity but before your your stet contract must compile you must have the storage uh the storage struct like you must this and like that's what I've been saying like it can have an interface like maybe wrote an interface to use in your contract the compiler P compiler on the back end you just generate all the things for you so it you pass the name of of the interface and then pass contract I contract anything you name it it will just pick out that that tit and then as it like contate the whole stuff to it so is it doesn't matter the name for example if you come here and maybe remove this straa so it works based on the name of yourface so this a dis it a for you automatically by comp how do you see cont uh you don't need to see the content actually just have to like pass it it's like is what you're passing this is just a function I think if you want you can go maybe you can go to their call Li the stet call and then look at their their implementations you see again this are just for making standal C nothing else so I can see the function inside yes all these things now once you pass this it will show you this function that we declared inside this inter so it's how do you how do you set your your this again in solid yes [Music] so en This Is How We Do It so but then must annotate it this storage so that the compar know that this is the storage variables [Music] person owner living princi has no [Music] just talk what you need in your contract as variables is what passing the storage okay if you want to now implement the the this stuff you have in interface the functions in interface I can't Implement them just let me just [Music] do you know what this the function of this yes yes so now you do [Music] this this was what what's her name now look this is where you can either pass Super and then add it or you just use it from here so this is this point you can do like this super so you see everything there you pass it like this then you don't have to import it from here yes so I you do like this of having there's what we call generic variables generics in in R so this this contact state is just a generic what he do is just to hold is holding any any varable want to pass here this is just it for you as a text know text just a test you can use anything right inside this place it must not be cont State some people use just just pass typ for typ then the important thing is to pass the contract when you implementing it here do we get so I think [Music] you said I didn't get that can you please go over it again okay but can hear me sir yes I can hear you okay you see this contact State now hello yes I see the state I see the so I was saying that this this Capital here is just a generic what you call generic in Rost and Kyo so it's just a Dom text holding any any any data type that you letter pass in when you deare it in your contract so for instance now this you can change it to maybe contract state right it is still work if you can you can just maybe do something like this it will still work anything you put will work but then when you want to like use it in your contract as an interface you want to like implement the interface what you is the must must pass the contact state so in of having this here having the text yeah pass the contact State inside justess this one with this one is it clear now yes it's clear oh s can hear me yeah this contrast St where is it coming from also from the library I think if I'm to guess I've not looked at the core implementation of this stuffs but this I think this is just maybe kind of a struct or a function I think it's a stru because it's passing it's passing everything like everything inside this storage struct and all the implementations contract so once you passing the contract St you can assess all these St and then you just pass s you still come to that s dot once you call s dot you're referring to this contract State and normally what what we Implement as as self en R andyo is destu so it be confus yeah be confusing but then just know that this is just this will pass the whole contract state to self so instead of using the contract amount. read you just pass. amount. read okay thank you can you see this so is is already throwing error because we not Implement these two St that's why I seeing this this red [Music] moment for so remember to make this uh this ER will just import the contact address we did [Music] it leg even if you like use name of anybody from the village you pass there to pass so it's compiling because we are done with the just the skeleton they not do any major work here so that's how the interface works and the funny thing is in in the newest uh versions of what they reasing now stet you cannot write a contract without interface is not compos last time I not composing but then if if WR only contract in St not compile everything will compile but then the problem you have is until you want to deploy it or declare it do not see any class to you not see any any SRA after it be just be if you remove this and then like remove all these ones this implementations leave your leave only these two functions here it will still work you get but then if when when you go to your this file here this is the contract class sest so if there's no interface you come here you just see like one or two lines these things will not be here and then you cannot declare your contract or deploy it without this time without this all these figures here so I don't know if they told you guys Kyo is is aable like ZK language so majorly using Kyu has just I think it's just to make it simpler for us to write provable programs or contract so this numbers I think there may be proofs anything from the contract you wrot that am going to pass I think this is s explain s to you guys what SRA isin have have cousin [Music] yeah you have to like pass it go to cin so we are done with this let's do this on maybe to the other five let's do it on another so the first thing you do is to import the the interface so the interface is inside this file ABC inside file ABC [Music] this you do TR this let's look at this ER we saying that this interface is not Vis so we can't access it from this file this file because it's not public but you want to use your interface or you want to use your contract or maybe your Str in another file like if building a complex project and you want to be exporting your functions on your files you have to make them public so this now I have to add have to add at the beginning here are we together hase so this this so it's now you import import your modules in Rost and K so you set the part like the part of the mod from the begin the folder to the ignore the SRC you're not passing the SR just the name of this thing and then the the file oh e all hope I was time com okay so this is how to use it in another of all import it any questions so far online guys can you guys still hear me yes sir so no question so far right let's continue so I don't need to start talking about private functions and public [Music] functions then there what call internal functions in how to want to wrn function can you comfort let's try some does mean that you have this okay let's do something like [Music] self me have May function you don't have you don't need to make it make it public stand so you can just pass it here and then outside outside this implementation now outside this scope like this implementation block now do so this generator to also [Music] like it's for like working with internal functions want to do an internal like internal threat that is not is not imported or not inherited it can just regenerate sta Implement uh does mean only using it inside this particular this particular F inside place okay yes yes you cannot call it outside it's not as outside this you know in in in solidity you still have your internal functions and your private functions of maring it maybe public this one that one just leave itty get so if you don't want the function to record from maybe from outside the contract so this is another like interface that is internal so just like run anything you want to do inside it still you can also Define your contract without this so just write your normal function without this annotation you get so if you just like that without this still work but then it not be accessible outside the contract so it's an contract private contract sorry function not contract have something like this SE just all these ones are inbu modules and functions and stack you you have your [Music] Global what so this ones are the on stet they have get callor address get contact address many of them so get BL block number that time stamp is get Block doing time stamp you have get Block time stamp have your color address address this is address this yes so that is get Contract address this one let's do something see that if if he rast okay it's also the same that's what we call inference inference is when you don't have to pass the the type so like the compiler we okay guess and pass the appropriate type for you so like this oner now you can leave out this and then do maybe [Music] s so now the compiler knows that okay okay this is contract address are you seeing it here without having a function what call you guys about Universal contract deployers yes yes so when you deploy a contract if you if not pass owner is the get color address if you pick the address of that UDC and pass it for as the owner because that's the address that is calling that is deploying the contract the [Music] address have to pass the contract like the address and the Constructor yeah I think half time look atable ownable function contract there an ownable contract by is a component actually from open what are you saying good thing is big like all these companies have know mind have some some teated to St so open they have their contract based all the solity contract that they have they also have it on stet and theying new versions all the time so maybe there's time I was thinking that not so let's do Constructor [Music] then of course you know that you must pass your your type if if if you're passing argument you must add the type so it's in solidity it's also the same thing in K you must pass the type that's why you're having this contact address right so this is how you assign the own of the contract Shi yeah if if you don't do this and then pass maybe you pass get call address as as the owner you pick up the address of the universal deployer and then you have lost that contract what function Contra something like that address and set it right put right without that can we use can we still get the employer address without doing that set once we do this stuff now this once to pass this in your construct and you have your owner your your storage variable it's already stored like this owner you don't need to set it again unless maybe want to like keep changing the can use that set and updating it so how many of you write typescript everybody questions if I have question ask sir can you hear me yeah yeah he said something about Universal deployer losing my contract can you go that again okay the is on St there is what to call a universal deployer the contract is I think is a sequencer it's address of a sequencer the job is to just be listening to the deploy score that's what they call deploy score on state it's a function that deploys all the contracts on state once that function rings on stet anywhere it will pick up that contract and deploy for you so it has an address if you don't like if you if you come to your maybe your contract now instead of assigning this owner to the to this person like you don't pass you did not pass the owner as as an argument let's say you something like this and then you s owner right so come here if you do anything like this in of inste of passing your own address as the person deploying the contract they pass the address of the universal deployer for you because it's not your your account is not the actual account that deploying the contract is the universal deployer so do you get that yes that makes sense that makes sense the way you do require and what to do is ass so if you want to check that the person calling this contract is the actual owner and you have your owner here you have read like you have gotten the owner's address from the state this thing and then the person this is the person calling the contract all you need to do just to confirm that owner is to then if it's not equal that means it Willow error it will Panic what do you call panic inity I [Music] that so it's as simple as that this line will be shaken that the person calling is the owner of the contract so assum you have this in your contract now and you go and pass Universal depler as the owner of the contract that means you have lost access to the contract you get that I have to be careful this balance is [Music] correct so this is mapping mapping in what to use is Legacy map so passing the PS I think in address of the owner and the balance so on is address the balance is integer [Music] yes like Legacy map you can just first to start with you cannot use mapping like this Legacy map can only use it inside storage stroke so you cannot use it outside your storage stru if not so outside story can use your dictionary 252 D so now you do they told you guys it's not advisable for you to go and start writing your own token contract by yourself hope you know don't know so it's not advisable for to and start writing your own toen contract by yourself n or like noral or let's say maybe you want to now maybe change some things but then not open use just be maybe and the fun thing I think I don't know if anybody's still going to tisue guys component op the nor they don't have contacts again have components so it's not difficult any just like import it and then use maybe before I I try to touch so [Music] find [Music] starts any question you understand d i Lear people yes understand you still understand hello understand that very good let's continue just so you add the person that is being from the person that is playing yes see so ack quick question sir can you hear me just one second okay we that the mro 34 if let me try something if you put this this like error but is not you're not supposed to pass string G so have it has to be double quote It's s but if you're using M the string inside n on double quot in of single quote I think they started this one went the we have we have nor string now one that is with2 bits and we have something that is the new one now you can use any arbitary amount of of numers of letters so it's now by that's longer you have a and roast and the have string so string is smaller like I think2 bit but if you want to use maybe want to and maybe the U is wrong use so let's do the I se it now the error has cleared so I noticed something when I was like writing this function without using the generate threat was throwing on here you notice wait the function the contact could not see like this function could not see this function down here because that that nothing ising it so I have to like Define it inside this rate so that it can see it are we following no tell again please like if you want to like write internal functions in k contract you have to like passing generate the tra so you must pass annotate it with generate tra and then Implement that this private trade or interal tra if not if not you cannot call this function inside the contract because this ones cannot see it is is standard for for private I think private should be private TR must be used let me try something still works right but then I think anything is changing I try funny enough still see okay okay it's because of this gener tra yeah I think once we have this gener tra anything right pass because this is actually the that you is this so as assuming you have deployed I on dispers okay yeah sorry someone had a question before please who is that person who was that person was about to implement tra private tra okay have gotten now hello are you cleared now emmanu yes I am thank you continue so have we have you guys done anything some dispatchers contract dispatchers and Library dispatchers 525 [Music] no contract nice on how to emit event so this I just simp just follow there no need to there be no confusion on this let's emit events h no question AB yes let's continue [Music] uh for [Laughter] [Music] p you understand D hello yes any questions yes it's an event no question let's continue is straight sayward actually I I'm not a CO engineer I don't know why they have to do like this but then how it is just follow it so first of all I have to show that it's an event this annotation here then you have to derive this one yeah this particular line you have to like what you do with the is to import the tra you need to run this truck and and the anons so drop is there what they call ownership in Rost so each each variable in R has an owner and once he go is it goes out of scope it have to be dropped yeah so that's why you have this drop drop is just a function to drop this or once it it goes out out of scope the reason is because they don't have we don't have default implementation for it if it's other other data types like string integer buan you can drop them automatically but then this on I have to like call like it with a drop so that they know that they're supposed to like work after after they done then this event is just to Mar it as an event nothing else then first of all pass all your event like the whole event that are going to be passing in that contract all should be inside this so as I have maybe transferred uh allowance all this of type allowance all these ones then have to now come and wru for it [Music] to for so we are following are we following it's just the same only the only thing is that inside this m now defining all the events are going to beting in the contract so now you you now start to like Define the events one after the other then if you want to now emit the event okay have finished writing the logic what you just have to do is do self. emit I emit transferred you know that it's a so you have to is it what like we have just do this the first uh the first the first variable and the first argument is send have receiv the amount so pass receiver amount all right that's the [Music] so it's the exact word have to the exact inside inside theu for you to work are you following and then if if you don't want to like start duplicating the stuff if you don't want to write come and write sender and then write maybe owner or anything like that this one is send you have send Have receiv and Have amount what you can just do is come here change this your owner then receiver can just come here and C this ones off and we are good it doesn't make sense to for you to stressing yourself and be writing put col writing again just like use the same and pass all of them on easy for you and make it makes it more professional any question no let's continue so I'm done with with the event and how to the event in Ciro let's do dispat p dispers and Library dispatchers then we know that almost how many hours this supposed to are you serious let's continue so we are done with the the basic contract and interfaces and the event how to them uh let's just like let's just assume that we have deployed this contract okay [Music] have deplo this contract and they want to like make exal course to it so I told before that if you want to make exal C to use contract dis espe cont already calling classes like classes to call classes use but the contract what I just fing is explain it it's crazy that's is why St is far more advanced than solidity comp to me that I go back again every small you you just be getting small is size Max no I can't again is than Kyo actually it's simpler simpler it was built on purpose to be simple simp to Le I want to each one is having their own purposes wow someone is done nice what I looking for inside this what you to do this guy I'm TR you understand get I if you you cannot understanding Vision please identify wait Nigeria many weeks understand simple English nowhere when I went to Kenya I was speaking like Kenyan people so if you come to Niger speak like us so to make exteral course to contract we using dispatchers so if you look at this you I not import the trait itself there's noc2 anything just dispatchers so import dispatcher and Tra there like they make underground exteral course contract the same way you do your interface inity you do contract address transfer anything same way this works yeah so in of the of the tra transfer you pass this disp the contract address you can make your call I have something [Music] like this one is old one it's 4 [Music] say yeah let's just all things are fter away why I'm doing this is that you guys can understand that it's also possible to like pass this direct without having to import it are we together normally I should just import it and then what I'm doing just doing the extra stress for this is AD don't text hear me don't this inside contract just like I want to just pass address inside there so just like show you guys okay this is the way to do this so are 2 3 is 1 2 3 is an integer right I remove these ones are you see from numeric so see it as integer not as address [Music] have to that's trying is like just convert your normal F yes so have to do it so if you if you look at inside this modules or functions inside this place you find that okay you have transfer here you have transfer from so even without importing the threa from the other pile already seeing the functions inside that threa so you have access to all the functions this is what they call a contract disal C passing the contract address of that contract maybe if isc2 just passing the address of the lc20 contract that you deployed on another contract and then to making cost to that contract so this you don't even need the funny thing is you don't need a contract or any a contract here you don't need to import any any St the only you need is just this disp here yeah I don't think it's an interface I think just maybe a function or a modu that is doing the CIS behind the SC yeah so passing the the uh argument and everything is [Music] f so any question on this you have deployed your contract on St have your contract then if you want to make call to that contract that you deployed already what you just need is to import okay we have normal we have dispatchers even you don't even need to write it it's already on open can just import it into your contract and then write a function to make call to that contract you get once you bring that dispatcher pass the address of the contract you can call that you can call a new function Pro [Music] function the function don't finish that does the same thing okay apart from apart from dispat C contract and Library dispat course there's another low level C that's the one you're talking about now so I think that one also I think they also pass something there things you pass to that one to make the call it's another it's Advanced kind of not advanced not what they ask me to ask me to teach [Music] you let's understand this on first okay let's just do this things together for for sh right so I mentioned earlier the difference between contract cost and Library cost is for contract oring contract address this one now for for Library course pass the class CL is like B Cod let break it down for cl is like not B code they it it's like B code what it means that when they upload your when you declare a contract on stet they upload your your contract F code the protocol and then they return like one what they return to is like a contract address but it's not an address what they call it is class Ash they just ask the key of the place they start the the class as and return the the as for you what we call it is class Ash any question no question let's continue so that class Ash is what we pass here the CL here because when you doing not making call you're not making call to contract so the only way you can access that class Ash the contract F code is using the class Ash we get trying to like bring it down understand it did you get it understand libr like libr making this like noral no like it's not like normal C you do noral inity this one now talking about not like normal C because you make exteral C passing contract address of that contract to remember yes good but now why you want to make Library course on stet passing contact address passing class yes you have options I call you maybe I don't deploy your contact or I don't deploy it but it's forf purposes can not ha a contract but you can ha a contract you get so some people might think okay sa for us to just declare it and then making Library call to you don't have access to their contract I don't think opens the de contract just they just have Li opens thee just Li it's not a contract because they are not deployed yes but then the reason you cannot make Library C open because they not deed are you getting it now so unless maybe you import it by yourself can now start making C I can opens the cont because they are just components they not contract and I don't think it can deploy components embedded okay can you hear me sir I'm hearing you okay so a quick question line five you are trying to inside that file you are doing the I2 dispart the dispart tra then the library dispatcher so my question is these dispatchers you've imported here did they were created as a result of using the traits in the file ABC am I correct please yes so lastly online six you did use stocket then you said you are importing most things contract address class class Ash and then class Ash um this um I think this should I call them constant now is there a place where we could get a list of all these Conant and like there are many so that we could use them have have you check book oh okay I'll check I'll check that for try see they listed there I don't think so okay okay another question so um this um implementation now you said we are trying to use the class Ash because when you like declare to generate a class as for you and that's what you use so if in a case I'm like do a testing situation and I'm not like trying to declare first is there a way I could like call get the class Ash betweenin the file to like run my test ah there are two things you you might do one is to declare the contract on tet and then F tet you guys have done Fest hello sir do you have any we have not we we testing here the Reon why I mentioned it is because you did something ass in the previous file so that's why it just to now the second where you might want to use it in your testing is I can't enter tting now it will take my time but let me show you something there's one contribution I'm doing on examp and on this Library course let me just open it and show you guys something so look at this test can you see it yeah I can see it very good if they tting your contract and they're doing Library course maybe you don't want to De declare the contract or maybe it's too much stress for you you can use this set up this test class as is is an a default test CL just for testing so this is the name of your contract name of your of the contract then you pass this test pass Ash and then you WRA it this will give you like a test environment for you to like test your library course and know whether they actually making the course but then if you want to recheck that there's no way for you to recheck I think this will just this this works just fine if you want to test your contract can use this but then this is not this is beyond what we are doing now I think the person that we take you on test will still touch this stu okay all right thank you very good to disiness so it's simple to just to pass in this so disp disp here [Music] then open [Music] your this pass the as Implement I implemented it oh this ah we don't finish now deploy to test net I'm not going to deploy to test net I'm going to give you a link to my articles on St so you guys can do that one on your own if have any I can contact on what no not WhatsApp tegram or twit why not yes I think what I have here is my uh I send my username ch ch so how to deploy to test [Music] net I must the is H and also this so I was telling you guys that solidity is like a bed a cash bed put it inside cage and lock it so it's like a CAG bed but then with Kyo now if maybe you deploy a contract there's a bug or a mistake you can easily like upgrade it natively you don't have to go contract or deploy contract just there is a a low level score just go through thetic you have time to explain everything so so mean that a contract to get and go back contract your enjoy your M they put money easy no but then how many how many projects have you that investors just it's not about question of Technology it's about question of people the people behind it I I mean just it's even simple because if you know that you know that people are watching you but then if you say you de contract and go behind it and even the on that that AED by NE and all those ones they still is not when you write a contract there must be somebody that has right to withdraw or transfer money otherwise oh sorry I tell people it's not about the technology technology is just there for us to use it's not the mind of the people that are using it you have gun everybody have gun not you that car and another person and then you say people people that people something like that oh so I think we're almost done any question so far question you know anything about do so they have they have this two Katana Katana is is like a noens yes have people not done St architecture how many of us how many of what what what you about meus yes meus you know all of us know that yes so fine there's no time on on evm we have manys that okay miners now be be picking transactions on State and other we have sequencers so on St There's No Me pro there's no like okay we are looking for the transtion with the highest gas [Music] Fe of understand not speaking there's nothing likeing for high gas feed everything is like press confet so what happens is once you transaction sequencers will now pick it up and then okay check check check everything is intact maybe they cheing for maybe signat gas fee and make sure that everything in they now send it to Pro ex once once they send it Spencer picks it up checks it and make sure that it's well arranged and then theyit to Market accepted and thenit to to the next uh I then send to verify right out so uh let's just like I'll show you how to install Katana then I think you f that and then you might run into some errors yes you can use it to run local nodes it's like uh boundary hard you can like use it to run it will give you some account with preed ETS and all those ones that can use to make transactions yeah so are we are we seen the screen so this copy this once this one passes once it finishes you then run the job are we installing this oh oh [Music] you copy you copy the host of not only the link that from the call then end with the bash copy everything together do you guys know how to use how to use ASDF installations no no I don't know how to use it ah ASDF uh I think I send you the their Link in short use find go to find.

com hd.com then how to type how to install ASDF on the this thing just be copying and pasting it will work then after installation you can now start using to install and and other STS so if DF hello sir yes that's installed but when I run the job it you not work am I supposed to we put something before theob open open another another tab another and then the okay supposed to work oh yes it works thank you so if you finish your installations run this command so what does this command do this the same h this command that you just sent now what does it do run it first I finish installation run the command Okay as anyone run it I se something so if you're run it you should be seeing a contract and account for testing this is like your local node it's just for testing purpose so if you here that means you have reached the end of the marathon use the and then follow the pro you can deploy contract guys anyone doing it from the browser yes been have you guys insted it like you have not anything [Music] onra okay St is for is for declaring and deploying contracts first [Music] finished insted yes but you can the job let me see yes yes if you scroll up you see Katana at the beginning open open that another minut uhoh I send you a link yes follow that that there's another way how do I okay okay I'm [Music] send confirm yeah okay so use the the link I sent now to install the the command to St so if you finish just run Stack Up which New Link the new link is not for it's not for do don't worry let me get the link for you it's not working denied sud are you using Windows okay put put before if he permission dened saying [Music] what from here the same Miss denied let me for password password name that having issue okay so we have finished installing St don't install because of what Che B check the link at just mus it TR is this [Music] I think successful right yes just then simply run no no no just open another and then yes how so now it's time for questions so if you have any question just ask now I'll be done in four or five minutes how does the laptop got to PR people big [Music] man which which which L which oh wow yeah go on go okay so I've successfully installed St and I've St and inst is sucess downloaded everything from so what next oh okay I will send you documentation for St line so it's just for if you finish writing contract you can use to declare you can use St to declare or deploy so it's just a c command line interface for clearing and deploy contract and you get that yeah I got so is that is that will that be all for today more I'm almost done yes I sent I sent some some links to you so if you maybe you practice have you have a contact want to like test deploy or declare I have if you want to deoy on test or if want to deoe see this Deploy on Katana follow the article so if you want to deploy on test follow the first like stra forward like that then if you have yes Victoria do you have an idea when the master class is ending I'm not sure not sure I have to like check I think they have some of those dets in their channel so em question no I'm good for now thank you who is still having issues what what are you faing now which one are you faing now wait some of this I think Chief come before you can run some of this this stuff we can install some scab and the rest of they have to have insted in your systemo like Rost compiler but when P get problem with get problem with with Paul might from Peter actually so Che your lapop Che your laptop so guys uh we are going to end it here for today so let me just drop my my telegram usern have any question can [Music] B see one house one house I want to see if you can deploy one contract on are we okay just one one then call it you still see my screen let's do this so I don't I'm not sure but noral you need you need Sierra file like you need your contract to be compiled to Sierra so before before I'm not about now you have to come to yourl file and then add it so what you do is just to type Sierra like this so once you do it then compil okay I'm supposed to like comp comp so you save next thing to do is just to compile your contract using SC just build it so if you see here you have we have a new folder here the target folder then if you open it you see Dev like this this is where all your files F and everything is so it will generate all these juston files for you now what we are interested in is this contract class. Json file this is what we use to both de clearing and deployment is the contract class five so of all you have to like you have to set your account like account is like okay you have to set the the account you're going to use to deploy the contract because you know that every contract on on any protocol it must be from an EA like wait what's an EA EA so if I deploy deoy from an so for to set it up first of all like set both the KE store in of going to do the AMV normal EMV that you used to do and then import you just import the file direct it's encrypted so import the Play Store and import the account itself pass them [Music] I'm not sure about this but then let's do something so I'm the just simple just you get everything right FL so this is to import the keys that are going to use like is encrypted first then is the detail of your account like you're going to pass your private that you know it's not advisable it's not safe so they encrypt details they need from your account and pass it by themselves come again I think it's kind ofation because you're not pass it's not going collect your private key once you pass your private key use it to create generate that ke those keys and justers and so if you click on this it it will request a private key so now yes I want toiv let's just use one private key from from U Katana Katana is is is built [Music] inside yes you have to inst then Katana is embedded inside it like you have and and Katana anyone you use just just type name okay explain this this laptop now you have CPU have maybe dis jacket and all those ones still inside this laptop inside you have Katana one side you have so one side so you must install it toos then the one want to use like pass it from the command will come I'm going to P the private you not see it here like you not see pested I don't know how they did it don't ask me question I test it so it's it's asking for a password it's not your laptop password it's not more that it must be your laptop password you can just pass any number anything like when when you want to deploy it you ask for it so it has created a new file for us please just are we see it can see open it you're going to be find Cipher text inside so look at the content it's only Jons that you see here me I don't know anything inside it I just pass it and do my work and go I think just this Mark here I think it's the hash of either the systems CPU Seri number anything hasing things from the laptop then combine it with the sword generate the for you sure remember because to pass it want so yes actually this will not work [Music] are you still see my screen no don't worry don't worry don't worry I'm coming [Music] it's not like I don't trust you guys you get it's for security purposes you I'm back on land so after you have added uh the keys you have to fish the account that going to use so the way to F it is to F this toy the account is to F this command this one now will require an so we going to pass an I'm going to get just go and get a one from Jun I think this is one of the most reli so I just [Music] did you get the so is free and is very fast one of the most reliable so if you want to Dey AET use the first one look see the right want to all of us know is no longer working so it has been replicated so now use only l this is what I I was talking about before so for you to like declare contract or deploy you have to use that's why the keys now to import the keys now have to use line now to even import the account going to use account F then F you p the address or your the the wallet address that you going to use the so I copy my [Music] address this I this [Music] so we it if if okay is going to go okay not go okay so first thing here if if the account you want to use to deploy your contract is not if it's not deployed on on on se you cannot fish it from here because there only only deployed account can be faced using the stack line do we get it yeah because before you can use any account on stack net actually in all the account on stack net are smart contract account there's nothing like EA on stack net they have told before yes or no yes good we don't have externally owned account on stet everything is smart contract account so before you can use your your wallet to do anything you must deploy it first so this one now this one worked because I I deployed it already so if you want to deploy if you want to deploy your wallet do we know how to deploy if you just you just created a new wallet on stet using maybe agent you know how to deploy it I don't know how to deploy it just send okay go to any for set if you go through the wallet you see here the right like deposit f follow it you see foret or anything go to the foret then get some test tokens let me see see now if you're using bra get or stack from stack net stack net Tok foret so if you click on this it will take you to their their website so you can get some test net how get place I okay just click and deposit get the person asking the question yeah I clicked on I can't see what you see are you using agent I'm using bravs uhh are you on tting your check check here if it's on seia oret you see unless maybe you're another different version then you can still just Google uh Google stet foret okay so the way to deploy your wallet is just to send small money from maybe the easiest thing is to create two accounts you have account one and account two so from your account one just send like 0.1 token to your account two Al you send it to another another wallet deploy your wallet automatically money real money yes it's not it's not expensive just like is less than one1 expensive there's no time I only have like five minutes so after I have imported the account and and after I have set your keys the next is to declare the contract [Music] Target this target da is is this file this folder here are you following passing the Target because what you want to actually play and deploy is this file inside here so you passing to assess this file you set the part you pass the other name pass this second folder then you get the Stu inside so Target project contract just I said before what you need is the contract plus just this so these ones other purposes but the one you need is this [Music] copy that's that's just yes the part yes so the project you seeing here is the name of this folder yes so the name of your own folder is just follow this follow this thing like this if even if you hold you see the this yeah so this open [Music] so this key store now is asking for this this key do you get passing the flag the key store flag then key store you put this piece that imported then do account flag you can use any name you want it's noral that it must be either keys or account if you like can do write account in or WR key in anything you want you can put there it doesn't matter that matters is that pass the exact here on this line are you following yes sir okay is not asking for password so that the password that you use to set your P St is now that you're going to need it pass it and then class declared are seeing it now let's say you want to like do library C to this contract just copy this C pass it as parameter inside that function and then make the course it but then the normal Library C is like delegate call I explain it well Library C and stet they like delegate CS because the contract this pass is not deployed so it doesn't have any state you know what state all of there's no State assign to any cont deployed after deployment after Deo that you get your state otherwise only and I don't something about C all of us about the context of of us so when you making library and the state that is being updated is not the contract calling contct are we get now so the CL has been declared Z has been uploaded on St Network yeah you can assess it you can do everything and you can deploy this particular CR a million times like once you have a CR as you don't have to like again cont want you get ites is for particular contract then contract can de as many cont different contract addresses is is like it's like okay the same maybe you buy 10 packs of sug you put all of them on the Shelf this one now okay this one this is the location of this one return maybe you write location one this same way you are deploying different different addresses same contract as are we getting it yes so that address in that one you're right is just Ash they Ash loation and bring down the Comp address for you tell people when you when you the tell that's okay this have say the same addressing the same contract different logic totally I'm talking about you yes you can you can once you have the class I can copy any class online and Deploy on my system so watch now wait deploy now intercepting the class Ash that we just declared are we seeing it so we are person that I just copied it P thatass as an argument on the C line for oh you see it I not pass the contract address of the owner that's [Music] no the idea will not change because what what we have in the Constructor is not a concrete variable it's just a parameter so the ab still has that okay you supposed to pass parameter here C [Music] yes account just so the contract is deployed I just passed passed the the argument and then one straight away to it so you know it's stressful it's not stressful for me so in one L so if you have arguments on the Constructor you have to pass it in the CR so simple like that if if it's string like if it's faed data type I think you have to put this indicate that is faed like double quote if it's integer just pass it like that if it's address just like that it don't finish any question online people yeah yes is that to can I can't even carry all the things in my head I have I have family problems any other question any question now is the time and now that I can't believe this has been 3 hours no question good night good night sir good night good night good night just follow the command no don't that that my My article you see steps to good night everybody we are done for today so uh this is my and last class unfortunately no you don't need it I put it but I think it's still without it drop your Twitter oh sir the username you sent to the chat that time is it tegram yes it's tegram okay so actually not not going to see so I'm done H other from I stopped thank you guys for coming to my thank you sir welcome

Automatic transcript — names and jargon may be misspelled.