Skip to content

Commit

Permalink
Add setERC20() calls in cloneable contract deploy scripts
Browse files Browse the repository at this point in the history
Signed-off-by: Jim Zhang <[email protected]>
  • Loading branch information
jimthematrix committed Aug 26, 2024
1 parent 9158c94 commit 8d0c25f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 12 deletions.
15 changes: 3 additions & 12 deletions solidity/scripts/deploy_cloneable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,8 @@ export async function deployFungible(tokenName: string) {
const { deployer, args, libraries } = await verifiersDeployer.deployDependencies();

let zetoFactory;
const opts = {
kind: 'uups',
initializer: 'initialize',
unsafeAllow: ['delegatecall']
};
if (libraries) {
zetoFactory = await getLinkedContractFactory(tokenName, libraries);
opts.unsafeAllow.push('external-library-linking');
} else {
zetoFactory = await ethers.getContractFactory(tokenName)
}
Expand All @@ -24,6 +18,9 @@ export async function deployFungible(tokenName: string) {
await zetoImpl.waitForDeployment();
await zetoImpl.connect(deployer).initialize(...args);

const tx3 = await zetoImpl.connect(deployer).setERC20(erc20.target);
await tx3.wait();

console.log(`ERC20 deployed: ${erc20.target}`);
console.log(`ZetoToken deployed: ${zetoImpl.target}`);

Expand All @@ -36,14 +33,8 @@ export async function deployNonFungible(tokenName: string) {
const { args, libraries } = await verifiersDeployer.deployDependencies();

let zetoFactory;
const opts = {
kind: 'uups',
initializer: 'initialize',
unsafeAllow: ['delegatecall']
};
if (libraries) {
zetoFactory = await getLinkedContractFactory(tokenName, libraries);
opts.unsafeAllow.push('external-library-linking');
} else {
zetoFactory = await ethers.getContractFactory(tokenName)
}
Expand Down
5 changes: 5 additions & 0 deletions solidity/test/lib/deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ export async function deployZeto(tokenName: string) {
const result = await deployFunc(tokenName);
({ deployer, zetoImpl, erc20, args } = result as any);

// we want to test the effectiveness of the factory contract
// to create clones of the Zeto implementation contract
const Factory = await ethers.getContractFactory("ZetoTokenFactory");
const factory = await Factory.deploy();
await factory.waitForDeployment();
Expand All @@ -58,6 +60,9 @@ export async function deployZeto(tokenName: string) {
}
}
zeto = await ethers.getContractAt(tokenName, zetoAddress);

const tx3 = await zeto.connect(deployer).setERC20(erc20.target);
await tx3.wait();
}

return { deployer, zeto, erc20 };
Expand Down

0 comments on commit 8d0c25f

Please sign in to comment.