Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Defender: Improve license type handling #1013

Merged
merged 9 commits into from
Apr 22, 2024

Conversation

ericglau
Copy link
Member

@ericglau ericglau commented Apr 18, 2024

For Hardhat, fixes the same issue identified in OpenZeppelin/defender-deploy-client-cli#8
Equivalent to OpenZeppelin/openzeppelin-foundry-upgrades#43
Updates submodule for latest docs from OpenZeppelin/openzeppelin-foundry-upgrades#43

Contracts have SPDX license identifiers, while block explorer verification (e.g. Etherscan source code verification) through Defender SDK requires a format that matches with https://etherscan.io/contract-license-types.

This PR does the following:

  • Infers licenseType based on SPDX license identifier, instead of using the SPDX license identifier directly.
  • Adds a licenseType option which can override the SPDX license identifier.
  • Adds a skipLicenseType option which can skip setting a license type.

Breaking change:

  • If the contract does not have an SPDX identifier, previously the verification sets the license type to be "None" on Etherscan. With this PR, this case would result in Etherscan not showing the license type field at all.
    • If you want the license type to appear as "None", either set your contract to have // SPDX-License-Identifier: UNLICENSED according to Solidity docs, or set the licenseType option to "None".

@ericglau ericglau requested a review from ernestognw April 18, 2024 17:27
Copy link
Member

@ernestognw ernestognw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

@ericglau ericglau enabled auto-merge (squash) April 22, 2024 14:43
@ericglau ericglau merged commit 0f6bf7b into OpenZeppelin:master Apr 22, 2024
11 checks passed
@ericglau ericglau deleted the licensetype branch April 22, 2024 14:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants