Skip to content

Commit 83829d1

Browse files
authored
Cairo: Use Contracts for Cairo v0.12.0, add ERC20Votes (#355)
1 parent 7817c21 commit 83829d1

23 files changed

+1376
-581
lines changed

packages/core-cairo/CHANGELOG.md

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

3+
## 0.12.0 (2024-05-01)
4+
5+
- Add `votes` option to ERC20. ([#355](https://github.com/OpenZeppelin/contracts-wizard/pull/355))
6+
- Require `appName` and `appVersion` when `votes` is enabled.
7+
- Sort implemented traits.
8+
- **Breaking changes**:
9+
- Use OpenZeppelin Contracts for Cairo v0.12.0.
10+
- Use Hooks with ERC20.
11+
312
## 0.11.0 (2024-04-17)
413

514
- **Breaking changes**:

packages/core-cairo/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-cairo",
3-
"version": "0.11.0",
3+
"version": "0.12.0",
44
"description": "A boilerplate generator to get started with OpenZeppelin Contracts for Cairo",
55
"license": "MIT",
66
"repository": "github:OpenZeppelin/contracts-wizard",

packages/core-cairo/src/contract.test.ts.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Generated by [AVA](https://avajs.dev).
99
> Snapshot 1
1010
1111
`// SPDX-License-Identifier: MIT␊
12-
// Compatible with OpenZeppelin Contracts for Cairo ^0.11.0␊
12+
// Compatible with OpenZeppelin Contracts for Cairo ^0.12.0␊
1313
1414
#[starknet::contract]␊
1515
mod Foo {␊
@@ -24,7 +24,7 @@ Generated by [AVA](https://avajs.dev).
2424
> Snapshot 1
2525
2626
`// SPDX-License-Identifier: MIT␊
27-
// Compatible with OpenZeppelin Contracts for Cairo ^0.11.0␊
27+
// Compatible with OpenZeppelin Contracts for Cairo ^0.12.0␊
2828
2929
#[starknet::contract]␊
3030
mod Foo {␊
@@ -44,7 +44,7 @@ Generated by [AVA](https://avajs.dev).
4444
> Snapshot 1
4545
4646
`// SPDX-License-Identifier: MIT␊
47-
// Compatible with OpenZeppelin Contracts for Cairo ^0.11.0␊
47+
// Compatible with OpenZeppelin Contracts for Cairo ^0.12.0␊
4848
4949
#[starknet::contract]␊
5050
mod Foo {␊
@@ -64,7 +64,7 @@ Generated by [AVA](https://avajs.dev).
6464
> Snapshot 1
6565
6666
`// SPDX-License-Identifier: MIT␊
67-
// Compatible with OpenZeppelin Contracts for Cairo ^0.11.0␊
67+
// Compatible with OpenZeppelin Contracts for Cairo ^0.12.0␊
6868
6969
#[starknet::contract]␊
7070
mod Foo {␊
@@ -89,7 +89,7 @@ Generated by [AVA](https://avajs.dev).
8989
> Snapshot 1
9090
9191
`// SPDX-License-Identifier: MIT␊
92-
// Compatible with OpenZeppelin Contracts for Cairo ^0.11.0␊
92+
// Compatible with OpenZeppelin Contracts for Cairo ^0.12.0␊
9393
9494
#[starknet::contract]␊
9595
mod Foo {␊
@@ -114,7 +114,7 @@ Generated by [AVA](https://avajs.dev).
114114
> Snapshot 1
115115
116116
`// SPDX-License-Identifier: MIT␊
117-
// Compatible with OpenZeppelin Contracts for Cairo ^0.11.0␊
117+
// Compatible with OpenZeppelin Contracts for Cairo ^0.12.0␊
118118
119119
#[starknet::contract]␊
120120
mod Foo {␊
@@ -152,7 +152,7 @@ Generated by [AVA](https://avajs.dev).
152152
> Snapshot 1
153153
154154
`// SPDX-License-Identifier: MIT␊
155-
// Compatible with OpenZeppelin Contracts for Cairo ^0.11.0␊
155+
// Compatible with OpenZeppelin Contracts for Cairo ^0.12.0␊
156156
157157
#[starknet::contract]␊
158158
mod Foo {␊
0 Bytes
Binary file not shown.

packages/core-cairo/src/contract.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,11 @@ export interface BaseImplementedTrait {
4848
of: string;
4949
tags: string[];
5050
perItemTag?: string;
51+
/**
52+
* Priority for which trait to print first.
53+
* Lower numbers are higher priority, undefined is lowest priority.
54+
*/
55+
priority?: number;
5156
}
5257

5358
export interface ImplementedTrait extends BaseImplementedTrait {
@@ -165,6 +170,7 @@ export class ContractBuilder implements Contract {
165170
of: baseTrait.of,
166171
tags: [ ...baseTrait.tags ],
167172
functions: [],
173+
priority: baseTrait.priority,
168174
};
169175
this.implementedTraitsMap.set(key, t);
170176
return t;

packages/core-cairo/src/custom.test.ts.md

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Generated by [AVA](https://avajs.dev).
99
> Snapshot 1
1010
1111
`// SPDX-License-Identifier: MIT␊
12-
// Compatible with OpenZeppelin Contracts for Cairo ^0.11.0␊
12+
// Compatible with OpenZeppelin Contracts for Cairo ^0.12.0␊
1313
1414
#[starknet::contract]␊
1515
mod MyContract {␊
@@ -24,7 +24,7 @@ Generated by [AVA](https://avajs.dev).
2424
> Snapshot 1
2525
2626
`// SPDX-License-Identifier: MIT␊
27-
// Compatible with OpenZeppelin Contracts for Cairo ^0.11.0␊
27+
// Compatible with OpenZeppelin Contracts for Cairo ^0.12.0␊
2828
2929
#[starknet::contract]␊
3030
mod MyContract {␊
@@ -80,7 +80,7 @@ Generated by [AVA](https://avajs.dev).
8080
> Snapshot 1
8181
8282
`// SPDX-License-Identifier: MIT␊
83-
// Compatible with OpenZeppelin Contracts for Cairo ^0.11.0␊
83+
// Compatible with OpenZeppelin Contracts for Cairo ^0.12.0␊
8484
8585
#[starknet::contract]␊
8686
mod MyContract {␊
@@ -129,6 +129,14 @@ Generated by [AVA](https://avajs.dev).
129129
fn constructor(ref self: ContractState, owner: ContractAddress) {␊
130130
self.ownable.initializer(owner);␊
131131
}␊
132+
133+
#[abi(embed_v0)]␊
134+
impl UpgradeableImpl of IUpgradeable<ContractState> {␊
135+
fn upgrade(ref self: ContractState, new_class_hash: ClassHash) {␊
136+
self.ownable.assert_only_owner();␊
137+
self.upgradeable._upgrade(new_class_hash);␊
138+
}␊
139+
}␊
132140
133141
#[generate_trait]␊
134142
#[abi(per_item)]␊
@@ -145,14 +153,6 @@ Generated by [AVA](https://avajs.dev).
145153
self.pausable._unpause();␊
146154
}␊
147155
}␊
148-
149-
#[abi(embed_v0)]␊
150-
impl UpgradeableImpl of IUpgradeable<ContractState> {␊
151-
fn upgrade(ref self: ContractState, new_class_hash: ClassHash) {␊
152-
self.ownable.assert_only_owner();␊
153-
self.upgradeable._upgrade(new_class_hash);␊
154-
}␊
155-
}␊
156156
}␊
157157
`
158158

@@ -161,7 +161,7 @@ Generated by [AVA](https://avajs.dev).
161161
> Snapshot 1
162162
163163
`// SPDX-License-Identifier: MIT␊
164-
// Compatible with OpenZeppelin Contracts for Cairo ^0.11.0␊
164+
// Compatible with OpenZeppelin Contracts for Cairo ^0.12.0␊
165165
166166
#[starknet::contract]␊
167167
mod MyContract {␊
@@ -217,7 +217,7 @@ Generated by [AVA](https://avajs.dev).
217217
> Snapshot 1
218218
219219
`// SPDX-License-Identifier: MIT␊
220-
// Compatible with OpenZeppelin Contracts for Cairo ^0.11.0␊
220+
// Compatible with OpenZeppelin Contracts for Cairo ^0.12.0␊
221221
222222
#[starknet::contract]␊
223223
mod MyContract {␊
@@ -232,7 +232,7 @@ Generated by [AVA](https://avajs.dev).
232232
> Snapshot 1
233233
234234
`// SPDX-License-Identifier: MIT␊
235-
// Compatible with OpenZeppelin Contracts for Cairo ^0.11.0␊
235+
// Compatible with OpenZeppelin Contracts for Cairo ^0.12.0␊
236236
237237
#[starknet::contract]␊
238238
mod MyContract {␊
@@ -288,7 +288,7 @@ Generated by [AVA](https://avajs.dev).
288288
> Snapshot 1
289289
290290
`// SPDX-License-Identifier: MIT␊
291-
// Compatible with OpenZeppelin Contracts for Cairo ^0.11.0␊
291+
// Compatible with OpenZeppelin Contracts for Cairo ^0.12.0␊
292292
293293
const UPGRADER_ROLE: felt252 = selector!("UPGRADER_ROLE");␊
294294
@@ -361,7 +361,7 @@ Generated by [AVA](https://avajs.dev).
361361
> Snapshot 1
362362
363363
`// SPDX-License-Identifier: MIT␊
364-
// Compatible with OpenZeppelin Contracts for Cairo ^0.11.0␊
364+
// Compatible with OpenZeppelin Contracts for Cairo ^0.12.0␊
365365
366366
#[starknet::contract]␊
367367
mod MyContract {␊
-3 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)