-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrequire.sol
More file actions
48 lines (31 loc) · 1.36 KB
/
require.sol
File metadata and controls
48 lines (31 loc) · 1.36 KB
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
41
42
43
44
45
46
47
48
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
contract Tech4dev{
/*_name == 'Victoria'
hash of _name == Hash of victoria
1. Create a function Celeron that which takes name
as an input. You should require the name of the input
is thesame with Fawole.
2. Create a function Intel that takes name as an input. You
should require the name of the input is not thesame as Fawole
*/
function Celeron(string memory _name) public returns(string memory){
require(keccak256(abi.encodePacked(_name)) == keccak256(abi.encodePacked("Fawole")));
return "hi!";
}
function Intel(string memory _name) public returns(string memory){
require(keccak256(abi.encodePacked(_name)) != keccak256(abi.encodePacked("Fawole")));
}
/*1. Create a function Spike that which takes name
as an input. You should require that the name of the input
is less than or equal to Dami.
2.Create a function Bonolo that takes name as an input. You
should require the name of the input is greater than or equal to Fash.
*/
function Spike(string memory _name) public returns(string memory){
require(keccak256(abi.encodePacked(_name)) <= keccak256(abi.encodePacked("Dami")));
}
function Bonolo(string memory _name) public returns(string memory){
require(keccak256(abi.encodePacked(_name)) >= keccak256(abi.encodePacked("Fash")));
}
}