-
Notifications
You must be signed in to change notification settings - Fork 36
/
7comm-aula05.sol
40 lines (33 loc) · 916 Bytes
/
7comm-aula05.sol
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
// SPDX-License-Identifier: MIT
pragma solidity 0.8.20;
contract Status {
bool public isValid;
constructor() {
isValid = true;
}
function notValid() public returns(bool) {
isValid = false;
return true;
}
}
contract Ownable {
address public owner;
modifier onlyOwner() {
require(msg.sender == owner, "Only owner can perform this action");
_;
}
constructor() {
owner = msg.sender;
}
function changeOwner(address _owner) public onlyOwner returns (bool) {
owner = _owner;
return true;
}
}
contract LivroDeBordo is Ownable, Status {
mapping(bytes32 => string) public ownerMessages;
function saveMessage(string calldata _msg) external onlyOwner returns (bytes32) {
ownerMessages[keccak256(bytes(string.concat(_msg, "teste")))] = _msg;
return keccak256(bytes(_msg));
}
}