Solidity 2022: Next steps after the basics. Inheritance, ERC20, and ERC721 Smart Contracts | Dave Slater | Skillshare
Drawer
Search

Playback Speed


  • 0.5x
  • 1x (Normal)
  • 1.25x
  • 1.5x
  • 2x

Solidity 2022: Next steps after the basics. Inheritance, ERC20, and ERC721 Smart Contracts

teacher avatar Dave Slater, Develop the World that you dream of

Watch this class and thousands more

Get unlimited access to every class
Taught by industry leaders & working professionals
Topics include illustration, design, photography, and more

Watch this class and thousands more

Get unlimited access to every class
Taught by industry leaders & working professionals
Topics include illustration, design, photography, and more

Lessons in This Class

    • 1.

      Intro

      1:19

    • 2.

      Lesson 1 - Inheritance

      20:02

    • 3.

      Lesson 2 - Linearization

      10:11

    • 4.

      OPTIONAL - Set up a Testnet on MM

      4:35

    • 5.

      Lesson 3 - ERC20 Token

      50:34

    • 6.

      Lesson 4 - ERC 721 Token

      24:34

  • --
  • Beginner level
  • Intermediate level
  • Advanced level
  • All levels

Community Generated

The level is determined by a majority opinion of students who have reviewed this class. The teacher's recommendation is shown until at least 5 student responses are collected.

77

Students

1

Project

About This Class

Who is this class for?

This class is for anyone who has some fundamentals about  smart contract development using the Solidity language! Here we will cover everything in a step by step method, talking about inheritance, ERC20 and ERC721 standards.

Most of the tutorials and courses I followed focus on creating some type of project from the start, which is a great way to learn, but they also go very fast through the basic and I used to find myself not understanding why they write code in a certain way. 

The goal is for you to complete the class with the ability to understand the of ERC20 and ERC721 standards, and how to deploy tokens and NFTs on the blockchain..

What you will learn:

  • Remix IDE, Solidity versions and documentation
  • Inheritance
  • ERC20 Standard
  • ERC721 Standard (NFTs)

What you will create:

Along the way, we will create:

  • ERC20 Token Smart contract;
  • ERC721 NFT Smart Contract:

I recommend to follow my Solidity Basics Class before joining this one

Find the files about this class in the GitHub Repository for Solidity

Solidity Docs: Solidity Docs

Remix IDE: Remix IDE

Meet Your Teacher

Teacher Profile Image

Dave Slater

Develop the World that you dream of

Teacher

Hello, I'm Dave. I am a developer advocate, tech enthusiast, pilot, and flight instructor! I have an extensive teaching experience from my flight instructor background. During my programming journey, I learned so much from the community, and I want to do my part to give something back!
Here I will focus on the Solidity language to create smart contracts and python, especially python, to interact with the blockchain.


I have worked on many projects and helped many teams launch their DApps.


What can you expect from me?
- Clear and step-by-step explanations.
- Support and interaction if you have doubts or questions.
- Enjoyable classes that will help you during your coding journey!


I structure my courses to be beginner friendly; if you have zero... See full profile

Level: Intermediate

Class Ratings

Expectations Met?
    Exceeded!
  • 0%
  • Yes
  • 0%
  • Somewhat
  • 0%
  • Not really
  • 0%

Why Join Skillshare?

Take award-winning Skillshare Original Classes

Each class has short lessons, hands-on projects

Your membership supports Skillshare teachers

Learn From Anywhere

Take classes on the go with the Skillshare app. Stream or download to watch on the plane, the subway, or wherever you learn best.

Transcripts

1. Intro : Hi and welcome to the solidity next step class. I'm David, I'm gonna be your teacher for this class. So this is a SQL to my Solidity basics class. If you haven't watched that one yet, I really recommend to go back and look into their one because in this class we're going to cover many topics, basics that are discussed in the previous class. If you don't have this concept down pretty well, everything is going to sound very confusing and nothing is gonna make sense. So make sure that you go over the basics course first. Now, these is the continuation the course. So once you have the solidity basics down very well, then we can continue on to more complicated and more practical things. In this class, we're going to go over inheritance, which is a very important function that we use coding smart contracts in solidity. And we're gonna go over the ERC20 Standard and the CERC 721 standard as well. So those are the standards for a token and then FTEs. And then at the ends of these lessons, you will already have quartered and deployed your own smart contracts for your own token, as well as the same for lefties. Let's get ready and go down through those. 2. Lesson 1 - Inheritance: Hi and welcome to this first lesson or the solidity next, next step course. As I mentioned in the intro, you really should go through the basic scores first. You have a good understanding of what, what's gonna go on in these lessons. Otherwise you really gonna struggle. So if you didn't already, I will recommend to go back to that. And if you already went through that, welcome back and thank you for joining me again. In this lesson, we're going to talk about inheritance. What is inheritance is a very important capability of solidity. Inheritance is the capacity to transfer functions and variables to derived contracts or four. Now let us say to other contracts, what is our derived contract and how do we use inheritance? So in this picture is just a basic, a basic concept, ordinary tense. We have two contracts. It can be more, but for now, let's just take two contracts. Contract. A contract be defined as parent and child. The documentation calls them base contract and derived contract. The contract is the base contract and contract B is the derived contract. So when we connect them like this, it means that contract B, he narrates all the public and interior variables and functions. Note that the private variables and functions are not in not in airtight. And we're going to briefly, going to mention that a little bit later on. But this is how inheritance worked. In small, in a small function, it can be even very complicated. It can be multiple contracts in everything from one contract and then last contract in Eritrea. And a little bit of all of them. It can be something extremely complicated like this, where there are many, many contracts involved. And so inheritance is a good way to divide the workload and to isolate parts that we want. We want to have inside or not. This is one of the contracts, one of the structures that we're going to practice in this lesson is this one here. We have multiple parents and child relationships, so we'll have one parent contract here, child contract, another child contract, but then this one is also apparent contract for this counter. Today's lesson, we're gonna work on something like this. So let's start coding a little bit here. Let's go up and remix. And by now you should be pretty familiar with how this looks. Let's start writing the first contract, sorry, in these one contract here in this page, we're going to have multiple contracts today. And then we're going to connect them together and to show how inheritance works, let's start coding the first contract with the usual keyword contract, and we'll call this one here first contract. First contract. Like this. And we're going to establish that feel. We're gonna start with a few functions in here. We can see how we can have other concept and everything. Then we also going to introduce some new keywords. Let's start from the first function. We can just call the number one. So we know it's first function though we make here will make this one public sold. The other contracts can access it as well. Pure. Because we are now going to do anything on the blockchain here is just to check how inheritance works. And so everything is gonna be internal. And here's what we're going to introduce a new keyword, keyword virtual. Virtual means that other smart contracts can inherit this function and use it. I'm sorry. Mitochondria can inherit this function and modify it. I will see in a second how we do that. We're gonna return numbers. So we're gonna return a uint8. We can simply return a number. Let's read 100. This is going to be the first function. Then there's this COVID Mike, the same function. Again, we'll just call it number two instead. So we had to function. It has the same attributes, virtual again, because then we can modify it in a smart contract. And let's just change the number 200 for example, like this. Now, these two functions can be inherited by another contract and modified it. Let's see how we can do that. Or rather let's first test this contract to make sure that it works fine. So by now you should be familiar with these two. Lines up here, so we're using the version between 69. Let's try to compile it, Control S, compiled it correctly. If we go and deployed on our own JavaScript to machine, will have first contract here. Deployed. Here we go, we have our two functions. Number one that has 100, number two that has 200, and that's it. Now, let's write a second contract and see how we can inherit those functions. So we'll write another contract then remember that inside the same page you can have multiple counts. How many contrasts you want. So let's write the second one and we'll call it a second contract. Second contrast. Here we're going to introduce a new keyword. Again. We introduce a keyword eats. So the keyword is, it's how we actually create the connection between the two contracts. So we can write second contract. First contract. This is the keyword, that connection. So let's put it here. The column contracts. Here this keyword is, is how we connect the two contrasts are now these second contract is going to happen narrated these two functions. So to test this, let's show it like this. Right now we're not writing a new function in the new variable inside this contract. But if we go and deploy, so let's first compile it Control S. Then if we go and deploy, let's make sure that we check because now we have two contracts in here so we can switch them. Let's make sure we deploy. The second contract will deploy. If we looking at we have the two functions that we can access them. No problem. One hundred and two hundred. This is the very basic example that shows how inheritance works. We have one contract here. The has nothing in it. What we can use the functions in here. Now let's see how we can take this functions and modify them. From the first contract. Solving, write the function. To do this, to actually modified and override. The function must have the same name of the functions in the first contract. We'll call this one here number one again. And it's going to have the same attributes, public, pure. And then we'll call it will make a virtual. Again. We're going to, we can create a third contrast and we can show how that works. So here to remember is to allow us another contract to inherit this function and modified. But we said that we wanted to modify the function in the first contract. So here we have a new keyword override. The keyword override is what actually modifies the function. Without this one, we're not gonna be allowed to modify what numbers is return. And then we're gonna return the number again. We'll return a uint8. This time. We will return the first one was 100 in the second row will return 150. Then if we copy the second function again, we tried to modify this one as well. We have number two, which is okay because remember it must be the same name. We're going to have to add the keyword override. Then we can modify the number here, 250 for example. So now let's try to compile it, Control S and it compiles correctly. And effectively once we deploy with the second smart contract, will be able to call the same function. But instead of being returned in 100 is going to return 150 because we've modified it. Now if we remove the override keyword like this, and I try to compile it. It's going to give an error, say it's not compiling it because it's, Hey, you are trying to change something. Are you missing the keyword override? Let's put it back. Let me spend and things today over right? Now, compile correctly. So now if we go back and redeploy again the second contract, then if we call number one, now we receive 150 because we modified it. If we call number to 250, because again we're modified. Now, what if we want to call the first function here number one? But without being modified because at this moment here, we cannot do that because we changed it. So how can we call it again? We'll use the keyword. When there is a way to do it and we had to create a function for that. In this function we're going to add a new keyword, super, super keyword. And these allow us to call a function that called the original functions basically from a previous contract. Let's create a function. We can name access one because we want to access that first number one function. Now, this is going to be a little bit more straightforward. We're not modifying anything here, so we can just do it. Public. Pure. N is going to return a uint8 again, because remember this function here returns a uint8. Then what's going to be actually return here will be a return super dot and the name of the function. So number one in this case, because that's what we want to return this super keyword, saying, take the original function in the first contract and return me whatever is in there. If we test it, we can kill these control is to control if it works, compile correctly. If we go back and deploy the second count of three, again, successful. Now we're going to have access one. If we tried to access just numbered one, it's returning 150 because it's been modified from this one here. And the now if I click on Access one, then is going to be returning 100 because it is returned in this first one here. These are very basic way of how this, in Erikson's work, religious wanted to show this way to be able to explain the concept and to explain this virtual keyword. So remember today we have these few new keywords, virtual, that is allowing us to modify this function from another contract. Then we have the keyword override that actually modifies the function. Now, let's create a third contract. And they'll want to show you one more thing. Let's create a third contract here. Show you the power of inheritance. We have a contract called third contract. Contract. This contract is going to inherit. Only the second contract will be third contract is second contract. Like this. Now we're gonna leave this empty, right? No code in here. But because of how inheritance works, we can access all of the functions. All of them because this third contract here, even though it's empty, is inheriting second contract, which is inheriting first contract. If we go back here and deploy in the second contract here, I'm sorry, wrong one, we have two, we have three contracts now. And I did a comparator or control S. We will deploy third contract. Here we have it. And now we can access all the functions. We have number one, which is going to give us 150 for number 2100 if we access that first one there. Now, for example, we could write, we could write an extra function here, number one in the first contract. So I can briefly explain how the logic behind the inheritance work with solid. Let's go function and we call it number three. For example. This one is also going to be public inside the parameters public pure. And we return us, let's return a string and this one here, return a string. Remember that whenever we pass a string or we take a string, we have to liquid the memory type. This will be memory will just return. We said that we return a string which has written a sentence. And I'm gonna sprite. In the first contract, in the first column. Here. Now let's kill the old one. Compile it. We already twice the third row. Now let's briefly go over these functions. Let's see the logic deployed. These last contract here. Third contract that has no code inside, but we are inheriting second contract. Then for the second contract, we are inheriting wherever it is in first contract. So what is the logic? That is the solid the users here. Now, if I try to call function number one, which gives me 152nd contrast validity goes in here, I call it goes in here, so okay, it's not in third contract, will go here in second contract and let's check if it's in there. I was like, Oh, it's in here. Very well. And it stops at the first one that finds its gonna do the same thing for number two, because it's in the same contract for access one as well, because it goes here. Not in the third contract. Let's check in a second one. Let's go for number three. Now if we call it, it tells us all I am in the first contract so it finds a correctly, how does it do that? Solidity does is that it takes the list of the reneritchie inherited contracts and goes from right to left and checks into them. And then it goes, whenever it finds the first one, it goes by that. In this case, we tried to access number three. It looks in third contrast at all is now here. Let's go check in second contract. Second contract is here. He's not here. Go check-in. First contract, here it is, and then it can call it. This is kind of the logic behind inheritance. As we can see in that picture. In this picture, it can become very, very complicated. It's good that we take it slow and understand the logic behind it. Now, I'm going to stop this lesson here. And in the next lesson we're going to go a little bit more over inheritance, where we're going to see a little bit more multilevel inheritance where we're basically going to create something like this. Where are we going to create one controller base contract then is going to be inherited by other two different contracts. And then we're going to write a last contract that is only going to inherit one of them. Stay tuned for the next lesson and luck. 3. Lesson 2 - Linearization: Hello everyone and welcome to this next, next lesson, solidity, next steps. In the previous lesson, we covered inheritance, which is the function. It's not a function, but it is the capability of a contract to he narrowed it and be able to use functions and variables from previous contracts. Today is gonna be slightly shorter lesson, but I want to cover a part, something that is part of a narrative densities, the linearization. When you have multiple contracts, all inheriting functions and variables from previous contract, you will have to state them in a specific order. And we're going to cover what is order is. I wanted to make a specific lesson about it because I think it can be pretty confusing. We're going to build from the previous contract that we already wrote. They never tends to one from the last lesson, we're just going to add a couple of things and we're just going to go a little bit deeper into the inheritance. Think the last time we ended up with these three contrasts. The third country that we made, we just left it empty because it was already getting all the functions and everything from the previous contracts. Now I want to show what the linearization mean. Let's say, let's just make a modification to this second contract. We're going to add another function here. We can call letters. Let's add a function of a cold letters. This function is gonna be pretty similar to all the previous one. I just gonna return a string that's gonna be public. Pure. We can call it. We can call the returns. Because it's gonna return a string in this case, is simply going to return strings saying, I am only in the second contract. And yes, so now we have this actual, these extra functions. So I might read this way because I wanted to have a function that it was only available in this second contract. Now, what we can do with this third contract, let's say that. Let's say that we want to have, actually I forgot here. This one here wants to be virtual as well, so we can modify it in the second contract. Now, let's say that we want to have access to both. The second contract and thirst contracts are, I know that it is not useful or practical in this example, it doesn't do anything we could say. We could already actually roadway, but I want to, I want to demonstrate the linearization. So let's hit it from this third contract. We want in eric functions from both. First, second contract. Let's say that the second contract here Does any narrating anymore. We will have to modify a whole bunch of stuff. But for now, let's just really like that. How can we make this third contrary inherit everything from the first and the second one? We will have to make. We already know from the second contract here, the third contract is second contract. But I can't just add the first contract here in a random order. Because otherwise it's going to, the compiler's going to give an error. If I, if I now try to compile it, it's going to give an arrow here. This error is not the arrow that I expected. Forgot a semicolon on this. But now we get the actual error. Here. It says linearization of inheritance in our second graph is impossible. And that's because this is because of how Solidity looks at the inheritance of contracts. So what does documentation sizes that the linearization is from the most base like to the most derived. This means that when we list them, we have to list the contracts in an order that goes from the most basic to the most arrive figure. Look at this hour at our picture here about inheritance. And we have the graph there shows the base contracts. And this is pretty much a structured that we have now. Where we have the first contract, then the second contract inherits from the first contract. The third contract we want to make it in a way that in ears for both. If we look at this one is the first 1, second, third 1. We had to list these two in the inheritance. Which one is the most basic? The most basic light is the one that he narrates, the less. Now we're okay is the most base like it's going to be the contract number one. And the more than most, the right is going to be number two. We're gonna have to list them in this order. First contract and then second contract. If we will look in here, we will just have to invert inverted two of them. And we'll pull first contract and then the second contour. Now if we compile issue work, the contract works. But there is something else. Because I forgot to put my more here. Remember that every time they use strings somewhere, you have to put the memory. Now Control S to compile that. Go wrong this time. There's always stuff. What did I mess up here? I think it's just because we didn't pull the functions in yet, so we have to place the functions in there to make it work. So let's go take the actual functions that we're going to want to pass an override. So we'll do we'll take number one and number two that are in both contracts that we want to inherit. And let's fix this. Now because we are inheriting from two different contracts in here, we're going to have to add that extra, extra, extra information. We hope override because the idea is that we want to replace this function. So the form 15200 we want to replace it with, I don't know if five hundred six hundred, just like we did with that. But because we're inheriting from two different contrasts, we're going to have to specify which contracts we are getting after the override. Then we're going to have to specify first contract and second contract in this case, the order and this one here, it doesn't matter, exist. Way to say, Hey, you are inheriting these functions from these contracts. That's how solid they want setting frequent pilot. Now it works. Sorry about that, I forgot that step. So this is what I wanted to show about the linearization. Okay, now that we've compiled it, if we want, we can test it out just to make sure that it does what we meant. But since it compile correctly should, there isn't really any specific logic in here. So we're going to go compile the third contract on our a virtual machine. Deploy. You can see we have everything available. We can access the original first first function. We can access this letter function that is only the second contract, free call. Number one and number two. Those are gonna be the overwritten, sorry, the number one, Number two, the zoom a bit overridden ones. The number three is going to be that person only in the first contract. This was a little bit shorter video button linearization. And then every tenses just wanted to, I wanted to make sure that I will go step-by-step and not make it to extra complicated because it can be pretty confusing, especially when you start getting many different contracts. They talked together. That's what we're going to see in the next, in the next video. In the next video is going to be pretty cool. Actually, we're going to explore the ERC20 Standard And we're gonna, we're gonna be making our own ERC-20 token and we're going to deploy it on an actual blockchain. Obviously is gonna be the test net. So there is no real fees, fees involved. But I'll show you how we can make our own token and then deployed are now on a test that we can deploy it in. The theorem test net on the button as Manchu intestine that we like. Everything from here, from remix. I'll see you in the next video. 4. OPTIONAL - Set up a Testnet on MM: Hi, this is gonna be a very shortlist. I'm just talking about how to set up the test neck on a MetaMask so we can we can use it to work through the next contract for this, for testing our contract that we're going to make in the next lessons, we're going to use the smart train test net. We can basically try to test our contracts on the BSC using B&B, testing a B&B and so on. You can really do this in any test net. There is future for avalanche, there is a rink before Ethereum. You can do these in any testlet chain I'm just going to use by finances and example, if we go on the website here, the ox, the abundance at orals, we can find the guides for maintenance, test notes and everything. And I say income. I'm going to leave all these links in one of the notes down so you can see them. If we go on the chain test, neither are you going to have a bunch of information. The first thing that we're gonna need is how to, how to get the test net tokens. Because we're going to need those. If we go on BSC developers, we're going to find a faucet. If we scroll down, we'll have B&B developers tested. False it. If we click on facet. Now we can, we can go on and our mathematics get the address that we want. We need to use here, as you can see here, I already have set it up and I already have some testing and B&B, we'll just copy the address. Kristi, here. You go here and do give me BNB and you can get up to one B&B per day. Here's accepted, funded. So if I go check on my how my mask here going to say 2.2 B&B. There's going to be plenty enough to test our smart contract. Now, if you don't have the test net already set up in mathematics, how you can do it is there forever for bindings, you can go in the academy minus Academy and it's gonna have a nice article with the numbers. So this one here is Academy of bindings.com. Really, the idea is you just go on Google and type binding or BSC test net mathematics score. Few avalanche refugee MetaMask in mathematics and so on. And so you're gonna give it a data for minus mark chain. If we scroll down Walter, all the instructions how to do it. Here's gonna give you the number minus and test net. These are the coordinates basically that my thumb must has to access the test net for the main or in the case. So to add it, you'll just go on your mathematics. Here loads, okay? If you go here on your accounts, there are the settings networks. And then here it's going to have all the networks that you already have available. You can just add a network. Now you can just copy and paste here the name they, RPC, the chain ID and everything. Copy paste, Save. And now you'll have the test and available. Then you can just switch it just as you regularly do from your mathematics, from up here, CRM origin, the testlet, But then I could switch on a theorem mine at future tests net for avalanche, regular BSC. Those here all ring me erupts then Coburn I believe as well, they're all tests and for Ethereum network, just do it and now you're ready to have a test and now you're on your mathematics so we can use it to try our contract. So next lesson is going to be about the ERC-20 tokens. So we are actually going to take the ERC20 Standard and deploy an actual token on an actual blockchain is going to be the test net, but steel is the actual chain and you can see how we can interact with it. See you next time. 5. Lesson 3 - ERC20 Token: Hi and welcome to the lesson where we're going to finally explore a real smart contrast. Today we are going to go and check our ERC-20 standards. So we're basically going to create a token that we're going to actually deploy on a blockchain and we can see how it works. First, let me introduce you to a good service and I servicing these interests, they open Zeplin. You can find this documentation adopts that open zeppelin.com. And so what they do is that they give you access to pre-made smart contracts. The good thing of that is that these smart contracts are tested so we know they work, they operated and they are kept, kept up to date and they're safe. In this environment. That doesn't really make sense to rewrite constantly the same thing over and over. For example, ERC-20 is the standard for tokens on Ethereum Virtual Machine blockchain like Ethereum minus Mar chain, avalanche and so on. That means that the tokens are always basically the same contract. There will be no point in writing hundreds of lines of code every time. So that's why services I open Zeplin a very good. So how this is gonna work is we're going to go check the contracts and opens effort in here. And it gives you a pretty good overview of everything that I have available. The heavier C2H4 tokens here, C7, 21 for FTEs and so on. What we're going to focus in this, in this course is going to be here. So 24 tokens and you see 721 for today, we'll go over the tokens. If you look over a near system, sorry, your C2. And then they're gonna give you a pretty good description of how the contract works and everything. I will recommend to go through those and see how it works. Now. To actually use the contrast, what we can do, we're gonna go on their GitHub. Appear. Then you see that you have a whole bunch of stuff available. So if you go on open separately in contracts, we're going to find all the contrasts that have available basically will do contracts. We've gone tokens. And here we have all the different standards. So if you go on ERC-20, then we have our ERC $20 salt file. If we open this one, here it is. This pretty much code for the ERC-20 token. If you look at the top, you'll see that this one is done in the last version of solidity. That's why I say that following a service ideas is very good because they give you always the most up-to-date code. As you can see at the very top before starting the contract here, they import our contracts. So they import is ERC-20, the IRC 20 method data in context. So this import statement basically is just to say, say Hey, take this contract and putting this page, it will be the exact same. If you go here, copy all the code, and then paste it in this page. Now, this is just a little bit more efficient way because then we don't have to have all these code written. But basically what do you want to do is that you would just want to copy the contract. Doesn't copy it for some reason from there. What we want to do, we're going to copy the code. Or you go all the way to the end. We take it from here. All the way up carpet. We go on our remix IDE where I have an ERC-20 dot saw contract that I started, paste it. Now we have a contrast. Now. These are base contracts, so it's not really going to get is not going to work quite as well for what we want to do right now is not gonna work at all, for example, because it's input statement not connected to anything. They give you the names of what you want to use, but they're not connected. If we tried to compile it, I press it to compile, it's not gonna work. And it's because of those. But they tell us which ones we want. We want to import the eye ERC-20, the metadata and the context. So let's go look at what these are. Let's go back to their GitHub. If we go ERC-20 folder here, we'll have right here we have the ERC 20 dot. So this is the other contract that we import. We don't have to copy and paste all these texts because we're just going to import the code directly from GitHub. But if we look through it, you should start thing to understand as you start to understand what, what's going on in this country. For example, here we are importing the events. So for example, they transfer, approve, call, other functions. We are going to receive events, we're going to emit events. So we could have another platform listening for those events to check when addresses are sending, transferring tokens and so on. It has the actual functions to find the balance of, of an address to transfer and so on. Once and all these things. This just gives us some added functionality. So what we do, we copy the link control C. Come up here. We'll just paste it in this input stuff here. The first one is good. Now we need the ERC-20 metadata dot soul, and this is gonna be in the extensions. We'll go back up here. If you go into extensions, we want to find a mate and some of them here, here. Now this contract, for example, is the contract that holds the name and symbol in the decimals. That's really just what this does. And that's how we're able to set it. Again. We take the link pasted here until this hotter input statement. Then we need the context. The context is an interesting one. Here. C is in utils. Utils and contexts here should be there. Where did they go? I see what I've done wrong here. Sorry about that. This one is done in the token one. Contracts back from the beginning. It's not gonna be in token, this is just gonna be in contracts. Utils wasn't looking in the wrong utils. Sorry about that. Here we have contexts. Contexts. Does this one does an interesting thing because if you look through it, shows the d create a function for message sender and a function for message data. So this is because solidity is always evolving. It's always evolving language. In case one day this message and send a message, data. Functions or definitions are gonna change. Then if you use this function instead of using this keyword directly, you're only going to change the name of the function instead of the whole thing. This is really the idea behind that. Copy this link and paste it here as well. Now, we have all the inputs correct, correctly. Now, basically we have a function in ERC-20, smart contract congratulation you have, you can deploy your token. All of us. Let's just do a quick test. If we tried to compile it, everything should work. Indeed, a composite is fine. But it doesn't quite do what we want. So let's explore it for a moment. If we look in the beginning here, well, after the input segment, there is a bunch of nodes. Those are very good because this is all, these all open source. So they give you the instructions and everything. Now in the beginning you should see something you know by now you're familiar with. These are all variables. The first one here that we have the contract, right, is ERC-20. And as you can see, this is just how we saw in the previous few videos, inheritance. These contract is inheriting functions and variables from contexts IRC 20th and the metadata. That's why we are important then, because then we can, we can inherit their functions. Otherwise we will have to write the whole contract in here. And then the first mapping that we have here is the balances mapping. Just like we did in the first course, the solidity basics, we have a mapping that associates an address with the amount of tokens so that we can record the balance, then allowances. It's the same thing as a mapping with an address, connect into a mapping of again, addresses and numbers. Now, allowances is, let's go down and outflow because this one is a new thing. So if you're familiar we using here it is allowance and approve. If you're familiar with using any decentralized application or just making slops on decentralized exchanges. You've noticed that when you have to interact with them, for example, when you want to swap, I don't know B&B for a token, let's say you want to solve B&B for the cake token. The first time that you're gonna do that with a wallet, you're gonna have to approve the token. That's what this is. This is what the proof function is. This is the function that basically is called and say, hey, these address is approving this token. And that's to give access, basically to give the smart contract from the decentralized change access to the token that you have in your wallet. That's the approval part. And this connected to the allowance. The allowance is how many tokens you allow this smart contract touch. Let's say that you approve the, let's say you have ten cake token and you want to swap them to B&B. You basically want to sell them and swap. That's what would you do it the first time you approve the smart contract of the exchange to touch the tokens, and then you allow it to use the tokens, let's say all ten of them. That's what it has allowed. So this is what is approved and allowances. And the same thing for decentralized applications. That whenever you're using them, you're like, oh, you have to approve us to touch your tokens person. That's what's happening. Let's go back to the beginning. There was that part and then we have the usual, more regular variables, the total supply name symbol, and then a constructor. When a contract is created, we are constructing the contract with the name and the symbol. That's how you do it, right? When you would see when we deploy, deploy with a name and symbol that we choose. And that's how it works. And then you'll have the other functions and these are all public. So these are all functions that we can call virtual n override. So if we create another contract, we can also change them. Now this one here is just going to return the name. This one is going to show you the symbol. Cannot show how many decimals. We have. Usually ERC-20 tokens have a standard of 18 decimals. And we'll see with the point what that means. We can change it. But usually it's better because it's more precise for the computer systems. Do we have the function to call back the total supply, find the balances on address. And just how we did in the first course, actually all these things, right? The function to transfer the allowance in the proof, we just talked about them. And then we can transfer from two water addresses, the reckless to increase and decrease allowance. Those are for the lemmas that we mentioned before when you approve the token, that you can increase or decrease the alarm. So let's say you have a 100 tokens available, but you only want the contract to touch ten, then you will approve it and then decrease the allowance from all of them to ten. There are transferred things. These two, these two are interesting ones that we're going to check during our process. Here's the main function. Means that we can have a way to create and destroy from the burn function. With a mean function, we can create new tokens when the burn function, we can destroy them and reduce the total supply. Now if you notice these two functions are internal, means that this can be called from, From a contract, from a contract inside these on all from underwrite contract, right? So this is gonna be one of the interesting that we're gonna see in a second. Then we have the ****** stuff down here. These are the important things. Now, let's try to deploy this contract and see why we need to do some modifications. Technically, these will be fine contract. We already compiling, compile again to be sure, let's try to deploy for now. We'll deploy it in on the virtual machine here. And if you look here in the ploy, now we have the name and the symbol because of the constructor. Let's deploy, we'll call it token. Token and the symbol is t KN. So if we transact, create this more contrast. Sweet time here. Interesting. Well, it looks like it took in any way from memory, but I'm not quite sure why is too slow, I guess. Anyway, deployed. And now we can see we have all the functions of variables available here from this contract, n from the contracts that we are inheriting. If we try to call name, you can see we'll have the name token. Our symbol is Kn. This is what I was mentioning the beginning that we're going to have to make modifications because this token, this country hears been deployed and the token has been created, but not total supply. That's the standard has no to those supply. And we saw we had a mean function, but it's internal. We will need to create another control for that. So right now we just deployed a contract of a token that has a name and a single bond. There is no way for us to create a supply. How do we fix that? Well, we're going to have to make a few modifications, so we have a few different ways to do it. Let's start from the first way where we kind of a hard code. We can now call the total supply. We can see here, we already have the total supply variable. Nobody is using it. How can we do it? We can add it in a constructor. Here were the reason the name and the symbol. We just start the total supply as well. Here we'll just do a comma and then you went and we'll add the total supply will pass through an extra number in here. Here, after name, after name and symbol. We're just going to add the total supply. Here. We already have a total supply variable. Will just have that one. Total supply. Supply with the underscore, which is the variable, the width pass through the constructor. One thing that I want to remember, so I'm going to put a note here. Is that the standard is 18 decimals, right? This means that to have the courage to read in the correct way. So for the Meta mask and all that application to read you the current way, it has to have 18 zeros after the number that we use. So I'm just going to type 180 here to have our, our base. These are zeros. Now, these countries allows us to actually create a total supply as well, so that we can actually have tokens to transfer and to use from the beginning. Let's try two. It again, Control S to compile. It looks like I always forget the semicolon. Let's try to compile it again. This time. This time it compiles correctly. If we go back here, this one is the ERC 20. So if we compile our ERC 20 contract, you will see it. And now we have the total supply as well. So we can, we can deploy it again. It's called token again, take AN and now we can add a supply. Let's say we want to add, we want to have one hundred, ten hundred tokens available as a source of supply. So if we only write it like this, now what we will have 1000, not one hundred, ten hundred tokens. For that. We're going to have the 1800s animals after. That's why I wrote this one here so I can just copy the zeros and attach them here. These humongous number. Now it means we have 1000 tokens. If we make a transaction, transaction to create the contract. Again, I'm not sure why so slow here. We have the contrary created. If we go check now we have the total supply as well that we can call. And we have all these numbers here. The name and target. That's it. So now we have a contrast deployed that has an actual supply, and now we can do things with it. We can transfer tokens, for example, from these, while these all these tokens have been created on actually the construct or I forgot something. All these tokens have been created, but they're pretty much narrower because we didn't assign them anywhere. We have to assign these tokens sought to some address to be able to send them. What we want to do is here after the total supply, we want to also add the tokens to a balanced. And so we can just do it. We can just add it to the balance of the message sender, which in this case will be the owner even if it's not specified. We can just remember we have the mappings here of the balance with the iris and the amounts will do the balance of the message sender is equal to total supply. Semicolon Control S to compile. It worked. So let's destroy this country and let's create it again. And we'll do the 10000. We'd all the zeros again. The contract went through fine. Now again, we have all sorts of supply symbol and name. But now we're going to have this 1 thousand tokens available in disasters. So if we copy the address, we go to balance off to paste the others in here. We have all the coins in here. If we want, we can send them to another address. So we can take this second address here where we says transfer. We can do transfer to this address and name overhead to switch back to their account or it was not gonna work. Then let's say we want to send 100 targets. So we'll type in 100 plus the eight in decimal. So we have here. Here we go. Now if we go take these address, these are the source has some tokens in it. These are very basic way right? Now let's try to deploy it on the actual blockchain we met them are so we can see how it works through that. We can destroy this one here. To deploy it on the actual blockchain where we want to go in our MetaMask and make sure that we have the right account, right network. If you already have a son, I'm going to use the BSC testlet if you already have some testing and B&B is good. Otherwise, if you've watched the previous video, is going to explain you how to set up the test. And I had to get some testing and B&B, the fear right here. So how do we do this? One is a hearing environment. We're going to switch from the virtual machine to inject a Web three, this one here. Now you can see the network highlights here and custom 97 network. This is a bonus test mid 1970s, the idea of the chain. If we look in our account, we only have one. It has these many. It says ether, but it's B&B. Now we can deploy this contract again. And this one is gonna be deployed on the binary smart chain tests that we can just leave the same data here under deploy name, symbol, and total supplied. But now when we do transact these, actually going to pull up our metal masks and say, Hey, do you want to deploy this contract deployment from our account to a contract? Here's how many B&B we're going to spend for that. We do, confirms. And here it says, the creation of the contract is spending is created. Now we can interact from this contract, from this contract from here, where we can always use, we can call again the total supply, the symbol and the name. But then we can also go check it on the actual test net block explorer. If we take the transaction ash, then we go on. To find the chain Explorer here, we'll just test DSE tests that we can find here. Block blockchain explorer testlet. Now if we paste our transaction hash here, is going to show all the data they usually shows undoes the contract creation, right? So I'm going to show that he has been sent from our address. This is the smart contract that we created. We actually create a smart contract which is on unders frequent check here. Says these are the data hub hour or smart contract. Pretty good. Again, right now we don't really have anything. The contrary here is encoded because we didn't verify or publish it, which is something that we could do. We're now going to run now, let's see how we interact with it. Now we can't interact directly from here because it's not published. But we can interrupt from remix. We said that we had all these tokens, right? Let's try to send them to another address. I'm going to take one other others that are heavier in my mathematics. For example, this one here. I'll copy it and paste it in. Transfer. Now I can transfer some token from the others has been deployed the contract. These are the routers. Let's say we have 1000 token itself we want to send to hundreds of these accounts, will have to send 200 plus. The 1800s. If we do transact, MetaMask shows up again and asked us to allow their transaction. You can see here when we are transferring 200 and TPN, that's because of the 1800s. There are free, we're not pulling the 1880s that it will be as much smaller number, right? So we can confirm those transactions successful. So now if we go here and we refresh the browser where the contract is, always hit a transaction in here. We can see that it was 200 t KN sent from our address to this other new address. And this new address. Now we can see now we can see or witness second one is the wrong one. We can see that we had the total supply. We have only two addresses are holding the token, the decimals and everything we can see everything is pretty cool and this is how an actual token works. And so we just made a contract that allowed us to launch our token. Now, we mentioned this is a hard now, this one has a hard total supply. How can we modify that? We saw that we have the mint and the burn function somewhere down here and those meet and learn here. So I'm just going to destroy the country from here. We have mean and burn. How do we access those two? Now we can create new contract. Here's where all the inheritance and things that we looked in the previous counter in the previous videos are gonna come into play. Now we're going to create a contract that allow us to meet this token here that we created. How do we want to create? Will create a contrast. Let's, let's call it token. Token. This is going to allow us to mean token. Now, we want to import non-important, we want to inherit the functions from these contracts. So we're gonna have two domains. Token is ERC-20. We can inherit all these functions. Now. We can now use the function to create and burn tokens. But we want to put some fail-safe. We want to make sure that only the contrast, the owner of the contract can do this because otherwise it wouldn't make sense. Anyone could just go there and create their own tokens, right? Remember how we do this from the first course, we will create an address variable. We can call owner. Then we're going to add all these information in the constructor of this contract. At the end we're going to deploy only this last controversies mean trouble, token contract and everything else is gonna come, but it will create a constructor. Cones. Way to create, to put up the name and initial total supply is gonna be slightly different than before. We're gonna have to specify where these information are. So we're going to do ERC 20. And then here we're gonna already call it the name and the name the same, both the initial total supply, the name we can call it again token. Actually do something better, a little more, a creative, let's call it better. You do better dollar. I will call it a better dollar. Then the symbol is just going to be taller. And let's do the, the initial total supply is 1000 tokens. This is gonna be a uint8. So we're not gonna do that. We do 1000. And then let's go take the 18 zeros that I had here and the big anywhere those zeros. Because remember that's our total supply. The 18 zeros over here, right? Now, our constructor is just going to build it when we deploy. And then very simple, we're just going to associate the message center to the owner variable. Here, owner equals my city center dot sender. Now whenever the contract is deployed, we already gonna have our owner associated. Only the owner is going to be able to call this the next function that we write. Then we said we wanted to write. We wanted to have the means to them burn function so we can increase and decrease supply, will just create the function we can call a mint. Going to take two parameters, right? It's gonna take address. This function is actually very similar to number. It's very similar to that coin mentor contract that we wrote in the first, in the first course address, we can call it account. Then it's going to take our u int, which is amount. And this is gonna be the amount that we want to create or destroy. This function here is this is gonna be public, so we can call it. Here we go. Now, the first that we want to do, we want to make, we're gonna put our require condition, right? So only the owner can do it. We could do with a modifier if you want to have many functions that these were in this schedule only have two, sorry, It's okay if you do it like this. So we'll do message sender must be equal to honor. So equal, equal. Like this. Then we can make, we can write the error messages and say only the owner can meet the owner. Then from after that one is verified and we call them function from the previous contracts. And we're going to pass the account and the mass. Just like that. The first function is done. This is the function to mint. If we create the function to burn is actually going to be the same. We can call, we can call it the same or copy paste here we'll just call it a burn function. Here. Instead of calling the main function from the ERC-20 contract, we'll call the boot function. We just gonna pass the same extra parameters. We're gonna pass the account and the amount. Now just to show what's happening here, see that we're calling this function underscore maintenance core burn. If you go check in the ERC-20 token contract. Here we have it underscore burn and it accepts an account and an amount. Here. Same thing. Accept the same thing isn't then it does their own other thing. That's what it does. Very good. Now we can try to deploy. If you do Control S. I did something wrong here. Obviously. What did I do wrong? Road construction instead of constructor should work Control S. I did something wrong stuff. We didn't put the semicolon here, and these are always good. Control S. All right, now I worked. Let's try to first deployed in the virtual machine. We are going to deploy not the ERC-20 contract and birth. We are going to point me in trouble token, this one here, you'll see that there was a ploy, doesn't take anything because everything is already coded in here, then we make the transaction. Let's go look it up. If we look into it, we have all the previous things, but we also have mean sunburn. Looking in here, we have total supply. The symbol is the name is better dollar. Now if we take the address and we will check the balance of the address, would have all these bonds here, but we can increase it in decreasing. Let's say that we want to add another 1000 token. So we're gonna go here mint. We're going to paste the address again. So we're going to add, we can actually meet this token to other addresses as well. So let's, let's try to do that. We want to have these arteries have a bunch of tokens, so we'll copy this, paste it here. We add our 1000 and talking with zeros, and that's just the same as the supply. So let's do there. Remember that we had to switch account that there wasn't going to work. Actually, we can use it as an example. Let's add a desirous. Once a mint thousand token for themselves, we made a transaction and it's gonna fail. And it says, hey, only the owner can meant, whoops, I tried, didn't work. Now if we go from the owner account, we started transaction that now that's going to work. These address here. Now it also has a balance of 1 thousand tokens. Just say that. Let's say that we want to destroy all the tokens. We don't like the token that supply anymore. Instead of mint. Then we will say, let's take the tokens from this amount. This accountants destroy them. Remember, each account only has 10000. Now we pulled all the tokens that we want to destroy it from this account, the transaction. Then we're gonna go see that these account doesn't have anymore tokens. The total supply, steel thousand. If we remove all the token from the other account as well. Let's copy this account. Have to switch back to the owner. Transaction. Burn amount exceeds the balance. Did we do we do before we already destroyed the tokens from the accounts, we have to do it to the other account. Transaction ran out of gas. Going on. There's a problem, there's probably some other problem to remove 0. Alright, now we tried to destroy, were probably trying to destroy too many tokens there. You can see then we destroy that part there. Very good. Then if we want to actually test this on the inject the Web three weekend, switch to inject a Web three and redeploy it on the actual test. Alright, deploys and let's go check it on the, on the website here we'll copy the hash. All right, Here it is. It's being created. The contract that has been created from this address. Now, we have the contract. Let's try to do the same. We'll create some more. Let's send some tokens. We can take. 500 tokens and send them to the other address just like we did before. This is the same otters that I used before. I will transfer it to them. They address here, and we'll transfer 500th tokens plus the 1800s. Here we're gonna have to say make all the zeros except for the last 1 thousand dose should be 18 zeros transaction. So if you're works, yes, we are trying to transfer 500 tokens. Just like that. Now let's go check. Transaction happened here. Yes, they worked, received the transaction. Now let's check the token here. Here it is, it transferred the 500 better doll. And if we go in here, now we can see that the total supply is 100000. We have two addresses have been transferred one time. Now let's try to increase or decrease in supply. We are using the right accounts. So let's try to create some more tokens. If we increase the supply. Whereas maintenance, admit this one. Let's send ourselves some more tokens. Let's create another thousand tokens like we did before. Here we're calling the main function. We'll approve it was verified. Let's go back into the contract. Better token, here's the contract. Now we have meant free go check. Look at this. Now we have 2 thousand sockets. We could do the same thing with the burn, so we can reduce the supply. Now usually you can access this type of contrasts from the website here as well. For example, if you go on pancake swap on the pancake swapped page and you can go on contract and you can access the functions. Here. We can't. What do you have to do for that? You have to verify the source code of the contract. What we can do is we can just click where they were telling us to verify. Here, take the address. We can go and see, well, recompile it in solidity. We use the last version. We have an open source license. So if we continue, then we're just gonna have to paste basically the source code. So here we go, Come here. We take our source code technically, should be fine. I'm just going to take everything. We take the source code and copy it and paste it in here. Let's see if this works like this. I think it would be cool the IBI. So we have to take the IBI of our contract here. We shall have some more information on computation details and we can copy the RBI. Here we have the ABI. So let's see if now it should work. I guess it doesn't it doesn't do it at the moment because of his just a test and and and some time it doesn't work. I did the same thing a few hours ago and it was working fine. Well, anyway, this will be just a way to verify it in publishing like it would be in real smart contractor, then you could actually access it in the record from there. So the only thing that will be differences that you could access all the functions directly from there. Anyway, this was a kind of a longer lesson, but it's really important to understand the basics, right? So this is just a, the base contract for a token, the ERC20 Standard. We saw how we can import it from open Zeplin. How we can modify it to work with a total supply and how we can actually create new contract. They use the same functions to burn and means and transfer and do all these different things. Well, I hope you enjoyed this lesson and the next one is gonna be the last in this course. It's gonna be something very similar about, about the C7 21. So the next one, we basically going to create an NFT, like we created the token today. Thank you. 6. Lesson 4 - ERC 721 Token: Hi and welcome to the last lesson in this next steps course. We're gonna do something pretty similar to the previous video where we went through ERC-20 token contract. But with the ERC 2721, which is for an FTEs, just starts from opened zipper in documentation just the last time because it's the same principle they have pretty good documentation, is just gonna be slightly different. So the last time we went on the ERC20, nice time. We'll go onto our C7 to T1 here. Just like last time, we're going to find a pretty nice explanation about different functions and everything. So I will really recommend go through this to have a better idea. But instead of going directly to their GitHub this time, we're going to copy this code here. Because this is, this is kind of the interface we can say that we're gonna use to interact with our with the 721 standard. Thanks. What's the difference between your C120 in 721? So while your C120 is a fungible token is a token that you can use to do something like exchange for a value. While ERC seventh 21 is defined as unknown fungible target. The main difference is that your C7 T12 one token is unique. Once it's created, it's gonna have an ID, just as you can see here, that it has these variable token IDs. That's the main difference. Each time that our ERC 721 is mental. It's going to have a unique ID and that cannot be changed. So if I own number one, then if I means a different one is gonna be number two and so on and so on. Let's see how this works. Let's copy this code here. We can copy it from up here or we can just selected from here. We can cope it, will paste it in remix where I have this ERC 721 volt solve file. Now, we're going to have to do something similar to the last time to import these. Import, these are contracts from GitHub. From the documentation we can just go on GitHub. Go home the contracts, contracts, and let's see where these are. The first one is going to be an ERC seventh, 21 years to 751 volt source. So we can go look it up quickly. Here, C7, 21 years, 751 of those salts. So if we look through this, you'll see that now this one here is important. A whole bunch of other documents, contracts. And if we go through those quickly, we can see that this is fully domain structure. It has its stores, the name and the symbol. It has the owner, Odysseys, balances, approvals and so on. So this one is kind of like the skeleton. That's what this one does. So we can just copy the link from this one. Go change it. In this first slide. Just like that. The second one that we want to use is this one here, 731751 storage. This one is going to be in the extensions. We go on stanchions. Your eye storage. Now these gonna bring up a question, what is the URI? Lfts and non-fungible tokens usually have some specific parameters associated to them. Let's say, Well now this gaming and Nephthys are very common, right? And that's kinda what we're gonna work on today. We're going to pretend that we're creating a contract to, for an object in a game. Usually objects in games, let's say that you're playing and you're creating an RPG game, then objects can have attributes like weapons can be a certain type of weapon, that they are a certain type of damage and so on. So basically that's what the URI does. The arises a connection between the attributes and the weapon, or in this case of this example is between the attributes and the NFT. This is what this C7 to T1 sort does, is that it's going to store the attributes today. We're not going to dig too much into this because it's a little bit more complicated. We're just going to give an example, But in a second here. Now we can continue and copy paste. Contract in here and the last one will be counters. And this one is again as in, is not in the token folder bodies in utils. Here we can do contracts. You have counters, counters. It has the functions to keep track of the NFV is basically we can just copy it. Ampersand in here. Now compared to the previous contract that we played with with the ear C7, T12 I'm sorry, could keep confusing between the ERC 20. These are will not need them much change. It's actually pretty much ready to be tested. There are only few things that we want to adapt. So we said that we want to create some sort of like a contract for some sort of object in our game. Let's say that we want to create a card games. We can call it cool cars. Just haven't, hasn't handled. Here is we're gonna change the name of the of the contract. And as you can see this one here, while it's importing all these contracts, but then he's inheriting the URI storage contract, which behind that now is going to inherit everything else. Then here this is a new way to explain that we are taking some came from the counters contract in this case I think is a struct inside the contract and we are adopting it and bring it in here. So these basically keeps track of how many enough TAs are on route. And then I'll show you how we can use this one here. Now the constructor function is going to create the contract and associate the name and the symbol, as you can see here, takes from the ERC 721 contract, which is up here, and takes a name and the symbol. We can just say that this, we have the cool cars as the name. The symbol is just gonna be like that. Now, our contract is pretty much ready. We can pretty much already tested. Let's just briefly go to the main function here before going into the actual testing. So here we have a function called the warned item, which we can call it any way we can call it, means NFT or generate car. Let's call it make my car. So whenever we are colonies function, we create a new card that we can leave to the player. Now here, the player parameter here is gonna be the address maintenance. There's going to be given to that address. And the token URI here would be those attributes that we were talking about. So generally how this works. So we can see those are attributes. I don't know. In the case of a car, it can be the color, it can be usually It's a mix. These token, this URI holds all of the attributes is usually generated as a JSON file. Then it has all the attributes it can be in on the color of the car. In this case, the color of the car can be the power and so on and so on. For this example, we are now going to create the JSON file and everything and link it to it. We're just going to type. Type is a string where we can put the color or some fluid that just to give the example, this one is public, so it can be called because we want to have, we want to have people call in it. And this is going to return a uint8. What is going to return is basically the token ID. Because as we mentioned, the main difference between ERC-20 in 1721 is that we have an actual unique ID for each element. That is means that That's what this function does. It creates it, and then it increments the count and it stores it in the system. And you can see it's gonna return a new item ID so we can be able to sail. Let's first check it. Let's first test it on the virtual machine. Will do Control S If we can compile it. What's going on? I don't know why it takes some time, but it took some time. So this is another good thing of using these pre-made and already tested contracts. Already working. All by itself. We compiled it and we can deploy. We'll do the virtual machine. Here. We don't have to put any, I don't have to include anything because it's already coded in here. We'll just deploy the cool cars contract. And if we look, we have many contracts that we could deploy because they were all important by one another. Here we have all the functions and everything available. Let's start with the usual things. We can check the name and the symbol. You can see the name, cool cars, symbol cars. And then it works. Then we have the other functions pretty much like the ERC-20, where we're gonna have to approve the contract before interacting with it and so on. But the main function that we have here is this my car, right? If we look here, we have a player and the URI. So this means that whoever calls this function, well, I press it by mistake but is gonna be an address and then there is going to be an URI associated with it is usually associated automatically once the function is called. In this case, we'll do a manual interest to test it. But let's say that these second address here, it's going to come and meant this is the player and is gonna come here. Meant the target address in there. And let's say that is a black car. Doesn't matter too much what it is. We make the transaction. Went through. Now, these address three, take it and we will check. If we check on the balance of function, we should see that these address has one NFT available. If we take another address, Let's say this one here. We check and balance are here. It's not going to have anything. Here it is. There is no NFT, so that's how it works. Now, this one here is deployed on the net yet so we can check the details. But these basically every time we call the function one, if t is gonna be created with a unique ID and sent to the others. Now, let's try to destroy Diesel. Let's deploy it on the actual test. This time in the previous one, we use the VSC test and at this time let's use the RNC be testlet, which is the test for Ethereum. So we have wrinkly here. Switch to this account three that has more Ethereum. Then remember we will try injected with three. We had the repeat tests that we have our account. Now we can deploy the contract. Now we can confirm it. A contract deployment. We confirm it is pending, expanding and expanding. Was the PLO correctly. So from here, we can just click directly on view on ether scan. It's going to open the window here still indexing, so the transaction was sent successfully, but the blockchain is still index in it. Let's just wait a moment to see when this is going to work. This is contract creation. Okay, did it? So now the contract here was created. If we go on the others here, you can see how now we have an NFT. Main things, smart contracts. If we go check back here, Let's, let's assume these others that were heavier. Let's try to maintain an FTE for our address. Will go on my car, paste the address, and this time we'll mentor red car. Make the transaction. We're gonna have to confirm it to mathematics. Here we're having it went through. Depending what I went through. Let's check in on ether scan. You can do. Please index. It took some time, but now if we look at the Add the details. You went from the address 0 to our other. From the other 0 was created and send these on here. Now is C7 through I'm talking, and it has an ID number one. Here, cool cars is NFT itself. There is no match supply and everything. There is only one transfer that happen. We can see here we have the unique token ID number one. If click on it, we can see the details a little there. It doesn't have much, but it's number one. Now if we take, if we create another NFT, let's just create the same address and we make blue car. Made a transaction again, hopefully is now going to take that long. Trending here. Let's go look it up on ether scan. Please be faster this time. Alright, here we go. We have ID number two. So now this one here is a specific token which is on unique ID. And now we have to have a total of two. They're both on the same address. If we take this address, we should see that balance of we call it here. Now we have two. It means that these artist has two different entities. We can also use the owner of function, which can tell us C is asking for a token ID. And it can tell us who the owner is. We can check who is the owner own number one. And number two is this same address because we mentioned in the same way. So let's try to transfer, we can transfer it to other addresses, right? So let's say that we can, now we own it so we can transfer it. We can take one of the other addresses that we use here. Copied it. The approval transfer from. Here we can use a transfer from functions transcript from two. And let's say we want to send this to this address. We want to send it, to send it from the right. So we want to send it to see these arrows here. And we're going to send the token ID number two. The second one that it was created. Say it says number two cars. Sorry, I went a little bit faster through that. Was completed up. Taking a while. I don't know why social role tonight. Alright. So now we have a token transfer from the previous otters and owned it to the new orders. That is the token number two. Now if we look at this contract holders, now it's gonna have recorded all this transaction. This is basically just how the contract will work. One thing that I wanted to show before we get done here is that we are creating our maintain tokens. We didn't really have a way to see how many of those have been maintained. If we look through all these trends are the functions that we have available. We don't have a counter. We can see who is the owner or Warren f. T, But we know that we made till now three is going to give us an error because we don't have a number three. How can we see that? Because we have a counter function right in the counters contract. If we kill this one here, if you look at this one, we have it. But it's private. This means that we can't call it from outside. To do that, to be able to see it, we will have to make it public, public, public. Now if we compile it for this one here, we can just test it in the virtual machine. We deploy. Take the address here and let's try to meet a few of them. Let's means all to the same RSS, okay? The first one is black, the second one is red. Third one is yellow. Alright, now we mean to three and update. So we can check that the owner address has three nf TAs and we can see that this is the honorable of them and that's fine. But now we have this extra one here, token IDs. If we call it, it's gonna show three. So this is all we have three tokens and we can check who the owner of what Tolkien is. That's it. We can also recall the URI. We can take token number two and see, well what are the attributes or it's a red car and the token number 3100 attributes or is it a yellow ocher? These are all functions and things that can be implemented for, you know, other applications. For example, if you have shrunk developing a game or something like that. This one was a little bit less than details compared to the ERC-20, but it is a good introduction to what LFTs are and how these types of contracts work. This concludes these next steps course. After this one, you should have a little bit more familiar, familiarity with actual smart contract that do actual real thing. So don't be afraid of practicing. Keep practicing to make your own token, maybe even trying to create a different, an extra contract after you created a token. So you can interact with the token, try and see where you can make. And then the next course that I'm going to perish, it's going to be the Python course to use Web three, the Web three libraries to interact as my contract. So that one is going to be very useful. One is gonna allow you to interact with smart contracts like exchanges, where basically you will be able to create bots, crypto trading bots in Python using the library. So it's pretty interesting. Alright, thank you for following, and I'll see you next time.