Import
Global Import
The statement below will import all Solidity objects found in “./MySolidityFile.sol”
import “./MySolidityFile.sol”;
MySolidityFile.sol could contain multiple contracts; all of them will be imported.
“Solidity object” to describe any
contract
,library
,interface
, or otherconstant
or variables that you can define at the file level (struct
,enum
, etc.)
Instead, the Solidity docs recommend specifying imported symbols explicitly.
Import { ContractA } from “./MySolidityFile.sol”;
You can specify within the curly braces
{ }
the specific symbols/objects that you want to import and use.
Import Aliases
Global Aliases
// longer syntax
import * as Endpoints from “./Endpoints.sol”.
// shorter syntax
import “./Endpoints.sol” as Endpoints;
Specific Aliases
import { Point as Coordinate, GPS } from “./Endpoints.sol”;
Last updated