-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path28_Import.sol
More file actions
36 lines (27 loc) · 713 Bytes
/
Copy path28_Import.sol
File metadata and controls
36 lines (27 loc) · 713 Bytes
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
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.13;
struct Point {
uint x;
uint y;
}
error Unauthorized(address caller);
function add(uint x, uint y) pure returns (uint) {
return x + y;
}
contract Foo {
string public name = "Foo";
}
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.13;
// import Foo.sol from current directory
import "./Foo.sol";
// import {symbol1 as alias, symbol2} from "filename";
import {Unauthorized, add as func, Point} from "./Foo.sol";
contract Import {
// Initialize Foo.sol
Foo public foo = new Foo();
// Test Foo.sol by getting it's name.
function getFooName() public view returns (string memory) {
return foo.name();
}
}