Skip to content

Commit

Permalink
Fix default access control for upgradeable
Browse files Browse the repository at this point in the history
  • Loading branch information
ericglau committed Nov 28, 2023
1 parent 45ac69d commit fa383e9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
4 changes: 1 addition & 3 deletions packages/core-cairo/src/erc20.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
6 changes: 3 additions & 3 deletions packages/core-cairo/src/set-upgradeable.ts
Original file line number Diff line number Diff line change
@@ -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';
Expand All @@ -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;
}
Expand All @@ -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()',
Expand Down

0 comments on commit fa383e9

Please sign in to comment.