Testing
The picture loads from YouTube. The player loads only when you press Play. Turn on captions in the player if you need them.
A speaker leads a StarkNet Foundry testing class, first asking students to define unit, fuzz, integration and fork testing. The session shows unit tests, expected failures and fuzz runs, then builds an ownable contract and tests it with a caller cheat code, closing with an exercise on ownership transfer tests.
Not by We Them Media Channel: Web3Bridge. Published Saturday 1 June 2024.
Titles are the owner’s. It plays from their channel.
Watch it on YouTube (opens in a new tab)
Transcript
This transcript may contain errors. This video belongs to Web3Bridge. Letters mark each change of speaker.
These are the speakers’ own words. We have not checked their claims.
0:01 A: All right, so basically I'll be taking you guys through unit testing, uh, force testing, integration testing, and fork testing. So now I would like to probe your prior knowledge of testing. I want to believe we've all written smart contracts in Solidity, is that correct? Or this is just our first time writing, um, smart contracts in general? If you want to say something, please unmute your mic and like, you know, talk.
0:29 B: Not my first time writing Solidity smart contracts before.
0:38 A: Okay, so, um, every other person have written Solidity smart contracts, right?
0:45 C: Yes.
0:46 A: Test cases for it, is that correct?
0:48 D: Yes. Awesome.
0:53 A: So can someone give me like the differences between unit testing and fuzz testing, integration testing, and fork testing? Just like, I just need to like probe our prior knowledge of smart contract testing. Unit testing, integration testing, fuzz testing, and fork testing. Anyone can give me the differences between these 4 test mechanisms? Okay, um, Sabo, can you go first? Do you have any idea how unit testing works? What unit testing is?
1:29 E: Um, unit testing is like testing your code in bits to see if they work, like if they work the way they are supposed to work, if they behave the way it's meant to behave.
1:43 C: What?
1:43 A: Say that again.
1:44 E: I said unit testing is testing your code in bits to know if the- if it really behaves the way it's supposed to.
1:52 A: Okay, so Daniel, do you agree with, um, Sabo?
1:56 B: Uh, yes. Um, but to add to that, um, yes, in unit testing now you test, um, a particular code snippet. That's why it's called unit. So you're testing units of codes. But then I agree to him, that's how it is.
2:11 A: Okay, cool. So what differentiates that- I'm still on you, Daniel- so what differentiates that, um, from integration testing?
2:17 B: Um, honestly, I've not done integration testing before, so-
2:27 E: Okay, okay.
2:29 A: So, um, Victoria, do you- okay, okay, Victoria, please go ahead. Do you want- do you care to like share the differences between integration testing and unit testing?
2:40 F: Okay, so I think you mentioned 4 tests. I didn't hear those ones. Uh, I couldn't get like what they are called, but, uh, my own understanding of unit testing and integration test- sorry, based on my knowledge of content. So unit testing is basically testing, uh, lines of code, like let's say a function. Right, to test how just one single function works. Then integration testing is when you want to test the whole flow. Let's say you're writing a to-do smart contract, you want to test how the add function works with the remove function, with the, you know, the whole integration of the to-do to make sure that it is working. Why unit test? That's integration testing, but unit testing is testing just one particular unit of your code. just a functional- yeah.
3:38 E: Okay, thank you.
3:40 A: So, um, Emmanuel, Emmanuel Akalo, do you agree with Victoria? Yes, I agree with her. Okay, awesome. So, um, can you shed more light on how these 2 different kinds of testing differs from forced testing?
3:55 D: Um, I think I'm hearing of Fuzz for the first time here.
4:05 A: And, uh, fuzz, F-U-Z-Z.
4:09 D: Oh, fuzz. I have no idea about that. Well, I've seen it before, but I have no idea about that. I think it has to do with like, um, interaction with like the contract when it has been deployed, something of that nature. I don't know.
4:28 A: Okay, I don't exactly agree with you, but, um, so anyone with a contrary opinion as regards forced testing?
4:35 B: So, um, it's like stress testing your code to see when it fails.
4:57 A: Okay, so Emmanuel, did you catch that?
5:01 D: No, sir, it wasn't audible enough.
5:06 A: Can you say that again?
5:08 B: Okay, um, I was saying fuzz testing is like stress testing something where you run repeated codes with different values with um, on your code to see where it fails. So it's like you're testing an app with 1, 2, 3, 4, 5, 6 till maybe it fails at 100 million. So like, that's where we call- that's what we call like false testing. That's what I understand by false testing, not that.
5:38 A: So, Emmanuel, did you catch that, Emmanuel?
5:45 B: Yeah, I do.
5:49 C: Oh cool.
5:49 A: So, and, um, that then that leads us to fork testing. Anyone with the idea of how fork testing works? When we say we want to like fork the mainnet, what do we mean? Anyone?
6:05 F: Okay, so it's- we've done something like that at the attribute called- so it just basically means, um, when something is on the mainnet, so you want to do like, um, a rerun of how it will look on the mainnet, right? Just like, you know, bring it locally, then test it as if it's on the mainnet before you actually put it on the mainnet, just to see how it will work if it's actually on the mainnet. So you have like this, um, false like test environment that you can use as if you're on the mainnet. So just basically forking something and bringing it locally to test how it will really work when it goes live. That's what changes.
6:56 E: Awesome.
6:58 A: So did everyone catch that, or do I have to reiterate? So in the course of the class, if we don't understand something, please do well to call my attention to it. And I will be asking a whole lot of questions, right? Because I'm working with the premise that we all have an idea of how this whole thing works, and the only thing we are just doing is testing, testing our contracts and building on our existing knowledge. So with the whole forms of testing we talked about just now, we'll be touching them one after the other. So we'll be starting with unit testing.
7:33 E: So let's-
7:35 A: I want to believe we all have StarkNet Foundry installed on our local machines, right?
7:38 E: Yes. Yes.
7:45 D: Yes, sir.
7:46 A: Okay, so I, um, it's- I kind of prefer, um, sound feedback compared to the thumbs up. So, so like, you know, I can't keep like, you know, switching screens, like check if you're sending thumbs up, do you understand? So, um, can you all see my screen? Is it, um, clear enough?
8:04 C: Yes, it is.
8:05 F: It's tiny.
8:07 A: Oh, one more zoom in.
8:10 E: Yeah, all that.
8:16 A: Is that okay?
8:17 C: Cool.
8:20 A: All right, so make entry S+ So yeah, I said I believe we all have StarkNet Foundry installed on our local machine, right?
8:43 F: Yes.
8:46 A: So I believe we all know how to initialize, initialize a new Foundry project.
8:58 E: So. So we have our project initialized. So yeah, so let's take this off. Is this- let's use this. Okay, awesome.
10:19 A: So starting with unit testing, basically we were trying to like, you know, check how, um, each section of a particular- like the output as a whole. Now you should like test each function to see how they work, to see if they are working properly as expected. So let's say, uh, we want to test- let's, let's say normal So let's say we have a simple function that basically like, uh, say adds 2, um, 2 numbers together.
10:54 E: So let's say function add. So if I can see what we- let's see, this returns 45,000.
11:24 A: So that returns, uh, the summation of A plus b, right? So now we want to test if this function works, right? We can basically write our test cases inside this single file since it's just basic unit test, right? But to get started, you need to specify the test keyword over here.
11:52 F: Sorry, sir, please can you zoom in more? Like, I can barely see.
11:59 A: About now. Is that okay?
12:04 E: More?
12:05 F: Yes.
12:06 E: Okay, I can.
12:07 F: Yes, that's better. Yes, thank you.
12:09 A: So, uh, we want to like, you know, you know we're writing our tests inside the same file as our function, right? So we have to like specify this else the compiler will just like pick it up. So then we have to like put it in the mode, um, say tests. So now we want to test if this function works as expected, right? Um, and I want to believe that you are familiar with the super keyword. So can someone tell me what this does? The super keyword.
12:43 F: It's used to access something outside Okay, model.
12:52 A: Basically above.
12:53 E: Thank you very much for that.
12:57 A: Um, so now we, we now have access to the add function inside our, um, inside our test block over here. So we can go ahead to, um, to test our function. So basically you would wonder, like, if we do smforge test, how would the compiler pick up our test cases? So we can do that by specifying the test keyword on each of those functions. If you don't specify this test keyword on each of those functions, you'll be able to like- it won't read this as a test function. So we specify the keyword on line 10 over here, and then let's say, um, function-
13:38 E: sorry, function test.
13:40 C: All right.
13:44 E: And, uh, you can have this.
13:47 A: Please, if you get confused at any point in time, call my attention to it, right? So, and then, uh, to check the validity of our sum, we need to like make use of the assert keyword. Um, and please, I'll be calling people at random to like, you know, ask questions just to be sure you guys are following. So, Daniel, uh, are you familiar with the assert keyword and what does it do?
14:13 B: Okay, uh, yeah, I understand that. Um, okay, just like in Solidity, um, instead of assert, now we're going to use, um, maybe, uh, instead of- yeah, like in Solidity, you'd have been require or something like that, but here is to assert. That is-
14:29 E: Okay.
14:30 B: I don't know how to say it, but it's the, it's the substitution for the Um, how do I say it now? Okay, if it was Solidity, it wouldn't be assert we use, even though we have the assert statement in Solidity. But here I think it's only assert we use to test, that is to check, you know, between 2 values or something like that.
14:58 A: Okay, thank you. Um, Sabo, want to give that-
15:04 C: is-
15:04 A: sorry, is it Sabo or Ajidoku? Which one do you prefer? Are you on call?
15:11 E: Yes, I'm on the call.
15:15 A: Excuse me, um, my-
15:16 E: yes, um, Sabo is first or Archie?
15:22 A: Sabo is fine. Yeah, Sabo is fine. All right, go on. So do you care to give it a shot? What's the function? Okay, um, we use assert to like when we want it to proceed when the condition is true.
15:42 E: Like it should-
15:43 A: the condition has to be true for it to pass. That's when we use assert. Good, that's, that's a perfect answer.
15:51 E: Thank you for that.
15:51 A: So, so now we want to like, um, okay. So we want to, uh, make sure that our function works perfectly fine because our expectation is that when we have 2 and 3 together, it should give us 5. And if this is wrong, that means our function is incorrect, is faulty, is buggy.
16:20 E: Incorrect.
16:31 A: So of course we all know that if we add 2 and put 3 together, it should give us 5. Anything contrary is going to fail. So, um, So, uh, if you run our test, you check your- you run your test with sn4gtest. That's the keyword that can run your test, and the compiler is able to pick up this test case because of this test keyword that we specify. On the function. I have to make sure that if you are naming your test, it has to like start with test. Test. Let's say you want to like test subtraction. Now that's like test subtraction test, if it works test. Like that's like, you know, come before the keyword. You can see our Okay, okay. Yeah, yeah, that's it. Yeah, so technically it's running one, you know, our test is not in here, right? So it picked up 0 tests from there, uh, and then 1 test from here, which is running 1 test from source. So yeah, that means our function works. So let's say we have, um, let's say we have 6, right? Of course, this is definitely going to fail. Let's run this again. So you can see it's definitely going to like, you know, fail. So this is one of the ways you like do a unit testing. So, um, I'm sure if you've been working well with, um, Cairo smart contract, you must have seen, let's say, a function that panics, function that fails, and stuff like that. And, uh, a function that you expect to fail, how can you handle functions like that? So let's say we have a function that is expected to fail. Okay, for example, now this function, I will expect it to fail, but then We don't want it to like, you know, return to us like this.
19:31 E: Do you get?
19:33 A: So if you're expecting a function to fail, let's have this set.
19:37 E: Let's return this back to 3.
19:40 A: So let's say we have a function that we expect it to fail.
19:44 E: So in test, fail that.
19:51 A: So now in StackNet Foundry, we have the methods exposed to us to like you know, assert if a- to assert an expected failure, right? And so let's say this is- so of course 2+ 10 is definitely not equals to 5. So we expect this test to fail. But then if we run these test cases like this, you run these 2 tests like this.
20:18 E: Oh shit.
20:28 A: Don't forget, we're expecting this test to fail, right? So as you can see, one test passed, one test failed, right? But this is not a good, um, developer experience, so we need both tests to pass, right? So we can specify an expected failure keyword over here.
21:13 E: This should panic.
21:18 A: And then, uh, what we're expecting-
21:21 E: expected, uh, it's a method.
21:25 A: This, this basically is a tuple, right?
21:29 E: Uh, then we're expecting that 2 should be equals to 3.
21:37 D: I'm sorry.
21:41 E: Sorry, this is definitely going to be the- that is going to become-
22:00 A: so this is the double specified So if you run a test, of course this is meant to fail. This is meant to fail, right? But then the fact that we already expecting that it's going to fail, so it's not going to like run into a problem and it's not going to like run a failure, a failure response, like give a failure response to us, right? So since this passed, that means our logic is also correct. So don't forget, let me comment this out again and run the test. If you run this, it's going to return a fail response to you. But the fact that you're already expecting that it is going to fail and then you added the should panic keyword in your test file, then it's- the compiler is going to know that, oh, you know that it's going to fail. And you can like, um, so it's expected, okay, it's going to fail, and then it's expecting this error message as well. So once this error message matches what was returned, what is being returned over here, then it's going to like, you know, pass, right? So this is also one of the, one of the ways like, you know, do a unit, um, testing. Uh, also, so let me quickly touch post-testing using the same function. So let's say we have this same, uh, The same test file.
23:28 E: It's again here. So test out POST.
23:34 A: So the beautiful thing with StackNet Boundary is the fact that you don't have to write your- you know, when you're dealing with like the traditional fuzzing, right, you pass in random figures to make sure that your test breaks. But then, StackNet Foundry has made it a lot easier such that you don't have to like pass these things manually. It like imputes the values at random on your behalf. And one of the ways to like do a forced test with StackNet Foundry is just like, you know, specify that, okay, put in arguments here, put in arguments here. So let's say, uh, we have test_at_force.
24:15 E: Let's say we have uh, say x is a float 252, then we say y also float 252, then it's going to send in x and y.
24:31 A: And we're expecting that the summation should be equal to x plus y. So in this, in this kind of scenario now, right, The compiler is going to pass in random figures in here. It's going to pass in random figures and it's going to like stress the program to find at what point will it break. So if I have to run this test now, um, I've run this test now, say Simple test. So as you can see, look at number of runs here. It ran over the program 256 times with, you know, arbitrary figures, with random figures. Like, make sure that, okay, the program works perfectly fine or the program breaks.
25:38 E: Sorry, a moment.
26:51 A: Sorry about that. So yeah, so the program is going to like, you know, pass in random figures in here to make sure like, okay, the test passes. So that's basic, um, fuzz testing. So this is the basic things you need to know about fuzz testing. And if you need to know more and stuff like that, the perfect resource is the StackNet Foundry documentation.
27:19 E: I think I'm going to send this for the course.
27:26 A: So if you use like, you know, Learn More and stuff like that, you can head over to Stack Overflow documentation to like, you know, uh, see more, um, more stuff that are open, more methods that are open for use. So, um, the next thing we'll be touching is Integration texting. So basically it allows us to say, know the flow of things. Oh, please, is anyone confused up to this point? Please, if you're confused, um, signify. Let me reiterate or clarify any confusion.
28:00 E: Is anyone confused?
28:03 A: Please confirm if you can still hear me.
28:13 B: Yes, we can hear you.
28:17 F: Yes, sir.
28:17 A: All right, so is anyone confused up to this point?
28:20 D: So yeah, I have a question.
28:22 A: Go on, please.
28:23 D: So, um, I'm aware that we could use- we were using Scarp before to run our programs, and there was a Scarp test function that runs tests. So why migrating to SNForge now for testing, please?
28:42 A: So I'm just, just being curious.
28:44 E: Yeah, yeah.
28:46 A: So basically, Stacknet Founder actually like makes a whole lot of things easier, right? A whole lot of things easier when it comes to writing your smart contract and even posting your smart contracts. So, well, in the course of the class, we'll be talking about certain cheat codes that are open to you, open open for use with StarkNet Foundry. So basically StarkNet Foundry uses SCAB under the hood, right? So it's just that the way we're like approaching it is what kind of differs, but then it still works the same way as SCAB does. Is that cool?
29:19 C: Cool.
29:21 E: All right, nice.
29:23 A: So let's go ahead to writing Um, so basically we want to like do an integration test. So then with an integrated integration test, of course we need to like have a smart contract, right? So let's quickly create a basic ownable smart contract. We are going to be writing this smart contract together as I'll be asking quite a number of questions to like, you know, check how far we've gone with writing smart contracts. Um, So let's initialize another, another project.
30:20 E: Init for the moment.
30:47 A: So let's create an enable contract.
30:51 E: Enable. So it's enabled. Let's open this up as well.
31:00 A: Sorry, is there a class Governor?
31:01 F: Yes, there is. Okay, I'm just going to take it to Shiva. Do you want to send something to us?
31:28 C: Yeah, yeah, it's coming online.
31:31 A: Kimmy's online now.
31:33 E: Okay, okay, Kimmy is the class governor.
31:36 A: Okay, so if I need to send anything, I'll just send it to chat box. Um, so now we initialize- what's that?
31:47 F: Oh, you can just use our Telegram. We have like a Telegram for this class.
31:50 A: Okay, okay, okay.
31:53 F: It's not been added.
31:54 E: Yeah, yeah, yeah, yeah, no problem.
31:56 A: So, uh, we want to like initialize our, um, vulnerable smart contract.
32:04 E: So the first thing to do-
32:06 A: so the first thing we are going to do is to outline what we intend to achieve, right? So basically we want to have a smart contract that allows Only owner to set the data. Also would need a way, a way to obtain the dataset. Also, we need a function to return the owner. Return the owner of the contract. Of the contract. Um, what else?
33:07 E: Again, you need a function to transfer ownership. To transfer Ownership. Um, what else? What else? What else? Okay, let's, let's keep it pretty simple so we can quickly, you know, um, cover up.
33:36 A: So, um, where do we go from here? Can somebody help me out? Where do we go from here?
33:42 E: Yeah, we need to define the interface. Thank you very much.
33:49 A: Define the interface. Um, so, Ekarika, what does the interface do? Is Ekarika on the call?
34:03 C: Yeah, I am. Go on, please.
34:07 A: What does the interface do? Are you online or you're on site?
34:09 C: I'm on site.
34:11 A: Okay, good. So what does interface do?
34:13 C: Actually, what the interface does is it serves as- it's where we define all the functions we are going to be interacting with or we are going to be implementing or that we'll be using in the contract. So it allows other contracts, or it allows other contracts to be able to use or to be able to call our contract, to be able to interact with our contract. contracts. So it's- you can serve as a middleman, and also it helps guide us to write within what we intend, um, to, to lay out in the, in, in the contract. So it serves as a building block, like as a framework or a skeleton, something like that.
34:53 A: So does anybody disagree with, um, I don't disagree with him.
35:06 D: Please, your screen size is a bit tiny.
35:09 A: How about now? Better?
35:15 D: This is better.
35:17 E: All right, good.
35:21 A: Um, okay, so let's define our functions, right? So we need the function to allow only the owner to setData, correct?
35:31 E: So let's say we have a function setData, um, new, passing the value that we want to save, value, which has to be a float.
36:00 A: I want to believe that none of us is alien to Cairo syntax, correct? Is that correct?
36:09 D: Yes.
36:12 A: All right, good. So then we have- we've defined our set_data. Then we need also- we need a way to obtain the dataset.
36:21 E: So, uh, I have another function, So, uh, self, um, so it's going to return- sorry, I don't think we need the ref. Yeah, that's right. Thank you for that. Thank you.
36:55 C: Who was that?
36:55 B: What's your name?
36:56 A: Emmanuel.
37:00 E: All right, thanks, Emmanuel.
37:02 A: Um, then we need a function to return the owner, owner of the contract.
37:09 E: So say function owner. So this also, then returns-
37:26 A: oh, this is definitely going to return contract address, which is not defined yet. So can anyone help me out? Where do we obtain our Contract address? Yeah, we are obtaining it from the staff list.
37:44 E: Thank you very much.
37:47 A: That's Emmanuel, is that correct? Is that Emmanuel again?
37:51 B: Yes, sir.
37:52 E: All right. Yes. Oh, there's an error here. Right, awesome.
38:09 A: So the last- okay, function to transfer ownership. So if you are transferring ownership, of course you are going to require a new address, new owner.
38:19 E: So let's do that function transfer ownership. So is anyone confused up to this point?
39:03 A: Is anyone confused up to this point? Um, Signify, if anyone is confused up to this point, are we all clear up to this point? Any feedback?
39:14 B: Yeah, I just have a question.
39:16 E: Go on. So, um, I don't-
39:21 B: the ref self, I don't understand what it means, so I don't know if you can throw light on it.
39:28 A: Basically, you're referencing the contract state. Do you get that part? You are referencing the contract state. That's why you're specifying this.
39:38 E: Okay, okay. Yeah, so another question from anybody?
39:47 A: Um, who else is on the call? Mary, Mary Gatoni, so where do we go from here? We're about to start writing our contract. Where do we go from here, Mary Gatoni?
39:56 E: Can you help us out real quick?
39:58 F: Yeah, after that we'll use- I'm on IGSPC, so I think we have to implement the traits now.
40:05 A: We're about to start our contract, like What do we do first?
40:16 F: We use the main function.
40:22 A: But anybody wants to help Mary out? All right, so we need to actually define the StackNet contract. All right, so sorry, who was that? Who was that who spoke just now? Okay, so we need to declare our-
40:51 E: need to declare our Stack Merge contract.
41:07 A: Then we give the name, give a, um, so let's see, ownable contract.
41:19 E: So we define our block in here. Okay, yeah, that's good.
41:31 A: So yeah, Uh, so according to Mary, then we initialize our storage earlier.
41:38 E: We need to specify the storage keyword. Uh, we put ours-
41:47 A: if I'm going too fast, please bring me back. So yeah, so what do we need? Uh, we need a, um, We need a state variable to store our owner, and we also need a state variable to store our data. So, uh, so let's say owner- what's the nature of owner? Owner is a contract address.
42:20 E: That's a contract address. Sorry.
42:23 A: Uh, then also our data- the nature of our data is a So our storage is set. Um, where do we go from here? Let's define our constructor.
42:46 E: Sorry. Specify the steps. So what are we-
43:33 A: okay, we're passing in the initial donor.
43:36 E: Let's initialize that from scratch.
43:38 A: So we have an integer as a donor, uh, initial donor.
43:44 E: Should be a contract address. Um, does anyone see? Oh, oh yeah, we meant to, uh, pop this.
44:08 A: So we can basically, since we have it up here, we can use it. We can make use of the super keyword.
44:14 E: So use super, so construct address. So we don't have to like repeat use stack method, you already have it in our file.
44:39 A: So, uh, let's initialize our owner.
44:57 E: That looks about right.
45:05 A: Okay, so let's also set our initial data, right?
45:11 E: So self.data, right? We can upload it. Let's just upload it, right? Let's just upload it to yourself. All right.
45:34 A: So quick question for the class. Yeah, let's assume that we have, um, let's say data2 here.
45:44 E: Let's say we have data2 here, 12, 2, 5, 2, right?
45:50 A: And we failed to initialize this data2 in here. What is going to be the value at deployment of our data2?
45:57 C: Anybody?
45:57 B: 0.
46:07 F: Anyone?
46:08 E: All right, sir.
46:11 A: All right, so, uh, David, do you agree with Emmanuel?
46:16 C: David Dada.
46:24 A: David Dada. Is that correct? Yeah. Do you agree with Emmanuel?
46:31 E: Okay, since he's not on the call-
46:33 A: so, Kemi, do you agree with Emmanuel that the initial value is going to be 0, or you have a contrary view?
46:46 F: No, I don't have a contrary opinion. I agree.
46:49 E: All right, all right, let's go ahead.
46:51 A: So, um, Where do we go from here? We have our function, we have our, our interface, we have our storage, we have our constructor. So we should go ahead to our implementation.
47:11 E: You know, this is very important. Okay, in a different block, so say enable What's the name of that? Oh, there's an error here.
47:54 A: All right, let me pull it fixed.
47:56 E: Let me see if I can pull it fixed. Oh, come on. I'm sure it's fixed.
48:12 F: I think we need to use super.
48:13 E: Yeah, thank you very much for that.
48:16 A: So we need to, we need to import this guy over here.
48:33 E: Um, all right, let's go.
48:37 A: Is there anyone confused up to this point?
48:38 B: No, but do we have to always add the I to the interface, um, to the name of the interface?
48:45 A: Yeah, it's more like the due process. You can actually leave it out, but then it's more like, okay, it's how everyone writes it. So, um, let's- so what's our first function in our interface block? So setData.
49:05 E: Let's implement our setData. setData. So, um, ref self. Let's see here. Okay, simply contract it. Contract it.
49:26 A: Then, uh, what kind of data are we Impute it to 1252.
49:31 E: New value, 0.5, 1252.
49:40 A: Um, then what are the features of asset data? Only the owner should be able to call this function, right? So it only makes more sense to first implement our only owner modification first. Let's have a private function function. So we don't have to include that.
49:58 E: We can use the generic trait.
50:01 A: We said about creating a, uh, generic trait. So can- does anyone know the implication of this generic trait? Anyone?
50:20 E: Just that It's just for, let's say, implementing an internal function or a private function. All right, thank you very much for that. Um, say function only owner.
50:59 A: So So, uh, what would this do? It checks that the person calling the function, right, is the owner. Uh, and then there's a method from StackNotes, use- um, use to get the caller, to get the caller of a particular function. So Use StackNotes. I want to use the get color address method.
51:45 E: StackNotes get color address method.
51:59 A: So let's say let color equals get_caller_address. So the plan is to check that the person calling this function is the owner. So we can also assert that caller is equal to-
52:33 E: hold on, so that's self.read, self.read. And another error message says color is not read. This looks good.
53:03 A: Any confusion?
53:04 E: Any confusion? Any confusion?
53:23 A: No confusion.
53:24 E: Okay, question on my side.
53:26 A: How about the-
53:28 D: No confusion.
53:32 A: Okay, um, so now, uh, we can now proceed to like make a check that only the owner should be able to call this setData function. So since this function is a private function You can equally say self.only_owner. So now this function checks that the person calling the set_data function is the owner. If it's, if it's not the owner, it's going to revert. So then we can now proceed to set our data.
54:18 E: Write passing our new value in there passing a new value in there okay so yeah I think our set data function is done then we can move on to the next function or the next function get data say a function get data. So we can say Office itself, snapshot of contract state. Is this contract state?
55:08 A: Um, basically what is Nature of update is a failed 252, so it's definitely going to return a failed 252.
55:23 E: So quick question for the class.
55:37 A: Hold on a moment, let me type this out.
55:40 F: Yes.
55:40 E: Um, self.data.read.
55:53 A: So what's the difference between this block, this line 38, and, uh, So can anyone tell me the difference between this block of this line of code and this line of code and this line of code?
56:17 F: So the first one would not return anything because you added like a semicolon at the end. Yeah. Okay, first one returns data, and I think the second one- I've not used the second one before, but I think it also does the same thing, returns the data.
56:40 A: Yeah, so yeah, both does the same thing. But what makes this unique from this? Like, what's- what exactly is the main differences between these 2? This guy and this guy over here, you can use either one interchangeably, right?
56:54 E: Which is very, very great.
56:57 A: What differentiates this guy from this guy?
56:59 D: I think is the syntax. The first one you don't have to close with semicolon, the last one you close it with a semicolon. That's what I see there at the moment.
57:12 C: Yeah, just, just like the last speaker said, when you close with a semicolon, uh, when you close with the semicolon, then you have to You have to put the return statement. That is, you have to explicitly state that you are returning this particular part of the, of the, of this function. But when you don't close with a semicolon, then the- it will automatically pick it since there's a return, since there's a return there. So it will automatically pick the one that is not closing with a semicolon and return that.
57:48 E: All right, so thank you.
57:51 A: So basically, when you make use of return keyword, you have to like close it with a semicolon. So is that how you use this, or you use this? Is that why you don't close it with a semicolon and return it just like that, or you use it, or you use the return keyword and close it with the semicolon? Either one works fine. Okay, I don't know whether this is also the same thing, you know, when you- explain this, explain, explain. basically make use of return, no other, you know, program after that can actually execute it.
58:19 E: Yeah, yeah, that's right.
58:23 A: So, um, let's go ahead. So I see you guys really do have a knowledge of the smart contract. So what's the next function? We need a function to return the owner.
58:54 E: Function, function owner, function owner, the function to return the owner of the contract self. Then this is going to return-
59:16 A: so the owner is going to return what to us? A contract address.
59:24 E: Um, then we can basically say self.
59:38 F: Owner.wait.
59:38 E: Yeah, good.
59:39 A: So we have our 3 functions set.
59:41 E: So it means-
59:42 A: okay, so our transfer ownership function as well, let's implement that. So mind you, this is throwing an error based on the fact that all our definitions here have not been implemented yet. So the moment we implement every single one of these um, of this trait in our implementation block, this error is going to go away.
60:06 E: So, so function transfer ownership, um, so we're writing to state, you have to like make reference to self.
60:15 A: Then, um, So I want to make sure that only the, only the owner can transfer ownership.
60:56 E: So, um, you can just basically copy this block here. Just a single.
61:06 A: Then, um, so you need to obtain the previous owner first. So let's just try straight to it. Do we all know how emit works with StarkNet smart contract, or we need to touch it? Once you emit events, do you all know how it works, or we need to touch it?
61:26 E: Quick response, please.
61:28 D: Please, George.
61:32 A: Let's touch it. All right, so basically, once we transfer ownership, we need to emit events. And what do we want the content of the of the event should be. So let's say the address of the previous owner and the address of the new owner. And if you want to do that, make use of our emit keyword.
61:58 E: If you can just put it over here. So say our event and I need to implement divide because it's going to like drop it. You have to run into error.
62:32 A: Then, um, what else? Then we have until now.
62:36 E: We won't.
62:39 A: So now what's going to be the content of our, of our events? We said, we already said, um, the previous owner, right? And the, um, the new owner. So only makes more sense to have a struct to come to accommodate this.
62:56 E: Let's implement the same thing here. So, um, so yeah, let's have a struct. So let's name it Financial Okay, ownership transfer.
63:38 A: Then we can define our queue.
63:47 E: So sleep previous owner, definitely going to be counter address. Contract address, then a second queue. So any owner, owner also contract address. Why is it still an all? Oh, sorry, this is meant to be just a struct, not an event. Aha, awesome.
64:25 A: So now we can confidently make use of this here now.
64:31 E: So you can say, um, Yeah, sounds about right.
64:49 A: So now we've implemented our event.
64:51 E: This should work. Yeah.
64:55 A: So now the next thing is to make use of this event in our smart contract. So now we know that once we transfer owner, it's going to emit an event. So we need the address of the previous owner, and then we need the address of the new owner. Right, so let's say, uh, let's previous owner equals, um, self.owner.read. So we're doing this first. Um, okay, then we required to just set it like that.
65:31 E: So let's set new self That looks about right.
65:49 A: So let's emit our event. So we have ourselves the emit keyword, uh, then what's the name of our event?
66:00 E: Yeah. I should transfer. So, uh, you can have this here because it is fixing previous owner first and, um, oh, and the new owner. Okay, uh, we are running into an error.
66:35 A: Anybody see?
66:37 E: We need to define the key. Yeah, yeah, take one after the other. Okay, yeah, the key should be there actually before the value.
66:47 A: The what?
66:48 E: The key from the struct.
66:54 A: Oh, thank you for that.
66:56 E: Thank you very much. Actually, we can do it this way. I guess this should work.
67:22 A: That works.
67:27 E: Yeah, it works just for purposes, you know.
67:31 A: All right, so thanks for that. Um, thank you, Victoria.
67:35 E: Thank you, Mama.
67:39 A: So where do we go from here? I think our contract is looking good. What else have you not implemented?
67:45 B: This.
67:50 E: Yeah.
67:56 A: So anybody confused up to this point? Abigail, I don't think I've heard your voice in this call.
68:13 C: Abigail, are you there?
68:13 F: Hi, yes, I'm here. I have noted what you asked.
68:23 A: Okay, are you on site or you're online?
68:25 F: I'm on site.
68:27 A: Okay, so, um, where do you think we should go from here? Well, I was expecting you to say let's, let's just go ahead and test the contract. Anyway, let's just go ahead and test the contract. So, um, so, um, so we, we are now going to, uh, apply some of the knowledge we had our unit testing in our, um, in our test, in our integration testing, right? So basically we could have our test file over here. We'll just have to like, you know, make sure we specify the cfg keyword and cfg_test keyword, blah blah blah. Uh, but then for, uh, code readability and code neatness, we should- let's have it in a separate, um, file, right? So, um, Quick question, have we all deployed on, um, Sepolia? Have you all deployed the contract on Sepolia before? Like, not normal Ethereum. Like, have you all deployed on Sepolia before?
69:43 E: Yes, once.
69:45 A: Okay, so, um, can anyone tell me the deployment process? You know, like, the few things that happens before deployment. Because basically we are trying to, um, we are trying to imitate what happens in real time in our local machine, in our test file, right? So does anyone- can anyone like, um, explain to me like the processes involved, like the key things that are very, very paramount when it comes to, um, deploying a StarkNet smart contract?
70:22 B: So I think it's to declare, declare the contract before deploying it.
70:31 A: Okay, I think I need to give Daniel a round of applause. Give me a moment. Yeah, I think I just gave you a clap. So yeah, we need to deploy- sorry, we need to declare our contracts and then deploy our contract before we can interact with it. Um, so, um, also, are we all familiar with the concept of dispatcher? Are we all familiar with the concept of dispatcher?
71:03 F: Yeah, I have an idea.
71:10 A: Hold on, before you say anything, um, Benjamin, do you have any- do you have an idea of how- of what a dispatcher is? Yes, I do. Okay, can you explain it to us? Like, what does it do?
71:24 E: Why do we need a dispatcher?
71:25 A: Dispatcher is like the- it's like, let me know, I don't want to use the word interface because of, um, because of what interface means in this sense, but it's like the medium we use to interact with a smart contract. So if I want to call the function of a smart contract, I will use the dispatcher of, um, that is generated by the compiler from the trait or interface of that contract to call those functions. All right, so Victoria, do you agree with Benjamin?
71:58 F: Yes, yes.
72:07 B: Okay, so, um, yeah, from the last class, um, the last- yeah, the last class, the tutor said, um, the dispatcher is meant for making external calls.
72:16 E: All right, of course. Yeah, of course.
72:21 A: So thank you for that. So, um, yeah, we already said earlier that we need like- we need to declare our smart contract, right? So the beautiful thing is that Stacknet Foundry has made this a lot more easier for us. So we can basically just, you know, use, um, what's it called, use the declare keyword from SNForge STD, right? So then I think let's import our dispatcher trait. So we can basically say use the name of our project No, we are making reference to Honorable from our test file.
72:59 E: Use Honorable. Um, and the beautiful thing with this is that when we specify this and add a dispatcher keyword to it, it is open for us. Dispatcher. Awesome. Um, So, okay, so these are like-
73:38 A: I'm trying to like, you know, um, what's it called, like set up the prerequisites before we proceed to writing our test proper. So now we need to have- let's create, instead of deploying at every point in time that we write a test case, which it makes more sense to have a helper function to help us declare and deploy a smart contract in our test file. So let's say we have a function deploy contract. So this is going to like make our testing very easy. Once you have this, you just have to like Call this function to deploy.
74:17 E: Deploy contract. So, okay, um, contract to do by time. Sorry, time. Okay, so, um, let's contract, um, equals-
75:03 A: so we have to declare So, uh, declare is going to take this name argument.
75:11 E: You can unwrap it. Is that correct? Yeah.
75:21 A: So, uh, then we declare. This is how you declare with Stacksmith Foundry. So then we are open to- so, um, the next thing to- after we declare, the next is to deploy.
75:33 E: Right, so in our deploy contract, the top, right? So we can say contract.deploy. Hold on a moment.
75:55 A: So if you can recall, we We have a constructor here. So if you don't pass in the argument, it's going to fail.
76:05 E: It's going to like throw an error. So it makes more sense to have an admin address. You're passing an admin address, right? So address.
76:20 A: So this class is meant to end by 6, right?
76:27 F: No, 7.
76:27 C: 7.
76:29 E: Okay, all right, give me a moment.
76:39 A: Let's admin address, um, equals Admin. Okay, let's typecast this.
76:54 E: But then before we can typecast, we need the, the try_into keyword, try_into method from core.
77:03 A: So, well, I'm sure you're familiar with typecasting, correct?
77:06 E: Am I correct?
77:10 A: Are we familiar with typecasting?
77:10 D: Yes, yes.
77:13 E: Okay. Put, um, try into. So, uh, can basically- so since you are typecasting, right, you need to annotate.
77:44 A: You need to like tell it that we need you to typecast this into a contract address.
77:54 E: Oh, need to import this again. This is meant to throw an error. Why is it not throwing an error? Hold on a moment, please. Ah, that's not- yes, I think they trade.
78:25 C: So what do you think?
78:30 D: They try into, um, call.
78:43 E: I think it has to be like a capital I or something. Oh, thank you, thank you.
78:58 A: So Okay, this is basically throwing a request. We need to like make a return and stuff like that. So, uh, so now basically this- yeah, we said something about, um, passing in a- passing in the arguments for the constructor. So it's-
79:17 E: we'll pass it in as an array. So an array, then I think address.
79:29 C: Are you-
79:29 A: this is going to- if we pass it in like this, it is meant to throw an error because it is expecting-
79:37 E: so this is a tuple, right?
79:51 A: So this is going to return a contract address to us. And one other thing, they're like 2, so we have to like leave that space open. So this, this guy will throw an error.
80:01 E: So what's this error again? Hold up a moment. Let's then return contract address. Something was wrong. I used the variable.
81:10 A: I don't want to see this here.
81:11 D: Can we try spamming the, like, unwrap?
81:16 A: Say that again.
81:19 D: The unwrap, do we need to add a spam to it at the end? A spam to it at the end of unwrap?
81:27 E: No, not that one. This?
81:32 D: Yes, but I doubt- no, it's not What's that value?
81:43 E: Um, anyway, let's debug. Let's see where the error is coming from.
82:00 A: Can somebody tell me why this is not throwing an error again?
82:07 E: Oh, I see.
82:08 D: Is it because the contract address you are returning is not- the type was not there?
82:17 E: I thought- oops, doesn't matter.
82:30 A: Anyway, let's, you know what, let's, let's go ahead. If we encounter other errors, we'll debug. But basically, this is our helper function to help.
82:41 E: Someone is-
82:42 D: go on.
82:42 C: All right, I see that normally when we want to typecast, we use try_int_to and unwrap, but in this case, we are just unwrapping. Without- in line 9.
82:59 A: Line 9?
83:03 E: Um, no, this is meant to-
83:05 A: I'm not typecasting here. TryingTo is meant to typecast. I'm not typecasting here, I'm just unwrapping what is being returned from declare. If I don't unwrap it, it's not going to go into contract. If I'm typecasting, then I'll make use of TryingTo, but I'm not typecasting here and just unwrapping what is inside the player, what is being returned by the player.
83:24 C: So what, what is normally being returned by the player? And what's the contrast? What are you expecting?
83:31 E: Well, let's check the type over here.
83:38 A: It's not returning the type. I'm not sure the kind of type it is meant to return, right?
83:43 E: I've not exactly looked into that, but Probably in the course of the class.
83:46 A: If I find it, I'll definitely let you know.
83:49 E: All right, all right, so, all right, go on.
83:54 F: Okay, so what's the essence of what you did in line 8? Like, why did you have to typecast the admin to contract address? Why not just use it as normal contract address?
84:07 A: Okay, so, um, it's just basically for readability.
84:12 E: Do you get?
84:14 A: I can basically just go on my wallet address, on my wallet, and copy a random contract address, right, and paste it in here, like I code it. But for if you are going through the code base later on, you might be confused as to what kind of address is this. So for basic readability, it's just basically typecasting a string to an address. So if you see this now, if you see this now, you know that, oh, oh, okay. this is admin address. Or let's say if I have- let's say if I have, um, let's say I have another address here. Let's say fake admin address. Fake admin address. I can basically say here as well, fake admin. It's basically for readability. So this, this has been typecasted into a string. Sorry, this string is being typecasted into a contract address.
85:04 E: Did I answer your question? Sorry, are you clear?
85:09 F: Yes.
85:10 C: So if, if you say a string is being interpreted into an address, does that mean that anytime that it's trying to fetch that particular address, it will be reading a string as an address, or will you be able to fetch the deployer's address? I'm trying to understand.
85:26 A: At this point, at this point, this is definitely- this is is going to return like an X. Like, the returns from this is going to be an X. Like, it'd be like a contract address normally. Do you get?
85:38 C: So if you try to put the deployer's address-
85:41 A: yes, that is the deployer's address. So the owner- that's- this is the owner's address, the one you are passing into the constructor here, the initial owner.
85:51 C: Do you get? Yes, yes, I get. Yes, I get this one. So how will you be able to read that admin is that owner's address? How would you be able to link this admin to that deployer's address?
86:02 A: You mean this?
86:04 C: Yes. How would you be able to link this admin to the deployer's address?
86:11 A: No, no, no, no, no. The person deploying this contract now, right now, you know, when we run the test case or run tests, right, it's the inbuilt address, like the, like the inbuilt, um, uh, address, private key, and stuff like that is embedded inside of Stacking Foundation that is deploying this for us. But then meanwhile, meanwhile, if a familiar would start prank with normal Solidity, we can do something similar, although it's- although we can use a different, uh, keyword when it comes to this one. So you can, you can specify who deploys this contract address. But then, but meanwhile, you know, we are, we are only passing in the initial owner as at the constructor level. So we are not setting msg.sender over here, so we are passing the initial owner yet. So it doesn't matter who deploys it, do you get? But then we can still specify who deploys a particular contract. We can make use of StackConnect Foundry's cheat code to get the method that will- that is going to like help us to, um, to specify who deploys the contract, who calls the function, and stuff like that.
87:17 E: Are we good?
87:20 C: Yeah, yeah, we are good. Okay, what was just- what was confusing me was the fact that, okay, like, this, this is a script to deploy the contract. Now, in the, in the contract itself, we have a constructor that takes in the address, that fetches the address of the deployer and sets it as the owner of the contract. Now, in this script that is meant to deploy that address, now, you know, if like- okay, let me put it like this. In, uh, in- so let's say we are doing them, we are trying to deploy a Solidity contract with ADAT now, um, with, um, in ADAT now, in our deployment script, we are going to have maybe a kind of maybe .env, and that's- that .env is going to have the deployer's address or private key, and that is going to translate in our deployment script, some- something like that, like I'm just trying to like, like there's a linkage between whatever string we are using in our script to the deployer's address or the deployer's private key to just give that connection. Like what I'm just trying to understand now is like, how does this admin now, how does the, how does the script now make it understand that, okay, this admin keyword that is here now is, is a placeholder for, for the deployer's Address.
88:37 A: Don't get it, don't get it wrong. This admin address here is not the deployer. Something else is deploying it for us in our test case, in our test file. This admin address is just being passed into the constructor so the- so this admin can take the position of an owner, of the owner. Now according to our contract logic, we are setting the owner here Yeah, we are setting the owner from the argument that we are passing into our constructor, not like we are targeting the deployer of the contract. Do you get the person?
89:12 C: Okay, okay, okay, okay.
89:14 A: This contract is not- yeah, the other person is the owner.
89:19 E: Do you get? Yeah.
89:20 A: So I think we are done with our helper function. So now this, this basically deploys, deploys our contract, uh, deploys it, and then it returns the contract address of of the, um, of the contract to us, of our Honorable contract to us. So now we can now move to our test proper now. And then if you want to remember, we're writing our unit test. The first thing we did was to declare our test, um, keyword.
89:48 E: That's keywords.
89:50 A: Um, and then we say, you know, still the same, you know, let's say test So the first thing, okay, let's, okay, let's test initial data. So, you know, we are setting our initial data constructor level here. So now our initial, our initial owner has to be this admin address and our initial data has to be 1. So let's write a function to test that this, um, this, um, that this, um, this state we set over here is valid.
90:22 E: So, uh, so let's say test initial data.
90:31 A: So is anyone confused up to this point before I move forward? Are you confused? Uh, David, are you confused? I need like vocal feedback rather than emojis so I can know you're actually following. David, are you confused? David Dada, is David on call? Yes, I'm on the call. Okay, that kind of took you so long to respond. So are you following? Yeah. Any confusion so far? Yeah, I'll watch the playback. Well, I feel it's best to try and catch up, right? And if you have questions on the go, you ask. Yes, trust me, when you say we go back to it, sometimes you end up not going back to it. So try and catch up. So, Banwo, are you confused? Are you confused or we good? So is Fatima a bot?
91:44 B: No, no, I'm not confused. Thank you.
91:51 A: Oh great. So is Fatima a bot?
91:56 E: Uh, anyway, let's go on.
92:03 A: Um, so let's write a function to test our initial data. Um, so let's first, let's first deploy our contract.
92:18 E: Sorry, contract address is now going to be-
92:26 A: so since we already have our helper function to deploy this and it's going to return contract address to us, you can basically just call the function here. And mind you, passing the name of your contract, that's the binary, uh, is it the name of the contract so it can pick it up from the target? It has to be the same. If it's not the same, it's going to fail because it will scream that there is nothing like enable contract. So, and then the next thing is to- we have our contract address now, right? Next thing is to interact with our contract address with our contract with our dispatcher. Um, so let's dispatcher-
93:07 E: oh Lord, dispatcher- let dispatcher equals to, um, our on-the-go trade dispatcher. You can paste this thing here.
93:25 A: So to So what argument does our HoneyBook dispatcher take? Anybody?
93:29 E: Quick response. The contract address.
93:32 B: Thank you.
93:34 E: Contract address.
93:37 A: So we have our, um, we cannot interact with our contracts. Our dispatcher is now set up, right? So let's say, uh, so now we need to check, we want to test our initial data, right? So we need to check, let's see, let's see our initial data in a state, in a in a local variable. Let's see, initial-
93:59 E: sorry, it's initial data equals to-
94:04 A: this is how you interact with this dispatcher. So we are getting data.
94:11 E: GetData is a function here. GetData. So this is going to return our data to us.
94:20 A: So you get data. Yeah, that's better. And then let's check our initial owner.
94:28 E: Let's initial owner equals to dispatcher, dispatcher, dispatcher. Sorry, let's see.
94:55 A: Okay, so basically now, basically we know that our initial data is this admin address and 1, the one we passed in here. And 1 here. So if our, if our logic is correct, the initial data has to be 1 and the initial owner has to be this admin address. So, and how can we achieve that? How can we check? Make use of the assert keyword. So let's have, let's have the same admin address over here because we're going to like check it, check this state. So basically we want to like test if if this initial data, this initial owner is equal to this admin address that we passed in our deployment, right? So, and also we are going to like check if, uh, the initial data is 1, the one we passed in, in like the one we had put it in our contract.
95:55 E: So we can easily say assert that initial data is equal to admin address So if false, incorrect, correct admin.
96:17 B: I think that one should be initial owner.
96:22 E: Oh, thank you.
96:24 F: Right.
96:31 A: So then also assert that our initial data is equal to 1.
96:44 E: Incorrect data.
96:46 A: All right, so now let's, let's run our first test. Let's see how it So you can run your test case by just simply running SNForge test. So it's going to like pick up all the tests, all the tests that is inside your smart contract.
97:10 E: So basically we only have one test, so you need to call it just one test. Let's see, that's SNForge test.
97:20 A: Yeah, contract compiles. Okay, all right, so why is it failing?
97:33 E: Nettop deploy not found. Oh, okay, we need to start debugging.
97:48 A: The bug is over here.
97:58 E: I think you have to import deploy, or it's meant to be part of this, uh, it's actually like part of the method on contract.
98:19 D: The way you imported the SNForge_SDT on line 1 and you imported declare, are you just supposed to import deploy also there?
98:30 E: Let's see.
99:08 A: It's not part of its method.
99:10 E: Okay, it doesn't part of from method.
99:19 A: Please, I need, I need more eyes to look at this.
99:22 E: More eyes to look at this. What is possibly wrong?
99:56 A: Are you saying this guy is unused?
99:57 E: Okay. You're saying admin address is unused, which is dumb. Oh, contract has- Yeah.
101:04 A: So now if, if there is one thing I appreciate with Cairo here, most of the errors like it's- they are kind of clear with the error now. So let me show you something. Let me take this off again around here. So now if you check the error message over here, it says something like, uh, the compiler found on the type of contract class that you don't import That's where I got hints that I did not import the contract class struct because deploy method like is meant to be found like in here. So, um, Cairo errors are like quite easy to like trace, you get.
101:56 E: So just always learn to go through the error message first, then debug from there. So sorry, let's run our test again to see if that works.
102:06 A: So yeah, collected one test and then it passed. So that means, um, when we set our state up at our constructor level, everything worked as, um, as expected. So now let's test for, um, another scenario. So, um, let's test for when we set our data. You know, we, we, we- sorry, let's test this function next, this, uh, setData function. We already tested the getData. Let's test the setData function next. So let's not forget get specified the test keyword. We don't specify, it won't pick it up as a test function.
103:06 E: Test set data.
103:15 A: Yeah, so now, um, still the basic, it's still the same, um, also the same Flow. So we can just- let's just copy these 3 lines apart.
103:39 E: Yeah, then let's set data.
103:43 A: So dispatcher.sort So now, mind you, this function is going to fail.
103:57 E: Okay, hold on, let's, let's test this. Let's test it out.
104:19 A: So as you can see, this test, this second test, test said it works. This test failed. Why? Now then, this brings us back to, um, Ekareka. Is it Ekareka?
104:30 E: Yeah.
104:31 A: Question Ekareka asked us earlier, that how will the contracts know the owner from the deployer and the caller of the function, right? So, uh, the beautiful thing with StarkNet Foundry is that It's, um, it's- it opens up methods to, uh, do and stuff certain things. Like, for example, now we want to, like, uh, let's say mock- sorry, say, um, use the address of the admin. Like, more like maybe like, um, like borrow the address of the admin.
105:04 E: What's that?
105:08 A: Like pranking normal Solidity, right? Thank you very much. Yes, thank you for the word. Yeah, more like prank the admin address, right?
105:15 E: So, um, let me see.
105:22 A: Okay, so restart Node Foundry.
105:24 E: We go to cheat codes reference.
105:33 A: So these are cheat codes. Basically, these methods are available for use, like use them anyhow you want, depending on the use case, right? And the guy we need, the cheat code we need over here is this guy over here. So this changes the color of the address for the contract. So now for our, uh, can you see my screen? Is this bold enough, right? Is it bold enough?
105:55 E: No, no, no. Good enough?
106:03 F: Yeah.
106:05 E: Good.
106:08 A: So now we need this cheat caller address. So now we need function- we need this cheat caller address, um, uh, this, uh, this cheat caller address method for us to like, uh, prank the address of, um, of the owner. Right, and this is a method available for us on Stack Overflow. So basically it takes in, uh, targets, right, targets contract address, the caller address, like the caller address you want to, you want to prank, and a span, a span. And how do we know what this guy is? If we have something like a span over here, these are like how you, the ways like maybe debug your, um, uh, your test and the things you need, what you don't need, and stuff like that. And you can see, if you look at CheatSpan, CheatSpan is an enum. It's an enum that specifies how long the attacker should cheat for, uh, whether indefinitely or for a number of calls. So basically, this works- this is going to work for us. Let's copy this guy. So So let's import it.
107:27 E: Let's import the graph from smprotestd.
107:35 A: Is anybody confused? Is anybody confused?
107:44 C: No.
107:49 F: Yes.
107:50 A: You're confused?
107:50 F: Can you hear me? Okay. Yeah. So I have a question about-
107:55 A: yes.
107:59 F: Okay. So I have a question about the contract class I used the other time. Like, what's the use? Because I understand the use of dispatchers and all that, but like contract class, like, What did we get for?
108:13 A: So this guy basically allows us to have access to methods like deploy. So when this contract class was missing, this deploy function- this deploy method did not work because we did not implement the trait in our own smart contract. It has been implemented from StarkNet Foundry, right? So we only need to like bring in the trait into our own local machine for us to make use of the deploy method. So without this contract class trait, we will not have access to deploy method. If you notice, this declare came straight from SMForge STD, right? So, so does deploy. You know, we cannot- we could not import deploy directly from it, just saying we deploy declare the way we imported declare, right? So we needed the contract class trait so that we can have access to the deploy method. So without this contract class trait we cannot have access to the deploy method. It's more like you saying that, um, you want to, uh, you want to call setData without importing EnableTrade. Like, you know, we've been calling, um, we've been calling getData over here, right? This was only made possible because we imported this, our IEnableTradeDispatcher, right? It's almost the same, do you get? So without the contract class trait, which has the implementation of Uh, we deploy, there was no, there was no way we could like, you know, make use of the deploy method on our contract. Do you get?
109:37 F: Yes, I do. Yes. And also, yeah, a follow-up question, right? So yesterday, the, yesterday, Wednesday, so the mentor was like dispatchers, uh, generated automatically for your contract, like each contract, because I see that it's coming from ownable, and we didn't actually declare it in ownable. So it's coming, it's been generated. Like, how is this generation process?
110:06 A: Like, no, that is very correct. That is very correct. Yeah, it's been generated to us under the hood, and believe me, technically we cannot go into the details of how it is being implemented under the hood.
110:25 E: Do you get?
110:25 A: So it's, it has, that has been abstracted. All we have to do is just make it just the same way. If you notice here, if you notice this private function here too, private function we have here, you also have a generate_traits. Every, all this, it generates the traits under the hood for us. We don't have to like necessarily, since we are staying on the application layer, we don't have to like necessarily like maybe know like the into, into, unless you want to like maybe dive deep. into it, then you can go ahead and like check out how it works under the hood. You could take it as a personal project anyways.
110:54 F: Okay, I'll do that. Thank you.
110:58 A: All right, so let's go on. Um, so now we need to prank the address of the admin for us to be able to call this setData function. Uh, so we already imported the cheat caller address. Cheat caller address, right? So the way you use startsprank, right, um, you have to like put it above the function you want to call. Although we can specify the number of calls we want this function to- the number of calls we want this caller to be able to like call, right? Um, but then we start to like specify that, okay, just put it above the function you want to call. And then what are the parameters? It takes the target contract address, then caller address, and a cheat span. So the target is the address you want to interact with, which is this contract address. So this guy over here. Then it takes in, takes in the caller address, the person that you want, want to be the caller of the function. That's the admin here. Then it takes in a span, which is, yeah, just span. Um, So, cheat span is- cheat span is an enum, right?
112:38 E: So let's, um, let's import cheat span over here as well.
112:46 A: Also, to make use of it, we can pass in cheat span. Yeah, so we can set the, uh, You can set it to indefinite, or you can just say, okay, make only this number of calls. So let's just say we wanted to make just 2 calls.
113:10 E: Target and 2 calls.
113:12 A: So if you want it to be indefinite, we can just pass in indefinite over here as well. It does not take in a parameter. Only target calls takes in a parameter- sorry, an argument. I think this should-
113:24 E: this is So yeah, I think this is fine.
113:29 A: So let's test this first. Let's see if it's good.
113:33 E: So if it works first before we proceed with the rest of the test logic. Oh, this is a new column.
114:08 A: Okay, great.
114:08 E: Oh, awesome.
114:09 A: So yeah, we've been able to successfully prank the address of the admin. That was why we were able to call this setData. So we need to be sure that the data actually is correct. So our new data now is going to be 6, right? So we need to like check if truly it is 6 since we are setting it to 6. So let's say let new-
114:34 E: sorry, let newData equals to dispatcher.getData. Let's get data.
114:55 A: So then we can put in a little assert statement over here.
114:59 E: Uh, new data is equal to 6. If it is not, then dataset field. So let's clear this.
115:18 A: We're gonna test over again.
115:33 E: Good.
115:33 A: So yeah. Our test works now. Any confusion up to this point?
115:39 D: No, I kind of lost it from where we started using this sheet thing. Okay, I don't know if you could quickly run through it again.
115:56 E: I'm sorry, please. No problem.
115:59 A: So Jake's caller address is a cheat code, like a cheat sheet from StarkNet Foundry. It has been implemented already on StarkNet Foundry. All you can- and then you have access to make use of it in your test file, right? So basically what it does is to, is to mock the address of the caller, like the person you wanted to be the caller of that function.
116:20 E: It pranks it.
116:22 A: It's, it works, it works similar ways the way startPrank, stopPrank works in Solidity. So this guy allows you to, um, prank an address that you want it to- I want to be the caller of a particular function. So now we want this admin address to be the caller of this function, right? So we can invoke the cheat caller address method, passing the target caller address you want to, like, you know, you know, you want to interact with, passing the person you want it to be the caller, and then passing the cheat span, like the span, um, argument. So basically, this span argument- the span argument is for the document. You can see it from documentation, like over here. It takes in a CheatSpan, right? It takes in the span. It takes in 3 arguments: target, caller address, and then span, right? And then we further now, you know, when we search span here, of course, and we further now find out, okay, what exactly is this CheatSpan? So we found it over here. Then we realized that CheatSpan is an enum that has 2 options. You know the way enums work? if there are options, it's either A or B depending on the definition of the enum. So we have- it's either we say, okay, it is, um, we want to choose indefinite, we want the caller to like call an indefinite number of functions, or we want the caller to only call a few or a particular, a certain number of functions. So then we pick the target call. So let's say we want to pick indefinite now. Let's say we pick indefinite now. Yeah. If we pass in CheatSpan, and don't forget we first imported CheatSpan from StackNet Foundry. This CheatSpan, we imported it here first because of course it is a method in StackNet Foundry, right? So we first imported it and then let's pass in one of the options inside the handler which is indefinite. You know we made use of target calls earlier, so let's make use of indefinite and see if that works. So now, by implication, when we set this, that means the caller of this setData function is going to be the address that we specify in here, which is the admin. And we expect it to pass. So is it clear now, um, Emmanuel? Emmanuel, Ocalo asked the question.
118:45 D: Yep, it's clear.
118:47 E: All right, awesome.
118:49 A: Sorry, I just want to see like- sorry, I just want to see where you imported your, um, CHIDS Scholar address from because when I did it on my, on my system, it keeps failing.
119:00 E: I don't know why. Okay.
119:04 A: StackNet SM4 yesterday. That's the same thing.
119:08 E: I don't know, boy.
119:09 A: If I do startsprank, it works, but if I do this cheat squad, I don't know why it doesn't work. Oh, what's the version of your StackNet Foundry? I'm using the latest version. There has been upgrades. Startsprank works on previous versions. Okay, okay. Let me try and upgrade this then.
119:25 E: Yeah.
119:28 A: So, um, Any other confusion from here? I mean, at this point, I need the- I need a, um, I need verbal feedback. Any other confusion from here? Are we all good?
119:51 E: Yes, sir.
119:54 B: Yeah, we're good.
119:57 A: So let's test one more, um, one more test, one more scenario. Um, okay, so let's test if a fake admin tries to-
120:10 E: um, wait, hold on.
120:12 A: Okay, let's test this. If a fake admin tries to like, uh, maybe interact with set data, right? So It's basically this, this guy is basically this guy. We want to like make sure that no other admins can, uh, can call this set_data function. So let's, let's just copy this function here.
120:35 E: So, so let's call it test Test fake admin set data fields, right? So technically, let's replace this guy with fake admin. Let's say fake admin address. And let's call this fake admin.
121:17 A: So it deploys, sets the admin, blah blah blah. Then let's copy this. And, uh, you want this fake admin- I just- this fake admin should be the one to like call this, um, function, right? So let's delete this.
121:31 E: Oh no, let's, let's leave it.
121:39 A: Let's see, let me say, um, so since the data will remain unchanged, so just to be sure that, um, just to be sure that the data we set at deployment remains the same. So let's say data check, and the data check is 1. The initial data we set at deployment is 1. So let's- and So by implication, if this, if this function should go through, right, and the person is able to like set data to 6, then there's a very big problem with our contract. There's a very big vulnerability with our contract, right? So this is meant to fail. So, uh, let's clear this. So as you can see that, okay, one of the tests failed with the error caller is not the owner. So that means yes, our smart contract, our contract works, right? But then there are better ways to handle all the failed tests, right? If you can remember, if you can, if you can remember when we're talking about our unit tests in entries, right? We had, um, we had an option that allowed us to test- to test-
123:05 E: where is it?
123:07 A: And an option that allowed us to- give me a moment, sorry. We had an option that allowed us to ascertain that, okay, this test should fail. You should like panic, right? It's instead of like, you know, handling, okay, failed, failed in your console and stuff like that. Better ways like handle this. So we need to expect the panic message, right?
123:33 E: So let's set it over here.
123:38 A: So sorry, I just- So yeah, but then mind you, we're expecting this, this, um, function to fail like this, right? But then we want to like make sure that we don't get this fail, um, message in our console. So we're expecting that caller, it should return an error saying caller is not the owner.
124:12 E: So if we copy this and paste this in here And then run it all over again, then we would have handled our field error message properly.
124:25 A: As you can see now, we no longer have a field test again because we already told the compiler to expect that Okay, for this test, return an error saying the caller isn't the owner. So it's already like programmed, okay, once this test runs and then it returns that caller isn't the owner, then you can pass. Uh, so guessing this, this is, uh, settled.
124:56 D: So can we test the enums to see if they emit what we expect? Is there a way we can test that?
125:08 E: Oh yeah, that's true. We can actually do that. I have to like take- sorry, give me a moment.
125:43 A: So let's do this. Let me send something in the chat box. So I just sent something in the chat box.
125:59 B: in your-
126:00 A: it's actually going to be part of your, what's it called, your exercise. So go on the documentation and figure out how to test smart contract events. So although I still have-
126:12 E: I have an exercise for you guys to like do like right now, like right now.
126:17 A: I'm going to push this contract. Okay, let me do this. I'm going to create a Git file, a gist file right now. I'm going to, uh, paste in the, the Cairo contract and then the test contract, right? And you guys are going to write 2 more functions- I mean, sorry, 2 more test cases. Yeah, 2 more test cases. One is-
126:46 E: okay, hold on, let's have it over here. Wait, are we-
126:53 A: are we- were we coding along?
126:54 F: No.
126:57 D: No.
126:58 E: Okay, so I'm going to push this way. Um, to do so, uh, say, um, One, um, write, write the following test cases. Test if transfer ownership reports. Trans ownership box.
128:21 A: Then also test if transfer ownership.
128:37 E: Fine. If admin works, so our test scenario can we test? Um, Okay, and the take-home.
129:04 A: So you're going to- you'll be doing this within these 2 on call right now. On call right now, I would have only about, um, say 30 minutes to get that done, right? Only about 30 minutes to get that done. So you have to think fast. You only have 30 minutes to get it done. Um, so then the take-home, this one will be submitted today. Is what today is?
129:28 E: Friday.
129:29 A: So this is going to be submitted, um, tomorrow. Sorry, you have a class tomorrow, right?
129:35 E: Uh, no, no, no.
129:39 A: Okay, beautiful. So, um, this is- this second one is going to be submitted, uh, tomorrow by 4 PM. Any submission?
129:52 E: Hello, sir.
129:53 A: What's that?
129:54 C: Sorry, sir, I, I, I really like to come here and please, because, um, I, I, I don't know about others, but I, for instance, I still have, um, um, last week we had, um, some outings and stuff and stuff. So my catching up with Cairo is still a bit behind. It's, it's because of the assignment I'm, I'm speaking. It's, it's, it's, it's still a bit behind. And not to talk of this, the fact that we have like 2 hackathons that are closing in. I know it's not like we are submitting and we are sure, but then it's just, we are trying to just push to just make sure that we have it submitted. And that's, and then we have another one to be submitted. So I don't know if you would actually give us more time so that we can actually put much effort in making sure that we get to, we don't want to just rush it and just do it just for doing's sake and have it done. But we, we want to make sure that we know it and we know it well. So if you could actually give us time so that we can clear out all our- in fact, we still have, um, one assignment from Wednesday that I, I've never even touched it. There's another assignment again that I've never even touched, and I just have to plead, like, if you could just temper justice with- temper mercy with- temper- I don't even know. One temper sha. Temper our patience. Anyone, just Yes, sir. So if you could just help us, please, please, sir.
131:24 E: Okay, um, no problem. Hold on a moment.
131:53 A: So, um, I understand your concerns, right? It's one of the reasons why you're in Berkeley Bridge.
131:59 E: You get-
131:59 A: you need to learn how to multitask. But, you know, given the fact that you completed and stuff like that. So you can all submit it tomorrow by 4:30 instead of 4 PM. I think that's fair. So give me a moment, let me push this to GitHub Gist.
132:19 E: Uh, I need to log in my details first. What is it? Okay.
133:17 A: So yeah, you are doing this on call right now and you have to like think fast. You have only 30 minutes to get it done and then you push it to You create a gist, push it up, then you submit it on your- I'm not on-
133:33 C: who is-
133:34 A: I'm not on your Telegram group page. Um, are you an admin on Telegram group page?
133:42 E: Yeah, I'm trying to reach out to the admin to add you to it.
133:54 A: Is that fine? So do that. So yeah, yes, so do that. Um, so that once the- once you guys are done, you submit it like there, then we'll review it within 5, 10, 15 minutes.
134:09 E: Cool.
134:11 A: So I think I should stop recording now.
More from this hub
- Web3Bridge Weekly Update Vlog 3
- Web3Bridge Weekly Update Vlog 2 1
- Web3Bridge Weekly Update Vlog 1
- Web3Bridge Experience Uche
- Web3Bridge Experience Vicentia
- Web3Bridge Experience Tosin
- Web3Bridge Student Experience
- Web3Bridge Experience Mitchell
- Web3Bridge Experience Abiodun
- Web3Bridge Live Stream
- Web3 Lagos Conference 2022
- Web3Bridge 3rd anniversary Documentary
- Meet The Students of Web3bridge Cohort 09 - Part I
- Meet The Students of Web3bridge Cohort 09 - Part II
- Cohort 09 Week 01 Students' Report
- Cohort 09 Week 02 Students' Report
- Question & Answer Session With Vitalik Buterin
- Pushing the boundaries of Web3 UX - Richa Joshi
- Implications of the National Policy of Blockchain in Nigeria on the growth of the Web3 ecosystem
- Cohort 09 Week 03 Students' Report
- Cohort 09 Web3bridgers in Class
- Understanding Blockchain For Beginners - Hezekiah Suleman
- Exciting Insights: Students Reflect on Their Week 04 Learnings!
- Taking a Breather: Our Students Stepped Away from Classes for Conference and Workshop Week 05
- The Students Share Their Eviction Test Experience Week 06
- The Students Spent The Whole Week Building Projects Week 07
- An Introduction to Web3 Frontend: Students Sharing Their Experiences Week 08
- The Students Talk About The Dapps They Built Week 09
- Web3bridge Odyssey: Documentary Telling The Story of Web3bridge
- Exploring Foundry: Students Share Their Learning Journey Week 10
- Students Explain Diamond Standard (EIP-2535) | Week 11
- Smart Contract Code Review: The Students Share Their Experience Week 12
- Students Share Their Experience With Smart Contract Security Class Week 13
- Starting & Building a Career in Blockchain - Michael Jerry
- Web3: Community & Protocol - Ayodele Aransiola
- Understanding & Contributing to DAOs - Odebunmi Fiyinfoluwa
- Hacking distribution for web3 startups - Olatinwo Barakat Anuoluwa
- How crypto can regenerate the world - Kevin Owocki
- The Future of Work in a Decentralized World - Emmanuel Tope
- Blockchain for Africa: Why we should care - Amarachi Amaechi
- Web3bridge Cohort X Onsite Arrival Footage
- Meet The Faces of Cohort X: Introducing The Students of Cohort X - Part I
- Meet The Faces of Cohort X: Introducing The Students of Cohort X - Part II
- Meet The Faces of Cohort X: Introducing The Students of Cohort X - Part III
- Centralized vs Decentralized Networks: Insights from The Msg Senders
- Team ZK Shares Their Knowledge Concerning Smart Contract and It's Advantages
- Happy International Women's Day From Web3bridge
- Our Students Share Insight to What Consensus Mechanism is on Blockchain
- Utilizing JSON RPC as a Communication Protocol for Blockchain
- The Life of a Web3bridger in The Cohort: Abigael Irene Nyangasi from kenya
- The Life of a Web3bridger in The Cohort: Mary Gathoni Wangui from kenya
- Team MsgSender Shares Their Insight on Dapps, What They Learned, and Built
- Team Zero Knowledge Shares Their Insight on Dapps, and What They Learned
- Team Alpha.Eth || Solidity
- Exploring Smart Contracts || Cohort X Shares Insight
- Our Students Break Down Multisig Wallet || Cohort X
- Our Students Explain Mainnet Forking: Mirroring The Live Blockchain || Cohort X
- Exploring Smart Contract Interaction || Cohort X
- A Weekly Recap: What Cohort X Learned at Web3Bridge
- Interacting with Web3: Frontend Development in Cohort X
- Project Week: Cohort X Shares Insights and Emotions on Eviction Test
- Watch Our Students Break Down the Diamond Standard in Blockchain || Cohort X
- Starknet Fundamentals
- Cairo Programming Language I
- Cairo Programming Language II
- Writing Cairo Smart Contract on Starknet I
- Writing Cairo Smart Contract on Starknet II
- Check out what our ZK masterclass students said about their experiences in the program.
- Starknet Architecture
- Frontend Interaction With Cairo Smart Contract on Starknet
- Quick Review: Understanding Account Abstraction in Blockchain
- Quick Review: EIP-4844 Proto-Danksharding on Ethereum
- Quick Review: Blockchain Layer Two Solutions Explained
- Quick Review: Oracles in Blockchain Technology
- Beyond Web3Bridge: Ayomide Adebara’s Success Story
- Beyond Web3Bridge: Casweeney Ojukwu’s Success Story
- Beyond Web3Bridge: Etim Paul’s Success Story
- Beyond Web3Bridge: Faith Robert’s Success Story
- Beyond Web3Bridge: Emmanuel Glory Praise’s Success Story
- Beyond Web3Bridge: Chinonso Idogwu’s Success Story
- Beyond Web3Bridge: Ginika Chinonso’s Success Story
- Beyond Web3Bridge: Mayowa Obisesan's Success Story
- Beyond Web3Bridge: Mitong Dapal's Success Story
- Beyond Web3Bridge: Musa Abdulkareem's Success Story
- Meet The Faces of Cohort XI: Introducing The Students of Cohort XI - Part I
- Meet The Faces of Cohort XI: Introducing The Students of Cohort XI - Part II
- Meet The Faces of Cohort XI: Introducing The Students of Cohort XI - Part III
- Meet The Faces of Cohort XI: Introducing The Students of Cohort XI - Part IV
- Meet The Faces of Cohort XI: Introducing The Students of Cohort XI - Part V
- Web3 Lagos Conference 2024: Innovation, Networking & Game-Changing Insights - Day 1 & 2 Highlights!
- Web3 Lagos Conference 2024 Recap: Innovation, Hackathons, and Blockchain Breakthroughs!
- Supercharging user onboarding; Building with social logins and smart wallet - Ayomitan Pamilerin
- Web3bridge Journey; A look into the Future - Ayodeji Awosika
- Mental Model for Building Smart Contracts on Bitcoin - Abimbola Adebayo
- Beyond DX; Building World Class Developer Documentation for Web3 - Owanate Amachree
- DAOs and Onchain Governance - Fiyin Odebunmi
- Build In Public; The Web3 Advantage - Kevin Chibuoyim
- Building Scalable Dapps - Israel Rex
- Web3bridge Students (cohort 11) Share What They’ve Learned: What is blockchain?
- Web3bridge Students (cohort 11) Share What They’ve Learned: Understanding Ethereum
- Web3bridge Students (cohort 11) Share What They’ve Learned: Nodes and Clients
- Web3bridge Students (cohort 11) Share What They’ve Learned: Consensus mechanism.
- The Future of Data in Web3 - Ivy Elebesunu
- Empowering Underserved Markets Onchain An Exposition to Real World Assets RWAs - Oluwole Kayode
- Introduction to Blockchain - Hezekiah Suleman
- Real World Assets Fluke or For real - Emmanuel Tope
- Science on the blockchain - Introduction to Decentralized Science - Scott Itepu
- Product Roadmaps and Team Management in a Decentralized World - Adedoyinsolami Adeyeye
- The Role of Social Media in Building Web3 Communities Best Practices and Pitfalls - Amara Achusi
- Working as a writer in Web3; How to build their brand - Toluwalope Ajetunmobi
- A DePIN protocol for unlocking Africa's solar energy potential and solving Energ - Ifeanyi Christwin
- Introduction to Arbitrum - Oluwafemi Samuel
- Web3 UX from a Wallet point of view - John Odey
- How to write content that connects with Target audience - Victor Fawole
- The Role of User Experience in Web3 Adoption - Favour Ohanekwu
- Building a Career in Web3 - Purity Ogheneochuko
- Scroll Technical Workshop - Wisdom Ogwu
- Web3 Documentation Best Practices - Lessons from Rootstock - Wisdom Nwokocha
- Interchain applications Cosmos and the IBC - Peter Anyaogu
- Developers guide to building on Solana - Alex
- Future of Wallet and Custody - Peter Olawuyi
- Field Notes from the Trenches - Ukeme David Eseme
- Web3bridge Students (cohort 11) Share What They’ve Learned: An Account
- Web3bridge Students (cohort 11) Share What They’ve Learned: The EVM
- Web3bridge Students (cohort 11) Share What They’ve Learned: Public and Private Keys
- Web3bridge Students (cohort 11) Share What They’ve Learned: Transaction
- Web3bridge at 5 Full Documentary | Ayodeji Awosika on the Web3 Journey and Growth
- Invariants Testing for Smart Contracts in the World of Medusa - Joshua Adesanya
- Improving web3 User experience through chain abstraction - Collins Enebeli
- The Future of Technical Communication in Web3 - Victoria Adedayo
- CoreDAO workshop
- Build On Bitcoin Leveraging Rootstock - Chekwube Peters
- Building Scalable Web3 Applications - Amani Kanu
- The Future of Social Media for Blockchain Startups - Motolani Omotuyi
- Buidling Decentralized App quickly - KC Pele
- Building the Future Decentralized Computing Infrastructure for Web 3.0 - Uchechukwu Azubuko
- Understanding the Lisk Protocol - Lisk Workshop
- ZK Workshop - PSE team
- From Ancestors to Algorithms Harmonizing Trust Based Cultures - Abidemi Adenle
- DeSci Web3 and the Future of Scientific Collaboration - Daniel Anomfueme
- Exploring Career Paths in Web3 An Introductory Guide for Beginners - Glory Praise
- Building beyond the Hype - Titus Adenugba
- The Future of Digital Trust Leveraging Ceramic for Global Trust System - Kenechukwu Orjiene
- Building a Global Web3 Community - The SuperTeam Case Study
- Meet Push Notification - Push Ambassador
- Introduction to DEXPAY
- Understanding the East African Ecosystem - David Lumala
- Web3bridge Students (cohort 11) Share What They’ve Learned: Building Function Modifiers
- Web3bridge Students (cohort 11) Share What They’ve Learned: EVM Explained
- Web3bridge Students (cohort 11) Share What They’ve Learned: Account
- Web3bridge Students (cohort 11) Share What They’ve Learned: Wallet
- Web3bridge Students (cohort 11) Share What They’ve Learned :Contract structure
- Web3bridge Students (cohort 11) Share What They’ve Learned: Function Visibility
- Web3bridge Students (cohort 11) Share What They’ve Learned: DApps
- Web3bridge Students (cohort 11) Share What They’ve Learned: Deploying a Smart-Contract
- Cohort 11 Student Shares How Our Training Facility Fuels Success: Meet Akinwunmi Akinrimisi.
- OFFICIAL PARTNERSHIP ANNOUNCEMENT
- Cohort XI - Eviction Week
- Web3bridge Students (Cohort XI) Share What They’ve Learned: Interface, Interaction & Mainnet forking
- Web3bridge Students (Cohort XI) Share What They’ve Learned: Multisig Wallet
- Web3bridge Students (Cohort XI) Share What They’ve Learned: NFT Gated Event Contract
- Web3bridge Students (Cohort XI) Share What They’ve Learned: NFT Gated Event Contract
- Web3bridge Students (Cohort XI) Share What They’ve Learned: ABI
- Web3bridge Students (Cohort XI) Share What They’ve Learned: Intro to REACT
- Web3Bridge Journey: A Ugandan Student's Path to Blockchain Excellence
- Web3bridge Students (Cohort XI) Share What They’ve Learned: JSON RPC and Ethereum JSON RPC
- Web3bridge Students (Cohort XI) Share What They’ve Learned: Wallet, Providers and Signers
- Web3bridge Students (Cohort XI) Share What They’ve Learned: Advanced DApps
- Web3bridge Students (Cohort XI) Share What They’ve Learned: IPFS & IPNS
- Web3bridge Students (Cohort XI) Share What They’ve Learned: MetaMask & MetaMask SDK
- Web3bridge Students (Cohort XI) Share What They’ve Learned: Multicall
- Web3bridge Students (Cohort XI) Share What They’ve Learned: Subgraph
- Web3bridge Students (Cohort XI) Share What They’ve Learned: Calls
- Web3bridge Students (Cohort XI) Share What They’ve Learned: Diamond Standard
- Web3bridge Students (Cohort XI) Share What They’ve Learned: EIP 2535 Diamond Standard
- Web3bridge Students (Cohort XI) Share What They’ve Learned: Upgradeable Smart Contract
- Meet The Faces of Cohort XII: Introducing The Students of Cohort XII - Part I
- Meet The Faces of Cohort XII: Introducing The Students of Cohort XII - Part II
- Meet The Faces of Cohort XII: Introducing The Students of Cohort XII - Part III
- Meet The Faces of Cohort XII: Introducing The Students of Cohort XII - Part IV
- Web3bridge Students (Cohort XII) Share What They’ve Learned: Cryptography, Ethereum, and Wallets.
- Web3bridge Students (Cohort XII) Share What They’ve Learned: Solidity, Functions, and Data Locations
- Scroll Meets Web3Bridge: Exclusive Talk with the Founder!
- The Visit!
- Web3bridge Students Share What They’ve Learned: Blockchain, Distributed Ledger & Consensus Mechanism
- Lisk & CVVC Labs Visit Web3Bridge: Power Moves in African Web3
- Alumni Spotlight: Wilfred, Co-Founder of Audioblocks
- Alumni Spotlight: Michael, Co-Founder of Coinsafe
- This Man's Determination Will Leave You Speechless - Alumni Spotlight EP3: Casweeney Ojukwu
- Breaking Into Tech as a Woman - Alumni Spotlight EP4: Glory Praise Emmanuel
- From Machines to Code | Switched Gears into Tech - Alumni Spotlight EP5: Olorunsogo Banwo
- Web3: Get Rich Quick or Game Changer? – Alumni Spotlight EP6: Ayomitan Pamilerin
- Web3 Lagos Conference 4.0 Is Coming! Africa’s Biggest #web3 Event
- Introducing the Web3Bridge Cohort Xiii students
- DeFi Diaries: Building Wealth Community and Resilience in Web3
- The Future of Privacy - Olayinka Oshidipe
- The Future of Payments: From Card Swipes to Stablecoins - Iyanu Faleye
- Blockchain-Enabled AI for Smart Grid Optimization in Africa - Nnamdi Onuigbo
- Introduction to Arbitrum and the Arbitrum Technologies - Olatunji Samuel
- Data-driven Community Building: Metrics that Matter in Web3 - Mfonobong Umondia
- Panel Session VI: How Stablecoins are Powering the New Pan-African Economy.
- From ChatGPT to ChainGPT: Shipping Autonomous Agents on Ethereum - Opeyemi Stephen
- Understanding and building on Polkadot - Bekka
- Panel Session IV: Onchain data or Community-led Models: Which works Better for Today's Market?
- Panel Session II: From Grants to Growth Capital: The Evolving Web3 Playbook For Web3 African Founder
- Designing for Web3: Crafting Useful Products, Beyond DAOs, DeFis, and Wallets - Mercy Kolapo
- Understanding Qubic - Israel Qubic
- Developer Experience Done Right: Proven DX Strategies to Onboard and Retain More Developers - Joshua
- Dexpay Showcase
- Bridging Traditional Fintech with Decentralized Finance - Motunrayo Koyejo
- Composable Yields - Peter Anyaogu
- A Guide to Crypto Data Analytics. Building Your First Dashboard With Dune - Oladayo Oladipupo
- The Vaults Economy: Supercharging Crypto Market Money with ERC-4626 - Olaoluwa Oluwatunmise
- Creating Public Goods: The Missing Link in Your Developer Marketing - John Fawole
- Web3Bridge Turns 6! 🎉
- 6th Anniversary Appreciation
- RWA Tokenization - Ginger Eke-Daniel
- Stop Yapping, Start Building: Real African Contributions to Web3 - Chukwuemeka Uche
- Starknet: Opportunities and how to get started - Faith Roberts
- Stellar and it's Ecosystem - Levai Agbara
- Content Marketing For Onchain Products: A playbook for Builders and Marketers. - Joy Joe
- Beyond Audits: Securing Web3 in the Age of Lazarus - Gracious Igwe
- The State of Onchain UX. Why Crypto Still Feels Broken (How We Fix It) - Nnamdi Ernest
- Inclusive by Design, Compliance by Default. The Blueprint for Web3 Success - Deborah Enyone Oni
- Why Storytelling Matters in Web3 - Gloria Echendu
- Harnessing The Ripple Effects as African Creators - The Content Chef
- Panel Session: Finding the right path to protocol development and growth as a Web3 Developer
- Panel session I: The rise of builder hubs in Nigeria, lessons & opportunity
- The Future of Payments: Spend Crypto like Cash - Amarachi Agwu
- Pathway to Continuous Growth as a Developer || Mayowa Tudonu || Alumni Retreat
- Enterprise Blockchain: What You Should Know and Prepare For || Adebayo Fabamise || Alumni Retreat
- Crypto and Tax in Nigeria: A Practical Guide to the New Rules || Mitong Dapal || Alumni Retreat
- What to Expect from Web3bridge in 2026
- Web3Bridge Cohort XIV Arrival Day Highlight
- Web3Bridge: Not a Shortcut, But a Launchpad
- Meet the new builders of Web3bridge Cohort XIV || PART 1
- Meet the new builders of Web3bridge Cohort XIV || PART 2
- COHORT XIV INTRODUCTION PART 3
- COHORT XIV INTRODUCTION PART 4
- COHORT XIV INTRODUCTION PART 5
- Web3 Lagos Conference 2026 FINALE
- Web3 Lagos Conference 2026
- WAs for African Money Markets and SMEs | Abidemi Ademola @Web3LagosCon
- The Hard Truth: Why Most Nigerian Startups Never Raise Venture Capital | Adeola Adesina
- Why Every Blockchain Needs an Intelligence Layer | Christian Obi @Web3LagosCon
- AI-Powered Infrastructure:Building More with Fewer Servers & Nodes | KC Pele @Web3LagosCon
- Scaling Your Web3 Startup to Mainstream Adoption | Oluwasanmi Timilehin @Web3LagosCon
- Onchain Lending for Productive Assets | Kayode Oluwole @Web3LagosCon
- The Trust Layer for a Trillion Agents: Blockchain, AI & the Next Internet | Ukeme David
- Trust Machines: What Crypto Actually Does for Credit in Africa | Favour Aniogor @Web3LagosCon
- Stablecoins as a Tool for Financial Inclusion | Ajayi Matthew (OnyxFi) @Web3LagosCon
- Tokenization: The Future of Ownership | Solomon Amaechi @Web3LagosCon
- DePIN & Decentralised AI | Panel Session @Web3LagosCon
- The Missing Layer in AI: Incentives, Trust & Accountability | Aishat Suleiman @Web3LagosCon
- Money in Crypto, Life in Fiat | Francis Codex @Web3LagosCon
- Optimizing for AI Agents: Why Founders Must Build for AI, Not Human Eyes | Adugbo Victory
- Decentralization Across Borders | Adetola Ogunsanya @Web3LagosCon
- Stablecoins & the Future of Digital Payments in Africa | Panel Session @Web3LagosCon 5.0
- AI Is Reshaping the Cybersecurity Landscape but How? | Damilola Abiona @Web3LagosCon 5.0
- Scaling Web3 in Africa: Growth Strategies & Adoption | Growth Panel @Web3LagosCon 5.0
- Building Pan-African Payment Rails with Stablecoins | Suleiman Suleiman @Web3LagosCon 5.0
- The Global Builder Pathway: Where Ethereum's Next Applications Come From | Pablo EAG @Web3LagosCon
- Why Every Fintech Is Rebuilding the Same Stablecoin Liquidity Stack | Amadi Chibuotu @Web3LagosCon
- Legal & Compliance in Web3: Navigating Blockchain Regulations | Panel Session @Web3LagosCon
- The Creator Economy with Stablecoins | Ike Orizu @Web3LagosCon 5.0
- Stablecoins Beyond the Hype: Building Africa's Cross-Border Payment Infrastructure | Mercy Emmanuel
- Venture Capital & Startup Funding in Africa | VC/Funding Panel @Web3LagosCon 5.0
Something wrong, or a video you want off this page? Write to wethem.xyz@gmail.com and it is fixed or taken down within 48 hours.
