Skip to content

Commit acacc83

Browse files
authored
Remove isAccessControlRequired from specific Cairo contract APIs, update copyright year (#426)
1 parent e08725a commit acacc83

File tree

11 files changed

+35
-30
lines changed

11 files changed

+35
-30
lines changed

NOTICE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
OpenZeppelin Contracts Wizard
2-
Copyright (C) 2021-2024 Zeppelin Group Ltd
2+
Copyright (C) 2021-2025 Zeppelin Group Ltd
33

44
This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, version 3.
55

packages/core-cairo/CHANGELOG.md

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

3-
## 0.21.0 (2025-01-09)
3+
## 0.21.0 (2025-01-13)
44

55
- Add Vesting tab. ([#425](https://github.com/OpenZeppelin/contracts-wizard/pull/425))
6-
- Update Contracts Wizard license to AGPLv3. ([#424](https://github.com/OpenZeppelin/contracts-wizard/pull/424))
6+
7+
- **Breaking changes**:
8+
- Remove `isAccessControlRequired` from `governor` and `vesting`. ([#426](https://github.com/OpenZeppelin/contracts-wizard/pull/426))
9+
- Update Contracts Wizard license to AGPLv3. ([#424](https://github.com/OpenZeppelin/contracts-wizard/pull/424))
710

811
## 0.20.1 (2024-12-17)
912

packages/core-cairo/NOTICE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
OpenZeppelin Contracts Wizard
2-
Copyright (C) 2021-2024 Zeppelin Group Ltd
2+
Copyright (C) 2021-2025 Zeppelin Group Ltd
33

44
This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, version 3.
55

packages/core-cairo/README.md

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ The following contract types are supported:
1717
- `erc721`
1818
- `erc1155`
1919
- `account`
20+
- `governor`
21+
- `vesting`
2022
- `custom`
2123

2224
Each contract type has functions/constants as defined below.
@@ -37,6 +39,12 @@ function print(opts?: ERC1155Options): string
3739
function print(opts?: AccountOptions): string
3840
```
3941
```js
42+
function print(opts?: GovernorOptions): string
43+
```
44+
```js
45+
function print(opts?: VestingOptions): string
46+
```
47+
```js
4048
function print(opts?: CustomOptions): string
4149
```
4250
Returns a string representation of a contract generated using the provided options. If `opts` is not provided, uses [`defaults`](#defaults).
@@ -55,6 +63,12 @@ const defaults: Required<ERC1155Options>
5563
const defaults: Required<AccountOptions>
5664
```
5765
```js
66+
const defaults: Required<GovernorOptions>
67+
```
68+
```js
69+
const defaults: Required<VestingOptions>
70+
```
71+
```js
5872
const defaults: Required<CustomOptions>
5973
```
6074
The default options that are used for [`print`](#print).
@@ -74,8 +88,8 @@ function isAccessControlRequired(opts: Partial<CustomOptions>): boolean
7488
```
7589
Whether any of the provided options require access control to be enabled. If this returns `true`, then calling `print` with the same options would cause the `access` option to default to `'ownable'` if it was `undefined` or `false`.
7690

77-
> Note that account contracts handle permissions differently from the other supported contracts.
78-
Thus, the `account` contract type does not include `isAccessControlRequired`.
91+
> Note that contracts such as `account`, `governor`, and `vesting` have their own ways of handling permissions and do not support the `access` option.
92+
Thus, those types do not include `isAccessControlRequired`.
7993

8094
### Contract specific functions
8195

packages/core-cairo/src/api.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ import { printERC20, defaults as erc20defaults, isAccessControlRequired as erc20
33
import { printERC721, defaults as erc721defaults, isAccessControlRequired as erc721IsAccessControlRequired, ERC721Options } from './erc721';
44
import { printERC1155, defaults as erc1155defaults, isAccessControlRequired as erc1155IsAccessControlRequired, ERC1155Options } from './erc1155';
55
import { printAccount, defaults as accountDefaults, AccountOptions } from './account';
6-
import { printGovernor, defaults as governorDefaults, isAccessControlRequired as governorIsAccessControlRequired, GovernorOptions } from './governor';
6+
import { printGovernor, defaults as governorDefaults, GovernorOptions } from './governor';
77
import { printCustom, defaults as customDefaults, isAccessControlRequired as customIsAccessControlRequired, CustomOptions } from './custom';
8-
import { printVesting, defaults as vestingDefaults, isAccessControlRequired as vestingIsAccessControlRequired, VestingOptions } from './vesting';
8+
import { printVesting, defaults as vestingDefaults, VestingOptions } from './vesting';
99

1010
export interface WizardAccountAPI<Options extends CommonOptions>{
1111
/**
@@ -29,21 +29,23 @@ export interface WizardContractAPI<Options extends CommonContractOptions> {
2929
* The default options that are used for `print`.
3030
*/
3131
defaults: Required<Options>;
32+
}
3233

34+
export interface AccessControlAPI<Options extends CommonContractOptions> {
3335
/**
3436
* Whether any of the provided options require access control to be enabled. If this returns `true`, then calling `print` with the
3537
* same options would cause the `access` option to default to `'ownable'` if it was `undefined` or `false`.
3638
*/
37-
isAccessControlRequired: (opts: Partial<Options>) => boolean;
39+
isAccessControlRequired: (opts: Partial<Options>) => boolean;
3840
}
3941

40-
export type ERC20 = WizardContractAPI<ERC20Options>;
41-
export type ERC721 = WizardContractAPI<ERC721Options>;
42-
export type ERC1155 = WizardContractAPI<ERC1155Options>;
42+
export type ERC20 = WizardContractAPI<ERC20Options> & AccessControlAPI<ERC20Options>;
43+
export type ERC721 = WizardContractAPI<ERC721Options> & AccessControlAPI<ERC721Options>;
44+
export type ERC1155 = WizardContractAPI<ERC1155Options> & AccessControlAPI<ERC1155Options>;
4345
export type Account = WizardAccountAPI<AccountOptions>;
4446
export type Governor = WizardContractAPI<GovernorOptions>;
4547
export type Vesting = WizardContractAPI<VestingOptions>;
46-
export type Custom = WizardContractAPI<CustomOptions>;
48+
export type Custom = WizardContractAPI<CustomOptions> & AccessControlAPI<CustomOptions>;
4749

4850
export const erc20: ERC20 = {
4951
print: printERC20,
@@ -67,12 +69,10 @@ export const account: Account = {
6769
export const governor: Governor = {
6870
print: printGovernor,
6971
defaults: governorDefaults,
70-
isAccessControlRequired: governorIsAccessControlRequired
7172
}
7273
export const vesting: Vesting = {
7374
print: printVesting,
7475
defaults: vestingDefaults,
75-
isAccessControlRequired: vestingIsAccessControlRequired
7676
}
7777
export const custom: Custom = {
7878
print: printCustom,

packages/core-cairo/src/governor.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,6 @@ export interface GovernorOptions extends CommonOptions {
6565
appVersion?: string;
6666
}
6767

68-
export function isAccessControlRequired(opts: Partial<GovernorOptions>): boolean {
69-
return false;
70-
}
71-
7268
function withDefaults(opts: GovernorOptions): Required<GovernorOptions> {
7369
return {
7470
...opts,

packages/core-cairo/src/vesting.test.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -109,10 +109,6 @@ testAPIEquivalence('API all custom settings', {
109109
schedule: 'custom'
110110
});
111111

112-
test('Vesting API isAccessControlRequired', async t => {
113-
t.is(vesting.isAccessControlRequired({}), true);
114-
});
115-
116112
test('cliff too high', async t => {
117113
const error = t.throws(() => buildVesting({
118114
...defaults,

packages/core-cairo/src/vesting.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,6 @@ function withDefaults(opts: VestingOptions): Required<VestingOptions> {
4444
};
4545
}
4646

47-
export function isAccessControlRequired(_: Partial<VestingOptions>): boolean {
48-
return true;
49-
}
50-
5147
export function buildVesting(opts: VestingOptions): Contract {
5248
const c = new ContractBuilder(opts.name);
5349
const allOpts = withDefaults(opts);

packages/core/NOTICE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
OpenZeppelin Contracts Wizard
2-
Copyright (C) 2021-2024 Zeppelin Group Ltd
2+
Copyright (C) 2021-2025 Zeppelin Group Ltd
33

44
This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, version 3.
55

packages/ui/public/cairo.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858
</div>
5959

6060
<footer>
61-
<p>© <a href="https://openzeppelin.com" target="_blank" rel="noopener noreferrer">OpenZeppelin</a> 2022-2024 |&nbsp;<a href="https://openzeppelin.com/privacy" target="_blank" rel="noopener noreferrer">Privacy</a> |&nbsp;<a href="https://openzeppelin.com/tos" target="_blank" rel="noopener noreferrer">Terms of Service</a></p>
61+
<p>© <a href="https://openzeppelin.com" target="_blank" rel="noopener noreferrer">OpenZeppelin</a> 2022-2025 |&nbsp;<a href="https://openzeppelin.com/privacy" target="_blank" rel="noopener noreferrer">Privacy</a> |&nbsp;<a href="https://openzeppelin.com/tos" target="_blank" rel="noopener noreferrer">Terms of Service</a></p>
6262
</footer>
6363

6464
<!-- Start of HubSpot Embed Code -->

0 commit comments

Comments
 (0)