omgnetwork / plasma-contracts

Root chain contracts for Plasma
Apache License 2.0
112 stars 66 forks source link

Remap the import path if possible #190

Open boolafish opened 5 years ago

boolafish commented 5 years ago

Why

See this PR comment: https://github.com/omisego/plasma-contracts/pull/183#discussion_r307694194

Currently we are using relative import, however, it gets a bit messy with a lot of ../../../.

Also, it is the solidity doc recommendation: here

Always use relative imports like import "./filename.sol"; and avoid using .. in path specifiers. In the latter case, it is probably better to use global paths and set up remappings as explained below.

Note

Whether it is doable (to use the remap function of solc) with truffle is still a question. https://ethereum.stackexchange.com/questions/9459/configure-truffle-compiler-default-import-folder

Successful Criteria

pik694 commented 4 years ago

https://github.com/trufflesuite/truffle/issues/2355#issuecomment-528073949

Truffle team has added support for solidity remappings 🎉

pik694 commented 4 years ago

Remapping still does not work due to a problem in truffle. Even though it accepts the remappings config option, it fails at resolving the files since the Resolver is not aware of remapping possibility. I asked a question on their gitter and will probably file an issue.

pik694 commented 4 years ago

I opened an issue in truffle repository - https://github.com/trufflesuite/truffle/issues/2768.