- What is a “MethodID”
- Fallback and receive functions
- External calls
https://docs.soliditylang.org/en/latest/control-structures.html#external-function-calls
https://solidity-by-example.org/function-selector/
- Fallback and receive functions
- External calls
- Attaching “mismatched” contracts
- Why some functions work and others don’t because of the “MethodID”
- Wrapping up contents
- Modifier
- Assertion inside modifiers
- Message Sender
- Visibility
- Mutability
- Implementing basic access control on setText
https://docs.soliditylang.org/en/latest/common-patterns.html#restricting-access
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.7.0 <0.9.0;
contract HelloWorld {
string private text;
address public owner;
constructor() {
text = "Hello World";
owner = msg.sender;
}
function helloWorld() public view returns (string memory) {
return text;
}
function setText(string calldata newText) public onlyOwner {
text = newText;
}
function transferOwnership(address newOwner) public onlyOwner {
owner = newOwner;
}
modifier onlyOwner()
{
require (msg.sender == owner, "Caller is not the owner");
_;
}
}
- Interacting with previously deployed contracts using interfaces
- Inspecting “MethodId” mismatch and fallback functions
- Inspecting execution errors based on assertions
- Fixing the interfaces
- Interacting with other peoples contract
- Handy reference sheet: Solidity Cheatsheet
- Overall style guide: Solidity Style Guide
- Solidity quick guide: Learn Solidity in Y minutes
- Create Github Issues with your questions about this lesson
- Read the references