Solidity 101 | Session 2 (Raquel)
Solidity 101 — dev3pack & Cyfrin Updraft · May 2025 · 1:15:42
This Solidity workshop debugs compiler errors, compares data locations, and builds mappings in Remix. It deploys a SimpleStorage contract to Sepolia, then develops a factory that creates and calls other contracts. Live exercises cover imports, ABIs, inheritance, virtual functions and overrides.
Speakers
Topics
From Solidity 101 — dev3pack & Cyfrin Updraft, hosted by dev3pack.
Transcript
Hi everyone. Sorry I was on a meeting. Yo, [laughter] uh, what are you doing? Preparing yourself. [laughter] All right. Yeah, it's because I'm alone. So, usually I don't use the like the headphones at all. I just like use it loud. Um, all right.
The quality audio is not the same. Oh, now I cannot hear you. Just one moment because I'm sure it's because of my configuration. If not, I will enter. I'm going to go out and enter again. Just a moment. All right. I'm getting a message. Um to
All right, I just put a message as a reminder and yeah, my reflex like before each session I remove all AI note taker [laughter] because I don't like this. Yeah. So that's why a couple a couple of Dback fellow were into the on boarding session with layer as ambassadors. So that's why we are just on time. Yeah. Could you hear us? I can hear you.
Ah yes, because you are muted. Yes, I'm muted. That's why. Okay. Who singers going um in Argentina? It's going good. I'm here with my mate now. Now I'm a local. Um but actually I'm flying back on Thursday night in to Barcelona. Oh, all right. For something specific. I have a wedding on the 22nd and and actually I'm very very very tempted to bring a pizza to the wedding.
Why? Because it's pizza day. Ah yeah. Okay. Yeah. Makes sense. [laughter] Very very tempted. Yeah. Um if anyone don't know like pizza day, it was like kind of 10 years ago someone bought a pizza with I don't know 1,000 bitcoins or something like that. And it's like yeah like ridiculous amount of bitcoin and it's like the first track of the real price of bitcoin. So because of that it's a pizza day.
exactly happening every year. Um to remember this this funny moment in fact [laughter] and we didn't expected that Bitcoin will go like this. Yeah. Yesterday I I saw that Combase is entering in the S SNP uh 500. That is something really big. Um even uh um like open AI and so on are not in it. So pretty pretty.
All right. Um so before starting uh did you go through uh the ciphering courses um to complete the first session yesterday? Uh so it was until until section one uh point.8 about array structs. Um so I I think normally you go through it. Um but uh all right I think you can start people will will join. Usually we are around 2030 a few until 5 couldn't compete all. All right. So it's a great way to to like to keep in track um with whole session
every time. Um so go through it. All right, let's go then. Okay, then I'm going to start as you are going to see actually the ones that have been capable to go through like the first session chapters. We are going to continue building the same line. We are going to finish session one and we are going to do also the storage factor that is um session lesson two and lesson two is also linked to lesson one since we are using the simple storage uh contract that is the one we started building yesterday. Okay, I don't have a slide actually. I'm going
to build on Ramix and I'm going to try to be explaining everything slowly slowly and also getting some errors in purpose. Um I'm going to share everything just allow since I have everything closed. Thanks Scott. Uh so actually what we are going to do is what I was commenting this actually the GitHub from learning solidity and here is the solidity 101. Yesterday you covered from until the arrays and the strcts and we are going to start with compiler errors and warning and also do the section two. Okay. So we are using remix right now that it's a tool
actually to write smart contracts so you don't have to install everything and it handles like it's going to make our life easier as yesterday was commented. So first of all we are going to learn a little bit about the errors. So here if you can see now I'm having like a notice that it's not going to compile and when I go here to compile lenses to errors I'm getting an error. What is recommended? You could actually copy this error and ask for example here it's already copied like ask any model or search for it. So you can have some information about why and here as you
can see it's saying like I'm missing a semicolon. So okay I will check and here I can see actually when the where the error is being marked that in fact I'm missing like the final final semicolon. Okay I try to compile again and oh no I'm having other errors but first I'm going to check the warning. If now it was only the warning and I wanted to compile it's actually going to compile that it's more like a best practice that is rem reminding me that I should follow and what actually missing is here like spdx license identifier is not provided in the source file and in fact here I can see that in yellow I'm not
specifying the I'm not specifying uh the license as we were doing here in the first lesson. So I'm going to copy paste it and try to compile again. And voila like the warning is gone. So now we are going to jump into the memory but I decided actually um to do it with the errors because I can notice that I'm having two errors. Okay, I'm having a type type error data that the location must be memory and I'm using call data and I'm having another error that I'm missing the the memory given.
Okay, before that I'm going to explain a little bit what are the memory types. So as you know in blockchain uh we store the information in blocks. So um you can have different you can have different types of memory. Uh here are like write and uh write and read um memory types that are all of them. Uh actually no I'm missing some but that are the basic ones I guess I deleted before. uh for now we are only use memory storage and call data that are the ones that actually are required for strokes extracts arrays and strings.
Okay. So why is that important? We are always talking about that in blockchain to store information in a block you are going to consume some gas. This gas actually it's uh you are paying this gas to the to the validator to include that information in a block and also repres represents the computational cost of that um the computational cost of that action in the blockchain.
Why is this it's important because actually like read um read types of memory are not going to consume gas. That means that it has no computational effort for the validator actually no actually it consumes some validate um computational um effort in the validators what will be like the VM and the machine like where everything is being processed but we don't have to pay for it um that is going to make that to interact with some functions in our contract it's going to be cheaper and we are don't we are not need to pay any does to actually interact with the blockchain because we are just reading
information from it that are memory memory and call data. If we want to store information in in the blockchain that could be a transaction, could be deploy a contract, could be different different actions, then we will be using a storage that it's also the default um uh memory type that is used like for example for variables this will be like storage that is going to consume some gas and every action has a fixed amount of gas that is going to uh get consumed.
So if we check actually that if you have gone through the lesson one you are going to see that that it was a simple storage contract and we could identify that for example this um this variable is going to get a storage while others like here is a little bit um different here that um we want to add a person to an array to a list is telling me that oh that's missing is the the first error. Why? Because a string strcts an arrays they require a memory type. So when you are giving an argument uh to that function, it needs to be specified what
kind uh of memory type is going to use. And I could say like okay I'm going to put storage again. It's complaining as you can see it's in red. And why is in red? It's in red because when I'm trying to compile solidity compiler it's smart enough to see that okay that's an argument that it's something that you are going to use one time why you are going to store store that information in the blockchain so it's going to give you an error likely so it's going to ask memory here I have copy like okay now I'm compiling voila now I'm having only one error why is that error
That error is actually here memory. Why? Because as I said before like the memory type needs to be given for strings. I know I'm repeating a lot but it's just in case you're going to remember it's going to be for strings, strrus and arrays and I'm giving memory to something that actually it's unsigned integer. In this case I don't give anything. Okay. Now I try to compile again. Oh, and I'm having one other error that I was not seeing before. And it's here. It say cut.
Why? Because actually I'm trying to reassign the value cut to the to the to the argument name. And we were talking that actually memory and call data both are read memory types. So they are not going to consume any gas. Then what's the difference? Why we have two memory time types that actually are for read? Well, if I see and here I try to do the same and I'm trying to reassign the argument name to cut and not the the the given argument to the function is not going to complain
and mainly that it's I mean there is like some different values but that's the main difference. is like call data cannot be overwrite while memory can be reassigned. You can reassign the value to name because it's memory and not cold data. So call data it's immutable. Here we will need memory then we will we won't have any error or if we want to keep it as cold data we will not be capable to reassign it. There is any question about that?
I don't see the um the chart primitives type store on stack in default. So we don't need to specify memory or call data strings uh primitives type on stack primitive store on stack default so we don't I don't know um maybe I I memory call data now here Angela back I'm I'm trying to memory and call data
the difference yes memory and call data the difference is that call data it's immutable you cannot change after the value given to the argument while in memory you can override that value so here as you can see you have the argument name and after you reassign a value to name that it's got while with gold data you cannot do that no not to string like in wind bull exact um exactly is what I was showing just a moment before is that here it's a stack value you cannot you can actually not specify like you specify the memory values to strings structures and arrays
are the three that uh types that are going to ask you string isn't primitive in solidity. It is perceived as an array. Yeah, actually it's an array of bytes. So it's because of that like actually string the the the the structure is very similar. It it works as a string of bytes. I don't know if that answers the question. Yes. Okay. Uh now we are going to continue and we are going to here I'm going to move actually to the mapping.
Uh okay so we have check arrays before and as we were seeing here I have some deploy contracts. And I'm going to deploy the simple storage from before just to check again. Uh here simply storage deploy. So here I was having the examples that um if I was checking olives okay it's having like the number six and then and and and I could like add persons uh for example uh Bob it's okay Bob seven I could add the person and after I could check the
number for example in zero or a list of people Bob no okay zero and I could see that Bob F number is seven here actually in the array as was explained it in the previous lesson like I'm giving the space like I'm giving actually in in in in the order in what it's stored the fabric number so I'm giving zero I'm giving one I'm giving two but now we are going to have maps mapping the difference of mapping is like it's a dictionary. Okay. So, ignore that. Uh, okay. It's like a
dictionary. So, what I'm going to give it's a key and with that key value, I'm going to search actually for what it's pointing and the value and the arguments that it's storing linked to that key. The key could be a string, a name, an address. And this it's used to find like information information. for example in this case attached to a person to know the FY number. So here if you can see we had the array it was the the the the same and now we are checking the mapping just as a comment as you can see here it's in red but if I'm trying to compile lessons to mapping it's allowed I'm not
getting any error so this red it's on only for the uh code editor that it's marking like that it's not an error so here we have the mapping and as can see I have defined my mapping as a string that it's pointing an unsigned integer okay and I'm calling it I'm declaring public and I'm declaring it like my favorite number map or le etc this could be also like for example it will be a contract it's very common actually to use addresses so it will be the same it will be mapping it will be an address pointing to a And here we will just declare it as
address using the address as an identifier of the person to know it's um number in this case. Here is the same function that we were using to store and retrieve. And here actually what I have um we have added is here that we are using a map to actually retrieve what it's the fing number of a name because we were remember that we have declared our mapping that I'm introducing a string and it's going to um give me an integer I uh un sign integer. So here I
use my favorite number map that it was declared the number as public. I'm giving it the name that the name is one of the arguments given to the function and it's going to give me actually like the fabric number. I compile here after I can go to deploy storage mapping. I deploy it just one moment because I'm going to delete the previous ones. I deploy it and here actually I can see that here I have like um if I want to retrieve I don't have anything because I have introduced nothing so I will need well that was before here I have my fing number map here I have my fing number
map I can ask it for Bob zero because actually we don't have anything and now uh my furry number okay add person Bob 7 I add the person okay sorry I'm using the two pop seven here I have used the function add person two I have introduced the arguments that it's a string Bob and I'm sign interior seven and now if I'm asking for Bob address two at person two no Sorry. Um why it's not giving me uh my favorite at
present two. Uh just one moment. Uh here is the Iz doesn't want now. Uh oh. Just one one moment. Sorry. No, it's a thing. All right. Don't hesitate to show I mean no sorry what's the door okay uh yeah so here when or good take your time yeah sorry here so here it's Bob here it's seven and when I want to transact I'm I'm giving the information okay uh I don't have the retrieve number name my
favorite number map. My favorite number map. Why it's not destroying it properly? Retrieve weird. Uh maybe in the comments because before was working. store at person list of people say something people Bob address my favorite number at person I'm giving Bob I'm giving
favorite number and my favorite number map okay because I'm I'm I'm I'm not retrieving it in any way I'm just assigning it the map so here for example um in my in add person 2 I have I have like my favorite number I'm giving it Bob but probably it's not properly saved before add person two uh I think uh because you override name with cat so it stores with cat actually no it's because here I'm declaring my favorite number no no in it person to uh function.
Okay. Um person function. Can you come to at person two? Ah here. Here. Ah okay. Yes true. Thank you very much. Um add person two. Now uh so before actually executing at person two one moment I have too many things open. um store at person two. I'm not going to execute it, but for example, yeah, I was executing to Bob. Okay, Bob 7 transact parameters and it's going to
so now I going pop. Okay. Was not that retrieve. No reason. That's no. Okay. It's it's a all good. Yeah. I'm going to process. But here actually see that I'm giving the Bob seven and my favorite like [clears throat] the code input. It should be in the locks.
We are always upset by by bug. [laughter] Yeah, I mean it was just working before. I tested everything. So maybe I can't redeploy. It's frustrating. Okay. Yeah, sorry. I didn't redeploy it. So it was still asking for cut. Okay, that's one of the difference. So I removed like cat but I was not compiled. So I will have to recompile deploy again and now when I have here Bob 7 now I should have actually string F number seven decoded input uh if I check Bob that's different and my for number
string Bob it's seven okay that's working okay what was the problem just before as someone actually helped me a lot. I was overwriting the name for cut. So when I was trying to look for Bob actually was giving me the default number uh for an empty map, the default number for an empty map, it's zero. So if I'm giving a key that doesn't exist, it's going to give me always zero. Okay. So what was happening? It was overwriting the name and the argument of the name as cat. So Bob was never existing after I change the code here but I forgot actually to recompile.
Okay, and deploy again. So what happens then? It happens that I was doing the same like even though I changed my code here like in the in the code editor the contract that I was calling it was the previous one. So always when you change something you have to dond do as me you have to remind that you have to rec compile the code again and deploy it if not what you are using was the previous contract okay so now we can continue just a little yeah that changes everything that's a detail that changes everything and sometimes you are just like in in in why it's not working blocked and and and it's not a work what was happening for
simple for example now I have Bob if now I give cat it's giving me zero okay again like if you are giving a key that doesn't exist the default uh value is going to it's going to return you is zero okay and that's the mapping um now we are going to continue and actually we are going to deploy the storage factory that's actually the contract we have been working is the end of the of the lesson one section one and And actually now we were compiling here the code and we were also uh getting like an a remix okay like um the contract deployed locally we have never push actually this
code to the blockchain uh if we want to deploy it actually using remics what we will do is inject the provider that provided that will be the metam mask here I have the metam mask in soul with the wallet and it's a test wallet I use with Seapoleia. Seep Seapoleia it's a network is a test it's a test net. There is different test nets for different networks but um sepoleia is a test net where actually it's like free like it's nonreal tokens not real gas money uh so you can have sepia is and try for free to deploy and now I will choose like injected provider as you can see here it's the account it will be the same
account 9B the same account as as in my meta mask Uh here is estimated gas or custom and actually will deploy. I don't know if you can see it because I have like um yes we can you see perfect. So look at here actually you have a lot of data. This data is the machine code of all our contract that is going to get deployed to the sepole network. I confirm and in the meta mask uh popup I can see that the contract deployment is pending. I'm just going to wait a moment and I'm going to select to see it in the in the um SR scan.
Uh it's going to get processed and also we are waiting. So in S SR scan is get indexed. Here we can see also like some information like where is going where it's getting called that it's my wallet and the contract creation that once it's processed uh here and now we have the contract and we can see the contract have been deployed in the blockchain in sepoleia network and here it's the contract address if I go back to ramics now I can see that here in my simply simple uh uh I don't want here
you cannot see it properly but let me I need a mouse mouse actually but okay here actually it's giving me the address it where it has been deployed the contract I have here 0x E and when I go to SRS scan it's the same number so now for example if one if I want to interact now I want to add cut Finally h sorry I'm going to use that cut and the for number is going to get eight I'm going to click on it and actually metam mask is going to get open and it's going to ask me to confir the transaction here that now we have less data I can see different things like the network fee
again like I'm writing some information in the blockchain so it has some gas cost I have to pay in this case with sepoleia is and well some other information like the function add person two the parameter cut and the number eight. Okay, I confirm the transaction here again. I can check it. I can view in the block explorer and one it's actually uh processed uh I will be capable to see it indexed in the SR scan. I go back and now if I want like my favorite number and I give cut
here I can see that it's giving a call and actually it's calling the simple the address of the simple storage and here I have my eight so it has been indexed properly and that will be how to deploy from ramics actually a contract in sepoleia that is the test Once we have that now we are going to process for the uh section two that actually I have it here we are using simple storage that is just the but we are going to go just in case. Okay.
So the section two is on on cipher uh it's another section like exactly and actually what we could do because I have it prepared uh we could do the quiz. Yes, we could do here. It was the section one. Okay. From the 101, solid 101. And actually, we could do the quiz. That was the quiz from the previous part you did yesterday. Um, and we could do that. I have not done it. The the second quiz. Okay. I do recommend it. Once you go through do the quiz, we can try ah get started and you are going to get some questions actually from the Siri we have done. Uh so for example which of the is not a
validity valid solidity type I'm just giving like five seconds five four they reply on the chat yes float exactly okay float check answer it's correct um just text in in the in in the chat okay what is a struct keyboard Use four to define to define an array to declare a variable to be a storage to establish a new data type that groups multiple variables or to create a code runs before after function. Third, third.
Yes. Perfect. Which of the following is located for a storage that is not temporary? Five. Four. storage. Exactly. In solidity, what which of the following functions visibility specifiers allows a function to call internally with a contract and externally by users or another contract? That's difficult.
Okay. Exactly. Public. Why can the storage location be used for the new variables inside of a function of solidity? Someone says a and it's b. Why can the storage location be used for new variables inside of function solidity? because storage variables are automatically initialized to zero. That's not true. It depends on on the type. Okay. Uh for example, um a map, okay, that uh we are giving a key that doesn't exist, okay, it's zero. But for example, if we are giving a boolean, it's going to be false.
Um if it's a string, it's going to be an empty string. So actually the storage variables automatically set to zero. No, it depends on the type if I'm not wrong because the storage variables are reserved for constant only. No, because storage variables can only be used for external functions parameters. No, we can check that we have done it in public and because storage variables are meant to persist between functions calls and are only declared at the contract level. Yes, because at the end is what is going to be written in the contract and then it is going to you are going to be capable to read it after while memory or call data you are just going to use it in that function and after it's going to get deleted it's it's going to never
[music] existed okay given the following mapping address to U in 20 56 what is the file value returned when accessing a [music] key that does not exist Five zero. Yes. I mean perfect. What is the purpose of BU keyword and declaring the function of solidity? Okay. The actually that's good because we have we have seen that also we have public we have buu. So bu actually it's going to tell you that it's only a
readable in the case a function only reads the state data and does not modify it. Perfect. And we are finishing which of the following code snippets it's a valid way to declare public function that accepts you in par value. Oh which of the following code snippets is a valid way to declare a public function that accepts a to parameter and sets value. Okay. Function store. Okay. Okay, that's the name of the function. It has um an argument for number um that's weird.
Function store public for favorite number for number function store it. It's all the same. Oh, it's me. Okay. Store functionally. No. Okay. Here it has the public public world. Yeah. Uhhuh. Here public. Yeah. And it is where the public actually is the P store public. No actually. Okay. We are going to get through because I I see different answers. Okay. So if you check here it's like you are declaring that it's a function. After you are declaring the name of the function store, you are declaring the arguments
and here is starting the function directly. The problem is that we have to declare what type of function is it. If it's public, if it's internal, if it's view okay so a would not be we go actually I'm seeing I'm seeing c and d also. So here we have function store public. The problem here it's like I'm I'm telling that the the function is public. while we are in the function is store. So that makes no sense at all. And now between C and D you have function you have store that it's the name of the function you are declaring the arguments you are telling that it's public and after you put like um the body of the function
here. [snorts] Okay. And here actually you are in the C it's just a detail. Okay. It's what what is the argument and what is the variable in our contract. Okay, the variable in our contract it was for every number. So what you are doing in C is that you are taking the argument and you are assigning to the um to the H to to to the value in the contract what we don't know yet if it's initialized as as zero while in D as now everybody has said what you have is that you have favorite number that favorite number was if I go to simp simple storage here we have a
store you have the value that we have declared in the contract as my favorite number. Okay. And then you're assigning the the to my favorite number variable the argument value. Okay. So then it will be D. Okay. Just as explaining and what keyboard can be used in a function declaration to specify that the function can only be accessed from within the same contract. Five four three, two, one. Yes.
Uhhuh. I checked it's private. Okay. Internal. Okay. Now let's let's explain. Okay. Because I have see okay external it can only be accessed outside public inside and outside. private can only be keyboard can be used in function declaration to specify the function can only be accessed from within the same contract. What's the difference between internal and private? Uh now we are going to see it in the storage factory.
Okay, the difference is that private it's only from the same contract. Internal is from another function. Okay, so internal it's something that you cannot call. So we were seeing here in the in in the deployment that we have different and we were access. So internal will be something that it's called from another function but that function can be from another contract. Okay. So it's something that a person cannot call. It's something that another function it's being called. While private it's only from the same contract. Okay. Now we are going to explain it better. Okay. private only is the same contract and internal to another function. Okay. Now it's going
to make more sense when we do exactly can be used from other contracts. Now when we explain storage factory that is the second part of the class that it's going to actually make sense. Okay. I know it's a lot of information. Stop me because I'm speaking pretty fast. Okay. Uh that's fine I have prep uh look looks fine looks fine okay so we are going to go to the storage factory again in the github you have all the information it's going to be section two and you can check actually you can get the code from it also uh so or go through the courses that is what I recommend and type in
manually so just a recap you have simple storage simple storage is um the contract we have written before and it's everything is the same. Okay. Um it does not change much but what happens now we have deployed simple storage manually but what you can also do is deploy a contract from another contract. Okay. So here you have storage factory. I have commented everything and as you can see you have the license you have the pragma solidity and now we want to actually deploy simple
simple storage from a storage factory therefore it's a factory okay so what we are going to do is like for example we are going to say simple storage it's public. Okay, simpler storage. Um, what's the problem? I'm I'm having an error. If I want to deploy, it's not going to allow me. Why we are having this error? We are having this error because storage factory does not know what simple storage is.
Okay, as you check also, it's case sensitive. So, simple storage is not the same as simple storage with capital letter at the beginning. What we could do, we could just go to simple storage and copy the the contract. And now I have the contract simple storage declared here in the same file. And it's also detecting that it it exists. What's the problem? Imagine that you are working with a lot of contracts, especially if it's a D5 application.
It's going to get really really really long. lines of code. Okay, so that's not a good practice. I'm going to delete it. I don't know what I have done. Just one moment. Okay. And actually we could export the file. So we could we import sorry we could import simple storage file because it's here in the same folder. And what it will do the problem is that if I do this, it will be importing um it will be importing all the contracts in simple storage.
So simple storage contract it will be also importing simple storage 2, simple storage 3, simple storage 4. Okay, that's a problem because the problem is when once I'm going to deploy this, it's going to deploy everything in a storage factory and everything that it's imported that it's going to increase the gas cost. What we should do actually it's just import the contract we want to use. So calling simple storage from the simple storage file any with that exactly and and now we are going to go
to the child and inheritance because I'm seeing like in the chat you are discussing that um actually that is the last part. So here I have the storage factory that it's simple storage. It's it's just creating um if I want to compile this it's going to compile fine. If I wanted to deploy actually and now I go here and I want to deploy it and if you can see I have a storage factory. Well it's doing nothing so far. Why?
Because we are not creating any any new one. Okay, perfect. Yeah. Now actually what is going to happen is that we are going to create an array of simple storage because what what it's happening here okay um okay here step by step here I declare simple storage from simple storage and I have this function okay that um ignore this line that what is going to do is create a new contract. Okay, I declare the variable.
Okay, simple storage. It's a public simple storage that it's the name of the variable. That's what importing. And now what I'm doing is that simple storage, it's a type the contract we are importing. It's a simple storage contract variable and we are deploying a new um simple storage. If now I compile and well I'm having like a a warning but again like with the warning it's allowing me to compile and it's allowing me to deploy here I can call create simple storage and when uh why is not again? Well, the problem here
is because this is not an array. Um, it's going to overwrite that value and we are going to lose track of actually all the simple storage the factory has deployed. How we fix this? Actually, we use an array. Okay. And this array actually Oh, wait. Okay. That was not working because here was um so actually we create an an array that is list of simple storage contracts and it's an array of simple storage. Here we call again simple storage. It's simple storage contract value and we create a
new simple storage and after with push we add a value to the list of simple storage um array. Compile deploy and now create simple storage and when I give the first we have an address create simple storage and I give like the second position of the array that it's one and if we can see that changes we have created two if I give the third position of the array nothing it not it does not change because it does not exist okay and here
it says like transaction has been reverted why because that doesn't exist now if I create it now it's going to exist and now we have it now we are going to continue okay because okay we are creating simple storage um contracts but if I go back to the simple oh artifacts no I don't want Well, if I go back to the simple storage, we had several functions. Okay, we have store and we have retrieve and that person. Okay, how can we interact actually with that functions from our factory to interact with our functions?
Actually, what we use is the the address. Okay, what we were seeing here in the deployed here is the the address of the contract. So we need the address of the contract we are going to interact with and we need the IBI. Okay, here in REMIX um it handles the IBI the IBI by its own. So you don't have to worry and you can practice that in the future. But actually here um if I go to the compile uh now I'm gonna get lost I'm sure you have the storage factory and you have compilation details and here you have the AI for example um okay you have
the compilation details details and you have the AI you can copy it here and if I see the metadata byte code AI actually is here that actually it's the description of the contract So it's when it's what it's going to use later to understand what the contract has, what functions, what variables. Um right now Remix is handling this for you. So you don't have to worry. I'll go back to storage factory. Sorry, I cannot I close this. I go back to storage factory. Okay. And knowing that the ABI is being handled for Remix, what I'm going to do is declare some functions I'm going to describe
now. And what it's doing actually is that okay software factory. So SF software factory store um it has two variables like the storage index and the number and again like it's a public we need the address we need the IBI and the IBI it's this description that we have just checked in the compilation details so it's going to map the list remember that that it's how you were calling a map so what it's going to do is like a list of simple Simple storage contract simple storage index. Okay, the simple storage index um it's the array here
and it's going to look in the store function. As you see this store function is the name we have here in the simple storage. um and it's going to give the number and the number it's actually the um in this case if I check simple storage it's getting the favorite number okay so that number actually it's the argument is going to send to store the same for get it's we are going to use retrieve okay so now I will do the same compile storage factory I remove the old ones. I deploy it. And
now, as you can see, I have a store and I have also the list of simples. I have to create a simple storage because I I have just redeploy it. So, it's not going to remember the previous ones. If I check my list, I know I have one address. Okay. And now I want to store. And to store what I have to do, I have to give it a number. Okay. If every number eight it's a write function and now I want it's an array [clears throat] you simple storage index the simple storage index or it's a u
it's a u simple it's a u public simple storage it's an Simple arrange index retrieve. What is retrieving? I check here. Simple storage and retrieve public returns aint of my favorite number. Okay.
Well, I'm not going to lose simple storage index. Where is the simplest storage index? Simple stretch factory um simple stretch index is you and simple stretch index is the simple stretch number. that in this case the simple storage number when okay uh here when I declare actually I just give a number but I forgot from the other
argument okay so here I will have to say 0 0 well zero I want to 7 9 store and then it's 7 9 here it was the strange number And the index will be seven and it's should give me nine. Okay. Again um compile factory deploy factory I have to give two uins nine and nine.
Okay. declare store nine nine. Okay, it's just in error because it's not getting deployed. I'm going too fast. But it's just like Uhhuh. I I think you first need to create simple storage like nine times or 10. Oh, true. Yes. No way I'm doing that. I'm going to do 0 9 transact list of simple storage zero call I'm getting the the the first one if I'm giving it two
it does not change it's giving me an error because it's not and now if I give zero call I have the nine now yes okay and now what we were what we were talking just before about inheriting. So now what we have achieved is that I have a storage factory that can deploy another contract. So storage factory it's a contract that can deploy another contract and interact with the functions from the other contract.
Okay. But now imagine that okay I lost simple storage but I want to modify something like I'm not um for example here with store I will want to store everything plus three or four. Okay what I could do I would could copy paste deploy a new contract from zero and use the other contract I have deployed or I could use inheritance. Okay, here I have like at five storage that is simple storage. Again, if I don't import simple storage, my contract doesn't know what simple storage is. So, I have to import it. And
once I import it, it knows what simple storage is. And it inherits everything inside of the contract. So now I have this contract. As you can see, everything is commented. So if I want to compile it and I want to deploy it, I have everything that the simple storage contract would have. Why? Because it's inheriting. It's a child from simple storage. It's inheriting all the information. And before it was a question about private or internal. Okay, so this is another
contract that is inherited from simple storage but internal functions will still work while privates won't if I'm not wrong. Okay, it's I'm always curs saying something makes no sense but so what we are going to do now we have the function store okay and we are going to override the function so we declare the same like same arguments same variables um so we are going to compile oho what's happened okay what is happening actually it's asking me that we have forget virtual and when I click I okay compare I want I click to the
okay when I click to the error it give me to here and actually it's use a detail is that for a function to be capable to be overwrited it needs it needs to be declared as virtual so now when I go to add five okay here was the error that it's non virtual function and it needs virtual so we can overwrite I compile and now it's working. Okay. Um and it will be the same. So when I here I deploy five storage that it's my name five storage. So when I add a person Bob seven
and I give Bob it's giving me seven uh and the store okay and the store I'm giving it seven again and list of people it's a zero name Bob seven retrieve 12 you can say it's 7 + 5 when I'm doing the retrieve because in the store it has automatically done that. Uh okay. What I'm going to check the questions internal. Okay. What is doing remics for use for us for AI? How would it be different we weren't using ramics?
Okay. That's a really good question. Don't worry for now just focus on ramics. But what would you do is like here is as you can see uh when I'm compiling it it's creating like a lot of folders uh with information of the comp compile and the deployment. So as you can see here I have like the storage factory JSON that it's actually when you are using um your own code editor visual studio whatever you are using um you will add this JSON document that it's actually the AI the the that it will contain contain the the AI here you can see for example AV encoded topple um so what it's doing ramics is just
generating all that file for you automatically So it it handles everything in the back and you don't have to worry if not the API it's introduced actually in your code editor as a JSON file probably you you can show how like on scan probably the contract and how usually you can get the habi too. Yeah, I can go here to any I'm going to take just one randomly. Um, one lesson randomly. Um, Foundry I don't know Fry 20.
I just want to go to a [clears throat] a G code. Okay, I'm going to a GitHub. Okay. So if you can see uh but that usually is not pushed deploy the soul library GitHub test no because the ABI it's something you should not push JSON just because it's like random data. Um now I don't know if I have in my machine anything your file just another one.
[clears throat] Well, these are just sometimes you can see the palmares of Rael. Oh, okay. Uh yeah. No, but I want to Okay. Um now I cannot but because I don't know it's making it so difficult. I just want to go to a GitHub repo. GitHub. Yeah. Um but I don't know if it's going to be pushed because it's something actually you don't push much because but they have like bad habits so could be possible. So you have packages uh you well you have the con that's front end
so forget components hooks okay that's not a good example I don't have contracts here all good [laughter] that's fine yeah I'm going to go repos yesterday I sent the ABI ninja um whenever you get an ABI from a contract too hard hat here. So hard hat is just like a framework to deploy smart contracts.
Don't worry about that for now. You will see it very soon. But actually seeing that we are using Foundry, right? So Solen uh yes it's Fundry. So it's similar to Foundry. Okay. But here as you can see that it's for my contracts. Here I will have the contracts like test RC20.sol Solve and here I will have the AI AI.json.json that actually is just like the information for my for my um RC20 contract and when I'm I'm working with it I will just like it
will need like the the AI that's all. So if someone wants to interact the contract with our contract, do they need to add our contracts AI JSON? Yes, but actually like the AI JSON, it's something you you can like here when I go to SR scan like REMIX is really like processing everything. So it's very nice. But for example when I go to SR scan that it's where the contract was deployed uh I can go here to contract and you could the compile byte code the compile by code. So like the AI
information is used like I the AI information.json it's actually the the the contract information here. So I have events trans token transfer C20 transactions um let me see a transaction more details here as you can see um that it's AI it's a it actually it's not true that you need AI because you could only get parts so what you need is actually um you need to know the function structure so you could say like you are going to interact with that person too and actually giving this information it
will be enough. So for the transaction because the thing is like you are sending a transaction to the blockchain could be read or could be store or write or read transaction. So the thing is like you need to know what is the structure of the function you are going to read or write. Okay. So the AI is giving you that information. What it's giving you is that at person two it has one argument that it's value it's it's a name and another argument that it's forbid number. So it's the the argument you have to send in the transaction uh to the contract.
So that is the information it's in the AI. Um okay so if we know this so we don't need to add AI JSON to you could you could have it but only partially and actually that's something that when you go through the course um it it it mentions that actually it's not true that you need the holi you could only have actually the let me go here you could only have the metadata JSON you could have only something like that here ABI and for example if you seen that I'm only going to interact with create simple storage contract and I'm not going to use any of
the others you could only introduce this part in the API. I don't know if that answers the question. For example, if I'm going to never use um SF store, I could not include it. Okay. Um the thing is like you have to translate to the transaction when because you are going to send some information in a transaction and you need to know what you are writing and what you are reading and what are the arguments. So you need to have the structure of the transaction because that is one what the compiler is going to use to build your transaction.
Remember that that after is going to be compiling to byte code. Um and it needs to know the structure of what you are sending to the machine. the ABI does that function for you. The thing is like you could add it like comprehensive like everything or you could only add um actually functions you are going to interact with but that is too much detail you should not worry for now it's like remix is handling and when you go through the project you are going to see and the vi many times is going to be um generated for you for the uh for the different
frameworks. It's not something you are going to need to write manually at all. Any other questions? Everyone is super curious. Yeah. No, that's good. I mean, I I still have the other quiz if people it's still with energy. Um yeah they're here the simple storage quiz I have not done them so if people want we can do it um if not you can go through section one you can finish section one you can finish section two and then you do the quiz because I think that it's a really good
exercise just to think about again and if you click something is not right then you can go to any AI tool uh like um in the in the course this is good yeah that's good because I'm the first one that I'm making a lot of mistakes um always I'm a little bit dispersed and actually going through the debugging testing testing testing and so and and a lot of repetition it's actually when you are going to get with the concepts stick in your [music] mind so not just watch the videos or just after go through and code it test things just for curiosity as before that for example now you have now you have like inheritance
Um, I'm I'm a little bit artifact here. You have like inheritance. So you could for example test what we were talking before about private and internal functions. Okay. So you can try to modify and play a little bit with it and see how actually it behaves. And here also okay no that's not uh I don't know where it ended. But here also you have like the all the different documentation you can check and you have all the code to check and also like you have like different recommendation as AI tools you can use to learn and and educate that for me I not a super fan of VIP coding
but yes like when you have any question or error ask to explain it or when you see um a code and you are not capable to comprehend it just copy paste the code and ask what the code is doing. So explain you step by step what it's doing. Uh where is it? But by the way at the end of siphon um when you have completed a few courses the thing is you can pass a certification um and so this certification is well renew renowned [laughter] into the ecosystem. So if you are looking for a job as a full tech web three smart contract developer sorry um it's it's
useful. Yes. And and at the end of every every section there is also a challenge that you are going to be minting an NFT too and it's it's going to get in your wallet once you set up your metam mask etc. I don't know if that is the same certification you were mentioning Sen. Uh, no. It's it's another one because the other one it's uh you have to pay $100. Oh, okay. Yeah. And um it's it's kind of complicated.
So, you really have to train yourself before but it's covering really what is it? What is in the siphon updraft courses? It's like a quiz. Some quiz you have to put input. [laughter] So be careful about it. Nice, nice, nice. I don't know if there is any other question. So how we can help you? I think you are super pedagog. We say that pedagog. Yeah.
Yeah. Spanish is similar like Yeah. Um yeah I try to make it a little bit dynamic because if not it's it's very tough. Yeah it's it's well like structure in term of steps and even you you're going through um how to debug stuff. So it's something really useful because when you're vibe coding, not vibe coding like you live coding, um sometimes that's happen. And so yes. Um yes. And also you see I make mistakes.
I I'm always not like seeing the details. You girls and boys like were helping me. Um because before like I it was cut. I was not seeing that cat was being over override there. You told me. So don't get frustrated. It's just like sometimes you don't see the mistake, but it's it's part of the process. Yeah. [laughter] Nice. So, please go through siphoning. Um, take your time. I think you need like one hour practice by day and during during this this week and we will see again Raquel on Thursday, right?
Yes. All right. Uh tomorrow we're going to deep dive on into a record part. So it's something clearly um something to master [laughter] for building application. Um so yeah um WA will take care of that because she is working on this file. Um so feel free to prepare your question by the way regarding this topic and uh any it's more about if you are like if you like unchained data stuff um that can be interesting for you.
All right thanks again. Thank you everyone for everything and see you on Thursday then. See you. Yes. Your tail.