Reputation:
I'm creating a crowdsale contract that's using open-zeppelin smart contracts and the files i'm using are the base Crowdsale.sol and the CappedCrowdsale.sol extension. So, these both files are importing the SafeMath library: import '../math/SafeMath.sol';.
The question is: Why importing the base Crowdsale.sol does not import the library also? Or should i remove the second import becouse it's only there for the case you only wanted de CappedCrowdsale.sol file?
Thanks!
Upvotes: 2
Views: 1644
Reputation: 1031
You should be able to leave both import statements in place without increasing the size of your compiled bytecode. See the following from the Solidity docs:
import "filename";
This statement imports all global symbols from “filename” (and symbols
imported there) into the current global scope (different than in ES6 but
backwards-compatible for Solidity).
The compiler is loading the symbols from the SafeMath.sol file into the global scope. If there are two import commands they will not double. The will either be overwritten by the same symbols (causing no increase in file size or the duplicate import statement will be ignored). To be honest I am not sure which of the two.
Upvotes: 4