import styles

https://betterprogramming.pub/solidity-tutorial-all-about-imports-c65110e41f3a

Global Import

The statement below will import all Solidity objects found in “./MySolidityFile.sol”

import “./MySolidityFile.sol”;

“Solidity object” to describe any contract, library, interface, or other constant or variables that you can define at the file level (struct, enum, etc.)

Instead, the Solidity docs recommend specifying imported symbols explicitly.

Import { Something } from “./MySolidityFile.sol”;
  • You can then mention 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