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

CLI: Support Foundry contract naming conventions #906

Closed
wants to merge 4 commits into from

Conversation

ericglau
Copy link
Member

Fixes #902

@ericglau ericglau requested a review from a team October 20, 2023 19:45
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.

I rewrote the tests because we shouldn't test isMatch but findContract instead. Otherwise there's no direct test connection between these tests and the actual CLI

LGTM

Comment on lines +76 to +78
const lastSlash = contract.fullyQualifiedName.lastIndexOf('/');
const fullyQualifiedWithoutPath =
lastSlash >= 0 ? contract.fullyQualifiedName.slice(lastSlash + 1) : contract.fullyQualifiedName;
Copy link
Member

Choose a reason for hiding this comment

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

Also more straightforward as well

Suggested change
const lastSlash = contract.fullyQualifiedName.lastIndexOf('/');
const fullyQualifiedWithoutPath =
lastSlash >= 0 ? contract.fullyQualifiedName.slice(lastSlash + 1) : contract.fullyQualifiedName;
const fullyQualifiedWithoutPath = contract.fullyQualifiedName.replace(/.*\//, '');


function matchesDotSol(contractName: string, contract: SourceContractIdentifier) {
if (contractName.endsWith('.sol')) {
const name = contractName.slice(0, contractName.length - 4);
Copy link
Member

Choose a reason for hiding this comment

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

This is more explicit imo

Suggested change
const name = contractName.slice(0, contractName.length - 4);
const name = contractName.replace('.sol', '')

@ericglau ericglau marked this pull request as draft October 24, 2023 18:55
@ericglau
Copy link
Member Author

Cancelling since Foundry naming conventions are not standard, so should be handled by the caller on the Foundry side before calling the Upgrades CLI.

@ericglau ericglau closed this Oct 30, 2023
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.

CLI: Support Foundry contract naming conventions
2 participants