-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathimports-exercise.sol
41 lines (31 loc) · 1.04 KB
/
imports-exercise.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
41
https://docs.base.org/base-camp/docs/imports/imports-exercise/
CODE:
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.13;
import "https://raw.githubusercontent.com/avocadodefi/base-camp/main/SillyStringUtils.sol";
contract ImportsExercise {
using SillyStringUtils for string;
SillyStringUtils.Haiku public haiku;
function saveHaiku(
string calldata _line1,
string calldata _line2,
string calldata _line3
) external {
require(bytes(_line1).length > 0 && bytes(_line2).length > 0 && bytes(_line3).length > 0, "All lines must be non-empty");
haiku = SillyStringUtils.Haiku(
_line1,
_line2,
_line3
);
}
function getHaiku() external view returns (SillyStringUtils.Haiku memory) {
return haiku;
}
function shruggieHaiku() external view returns (SillyStringUtils.Haiku memory) {
return SillyStringUtils.Haiku(
haiku.line1,
haiku.line2,
haiku.line3.shruggie()
);
}
}