Different ways of importing solidity files

Hi all,

In the Solidity docs and also in OZ libaries, I mainly find this way of importing :

import "@openzeppelin/contracts-upgradeable/token/ERC721/utils/ERC721HolderUpgradeable.sol";

But in most of the top projects I study on GitHub (PartyDao, Fractional, Aavegotchi etc.), I see this version :

import {
} from "@openzeppelin/contracts-upgradeable/token/ERC721/utils/ERC721HolderUpgradeable.sol";

I do guess that in the second example we can only import specific contracts/interfaces or variable types from the imported filed. But as in 99% of the time you just have one contract or variable type inside the imported file, I wonder why it is still done this way by the devs. Is it for the code clarity ? Because I don't see any difference if you use the first or second version when you have only one object to import anyway from this file, like with the above example using ERC721HolderUpgradeable.

1 Like

For your information, I received a great reply here :