Skip to content

Commit 79945e0

Browse files
authored
Cairo: Fix missing use clause in hook for ERC20 votes (#637)
1 parent 5320e4a commit 79945e0

File tree

7 files changed

+11
-0
lines changed

7 files changed

+11
-0
lines changed

.changeset/old-corners-scream.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@openzeppelin/wizard-cairo': patch
3+
---
4+
5+
Fix missing use clause in hooks for ERC20 votes

packages/core/cairo/src/erc20.test.ts.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1111,6 +1111,7 @@ Generated by [AVA](https://avajs.dev).
11111111
use openzeppelin::token::erc20::{DefaultConfig, ERC20Component};␊
11121112
use openzeppelin::utils::cryptography::nonces::NoncesComponent;␊
11131113
use openzeppelin::utils::cryptography::snip12::SNIP12Metadata;␊
1114+
use starknet::ContractAddress;␊
11141115
11151116
component!(path: ERC20Component, storage: erc20, event: ERC20Event);␊
11161117
component!(path: NoncesComponent, storage: nonces, event: NoncesEvent);␊
2 Bytes
Binary file not shown.

packages/core/cairo/src/erc20.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ function addHooks(c: ContractBuilder, allOpts: Required<ERC20Options>) {
110110
c.addImplementedTrait(hooksTrait);
111111

112112
if (allOpts.pausable) {
113+
c.addUseClause('starknet', 'ContractAddress');
113114
const beforeUpdateFn = c.addFunction(hooksTrait, {
114115
name: 'before_update',
115116
args: [
@@ -150,6 +151,7 @@ function addHooks(c: ContractBuilder, allOpts: Required<ERC20Options>) {
150151
'SNIP12 Metadata',
151152
);
152153

154+
c.addUseClause('starknet', 'ContractAddress');
153155
const afterUpdateFn = c.addFunction(hooksTrait, {
154156
name: 'after_update',
155157
args: [

packages/core/cairo_alpha/src/erc20.test.ts.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1114,6 +1114,7 @@ Generated by [AVA](https://avajs.dev).
11141114
use openzeppelin::utils::contract_clock::ERC6372TimestampClock;␊
11151115
use openzeppelin::utils::cryptography::nonces::NoncesComponent;␊
11161116
use openzeppelin::utils::cryptography::snip12::SNIP12Metadata;␊
1117+
use starknet::ContractAddress;␊
11171118
11181119
component!(path: ERC20Component, storage: erc20, event: ERC20Event);␊
11191120
component!(path: NoncesComponent, storage: nonces, event: NoncesEvent);␊
0 Bytes
Binary file not shown.

packages/core/cairo_alpha/src/erc20.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ function addHooks(c: ContractBuilder, allOpts: Required<ERC20Options>) {
110110
c.addImplementedTrait(hooksTrait);
111111

112112
if (allOpts.pausable) {
113+
c.addUseClause('starknet', 'ContractAddress');
113114
const beforeUpdateFn = c.addFunction(hooksTrait, {
114115
name: 'before_update',
115116
args: [
@@ -150,6 +151,7 @@ function addHooks(c: ContractBuilder, allOpts: Required<ERC20Options>) {
150151
'SNIP12 Metadata',
151152
);
152153

154+
c.addUseClause('starknet', 'ContractAddress');
153155
const afterUpdateFn = c.addFunction(hooksTrait, {
154156
name: 'after_update',
155157
args: [

0 commit comments

Comments
 (0)