OK, so why don't we go ahead and deploy this contract, see if this contract actually works, if we
can create our own coin and if all these functions are working and I want you to look through all the
code if you've been coding along, right.
Are we forgetting something?
Because I actually forgot one thing when I just reviewed it now and I'm looking at it, I'm like, oh,
wait a minute.
Something very important.
Very, very important.
And it has to do I'll give you a hint.
It has to do with our event.
Now, we say that events allow the clients to react to specific contract changes that you declare.
Right.
But let's specify this even more.
So what really is an event?
What really is an event?
Well.
Let me just play something and for you to read here.
Oops, you're not going to read that.
All right, so an event when we think of an event, we're thinking about two things.
We need to omit an event, first of all.
So we set up the event and then we need to minute.
And what does the event actually keep?
Well, it stores arguments, right?
And these are the argument arguments address from address to and the amount, and these logs are actually
stored on the theory and block chain and they're accessible using the address of the contract till the
contract is present.
But what are we missing in this contract?
In our function, right, A.N. function, what are we missing, what we forgot to do here is we forgot
to actually omit our event and we want to omit the event after we when we send our function and our
function.
Right.
Because when we send after it's been sent and it's been sent.
So that's where we want to actually omit our event.
And so in order to minute, we want to do is we use the omit key word.
And this is quite a standard pattern, right?
When you create an event, then you need to omit that event.
So we're going to do Ammit and what is the event that we're omitting while it's sent.
Right.
So sent.
And then we bring in our arguments.
What are the three arguments?
Well, remember, for our sense, we have an address from an address to you and an amount.
So what is the address from what we want to send from the person who's calling the contract?
So that would be the message sender right now.
Where do we want to send it to the address to?
Well, we want to send that to what?
We want to send that to the person that is receiving.
Right.
And our function here.
We have an input where we can say who's receiving it.
So that's where we want it to go.
Hopefully that's intuitive, right?
Receiver And then finally, what's the other the final argument is the let me go back.
It's the amount.
Right.
And that makes sense.
Right.
So this should actually look pretty logical.
This should look pretty logical to you when you're looking at this.
You should say, hey, wait a minute, this is an event.
And when we're sending the event, we need to check the three arguments.
So the message sender, who's the message sender?
So the person that's sending.
All right.
The receiver who's receiving and then the amount.
Right.
And that receiver, we're actually going to do that.
And the receiver is the person that we want to receive that amount.
Right.
So that is the final piece of the puzzle that we were missing here.
All right.
And hopefully and hopefully by stopping and adding this all the way at the very end, it kind of ties
the whole thing together.
Hopefully this is now hopefully the contract is now tied together.
All right.
So enough harping on the event in the omitting.
We're going to be creating many events and our final project, we're creating our own decentralized
back.
So we're going to be omitting, transferring, transferring from there's a lot of different events we're
going to look at and we're going to look at them later so you don't have to get to.
So don't get too worried right now.
So don't get too worried or hung up on these events right now.
I just wanted to introduce you to this, and I just want to introduce you to this at the end here at
the end here in a final swoop.
All right.
So let's go ahead and actually deploy.
So let's save make sure we're not running into any errors.
And, you know, when you hit Command s, it's the same thing as compiling, right?
It's you know, you see me hitting the compile sometimes command s, but it's the same thing.
So we click compile.
All right.
So we've successfully compiled.
All right.
Let's switch to the JavaScript VM Berlind.
So I'm going to add some fresh accounts.
We got ten fresh accounts.
Make sure we're on the first account over here.
Let's actually copy the clipboard from the first account, from the first account here.
Now, let's go ahead and deploy.
Let's deploy this contract.
All right.
It looks like we have successfully deployed the contract.
And if you look, we have a successful transaction and now we have our two functions.
We've got a main function and a SEN function.
All right.
So we've got two functions over here.
Mensen send.
Awesome.
So let's see if this works, let's see if things are working.
All right, let's say we go we go to an account.
Let's say we switch up here and we switch to the fourth account.
Let's copy this now, let's say from the fourth account in the fourth account, we want to mint ourselves
a bunch of tokens right where the fourth account.
So we're going to copy and paste the fourth account here from our fourth account.
And we want a thousand.
You know, actually, we're feeling greedy.
We want 10000.
So we're going to click on Transact.
What do you think's going to happen when we click on Transact and notice that we get a reversionary?
We can't actually meant we can't actually meant all right.
Now, why is that?
Why is that?
Well, what if we switch to the second account?
So we go to the second account.
All right.
We're going to count number two over here.
Let's copy this and let's meant for ourselves in the second account instead from the second account.
Ten thousand tokens to transact.
Error, error again.
Well, what's going on here, what's going on here?
How can my comment I thought Clarian whoa, I thought you said this was going to work.
It's not working.
All right.
Well, what if we switch to the first account, to the first account, the account that created the
contract?
Right.
Let's pass this in and we're going to mint 10000 for ourselves.
So the receiver is going to take the same contract.
All right, let's see that and let's transact.
Boom, would you look at that, we have a successful transaction, so what happened, what happened
here?
Well, hopefully you figured it out, right?
Hopefully you're like, all right, I get it.
I get it, Clarient.
But if you're not sure, just think about it.
We created a mint function, but we required that the message sender equals the mentor.
Right.
And we set our mentor and we sent our mentor to equal the message sent to equal the message sender and
our constructor.
So when we deploy, the mentor gets the message sender address.
Right.
And then message sender has to be that has to be that person who's calling.
So by doing this, we actually create a security protocol where nobody else can nobody else can mint
new coins except for us.
We're the ones who created it were the only ones who are allowed to make new coins.
That is rule number one.
You know, these are your tokens.
You don't want anyone just to be create other people to make your tokens.
So now we're feeling generous, right?
We've got 10000 tokens we can make as much as we want.
We're like the feds.
We're just gonna start printing.
So let's go ahead and try something else.
Let's go to the second account.
Let's copy the address.
Let's go back from our Message Sender account.
Sometimes my thing freezes up back to the first account like that.
Let's paste this in the second address and let's send our second address, our friend Timmy Hatemi over
there, 10000.
Look at that, Timmy now has 10000, Timmy now has 10000, right.
And so now Timmy should actually have 10000.
So let's say we switch to the second account.
Let's be Timmy for a second.
So Timmy has 10000 tokens now.
So Timmy can say, hey, wait a minute, this is great.
I got 10000.
But, you know, I need to pay my rent.
I'm going to just I'm going to send 5000 to uni swopping, get some cash out on exchange or I don't
know, whatever I need to pay my rent.
So what?
What Tim is going to do, we're going to say that, Timmy, this we're going to say that this account
number five over here, we'll take the fifth account.
We're going to say the fifth account is like a unique swap at a.m. exchange, whatever.
And then we go back to our second account.
Right, because it's got to be from the account that actually has the money.
I'm going to say 5000 of these tokens are going to be sent over to this new address.
Timmy is going to send half of his money out when we hit Transact.
And if you look at that, we have a successful transaction, it works, but what if we want to send
now 50000?
It doesn't work, right, because we don't have that balance, we requested 50000, but if you look
now at a transaction, we can see what's available.
The only thing we have available is 5000.
And we actually set that up and our insufficient balance error message and now it is working as well.
All right.
So this is it.
This is your very own coin.
And if you want to customize this, if you want to do more research, this is a starting point for you.
So go ahead and look at.
So go ahead and review everything, go through all the functioning, go through all the functions.
Remember, we've got our constructor, our minting function or some function.
There's a lot more that we can build right from here.
This is just a setting stone.
This is just the stepping stones.
And we're going to we are going to build when we get to the final project, we're building out fully
simulated Iraqi twenty's right with approval's that hook up to the metal mask and have approval's to
run with transfer from ADTRAN third and third party transferring.
All that's going to come later on.
But if you want to do some research on your own now, read up more on Iraq.
Twenty tokens, read up more on what you would like to add and think about what you would like to add.
What sort of functionalities would you like to add for your own token, for your own contracts?
OK, so make sure everything's working, deploy it, test it out.
And once everything is working, congratulations.
You've created your very own crypto token.
Welcome to the crypto verse.
I'll see in the next video.