The One Question bounty closes Thursday 10 December.

Join in
We Them Media logo We Them Media Support us

Exciting Insights: Students Reflect on Their Week 04 Learnings!

The picture loads from YouTube. The player loads only when you press Play. Turn on captions in the player if you need them.

A Cohort 9 student recaps factory contracts, which create new instances of a contract, and the salt used for predictable addresses across chains. They also cover storage slot packing, inheritance between parent and child contracts, and the three data locations: calldata, memory and storage.

Not by We Them Media Channel: Web3Bridge. Published Thursday 5 October 2023.

Titles are the owner’s. It plays from their channel.

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:09 A: Web3 Bridge Cohort 9, sponsored by Base.

0:11 B: I'm here to give you a quick recap of my learning experience here at Web3 Bridge. Last week we started off by learning about factory contracts. Factory contract being a contract that helps to create new instances of a particular contract, let's say our main contract, these new contracts created share similar code with the main contract but doesn't share the same storage. While creating the new instance of the contract, we can- if you want the contract address to be deterministic, you set a specific salt in the process called createSalt, or you can just allow it to be deterministic by allowing How do you want to work on the, um, of setting the random contract address?

1:05 C: Slots are, say, it takes a maximum of 256 bits, which is about 32 bytes for each slot. So every slot cannot exceed 32 bytes in no sense. Now there's something called slot packing in the sense that if you have, for instance, a variable of uint128 That means there's another 128 bits left. You have to like make another variable to carry 128 bits, or you still break it down and the EVM node is going to pack it all together and put it in that one slot before going to the next slot.

1:40 D: So if you're using Curate2, in this case we have a, we have a salt. So this is when we have realized the size of having huge, say, some stablecoins like DAI token, and you get Deployed on the same contract address on multiple chains. So like BSC, if you check the Task Runner for DAI, you can see that it is deployed on the same contract address on multiple chains, maybe BSC, Ethereum, Arbitrum, or whatever chain you are looking for. So you get deployed on the same contract address. So this is the idea of curators, how it can use contract addresses on multiple chains.

2:18 E: Inheritance, it has been The name implies inheritance, inheriting something. Um, you know, it has to do with 2 contracts, the parent contract and the child contract. We call the child contract- sometimes they call it derived contract, whereby the child contract can inherit a function from the parent contract. However, before the child contract can To inherit a particular function from its parent contract, the parent contract has to set its function as external. This makes it possible for the child contract to inherit such a function.

3:06 F: When it comes to storage functions or storage in functions, there are 3 primary locations where data can be stored. The first location is the core data, so that is the memory. And the third location is, um, is the storage location itself. So the call data is a special- that's special read-only and non-modifiable area where the parameters of the function- parameters and arguments on a function call is stored. So it is used to hold the- it is used to

3:39 E: hold the input data of the function call. So this is the end of your sharing. My thoughts are generally here. Thank you.

3:48 A: Web3 Bridge Cohort 9, sponsored by Base.

More from this hub

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.