The One Question bounty closes Thursday 10 December.

Join in
We Them Media logo We Them Media Support us

Web3bridge Students (cohort 11) Share What They’ve Learned: Building Function Modifiers

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

Cohort 11 students describe a week of learning Solidity, including writing a first contract. One then explains function types: pure functions that neither read nor write state, view functions that only read, and payable functions that can receive Ether, with a fundraiser donation as the example.

Not by We Them Media Channel: Web3Bridge. Published Tuesday 15 October 2024.

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:00 A: This video is brought to you by Lix, your official sponsors for Cohort 11.

0:04 B: My experience this week has been awesome, especially in class. We've started programming in Solidity. It's been a bit difficult too, in a way, but we're pulling through, you know, by leveraging on the resources and the videos that have been shared with us.

0:24 C: We were introduced to Solidity and its concepts. And also, I wrote my first contract this week.

0:32 D: We learned how to write Solidity smart contracts and testing with the relevant frameworks.

0:39 B: So unlike asset modifiers that our past colleague has talked about, function modifiers define the behavior of a function. So there are 3 types. We have procure, We have the view and we have the payable function modifiers. So pure functions are functions that do not read from states, nor do they write to states. So they're basically used for calculating or for doing abstract things that would not involve writing to states or reading from states.

1:17 D: So it does not modify the state of the blockchain. Also, when called externally, maybe by a contract, it can cost a little bit of gas. Normally it doesn't cost gas, but when called externally, it can cost a little bit of gas. But when called internally by a contract, it doesn't cost any gas. So that's one of the reasons why view functions, the needs, why it's implemented in writing smart contracts in terms of gas optimization.

1:44 C: So a payable function is a function modifier that allow smart contracts to collect Ether. Now, Ether is the native currency of Ethereum. Also, what payable functions let you do is that they can let developers accept Ether and then perform a particular instruction based on what was written. Now, a basic example of that is a payable function that can collect Ether for donation for a fundraiser. So for more updates on this, kindly like, subscribe, and share. Bye.

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.