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

Feat/btpm new deployment scripts #72

Merged
merged 8 commits into from
Feb 6, 2024

Conversation

livingrockrises
Copy link
Collaborator

Summary

Related Issue: # (issue number)

Change Type

  • Bug Fix
  • Refactor
  • New Feature
  • Breaking Change
  • Documentation Update
  • Performance Improvement
  • Other

Checklist

  • My code follows this project's style guidelines
  • I've reviewed my own code
  • I've added comments for any hard-to-understand areas
  • I've updated the documentation if necessary
  • My changes generate no new warnings
  • I've added tests that prove my fix is effective or my feature works
  • All unit tests pass locally with my changes
  • Any dependent changes have been merged and published

Additional Information

Branch Naming

Comment on lines 11 to 24
const entryPointAddress =
process.env.ENTRY_POINT_ADDRESS ||
"0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789";
const verifyingSigner = process.env.PAYMASTER_SIGNER_ADDRESS_PROD || "";
const DEPLOYER_CONTRACT_ADDRESS =
process.env.DEPLOYER_CONTRACT_ADDRESS_PROD || "";

function delay(ms: number) {
return new Promise<void>((resolve) => {
setTimeout(() => {
resolve();
}, ms);
});
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

This should be managed in a central config.ts and not duplicated across scripts

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

DEPLOYER_CONTRACT_ADDRESS and entryPointAddress are applicable to more scripts. Have left them as it is to have control on individual script.
moved delay to utils/

Comment on lines 35 to 37
const BiconomyTokenPaymaster = await ethers.getContractFactory(
"BiconomyTokenPaymaster"
);
Copy link
Collaborator

Choose a reason for hiding this comment

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

use Typechain

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

done

Comment on lines 26 to 33
async function deployTokenPaymasterContract(
deployerInstance: Deployer,
earlyOwnerAddress: string
): Promise<string | undefined> {
try {
const salt = ethers.utils.keccak256(
ethers.utils.toUtf8Bytes(DEPLOYMENT_SALTS.TOKEN_PAYMASTER_V2)
);
Copy link
Collaborator

Choose a reason for hiding this comment

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

It would be better to create a common deployGeneric similar to https://github.com/bcnmy/scw-contracts/blob/v2-deployments-with-config/scripts/deploy.ts#L67 and use it across all scripts instead of duplicating deploy -> verify logic

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

added deployGeneric() in this script and can re use for other contracts in same script (although there aren't any now)


async function main() {
const accounts = await ethers.getSigners();
const earlyOwner = await accounts[0].getAddress();
Copy link
Collaborator

Choose a reason for hiding this comment

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

should verify that this is not null and is a valid address
https://docs.ethers.org/v5/api/utils/address/#utils-isAddress

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

done

@livingrockrises livingrockrises marked this pull request as ready for review January 15, 2024 09:08
@livingrockrises livingrockrises merged commit 2ed359d into develop Feb 6, 2024
3 checks passed
@livingrockrises livingrockrises deleted the feat/btpm-new-deployment-scripts branch February 6, 2024 11:11
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