Solidity 101 | Session 1 (Khawla)
Solidity 101 — dev3pack & Cyfrin Updraft · 1:03:26
Khawla teaches Solidity basics through a SimpleStorage contract in Remix. The lesson introduces data types and default values, compiler settings, function visibility, arrays, and structs, with live exercises that store and retrieve numbers and named records.
Speakers
Topics
From Solidity 101 — dev3pack & Cyfrin Updraft, hosted by dev3pack.
Transcript
Hello. Hello. Yellow. Yellow. Uh, remove. Yeah. Um, so Whoa. Okay, let's wait a bit. Um, so going to come like in two or three minutes, something like this. She's a
bit a bit a bit late. Um but I uh hope you're doing well as usual. Uh I will put a remainder. Um text. I I I put like um Google Meets and so I just remove it.
Probably some people were there. No reason. All right. one. Um um motion attack. We're coming.
[Music] I I put the link on the on the chat for everyone to [Music] join. [Music] Oh, okay. pin notify up. All good. Oh, 10 people just joined.
Nice. Uh, all right. Hello. Hey, VA. Hi, Fen. How's everyone? Welcome. Welcome. We're doing great. Apparently, apparently. No, I can see it. Everyone's doing great. for sure. Yeah. So, we're going to wait um one or two minutes uh because I just put a remainder um with the link. Um but all good. Um Oh, probably before I I can just present um the courses uh for this
week. Yes, I will do that. Makes sense. All right, I'm lost. [Music] Um, okay. So, you can't see that right now. Um, so during this week, uh, we're going to devise the basic concepts uh about solidity. Uh, solid solidity the main uh like it's a programming language that um we are using on the Etherum ecosystem to write smart contracts. So um just um it's like we we we will deep dive uh using using a specific resources
that is called um siphon updraft. So in fact um into into these courses the goal of the the it's the goal of the boot camp is to provide additional context about about these courses. Um and it's something that you can uh get as a self assignment on your side. It's like 5 hour of content itself but with some quick video uh that you can you can show um with different um with different session uh section. So take your time learning to through it and uh the goal of the the best camp the
boot camp is to provide yes more like um spec if you have a specific question about it etc and also going through the different concepts itself that are in the into this these courses. Uh I wanted also to talk about um something else. U so I don't know if SNHA is here. Let's Oh, you can't hear me. Um, she's not here. Um, but actually SNHA has done something cool. So, after this B camp, this boot camp, what you can do is also going through uh Thursday's day uh building with
solidity. So it's some uh little challenges um that you can you can do uh from uh fundamentals to more advanced one um for writing smart contract. It's really beginner friendly. Um and I know I put I put everything here. Yeah. So during the the next two weeks you're going to do this thing and this thing. All right. All good. Great. Uh and so you can see all the video related to each challenges um about 30 days building with solidity. It's really really useful. Um I know a couple of
people already done it um and learn a lot through it because you can you can also push your smart contract on GitHub and having like a better public building on your side. All right. All good. Um so today um we're going to deep dive into this this this specific um topics and when when uh the session is over so we update the notion as we have done for the best camp uh the discovery best camp last month. All right. If you have any question, you can put it on the
telegram. We have like a dedicated chat for that called solidity. I think we are good now to start. Yay. Thank you for the introduction. You're welcome. All right. So, um, just like Sen said about the Solidity smart contract development, you can check out all of the courses here on Siphon Updraft. Um, one minute. Yeah. Yeah, you can check all of the courses here on Siphon Updraft. And today we're doing the solitics smart contract development. Um, wait, why is that so big?
Yeah, indeed. It's so big, right? Yeah, I think it's my settings. But, um, yeah. So, we're doing this, which is the first section, simple storage. Um, we're doing from lesson one all the way to lesson eight. So, with every uh section, you will get a quiz. Try to do that like on your own time. Um, yeah, you can get multiple quizzes in one section. So, that's really cool.
Um, I love Siphon Updraft. It has really good courses and it's really fun and the community is cool, too. So, welcome to Soliti 101. Yay. Let's do this. All right. So, who am I? Um, I am Kola. Um, I'm based in the UAE or what people know, Dubai, I guess. Um, that's the only city that people know. And then I am a technical product manager at DIA Data. We do crosschain oracles. Um, and I got into crypto back in 2020 or like end of 2020, like 2021, and then worked a little bit as a
blockchain developer for around two years. Um, and then I transitioned into product mid 2023. So, um, it's been two years um, in product and that's fun. Um and then also I think last year not last year I think this is an old slide that was back in um yeah actually yeah 2024 we launched solidity sisters so that was fun um and we were all just like learning together solidity um but unfortunately it's not as active now you are doing the the inverse the contrary of all um developer journey like developer and then after that transitioning as a objects and I know
some people inside the ecosystem doing the contrary. Really? Yeah. Wow. I didn't know. Okay, that makes me unique. I like that. I want to be special. All right. So, today we're going to learn um about solidity. So I'm curious how many of you have I don't know like dappled with solidity or I want to know like what are your general observations of the language? What kind of is it object-oriented for example or like what did you notice about solidity and the way it's written generally? Were there any special observations that you have? Actually they are all new about solidity. Really? Yeah. Wow. Okay. And
so like they're all familiar with like web two languages I guess like yeah something like JavaScript. Okay cool. So then um one of Soliti features is that it's object- oriented. So I'm sure if you've worked with Java you know what object oriented is. So it's like having it's like saying it's like it's like a way of defining a class and then saying this class um is a or for example yeah actually I have this tab open. So for example you have a button you can define a button as a class and then within that class this button has uh a label it has x size y size and and and certain positions on the coordinates on the x
and y and y coordinates um and then it also has methods. So it's sort of similar solidity is an object-oriented language and it's also high level. So that means that it it like the the language is written in a way that anyone can understand like it's a a human readable language. Um and it's not lowlevel uh like assembly for example if you're familiar with assembly it's a low-level language um and it uses a lot of curly brackets just like JavaScript um for structuring uh data and then it's also statically typed. So that means that anytime you declare a variable, you have to specify what is the data type of
that variable. Um, and I think that's not the case for JavaScript, right? Yeah, I think so. Um, and then it supports inheritance, creating libraries, and complex userdefined types, and it has a bunch of other features. So let's get into the data types. Um we will look into the data types and then we'll try to guess together um what would be the default type for oh sorry the default value for each data type. So we start with boolean. We all I think we're all familiar with these data
types. They these are the same data types that you will find in other programming languages. Um there's boolean that could be true or false. Um there is unsigned integers which are positive integer values. Um it can be zero or it can be anything from zero like like positive integers essentially. Um and then int would also store negative integers. Um, and address is just a an address. If you have like if you've seen an Ethereum address before, if you use Metam Mask, um, for example this one, wait, for example, an address like
this, it would look something like this. Um, that is an address and it can store um these kind of values. Um and then you can also access method on addresses like balance and transfer. And then there's also bytes and strings. Um a string is just a string. It's like any um human readable uh string or set of characters. But bytes are more like strings that can for example hexadesimal values. They can contain hexadimal values. Um those are the types of values that this data type can store. Um yes. So now let's um do
this exercise together. And what do you think each type's default value is? I like to do this exercise with everyone. So for example, what would you think is the default value for boolean? So if I go here and I don't know maybe we can use the storage contract. Sorry. Could you present Remix? No, not yet. Oh, actually good idea.
Let's present Remix. So Remix is like an IDE. Um but it's like a browser IDE that you can use something like VS Code, but then you can use it just on your browser to compile contracts, right? contracts also deploy contracts to a blockchain. Um so that makes development really easy and fast and quick. But um usually like when you want to develop um like production level contracts or set up a big project then uh remix is not the ideal environment for doing that. you need to use frameworks like hard hat or foundry to develop these smart contracts
because they also come with a bunch of other tools. Um, and you can run a bunch of other things with them. But like with Remix, it's kind of limited. It's more of like a light like a light development environment that you can use and access quickly. Yeah. So it's well um well used during Agaton. Yeah. like it's very accessible and easy. And if you look here, if you should first go to remix.ethereum.org, I'll drop the link here. Oh, you already did. Thank you. Can you do basic front end edit?
No, I don't think so. But you can run scripts. You can run JavaScript. uh J yeah JavaScript scripts or scripts in general. Um and you can also run tests here. You can write tests but I think a whole front on a remix. No, I have not seen that before. Um yes. So here you can see um these are the projects. Uh these are like folders that have scripts. Let's say let's start with the contracts.
These are the contracts. Um and in solidity smart contracts solidity smart contracts they end with um um with dots soul. So that's how you know that this contract is written in solidity and then if you say let's say you developed a contract and now you want this contract to be available to everyone you have to deploy it to a blockchain. And so to do that, you will write a script that will help you um deploy it using your let's say wallet.
You will fund your wallet with some tokens and then you will if you have a constructor inside your contract, you will pass the values that are needed to deploy your contract. And then you'll write a script that can do all of that for you. And you of course you need to set up an RPC. um and you need to set up a a bunch of other things so that it can deploy it to the destination chain. So you can write scripts here and then you can also test your contract. Um you can either write the test cases in solidity like the one here or you can write the test cases in JavaScript. Um yeah so that's how it looks like. This is the
layout and then this is a search. You can also search through your files, your projects. This is the solidity compiler. Um, so so once you write your contracts here, you need to compile it and then that bite code I think it produces a bite code, right? And then that by code is what is used to basically understand how to interact with the with the contract. Um but let's not get into the compiler part. Um and then here you have the environment which you if like if you have if you want like remix gives you this virtual environment. So like a
playground that you can test with. But let's say you don't want to deploy your contract in Remix. you want to deploy it on let's say base then you can connect your wallet and through wallet connect for example and then it will use um your wallet connection to deploy it to base instead of using this virtual environment. This is a debugger. Um, but here inside the deploy and run transactions tab is where we can see all of our deployed contracts, which we will do that in a bit. Uh, but that's just um a a brief overview of Remix and how it
works. Um, yeah, Remix is super helpful for testing things really quickly. All right. Do you have any question about Remix? Um because I mentioned that four courses related to siphon are using remix and uh you're going to interact a lot with with this tool just to deploy quickly a smart contract and so on. Yeah. Just to be familiar with it soon. Looks okay.
Okay. Oh, good. Um, uh, wait. Like I'm trying to see if there's a simple diagram that I can use. Yeah, something like this. Just to show you just to show you what happens like when you compile uh when you compile your contract uh it produces a bite code and it produces an AI and then I think the bite code is what gets deployed to the EVM. But let's say you want to create a front end that will interact
with the contract. Then you need the you need this API to access the methods that are on your smart contract. But we'll get into this later. Like you shouldn't concern yourself with that for now. Let me see if there are any questions so far. No questions. I think ABI stands for application. Wait, I'm trying to look things up with you [Music] guys. Okay. Application binary interface. Yes. Thank you.
All right. Every time some acronym Yeah. So many acronyms. True. Okay. So, what do I want to do here? Yes. Okay. Let's try defining random variables and then seeing what their default values are. So let's start with the first data type and which is boolean. Let's say bull
[Music] um is true for example or maybe like let's say bvar and then we compile this let's say and it should show up here and we deploy it. Wait a minute. Let's do public. Let's do [Music] function. Maybe that's not typical. Would that get compiled? Okay, there we
go. So, what would what would you say is the default value for this boolean variable? Would it be true or false? False. False. Okay, let's see. True. It's false. Yay. Yeah, it it's like on the on the like it's mentioned like if you can show where where it's mentioned that it's false on the where ah here. Yeah. Yes, thank you. It's here. It says false. So, so as you can see, um I I don't know if
you've noticed, but when I wrote bull and then I declared the variable without saying that it's public or private or whatever, then we I couldn't see that here. I couldn't see this button. So, if it's in blue, it means that it's a getter function. So every public variable that you declare in Solidity gets a like um like a default getter. Um I'm not sure if you're familiar with the concept of getters and setters, but yeah, it gets a getter and then that's how I get to call it. So it's essentially a function that can retrieve the value of this. Okay, let's try another one.
Um let's try an unsigned integer which means that it's can carry positive values only. Um and let's say u int public uh number delete compile apply. What would you say is the default value here? Yay. Okay, everyone else agrees it's zero. Okay. Yeah, it is zero. Nice. It's a game today.
Yeah, let's try um one last thing. Maybe let's try Yeah, let's try a string. And let's try an address. Let's try an address. public um my wallet. And let's try a string. Uh what's a string? String string public. Um my name I guess. And let's compile this and run it. Okay. What is the default value for my wallet and for not for for my name?
My name and my wallet. Yeah. 0x blah blah blah an empty string. Correct answer. So for my wallet it would be the zero string uh sorry the zero address and my name would be an empty string. [Music] Correct. Okay cool.
So now um I think we're a little familiar with the data types and solubility. Um maybe I would say like the tricky thing would be like you end versus int and things like that and also address is a new concept that doesn't exist in other programming languages I think. Um, yes. So, I used to do this exercise for like I we used to do a bit of math here, but it's okay. Maybe I'll keep it for later. Not today. Remember, it was too intense.
Yeah. So, let's get straight into functions. Um, functions similar concept that you find in other programming languages. you have wait let me make sure my code is ready uh actually oh I just realized that we never spoke about how to write a contract sorry I'm um maybe we can start from there okay so now let's create a new contract that is called simple storage and you should always make sure that the name of your file matches the name that you give to the contract. So
when you say just like when you say class person there's you start with this keyword contract and then you give the name of the contract always make sure that this name matches the name of the file. Um I think that's a good practice but I don't think it would do anything in terms of compilation if I'm not mistaken. And in solidity we start with um specifying the the license. So you start with um wait let me see where's the reference for it. Yes. So license identifier. Let's
see. Okay. So, you should always start with this license identifier like it can have multiple values like you can say MIT, you can use GPL, you can make it unlicensed. Um, and okay, thank you for sharing. Um yeah so essentially you start with specifying the license for your contract. Um and then you start with the with this keyword also pragma pragma keyword which is essentially
defining the version of the solidity compiler to use. So let's say we're going to use version let's see probably something that you remember right now um during the discovery base camp. So Kevin explained uh this this part um really perfect. Yeah I I I I think so I remember but it's always great to have a a remainder.
Yeah. Yeah. Exactly. So let's read this together. The pragma keyword is used to enable certain compiler features or checks. A pragma directive is always local to a source file. So you add pragma to all your files if you want to enable it in your whole project. Um and then you need to specify the compiler version here. And then what else? Yeah, let's not get in too much into this, but let's say we'll use version 0.8.13. And then when you use a hat, you're saying that this um contract is compatible with starting from version 0.8.13 and above. Um so you can use any
compiler version um starting from 0.8.13 to compile your contract and above. And so the way that you can find the new compiler versions that are being released um are through either the documentation or through the repo here. Solidity. As we can see, the latest version of the solid compiler. Right now, we're at 0.8.30. And it's always a good practice to use the latest um like stable version of the compiler. And yeah, they regularly like release what are the new features, what have they fixed. So, keep an eye on this too. Um this is good. And yeah, so we start with the
license identifier and then specifying the solidity version compiler version and then you start with the keyword contract and then you give a name to your contract and in this case we'll call it simple storage. And then just like a class it will contain a set of variables and it will contain a set of methods and everything like the entire logic should be within those curly brackets within the contract uh object. So in this simple storage contract we'll just have um a method that will take your favorite number and
store it. That's all like that's all it does. So if I want to store um my public number somewhere, I will need um a variable that can hold integer values, right? So I'll use and I'll make it public and I'll call it favorite number. and then we'll declare a function and the function is written in a similar way to other programming languages. So you start with no actually you don't need the return type that was misleading. Um you'll start with the
function keyword and then the function name. Let's call it store. And then you'll pass you will put the parameters if your function is accepting parameters. Um and if you need certain parameters to be passed um so yeah for your implementation for your function implementation then you will specify them here within those parenthesis. So let's say we will need the user to pass their favorite number which is also a [Music]
and it will be public and what it does is that it will assign the number that you pass. Let's call it babe num just to like distinguish it to this um global variable that you have or this variable that exists within your contract. So you'll say favorite number is equal to fave num. And now we get into the visibility part. Um, so you can specify how you want like you can
specify the visibility of your function. Let's look at into this cheat sheet. This is also really helpful. If you look, if you go down here, you'll see the function modifiers. So it's like keywords that you add to your function to say how you want this function to be accessed. So if you say something like this function is public, what does that mean? You can go here and you can see it says visible externally and internally creates a
getter function for storage slate variables. So that means that this function is visible to other contracts. Let's say you define another contract here. Then that function will be visible to the other contract internally and also externally other people can use it and interact with this function. So these are modifiers and keywords that you can give to your function to sort of control how people can access your function. If let's say you don't want this function to be accessible, let's say it's a super super sensitive
function, you don't want it to be accessible by other contracts, then you can mark it as private. Um but of course there are other restrictions that you can do in the future. Let's say um yes it's private or maybe let's say let's say it's for example let's say it's extern external it's an external function yes other people can use it outside of like like any user can come and use that contract sorry that function but you don't want any user let's say you want to control the access then there are like other layers to it you can say only this certain person with this address can call this function even though it's
external you can see it I can see it everyone can see it you can you can I mean you can but you cannot call it like you cannot make it execute its implementation because it has let's say um a modifier that's called only owner and only a certain person with that specific address can access it. So there are like different ways that you can control the behavior of your function. um especially when they're like super sensitive and also um yes sorry just highlighting that it's an important point uh notion to to master for yeah
exactly so let me access controls yeah you can check um a library that is called open zeppelin and in open zeppelin you'll see this tab for access control and for example this this function h sorry the contract let's say it's ownable and let's say you have wait actually yeah where is the modifier only owner okay let's not confuse you but I'll just share this with you so that you can learn more about access control for
example. So yes, so there are a bunch of things but it's not just for controlling the access it can also be gas efficient. So um if you mark it I think if you mark a function as external it will be more gas gas efficient like it will not cost as much to execute this function versus um marking it as public. So there are also like some stuff that has to do with gav efficiency and also another side to it is the access control. Um and yeah and that's what it takes to be a solicited developer. Like you need to be aware of all of those things. Um yes it can be overwhelming
but it is important because you're not just writing a piece of code. You're making sure that it's scal efficient. You're making sure that it's secure. you're making sure that because once it's deployed you cannot reverse right and you can use to some templates uh because uh yeah it's it's can be a lot to write exactly so don't hesitate to use templates I sent a link uh regarding that using solidity by example yeah that's true. Um, and then what were we saying?
Yes. Okay. So, this is a simple function that will store your favorite number um to this public variable, right? Um, and then what else do we need to do? Let's see how this works. Let's compile it and deploy it. And here, as you can see, if it's marked as I think like there are color codes in Remix, if I remember correctly, if it's orange, that means it's I think that means it's public, right? It means it's a setter function that is public.
Um, but yeah, I kind of forgot the color codes to be honest. So, let's store a number. Let's say my favorite number is three. Um, this will cost um gaz to call. So you you kind of have to pay for this in order to call it. And you can check here the gas the transaction cost it took for what four 43,000 718 gas.
Um, and then now what it did is that it stored just for storing my favorite number into this variable. And now let's call this the getter function for this function uh for this variable to see if three has been stored or not. And yes, it did. So now it holds a value of three. Ja has a question about uh contract modification. How to modify the state? Where's the question? Uh I think it's once contract is supplied.
Yeah, you can also use um upgradeable contracts. So you can also look this up uh but some contracts are upgradable and then you can somehow upgrade the contract implementation upgradeable contracts. See if there's a result. Yeah, there's also an open sublink guide here. I'll leave a link.
[Music] Um yeah, what were we saying? Okay, let's go back to this. Okay, now we want to explore other concepts. So something like arrays and strrus um would an array if you're familiar with it similar concept to other programming languages um you have like if if you declare an array of size five let's say you can you have all of these elements within the array um and each like the way that you can access it
is by saying num zero num one num two these are like an like each slot gets an index and it starts from zero and that's how you can access it. So essentially an array can hold multiple things um and it could be like a fixed size or it could be dynamic. Similar concept also exists in solidity. So you can either say this array or this bucket holds uh five elements or you can just declare a buck a bucket and it can hold whatever number of elements that you want. But of course they all have to be of the same type. Do we have other questions?
Um, okay. Someone's resharing the link. Okay. Um, just quickly, where should I start? Okay, maybe let's say we want to store we want to store instead of a single favorite number, we want to store an array of favorite numbers. So we will say unintent but this time with brackets and then we'll say public favorite numbers and now instead of holding one value it can hold multiple values. So we'll change this logic. Now
if I want to let's say I have an array of uh favorite number three four five six then this one. So if I want to access this one I'll have to say favorite numbers and then pass the index of the first element which is zero. If I want to access six, then that would be 0, one, two, three. I'll say favorite number and then I'll pass three. So, it's a similar concept to all of the programming languages that you know. Uh, nothing new here actually.
Um and then if I want to push an element or a value into this array, I will have to use the push keyword. I think I we've some other programming language also has this push keyboard but I don't remember. We'll we'll use the array name and then we'll say dot push favorite number like that. So let's see how this works now. We'll recompile. What happens if we find that there's a bug in our contract after deploying it?
you have to redeploy unless it's I'm I'm actually did not venture into the world of upgradeable contracts. I haven't written one before, but there should be a way for you to sort of like point to a newer contract, I guess. like I I'm not sure maybe I don't remember the concept but maybe there's like a a contract that points to another contract and then in case you want to upgrade that one this one will not be impacted and then it will just point to the new contract somehow. I'm not sure.
I don't remember honestly but we can look into this together. Um you're welcome. And yes, so now let's try this. Um, and then we'll get into the strus concept. And also strrus similar thing like if you probably written in another programming language, you'll just find this um like repetitive, nothing new. Um, yes. So simple storage we will pass a favorite number here. As you can see um if you want to call this array then you have to pass an
index here and store I will store three that's one transaction and I will also store four and five let's say three values. So now let's say I want to access um the first value that I entered. I will say I will pass zero as the index and then I'll call the array. As you can see this is the output which is three. If I want to access a second value I I'll pass one. It will return four. If I want to p access the third value it will have an index of two. And this is
the output which is five. Let's say if I want to access the fourth value, even though I don't have a fourth value stored, I'll give it an index of three. It's always like a it's always like your number minus one. Um it will revert, right? It will throw an error because this number does not exist. It doesn't have four slots. It only has three slots. So, similar concepts um to regular arrays. And then let's get into strrus. Strructrus is is a way of like let's say that you an integer does not like you're trying to declare a new type and your
new type does not fit into an integer. It's not an integer. Um and it's not a boolean value. It's not um it's not an address. It's a bunch of things. Um then you could use a strct to define a new data type. So let's say you want to create a strct of a person and this new data type is a person and that person can have a favorite number and can it can have a name then you will call you will use the keyword strct and then give it a name and yes it is intentional to have um um to have the name in uppercase like the first
letter and then you will Declare two types within or two data types within or two variables two properties within the strct which are favorite number and name string name and that will be your new data type. So you can have a variable like a variable of I don't know maybe let's say of type person you can say person one you can say person is the data type it's public and the the the variable is called person. So that's how you use or
that's how you introduce new data types um within your contract. Um yes. So now we want to create a bunch of these people like we want to store um like we want to store now a person. Um so the store function now will work as you'll pass the favorite number and you'll pass the name and it will store it into an array of persons. So you'll say person. Now it's an array of person because just like you can say you array it can also be person array uh because it is treated as a data type and
then you can declare as public list of people and now you can pass the favorite number of the person and add another property call it um sorry another parameter and call it a Okay. And now you can say what can you say? And now this is how you um this is how you push or how how you initialize um a a person variable and then push that into the array of persons. So
you'll say [Music] um you'll say let's say person one minute let's say list of people dot again it's because it's an array you can use the push method and this time to initialize a variable of type person you'll say person and then you'll do parenthesis and then you'll create sort of like an object and that will be passed to person and then you can use those two
properties that you've already declared and then give it the fave num as the value and it's like you're saying this um this value that you're passing here assign it to this uh property and then this value that I'm passing here assign it to this property and that's how you that's how you do it here but this might be a little confusing like if you want to distinguish the the the parameters from the um what do you call it from the properties declared here then you can just do an underscore like that just to make it
just to not confuse these two. Let's see why is it throwing an error. It must be memory. Yeah, we'll talk about that in the next session. And then let's see how this works. Now I see there are questions. Is is struck like um constructor in Java? No, it's not. Yeah. Yeah. More like objects in JavaScript. I think I think strrus also exists in Java. No strructs in Java. I think I I say in Java not Java because there is a constructor not in Java in
Spring. Yeah. Yeah. There is a constructor in Java. True. Construct somewhere. No. maybe in JavaScript but it's not the similar concept. We also have a constructor in solidity. Okay. Yeah, it it it is called uh constructor also like that. Same thing. Um but strct is more like a data type. Uh it doesn't do any implementation just stores values. Okay. Thank you.
Welcome. And now let's try the uh let's try calling the store function. The store function now as we can see it takes two parameters. It takes your favorite number. Let's say floor and it takes a name and you have to put it in what do you call it? double double quotes and then say I know let's try my name transact as you can see every time you interact with a function in solidity you have to pay gaz um and sometimes it's also not just gas some people also
charge you for calling those functions um for example we like we have in our smart contracts um a function for requesting data like so if you want data from an oracle what an oracle like it brings data from the outside world let's say from the stock market and then brings it to your contract if you want to call this function then you have to pay us uh it then you have to pay us some fees that that is charged on top of the gas fees so as you can see every call um requires gas but also some people might charge you an extra fees for calling those functions [Music] Um yeah um you can turn this whole thing
into a business model. And then let's access the let's access the person array. Yo, where's the person aring? It's here. Okay, so we'll pass zero as the index and call it. Yay. So now it did store two values. uh my favorite number and my name. Let's try another one. Five and then your favorite number is five. I decided and then let's access the second element in the list of people and that would be five for her
favorite number and this is her name. It's both stored. So yeah, um I guess that's the end. Uh I hope this was a live session. Um there are definitely other things that you should explore together. Um like upgradeable contracts like um we should also dive or maybe like on on your own time you could dive into the modifiers and how they work the different modifiers and also the function visibility specifiers. Um this is an an interesting exercise.
Um yeah and also order of presidents uh precedence for the operators they exist similar concept in other programming languages so you can know which ones get executed first which of these operators similar thing they have here so let's see but I guess that is the end any questions are there any are there free tools we can use without necessarily paying gas. Yeah, it's remix. You can use remixes like virtual environment for trying contracts. But if you want to also every chain offers three uh gas tokens on
their test net. Every every chain just like base they have base sapoleia. You can ask from their faucet. you can get some tokens for free and then you can try it on their test net environment. Um, every chain does that. So, let's see base. Yeah, the issue actually is um for claiming faucets in the foset we need um we need a funded um like account address and so doesn't have that. So you need to to fund it like who doesn't have it base. Um everyone I guess.
Um yeah. Oh you have to find your wallet first. Oh yeah on mainet. Yeah on mainet. Yeah true true for this net. Yeah that's true. I forgot. Yeah they made it harder now. I don't know why, but because of the box, I guess. But yeah, you need some you need to have like a very minimal I think what like $2 feed I don't remember, but like 0.00 something ETH in mainet in order to request from faucets. And that's just because like some people really abused faucets for so long.
But yeah. [Music] Um, yeah, I think that's all so far. Any questions? You are on time. Yay. Good for me. Nice. So, some people uh not some people, but a few people already go through the ciphering courses. Um but yeah just will share my screen. Uh so I think it's this video. Let me [Music]
share. So just make sure um like everything we have covered today uh it's here. So we can go here t and t until there um it's about this session. So please go go through it. I think you need probably 1 hour. Yeah, it's like 1 hour uh itself. Um so you can you can dive um by this way too. And then uh tomorrow we're going to have another another session. So with rackl this time about error memory mapping
storage factory. So you're going to have to complete a few section like this one section one and section two. Um so yeah just feel free to to go through it. Um so roller provides a great um first overview uh of this session. this section. Sorry for my English. And I I know uh Maya is also on the on the chat. So she's um a siphon ambassador. So also for technical question, don't hesitate u to to ask her uh ask to Raquel, ask to Walla, ask to
Emma. Um we have a couple of people well informed about everything related to that. Nice. Um I on the Telegram group we have a channel called Solidity. So for whatever your question, don't hesitate to to reach out. Yeah, they are really up to to reply to everything. Yes, for sure. Feel free to ask any questions. We're all here to help. Yes.
Thank you very much for this first session. Uh sir, uh Rael, I don't know. Yes, Rael, you are here, but I don't know if you want to to say something for tomorrow or anything. Don't hesitate. Um otherwise, um see you just tomorrow. Um and don't forget to complete siphon. Um and as I mentioned, after each each session, you will receive an email. um as we have done for the discovery basket with all recap and what you have to do for next session.
Amazing. Yeah. Perfect. Thank you. So you take care.