dev-protocol / protocol

⛓ Dev Protocol is an open source middleware for creator's sustainability.
https://devprtcl.com
Mozilla Public License 2.0
68 stars 9 forks source link

Change the way import is written #432

Open Akira-Taniguchi opened 4 years ago

Akira-Taniguchi commented 4 years ago

Description

Change the description method from absolute path to relative path

Solution

before

import {Pausable} from "@openzeppelin/contracts/lifecycle/Pausable.sol";
import {IAllocator} from "contracts/src/allocator/IAllocator.sol";

after

import "../../../@openzeppelin/contracts/lifecycle/Pausable.sol";
import "./IAllocator.sol";

reason: Dependencies can't be resolved when referring to a contract after npm install

aggre commented 4 years ago

I think a relative path, similar to a general JavaScript project, would be appropriate. Cause @openzeppelin/contracts will be installed in the user project's node_modules, but essentially cannot be known relative to @devprtcl/protocol.

So, like the following:

import "@openzeppelin/contracts/lifecycle/Pausable.sol";
import "./IAllocator.sol";