From e06d6855a6bfea9bb3244887204250b74b24e250 Mon Sep 17 00:00:00 2001 From: Eric Lau Date: Fri, 17 May 2024 15:01:01 -0400 Subject: [PATCH 01/11] Add empty hooks --- packages/core-cairo/src/erc1155.test.ts.md | 10 ++++++++++ packages/core-cairo/src/erc1155.test.ts.snap | Bin 2865 -> 2885 bytes packages/core-cairo/src/erc1155.ts | 2 ++ packages/core-cairo/src/erc721.test.ts.md | 9 +++++++++ packages/core-cairo/src/erc721.test.ts.snap | Bin 2438 -> 2462 bytes packages/core-cairo/src/erc721.ts | 2 ++ 6 files changed, 23 insertions(+) diff --git a/packages/core-cairo/src/erc1155.test.ts.md b/packages/core-cairo/src/erc1155.test.ts.md index 1609e0485..5d0ded3c9 100644 --- a/packages/core-cairo/src/erc1155.test.ts.md +++ b/packages/core-cairo/src/erc1155.test.ts.md @@ -16,6 +16,7 @@ Generated by [AVA](https://avajs.dev). use openzeppelin::access::ownable::OwnableComponent;␊ use openzeppelin::introspection::src5::SRC5Component;␊ use openzeppelin::token::erc1155::ERC1155Component;␊ + use openzeppelin::token::erc1155::ERC1155HooksEmptyImpl;␊ use starknet::ContractAddress;␊ ␊ component!(path: ERC1155Component, storage: erc1155, event: ERC1155Event);␊ @@ -86,6 +87,7 @@ Generated by [AVA](https://avajs.dev). use openzeppelin::access::ownable::OwnableComponent;␊ use openzeppelin::introspection::src5::SRC5Component;␊ use openzeppelin::token::erc1155::ERC1155Component;␊ + use openzeppelin::token::erc1155::ERC1155HooksEmptyImpl;␊ use openzeppelin::upgrades::UpgradeableComponent;␊ use openzeppelin::upgrades::interface::IUpgradeable;␊ use starknet::ClassHash;␊ @@ -177,6 +179,7 @@ Generated by [AVA](https://avajs.dev). use openzeppelin::access::accesscontrol::DEFAULT_ADMIN_ROLE;␊ use openzeppelin::introspection::src5::SRC5Component;␊ use openzeppelin::token::erc1155::ERC1155Component;␊ + use openzeppelin::token::erc1155::ERC1155HooksEmptyImpl;␊ use openzeppelin::upgrades::UpgradeableComponent;␊ use openzeppelin::upgrades::interface::IUpgradeable;␊ use starknet::ClassHash;␊ @@ -276,6 +279,7 @@ Generated by [AVA](https://avajs.dev). use openzeppelin::access::ownable::OwnableComponent;␊ use openzeppelin::introspection::src5::SRC5Component;␊ use openzeppelin::token::erc1155::ERC1155Component;␊ + use openzeppelin::token::erc1155::ERC1155HooksEmptyImpl;␊ use openzeppelin::upgrades::UpgradeableComponent;␊ use openzeppelin::upgrades::interface::IUpgradeable;␊ use starknet::ClassHash;␊ @@ -348,6 +352,7 @@ Generated by [AVA](https://avajs.dev). use openzeppelin::access::ownable::OwnableComponent;␊ use openzeppelin::introspection::src5::SRC5Component;␊ use openzeppelin::token::erc1155::ERC1155Component;␊ + use openzeppelin::token::erc1155::ERC1155HooksEmptyImpl;␊ use openzeppelin::upgrades::UpgradeableComponent;␊ use openzeppelin::upgrades::interface::IUpgradeable;␊ use starknet::ClassHash;␊ @@ -470,6 +475,7 @@ Generated by [AVA](https://avajs.dev). use openzeppelin::introspection::src5::SRC5Component;␊ use openzeppelin::security::pausable::PausableComponent;␊ use openzeppelin::token::erc1155::ERC1155Component;␊ + use openzeppelin::token::erc1155::ERC1155HooksEmptyImpl;␊ use openzeppelin::token::erc1155::interface;␊ use openzeppelin::upgrades::UpgradeableComponent;␊ use openzeppelin::upgrades::interface::IUpgradeable;␊ @@ -665,6 +671,7 @@ Generated by [AVA](https://avajs.dev). use openzeppelin::access::ownable::OwnableComponent;␊ use openzeppelin::introspection::src5::SRC5Component;␊ use openzeppelin::token::erc1155::ERC1155Component;␊ + use openzeppelin::token::erc1155::ERC1155HooksEmptyImpl;␊ use openzeppelin::upgrades::UpgradeableComponent;␊ use openzeppelin::upgrades::interface::IUpgradeable;␊ use starknet::ClassHash;␊ @@ -792,6 +799,7 @@ Generated by [AVA](https://avajs.dev). use openzeppelin::access::accesscontrol::DEFAULT_ADMIN_ROLE;␊ use openzeppelin::introspection::src5::SRC5Component;␊ use openzeppelin::token::erc1155::ERC1155Component;␊ + use openzeppelin::token::erc1155::ERC1155HooksEmptyImpl;␊ use openzeppelin::upgrades::UpgradeableComponent;␊ use openzeppelin::upgrades::interface::IUpgradeable;␊ use starknet::ClassHash;␊ @@ -934,6 +942,7 @@ Generated by [AVA](https://avajs.dev). use openzeppelin::introspection::src5::SRC5Component;␊ use openzeppelin::security::pausable::PausableComponent;␊ use openzeppelin::token::erc1155::ERC1155Component;␊ + use openzeppelin::token::erc1155::ERC1155HooksEmptyImpl;␊ use openzeppelin::token::erc1155::interface;␊ use starknet::ContractAddress;␊ use starknet::get_caller_address;␊ @@ -1206,6 +1215,7 @@ Generated by [AVA](https://avajs.dev). use openzeppelin::introspection::src5::SRC5Component;␊ use openzeppelin::security::pausable::PausableComponent;␊ use openzeppelin::token::erc1155::ERC1155Component;␊ + use openzeppelin::token::erc1155::ERC1155HooksEmptyImpl;␊ use openzeppelin::token::erc1155::interface;␊ use openzeppelin::upgrades::UpgradeableComponent;␊ use openzeppelin::upgrades::interface::IUpgradeable;␊ diff --git a/packages/core-cairo/src/erc1155.test.ts.snap b/packages/core-cairo/src/erc1155.test.ts.snap index a0e814c055f2f9055c2cd41c5b6a8f38fd951603..0aab72e167cc362ec09e24a5f6d839aa6027f1ea 100644 GIT binary patch literal 2885 zcmV-L3%c|{RzVem(PGk4EI- z;URf=&d0;EKU*!wGq1zH{}U6NIJnnBp>1le=RWHBR{?5c)N-&Ly2uYZ9tnT?x!pzt z{rSUx{OaBZ_t@tbzrOdIU;g#O?QQM+^x*ZQm$r%B5I<_Ru}f^r#(}OKH!n8m`+cwL zBVto}+O17G+KG?dZ?W%V$9CyUmjuWpp=No3wvX(<)4qSa^<-!3@y5m%--QGP*DfZy zZt{X}Ho9J0JHET{uCc5AxS`QcFT|QhslMY>bsd=|4ntk{Ze7+9T|bGxFkU>DviPi^ zqD@=zLLZyN_UL06n7g`uezw0`S(7k^bR7rglP9~h(&5=Y`!Z_17oK+=9(H|l*X;UE zzj9w9iRc>bc0fD(Y$GaTCha|_QK@%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)3L|=f*%@{=t3T*lz9`v?Q93)$R>HEhI&R>$KbHBUO z?jHBQ-%h|jY#-jgjQ78O@OjiuE;_wOpFj9>=ex)4EsNA7_0&jhKqB+5dgFf@Qu|NC zBDFO|YGsl$NIf5fAtWBKc+TQEi{~t!vv^K?Zaki|@Jmu(4}J-6oIxg*spv6nk(?ad zM=@J?5rutijd-a?XSOCy}iSYYZRrOh>oElL7N z_6hDcHBnW=Ln8_pTgfvz3B@A`6dUzN98j<+8-wVR0ETpXXZzuhz?ds@n|Sh?8s%~I zn*0yZkO+bkGrT{L-1U5TF_Ut;R z7>DLAVVOA)EqN@_^jLb`%ta0*R4RIwD++tFoF!*cEhcxwOhHMmfpC>s4|CwG@n5Pd zcbrK~4(?x=g__qwX^La)z!N<)uphh)__sS89kn z^&6;D*paIgLYD_v& z#yR44O>fA_nN7*2c|O%BIEWUfV%}D5wWiN7l(|~-)_=8X&986SYR#Iytd!EMKmlci z%N;lKH6*+1zKC6SyIVf1-EzCxZC^ujRucH8I~W|xU1R5gKp({j8uq>Bxl=P)Z{)8b z4egX#kGDfJ!gq%YaNSHx1V$eiO9RRX>LRNYwkg;&DVQF~E1hi9v5C^Lazv|k z?QfWx$wo#(#vTm7Afz7XF%VV*8T;viSwkR3M-|DevOjHDYutJKuORi9dJ*+FzHF9Z zO-pw~eXFV{ZF$d}G(NKi2U^mFE11aYHmV6!*-)F>EV>o&AMd|cP!oE zj&YQn<_F6roVDxm`)1=fb@ggg*Bo~fMQU5Zn*MFgw1ib#zIrdw%2&PjZ24-b%U7%R zYNaiu86~dpVKiH%vsJoPtI|nn_7&9SsQuMTv9GV%-`=wYNn4P#1<7S`i7iOlf}|}- z+JdA`U<;D-_N6UImh7+vNn4Pt(AEC-o Date: Fri, 17 May 2024 15:30:52 -0400 Subject: [PATCH 02/11] Update erc721 burn to use _check_authorized --- packages/core-cairo/src/erc721.test.ts.md | 9 ++++++--- packages/core-cairo/src/erc721.test.ts.snap | Bin 2462 -> 2455 bytes packages/core-cairo/src/erc721.ts | 3 ++- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/packages/core-cairo/src/erc721.test.ts.md b/packages/core-cairo/src/erc721.test.ts.md index 7836757d0..0ba26027c 100644 --- a/packages/core-cairo/src/erc721.test.ts.md +++ b/packages/core-cairo/src/erc721.test.ts.md @@ -272,8 +272,9 @@ Generated by [AVA](https://avajs.dev). impl ExternalImpl of ExternalTrait {␊ #[external(v0)]␊ fn burn(ref self: ContractState, token_id: u256) {␊ + let owner = self.erc721._owner_of(token_id);␊ let caller = get_caller_address();␊ - assert(self.erc721._is_approved_or_owner(caller, token_id), ERC721Component::Errors::UNAUTHORIZED);␊ + self.erc721._check_authorized(owner, caller, token_id);␊ self.erc721._burn(token_id);␊ }␊ }␊ @@ -866,8 +867,9 @@ Generated by [AVA](https://avajs.dev). #[external(v0)]␊ fn burn(ref self: ContractState, token_id: u256) {␊ self.pausable.assert_not_paused();␊ + let owner = self.erc721._owner_of(token_id);␊ let caller = get_caller_address();␊ - assert(self.erc721._is_approved_or_owner(caller, token_id), ERC721Component::Errors::UNAUTHORIZED);␊ + self.erc721._check_authorized(owner, caller, token_id);␊ self.erc721._burn(token_id);␊ }␊ ␊ @@ -1092,8 +1094,9 @@ Generated by [AVA](https://avajs.dev). #[external(v0)]␊ fn burn(ref self: ContractState, token_id: u256) {␊ self.pausable.assert_not_paused();␊ + let owner = self.erc721._owner_of(token_id);␊ let caller = get_caller_address();␊ - assert(self.erc721._is_approved_or_owner(caller, token_id), ERC721Component::Errors::UNAUTHORIZED);␊ + self.erc721._check_authorized(owner, caller, token_id);␊ self.erc721._burn(token_id);␊ }␊ ␊ diff --git a/packages/core-cairo/src/erc721.test.ts.snap b/packages/core-cairo/src/erc721.test.ts.snap index 8b677ed5c494cadf8371aa8a4aa4ddde62af9e5e..fc13ba71ce653524092df83ff66259c63806652f 100644 GIT binary patch literal 2455 zcmV;I3262~RzV@e4rydus+i}`1qU|Q` zH|&R(pdX6}00000000B+Tu*P~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o4T7s}x~mLXTN3L~*-myxAb6&|N3r<*D(V1wZoxx(cc8wC*!Up!qgsNT|c_ zu_aQoG1lyKnSf(@-DR}p3{BN!rAqqR%_@#2Ns_{*xz_Eycl_vyqh+9y|Sx6x#T`1!m=ewabM3===tegt1y!XA9H2m+qxh4&%mt$-`@9m#Dr^nCsZA%z}MRukz=Kk*^=B-98 zxSPtzUYz{qw6j-FsI}pwGssi2@06AVw%tiDyV+$Uq_1GIw|~%i@vP@`_L!=vu#ogD z;9SU%xn$e^R+(OHeOg_wPKIQjhYCAw%1OQ&*)7PKG<`)EX44gx_OyMaF9S@{p(I#P z#-?klv#b&rvbSlnH$4bc8W}RVi88seN2@mN517@-P8!i>AA4vRPzUuHeyc&7gEU~) zG!V0+s>!SpM{Qbb)Vcq!XzDQWLh5j6+A1TWwr+^}UR73Fc+ZS9KCuP|+R}t8m;>uN zs<~HLQOJrHpA|QZk1~rPOP*(zOub2hQg351h?`vpH}!N6M>64QF%UY!3gx z*__$f63*t7^nkNDa5kqx)@kAvoJLu?(J0 zJr{Us7Jg?CYMD^Wgj(jZm;`E>P|Ji`Ce$+Z22jhKw=JQTS<(Y)nNZ8DkQIJsP-(qd cr^BGK3zc1{>_TPtR#bNX4|>OsfNPNe0Kpp7H2?qr diff --git a/packages/core-cairo/src/erc721.ts b/packages/core-cairo/src/erc721.ts index 4be1ab0e6..48ba0ba1d 100644 --- a/packages/core-cairo/src/erc721.ts +++ b/packages/core-cairo/src/erc721.ts @@ -194,8 +194,9 @@ const functions = defineFunctions({ { name: 'token_id', type: 'u256' } ], code: [ + 'let owner = self.erc721._owner_of(token_id);', 'let caller = get_caller_address();', - 'assert(self.erc721._is_approved_or_owner(caller, token_id), ERC721Component::Errors::UNAUTHORIZED)', + 'self.erc721._check_authorized(owner, caller, token_id);', 'self.erc721._burn(token_id);' ] }, From 2b0c1a2c3846fc6d6dec25af692f21185754cbc2 Mon Sep 17 00:00:00 2001 From: Eric Lau Date: Tue, 21 May 2024 10:07:37 -0400 Subject: [PATCH 03/11] Use pausable in hooks WIP --- packages/core-cairo/src/add-pausable.ts | 5 +- packages/core-cairo/src/erc721.ts | 107 ++++++++++-------------- 2 files changed, 46 insertions(+), 66 deletions(-) diff --git a/packages/core-cairo/src/add-pausable.ts b/packages/core-cairo/src/add-pausable.ts index e6f1e0f2a..7dec045f6 100644 --- a/packages/core-cairo/src/add-pausable.ts +++ b/packages/core-cairo/src/add-pausable.ts @@ -1,5 +1,5 @@ import { getSelfArg } from './common-options'; -import type { BaseImplementedTrait, ContractBuilder, ContractFunction } from './contract'; +import type { ContractBuilder } from './contract'; import { Access, requireAccessControl } from './set-access-control'; import { defineFunctions } from './utils/define-functions'; import { defineComponents } from './utils/define-components'; @@ -57,6 +57,3 @@ const functions = defineFunctions({ }, }); -export function setPausable(c: ContractBuilder, t: BaseImplementedTrait, fn: ContractFunction) { - c.addFunctionCodeBefore(t, fn, 'self.pausable.assert_not_paused()'); -} diff --git a/packages/core-cairo/src/erc721.ts b/packages/core-cairo/src/erc721.ts index 48ba0ba1d..3aac1fc57 100644 --- a/packages/core-cairo/src/erc721.ts +++ b/packages/core-cairo/src/erc721.ts @@ -1,6 +1,6 @@ import { BaseImplementedTrait, Contract, ContractBuilder } from './contract'; import { Access, requireAccessControl, setAccessControl } from './set-access-control'; -import { addPausable, setPausable } from './add-pausable'; +import { addPausable } from './add-pausable'; import { defineFunctions } from './utils/define-functions'; import { CommonOptions, withCommonDefaults, getSelfArg } from './common-options'; import { setUpgradeable } from './set-upgradeable'; @@ -58,29 +58,23 @@ export function buildERC721(opts: ERC721Options): Contract { const allOpts = withDefaults(opts); addBase(c, toByteArray(allOpts.name), toByteArray(allOpts.symbol), toByteArray(allOpts.baseUri)); - addERC721MixinOrImpls(c, allOpts.pausable); - addSRC5Component(c); + addERC721Mixin(c); if (allOpts.pausable) { addPausable(c, allOpts.access); + addPausableHook(c); + } else { + c.addStandaloneImport('openzeppelin::token::erc721::ERC721HooksEmptyImpl'); } if (allOpts.burnable) { addBurnable(c); - if (allOpts.pausable) { - setPausable(c, externalTrait, functions.burn); - } } if (allOpts.mintable) { addMintable(c, allOpts.access); - if (allOpts.pausable) { - setPausable(c, externalTrait, functions.safe_mint); - } } - c.addStandaloneImport('openzeppelin::token::erc721::ERC721HooksEmptyImpl'); - setAccessControl(c, allOpts.access); setUpgradeable(c, allOpts.upgradeable, allOpts.access); setInfo(c, allOpts.info); @@ -88,61 +82,50 @@ export function buildERC721(opts: ERC721Options): Contract { return c; } -function addERC721Interface(c: ContractBuilder) { - c.addStandaloneImport('openzeppelin::token::erc721::interface'); -} +function addPausableHook(c: ContractBuilder) { + const ERC721HooksTrait: BaseImplementedTrait = { + name: `ERC721HooksImpl`, + of: 'ERC721Component::ERC721HooksTrait', + tags: [], + priority: 0, + }; + c.addImplementedTrait(ERC721HooksTrait); -function addERC721MixinOrImpls(c: ContractBuilder, pausable: boolean) { - if (pausable) { - addERC721Interface(c); + c.addStandaloneImport('starknet::ContractAddress'); - c.addImplToComponent(components.ERC721Component, { - name: 'ERC721MetadataImpl', - value: 'ERC721Component::ERC721MetadataImpl', - }); - c.addImplToComponent(components.ERC721Component, { - name: 'ERC721MetadataCamelOnly', - value: 'ERC721Component::ERC721MetadataCamelOnlyImpl', - }); + c.addFunction(ERC721HooksTrait, { + name: 'before_update', + args: [ + { name: 'ref self', type: `ERC721Component::ComponentState` }, + { name: 'to', type: 'ContractAddress' }, + { name: 'token_id', type: 'u256' }, + { name: 'auth', type: 'ContractAddress' }, + ], + code: [ + 'let contract_state = ERC721Component::HasComponent::get_contract(@self)', + 'contract_state.pausable.assert_not_paused()', + ], + }); - const ERC721Impl: BaseImplementedTrait = { - name: 'ERC721Impl', - of: 'interface::IERC721', - tags: [ - 'abi(embed_v0)' - ], - } - c.addFunction(ERC721Impl, functions.balance_of); - c.addFunction(ERC721Impl, functions.owner_of); - setPausable(c, ERC721Impl, functions.safe_transfer_from); - setPausable(c, ERC721Impl, functions.transfer_from); - setPausable(c, ERC721Impl, functions.approve); - setPausable(c, ERC721Impl, functions.set_approval_for_all); - c.addFunction(ERC721Impl, functions.get_approved); - c.addFunction(ERC721Impl, functions.is_approved_for_all); + c.addFunction(ERC721HooksTrait, { + name: 'after_update', + args: [ + { name: 'ref self', type: `ERC721Component::ComponentState` }, + { name: 'to', type: 'ContractAddress' }, + { name: 'token_id', type: 'u256' }, + { name: 'auth', type: 'ContractAddress' }, + ], + code: [], + }); +} - const ERC721CamelOnlyImpl: BaseImplementedTrait = { - name: 'ERC721CamelOnlyImpl', - of: 'interface::IERC721CamelOnly', - tags: [ - 'abi(embed_v0)' - ], - } - // Camel case versions of the functions above. Pausable is already set above. - c.addFunction(ERC721CamelOnlyImpl, functions.balanceOf); - c.addFunction(ERC721CamelOnlyImpl, functions.ownerOf); - c.addFunction(ERC721CamelOnlyImpl, functions.safeTransferFrom); - c.addFunction(ERC721CamelOnlyImpl, functions.transferFrom); - c.addFunction(ERC721CamelOnlyImpl, functions.setApprovalForAll); - c.addFunction(ERC721CamelOnlyImpl, functions.getApproved); - c.addFunction(ERC721CamelOnlyImpl, functions.isApprovedForAll); - } else { - c.addImplToComponent(components.ERC721Component, { - name: 'ERC721MixinImpl', - value: 'ERC721Component::ERC721MixinImpl', - }); - c.addInterfaceFlag('ISRC5'); - } +function addERC721Mixin(c: ContractBuilder) { + c.addImplToComponent(components.ERC721Component, { + name: 'ERC721MixinImpl', + value: 'ERC721Component::ERC721MixinImpl', + }); + c.addInterfaceFlag('ISRC5'); + addSRC5Component(c); } function addBase(c: ContractBuilder, name: string, symbol: string, baseUri: string) { From a35ae9869ff45c2e8275a3a4f482c7378c6c4395 Mon Sep 17 00:00:00 2001 From: Eric Lau Date: Tue, 21 May 2024 14:34:38 -0400 Subject: [PATCH 04/11] Use pausable in hooks WIP --- packages/core-cairo/src/erc1155.ts | 247 ++++++----------------------- packages/core-cairo/src/erc721.ts | 163 ------------------- 2 files changed, 47 insertions(+), 363 deletions(-) diff --git a/packages/core-cairo/src/erc1155.ts b/packages/core-cairo/src/erc1155.ts index 17370b8ee..529f4a35e 100644 --- a/packages/core-cairo/src/erc1155.ts +++ b/packages/core-cairo/src/erc1155.ts @@ -1,6 +1,6 @@ import { BaseImplementedTrait, Contract, ContractBuilder } from './contract'; import { Access, requireAccessControl, setAccessControl } from './set-access-control'; -import { addPausable, setPausable } from './add-pausable'; +import { addPausable } from './add-pausable'; import { defineFunctions } from './utils/define-functions'; import { CommonOptions, withCommonDefaults, getSelfArg } from './common-options'; import { setUpgradeable } from './set-upgradeable'; @@ -58,35 +58,27 @@ export function buildERC1155(opts: ERC1155Options): Contract { const allOpts = withDefaults(opts); addBase(c, toByteArray(allOpts.baseUri)); - addERC1155MixinOrImpls(c, allOpts.pausable); - addSRC5Component(c); + addERC1155Mixin(c); if (allOpts.pausable) { addPausable(c, allOpts.access); + addPausableHook(c); + } else { + c.addStandaloneImport('openzeppelin::token::erc1155::ERC1155HooksEmptyImpl'); } if (allOpts.burnable) { addBurnable(c); - if (allOpts.pausable) { - setPausable(c, externalTrait, functions.burn); - setPausable(c, externalTrait, functions.batch_burn); - } } if (allOpts.mintable) { addMintable(c, allOpts.access); - if (allOpts.pausable) { - setPausable(c, externalTrait, functions.mint); - setPausable(c, externalTrait, functions.batch_mint); - } } if (allOpts.updatableUri) { addSetBaseUri(c, allOpts.access); } - c.addStandaloneImport('openzeppelin::token::erc1155::ERC1155HooksEmptyImpl'); - setAccessControl(c, allOpts.access); setUpgradeable(c, allOpts.upgradeable, allOpts.access); setInfo(c, allOpts.info); @@ -94,54 +86,52 @@ export function buildERC1155(opts: ERC1155Options): Contract { return c; } -function addERC1155Interface(c: ContractBuilder) { - c.addStandaloneImport('openzeppelin::token::erc1155::interface'); -} +function addPausableHook(c: ContractBuilder) { + const ERC1155HooksTrait: BaseImplementedTrait = { + name: `ERC1155HooksImpl`, + of: 'ERC1155Component::ERC1155HooksTrait', + tags: [], + priority: 0, + }; + c.addImplementedTrait(ERC1155HooksTrait); -function addERC1155MixinOrImpls(c: ContractBuilder, pausable: boolean) { - if (pausable) { - addERC1155Interface(c); + c.addStandaloneImport('starknet::ContractAddress'); - c.addImplToComponent(components.ERC1155Component, { - name: 'ERC1155MetadataURIImpl', - value: 'ERC1155Component::ERC1155MetadataURIImpl', - }); + c.addFunction(ERC1155HooksTrait, { + name: 'before_update', + args: [ + { name: 'ref self', type: `ERC1155Component::ComponentState` }, + { name: 'from', type: 'ContractAddress' }, + { name: 'to', type: 'ContractAddress' }, + { name: 'token_ids', type: 'Span' }, + { name: 'values', type: 'Span' }, + ], + code: [ + 'let contract_state = ERC1155Component::HasComponent::get_contract(@self)', + 'contract_state.pausable.assert_not_paused()', + ], + }); - const ERC1155Impl: BaseImplementedTrait = { - name: 'ERC1155Impl', - of: 'interface::IERC1155', - tags: [ - 'abi(embed_v0)' - ], - } - c.addFunction(ERC1155Impl, functions.balance_of); - c.addFunction(ERC1155Impl, functions.balance_of_batch); - setPausable(c, ERC1155Impl, functions.safe_transfer_from); - setPausable(c, ERC1155Impl, functions.safe_batch_transfer_from); - setPausable(c, ERC1155Impl, functions.set_approval_for_all); - c.addFunction(ERC1155Impl, functions.is_approved_for_all); + c.addFunction(ERC1155HooksTrait, { + name: 'after_update', + args: [ + { name: 'ref self', type: `ERC1155Component::ComponentState` }, + { name: 'from', type: 'ContractAddress' }, + { name: 'to', type: 'ContractAddress' }, + { name: 'token_ids', type: 'Span' }, + { name: 'values', type: 'Span' }, + ], + code: [], + }); +} - const ERC1155CamelImpl: BaseImplementedTrait = { - name: 'ERC1155CamelImpl', - of: 'interface::IERC1155Camel', - tags: [ - 'abi(embed_v0)' - ], - } - // Camel case versions of the functions above. Pausable is already set above. - c.addFunction(ERC1155CamelImpl, functions.balanceOf); - c.addFunction(ERC1155CamelImpl, functions.balanceOfBatch); - c.addFunction(ERC1155CamelImpl, functions.safeTransferFrom); - c.addFunction(ERC1155CamelImpl, functions.safeBatchTransferFrom); - c.addFunction(ERC1155CamelImpl, functions.setApprovalForAll); - c.addFunction(ERC1155CamelImpl, functions.isApprovedForAll); - } else { - c.addImplToComponent(components.ERC1155Component, { - name: 'ERC1155MixinImpl', - value: 'ERC1155Component::ERC1155MixinImpl', - }); - c.addInterfaceFlag('ISRC5'); - } +function addERC1155Mixin(c: ContractBuilder) { + c.addImplToComponent(components.ERC1155Component, { + name: 'ERC1155MixinImpl', + value: 'ERC1155Component::ERC1155MixinImpl', + }); + c.addInterfaceFlag('ISRC5'); + addSRC5Component(c); } function addBase(c: ContractBuilder, baseUri: string) { @@ -292,147 +282,4 @@ const functions = defineFunctions({ 'self.set_base_uri(baseUri);' ] }, - - // Re-implements ERC1155Impl - balance_of: { - args: [ - getSelfArg('view'), - { name: 'account', type: 'ContractAddress' }, - { name: 'token_id', type: 'u256' }, - ], - returns: 'u256', - code: [ - 'self.erc1155.balance_of(account, token_id)' - ] - }, - balance_of_batch: { - args: [ - getSelfArg('view'), - { name: 'accounts', type: 'Span' }, - { name: 'token_ids', type: 'Span' }, - ], - returns: 'Span', - code: [ - 'self.erc1155.balance_of_batch(accounts, token_ids)' - ] - }, - safe_transfer_from: { - args: [ - getSelfArg(), - { name: 'from', type: 'ContractAddress' }, - { name: 'to', type: 'ContractAddress' }, - { name: 'token_id', type: 'u256' }, - { name: 'value', type: 'u256' }, - { name: 'data', type: 'Span' }, - ], - code: [ - 'self.erc1155.safe_transfer_from(from, to, token_id, value, data)' - ] - }, - safe_batch_transfer_from: { - args: [ - getSelfArg(), - { name: 'from', type: 'ContractAddress' }, - { name: 'to', type: 'ContractAddress' }, - { name: 'token_ids', type: 'Span' }, - { name: 'values', type: 'Span' }, - { name: 'data', type: 'Span' }, - ], - code: [ - 'self.erc1155.safe_batch_transfer_from(from, to, token_ids, values, data)' - ] - }, - set_approval_for_all: { - args: [ - getSelfArg(), - { name: 'operator', type: 'ContractAddress' }, - { name: 'approved', type: 'bool' }, - ], - code: [ - 'self.erc1155.set_approval_for_all(operator, approved)' - ] - }, - is_approved_for_all: { - args: [ - getSelfArg('view'), - { name: 'owner', type: 'ContractAddress' }, - { name: 'operator', type: 'ContractAddress' }, - ], - returns: 'bool', - code: [ - 'self.erc1155.is_approved_for_all(owner, operator)' - ] - }, - - // Re-implements ERC1155CamelImpl - - balanceOf: { - args: [ - getSelfArg('view'), - { name: 'account', type: 'ContractAddress' }, - { name: 'tokenId', type: 'u256' }, - ], - returns: 'u256', - code: [ - 'self.balance_of(account, tokenId)' - ] - }, - balanceOfBatch: { - args: [ - getSelfArg('view'), - { name: 'accounts', type: 'Span' }, - { name: 'tokenIds', type: 'Span' }, - ], - returns: 'Span', - code: [ - 'self.balance_of_batch(accounts, tokenIds)' - ] - }, - safeTransferFrom: { - args: [ - getSelfArg(), - { name: 'from', type: 'ContractAddress' }, - { name: 'to', type: 'ContractAddress' }, - { name: 'tokenId', type: 'u256' }, - { name: 'value', type: 'u256' }, - { name: 'data', type: 'Span' }, - ], - code: [ - 'self.safe_transfer_from(from, to, tokenId, value, data)' - ] - }, - safeBatchTransferFrom: { - args: [ - getSelfArg(), - { name: 'from', type: 'ContractAddress' }, - { name: 'to', type: 'ContractAddress' }, - { name: 'tokenIds', type: 'Span' }, - { name: 'values', type: 'Span' }, - { name: 'data', type: 'Span' }, - ], - code: [ - 'self.safe_batch_transfer_from(from, to, tokenIds, values, data)' - ] - }, - setApprovalForAll: { - args: [ - getSelfArg(), - { name: 'operator', type: 'ContractAddress' }, - { name: 'approved', type: 'bool' }, - ], - code: [ - 'self.set_approval_for_all(operator, approved)' - ] - }, - isApprovedForAll: { - args: [ - getSelfArg('view'), - { name: 'owner', type: 'ContractAddress' }, - { name: 'operator', type: 'ContractAddress' }, - ], - returns: 'bool', - code: [ - 'self.is_approved_for_all(owner, operator)' - ] - }, }); diff --git a/packages/core-cairo/src/erc721.ts b/packages/core-cairo/src/erc721.ts index 3aac1fc57..8637b860e 100644 --- a/packages/core-cairo/src/erc721.ts +++ b/packages/core-cairo/src/erc721.ts @@ -205,167 +205,4 @@ const functions = defineFunctions({ 'self.safe_mint(recipient, tokenId, data);', ] }, - - // Re-implements ERC721Impl - balance_of: { - args: [ - getSelfArg('view'), - { name: 'account', type: 'ContractAddress' }, - ], - returns: 'u256', - code: [ - 'self.erc721.balance_of(account)' - ] - }, - owner_of: { - args: [ - getSelfArg('view'), - { name: 'token_id', type: 'u256' }, - ], - returns: 'ContractAddress', - code: [ - 'self.erc721.owner_of(token_id)' - ] - }, - safe_transfer_from: { - args: [ - getSelfArg(), - { name: 'from', type: 'ContractAddress' }, - { name: 'to', type: 'ContractAddress' }, - { name: 'token_id', type: 'u256' }, - { name: 'data', type: 'Span' }, - ], - code: [ - 'self.erc721.safe_transfer_from(from, to, token_id, data)' - ] - }, - transfer_from: { - args: [ - getSelfArg(), - { name: 'from', type: 'ContractAddress' }, - { name: 'to', type: 'ContractAddress' }, - { name: 'token_id', type: 'u256' }, - ], - code: [ - 'self.erc721.transfer_from(from, to, token_id)' - ] - }, - approve: { - args: [ - getSelfArg(), - { name: 'to', type: 'ContractAddress' }, - { name: 'token_id', type: 'u256' }, - ], - code: [ - 'self.erc721.approve(to, token_id)' - ] - }, - set_approval_for_all: { - args: [ - getSelfArg(), - { name: 'operator', type: 'ContractAddress' }, - { name: 'approved', type: 'bool' }, - ], - code: [ - 'self.erc721.set_approval_for_all(operator, approved)' - ] - }, - get_approved: { - args: [ - getSelfArg('view'), - { name: 'token_id', type: 'u256' }, - ], - returns: 'ContractAddress', - code: [ - 'self.erc721.get_approved(token_id)' - ] - }, - is_approved_for_all: { - args: [ - getSelfArg('view'), - { name: 'owner', type: 'ContractAddress' }, - { name: 'operator', type: 'ContractAddress' }, - ], - returns: 'bool', - code: [ - 'self.erc721.is_approved_for_all(owner, operator)' - ] - }, - - // Re-implements ERC721CamelOnlyImpl - - balanceOf: { - args: [ - getSelfArg('view'), - { name: 'account', type: 'ContractAddress' }, - ], - returns: 'u256', - code: [ - 'self.balance_of(account)' - ] - }, - ownerOf: { - args: [ - getSelfArg('view'), - { name: 'tokenId', type: 'u256' }, - ], - returns: 'ContractAddress', - code: [ - 'self.owner_of(tokenId)' - ] - }, - safeTransferFrom: { - args: [ - getSelfArg(), - { name: 'from', type: 'ContractAddress' }, - { name: 'to', type: 'ContractAddress' }, - { name: 'tokenId', type: 'u256' }, - { name: 'data', type: 'Span' }, - ], - code: [ - 'self.safe_transfer_from(from, to, tokenId, data)' - ] - }, - transferFrom: { - args: [ - getSelfArg(), - { name: 'from', type: 'ContractAddress' }, - { name: 'to', type: 'ContractAddress' }, - { name: 'tokenId', type: 'u256' }, - ], - code: [ - 'self.transfer_from(from, to, tokenId)' - ] - }, - setApprovalForAll: { - args: [ - getSelfArg(), - { name: 'operator', type: 'ContractAddress' }, - { name: 'approved', type: 'bool' }, - ], - code: [ - 'self.set_approval_for_all(operator, approved)' - ] - }, - getApproved: { - args: [ - getSelfArg('view'), - { name: 'tokenId', type: 'u256' }, - ], - returns: 'ContractAddress', - code: [ - 'self.get_approved(tokenId)' - ] - }, - isApprovedForAll: { - args: [ - getSelfArg('view'), - { name: 'owner', type: 'ContractAddress' }, - { name: 'operator', type: 'ContractAddress' }, - ], - returns: 'bool', - code: [ - 'self.is_approved_for_all(owner, operator)' - ] - }, }); From 1d939d087d2e66eb5dba99a45f2329387062efd5 Mon Sep 17 00:00:00 2001 From: Eric Lau Date: Tue, 21 May 2024 17:19:20 -0400 Subject: [PATCH 05/11] Use votes and pausable hook in erc20 --- packages/core-cairo/src/erc20.ts | 307 +++++++++++-------------------- 1 file changed, 104 insertions(+), 203 deletions(-) diff --git a/packages/core-cairo/src/erc20.ts b/packages/core-cairo/src/erc20.ts index 21a4dd8fa..cdbe9b34a 100644 --- a/packages/core-cairo/src/erc20.ts +++ b/packages/core-cairo/src/erc20.ts @@ -1,6 +1,6 @@ -import { BaseImplementedTrait, Contract, ContractBuilder } from './contract'; +import { BaseImplementedTrait, Contract, ContractBuilder, ContractFunction } from './contract'; import { Access, requireAccessControl, setAccessControl } from './set-access-control'; -import { addPausable, setPausable } from './add-pausable'; +import { addPausable } from './add-pausable'; import { defineFunctions } from './utils/define-functions'; import { CommonOptions, withCommonDefaults, getSelfArg } from './common-options'; import { setUpgradeable } from './set-upgradeable'; @@ -67,7 +67,7 @@ export function buildERC20(opts: ERC20Options): Contract { const allOpts = withDefaults(opts); addBase(c, toByteArray(allOpts.name), toByteArray(allOpts.symbol)); - addERC20MixinOrImpls(c, allOpts.pausable); + addERC20Mixin(c); if (allOpts.premint) { addPremint(c, allOpts.premint); @@ -79,35 +79,13 @@ export function buildERC20(opts: ERC20Options): Contract { if (allOpts.burnable) { addBurnable(c); - if (allOpts.pausable) { - setPausable(c, externalTrait, functions.burn); - } } if (allOpts.mintable) { addMintable(c, allOpts.access); - if (allOpts.pausable) { - setPausable(c, externalTrait, functions.mint); - } } - if (allOpts.votes) { - if (!allOpts.appName) { - throw new OptionsError({ - appName: 'Application Name is required when Votes are enabled', - }); - } - - if (!allOpts.appVersion) { - throw new OptionsError({ - appVersion: 'Application Version is required when Votes are enabled', - }); - } - - addVotes(c, toFelt252(allOpts.appName, 'appName'), toFelt252(allOpts.appVersion, 'appVersion')); - } else { - c.addStandaloneImport('openzeppelin::token::erc20::ERC20HooksEmptyImpl'); - } + addHooks(c, allOpts); setAccessControl(c, allOpts.access); setUpgradeable(c, allOpts.upgradeable, allOpts.access); @@ -116,52 +94,114 @@ export function buildERC20(opts: ERC20Options): Contract { return c; } -function addERC20Interface(c: ContractBuilder) { - c.addStandaloneImport('openzeppelin::token::erc20::interface'); -} - -function addERC20MixinOrImpls(c: ContractBuilder, pausable: boolean) { - if (pausable) { - addERC20Interface(c); - - c.addImplToComponent(components.ERC20Component, { - name: 'ERC20MetadataImpl', - value: 'ERC20Component::ERC20MetadataImpl', +function addHooks(c: ContractBuilder, allOpts: Required) { + if (allOpts.votes || allOpts.pausable) { + const hooksTrait = { + name: 'ERC20HooksImpl', + of: 'ERC20Component::ERC20HooksTrait', + tags: [], + priority: 1, + }; + c.addImplementedTrait(hooksTrait); + + const beforeUpdateFn = c.addFunction(hooksTrait, { + name: 'before_update', + args: [ + { name: 'ref self', type: 'ERC20Component::ComponentState' }, + { name: 'from', type: 'ContractAddress' }, + { name: 'recipient', type: 'ContractAddress' }, + { name: 'amount', type: 'u256' }, + ], + code: [], }); - const ERC20Impl: BaseImplementedTrait = { - name: 'ERC20Impl', - of: 'interface::IERC20', - tags: [ - 'abi(embed_v0)' + const afterUpdateFn = c.addFunction(hooksTrait, { + name: 'after_update', + args: [ + { name: 'ref self', type: 'ERC20Component::ComponentState' }, + { name: 'from', type: 'ContractAddress' }, + { name: 'recipient', type: 'ContractAddress' }, + { name: 'amount', type: 'u256' }, ], + code: [], + }); + + if (allOpts.pausable) { + beforeUpdateFn.code.push( + 'let contract_state = ERC20Component::HasComponent::get_contract(@self);', + 'contract_state.pausable.assert_not_paused();', + ); } - c.addFunction(ERC20Impl, functions.total_supply); - c.addFunction(ERC20Impl, functions.balance_of); - c.addFunction(ERC20Impl, functions.allowance); - setPausable(c, ERC20Impl, functions.transfer); - setPausable(c, ERC20Impl, functions.transfer_from); - setPausable(c, ERC20Impl, functions.approve); - - const ERC20CamelOnlyImpl: BaseImplementedTrait = { - name: 'ERC20CamelOnlyImpl', - of: 'interface::IERC20CamelOnly', - tags: [ - 'abi(embed_v0)' - ], + + if (allOpts.votes) { + if (!allOpts.appName) { + throw new OptionsError({ + appName: 'Application Name is required when Votes are enabled', + }); + } + + if (!allOpts.appVersion) { + throw new OptionsError({ + appVersion: 'Application Version is required when Votes are enabled', + }); + } + + addVotesComponent(c, toFelt252(allOpts.appName, 'appName'), toFelt252(allOpts.appVersion, 'appVersion')); + + afterUpdateFn.code.push( + 'let mut contract_state = ERC20Component::HasComponent::get_contract_mut(ref self);', + 'contract_state.erc20_votes.transfer_voting_units(from, recipient, amount);', + ); } - // Camel case versions of the functions above. Pausable is already set above. - c.addFunction(ERC20CamelOnlyImpl, functions.totalSupply); - c.addFunction(ERC20CamelOnlyImpl, functions.balanceOf); - c.addFunction(ERC20CamelOnlyImpl, functions.transferFrom); } else { - c.addImplToComponent(components.ERC20Component, { - name: 'ERC20MixinImpl', - value: 'ERC20Component::ERC20MixinImpl', - }); + c.addStandaloneImport('openzeppelin::token::erc20::ERC20HooksEmptyImpl'); } } +function addPausableHook(c: ContractBuilder) { + const ERC721HooksTrait: BaseImplementedTrait = { + name: `ERC721HooksImpl`, + of: 'ERC721Component::ERC721HooksTrait', + tags: [], + priority: 0, + }; + c.addImplementedTrait(ERC721HooksTrait); + + c.addStandaloneImport('starknet::ContractAddress'); + + c.addFunction(ERC721HooksTrait, { + name: 'before_update', + args: [ + { name: 'ref self', type: `ERC721Component::ComponentState` }, + { name: 'to', type: 'ContractAddress' }, + { name: 'token_id', type: 'u256' }, + { name: 'auth', type: 'ContractAddress' }, + ], + code: [ + 'let contract_state = ERC721Component::HasComponent::get_contract(@self)', + 'contract_state.pausable.assert_not_paused()', + ], + }); + + c.addFunction(ERC721HooksTrait, { + name: 'after_update', + args: [ + { name: 'ref self', type: `ERC721Component::ComponentState` }, + { name: 'to', type: 'ContractAddress' }, + { name: 'token_id', type: 'u256' }, + { name: 'auth', type: 'ContractAddress' }, + ], + code: [], + }); +} + +function addERC20Mixin(c: ContractBuilder) { + c.addImplToComponent(components.ERC20Component, { + name: 'ERC20MixinImpl', + value: 'ERC20Component::ERC20MixinImpl', + }); +} + function addBase(c: ContractBuilder, name: string, symbol: string) { c.addComponent( components.ERC20Component, @@ -241,10 +281,9 @@ function addMintable(c: ContractBuilder, access: Access) { requireAccessControl(c, externalTrait, functions.mint, access, 'MINTER', 'minter'); } -function addVotes(c: ContractBuilder, name: string, version: string) { +function addVotesComponent(c: ContractBuilder, name: string, version: string) { c.addComponent(components.ERC20VotesComponent, [], false); c.addComponent(components.NoncesComponent, [], false); - c.addStandaloneImport('openzeppelin::token::erc20::extensions::ERC20VotesComponent::InternalTrait as ERC20VotesInternalTrait'); c.addStandaloneImport('openzeppelin::utils::cryptography::snip12::SNIP12Metadata'); c.addStandaloneImport('starknet::ContractAddress'); @@ -274,45 +313,6 @@ function addVotes(c: ContractBuilder, name: string, version: string) { `'${version}'`, ], }); - - const ERC20HooksTrait: BaseImplementedTrait = { - name: `ERC20VotesHooksImpl< - TContractState, - impl ERC20Votes: ERC20VotesComponent::HasComponent, - impl HasComponent: ERC20Component::HasComponent, - +NoncesComponent::HasComponent, - +Drop - >`, - of: 'ERC20Component::ERC20HooksTrait', - tags: [], - priority: 1, - }; - c.addImplementedTrait(ERC20HooksTrait); - - c.addFunction(ERC20HooksTrait, { - name: 'before_update', - args: [ - { name: 'ref self', type: 'ERC20Component::ComponentState' }, - { name: 'from', type: 'ContractAddress' }, - { name: 'recipient', type: 'ContractAddress' }, - { name: 'amount', type: 'u256' }, - ], - code: [], - }); - - c.addFunction(ERC20HooksTrait, { - name: 'after_update', - args: [ - { name: 'ref self', type: 'ERC20Component::ComponentState' }, - { name: 'from', type: 'ContractAddress' }, - { name: 'recipient', type: 'ContractAddress' }, - { name: 'amount', type: 'u256' }, - ], - code: [ - 'let mut erc20_votes_component = get_dep_component_mut!(ref self, ERC20Votes);', - 'erc20_votes_component.transfer_voting_units(from, recipient, amount);', - ], - }); } const components = defineComponents( { @@ -389,103 +389,4 @@ const functions = defineFunctions({ 'self.erc20._mint(recipient, amount);' ] }, - - // Re-implements ERC20Impl - total_supply: { - args: [ - getSelfArg('view') - ], - code: [ - 'self.erc20.total_supply()' - ], - returns : 'u256', - }, - balance_of: { - args: [ - getSelfArg('view'), - { name: 'account', type: 'ContractAddress' }, - ], - code: [ - 'self.erc20.balance_of(account)' - ], - returns : 'u256', - }, - allowance: { - args: [ - getSelfArg('view'), - { name: 'owner', type: 'ContractAddress' }, - { name: 'spender', type: 'ContractAddress' }, - ], - code: [ - 'self.erc20.allowance(owner, spender)' - ], - returns : 'u256', - }, - transfer: { - args: [ - getSelfArg(), - { name: 'recipient', type: 'ContractAddress' }, - { name: 'amount', type: 'u256' }, - ], - code: [ - 'self.erc20.transfer(recipient, amount)', - ], - returns : 'bool', - }, - transfer_from: { - args: [ - getSelfArg(), - { name: 'sender', type: 'ContractAddress' }, - { name: 'recipient', type: 'ContractAddress' }, - { name: 'amount', type: 'u256' }, - ], - code: [ - 'self.erc20.transfer_from(sender, recipient, amount)', - ], - returns : 'bool', - }, - approve: { - args: [ - getSelfArg(), - { name: 'spender', type: 'ContractAddress' }, - { name: 'amount', type: 'u256' }, - ], - code: [ - 'self.erc20.approve(spender, amount)', - ], - returns : 'bool', - }, - - // Re-implements ERC20CamelOnlyImpl - totalSupply: { - args: [ - getSelfArg('view') - ], - code: [ - 'self.total_supply()' - ], - returns : 'u256', - }, - balanceOf: { - args: [ - getSelfArg('view'), - { name: 'account', type: 'ContractAddress' }, - ], - code: [ - 'self.balance_of(account)' - ], - returns : 'u256', - }, - transferFrom: { - args: [ - getSelfArg(), - { name: 'sender', type: 'ContractAddress' }, - { name: 'recipient', type: 'ContractAddress' }, - { name: 'amount', type: 'u256' }, - ], - code: [ - 'self.transfer_from(sender, recipient, amount)', - ], - returns : 'bool', - }, }); From a48653e6038d0241dab5454e37dce42a9b43370c Mon Sep 17 00:00:00 2001 From: Eric Lau Date: Tue, 21 May 2024 17:24:41 -0400 Subject: [PATCH 06/11] Simplify burn functions --- packages/core-cairo/src/erc20.ts | 3 +-- packages/core-cairo/src/erc721.ts | 5 +---- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/packages/core-cairo/src/erc20.ts b/packages/core-cairo/src/erc20.ts index cdbe9b34a..3c53ecbb8 100644 --- a/packages/core-cairo/src/erc20.ts +++ b/packages/core-cairo/src/erc20.ts @@ -375,8 +375,7 @@ const functions = defineFunctions({ { name: 'value', type: 'u256' } ], code: [ - 'let caller = get_caller_address();', - 'self.erc20._burn(caller, value);' + 'self.erc20._burn(get_caller_address(), value);' ] }, mint: { diff --git a/packages/core-cairo/src/erc721.ts b/packages/core-cairo/src/erc721.ts index 8637b860e..a309a4a88 100644 --- a/packages/core-cairo/src/erc721.ts +++ b/packages/core-cairo/src/erc721.ts @@ -177,10 +177,7 @@ const functions = defineFunctions({ { name: 'token_id', type: 'u256' } ], code: [ - 'let owner = self.erc721._owner_of(token_id);', - 'let caller = get_caller_address();', - 'self.erc721._check_authorized(owner, caller, token_id);', - 'self.erc721._burn(token_id);' + 'self.erc721._update(Zeroable::zero(), token_id, get_caller_address());', ] }, safe_mint: { From 34b6cc33426b755cc7f48035346c381c00235b85 Mon Sep 17 00:00:00 2001 From: Eric Lau Date: Tue, 21 May 2024 17:25:25 -0400 Subject: [PATCH 07/11] Update snapshots --- packages/core-cairo/src/erc1155.test.ts.md | 263 ++-------- packages/core-cairo/src/erc1155.test.ts.snap | Bin 2885 -> 2535 bytes packages/core-cairo/src/erc20.test.ts.md | 481 +++---------------- packages/core-cairo/src/erc20.test.ts.snap | Bin 3191 -> 2770 bytes packages/core-cairo/src/erc721.test.ts.md | 313 ++---------- packages/core-cairo/src/erc721.test.ts.snap | Bin 2455 -> 2006 bytes 6 files changed, 140 insertions(+), 917 deletions(-) diff --git a/packages/core-cairo/src/erc1155.test.ts.md b/packages/core-cairo/src/erc1155.test.ts.md index 5d0ded3c9..035806aad 100644 --- a/packages/core-cairo/src/erc1155.test.ts.md +++ b/packages/core-cairo/src/erc1155.test.ts.md @@ -475,8 +475,6 @@ Generated by [AVA](https://avajs.dev). use openzeppelin::introspection::src5::SRC5Component;␊ use openzeppelin::security::pausable::PausableComponent;␊ use openzeppelin::token::erc1155::ERC1155Component;␊ - use openzeppelin::token::erc1155::ERC1155HooksEmptyImpl;␊ - use openzeppelin::token::erc1155::interface;␊ use openzeppelin::upgrades::UpgradeableComponent;␊ use openzeppelin::upgrades::interface::IUpgradeable;␊ use starknet::ClassHash;␊ @@ -489,9 +487,7 @@ Generated by [AVA](https://avajs.dev). component!(path: UpgradeableComponent, storage: upgradeable, event: UpgradeableEvent);␊ ␊ #[abi(embed_v0)]␊ - impl ERC1155MetadataURIImpl = ERC1155Component::ERC1155MetadataURIImpl;␊ - #[abi(embed_v0)]␊ - impl SRC5Impl = SRC5Component::SRC5Impl;␊ + impl ERC1155MixinImpl = ERC1155Component::ERC1155MixinImpl;␊ #[abi(embed_v0)]␊ impl PausableImpl = PausableComponent::PausableImpl;␊ #[abi(embed_v0)]␊ @@ -537,88 +533,25 @@ Generated by [AVA](https://avajs.dev). self.ownable.initializer(owner);␊ }␊ ␊ - #[abi(embed_v0)]␊ - impl ERC1155CamelImpl of interface::IERC1155Camel {␊ - fn balanceOf(self: @ContractState, account: ContractAddress, tokenId: u256) -> u256 {␊ - self.balance_of(account, tokenId)␊ - }␊ - ␊ - fn balanceOfBatch(self: @ContractState, accounts: Span, tokenIds: Span) -> Span {␊ - self.balance_of_batch(accounts, tokenIds)␊ - }␊ - ␊ - fn safeTransferFrom(␊ - ref self: ContractState,␊ - from: ContractAddress,␊ - to: ContractAddress,␊ - tokenId: u256,␊ - value: u256,␊ - data: Span,␊ - ) {␊ - self.safe_transfer_from(from, to, tokenId, value, data);␊ - }␊ - ␊ - fn safeBatchTransferFrom(␊ - ref self: ContractState,␊ + impl ERC1155HooksImpl of ERC1155Component::ERC1155HooksTrait {␊ + fn before_update(␊ + ref self: ERC1155Component::ComponentState,␊ from: ContractAddress,␊ to: ContractAddress,␊ - tokenIds: Span,␊ + token_ids: Span,␊ values: Span,␊ - data: Span,␊ - ) {␊ - self.safe_batch_transfer_from(from, to, tokenIds, values, data);␊ - }␊ - ␊ - fn setApprovalForAll(ref self: ContractState, operator: ContractAddress, approved: bool) {␊ - self.set_approval_for_all(operator, approved);␊ - }␊ - ␊ - fn isApprovedForAll(self: @ContractState, owner: ContractAddress, operator: ContractAddress) -> bool {␊ - self.is_approved_for_all(owner, operator)␊ - }␊ - }␊ - ␊ - #[abi(embed_v0)]␊ - impl ERC1155Impl of interface::IERC1155 {␊ - fn balance_of(self: @ContractState, account: ContractAddress, token_id: u256) -> u256 {␊ - self.erc1155.balance_of(account, token_id)␊ - }␊ - ␊ - fn balance_of_batch(self: @ContractState, accounts: Span, token_ids: Span) -> Span {␊ - self.erc1155.balance_of_batch(accounts, token_ids)␊ - }␊ - ␊ - fn safe_transfer_from(␊ - ref self: ContractState,␊ - from: ContractAddress,␊ - to: ContractAddress,␊ - token_id: u256,␊ - value: u256,␊ - data: Span,␊ ) {␊ - self.pausable.assert_not_paused();␊ - self.erc1155.safe_transfer_from(from, to, token_id, value, data);␊ + let contract_state = ERC1155Component::HasComponent::get_contract(@self);␊ + contract_state.pausable.assert_not_paused();␊ }␊ ␊ - fn safe_batch_transfer_from(␊ - ref self: ContractState,␊ + fn after_update(␊ + ref self: ERC1155Component::ComponentState,␊ from: ContractAddress,␊ to: ContractAddress,␊ token_ids: Span,␊ values: Span,␊ - data: Span,␊ ) {␊ - self.pausable.assert_not_paused();␊ - self.erc1155.safe_batch_transfer_from(from, to, token_ids, values, data);␊ - }␊ - ␊ - fn set_approval_for_all(ref self: ContractState, operator: ContractAddress, approved: bool) {␊ - self.pausable.assert_not_paused();␊ - self.erc1155.set_approval_for_all(operator, approved);␊ - }␊ - ␊ - fn is_approved_for_all(self: @ContractState, owner: ContractAddress, operator: ContractAddress) -> bool {␊ - self.erc1155.is_approved_for_all(owner, operator)␊ }␊ }␊ ␊ @@ -942,8 +875,6 @@ Generated by [AVA](https://avajs.dev). use openzeppelin::introspection::src5::SRC5Component;␊ use openzeppelin::security::pausable::PausableComponent;␊ use openzeppelin::token::erc1155::ERC1155Component;␊ - use openzeppelin::token::erc1155::ERC1155HooksEmptyImpl;␊ - use openzeppelin::token::erc1155::interface;␊ use starknet::ContractAddress;␊ use starknet::get_caller_address;␊ use super::{PAUSER_ROLE, MINTER_ROLE, URI_SETTER_ROLE};␊ @@ -954,9 +885,7 @@ Generated by [AVA](https://avajs.dev). component!(path: AccessControlComponent, storage: accesscontrol, event: AccessControlEvent);␊ ␊ #[abi(embed_v0)]␊ - impl ERC1155MetadataURIImpl = ERC1155Component::ERC1155MetadataURIImpl;␊ - #[abi(embed_v0)]␊ - impl SRC5Impl = SRC5Component::SRC5Impl;␊ + impl ERC1155MixinImpl = ERC1155Component::ERC1155MixinImpl;␊ #[abi(embed_v0)]␊ impl PausableImpl = PausableComponent::PausableImpl;␊ #[abi(embed_v0)]␊ @@ -1010,88 +939,25 @@ Generated by [AVA](https://avajs.dev). self.accesscontrol._grant_role(URI_SETTER_ROLE, uri_setter);␊ }␊ ␊ - #[abi(embed_v0)]␊ - impl ERC1155CamelImpl of interface::IERC1155Camel {␊ - fn balanceOf(self: @ContractState, account: ContractAddress, tokenId: u256) -> u256 {␊ - self.balance_of(account, tokenId)␊ - }␊ - ␊ - fn balanceOfBatch(self: @ContractState, accounts: Span, tokenIds: Span) -> Span {␊ - self.balance_of_batch(accounts, tokenIds)␊ - }␊ - ␊ - fn safeTransferFrom(␊ - ref self: ContractState,␊ + impl ERC1155HooksImpl of ERC1155Component::ERC1155HooksTrait {␊ + fn before_update(␊ + ref self: ERC1155Component::ComponentState,␊ from: ContractAddress,␊ to: ContractAddress,␊ - tokenId: u256,␊ - value: u256,␊ - data: Span,␊ - ) {␊ - self.safe_transfer_from(from, to, tokenId, value, data);␊ - }␊ - ␊ - fn safeBatchTransferFrom(␊ - ref self: ContractState,␊ - from: ContractAddress,␊ - to: ContractAddress,␊ - tokenIds: Span,␊ + token_ids: Span,␊ values: Span,␊ - data: Span,␊ ) {␊ - self.safe_batch_transfer_from(from, to, tokenIds, values, data);␊ - }␊ - ␊ - fn setApprovalForAll(ref self: ContractState, operator: ContractAddress, approved: bool) {␊ - self.set_approval_for_all(operator, approved);␊ + let contract_state = ERC1155Component::HasComponent::get_contract(@self);␊ + contract_state.pausable.assert_not_paused();␊ }␊ ␊ - fn isApprovedForAll(self: @ContractState, owner: ContractAddress, operator: ContractAddress) -> bool {␊ - self.is_approved_for_all(owner, operator)␊ - }␊ - }␊ - ␊ - #[abi(embed_v0)]␊ - impl ERC1155Impl of interface::IERC1155 {␊ - fn balance_of(self: @ContractState, account: ContractAddress, token_id: u256) -> u256 {␊ - self.erc1155.balance_of(account, token_id)␊ - }␊ - ␊ - fn balance_of_batch(self: @ContractState, accounts: Span, token_ids: Span) -> Span {␊ - self.erc1155.balance_of_batch(accounts, token_ids)␊ - }␊ - ␊ - fn safe_transfer_from(␊ - ref self: ContractState,␊ - from: ContractAddress,␊ - to: ContractAddress,␊ - token_id: u256,␊ - value: u256,␊ - data: Span,␊ - ) {␊ - self.pausable.assert_not_paused();␊ - self.erc1155.safe_transfer_from(from, to, token_id, value, data);␊ - }␊ - ␊ - fn safe_batch_transfer_from(␊ - ref self: ContractState,␊ + fn after_update(␊ + ref self: ERC1155Component::ComponentState,␊ from: ContractAddress,␊ to: ContractAddress,␊ token_ids: Span,␊ values: Span,␊ - data: Span,␊ ) {␊ - self.pausable.assert_not_paused();␊ - self.erc1155.safe_batch_transfer_from(from, to, token_ids, values, data);␊ - }␊ - ␊ - fn set_approval_for_all(ref self: ContractState, operator: ContractAddress, approved: bool) {␊ - self.pausable.assert_not_paused();␊ - self.erc1155.set_approval_for_all(operator, approved);␊ - }␊ - ␊ - fn is_approved_for_all(self: @ContractState, owner: ContractAddress, operator: ContractAddress) -> bool {␊ - self.erc1155.is_approved_for_all(owner, operator)␊ }␊ }␊ ␊ @@ -1112,7 +978,6 @@ Generated by [AVA](https://avajs.dev). ␊ #[external(v0)]␊ fn burn(ref self: ContractState, account: ContractAddress, token_id: u256, value: u256) {␊ - self.pausable.assert_not_paused();␊ let caller = get_caller_address();␊ if account != caller {␊ assert(self.erc1155.is_approved_for_all(account, caller), ERC1155Component::Errors::UNAUTHORIZED);␊ @@ -1127,7 +992,6 @@ Generated by [AVA](https://avajs.dev). token_ids: Span,␊ values: Span,␊ ) {␊ - self.pausable.assert_not_paused();␊ let caller = get_caller_address();␊ if account != caller {␊ assert(self.erc1155.is_approved_for_all(account, caller), ERC1155Component::Errors::UNAUTHORIZED);␊ @@ -1154,7 +1018,6 @@ Generated by [AVA](https://avajs.dev). data: Span,␊ ) {␊ self.accesscontrol.assert_only_role(MINTER_ROLE);␊ - self.pausable.assert_not_paused();␊ self.erc1155.mint_with_acceptance_check(account, token_id, value, data);␊ }␊ ␊ @@ -1167,7 +1030,6 @@ Generated by [AVA](https://avajs.dev). data: Span,␊ ) {␊ self.accesscontrol.assert_only_role(MINTER_ROLE);␊ - self.pausable.assert_not_paused();␊ self.erc1155.batch_mint_with_acceptance_check(account, token_ids, values, data);␊ }␊ ␊ @@ -1215,8 +1077,6 @@ Generated by [AVA](https://avajs.dev). use openzeppelin::introspection::src5::SRC5Component;␊ use openzeppelin::security::pausable::PausableComponent;␊ use openzeppelin::token::erc1155::ERC1155Component;␊ - use openzeppelin::token::erc1155::ERC1155HooksEmptyImpl;␊ - use openzeppelin::token::erc1155::interface;␊ use openzeppelin::upgrades::UpgradeableComponent;␊ use openzeppelin::upgrades::interface::IUpgradeable;␊ use starknet::ClassHash;␊ @@ -1231,9 +1091,7 @@ Generated by [AVA](https://avajs.dev). component!(path: UpgradeableComponent, storage: upgradeable, event: UpgradeableEvent);␊ ␊ #[abi(embed_v0)]␊ - impl ERC1155MetadataURIImpl = ERC1155Component::ERC1155MetadataURIImpl;␊ - #[abi(embed_v0)]␊ - impl SRC5Impl = SRC5Component::SRC5Impl;␊ + impl ERC1155MixinImpl = ERC1155Component::ERC1155MixinImpl;␊ #[abi(embed_v0)]␊ impl PausableImpl = PausableComponent::PausableImpl;␊ #[abi(embed_v0)]␊ @@ -1294,88 +1152,25 @@ Generated by [AVA](https://avajs.dev). self.accesscontrol._grant_role(UPGRADER_ROLE, upgrader);␊ }␊ ␊ - #[abi(embed_v0)]␊ - impl ERC1155CamelImpl of interface::IERC1155Camel {␊ - fn balanceOf(self: @ContractState, account: ContractAddress, tokenId: u256) -> u256 {␊ - self.balance_of(account, tokenId)␊ - }␊ - ␊ - fn balanceOfBatch(self: @ContractState, accounts: Span, tokenIds: Span) -> Span {␊ - self.balance_of_batch(accounts, tokenIds)␊ - }␊ - ␊ - fn safeTransferFrom(␊ - ref self: ContractState,␊ + impl ERC1155HooksImpl of ERC1155Component::ERC1155HooksTrait {␊ + fn before_update(␊ + ref self: ERC1155Component::ComponentState,␊ from: ContractAddress,␊ to: ContractAddress,␊ - tokenId: u256,␊ - value: u256,␊ - data: Span,␊ - ) {␊ - self.safe_transfer_from(from, to, tokenId, value, data);␊ - }␊ - ␊ - fn safeBatchTransferFrom(␊ - ref self: ContractState,␊ - from: ContractAddress,␊ - to: ContractAddress,␊ - tokenIds: Span,␊ + token_ids: Span,␊ values: Span,␊ - data: Span,␊ ) {␊ - self.safe_batch_transfer_from(from, to, tokenIds, values, data);␊ + let contract_state = ERC1155Component::HasComponent::get_contract(@self);␊ + contract_state.pausable.assert_not_paused();␊ }␊ ␊ - fn setApprovalForAll(ref self: ContractState, operator: ContractAddress, approved: bool) {␊ - self.set_approval_for_all(operator, approved);␊ - }␊ - ␊ - fn isApprovedForAll(self: @ContractState, owner: ContractAddress, operator: ContractAddress) -> bool {␊ - self.is_approved_for_all(owner, operator)␊ - }␊ - }␊ - ␊ - #[abi(embed_v0)]␊ - impl ERC1155Impl of interface::IERC1155 {␊ - fn balance_of(self: @ContractState, account: ContractAddress, token_id: u256) -> u256 {␊ - self.erc1155.balance_of(account, token_id)␊ - }␊ - ␊ - fn balance_of_batch(self: @ContractState, accounts: Span, token_ids: Span) -> Span {␊ - self.erc1155.balance_of_batch(accounts, token_ids)␊ - }␊ - ␊ - fn safe_transfer_from(␊ - ref self: ContractState,␊ - from: ContractAddress,␊ - to: ContractAddress,␊ - token_id: u256,␊ - value: u256,␊ - data: Span,␊ - ) {␊ - self.pausable.assert_not_paused();␊ - self.erc1155.safe_transfer_from(from, to, token_id, value, data);␊ - }␊ - ␊ - fn safe_batch_transfer_from(␊ - ref self: ContractState,␊ + fn after_update(␊ + ref self: ERC1155Component::ComponentState,␊ from: ContractAddress,␊ to: ContractAddress,␊ token_ids: Span,␊ values: Span,␊ - data: Span,␊ ) {␊ - self.pausable.assert_not_paused();␊ - self.erc1155.safe_batch_transfer_from(from, to, token_ids, values, data);␊ - }␊ - ␊ - fn set_approval_for_all(ref self: ContractState, operator: ContractAddress, approved: bool) {␊ - self.pausable.assert_not_paused();␊ - self.erc1155.set_approval_for_all(operator, approved);␊ - }␊ - ␊ - fn is_approved_for_all(self: @ContractState, owner: ContractAddress, operator: ContractAddress) -> bool {␊ - self.erc1155.is_approved_for_all(owner, operator)␊ }␊ }␊ ␊ @@ -1404,7 +1199,6 @@ Generated by [AVA](https://avajs.dev). ␊ #[external(v0)]␊ fn burn(ref self: ContractState, account: ContractAddress, token_id: u256, value: u256) {␊ - self.pausable.assert_not_paused();␊ let caller = get_caller_address();␊ if account != caller {␊ assert(self.erc1155.is_approved_for_all(account, caller), ERC1155Component::Errors::UNAUTHORIZED);␊ @@ -1419,7 +1213,6 @@ Generated by [AVA](https://avajs.dev). token_ids: Span,␊ values: Span,␊ ) {␊ - self.pausable.assert_not_paused();␊ let caller = get_caller_address();␊ if account != caller {␊ assert(self.erc1155.is_approved_for_all(account, caller), ERC1155Component::Errors::UNAUTHORIZED);␊ @@ -1446,7 +1239,6 @@ Generated by [AVA](https://avajs.dev). data: Span,␊ ) {␊ self.accesscontrol.assert_only_role(MINTER_ROLE);␊ - self.pausable.assert_not_paused();␊ self.erc1155.mint_with_acceptance_check(account, token_id, value, data);␊ }␊ ␊ @@ -1459,7 +1251,6 @@ Generated by [AVA](https://avajs.dev). data: Span,␊ ) {␊ self.accesscontrol.assert_only_role(MINTER_ROLE);␊ - self.pausable.assert_not_paused();␊ self.erc1155.batch_mint_with_acceptance_check(account, token_ids, values, data);␊ }␊ ␊ diff --git a/packages/core-cairo/src/erc1155.test.ts.snap b/packages/core-cairo/src/erc1155.test.ts.snap index 0aab72e167cc362ec09e24a5f6d839aa6027f1ea..c0543ae4b2ddb6816ef5cd77d3ce2b351482c2c9 100644 GIT binary patch literal 2535 zcmVh!J5G^{UhKv0bzh);gT6tp_6_!Zc7_~|X80pUvi>L?T{xmR zb7tl{^K;I3W+uN{9mg}z!~gt-iA@|l=%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Q7WThXCmpD zB3Przy)TVHr9TjkRVDx9sf&Nc$3w!bDhy*CQDES#Pa^Y4;;a{^>HO@qslEw zw_HfvgZsjwkuX#p%m=20C3P_+otpxfII5ncN z194VMIcyM?1z}n18kXfpVOgaiS(_h7AzA;eK}Z(dsDx;)<@_rt`63gIEL-X;pNk!6 zrfdNIPz%JcK@1yQr(My=xN?ecEth@f6=$a+wOsdlXArI@OjC&HTb+o$L5PfZYZyWT zAtVq&0wE+2LINQq5JCbWBv6Bpz~ST$A%PGQxOgFfkR)iqk_17>B!o<^WQ-hyOu}@4 jkVy!cT=3XC2$@{UVS|uK2$@{Fkjei8wH_XfRmuPW-gki+ diff --git a/packages/core-cairo/src/erc20.test.ts.md b/packages/core-cairo/src/erc20.test.ts.md index 64e17789a..d32d750ee 100644 --- a/packages/core-cairo/src/erc20.test.ts.md +++ b/packages/core-cairo/src/erc20.test.ts.md @@ -181,8 +181,7 @@ Generated by [AVA](https://avajs.dev). impl ExternalImpl of ExternalTrait {␊ #[external(v0)]␊ fn burn(ref self: ContractState, value: u256) {␊ - let caller = get_caller_address();␊ - self.erc20._burn(caller, value);␊ + self.erc20._burn(get_caller_address(), value);␊ }␊ }␊ }␊ @@ -200,8 +199,6 @@ Generated by [AVA](https://avajs.dev). use openzeppelin::access::ownable::OwnableComponent;␊ use openzeppelin::security::pausable::PausableComponent;␊ use openzeppelin::token::erc20::ERC20Component;␊ - use openzeppelin::token::erc20::ERC20HooksEmptyImpl;␊ - use openzeppelin::token::erc20::interface;␊ use openzeppelin::upgrades::UpgradeableComponent;␊ use openzeppelin::upgrades::interface::IUpgradeable;␊ use starknet::ClassHash;␊ @@ -213,7 +210,7 @@ Generated by [AVA](https://avajs.dev). component!(path: UpgradeableComponent, storage: upgradeable, event: UpgradeableEvent);␊ ␊ #[abi(embed_v0)]␊ - impl ERC20MetadataImpl = ERC20Component::ERC20MetadataImpl;␊ + impl ERC20MixinImpl = ERC20Component::ERC20MixinImpl;␊ #[abi(embed_v0)]␊ impl PausableImpl = PausableComponent::PausableImpl;␊ #[abi(embed_v0)]␊ @@ -255,58 +252,23 @@ Generated by [AVA](https://avajs.dev). self.ownable.initializer(owner);␊ }␊ ␊ - #[abi(embed_v0)]␊ - impl ERC20CamelOnlyImpl of interface::IERC20CamelOnly {␊ - fn totalSupply(self: @ContractState) -> u256 {␊ - self.total_supply()␊ - }␊ - ␊ - fn balanceOf(self: @ContractState, account: ContractAddress) -> u256 {␊ - self.balance_of(account)␊ - }␊ - ␊ - fn transferFrom(␊ - ref self: ContractState,␊ - sender: ContractAddress,␊ + impl ERC20HooksImpl of ERC20Component::ERC20HooksTrait {␊ + fn before_update(␊ + ref self: ERC20Component::ComponentState,␊ + from: ContractAddress,␊ recipient: ContractAddress,␊ amount: u256,␊ - ) -> bool {␊ - self.transfer_from(sender, recipient, amount)␊ - }␊ - }␊ - ␊ - #[abi(embed_v0)]␊ - impl ERC20Impl of interface::IERC20 {␊ - fn total_supply(self: @ContractState) -> u256 {␊ - self.erc20.total_supply()␊ - }␊ - ␊ - fn balance_of(self: @ContractState, account: ContractAddress) -> u256 {␊ - self.erc20.balance_of(account)␊ - }␊ - ␊ - fn allowance(self: @ContractState, owner: ContractAddress, spender: ContractAddress) -> u256 {␊ - self.erc20.allowance(owner, spender)␊ - }␊ - ␊ - fn transfer(ref self: ContractState, recipient: ContractAddress, amount: u256) -> bool {␊ - self.pausable.assert_not_paused();␊ - self.erc20.transfer(recipient, amount)␊ + ) {␊ + let contract_state = ERC20Component::HasComponent::get_contract(@self);␊ + contract_state.pausable.assert_not_paused();␊ }␊ ␊ - fn transfer_from(␊ - ref self: ContractState,␊ - sender: ContractAddress,␊ + fn after_update(␊ + ref self: ERC20Component::ComponentState,␊ + from: ContractAddress,␊ recipient: ContractAddress,␊ amount: u256,␊ - ) -> bool {␊ - self.pausable.assert_not_paused();␊ - self.erc20.transfer_from(sender, recipient, amount)␊ - }␊ - ␊ - fn approve(ref self: ContractState, spender: ContractAddress, amount: u256) -> bool {␊ - self.pausable.assert_not_paused();␊ - self.erc20.approve(spender, amount)␊ + ) {␊ }␊ }␊ ␊ @@ -353,8 +315,6 @@ Generated by [AVA](https://avajs.dev). use openzeppelin::introspection::src5::SRC5Component;␊ use openzeppelin::security::pausable::PausableComponent;␊ use openzeppelin::token::erc20::ERC20Component;␊ - use openzeppelin::token::erc20::ERC20HooksEmptyImpl;␊ - use openzeppelin::token::erc20::interface;␊ use openzeppelin::upgrades::UpgradeableComponent;␊ use openzeppelin::upgrades::interface::IUpgradeable;␊ use starknet::ClassHash;␊ @@ -368,7 +328,7 @@ Generated by [AVA](https://avajs.dev). component!(path: UpgradeableComponent, storage: upgradeable, event: UpgradeableEvent);␊ ␊ #[abi(embed_v0)]␊ - impl ERC20MetadataImpl = ERC20Component::ERC20MetadataImpl;␊ + impl ERC20MixinImpl = ERC20Component::ERC20MixinImpl;␊ #[abi(embed_v0)]␊ impl PausableImpl = PausableComponent::PausableImpl;␊ #[abi(embed_v0)]␊ @@ -423,58 +383,23 @@ Generated by [AVA](https://avajs.dev). self.accesscontrol._grant_role(UPGRADER_ROLE, upgrader);␊ }␊ ␊ - #[abi(embed_v0)]␊ - impl ERC20CamelOnlyImpl of interface::IERC20CamelOnly {␊ - fn totalSupply(self: @ContractState) -> u256 {␊ - self.total_supply()␊ - }␊ - ␊ - fn balanceOf(self: @ContractState, account: ContractAddress) -> u256 {␊ - self.balance_of(account)␊ - }␊ - ␊ - fn transferFrom(␊ - ref self: ContractState,␊ - sender: ContractAddress,␊ + impl ERC20HooksImpl of ERC20Component::ERC20HooksTrait {␊ + fn before_update(␊ + ref self: ERC20Component::ComponentState,␊ + from: ContractAddress,␊ recipient: ContractAddress,␊ amount: u256,␊ - ) -> bool {␊ - self.transfer_from(sender, recipient, amount)␊ - }␊ - }␊ - ␊ - #[abi(embed_v0)]␊ - impl ERC20Impl of interface::IERC20 {␊ - fn total_supply(self: @ContractState) -> u256 {␊ - self.erc20.total_supply()␊ - }␊ - ␊ - fn balance_of(self: @ContractState, account: ContractAddress) -> u256 {␊ - self.erc20.balance_of(account)␊ - }␊ - ␊ - fn allowance(self: @ContractState, owner: ContractAddress, spender: ContractAddress) -> u256 {␊ - self.erc20.allowance(owner, spender)␊ - }␊ - ␊ - fn transfer(ref self: ContractState, recipient: ContractAddress, amount: u256) -> bool {␊ - self.pausable.assert_not_paused();␊ - self.erc20.transfer(recipient, amount)␊ + ) {␊ + let contract_state = ERC20Component::HasComponent::get_contract(@self);␊ + contract_state.pausable.assert_not_paused();␊ }␊ ␊ - fn transfer_from(␊ - ref self: ContractState,␊ - sender: ContractAddress,␊ + fn after_update(␊ + ref self: ERC20Component::ComponentState,␊ + from: ContractAddress,␊ recipient: ContractAddress,␊ amount: u256,␊ - ) -> bool {␊ - self.pausable.assert_not_paused();␊ - self.erc20.transfer_from(sender, recipient, amount)␊ - }␊ - ␊ - fn approve(ref self: ContractState, spender: ContractAddress, amount: u256) -> bool {␊ - self.pausable.assert_not_paused();␊ - self.erc20.approve(spender, amount)␊ + ) {␊ }␊ }␊ ␊ @@ -516,8 +441,6 @@ Generated by [AVA](https://avajs.dev). use openzeppelin::access::ownable::OwnableComponent;␊ use openzeppelin::security::pausable::PausableComponent;␊ use openzeppelin::token::erc20::ERC20Component;␊ - use openzeppelin::token::erc20::ERC20HooksEmptyImpl;␊ - use openzeppelin::token::erc20::interface;␊ use openzeppelin::upgrades::UpgradeableComponent;␊ use openzeppelin::upgrades::interface::IUpgradeable;␊ use starknet::ClassHash;␊ @@ -530,7 +453,7 @@ Generated by [AVA](https://avajs.dev). component!(path: UpgradeableComponent, storage: upgradeable, event: UpgradeableEvent);␊ ␊ #[abi(embed_v0)]␊ - impl ERC20MetadataImpl = ERC20Component::ERC20MetadataImpl;␊ + impl ERC20MixinImpl = ERC20Component::ERC20MixinImpl;␊ #[abi(embed_v0)]␊ impl PausableImpl = PausableComponent::PausableImpl;␊ #[abi(embed_v0)]␊ @@ -572,58 +495,23 @@ Generated by [AVA](https://avajs.dev). self.ownable.initializer(owner);␊ }␊ ␊ - #[abi(embed_v0)]␊ - impl ERC20CamelOnlyImpl of interface::IERC20CamelOnly {␊ - fn totalSupply(self: @ContractState) -> u256 {␊ - self.total_supply()␊ - }␊ - ␊ - fn balanceOf(self: @ContractState, account: ContractAddress) -> u256 {␊ - self.balance_of(account)␊ - }␊ - ␊ - fn transferFrom(␊ - ref self: ContractState,␊ - sender: ContractAddress,␊ + impl ERC20HooksImpl of ERC20Component::ERC20HooksTrait {␊ + fn before_update(␊ + ref self: ERC20Component::ComponentState,␊ + from: ContractAddress,␊ recipient: ContractAddress,␊ amount: u256,␊ - ) -> bool {␊ - self.transfer_from(sender, recipient, amount)␊ - }␊ - }␊ - ␊ - #[abi(embed_v0)]␊ - impl ERC20Impl of interface::IERC20 {␊ - fn total_supply(self: @ContractState) -> u256 {␊ - self.erc20.total_supply()␊ - }␊ - ␊ - fn balance_of(self: @ContractState, account: ContractAddress) -> u256 {␊ - self.erc20.balance_of(account)␊ - }␊ - ␊ - fn allowance(self: @ContractState, owner: ContractAddress, spender: ContractAddress) -> u256 {␊ - self.erc20.allowance(owner, spender)␊ - }␊ - ␊ - fn transfer(ref self: ContractState, recipient: ContractAddress, amount: u256) -> bool {␊ - self.pausable.assert_not_paused();␊ - self.erc20.transfer(recipient, amount)␊ + ) {␊ + let contract_state = ERC20Component::HasComponent::get_contract(@self);␊ + contract_state.pausable.assert_not_paused();␊ }␊ ␊ - fn transfer_from(␊ - ref self: ContractState,␊ - sender: ContractAddress,␊ + fn after_update(␊ + ref self: ERC20Component::ComponentState,␊ + from: ContractAddress,␊ recipient: ContractAddress,␊ amount: u256,␊ - ) -> bool {␊ - self.pausable.assert_not_paused();␊ - self.erc20.transfer_from(sender, recipient, amount)␊ - }␊ - ␊ - fn approve(ref self: ContractState, spender: ContractAddress, amount: u256) -> bool {␊ - self.pausable.assert_not_paused();␊ - self.erc20.approve(spender, amount)␊ + ) {␊ }␊ }␊ ␊ @@ -652,9 +540,7 @@ Generated by [AVA](https://avajs.dev). ␊ #[external(v0)]␊ fn burn(ref self: ContractState, value: u256) {␊ - self.pausable.assert_not_paused();␊ - let caller = get_caller_address();␊ - self.erc20._burn(caller, value);␊ + self.erc20._burn(get_caller_address(), value);␊ }␊ }␊ }␊ @@ -1054,15 +940,9 @@ Generated by [AVA](https://avajs.dev). }␊ }␊ ␊ - impl ERC20VotesHooksImpl<␊ - TContractState,␊ - impl ERC20Votes: ERC20VotesComponent::HasComponent,␊ - impl HasComponent: ERC20Component::HasComponent,␊ - +NoncesComponent::HasComponent,␊ - +Drop␊ - > of ERC20Component::ERC20HooksTrait {␊ + impl ERC20HooksImpl of ERC20Component::ERC20HooksTrait {␊ fn before_update(␊ - ref self: ERC20Component::ComponentState,␊ + ref self: ERC20Component::ComponentState,␊ from: ContractAddress,␊ recipient: ContractAddress,␊ amount: u256,␊ @@ -1070,13 +950,13 @@ Generated by [AVA](https://avajs.dev). }␊ ␊ fn after_update(␊ - ref self: ERC20Component::ComponentState,␊ + ref self: ERC20Component::ComponentState,␊ from: ContractAddress,␊ recipient: ContractAddress,␊ amount: u256,␊ ) {␊ - let mut erc20_votes_component = get_dep_component_mut!(ref self, ERC20Votes);␊ - erc20_votes_component.transfer_voting_units(from, recipient, amount);␊ + let mut contract_state = ERC20Component::HasComponent::get_contract_mut(ref self);␊ + contract_state.erc20_votes.transfer_voting_units(from, recipient, amount);␊ }␊ }␊ ␊ @@ -1174,15 +1054,9 @@ Generated by [AVA](https://avajs.dev). }␊ }␊ ␊ - impl ERC20VotesHooksImpl<␊ - TContractState,␊ - impl ERC20Votes: ERC20VotesComponent::HasComponent,␊ - impl HasComponent: ERC20Component::HasComponent,␊ - +NoncesComponent::HasComponent,␊ - +Drop␊ - > of ERC20Component::ERC20HooksTrait {␊ + impl ERC20HooksImpl of ERC20Component::ERC20HooksTrait {␊ fn before_update(␊ - ref self: ERC20Component::ComponentState,␊ + ref self: ERC20Component::ComponentState,␊ from: ContractAddress,␊ recipient: ContractAddress,␊ amount: u256,␊ @@ -1190,13 +1064,13 @@ Generated by [AVA](https://avajs.dev). }␊ ␊ fn after_update(␊ - ref self: ERC20Component::ComponentState,␊ + ref self: ERC20Component::ComponentState,␊ from: ContractAddress,␊ recipient: ContractAddress,␊ amount: u256,␊ ) {␊ - let mut erc20_votes_component = get_dep_component_mut!(ref self, ERC20Votes);␊ - erc20_votes_component.transfer_voting_units(from, recipient, amount);␊ + let mut contract_state = ERC20Component::HasComponent::get_contract_mut(ref self);␊ + contract_state.erc20_votes.transfer_voting_units(from, recipient, amount);␊ }␊ }␊ ␊ @@ -1275,15 +1149,9 @@ Generated by [AVA](https://avajs.dev). }␊ }␊ ␊ - impl ERC20VotesHooksImpl<␊ - TContractState,␊ - impl ERC20Votes: ERC20VotesComponent::HasComponent,␊ - impl HasComponent: ERC20Component::HasComponent,␊ - +NoncesComponent::HasComponent,␊ - +Drop␊ - > of ERC20Component::ERC20HooksTrait {␊ + impl ERC20HooksImpl of ERC20Component::ERC20HooksTrait {␊ fn before_update(␊ - ref self: ERC20Component::ComponentState,␊ + ref self: ERC20Component::ComponentState,␊ from: ContractAddress,␊ recipient: ContractAddress,␊ amount: u256,␊ @@ -1291,13 +1159,13 @@ Generated by [AVA](https://avajs.dev). }␊ ␊ fn after_update(␊ - ref self: ERC20Component::ComponentState,␊ + ref self: ERC20Component::ComponentState,␊ from: ContractAddress,␊ recipient: ContractAddress,␊ amount: u256,␊ ) {␊ - let mut erc20_votes_component = get_dep_component_mut!(ref self, ERC20Votes);␊ - erc20_votes_component.transfer_voting_units(from, recipient, amount);␊ + let mut contract_state = ERC20Component::HasComponent::get_contract_mut(ref self);␊ + contract_state.erc20_votes.transfer_voting_units(from, recipient, amount);␊ }␊ }␊ }␊ @@ -1317,7 +1185,6 @@ Generated by [AVA](https://avajs.dev). use openzeppelin::token::erc20::ERC20Component;␊ use openzeppelin::token::erc20::extensions::ERC20VotesComponent;␊ use openzeppelin::token::erc20::extensions::ERC20VotesComponent::InternalTrait as ERC20VotesInternalTrait;␊ - use openzeppelin::token::erc20::interface;␊ use openzeppelin::utils::cryptography::nonces::NoncesComponent;␊ use openzeppelin::utils::cryptography::snip12::SNIP12Metadata;␊ use starknet::ContractAddress;␊ @@ -1330,7 +1197,7 @@ Generated by [AVA](https://avajs.dev). component!(path: NoncesComponent, storage: nonces, event: NoncesEvent);␊ ␊ #[abi(embed_v0)]␊ - impl ERC20MetadataImpl = ERC20Component::ERC20MetadataImpl;␊ + impl ERC20MixinImpl = ERC20Component::ERC20MixinImpl;␊ #[abi(embed_v0)]␊ impl PausableImpl = PausableComponent::PausableImpl;␊ #[abi(embed_v0)]␊ @@ -1391,84 +1258,25 @@ Generated by [AVA](https://avajs.dev). }␊ }␊ ␊ - impl ERC20VotesHooksImpl<␊ - TContractState,␊ - impl ERC20Votes: ERC20VotesComponent::HasComponent,␊ - impl HasComponent: ERC20Component::HasComponent,␊ - +NoncesComponent::HasComponent,␊ - +Drop␊ - > of ERC20Component::ERC20HooksTrait {␊ + impl ERC20HooksImpl of ERC20Component::ERC20HooksTrait {␊ fn before_update(␊ - ref self: ERC20Component::ComponentState,␊ + ref self: ERC20Component::ComponentState,␊ from: ContractAddress,␊ recipient: ContractAddress,␊ amount: u256,␊ ) {␊ + let contract_state = ERC20Component::HasComponent::get_contract(@self);␊ + contract_state.pausable.assert_not_paused();␊ }␊ ␊ fn after_update(␊ - ref self: ERC20Component::ComponentState,␊ + ref self: ERC20Component::ComponentState,␊ from: ContractAddress,␊ recipient: ContractAddress,␊ amount: u256,␊ ) {␊ - let mut erc20_votes_component = get_dep_component_mut!(ref self, ERC20Votes);␊ - erc20_votes_component.transfer_voting_units(from, recipient, amount);␊ - }␊ - }␊ - ␊ - #[abi(embed_v0)]␊ - impl ERC20CamelOnlyImpl of interface::IERC20CamelOnly {␊ - fn totalSupply(self: @ContractState) -> u256 {␊ - self.total_supply()␊ - }␊ - ␊ - fn balanceOf(self: @ContractState, account: ContractAddress) -> u256 {␊ - self.balance_of(account)␊ - }␊ - ␊ - fn transferFrom(␊ - ref self: ContractState,␊ - sender: ContractAddress,␊ - recipient: ContractAddress,␊ - amount: u256,␊ - ) -> bool {␊ - self.transfer_from(sender, recipient, amount)␊ - }␊ - }␊ - ␊ - #[abi(embed_v0)]␊ - impl ERC20Impl of interface::IERC20 {␊ - fn total_supply(self: @ContractState) -> u256 {␊ - self.erc20.total_supply()␊ - }␊ - ␊ - fn balance_of(self: @ContractState, account: ContractAddress) -> u256 {␊ - self.erc20.balance_of(account)␊ - }␊ - ␊ - fn allowance(self: @ContractState, owner: ContractAddress, spender: ContractAddress) -> u256 {␊ - self.erc20.allowance(owner, spender)␊ - }␊ - ␊ - fn transfer(ref self: ContractState, recipient: ContractAddress, amount: u256) -> bool {␊ - self.pausable.assert_not_paused();␊ - self.erc20.transfer(recipient, amount)␊ - }␊ - ␊ - fn transfer_from(␊ - ref self: ContractState,␊ - sender: ContractAddress,␊ - recipient: ContractAddress,␊ - amount: u256,␊ - ) -> bool {␊ - self.pausable.assert_not_paused();␊ - self.erc20.transfer_from(sender, recipient, amount)␊ - }␊ - ␊ - fn approve(ref self: ContractState, spender: ContractAddress, amount: u256) -> bool {␊ - self.pausable.assert_not_paused();␊ - self.erc20.approve(spender, amount)␊ + let mut contract_state = ERC20Component::HasComponent::get_contract_mut(ref self);␊ + contract_state.erc20_votes.transfer_voting_units(from, recipient, amount);␊ }␊ }␊ ␊ @@ -1489,15 +1297,12 @@ Generated by [AVA](https://avajs.dev). ␊ #[external(v0)]␊ fn burn(ref self: ContractState, value: u256) {␊ - self.pausable.assert_not_paused();␊ - let caller = get_caller_address();␊ - self.erc20._burn(caller, value);␊ + self.erc20._burn(get_caller_address(), value);␊ }␊ ␊ #[external(v0)]␊ fn mint(ref self: ContractState, recipient: ContractAddress, amount: u256) {␊ self.ownable.assert_only_owner();␊ - self.pausable.assert_not_paused();␊ self.erc20._mint(recipient, amount);␊ }␊ }␊ @@ -1518,7 +1323,6 @@ Generated by [AVA](https://avajs.dev). use openzeppelin::token::erc20::ERC20Component;␊ use openzeppelin::token::erc20::extensions::ERC20VotesComponent;␊ use openzeppelin::token::erc20::extensions::ERC20VotesComponent::InternalTrait as ERC20VotesInternalTrait;␊ - use openzeppelin::token::erc20::interface;␊ use openzeppelin::upgrades::UpgradeableComponent;␊ use openzeppelin::upgrades::interface::IUpgradeable;␊ use openzeppelin::utils::cryptography::nonces::NoncesComponent;␊ @@ -1535,7 +1339,7 @@ Generated by [AVA](https://avajs.dev). component!(path: UpgradeableComponent, storage: upgradeable, event: UpgradeableEvent);␊ ␊ #[abi(embed_v0)]␊ - impl ERC20MetadataImpl = ERC20Component::ERC20MetadataImpl;␊ + impl ERC20MixinImpl = ERC20Component::ERC20MixinImpl;␊ #[abi(embed_v0)]␊ impl PausableImpl = PausableComponent::PausableImpl;␊ #[abi(embed_v0)]␊ @@ -1601,84 +1405,25 @@ Generated by [AVA](https://avajs.dev). }␊ }␊ ␊ - impl ERC20VotesHooksImpl<␊ - TContractState,␊ - impl ERC20Votes: ERC20VotesComponent::HasComponent,␊ - impl HasComponent: ERC20Component::HasComponent,␊ - +NoncesComponent::HasComponent,␊ - +Drop␊ - > of ERC20Component::ERC20HooksTrait {␊ + impl ERC20HooksImpl of ERC20Component::ERC20HooksTrait {␊ fn before_update(␊ - ref self: ERC20Component::ComponentState,␊ + ref self: ERC20Component::ComponentState,␊ from: ContractAddress,␊ recipient: ContractAddress,␊ amount: u256,␊ ) {␊ + let contract_state = ERC20Component::HasComponent::get_contract(@self);␊ + contract_state.pausable.assert_not_paused();␊ }␊ ␊ fn after_update(␊ - ref self: ERC20Component::ComponentState,␊ + ref self: ERC20Component::ComponentState,␊ from: ContractAddress,␊ recipient: ContractAddress,␊ amount: u256,␊ ) {␊ - let mut erc20_votes_component = get_dep_component_mut!(ref self, ERC20Votes);␊ - erc20_votes_component.transfer_voting_units(from, recipient, amount);␊ - }␊ - }␊ - ␊ - #[abi(embed_v0)]␊ - impl ERC20CamelOnlyImpl of interface::IERC20CamelOnly {␊ - fn totalSupply(self: @ContractState) -> u256 {␊ - self.total_supply()␊ - }␊ - ␊ - fn balanceOf(self: @ContractState, account: ContractAddress) -> u256 {␊ - self.balance_of(account)␊ - }␊ - ␊ - fn transferFrom(␊ - ref self: ContractState,␊ - sender: ContractAddress,␊ - recipient: ContractAddress,␊ - amount: u256,␊ - ) -> bool {␊ - self.transfer_from(sender, recipient, amount)␊ - }␊ - }␊ - ␊ - #[abi(embed_v0)]␊ - impl ERC20Impl of interface::IERC20 {␊ - fn total_supply(self: @ContractState) -> u256 {␊ - self.erc20.total_supply()␊ - }␊ - ␊ - fn balance_of(self: @ContractState, account: ContractAddress) -> u256 {␊ - self.erc20.balance_of(account)␊ - }␊ - ␊ - fn allowance(self: @ContractState, owner: ContractAddress, spender: ContractAddress) -> u256 {␊ - self.erc20.allowance(owner, spender)␊ - }␊ - ␊ - fn transfer(ref self: ContractState, recipient: ContractAddress, amount: u256) -> bool {␊ - self.pausable.assert_not_paused();␊ - self.erc20.transfer(recipient, amount)␊ - }␊ - ␊ - fn transfer_from(␊ - ref self: ContractState,␊ - sender: ContractAddress,␊ - recipient: ContractAddress,␊ - amount: u256,␊ - ) -> bool {␊ - self.pausable.assert_not_paused();␊ - self.erc20.transfer_from(sender, recipient, amount)␊ - }␊ - ␊ - fn approve(ref self: ContractState, spender: ContractAddress, amount: u256) -> bool {␊ - self.pausable.assert_not_paused();␊ - self.erc20.approve(spender, amount)␊ + let mut contract_state = ERC20Component::HasComponent::get_contract_mut(ref self);␊ + contract_state.erc20_votes.transfer_voting_units(from, recipient, amount);␊ }␊ }␊ ␊ @@ -1707,15 +1452,12 @@ Generated by [AVA](https://avajs.dev). ␊ #[external(v0)]␊ fn burn(ref self: ContractState, value: u256) {␊ - self.pausable.assert_not_paused();␊ - let caller = get_caller_address();␊ - self.erc20._burn(caller, value);␊ + self.erc20._burn(get_caller_address(), value);␊ }␊ ␊ #[external(v0)]␊ fn mint(ref self: ContractState, recipient: ContractAddress, amount: u256) {␊ self.ownable.assert_only_owner();␊ - self.pausable.assert_not_paused();␊ self.erc20._mint(recipient, amount);␊ }␊ }␊ @@ -1742,7 +1484,6 @@ Generated by [AVA](https://avajs.dev). use openzeppelin::token::erc20::ERC20Component;␊ use openzeppelin::token::erc20::extensions::ERC20VotesComponent;␊ use openzeppelin::token::erc20::extensions::ERC20VotesComponent::InternalTrait as ERC20VotesInternalTrait;␊ - use openzeppelin::token::erc20::interface;␊ use openzeppelin::upgrades::UpgradeableComponent;␊ use openzeppelin::upgrades::interface::IUpgradeable;␊ use openzeppelin::utils::cryptography::nonces::NoncesComponent;␊ @@ -1761,7 +1502,7 @@ Generated by [AVA](https://avajs.dev). component!(path: UpgradeableComponent, storage: upgradeable, event: UpgradeableEvent);␊ ␊ #[abi(embed_v0)]␊ - impl ERC20MetadataImpl = ERC20Component::ERC20MetadataImpl;␊ + impl ERC20MixinImpl = ERC20Component::ERC20MixinImpl;␊ #[abi(embed_v0)]␊ impl PausableImpl = PausableComponent::PausableImpl;␊ #[abi(embed_v0)]␊ @@ -1842,84 +1583,25 @@ Generated by [AVA](https://avajs.dev). }␊ }␊ ␊ - impl ERC20VotesHooksImpl<␊ - TContractState,␊ - impl ERC20Votes: ERC20VotesComponent::HasComponent,␊ - impl HasComponent: ERC20Component::HasComponent,␊ - +NoncesComponent::HasComponent,␊ - +Drop␊ - > of ERC20Component::ERC20HooksTrait {␊ + impl ERC20HooksImpl of ERC20Component::ERC20HooksTrait {␊ fn before_update(␊ - ref self: ERC20Component::ComponentState,␊ + ref self: ERC20Component::ComponentState,␊ from: ContractAddress,␊ recipient: ContractAddress,␊ amount: u256,␊ ) {␊ + let contract_state = ERC20Component::HasComponent::get_contract(@self);␊ + contract_state.pausable.assert_not_paused();␊ }␊ ␊ fn after_update(␊ - ref self: ERC20Component::ComponentState,␊ + ref self: ERC20Component::ComponentState,␊ from: ContractAddress,␊ recipient: ContractAddress,␊ amount: u256,␊ ) {␊ - let mut erc20_votes_component = get_dep_component_mut!(ref self, ERC20Votes);␊ - erc20_votes_component.transfer_voting_units(from, recipient, amount);␊ - }␊ - }␊ - ␊ - #[abi(embed_v0)]␊ - impl ERC20CamelOnlyImpl of interface::IERC20CamelOnly {␊ - fn totalSupply(self: @ContractState) -> u256 {␊ - self.total_supply()␊ - }␊ - ␊ - fn balanceOf(self: @ContractState, account: ContractAddress) -> u256 {␊ - self.balance_of(account)␊ - }␊ - ␊ - fn transferFrom(␊ - ref self: ContractState,␊ - sender: ContractAddress,␊ - recipient: ContractAddress,␊ - amount: u256,␊ - ) -> bool {␊ - self.transfer_from(sender, recipient, amount)␊ - }␊ - }␊ - ␊ - #[abi(embed_v0)]␊ - impl ERC20Impl of interface::IERC20 {␊ - fn total_supply(self: @ContractState) -> u256 {␊ - self.erc20.total_supply()␊ - }␊ - ␊ - fn balance_of(self: @ContractState, account: ContractAddress) -> u256 {␊ - self.erc20.balance_of(account)␊ - }␊ - ␊ - fn allowance(self: @ContractState, owner: ContractAddress, spender: ContractAddress) -> u256 {␊ - self.erc20.allowance(owner, spender)␊ - }␊ - ␊ - fn transfer(ref self: ContractState, recipient: ContractAddress, amount: u256) -> bool {␊ - self.pausable.assert_not_paused();␊ - self.erc20.transfer(recipient, amount)␊ - }␊ - ␊ - fn transfer_from(␊ - ref self: ContractState,␊ - sender: ContractAddress,␊ - recipient: ContractAddress,␊ - amount: u256,␊ - ) -> bool {␊ - self.pausable.assert_not_paused();␊ - self.erc20.transfer_from(sender, recipient, amount)␊ - }␊ - ␊ - fn approve(ref self: ContractState, spender: ContractAddress, amount: u256) -> bool {␊ - self.pausable.assert_not_paused();␊ - self.erc20.approve(spender, amount)␊ + let mut contract_state = ERC20Component::HasComponent::get_contract_mut(ref self);␊ + contract_state.erc20_votes.transfer_voting_units(from, recipient, amount);␊ }␊ }␊ ␊ @@ -1948,15 +1630,12 @@ Generated by [AVA](https://avajs.dev). ␊ #[external(v0)]␊ fn burn(ref self: ContractState, value: u256) {␊ - self.pausable.assert_not_paused();␊ - let caller = get_caller_address();␊ - self.erc20._burn(caller, value);␊ + self.erc20._burn(get_caller_address(), value);␊ }␊ ␊ #[external(v0)]␊ fn mint(ref self: ContractState, recipient: ContractAddress, amount: u256) {␊ self.accesscontrol.assert_only_role(MINTER_ROLE);␊ - self.pausable.assert_not_paused();␊ self.erc20._mint(recipient, amount);␊ }␊ }␊ diff --git a/packages/core-cairo/src/erc20.test.ts.snap b/packages/core-cairo/src/erc20.test.ts.snap index a347d7880220ad954ca9ce9023e8c5ed98b402ed..b138d169a80760b57fa0c5bcdfdf7dc2e15e10e9 100644 GIT binary patch literal 2770 zcmV;@3N7_PRzV_P00000000B+T}^M}#u?sbQ8X(c2{uIzi{>!v93lgCKj>r&F2Hdw@idRv%S|sj_d49Cl{VE#KyqJmhTu7 z|I#J?U)~Rg1~I;WtUrGAi%0D9v!6eD`a%EkS6`vi{^1{YURfq~e7w^gVux5G3ws*s zb(-^x$)Vn=%udsuDY9RWV`WU$s^+%4XX@vc%X+g0x?das7y~ncQ zIy84Li^uuab+7!R@r2xV#}oTyBZz56K+l`BT$dV>;akWju4i0eEwU=UrjL2BBliC` zNBZIiV_-G$cz}oc_1^ZI;GsoR3d8oS8_Qt{qu-{|;Mt1<{3bHvDKQBCn!_hZU58-L zG3*&&;?HU*_9lWtg?aReH#G@54WIG1z{5=kJZLj668nT^%_PksT0yvXQDT9`-taF& z>{-{idFZ(lX4|Mjgq92gVP`rBTBikTJ4ifukvk^Q_WrEhYu$-@~M|_1$Wrt=`!mwzgmLl;1UYySx&bWwsT5 zIFMT5>4z0LywxR%-%)`q$;fdCyWCzs1PL=I{lsnSY8)mNFH=W z{bD{k&x?qkE=gR6SJL;!NP^*0c&fKp6qOexg_tdJRmO*W1fjyJEBBqyqCQJuj_QqB zs;KF=&obm>OonWLaF1>LaW%-qnyYI z3en!BiHH-}8V#nNqgDh@ZX_;ZJpnGViCiQb_MQ(D`RE!zTw$rs? zPua-Se(`IiWx{%)2O!x2wYkj^3NW;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c721.test.ts.md +++ b/packages/core-cairo/src/erc721.test.ts.md @@ -272,10 +272,7 @@ Generated by [AVA](https://avajs.dev). impl ExternalImpl of ExternalTrait {␊ #[external(v0)]␊ fn burn(ref self: ContractState, token_id: u256) {␊ - let owner = self.erc721._owner_of(token_id);␊ - let caller = get_caller_address();␊ - self.erc721._check_authorized(owner, caller, token_id);␊ - self.erc721._burn(token_id);␊ + self.erc721._update(Zeroable::zero(), token_id, get_caller_address());␊ }␊ }␊ }␊ @@ -294,8 +291,6 @@ Generated by [AVA](https://avajs.dev). use openzeppelin::introspection::src5::SRC5Component;␊ use openzeppelin::security::pausable::PausableComponent;␊ use openzeppelin::token::erc721::ERC721Component;␊ - use openzeppelin::token::erc721::ERC721HooksEmptyImpl;␊ - use openzeppelin::token::erc721::interface;␊ use openzeppelin::upgrades::UpgradeableComponent;␊ use openzeppelin::upgrades::interface::IUpgradeable;␊ use starknet::ClassHash;␊ @@ -308,11 +303,7 @@ Generated by [AVA](https://avajs.dev). component!(path: UpgradeableComponent, storage: upgradeable, event: UpgradeableEvent);␊ ␊ #[abi(embed_v0)]␊ - impl ERC721MetadataImpl = ERC721Component::ERC721MetadataImpl;␊ - #[abi(embed_v0)]␊ - impl ERC721MetadataCamelOnly = ERC721Component::ERC721MetadataCamelOnlyImpl;␊ - #[abi(embed_v0)]␊ - impl SRC5Impl = SRC5Component::SRC5Impl;␊ + impl ERC721MixinImpl = ERC721Component::ERC721MixinImpl;␊ #[abi(embed_v0)]␊ impl PausableImpl = PausableComponent::PausableImpl;␊ #[abi(embed_v0)]␊ @@ -358,95 +349,23 @@ Generated by [AVA](https://avajs.dev). self.ownable.initializer(owner);␊ }␊ ␊ - #[abi(embed_v0)]␊ - impl ERC721CamelOnlyImpl of interface::IERC721CamelOnly {␊ - fn balanceOf(self: @ContractState, account: ContractAddress) -> u256 {␊ - self.balance_of(account)␊ - }␊ - ␊ - fn ownerOf(self: @ContractState, tokenId: u256) -> ContractAddress {␊ - self.owner_of(tokenId)␊ - }␊ - ␊ - fn safeTransferFrom(␊ - ref self: ContractState,␊ - from: ContractAddress,␊ - to: ContractAddress,␊ - tokenId: u256,␊ - data: Span,␊ - ) {␊ - self.safe_transfer_from(from, to, tokenId, data);␊ - }␊ - ␊ - fn transferFrom(␊ - ref self: ContractState,␊ - from: ContractAddress,␊ - to: ContractAddress,␊ - tokenId: u256,␊ - ) {␊ - self.transfer_from(from, to, tokenId);␊ - }␊ - ␊ - fn setApprovalForAll(ref self: ContractState, operator: ContractAddress, approved: bool) {␊ - self.set_approval_for_all(operator, approved);␊ - }␊ - ␊ - fn getApproved(self: @ContractState, tokenId: u256) -> ContractAddress {␊ - self.get_approved(tokenId)␊ - }␊ - ␊ - fn isApprovedForAll(self: @ContractState, owner: ContractAddress, operator: ContractAddress) -> bool {␊ - self.is_approved_for_all(owner, operator)␊ - }␊ - }␊ - ␊ - #[abi(embed_v0)]␊ - impl ERC721Impl of interface::IERC721 {␊ - fn balance_of(self: @ContractState, account: ContractAddress) -> u256 {␊ - self.erc721.balance_of(account)␊ - }␊ - ␊ - fn owner_of(self: @ContractState, token_id: u256) -> ContractAddress {␊ - self.erc721.owner_of(token_id)␊ - }␊ - ␊ - fn safe_transfer_from(␊ - ref self: ContractState,␊ - from: ContractAddress,␊ + impl ERC721HooksImpl of ERC721Component::ERC721HooksTrait {␊ + fn before_update(␊ + ref self: ERC721Component::ComponentState,␊ to: ContractAddress,␊ token_id: u256,␊ - data: Span,␊ + auth: ContractAddress,␊ ) {␊ - self.pausable.assert_not_paused();␊ - self.erc721.safe_transfer_from(from, to, token_id, data);␊ + let contract_state = ERC721Component::HasComponent::get_contract(@self);␊ + contract_state.pausable.assert_not_paused();␊ }␊ ␊ - fn transfer_from(␊ - ref self: ContractState,␊ - from: ContractAddress,␊ + fn after_update(␊ + ref self: ERC721Component::ComponentState,␊ to: ContractAddress,␊ token_id: u256,␊ + auth: ContractAddress,␊ ) {␊ - self.pausable.assert_not_paused();␊ - self.erc721.transfer_from(from, to, token_id);␊ - }␊ - ␊ - fn approve(ref self: ContractState, to: ContractAddress, token_id: u256) {␊ - self.pausable.assert_not_paused();␊ - self.erc721.approve(to, token_id);␊ - }␊ - ␊ - fn set_approval_for_all(ref self: ContractState, operator: ContractAddress, approved: bool) {␊ - self.pausable.assert_not_paused();␊ - self.erc721.set_approval_for_all(operator, approved);␊ - }␊ - ␊ - fn get_approved(self: @ContractState, token_id: u256) -> ContractAddress {␊ - self.erc721.get_approved(token_id)␊ - }␊ - ␊ - fn is_approved_for_all(self: @ContractState, owner: ContractAddress, operator: ContractAddress) -> bool {␊ - self.erc721.is_approved_for_all(owner, operator)␊ }␊ }␊ ␊ @@ -701,8 +620,6 @@ Generated by [AVA](https://avajs.dev). use openzeppelin::introspection::src5::SRC5Component;␊ use openzeppelin::security::pausable::PausableComponent;␊ use openzeppelin::token::erc721::ERC721Component;␊ - use openzeppelin::token::erc721::ERC721HooksEmptyImpl;␊ - use openzeppelin::token::erc721::interface;␊ use starknet::ContractAddress;␊ use starknet::get_caller_address;␊ ␊ @@ -712,11 +629,7 @@ Generated by [AVA](https://avajs.dev). component!(path: OwnableComponent, storage: ownable, event: OwnableEvent);␊ ␊ #[abi(embed_v0)]␊ - impl ERC721MetadataImpl = ERC721Component::ERC721MetadataImpl;␊ - #[abi(embed_v0)]␊ - impl ERC721MetadataCamelOnly = ERC721Component::ERC721MetadataCamelOnlyImpl;␊ - #[abi(embed_v0)]␊ - impl SRC5Impl = SRC5Component::SRC5Impl;␊ + impl ERC721MixinImpl = ERC721Component::ERC721MixinImpl;␊ #[abi(embed_v0)]␊ impl PausableImpl = PausableComponent::PausableImpl;␊ #[abi(embed_v0)]␊ @@ -757,95 +670,23 @@ Generated by [AVA](https://avajs.dev). self.ownable.initializer(owner);␊ }␊ ␊ - #[abi(embed_v0)]␊ - impl ERC721CamelOnlyImpl of interface::IERC721CamelOnly {␊ - fn balanceOf(self: @ContractState, account: ContractAddress) -> u256 {␊ - self.balance_of(account)␊ - }␊ - ␊ - fn ownerOf(self: @ContractState, tokenId: u256) -> ContractAddress {␊ - self.owner_of(tokenId)␊ - }␊ - ␊ - fn safeTransferFrom(␊ - ref self: ContractState,␊ - from: ContractAddress,␊ - to: ContractAddress,␊ - tokenId: u256,␊ - data: Span,␊ - ) {␊ - self.safe_transfer_from(from, to, tokenId, data);␊ - }␊ - ␊ - fn transferFrom(␊ - ref self: ContractState,␊ - from: ContractAddress,␊ - to: ContractAddress,␊ - tokenId: u256,␊ - ) {␊ - self.transfer_from(from, to, tokenId);␊ - }␊ - ␊ - fn setApprovalForAll(ref self: ContractState, operator: ContractAddress, approved: bool) {␊ - self.set_approval_for_all(operator, approved);␊ - }␊ - ␊ - fn getApproved(self: @ContractState, tokenId: u256) -> ContractAddress {␊ - self.get_approved(tokenId)␊ - }␊ - ␊ - fn isApprovedForAll(self: @ContractState, owner: ContractAddress, operator: ContractAddress) -> bool {␊ - self.is_approved_for_all(owner, operator)␊ - }␊ - }␊ - ␊ - #[abi(embed_v0)]␊ - impl ERC721Impl of interface::IERC721 {␊ - fn balance_of(self: @ContractState, account: ContractAddress) -> u256 {␊ - self.erc721.balance_of(account)␊ - }␊ - ␊ - fn owner_of(self: @ContractState, token_id: u256) -> ContractAddress {␊ - self.erc721.owner_of(token_id)␊ - }␊ - ␊ - fn safe_transfer_from(␊ - ref self: ContractState,␊ - from: ContractAddress,␊ + impl ERC721HooksImpl of ERC721Component::ERC721HooksTrait {␊ + fn before_update(␊ + ref self: ERC721Component::ComponentState,␊ to: ContractAddress,␊ token_id: u256,␊ - data: Span,␊ + auth: ContractAddress,␊ ) {␊ - self.pausable.assert_not_paused();␊ - self.erc721.safe_transfer_from(from, to, token_id, data);␊ + let contract_state = ERC721Component::HasComponent::get_contract(@self);␊ + contract_state.pausable.assert_not_paused();␊ }␊ ␊ - fn transfer_from(␊ - ref self: ContractState,␊ - from: ContractAddress,␊ + fn after_update(␊ + ref self: ERC721Component::ComponentState,␊ to: ContractAddress,␊ token_id: u256,␊ + auth: ContractAddress,␊ ) {␊ - self.pausable.assert_not_paused();␊ - self.erc721.transfer_from(from, to, token_id);␊ - }␊ - ␊ - fn approve(ref self: ContractState, to: ContractAddress, token_id: u256) {␊ - self.pausable.assert_not_paused();␊ - self.erc721.approve(to, token_id);␊ - }␊ - ␊ - fn set_approval_for_all(ref self: ContractState, operator: ContractAddress, approved: bool) {␊ - self.pausable.assert_not_paused();␊ - self.erc721.set_approval_for_all(operator, approved);␊ - }␊ - ␊ - fn get_approved(self: @ContractState, token_id: u256) -> ContractAddress {␊ - self.erc721.get_approved(token_id)␊ - }␊ - ␊ - fn is_approved_for_all(self: @ContractState, owner: ContractAddress, operator: ContractAddress) -> bool {␊ - self.erc721.is_approved_for_all(owner, operator)␊ }␊ }␊ ␊ @@ -866,11 +707,7 @@ Generated by [AVA](https://avajs.dev). ␊ #[external(v0)]␊ fn burn(ref self: ContractState, token_id: u256) {␊ - self.pausable.assert_not_paused();␊ - let owner = self.erc721._owner_of(token_id);␊ - let caller = get_caller_address();␊ - self.erc721._check_authorized(owner, caller, token_id);␊ - self.erc721._burn(token_id);␊ + self.erc721._update(Zeroable::zero(), token_id, get_caller_address());␊ }␊ ␊ #[external(v0)]␊ @@ -881,7 +718,6 @@ Generated by [AVA](https://avajs.dev). data: Span,␊ ) {␊ self.ownable.assert_only_owner();␊ - self.pausable.assert_not_paused();␊ self.erc721._safe_mint(recipient, token_id, data);␊ }␊ ␊ @@ -911,8 +747,6 @@ Generated by [AVA](https://avajs.dev). use openzeppelin::introspection::src5::SRC5Component;␊ use openzeppelin::security::pausable::PausableComponent;␊ use openzeppelin::token::erc721::ERC721Component;␊ - use openzeppelin::token::erc721::ERC721HooksEmptyImpl;␊ - use openzeppelin::token::erc721::interface;␊ use openzeppelin::upgrades::UpgradeableComponent;␊ use openzeppelin::upgrades::interface::IUpgradeable;␊ use starknet::ClassHash;␊ @@ -926,11 +760,7 @@ Generated by [AVA](https://avajs.dev). component!(path: UpgradeableComponent, storage: upgradeable, event: UpgradeableEvent);␊ ␊ #[abi(embed_v0)]␊ - impl ERC721MetadataImpl = ERC721Component::ERC721MetadataImpl;␊ - #[abi(embed_v0)]␊ - impl ERC721MetadataCamelOnly = ERC721Component::ERC721MetadataCamelOnlyImpl;␊ - #[abi(embed_v0)]␊ - impl SRC5Impl = SRC5Component::SRC5Impl;␊ + impl ERC721MixinImpl = ERC721Component::ERC721MixinImpl;␊ #[abi(embed_v0)]␊ impl PausableImpl = PausableComponent::PausableImpl;␊ #[abi(embed_v0)]␊ @@ -976,95 +806,23 @@ Generated by [AVA](https://avajs.dev). self.ownable.initializer(owner);␊ }␊ ␊ - #[abi(embed_v0)]␊ - impl ERC721CamelOnlyImpl of interface::IERC721CamelOnly {␊ - fn balanceOf(self: @ContractState, account: ContractAddress) -> u256 {␊ - self.balance_of(account)␊ - }␊ - ␊ - fn ownerOf(self: @ContractState, tokenId: u256) -> ContractAddress {␊ - self.owner_of(tokenId)␊ - }␊ - ␊ - fn safeTransferFrom(␊ - ref self: ContractState,␊ - from: ContractAddress,␊ - to: ContractAddress,␊ - tokenId: u256,␊ - data: Span,␊ - ) {␊ - self.safe_transfer_from(from, to, tokenId, data);␊ - }␊ - ␊ - fn transferFrom(␊ - ref self: ContractState,␊ - from: ContractAddress,␊ - to: ContractAddress,␊ - tokenId: u256,␊ - ) {␊ - self.transfer_from(from, to, tokenId);␊ - }␊ - ␊ - fn setApprovalForAll(ref self: ContractState, operator: ContractAddress, approved: bool) {␊ - self.set_approval_for_all(operator, approved);␊ - }␊ - ␊ - fn getApproved(self: @ContractState, tokenId: u256) -> ContractAddress {␊ - self.get_approved(tokenId)␊ - }␊ - ␊ - fn isApprovedForAll(self: @ContractState, owner: ContractAddress, operator: ContractAddress) -> bool {␊ - self.is_approved_for_all(owner, operator)␊ - }␊ - }␊ - ␊ - #[abi(embed_v0)]␊ - impl ERC721Impl of interface::IERC721 {␊ - fn balance_of(self: @ContractState, account: ContractAddress) -> u256 {␊ - self.erc721.balance_of(account)␊ - }␊ - ␊ - fn owner_of(self: @ContractState, token_id: u256) -> ContractAddress {␊ - self.erc721.owner_of(token_id)␊ - }␊ - ␊ - fn safe_transfer_from(␊ - ref self: ContractState,␊ - from: ContractAddress,␊ + impl ERC721HooksImpl of ERC721Component::ERC721HooksTrait {␊ + fn before_update(␊ + ref self: ERC721Component::ComponentState,␊ to: ContractAddress,␊ token_id: u256,␊ - data: Span,␊ + auth: ContractAddress,␊ ) {␊ - self.pausable.assert_not_paused();␊ - self.erc721.safe_transfer_from(from, to, token_id, data);␊ + let contract_state = ERC721Component::HasComponent::get_contract(@self);␊ + contract_state.pausable.assert_not_paused();␊ }␊ ␊ - fn transfer_from(␊ - ref self: ContractState,␊ - from: ContractAddress,␊ + fn after_update(␊ + ref self: ERC721Component::ComponentState,␊ to: ContractAddress,␊ token_id: u256,␊ + auth: ContractAddress,␊ ) {␊ - self.pausable.assert_not_paused();␊ - self.erc721.transfer_from(from, to, token_id);␊ - }␊ - ␊ - fn approve(ref self: ContractState, to: ContractAddress, token_id: u256) {␊ - self.pausable.assert_not_paused();␊ - self.erc721.approve(to, token_id);␊ - }␊ - ␊ - fn set_approval_for_all(ref self: ContractState, operator: ContractAddress, approved: bool) {␊ - self.pausable.assert_not_paused();␊ - self.erc721.set_approval_for_all(operator, approved);␊ - }␊ - ␊ - fn get_approved(self: @ContractState, token_id: u256) -> ContractAddress {␊ - self.erc721.get_approved(token_id)␊ - }␊ - ␊ - fn is_approved_for_all(self: @ContractState, owner: ContractAddress, operator: ContractAddress) -> bool {␊ - self.erc721.is_approved_for_all(owner, operator)␊ }␊ }␊ ␊ @@ -1093,11 +851,7 @@ Generated by [AVA](https://avajs.dev). ␊ #[external(v0)]␊ fn burn(ref self: ContractState, token_id: u256) {␊ - self.pausable.assert_not_paused();␊ - let owner = self.erc721._owner_of(token_id);␊ - let caller = get_caller_address();␊ - self.erc721._check_authorized(owner, caller, token_id);␊ - self.erc721._burn(token_id);␊ + self.erc721._update(Zeroable::zero(), token_id, get_caller_address());␊ }␊ ␊ #[external(v0)]␊ @@ -1108,7 +862,6 @@ Generated by [AVA](https://avajs.dev). data: Span,␊ ) {␊ self.ownable.assert_only_owner();␊ - self.pausable.assert_not_paused();␊ self.erc721._safe_mint(recipient, token_id, data);␊ }␊ ␊ diff --git a/packages/core-cairo/src/erc721.test.ts.snap b/packages/core-cairo/src/erc721.test.ts.snap index fc13ba71ce653524092df83ff66259c63806652f..b252a694ed480d56500bdaffcc3932a97fe665f9 100644 GIT binary patch literal 2006 zcmV;{2PybLRzV@>3uDamp5lq zP#W2nO&^O000000000B+T-|ciHWa2UoetX$Ou6li2sfK{*^tbn9SmhyHlb{rl#nbl z6ehTeEoaquZP%6wfyqTLd)qglkI*;h^Yjh4s$|Pr$v?aK-E21U1zFoVpLC9-qwlk2 z-aA{aZ|y{X{*4GGE{eBcge~Ct-mN&;4xx?UmWy!Y!654SB>LmMZ9@Wox!nKc(r1_0 z@zJN3zWn&r<+(Yqv9|R5)(WUMK}p?SMjyZJIAFx>GFF${|r+^qF|8?5ei{T<|i zcQrtdI6}ausBbx{VPIO=j{;;7?9~-VKHu8RRZ-+# z)}b2&5_F%}Ac1u}fU0OM~o(DTLzz=~_KR4v3KJ7(nT-S*i8xb~6oo6ML9o=;F61 ztk3X?JktO(tKFa2pBX;5_iOt#o}EyVor>A$N}yyTcx6Jf5wt86MTX(;dMvFP#*_5N z$h0z%X{_9oFB{a$XM+V~WQ7AO%;voVEgGGUgfK811i$UVD0&Q|Ug=HVGcDT=Y0xJ! z>z1OFg-rsJmSuq{nGA)_4>t*x4@m*Zi;i!77+wKyj$A|D88Ms2v<3+*Df&6UvaUQR zDt9J_Saf=N*2&@a(zq|5BZorEGH^*ir)upkGt6g;s&I~gkuyYD98ZuzG+2MJwL6#8 zkI5{A86ORbT~ec3RxcoRex= zxPr43uF0r7$oAzUMnjDBbbMC~?;#D0z40|Mt81v5?o*jnuBN}ZqNwQ)pKCR(UkRO8 zEv=RBITNQ^OpZfLY7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 Date: Tue, 21 May 2024 17:27:59 -0400 Subject: [PATCH 08/11] Update versions, update changelog --- packages/core-cairo/CHANGELOG.md | 7 +++++++ packages/core-cairo/package.json | 2 +- packages/core-cairo/src/utils/version.ts | 4 ++-- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/packages/core-cairo/CHANGELOG.md b/packages/core-cairo/CHANGELOG.md index 78d1614cb..1332cf667 100644 --- a/packages/core-cairo/CHANGELOG.md +++ b/packages/core-cairo/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## Unreleased + +- **Breaking changes**: + - Use OpenZeppelin Contracts for Cairo v0.13.0. + - Use Hooks with ERC721 and ERC1155. + - Use Hooks for Pausable. + ## 0.12.0 (2024-05-01) - Add `votes` option to ERC20. ([#355](https://github.com/OpenZeppelin/contracts-wizard/pull/355)) diff --git a/packages/core-cairo/package.json b/packages/core-cairo/package.json index c692fae64..c650a2102 100644 --- a/packages/core-cairo/package.json +++ b/packages/core-cairo/package.json @@ -1,6 +1,6 @@ { "name": "@openzeppelin/wizard-cairo", - "version": "0.12.0", + "version": "0.13.0", "description": "A boilerplate generator to get started with OpenZeppelin Contracts for Cairo", "license": "MIT", "repository": "github:OpenZeppelin/contracts-wizard", diff --git a/packages/core-cairo/src/utils/version.ts b/packages/core-cairo/src/utils/version.ts index 06b204669..c3df2ba75 100644 --- a/packages/core-cairo/src/utils/version.ts +++ b/packages/core-cairo/src/utils/version.ts @@ -1,10 +1,10 @@ /** * The actual latest version to use in links. */ -export const contractsVersion = '0.12.0'; +export const contractsVersion = '0.13.0'; export const contractsVersionTag = `v${contractsVersion}`; /** * Semantic version string representing of the minimum compatible version of Contracts to display in output. */ -export const compatibleContractsSemver = '^0.12.0'; +export const compatibleContractsSemver = '^0.13.0'; From 25d046d85bb00261f66161fc0b5596de35a0b2b3 Mon Sep 17 00:00:00 2001 From: Eric Lau Date: Tue, 21 May 2024 17:32:24 -0400 Subject: [PATCH 09/11] Remove unused --- packages/core-cairo/src/erc20.ts | 39 +------------------------------- 1 file changed, 1 insertion(+), 38 deletions(-) diff --git a/packages/core-cairo/src/erc20.ts b/packages/core-cairo/src/erc20.ts index 3c53ecbb8..76e49e5fb 100644 --- a/packages/core-cairo/src/erc20.ts +++ b/packages/core-cairo/src/erc20.ts @@ -1,4 +1,4 @@ -import { BaseImplementedTrait, Contract, ContractBuilder, ContractFunction } from './contract'; +import { BaseImplementedTrait, Contract, ContractBuilder } from './contract'; import { Access, requireAccessControl, setAccessControl } from './set-access-control'; import { addPausable } from './add-pausable'; import { defineFunctions } from './utils/define-functions'; @@ -158,43 +158,6 @@ function addHooks(c: ContractBuilder, allOpts: Required) { } } -function addPausableHook(c: ContractBuilder) { - const ERC721HooksTrait: BaseImplementedTrait = { - name: `ERC721HooksImpl`, - of: 'ERC721Component::ERC721HooksTrait', - tags: [], - priority: 0, - }; - c.addImplementedTrait(ERC721HooksTrait); - - c.addStandaloneImport('starknet::ContractAddress'); - - c.addFunction(ERC721HooksTrait, { - name: 'before_update', - args: [ - { name: 'ref self', type: `ERC721Component::ComponentState` }, - { name: 'to', type: 'ContractAddress' }, - { name: 'token_id', type: 'u256' }, - { name: 'auth', type: 'ContractAddress' }, - ], - code: [ - 'let contract_state = ERC721Component::HasComponent::get_contract(@self)', - 'contract_state.pausable.assert_not_paused()', - ], - }); - - c.addFunction(ERC721HooksTrait, { - name: 'after_update', - args: [ - { name: 'ref self', type: `ERC721Component::ComponentState` }, - { name: 'to', type: 'ContractAddress' }, - { name: 'token_id', type: 'u256' }, - { name: 'auth', type: 'ContractAddress' }, - ], - code: [], - }); -} - function addERC20Mixin(c: ContractBuilder) { c.addImplToComponent(components.ERC20Component, { name: 'ERC20MixinImpl', From 8f3375fb98933a925fb12613ab513c0cf691cff6 Mon Sep 17 00:00:00 2001 From: Eric Lau Date: Tue, 21 May 2024 17:37:11 -0400 Subject: [PATCH 10/11] Update version in snapshots --- packages/core-cairo/src/contract.test.ts.md | 14 ++++---- packages/core-cairo/src/contract.test.ts.snap | Bin 714 -> 715 bytes packages/core-cairo/src/custom.test.ts.md | 16 ++++----- packages/core-cairo/src/custom.test.ts.snap | Bin 1337 -> 1338 bytes packages/core-cairo/src/erc1155.test.ts.md | 20 +++++------ packages/core-cairo/src/erc1155.test.ts.snap | Bin 2535 -> 2535 bytes packages/core-cairo/src/erc20.test.ts.md | 32 +++++++++--------- packages/core-cairo/src/erc20.test.ts.snap | Bin 2770 -> 2770 bytes packages/core-cairo/src/erc721.test.ts.md | 18 +++++----- packages/core-cairo/src/erc721.test.ts.snap | Bin 2006 -> 2006 bytes 10 files changed, 50 insertions(+), 50 deletions(-) diff --git a/packages/core-cairo/src/contract.test.ts.md b/packages/core-cairo/src/contract.test.ts.md index 93aac45a4..30ca51d4f 100644 --- a/packages/core-cairo/src/contract.test.ts.md +++ b/packages/core-cairo/src/contract.test.ts.md @@ -9,7 +9,7 @@ Generated by [AVA](https://avajs.dev). > Snapshot 1 `// SPDX-License-Identifier: MIT␊ - // Compatible with OpenZeppelin Contracts for Cairo ^0.12.0␊ + // Compatible with OpenZeppelin Contracts for Cairo ^0.13.0␊ ␊ #[starknet::contract]␊ mod Foo {␊ @@ -24,7 +24,7 @@ Generated by [AVA](https://avajs.dev). > Snapshot 1 `// SPDX-License-Identifier: MIT␊ - // Compatible with OpenZeppelin Contracts for Cairo ^0.12.0␊ + // Compatible with OpenZeppelin Contracts for Cairo ^0.13.0␊ ␊ #[starknet::contract]␊ mod Foo {␊ @@ -44,7 +44,7 @@ Generated by [AVA](https://avajs.dev). > Snapshot 1 `// SPDX-License-Identifier: MIT␊ - // Compatible with OpenZeppelin Contracts for Cairo ^0.12.0␊ + // Compatible with OpenZeppelin Contracts for Cairo ^0.13.0␊ ␊ #[starknet::contract]␊ mod Foo {␊ @@ -64,7 +64,7 @@ Generated by [AVA](https://avajs.dev). > Snapshot 1 `// SPDX-License-Identifier: MIT␊ - // Compatible with OpenZeppelin Contracts for Cairo ^0.12.0␊ + // Compatible with OpenZeppelin Contracts for Cairo ^0.13.0␊ ␊ #[starknet::contract]␊ mod Foo {␊ @@ -89,7 +89,7 @@ Generated by [AVA](https://avajs.dev). > Snapshot 1 `// SPDX-License-Identifier: MIT␊ - // Compatible with OpenZeppelin Contracts for Cairo ^0.12.0␊ + // Compatible with OpenZeppelin Contracts for Cairo ^0.13.0␊ ␊ #[starknet::contract]␊ mod Foo {␊ @@ -114,7 +114,7 @@ Generated by [AVA](https://avajs.dev). > Snapshot 1 `// SPDX-License-Identifier: MIT␊ - // Compatible with OpenZeppelin Contracts for Cairo ^0.12.0␊ + // Compatible with OpenZeppelin Contracts for Cairo ^0.13.0␊ ␊ #[starknet::contract]␊ mod Foo {␊ @@ -152,7 +152,7 @@ Generated by [AVA](https://avajs.dev). > Snapshot 1 `// SPDX-License-Identifier: MIT␊ - // Compatible with OpenZeppelin Contracts for Cairo ^0.12.0␊ + // Compatible with OpenZeppelin Contracts for Cairo ^0.13.0␊ ␊ #[starknet::contract]␊ mod Foo {␊ diff --git a/packages/core-cairo/src/contract.test.ts.snap b/packages/core-cairo/src/contract.test.ts.snap index bf56c387b722ea9ba458eabf4338bcc1ae1947be..0201cf73f6d8739995b6a3a8c1a4696ba9bb8e49 100644 GIT binary patch literal 715 zcmV;+0yOrY2e_yhH?3?6(aV+nz5S!Z2v1 z6!73!kROW(00000000B+RZVWwKom}b5W+iltYAntj+CS+>>OazA1P81Na>27!*32XnP=r_^ZoszexB(a81{{R3XB<3^RX{?b74gQN_y4}{z43YE$1FG%A3lR5 zG6ohfDme}$^06R+AcEplOqmq#&%+Q)eE9WR<3=NUn%5h*T3;HQn`r!O=dia=0-yqV zqY$Vh5drR@C!+&L>9<*uVoCfM&?_RR=xGY{1*9p&ges*@C{V;W+Qx)4^m5SOde9#@ z&c>0Dn4eORo>x?M>?ABidyJvC4pL8M!#F;H`~;eP_X%UNKltfC5)IO;ji%kBt=j z#7%)uh=io0g(OL1w0kCjQye1}Ex!*k#}djLM_@GWd|;dnUp4_HpX|{97rb1=nQoxU z-u+**SJ{!(i+9cDWnmN9Y!XT&!7+IQ9Hp4!q=viJcZ<7kt$)tlOhDeU=cy!9&r_N# zA)~5}q2??o&iCBh29<5P$Z+qe3RoAxTnTfN-R!F~bV>|E;zKxDl9V&7EJxYk%wC{eEg=_H3ium8C#CMIj{BuiciZ`_Z?$WFR(I_MQH|0N xt4j?s{uq}v`|-)zkB^sWKVsr@%wH>l)p1`RhU*>rFLr3*`~ZW6ajTI%&6|xo8($h*TWIub@3?zN0-yrA z!w{$>5drR@C&MF0>33O@VoCfM&?_RR=xGY{1*9p&ges*;C{V;W+Qo!3^s?XE-s$xn zXY)iz%+DxD&&w+tI|&QX0b}T`gVdARFpf`QtdBzSnJRx|WY%WkEF9b6`MqU}x)^mb zE-HJ#LRjhedGl_m<=f3`(y}!zG-%8tT5Q_o5Fr6^TKJ6iJG6#2$voymm z=g1&tjDXG(qy?oqq8Q7c*>jYuC1_!#fWPr`QtF=SxK|i;x20!&yH)eEx?f%p)hG?I wy3`=!k8xSEAD>G5@$o9{M@)Q<`D;b6Iv$$CV7){C#SSf;AA>u Snapshot 1 `// SPDX-License-Identifier: MIT␊ - // Compatible with OpenZeppelin Contracts for Cairo ^0.12.0␊ + // Compatible with OpenZeppelin Contracts for Cairo ^0.13.0␊ ␊ #[starknet::contract]␊ mod MyContract {␊ @@ -24,7 +24,7 @@ Generated by [AVA](https://avajs.dev). > Snapshot 1 `// SPDX-License-Identifier: MIT␊ - // Compatible with OpenZeppelin Contracts for Cairo ^0.12.0␊ + // Compatible with OpenZeppelin Contracts for Cairo ^0.13.0␊ ␊ #[starknet::contract]␊ mod MyContract {␊ @@ -80,7 +80,7 @@ Generated by [AVA](https://avajs.dev). > Snapshot 1 `// SPDX-License-Identifier: MIT␊ - // Compatible with OpenZeppelin Contracts for Cairo ^0.12.0␊ + // Compatible with OpenZeppelin Contracts for Cairo ^0.13.0␊ ␊ #[starknet::contract]␊ mod MyContract {␊ @@ -161,7 +161,7 @@ Generated by [AVA](https://avajs.dev). > Snapshot 1 `// SPDX-License-Identifier: MIT␊ - // Compatible with OpenZeppelin Contracts for Cairo ^0.12.0␊ + // Compatible with OpenZeppelin Contracts for Cairo ^0.13.0␊ ␊ #[starknet::contract]␊ mod MyContract {␊ @@ -217,7 +217,7 @@ Generated by [AVA](https://avajs.dev). > Snapshot 1 `// SPDX-License-Identifier: MIT␊ - // Compatible with OpenZeppelin Contracts for Cairo ^0.12.0␊ + // Compatible with OpenZeppelin Contracts for Cairo ^0.13.0␊ ␊ #[starknet::contract]␊ mod MyContract {␊ @@ -232,7 +232,7 @@ Generated by [AVA](https://avajs.dev). > Snapshot 1 `// SPDX-License-Identifier: MIT␊ - // Compatible with OpenZeppelin Contracts for Cairo ^0.12.0␊ + // Compatible with OpenZeppelin Contracts for Cairo ^0.13.0␊ ␊ #[starknet::contract]␊ mod MyContract {␊ @@ -288,7 +288,7 @@ Generated by [AVA](https://avajs.dev). > Snapshot 1 `// SPDX-License-Identifier: MIT␊ - // Compatible with OpenZeppelin Contracts for Cairo ^0.12.0␊ + // Compatible with OpenZeppelin Contracts for Cairo ^0.13.0␊ ␊ const UPGRADER_ROLE: felt252 = selector!("UPGRADER_ROLE");␊ ␊ @@ -361,7 +361,7 @@ Generated by [AVA](https://avajs.dev). > Snapshot 1 `// SPDX-License-Identifier: MIT␊ - // Compatible with OpenZeppelin Contracts for Cairo ^0.12.0␊ + // Compatible with OpenZeppelin Contracts for Cairo ^0.13.0␊ ␊ #[starknet::contract]␊ mod MyContract {␊ diff --git a/packages/core-cairo/src/custom.test.ts.snap b/packages/core-cairo/src/custom.test.ts.snap index 875f971fb81b68fcaecef44167ebcbc043494ec2..5da6f9977d6ccd95c6285d3357736eafc0f977a9 100644 GIT binary patch delta 1237 zcmV;`1SW|cdiZ!*z&8W`Uvd3w=t6Xr$Yb+0dcmc#4@CLjKGxpejnek7OLefnlN2(fo&YU^l znRCu}GWI+B+HuX>;MdCvGMXHI6dxM>>Lmi(*W=EEKC`(3HBj4?48y4c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p3z90D2!{()Z*!(ZQmST6xF8}}#lVO(t diff --git a/packages/core-cairo/src/erc1155.test.ts.md b/packages/core-cairo/src/erc1155.test.ts.md index 035806aad..341e6a263 100644 --- a/packages/core-cairo/src/erc1155.test.ts.md +++ b/packages/core-cairo/src/erc1155.test.ts.md @@ -9,7 +9,7 @@ Generated by [AVA](https://avajs.dev). > Snapshot 1 `// SPDX-License-Identifier: MIT␊ - // Compatible with OpenZeppelin Contracts for Cairo ^0.12.0␊ + // Compatible with OpenZeppelin Contracts for Cairo ^0.13.0␊ ␊ #[starknet::contract]␊ mod MyToken {␊ @@ -80,7 +80,7 @@ Generated by [AVA](https://avajs.dev). > Snapshot 1 `// SPDX-License-Identifier: MIT␊ - // Compatible with OpenZeppelin Contracts for Cairo ^0.12.0␊ + // Compatible with OpenZeppelin Contracts for Cairo ^0.13.0␊ ␊ #[starknet::contract]␊ mod MyToken {␊ @@ -168,7 +168,7 @@ Generated by [AVA](https://avajs.dev). > Snapshot 1 `// SPDX-License-Identifier: MIT␊ - // Compatible with OpenZeppelin Contracts for Cairo ^0.12.0␊ + // Compatible with OpenZeppelin Contracts for Cairo ^0.13.0␊ ␊ const URI_SETTER_ROLE: felt252 = selector!("URI_SETTER_ROLE");␊ const UPGRADER_ROLE: felt252 = selector!("UPGRADER_ROLE");␊ @@ -272,7 +272,7 @@ Generated by [AVA](https://avajs.dev). > Snapshot 1 `// SPDX-License-Identifier: MIT␊ - // Compatible with OpenZeppelin Contracts for Cairo ^0.12.0␊ + // Compatible with OpenZeppelin Contracts for Cairo ^0.13.0␊ ␊ #[starknet::contract]␊ mod MyToken {␊ @@ -345,7 +345,7 @@ Generated by [AVA](https://avajs.dev). > Snapshot 1 `// SPDX-License-Identifier: MIT␊ - // Compatible with OpenZeppelin Contracts for Cairo ^0.12.0␊ + // Compatible with OpenZeppelin Contracts for Cairo ^0.13.0␊ ␊ #[starknet::contract]␊ mod MyToken {␊ @@ -467,7 +467,7 @@ Generated by [AVA](https://avajs.dev). > Snapshot 1 `// SPDX-License-Identifier: MIT␊ - // Compatible with OpenZeppelin Contracts for Cairo ^0.12.0␊ + // Compatible with OpenZeppelin Contracts for Cairo ^0.13.0␊ ␊ #[starknet::contract]␊ mod MyToken {␊ @@ -597,7 +597,7 @@ Generated by [AVA](https://avajs.dev). > Snapshot 1 `// SPDX-License-Identifier: MIT␊ - // Compatible with OpenZeppelin Contracts for Cairo ^0.12.0␊ + // Compatible with OpenZeppelin Contracts for Cairo ^0.13.0␊ ␊ #[starknet::contract]␊ mod MyToken {␊ @@ -720,7 +720,7 @@ Generated by [AVA](https://avajs.dev). > Snapshot 1 `// SPDX-License-Identifier: MIT␊ - // Compatible with OpenZeppelin Contracts for Cairo ^0.12.0␊ + // Compatible with OpenZeppelin Contracts for Cairo ^0.13.0␊ ␊ const MINTER_ROLE: felt252 = selector!("MINTER_ROLE");␊ const URI_SETTER_ROLE: felt252 = selector!("URI_SETTER_ROLE");␊ @@ -862,7 +862,7 @@ Generated by [AVA](https://avajs.dev). > Snapshot 1 `// SPDX-License-Identifier: MIT␊ - // Compatible with OpenZeppelin Contracts for Cairo ^0.12.0␊ + // Compatible with OpenZeppelin Contracts for Cairo ^0.13.0␊ ␊ const PAUSER_ROLE: felt252 = selector!("PAUSER_ROLE");␊ const MINTER_ROLE: felt252 = selector!("MINTER_ROLE");␊ @@ -1063,7 +1063,7 @@ Generated by [AVA](https://avajs.dev). > Snapshot 1 `// SPDX-License-Identifier: MIT␊ - // Compatible with OpenZeppelin Contracts for Cairo ^0.12.0␊ + // Compatible with OpenZeppelin Contracts for Cairo ^0.13.0␊ ␊ const PAUSER_ROLE: felt252 = selector!("PAUSER_ROLE");␊ const MINTER_ROLE: felt252 = selector!("MINTER_ROLE");␊ diff --git a/packages/core-cairo/src/erc1155.test.ts.snap b/packages/core-cairo/src/erc1155.test.ts.snap index c0543ae4b2ddb6816ef5cd77d3ce2b351482c2c9..3df4d9cd028dd67abe3aefad9fde527e5b4276ef 100644 GIT binary patch literal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-N={{ao@S8!Xa000+)&Kdv! diff --git a/packages/core-cairo/src/erc20.test.ts.md b/packages/core-cairo/src/erc20.test.ts.md index d32d750ee..cf5fb11ff 100644 --- a/packages/core-cairo/src/erc20.test.ts.md +++ b/packages/core-cairo/src/erc20.test.ts.md @@ -9,7 +9,7 @@ Generated by [AVA](https://avajs.dev). > Snapshot 1 `// SPDX-License-Identifier: MIT␊ - // Compatible with OpenZeppelin Contracts for Cairo ^0.12.0␊ + // Compatible with OpenZeppelin Contracts for Cairo ^0.13.0␊ ␊ #[starknet::contract]␊ mod MyToken {␊ @@ -48,7 +48,7 @@ Generated by [AVA](https://avajs.dev). > Snapshot 1 `// SPDX-License-Identifier: MIT␊ - // Compatible with OpenZeppelin Contracts for Cairo ^0.12.0␊ + // Compatible with OpenZeppelin Contracts for Cairo ^0.13.0␊ ␊ #[starknet::contract]␊ mod MyToken {␊ @@ -115,7 +115,7 @@ Generated by [AVA](https://avajs.dev). > Snapshot 1 `// SPDX-License-Identifier: MIT␊ - // Compatible with OpenZeppelin Contracts for Cairo ^0.12.0␊ + // Compatible with OpenZeppelin Contracts for Cairo ^0.13.0␊ ␊ #[starknet::contract]␊ mod MyToken {␊ @@ -192,7 +192,7 @@ Generated by [AVA](https://avajs.dev). > Snapshot 1 `// SPDX-License-Identifier: MIT␊ - // Compatible with OpenZeppelin Contracts for Cairo ^0.12.0␊ + // Compatible with OpenZeppelin Contracts for Cairo ^0.13.0␊ ␊ #[starknet::contract]␊ mod MyToken {␊ @@ -303,7 +303,7 @@ Generated by [AVA](https://avajs.dev). > Snapshot 1 `// SPDX-License-Identifier: MIT␊ - // Compatible with OpenZeppelin Contracts for Cairo ^0.12.0␊ + // Compatible with OpenZeppelin Contracts for Cairo ^0.13.0␊ ␊ const PAUSER_ROLE: felt252 = selector!("PAUSER_ROLE");␊ const UPGRADER_ROLE: felt252 = selector!("UPGRADER_ROLE");␊ @@ -434,7 +434,7 @@ Generated by [AVA](https://avajs.dev). > Snapshot 1 `// SPDX-License-Identifier: MIT␊ - // Compatible with OpenZeppelin Contracts for Cairo ^0.12.0␊ + // Compatible with OpenZeppelin Contracts for Cairo ^0.13.0␊ ␊ #[starknet::contract]␊ mod MyToken {␊ @@ -551,7 +551,7 @@ Generated by [AVA](https://avajs.dev). > Snapshot 1 `// SPDX-License-Identifier: MIT␊ - // Compatible with OpenZeppelin Contracts for Cairo ^0.12.0␊ + // Compatible with OpenZeppelin Contracts for Cairo ^0.13.0␊ ␊ #[starknet::contract]␊ mod MyToken {␊ @@ -620,7 +620,7 @@ Generated by [AVA](https://avajs.dev). > Snapshot 1 `// SPDX-License-Identifier: MIT␊ - // Compatible with OpenZeppelin Contracts for Cairo ^0.12.0␊ + // Compatible with OpenZeppelin Contracts for Cairo ^0.13.0␊ ␊ #[starknet::contract]␊ mod MyToken {␊ @@ -687,7 +687,7 @@ Generated by [AVA](https://avajs.dev). > Snapshot 1 `// SPDX-License-Identifier: MIT␊ - // Compatible with OpenZeppelin Contracts for Cairo ^0.12.0␊ + // Compatible with OpenZeppelin Contracts for Cairo ^0.13.0␊ ␊ #[starknet::contract]␊ mod MyToken {␊ @@ -764,7 +764,7 @@ Generated by [AVA](https://avajs.dev). > Snapshot 1 `// SPDX-License-Identifier: MIT␊ - // Compatible with OpenZeppelin Contracts for Cairo ^0.12.0␊ + // Compatible with OpenZeppelin Contracts for Cairo ^0.13.0␊ ␊ const MINTER_ROLE: felt252 = selector!("MINTER_ROLE");␊ const UPGRADER_ROLE: felt252 = selector!("UPGRADER_ROLE");␊ @@ -861,7 +861,7 @@ Generated by [AVA](https://avajs.dev). > Snapshot 1 `// SPDX-License-Identifier: MIT␊ - // Compatible with OpenZeppelin Contracts for Cairo ^0.12.0␊ + // Compatible with OpenZeppelin Contracts for Cairo ^0.13.0␊ ␊ #[starknet::contract]␊ mod MyToken {␊ @@ -975,7 +975,7 @@ Generated by [AVA](https://avajs.dev). > Snapshot 1 `// SPDX-License-Identifier: MIT␊ - // Compatible with OpenZeppelin Contracts for Cairo ^0.12.0␊ + // Compatible with OpenZeppelin Contracts for Cairo ^0.13.0␊ ␊ #[starknet::contract]␊ mod MyToken {␊ @@ -1089,7 +1089,7 @@ Generated by [AVA](https://avajs.dev). > Snapshot 1 `// SPDX-License-Identifier: MIT␊ - // Compatible with OpenZeppelin Contracts for Cairo ^0.12.0␊ + // Compatible with OpenZeppelin Contracts for Cairo ^0.13.0␊ ␊ #[starknet::contract]␊ mod MyToken {␊ @@ -1176,7 +1176,7 @@ Generated by [AVA](https://avajs.dev). > Snapshot 1 `// SPDX-License-Identifier: MIT␊ - // Compatible with OpenZeppelin Contracts for Cairo ^0.12.0␊ + // Compatible with OpenZeppelin Contracts for Cairo ^0.13.0␊ ␊ #[starknet::contract]␊ mod MyToken {␊ @@ -1314,7 +1314,7 @@ Generated by [AVA](https://avajs.dev). > Snapshot 1 `// SPDX-License-Identifier: MIT␊ - // Compatible with OpenZeppelin Contracts for Cairo ^0.12.0␊ + // Compatible with OpenZeppelin Contracts for Cairo ^0.13.0␊ ␊ #[starknet::contract]␊ mod MyToken {␊ @@ -1469,7 +1469,7 @@ Generated by [AVA](https://avajs.dev). > Snapshot 1 `// SPDX-License-Identifier: MIT␊ - // Compatible with OpenZeppelin Contracts for Cairo ^0.12.0␊ + // Compatible with OpenZeppelin Contracts for Cairo ^0.13.0␊ ␊ const PAUSER_ROLE: felt252 = selector!("PAUSER_ROLE");␊ const MINTER_ROLE: felt252 = selector!("MINTER_ROLE");␊ diff --git a/packages/core-cairo/src/erc20.test.ts.snap b/packages/core-cairo/src/erc20.test.ts.snap index b138d169a80760b57fa0c5bcdfdf7dc2e15e10e9..5211ab234f288fa37a66b26b143bb2a5e259bf2d 100644 GIT binary patch literal 2770 zcmV;@3N7_PRzVtY^M>r z@(Ml#O@a+UQ6rl$MG8E4?F4&KpclO?&?ng57w7}@9r^}+md=nva)umHluSva{OiUR zHS^8P&pCYGKc}~&fobbk?%)53J;O8c&8Gv+HFSg>y}j2$mTm3$lM6>1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i2(O*eNg5_%D0k>xZ3w zUq9~jj=mHqw+M2LJ;w8Lajy5p*y)VJ9?+c4iDJ<AiNi>NI}bF7r3K z3PaB>eeU=pYE1goaxU~KZC`$q89)%dIcl>$?u?bLKO=(nZbdzVLWHMQ#DfS25e_08 zL^z0W5aA%g!w-mX5aA%g*&`6)<%sYI=ewhm)9&kIP~@P0qlU=K>cwy?QOpyo|ihvfMH;)Dvf562bg)aUm zlB@ck&2*jkrBJR*>a&jIl4^ejE~$s;l7e;7;2zsJ_m~oE0}h=6&l`B&;ILfq=dEQa zJ9r24vR=1E@Ze+wCnGo+!N~|tMp&$0`LqAP>bhKSo~wPXxyRx^`R zj_U70U)G%v1q=p0_51tO;hK!~_}8m<-3IvTE9*H!|IQ%43dwgdwRi YvovL88D?#&dK=gO0g8Cx(iqtQ0BL1R%m4rY diff --git a/packages/core-cairo/src/erc721.test.ts.md b/packages/core-cairo/src/erc721.test.ts.md index 3f47d3ae2..2c7eb15a6 100644 --- a/packages/core-cairo/src/erc721.test.ts.md +++ b/packages/core-cairo/src/erc721.test.ts.md @@ -9,7 +9,7 @@ Generated by [AVA](https://avajs.dev). > Snapshot 1 `// SPDX-License-Identifier: MIT␊ - // Compatible with OpenZeppelin Contracts for Cairo ^0.12.0␊ + // Compatible with OpenZeppelin Contracts for Cairo ^0.13.0␊ ␊ #[starknet::contract]␊ mod MyToken {␊ @@ -54,7 +54,7 @@ Generated by [AVA](https://avajs.dev). > Snapshot 1 `// SPDX-License-Identifier: MIT␊ - // Compatible with OpenZeppelin Contracts for Cairo ^0.12.0␊ + // Compatible with OpenZeppelin Contracts for Cairo ^0.13.0␊ ␊ #[starknet::contract]␊ mod MyToken {␊ @@ -127,7 +127,7 @@ Generated by [AVA](https://avajs.dev). > Snapshot 1 `// SPDX-License-Identifier: MIT␊ - // Compatible with OpenZeppelin Contracts for Cairo ^0.12.0␊ + // Compatible with OpenZeppelin Contracts for Cairo ^0.13.0␊ ␊ #[starknet::contract]␊ mod MyToken {␊ @@ -200,7 +200,7 @@ Generated by [AVA](https://avajs.dev). > Snapshot 1 `// SPDX-License-Identifier: MIT␊ - // Compatible with OpenZeppelin Contracts for Cairo ^0.12.0␊ + // Compatible with OpenZeppelin Contracts for Cairo ^0.13.0␊ ␊ #[starknet::contract]␊ mod MyToken {␊ @@ -283,7 +283,7 @@ Generated by [AVA](https://avajs.dev). > Snapshot 1 `// SPDX-License-Identifier: MIT␊ - // Compatible with OpenZeppelin Contracts for Cairo ^0.12.0␊ + // Compatible with OpenZeppelin Contracts for Cairo ^0.13.0␊ ␊ #[starknet::contract]␊ mod MyToken {␊ @@ -400,7 +400,7 @@ Generated by [AVA](https://avajs.dev). > Snapshot 1 `// SPDX-License-Identifier: MIT␊ - // Compatible with OpenZeppelin Contracts for Cairo ^0.12.0␊ + // Compatible with OpenZeppelin Contracts for Cairo ^0.13.0␊ ␊ #[starknet::contract]␊ mod MyToken {␊ @@ -498,7 +498,7 @@ Generated by [AVA](https://avajs.dev). > Snapshot 1 `// SPDX-License-Identifier: MIT␊ - // Compatible with OpenZeppelin Contracts for Cairo ^0.12.0␊ + // Compatible with OpenZeppelin Contracts for Cairo ^0.13.0␊ ␊ const MINTER_ROLE: felt252 = selector!("MINTER_ROLE");␊ const UPGRADER_ROLE: felt252 = selector!("UPGRADER_ROLE");␊ @@ -612,7 +612,7 @@ Generated by [AVA](https://avajs.dev). > Snapshot 1 `// SPDX-License-Identifier: MIT␊ - // Compatible with OpenZeppelin Contracts for Cairo ^0.12.0␊ + // Compatible with OpenZeppelin Contracts for Cairo ^0.13.0␊ ␊ #[starknet::contract]␊ mod MyToken {␊ @@ -739,7 +739,7 @@ Generated by [AVA](https://avajs.dev). > Snapshot 1 `// SPDX-License-Identifier: MIT␊ - // Compatible with OpenZeppelin Contracts for Cairo ^0.12.0␊ + // Compatible with OpenZeppelin Contracts for Cairo ^0.13.0␊ ␊ #[starknet::contract]␊ mod MyToken {␊ diff --git a/packages/core-cairo/src/erc721.test.ts.snap b/packages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QX(I>5E-|4^`P&e-*-sYCAqDv8s48+&!ciI4 ziglL%D~g)5c^)wtHLVvJQ9}*H@LFXkWqD77bZ}#Z4m3mv&!GlZeU!CV(NV36$FGV< z^p7-(wMsrsl}w!2bw~flYuA2Nl=4%(S#`XdRWHnUPLs5a^na|?o8Id=Nqaq~NQ#Yn zSLQSduW|09oRXJkdIO~106AG3AoZ5NiQDpbkVa0_7k|^K&-GjDqekwSZ>kmiua{>K%sea@zWse*LntrD|84ogsqv-e1`twr#bY()7KRfi(75#as jIHrE9ynfcCpB6O@4*jg@fU&y(&zk-RS06OJe{TQ)3!l$3 From ac71f8864eb44db3b6aaf05d201408be72c72379 Mon Sep 17 00:00:00 2001 From: Eric Lau Date: Wed, 22 May 2024 10:50:20 -0400 Subject: [PATCH 11/11] Update changelog --- packages/core-cairo/CHANGELOG.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/core-cairo/CHANGELOG.md b/packages/core-cairo/CHANGELOG.md index 1332cf667..19f093ab2 100644 --- a/packages/core-cairo/CHANGELOG.md +++ b/packages/core-cairo/CHANGELOG.md @@ -1,9 +1,9 @@ # Changelog -## Unreleased +## 0.13.0 (2024-05-22) - **Breaking changes**: - - Use OpenZeppelin Contracts for Cairo v0.13.0. + - Use OpenZeppelin Contracts for Cairo v0.13.0. ([#359](https://github.com/OpenZeppelin/contracts-wizard/pull/359)) - Use Hooks with ERC721 and ERC1155. - Use Hooks for Pausable.