Since Solidity 0.6.8, the compiler started throwing warnings if a contract isn't annotated with a SPDX license identifier:

// SPDX-License-Identifier: MIT

contract MyContract {

Now, there's a catch when importing third-party contracts, like those provided by OpenZeppelin or the UnorderedKeySet library built by Rob Hitchens.

We should obviously maintain the license the library author specifies in their repository, but what about flattened contracts? It's common to merge all contract files into one when verifying the source code on a blockchain explorer like Etherscan.

It it okay for a flattened file to contain multiple SPDX identifiers?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.