Skip to content

Commit bdec576

Browse files
ericglauAmxxmakiopen
authored
Add ERC20 Cross-Chain Bridging, SuperchainERC20 (#436)
Co-authored-by: Hadrien Croubois <[email protected]> Co-authored-by: makiopen <[email protected]>
1 parent 2af1736 commit bdec576

33 files changed

+1353
-83
lines changed

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ jobs:
3939
if: matrix.package == 'solidity'
4040
uses: foundry-rs/foundry-toolchain@v1
4141
- name: Install dependencies
42-
run: yarn install --network-concurrency 1
42+
run: yarn install
4343
- name: Compile TypeScript
4444
run: yarn tsc
4545
working-directory: packages/core/${{matrix.package}}

netlify.toml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,6 @@ publish = "packages/ui/public"
44

55
edge_functions = "packages/ui/api"
66

7-
[build.environment]
8-
YARN_FLAGS = "--network-concurrency 1"
9-
107
[[edge_functions]]
118
path = "/ai"
129
function = "ai"

packages/core/solidity/CHANGELOG.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
# Changelog
22

3+
## 0.5.3 (2025-03-13)
4+
5+
- Add ERC20 Cross-Chain Bridging, SuperchainERC20. ([#436](https://github.com/OpenZeppelin/contracts-wizard/pull/436))
6+
**Note:** Cross-Chain Bridging is experimental and may be subject to change.
7+
8+
- **Potentially breaking changes**:
9+
- Change order of constructor argument `recipient` when using `premint`.
10+
311
## 0.5.2 (2025-02-21)
412

513
- Fix modifiers order to follow Solidity style guides. ([#450](https://github.com/OpenZeppelin/contracts-wizard/pull/450))
@@ -8,7 +16,7 @@
816
## 0.5.1 (2025-02-05)
917

1018
- **Potentially breaking changes**:
11-
- Add constructor argument `recipient` when using `premint` in `erc20`, `stablecoin`, and `realWorldAsset`.
19+
- Add constructor argument `recipient` when using `premint` in `erc20`, `stablecoin`, and `realWorldAsset`. ([#435](https://github.com/OpenZeppelin/contracts-wizard/pull/435))
1220

1321
## 0.5.0 (2025-01-23)
1422

packages/core/solidity/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@openzeppelin/wizard",
3-
"version": "0.5.2",
3+
"version": "0.5.3",
44
"description": "A boilerplate generator to get started with OpenZeppelin Contracts",
55
"license": "AGPL-3.0-only",
66
"repository": "https://github.com/OpenZeppelin/contracts-wizard",

packages/core/solidity/src/erc20.test.ts

Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import test from 'ava';
2+
import type { OptionsError } from '.';
23
import { erc20 } from '.';
34

45
import type { ERC20Options } from './erc20';
@@ -98,6 +99,126 @@ testERC20('erc20 flashmint', {
9899
flashmint: true,
99100
});
100101

102+
testERC20('erc20 crossChainBridging custom', {
103+
crossChainBridging: 'custom',
104+
});
105+
106+
testERC20('erc20 crossChainBridging custom ownable', {
107+
crossChainBridging: 'custom',
108+
access: 'ownable',
109+
});
110+
111+
testERC20('erc20 crossChainBridging custom ownable mintable burnable', {
112+
crossChainBridging: 'custom',
113+
access: 'ownable',
114+
mintable: true,
115+
burnable: true,
116+
});
117+
118+
testERC20('erc20 crossChainBridging custom roles', {
119+
crossChainBridging: 'custom',
120+
access: 'roles',
121+
});
122+
123+
testERC20('erc20 crossChainBridging custom managed', {
124+
crossChainBridging: 'custom',
125+
access: 'managed',
126+
});
127+
128+
testERC20('erc20 crossChainBridging superchain', {
129+
crossChainBridging: 'superchain',
130+
});
131+
132+
testERC20('erc20 crossChainBridging superchain ownable', {
133+
crossChainBridging: 'superchain',
134+
access: 'ownable',
135+
});
136+
137+
testERC20('erc20 crossChainBridging superchain roles', {
138+
crossChainBridging: 'superchain',
139+
access: 'roles',
140+
});
141+
142+
testERC20('erc20 crossChainBridging superchain managed', {
143+
crossChainBridging: 'superchain',
144+
access: 'managed',
145+
});
146+
147+
test('erc20 crossChainBridging custom, upgradeable not allowed', async t => {
148+
const error = t.throws(() =>
149+
buildERC20({
150+
name: 'MyToken',
151+
symbol: 'MTK',
152+
crossChainBridging: 'custom',
153+
upgradeable: 'transparent',
154+
}),
155+
);
156+
t.is(
157+
(error as OptionsError).messages.crossChainBridging,
158+
'Upgradeability is not currently supported with Cross-Chain Bridging',
159+
);
160+
});
161+
162+
test('erc20 crossChainBridging superchain, upgradeable not allowed', async t => {
163+
const error = t.throws(() =>
164+
buildERC20({
165+
name: 'MyToken',
166+
symbol: 'MTK',
167+
crossChainBridging: 'superchain',
168+
upgradeable: 'transparent',
169+
}),
170+
);
171+
t.is(
172+
(error as OptionsError).messages.crossChainBridging,
173+
'Upgradeability is not currently supported with Cross-Chain Bridging',
174+
);
175+
});
176+
177+
test('erc20 crossChainBridging superchain, premintChainId required', async t => {
178+
const error = t.throws(() =>
179+
buildERC20({
180+
name: 'MyToken',
181+
symbol: 'MTK',
182+
crossChainBridging: 'superchain',
183+
premint: '2000',
184+
}),
185+
);
186+
t.is(
187+
(error as OptionsError).messages.premintChainId,
188+
'Chain ID is required when using Premint with Cross-Chain Bridging',
189+
);
190+
});
191+
192+
testERC20('erc20 premint ignores chainId when not crossChainBridging', {
193+
premint: '2000',
194+
premintChainId: '10',
195+
});
196+
197+
testERC20('erc20 premint chainId crossChainBridging custom', {
198+
premint: '2000',
199+
premintChainId: '10',
200+
crossChainBridging: 'custom',
201+
});
202+
203+
testERC20('erc20 premint chainId crossChainBridging superchain', {
204+
premint: '2000',
205+
premintChainId: '10',
206+
crossChainBridging: 'superchain',
207+
});
208+
209+
testERC20('erc20 full crossChainBridging custom non-upgradeable', {
210+
premint: '2000',
211+
access: 'roles',
212+
burnable: true,
213+
mintable: true,
214+
pausable: true,
215+
permit: true,
216+
votes: true,
217+
flashmint: true,
218+
crossChainBridging: 'custom',
219+
premintChainId: '10',
220+
});
221+
101222
testERC20('erc20 full upgradeable transparent', {
102223
premint: '2000',
103224
access: 'roles',

0 commit comments

Comments
 (0)