audio
audioduration (s)
4.91
21
sentence
stringlengths
61
200
looks like and feels like. Let's dive in. This is the Aetherium website aetherium.org We are going to make a transaction on a test Aetherium blockchain I'll explain what that means in a
get the exact same as we see for the transaction fee. So gas price, times how much gas you used, is the transaction fee. So whoever sent us this 0.1 ether, also paid 0.0000525, etc Rinkeby
right here, we have account one was 0.1, Rinckey eath, and account two was zero. Rigby. If I were to send 0.05 Rinckey eath. From this account to my other account, how much rinky
fee is 0.00000004 Go away. And this obviously would be an even smaller number if this was in units of weigh. So if we take this number, and we put it into our calculator, we can see that
of code with the semicolon. We also have bytes objects, or a bytes 32, again, representing how many bytes we want them to be. And this says that we have called favorite bytes, and we're
Not supported with pagination yet
bits is a byte. And we can go up by steps of eight. So we can do 816 32, etc, all the way to 256. For example, down here, we can't do bytes 64. And if we go ahead and try to compile this, we get
something like function, add public here, one plus one, or return, one plus one, this would be turns you into 36,
name, and their favorite number. To do that, we say struct people, you went to 56, favorite number, and a string name. Now we've created a new type called people kinda like you intuited
to let solidity know that we're going to be grabbing from these struct variables, we'll say favorite number is going to be two, and the name is going to be Patrick semicolon, and then we
one I had John, or actually better yet, to Patrick. Seven, John, etc. This is what it would show. But since it's empty, it's going to show nothing. And let's go ahead and remove the public
person. And we're going to take string, memory, name as input parameter, and I'll explain that in a minute. And a un 256 underscore favorite number, we're going to make this a
But let's also add them to our mapping here, what we'll do is we'll say name to favorite number. App key name is going to equal to favorite number. So let's go ahead, compile this.
Not supported with pagination yet
as well. Now, I mentioned this term before, but all this code that we wrote, when we hit this compile button, it compiles it down to the EVM or the Ethereum virtual machine. Don't worry too
UNT 256, underscore simple storage number. There'll be a public auction as well. Now in order for you to interact with any contract, you're always going to need two things. And we're going
we're passing the array index. So we can say simple storage contract at address simple storage array. At index simple Storage index. This bracket notation here is how you access
contracts, we can just access that simple storage contract using the index. So we would say, simple store, Edge array at index underscore simple storage index. Now we're saving the
from the storage factory. So we'll create a function called S F get, which stands for storage factory get, it'll take a un 256 underscore simple storage index. This will be a public view
simple storage array at the simple storage index. And then we're going to do return, simple storage.re retrieve to get that number that we just stored up here. And I should
Not supported with pagination yet
the same thing up here by deleting this part and just doing dot store, underscore simple store edge number, we save it. And this will work exactly the same. Awesome, we
Not supported with pagination yet
up the exact same way we normally would spdx license identifier, gonna be MIT, we'll give it pragma solidity. And we'll just do zero point 8.0 with the carrot. And we'll say contract, extra
Not supported with pagination yet
import dot slash, simple storage dot soul. And we'll say our contract extra storage is simple storage. And we save or compile. Now our extra storage contract is going to be the exact same as
Not supported with pagination yet
public function. And let's say instead of just storing favorite number, we'll say favorite number equals favorite number, plus five. If we try to compile this right now, we'll actually
contract to do. So first, let's set it up spdx license I tend to fire MIT do pragma solidity do caret zero point 8.8. And we'll
we could do something called require, we would say we want to require the message dot value is greater than one e 18. There's a couple of things to unpack here. One, e 18 is equal to one times
10 raised to the 18th, which is also equal to 112345 678-910-1234 5678. This is the value in way of one Aetherium this much way is one eath. So if we wanted the
value we want people to send along with the fund function, we can do that at the top of our contract, we can say you went to 56 public minimum USD equals 50. Now we have some place to check
We're gonna split it up into two steps here. We're gonna say aggregate tour, v3 interface, price feed. So we're creating a variable of type aggregator v3 interface equals aggregator v3
or one raised to the 10th, which is equal to 1123456789 10. Message dot value, though, is going to be a UNT 256. And right now, price is an interval at six. So why did we convert this
say for example, we send one eath or 112345 678-910-1234 5678 eath into this contract, one eath should equal $3,000. So to get the price, we're going to now do the eath price, which is
And now we divide that by 112345678 1-234-567-8910, which equals 2.9. Mmm, II 21, which the calculator kind of messed up them a little bit, but 2.9, not 2.99, ie 21 means this has 21
decimal places. So it'd be 2.1 234-567-8910 1-234-567-8910 one, or 1-234-567-8910 12345678 2900 I 9.99 and a nine. And this is actually exactly the reason why
and our minimum is at least 50. We could do 50 divided by 3000 0.016 eath should be approximately enough. So if we go to our Aetherium converter, and we do 0.016, we'll get how
Well, what we can do actually is we can have get conversion rate be a function of a un 256. So we could do something like Messer dot value dot get convert John, conversion rate. And we can add
our Funmi, we can now import this price converter and attach it to you in 256. So we'll do import that slash price converter, dot soul. And in Funmi, we'll do using price converter for UNT 256. Of
math tester, dot Sol. Now if I create a you int eight, I set it to public big number. And I set this to 255 Oops safe math tester. Let's go ahead and compile safe math tester with
math tester, let's go ahead to play up. If I hit big number, we're gonna get 255. Well, what happens if I create a function called ADD? That sets big number equal to big number plus one?
this list, okay, 1234. How do we get all the elements in this list? Well, we would use a for loop to loop through each one of these objects. So at zero with index would be one at the first
Not supported with pagination yet
ahead and say address under equals funders at the funder index. So now we have this funder address. And we want to use this to reset our mapping. So we're going to say, address
to amount funded at at the funder key is now equal to zero. Because remember, in fund we update the amount. Whenever we fund the contract, when we withdraw the money from the
this variable. So instead of looping through the array and deleting objects, we're just going to say funders equals a new address array, we're going to completely reset the array by
Not supported with pagination yet
going to start it as a completely blank new array. So great, we've gone ahead and reset the array. But how do we
address type. So message dot sender is of type address. Whereas payable, message that sender is of type, payable address, and in solidity in order to send the native
If we hit compile a fun meat outsole, we do indeed see that it's passing compliation. However, there's a bit of an issue here, right now, anybody can withdraw from this contract. So anybody can fund,
Not supported with pagination yet
maybe we want to add a section, maybe we want to say require message dot sender equals the owner, a note about double equals versus equals, you can think of this single equals as a
3000 divided by 50, we can do 50 divided by 3000. So we know that around 0.02 Aetherium, should be enough for this contract to work. So 0.02 Aetherium is this much way, we can copy that,
Not supported with pagination yet
the balance of our contract, and now has 0.02 ether, which makes sense, since we just sent it 0.02. If we put that 0.02 eath in terms of way back into the value section, and we call font
Not supported with pagination yet
again, after this transaction goes through, we should see this number go from 0.02 to 0.04. Now after we wait a brief delay, we do indeed see the balance has gone up to 0.04, which is
exactly what we'd expect. Awesome. So our funding mechanism is working correctly. And if we go down into our array, and our mapping to do address to array, and we paste our address, we should see
to account one, and we hit withdraw, meta mask will pop up, enabling us to confirm and withdraw the ether out of this contract address. Now if we look at this contract address on
reverted. We've completed all the basics of this section that I wanted to go through. And you should be incredibly proud of yourself for
the same thing with our fallback function will have fallback external payable. We'll just have it automatically call fund. Now, if somebody accidentally sends us money without calling
receive function if it exists. But if there's data that doesn't specify any of the other functions, it'll trigger the fallback function Awesome, you've done fantastically to get this far.
then move on to the next step. But I also want you to take at least 15 minutes yourself or be 100% Sure, you exhausted all options, you're completely out of ideas. So typically try to
So step one, tinker. Step two, Google the exact error, I'm going to do a step 2.5 That only is for this class, go to our GitHub, repo discussions, and or updates for this course,
on a forum, like stack, exchange eath and Stack Overflow. Stack Overflow is a question and answering tech forum like this, right? You can ask tech questions, and then you can
Hey, I'm having trouble with remix and an error. Can someone help me? Why is this not a well formatted question? If this is my question, there's not nearly enough information here, I, as a
remote development you can install the whole thing or just remote WsL we're gonna install the whole thing you can follow along to get started with remote WsL if you like, or you can just
this will go ahead and install and VM. After running that, go ahead and trash the terminal, and then reopen it. And then we can type MBM dash dash version to see if it actually installed
right into GitHub, or you can create a new folder for each section yourself and start from blank. And then you would just type code period. And you'd be in a brand new folder. All
Not supported with pagination yet
it's formatted. But what if we, we accidentally do some stuff like this or like this, or maybe even like this, we add a ton of new lines, etc, our code can start to look pretty gross. And
colon brackets. And we're going to do the same thing at the door dot default, or matter. Net we're going to do and then in here, we're going to do e s BENP, that prettier, hyphen VS
log, hi, I hit Save. And I open up my terminal. I can now run Node deploy.js. And it'll print out high node is how we say hey, we want to run this JavaScript code using Node js. Other
just run yarn. So Jas dash dash help, and you'll see it'll spit out a list of all the different options that soft Jas has. You can also run yarn, so Jas dash dash version to just make sure
you should see it in our package dot JSON. Now we can get the ABI and the binary, we can say const, abi equals Fs dot read file sync, which means we're going to synchronously read from
simple storage dot bin. So we're gonna say const binary equals Fs dot read file sync. We're gonna give it the path Hear, which is going to be dot slash, simple storage soul, simple storage dot
Not supported with pagination yet
you can use to deploy contracts. So we're gonna say const, contract factory equals new ethers dot contract, factory. And we're going to pass it, the API binary. And the wallet, we
these wait. And we can actually deploy this contract with ethers by doing const. Contract equals await, contract factory dot deploy. Now, this is the first time we've seen this await
this other stuff associated with it. Great job. You just deployed a contract to your own local blockchain with ethers. Jas. This is fantastic, Awesome work. Now let me show you what happens
actually need to sign this transaction, and then send it to our blockchain. Cons sign, TX response equals await, wallet dot sign transaction, and we can pass that TX object. And then
Not supported with pagination yet
this seventh string is actually seven the number then we can do const. Transaction received equals await transaction response that Wait, one. So we'll wait one block here. This
Not supported with pagination yet
wallet, dot from encrypted JSON sync. And all these commands that we're working with ethers, we can of course, find them in the documentation from encrypted JSON sync takes the encrypted
Dev, which again, we're just going to use yarn, so we're going to do yarn, add prettier, and then prettier plugin solidity. So we're installing both prettier, and the solidity
define what we want for both our solidity and for a JavaScript, so for example, our simple storage has a tab width of 412344 spaces. Maybe we want to change that. We want tab width
Not supported with pagination yet
contract, address, contract dot address. All right, great. Now let's go ahead and run this. So we'll do node deploy dot J. S deploying Please wait, you'll notice this takes a lot longer. Because we're
now let's grab this contract address and go over to Frank V ether scan and paste it in, we can see our two transactions here, we can see we have a contract creation. And we can
also see we call a store function. This is awesome. We've successfully deployed a contract to the wrinkly chain using our own code. Congratulations, this is massive. Now on ether scan,
we're going to import ethers from ethers, we're going to import star as Fs from Fs extra. And then we're going to import dot TMP slash config. And then we're just going to copy these,
once again you can do MK dir, hard hat, simple storage of CC. Now we can cd into hard hat simple storage of CD, and type code, period. And this will open up a new Visual Studio code
Not supported with pagination yet
function. And if you want to just copy paste this from the last section, you absolutely can. So we'll domain that then. Boom, just like that. And because of these semicolons are
Not supported with pagination yet
going to drive me absolutely insane. We're also going to add prettier, and our solidity prettier plugins. So we'll do yarn, add dash dash Dev, prettier and prettier, plug in
Not supported with pagination yet
solidity. Then we can go ahead and create our dot prettier, rc file, we're going to add tab with four, use tabs, false, semi
we're pulling in ethers, we can actually immediately grab a contract factory using ethers. We can say const simple storage factory equals await ethers dot get contract. Factory simple
Not supported with pagination yet
the contract. So we'll do a quick console dot log. Deploy flooring, contract done, and then we'll do Kant's simple storage equals await simple store edge factory dot deploy
Not supported with pagination yet
deployed, contract to. And then we'll add simple storage. That address. Let's run this now. We get deployed contract, and then we get deployed contract to, and then we get a contract address.
really cool. So I should just be able to change the network flag to Rigby now, right? Well, not quite. If you try to run that, you're gonna get invalid value undefined for hardhat config
ahead and try to figure out and debug this error yourself. You're ready. Alright, let's do it. We'll do yarn, hard hat, run scripts, deploy dot j s, dash dash network Rinkeby. And we get
our code, we'll do yarn, add dash dash Dev, at nomic, labs, slash hard hat slash hyphen, ether scan. Now that we have this plugin, we can go to our hard hat dot config, scroll to
the top and add this plugin do require at nomic labs slash hard hat, ether scan. Now that we have this plugin, the hard hat documentation has some more information about the usage, how
lowercase that includes already there. If five, then we're just going to console dot log already verified like that. Otherwise, we're just going to console dot log e. The
Not supported with pagination yet
be verified, we can actually get network configuration information by importing a network like this. And we can do something like console dot log network dot config. Now, if I
Not supported with pagination yet
if our ether scan API key exists. So we can also in here is site and this double ampersand means and we can say process dot e NV dot ether scan API key. This is some Boolean
Not supported with pagination yet
interpolation, current value. And then we'll go ahead and update the current value by doing cons. Transaction response equals await simple storage, that store will store the number
dot retrieve. Then we'll do console log. The added value is updated value. Awesome. And this is going to be our whole script.
being verified. This is awesome. This is perfect. We've now got a successful deploy dot j s script that can deploy, verify, and then interact with our code. This is fantastic. This hard hat
thing into a variable, we could have said instead, we could say const verify is going to be an async function that takes contract addresses and arguments. And here's the
then let's do console dot log block number. Or better yet, we'll string interpolate this and say current block number like this. Now though, if I try to run this task, you'll notice
Not supported with pagination yet
we ran a ganache network with a user interface. What we can do in hard hat is run yarn, RT hat node. And what this will do is it'll spin up a node on a local network, exactly the same as
Not supported with pagination yet
await ethers dot get contract factory, have simple storage. And now I can go ahead and even deploy this. So I can even just copy this line, paste it. And if we flip back to our node, we'll
Not supported with pagination yet
weight, simple storage. That store let's do 55 If I hit up twice, I can go back to the simple storage dot retrieve. call that function and I can see my big number has a value of 55.
Not supported with pagination yet
hat network gets cancelled. And close out that too. We can also do yarn, hard hat, console, dash dash network Rinkeby Rigby, or polygon or test net or main net or whatever we want. And we can
README.md exists but content is empty. Use the Edit dataset card button to edit it.
Downloads last month
2
Edit dataset card