diff --git a/packages/core-cairo/src/erc20.ts b/packages/core-cairo/src/erc20.ts index 3601715cc..f8c9da489 100644 --- a/packages/core-cairo/src/erc20.ts +++ b/packages/core-cairo/src/erc20.ts @@ -118,9 +118,7 @@ export function buildERC20(opts: ERC20Options): Contract { } setAccessControl(c, allOpts.access); - - setUpgradeable(c, allOpts.upgradeable); - + setUpgradeable(c, allOpts.upgradeable, allOpts.access); setInfo(c, allOpts.info); return c; diff --git a/packages/core-cairo/src/set-upgradeable.ts b/packages/core-cairo/src/set-upgradeable.ts index 7770938d8..e11b3d9c3 100644 --- a/packages/core-cairo/src/set-upgradeable.ts +++ b/packages/core-cairo/src/set-upgradeable.ts @@ -1,6 +1,6 @@ import { getSelfArg } from './common-options'; import type { ContractBuilder } from './contract'; -import { requireAccessControl } from './set-access-control'; +import { Access, requireAccessControl } from './set-access-control'; //import { Access, setAccessControl } from './set-access-control'; // import { defineFunctions } from './utils/define-functions'; import { defineComponents } from './utils/define-components'; @@ -10,7 +10,7 @@ export const upgradeableOptions = [false, true] as const; export type Upgradeable = typeof upgradeableOptions[number]; -export function setUpgradeable(c: ContractBuilder, upgradeable: Upgradeable) { +export function setUpgradeable(c: ContractBuilder, upgradeable: Upgradeable, access: Access) { if (upgradeable === false) { return; } @@ -21,7 +21,7 @@ export function setUpgradeable(c: ContractBuilder, upgradeable: Upgradeable) { c.addStandaloneImport('starknet::ClassHash'); c.addFunction(functions.upgrade); - requireAccessControl(c, functions.upgrade, 'roles', 'UPGRADER'); + requireAccessControl(c, functions.upgrade, access, 'UPGRADER'); // c.setFunctionBody([ // 'Proxy.assert_only_admin()',