Skip to content

Commit a594e07

Browse files
authored
Add download option for upgradeable Foundry package (#346)
1 parent d33453b commit a594e07

File tree

5 files changed

+834
-84
lines changed

5 files changed

+834
-84
lines changed

packages/core/src/zip-foundry.test.ts

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,14 @@ test.serial('erc20 full', async t => {
4949
await runTest(c, t, opts);
5050
});
5151

52-
test.serial('erc721 basic', async t => {
53-
const opts: GenericOptions = { kind: 'ERC721', name: 'My Token', symbol: 'MTK'};
52+
test.serial('erc20 uups, roles', async t => {
53+
const opts: GenericOptions = { kind: 'ERC20', name: 'My Token', symbol: 'MTK', upgradeable: 'uups', access: 'roles' };
54+
const c = buildERC20(opts);
55+
await runTest(c, t, opts);
56+
});
57+
58+
test.serial('erc721 uups, ownable', async t => {
59+
const opts: GenericOptions = { kind: 'ERC721', name: 'My Token', symbol: 'MTK', upgradeable: 'uups', access: 'ownable' };
5460
const c = buildERC721(opts);
5561
await runTest(c, t, opts);
5662
});
@@ -61,12 +67,24 @@ test.serial('erc1155 basic', async t => {
6167
await runTest(c, t, opts);
6268
});
6369

70+
test.serial('erc1155 transparent, ownable', async t => {
71+
const opts: GenericOptions = { kind: 'ERC1155', name: 'My Token', uri: 'https://myuri/{id}', upgradeable: 'transparent', access: 'ownable' };
72+
const c = buildERC1155(opts);
73+
await runTest(c, t, opts);
74+
});
75+
6476
test.serial('custom basic', async t => {
6577
const opts: GenericOptions = { kind: 'Custom', name: 'My Contract' };
6678
const c = buildCustom(opts);
6779
await runTest(c, t, opts);
6880
});
6981

82+
test.serial('custom transparent, managed', async t => {
83+
const opts: GenericOptions = { kind: 'Custom', name: 'My Contract', upgradeable: 'transparent', access: 'managed' };
84+
const c = buildCustom(opts);
85+
await runTest(c, t, opts);
86+
});
87+
7088
async function runTest(c: Contract, t: ExecutionContext<Context>, opts: GenericOptions) {
7189
const zip = await zipFoundry(c, opts);
7290

@@ -105,8 +123,8 @@ async function extractAndRunPackage(zip: JSZip, c: Contract, t: ExecutionContext
105123

106124
const setGitUser = 'git init && git config user.email "[email protected]" && git config user.name "Test"';
107125
const setup = 'bash setup.sh';
108-
const test = 'forge test';
109-
const script = `forge script script/${c.name}.s.sol`;
126+
const test = 'forge test' + (c.upgradeable ? ' --force' : '');
127+
const script = `forge script script/${c.name}.s.sol` + (c.upgradeable ? ' --force' : '');
110128

111129
const exec = (cmd: string) => util.promisify(child.exec)(cmd, { env: { ...process.env, NO_COLOR: '' } });
112130

0 commit comments

Comments
 (0)