From 3f8fabb0059cf106129186bdacadc5081e9b99cd Mon Sep 17 00:00:00 2001 From: Giorgi Lagidze Date: Mon, 7 Oct 2024 10:40:13 +0400 Subject: [PATCH] renaming --- packages/contracts/src/core/dao/DAO.sol | 2 +- .../src/core/permission/PermissionManager.sol | 69 ++++----- .../core/permission/permission-manager.ts | 139 +++++++++++------- 3 files changed, 119 insertions(+), 91 deletions(-) diff --git a/packages/contracts/src/core/dao/DAO.sol b/packages/contracts/src/core/dao/DAO.sol index dab204f03..fbf5106c5 100644 --- a/packages/contracts/src/core/dao/DAO.sol +++ b/packages/contracts/src/core/dao/DAO.sol @@ -309,7 +309,7 @@ contract DAO is id = ETH_TRANSFER_PERMISSION_ID; } - (bool created, , ) = getPermissionData(action.to, id); + (bool created, , ) = getPermissionStatus(action.to, id); if (created) { isAllowed = isGranted(action.to, msg.sender, id, action.data); diff --git a/packages/contracts/src/core/permission/PermissionManager.sol b/packages/contracts/src/core/permission/PermissionManager.sol index e87336745..2d0f6ad22 100644 --- a/packages/contracts/src/core/permission/PermissionManager.sol +++ b/packages/contracts/src/core/permission/PermissionManager.sol @@ -40,18 +40,21 @@ abstract contract PermissionManager is Initializable { /// @notice Full owner flag to check or assign full ownership rights for a permission uint256 internal constant FULL_OWNER_FLAG = uint256(3); + /// @notice To freeze the permission, `FREEZE_OWNER` must be added as an owner first. + address internal constant FREEZE_OWNER = address(1); + /// @notice A struct containing the information for a permission. /// @param delegations Owners can delegate the permission so delegatees can only grant it one time only. /// @param owners The current owners of the permission with their own specific flags capabilities. /// @param created Whether the permission has been created or not - used in consumer contracts(such as DAO.sol) to make decisions whether permission exists or not. - /// @param grantCounter How many owners(that have grant capabilities) are currently set for a permission. - /// @param revokeCounter How many owners(that have revoke capabilities) are currently set for a permission. + /// @param grantOwnerCounter How many owners(that have grant capabilities) are currently set for a permission. + /// @param revokeOwnerCounter How many owners(that have revoke capabilities) are currently set for a permission. struct Permission { mapping(address => uint256) delegations; mapping(address => uint256) owners; bool created; - uint64 grantCounter; - uint64 revokeCounter; + uint64 grantOwnerCounter; + uint64 revokeOwnerCounter; } /// @notice A mapping storing permissions as hashes (i.e., `permissionHash(where, who, permissionId)`) and their status encoded by an address (unset, allowed, or redirecting to a `PermissionCondition`). @@ -111,16 +114,16 @@ abstract contract PermissionManager is Initializable { error ZeroAddress(); /// @notice Thrown if the passed removal flags are invalid. The caller can only pass flags the user already has. - error InvalidFlagsForRemovalPassed(uint256 currentFlags, uint256 removalFlags); + error InvalidMissingFlags(uint256 currentFlags, uint256 removalFlags); /// @notice Thrown if the passed flag is set to zero. - error FlagCanNotBeZero(); + error InvalidEmptyFlag(); /// @notice Thrown if the permission is frozen. error PermissionFrozen(address where, bytes32 permissionId); /// @notice Thrown if the APPLY_TARGET_PERMISSION_ID is granted to the incorrect address. - error IncorrectApplyTargetMethodGranteeSet(address applyTargetMethodGrantee); + error UnrecognizedApplyPermissionsGrantee(address applyTargetMethodGrantee); /// @notice Emitted when a permission `permission` is granted in the context `here` to the address `_who` for the contract `_where`. /// @param permissionId The permission identifier. @@ -184,13 +187,13 @@ abstract contract PermissionManager is Initializable { uint256 flags ); - /// @notice Emitted when an owner does get removed. + /// @notice Emitted when an owner gets renounced. /// @param where The address of the target contract for which the owner loses permissions. /// @param permissionIdOrSelector The permission identifier. /// @param owner The address of the owner. /// @param updatedOwnerFlags The updated/current flags left on the owner. /// @param updatedDelegateeFlags The updated/current flags left on the owner. - event OwnerRemoved( + event OwnerRenounced( address indexed where, bytes32 indexed permissionIdOrSelector, address indexed owner, @@ -266,7 +269,7 @@ abstract contract PermissionManager is Initializable { uint256 _flags ) public virtual { if (_flags == 0) { - revert FlagCanNotBeZero(); + revert InvalidEmptyFlag(); } bytes32 permHash = permissionHash(_where, _permissionIdOrSelector); @@ -305,7 +308,7 @@ abstract contract PermissionManager is Initializable { uint256 _flags ) public virtual { if (_flags == 0) { - revert FlagCanNotBeZero(); + revert InvalidEmptyFlag(); } bytes32 permHash = permissionHash(_where, _permissionIdOrSelector); @@ -317,7 +320,7 @@ abstract contract PermissionManager is Initializable { uint256 currentFlags = permission.delegations[_delegatee]; if (!_checkFlags(currentFlags, _flags)) { - revert InvalidFlagsForRemovalPassed(currentFlags, _flags); + revert InvalidMissingFlags(currentFlags, _flags); } uint256 newFlags = currentFlags ^ _flags; @@ -338,7 +341,7 @@ abstract contract PermissionManager is Initializable { uint256 _flags ) public virtual { if (_flags == 0) { - revert FlagCanNotBeZero(); + revert InvalidEmptyFlag(); } if (_owner == address(0) || _where == address(0)) { @@ -364,19 +367,19 @@ abstract contract PermissionManager is Initializable { return; } - if (_owner != address(1)) { + if (_owner != FREEZE_OWNER) { if ( _checkFlags(_flags, GRANT_OWNER_FLAG) && !_checkFlags(currentFlags, GRANT_OWNER_FLAG) ) { - permission.grantCounter++; + permission.grantOwnerCounter++; } if ( _checkFlags(_flags, REVOKE_OWNER_FLAG) && !_checkFlags(currentFlags, REVOKE_OWNER_FLAG) ) { - permission.revokeCounter++; + permission.revokeOwnerCounter++; } } @@ -391,7 +394,7 @@ abstract contract PermissionManager is Initializable { /// @param _flags The flags as uint256 to remove specific rights the calling owner does have. (only revoke? only grant? both?) function removeOwner(address _where, bytes32 _permissionIdOrSelector, uint256 _flags) public { if (_flags == 0) { - revert FlagCanNotBeZero(); + revert InvalidEmptyFlag(); } Permission storage permission = permissions[ @@ -402,15 +405,15 @@ abstract contract PermissionManager is Initializable { // Check if the removal flags have more bit set as the owner currently has. if (!_checkFlags(ownerFlags, _flags)) { - revert InvalidFlagsForRemovalPassed(ownerFlags, _flags); + revert InvalidMissingFlags(ownerFlags, _flags); } if (_checkFlags(_flags, GRANT_OWNER_FLAG)) { - permission.grantCounter--; + permission.grantOwnerCounter--; } if (_checkFlags(_flags, REVOKE_OWNER_FLAG)) { - permission.revokeCounter--; + permission.revokeOwnerCounter--; } uint256 newOwnerFlags = ownerFlags ^ _flags; // remove permissions @@ -425,7 +428,7 @@ abstract contract PermissionManager is Initializable { permission.delegations[msg.sender] = newDelegateeFlags; } - emit OwnerRemoved( + emit OwnerRenounced( _where, _permissionIdOrSelector, msg.sender, @@ -455,7 +458,7 @@ abstract contract PermissionManager is Initializable { /// @return Whether the permission has been created or not. /// @return How many grant owners this permission has currently. /// @return How many revoke owners this permission has currently. - function getPermissionData( + function getPermissionStatus( address _where, bytes32 _permissionIdOrSelector ) public view returns (bool, uint64, uint64) { @@ -463,7 +466,7 @@ abstract contract PermissionManager is Initializable { permissionHash(_where, _permissionIdOrSelector) ]; - return (permission.created, permission.grantCounter, permission.revokeCounter); + return (permission.created, permission.grantOwnerCounter, permission.revokeOwnerCounter); } /// @notice Function to retrieve the owner and delegate flags of an `_account` on a permission. @@ -472,7 +475,7 @@ abstract contract PermissionManager is Initializable { /// @param _account The address for which to return the current flags. /// @return uint256 Returns owner flags. 0 if an `account` is not an owner. /// @return uint256 Returns delegatee flags. 0 if an `account` is not a delegatee. - function getFlags( + function getPermissionFlags( address _where, bytes32 _permissionIdOrSelector, address _account @@ -767,7 +770,7 @@ abstract contract PermissionManager is Initializable { // to the address allowed by ROOT. if (_permissionId == APPLY_TARGET_PERMISSION_ID) { if (applyTargetMethodGrantee == address(0) || applyTargetMethodGrantee != _who) { - revert IncorrectApplyTargetMethodGranteeSet(applyTargetMethodGrantee); + revert UnrecognizedApplyPermissionsGrantee(applyTargetMethodGrantee); } } @@ -836,7 +839,7 @@ abstract contract PermissionManager is Initializable { // to the address allowed by ROOT. if (_permissionId == APPLY_TARGET_PERMISSION_ID) { if (applyTargetMethodGrantee == address(0) || applyTargetMethodGrantee != _who) { - revert IncorrectApplyTargetMethodGranteeSet(applyTargetMethodGrantee); + revert UnrecognizedApplyPermissionsGrantee(applyTargetMethodGrantee); } } @@ -929,8 +932,8 @@ abstract contract PermissionManager is Initializable { } } - permission.grantCounter = 1; - permission.revokeCounter = 1; + permission.grantOwnerCounter = 1; + permission.revokeOwnerCounter = 1; emit PermissionCreated(_where, _permissionIdOrSelector, _owner, _whos); } @@ -940,9 +943,9 @@ abstract contract PermissionManager is Initializable { /// @return True if the permission is frozen and otherwise false function _isPermissionFrozen(Permission storage _permission) private view returns (bool) { return - _permission.grantCounter == 0 && - _permission.revokeCounter == 0 && - _permission.owners[address(1)] != 0; + _permission.grantOwnerCounter == 0 && + _permission.revokeOwnerCounter == 0 && + _permission.owners[FREEZE_OWNER] != 0; } /// @notice An internal function to be used to check permissions on the permission manager contract (`address(this)`) itself. @@ -1049,7 +1052,7 @@ abstract contract PermissionManager is Initializable { return true; } - return isRoot && _permission.grantCounter == 0; + return isRoot && _permission.grantOwnerCounter == 0; } } @@ -1064,7 +1067,7 @@ abstract contract PermissionManager is Initializable { return true; } - return isRoot && _permission.revokeCounter == 0; + return isRoot && _permission.revokeOwnerCounter == 0; } } diff --git a/packages/contracts/test/core/permission/permission-manager.ts b/packages/contracts/test/core/permission/permission-manager.ts index a667dac90..f29a2d6ab 100644 --- a/packages/contracts/test/core/permission/permission-manager.ts +++ b/packages/contracts/test/core/permission/permission-manager.ts @@ -40,7 +40,7 @@ interface SingleTargetPermission { const GRANT_OWNER_FLAG = 1; const REVOKE_OWNER_FLAG = 2; const FULL_OWNER_FLAG = 3; -const FREEZE_ADDRESS = '0x0000000000000000000000000000000000000001'; +const FREEZE_OWNER = '0x0000000000000000000000000000000000000001'; const someWhere = '0xb794F5eA0ba39494cE839613fffBA74279579268'; const somePermissionId = ethers.utils.id('SOME_PERMISSION'); @@ -114,7 +114,11 @@ describe('Core: PermissionManager', function () { ); expect( - await pm.getFlags(pm.address, ADMIN_PERMISSION_ID, otherSigner.address) + await pm.getPermissionFlags( + pm.address, + ADMIN_PERMISSION_ID, + otherSigner.address + ) ).to.deep.equal([FULL_OWNER_FLAG, 0]); }); @@ -136,7 +140,11 @@ describe('Core: PermissionManager', function () { ); expect( - await pm.getFlags(pm.address, ADMIN_PERMISSION_ID, otherSigner.address) + await pm.getPermissionFlags( + pm.address, + ADMIN_PERMISSION_ID, + otherSigner.address + ) ).to.deep.equal([GRANT_OWNER_FLAG, 0]); await expect( @@ -156,7 +164,11 @@ describe('Core: PermissionManager', function () { ); expect( - await pm.getFlags(pm.address, ADMIN_PERMISSION_ID, otherSigner.address) + await pm.getPermissionFlags( + pm.address, + ADMIN_PERMISSION_ID, + otherSigner.address + ) ).to.deep.equal([FULL_OWNER_FLAG, 0]); }); @@ -171,7 +183,7 @@ describe('Core: PermissionManager', function () { ); expect( - await pm.getPermissionData(pm.address, ADMIN_PERMISSION_ID) + await pm.getPermissionStatus(pm.address, ADMIN_PERMISSION_ID) ).to.deep.equal([true, 2, 1]); // If the same flag that `newOwner` already holds is added, @@ -181,7 +193,7 @@ describe('Core: PermissionManager', function () { ).to.not.emit(pm, 'OwnerAdded'); expect( - await pm.getPermissionData(pm.address, ADMIN_PERMISSION_ID) + await pm.getPermissionStatus(pm.address, ADMIN_PERMISSION_ID) ).to.deep.equal([true, 2, 1]); // Add the same owner but with revoke which should increase revoke counter only. @@ -195,14 +207,14 @@ describe('Core: PermissionManager', function () { ).to.emit(pm, 'OwnerAdded'); expect( - await pm.getPermissionData(pm.address, ADMIN_PERMISSION_ID) + await pm.getPermissionStatus(pm.address, ADMIN_PERMISSION_ID) ).to.deep.equal([true, 2, 2]); }); it('should revert if a zero flag is passed', async () => { await expect( pm.addOwner(pm.address, ADMIN_PERMISSION_ID, otherSigner.address, 0) - ).to.be.revertedWithCustomError(pm, 'FlagCanNotBeZero'); + ).to.be.revertedWithCustomError(pm, 'InvalidEmptyFlag'); }); it('should revert if an _owner passed is address(0)', async () => { @@ -228,7 +240,7 @@ describe('Core: PermissionManager', function () { }); it('should revert if the permission is frozen', async () => { - const freezeAddr = FREEZE_ADDRESS; + const freezeAddr = FREEZE_OWNER; await pm.addOwner( pm.address, @@ -340,11 +352,15 @@ describe('Core: PermissionManager', function () { await expect( pm.removeOwner(someWhere, ADMIN_PERMISSION_ID, FULL_OWNER_FLAG) ) - .to.emit(pm, 'OwnerRemoved') + .to.emit(pm, 'OwnerRenounced') .withArgs(someWhere, ADMIN_PERMISSION_ID, ownerSigner.address, 0, 0); expect( - await pm.getFlags(someWhere, ADMIN_PERMISSION_ID, ownerSigner.address) + await pm.getPermissionFlags( + someWhere, + ADMIN_PERMISSION_ID, + ownerSigner.address + ) ).to.deep.equal([0, 0]); }); @@ -352,7 +368,7 @@ describe('Core: PermissionManager', function () { await expect( pm.removeOwner(someWhere, ADMIN_PERMISSION_ID, GRANT_OWNER_FLAG) ) - .to.emit(pm, 'OwnerRemoved') + .to.emit(pm, 'OwnerRenounced') .withArgs( someWhere, ADMIN_PERMISSION_ID, @@ -362,24 +378,32 @@ describe('Core: PermissionManager', function () { ); expect( - await pm.getFlags(someWhere, ADMIN_PERMISSION_ID, ownerSigner.address) + await pm.getPermissionFlags( + someWhere, + ADMIN_PERMISSION_ID, + ownerSigner.address + ) ).to.deep.equal([REVOKE_OWNER_FLAG, 0]); await expect( pm.removeOwner(someWhere, ADMIN_PERMISSION_ID, REVOKE_OWNER_FLAG) ) - .to.emit(pm, 'OwnerRemoved') + .to.emit(pm, 'OwnerRenounced') .withArgs(someWhere, ADMIN_PERMISSION_ID, ownerSigner.address, 0, 0); expect( - await pm.getFlags(someWhere, ADMIN_PERMISSION_ID, ownerSigner.address) + await pm.getPermissionFlags( + someWhere, + ADMIN_PERMISSION_ID, + ownerSigner.address + ) ).to.deep.equal([0, 0]); }); it('should revert if a zero flag is passed', async () => { await expect( pm.removeOwner(someWhere, ADMIN_PERMISSION_ID, 0) - ).to.be.revertedWithCustomError(pm, 'FlagCanNotBeZero'); + ).to.be.revertedWithCustomError(pm, 'InvalidEmptyFlag'); }); it("should revert if flags that don't exist are removed", async () => { @@ -388,13 +412,13 @@ describe('Core: PermissionManager', function () { await expect( pm.removeOwner(someWhere, ADMIN_PERMISSION_ID, GRANT_OWNER_FLAG) ) - .to.be.revertedWithCustomError(pm, 'InvalidFlagsForRemovalPassed') + .to.be.revertedWithCustomError(pm, 'InvalidMissingFlags') .withArgs(REVOKE_OWNER_FLAG, GRANT_OWNER_FLAG); }); it('should correctly decrease owner counters', async () => { expect( - await pm.getPermissionData(someWhere, ADMIN_PERMISSION_ID) + await pm.getPermissionStatus(someWhere, ADMIN_PERMISSION_ID) ).to.deep.equal([true, 1, 1]); const newOwner = otherSigner.address; @@ -407,7 +431,7 @@ describe('Core: PermissionManager', function () { ); expect( - await pm.getPermissionData(someWhere, ADMIN_PERMISSION_ID) + await pm.getPermissionStatus(someWhere, ADMIN_PERMISSION_ID) ).to.deep.equal([true, 2, 2]); await pm @@ -415,7 +439,7 @@ describe('Core: PermissionManager', function () { .removeOwner(someWhere, ADMIN_PERMISSION_ID, GRANT_OWNER_FLAG); expect( - await pm.getPermissionData(someWhere, ADMIN_PERMISSION_ID) + await pm.getPermissionStatus(someWhere, ADMIN_PERMISSION_ID) ).to.deep.equal([true, 1, 2]); await pm @@ -423,7 +447,7 @@ describe('Core: PermissionManager', function () { .removeOwner(someWhere, ADMIN_PERMISSION_ID, REVOKE_OWNER_FLAG); expect( - await pm.getPermissionData(someWhere, ADMIN_PERMISSION_ID) + await pm.getPermissionStatus(someWhere, ADMIN_PERMISSION_ID) ).to.deep.equal([true, 1, 1]); }); @@ -449,7 +473,7 @@ describe('Core: PermissionManager', function () { .connect(owner) .removeOwner(someWhere, ADMIN_PERMISSION_ID, REVOKE_OWNER_FLAG) ) - .to.emit(pm, 'OwnerRemoved') + .to.emit(pm, 'OwnerRenounced') .withArgs( someWhere, ADMIN_PERMISSION_ID, @@ -545,11 +569,15 @@ describe('Core: PermissionManager', function () { ]); expect( - await pm.getFlags(pm.address, ADMIN_PERMISSION_ID, otherSigner.address) + await pm.getPermissionFlags( + pm.address, + ADMIN_PERMISSION_ID, + otherSigner.address + ) ).to.deep.equal([FULL_OWNER_FLAG, 0]); expect( - await pm.getPermissionData(pm.address, ADMIN_PERMISSION_ID) + await pm.getPermissionStatus(pm.address, ADMIN_PERMISSION_ID) ).to.deep.equal([true, 1, 1]); }); }); @@ -572,14 +600,14 @@ describe('Core: PermissionManager', function () { otherSigner.address, 0 ) - ).to.be.revertedWithCustomError(pm, 'FlagCanNotBeZero'); + ).to.be.revertedWithCustomError(pm, 'InvalidEmptyFlag'); }); it('should revert if the permission is actually frozen', async () => { await pm.addOwner( pm.address, ADMIN_PERMISSION_ID, - FREEZE_ADDRESS, + FREEZE_OWNER, FULL_OWNER_FLAG ); await pm.removeOwner(pm.address, ADMIN_PERMISSION_ID, FULL_OWNER_FLAG); @@ -629,7 +657,11 @@ describe('Core: PermissionManager', function () { ); expect( - await pm.getFlags(pm.address, ADMIN_PERMISSION_ID, otherSigner.address) + await pm.getPermissionFlags( + pm.address, + ADMIN_PERMISSION_ID, + otherSigner.address + ) ).to.deep.equal([0, GRANT_OWNER_FLAG]); await expect( @@ -649,7 +681,11 @@ describe('Core: PermissionManager', function () { ); expect( - await pm.getFlags(pm.address, ADMIN_PERMISSION_ID, otherSigner.address) + await pm.getPermissionFlags( + pm.address, + ADMIN_PERMISSION_ID, + otherSigner.address + ) ).to.deep.equal([0, FULL_OWNER_FLAG]); }); @@ -699,7 +735,7 @@ describe('Core: PermissionManager', function () { otherSigner.address, 0 ) - ).to.be.revertedWithCustomError(pm, 'FlagCanNotBeZero'); + ).to.be.revertedWithCustomError(pm, 'InvalidEmptyFlag'); }); it('should revert if the caller is not the owner of the permission he/she wants to undelegate', async () => { @@ -734,7 +770,7 @@ describe('Core: PermissionManager', function () { FULL_OWNER_FLAG ) ) - .to.be.revertedWithCustomError(pm, 'InvalidFlagsForRemovalPassed') + .to.be.revertedWithCustomError(pm, 'InvalidMissingFlags') .withArgs(GRANT_OWNER_FLAG, FULL_OWNER_FLAG); }); @@ -756,7 +792,11 @@ describe('Core: PermissionManager', function () { ); expect( - await pm.getFlags(pm.address, ADMIN_PERMISSION_ID, otherSigner.address) + await pm.getPermissionFlags( + pm.address, + ADMIN_PERMISSION_ID, + otherSigner.address + ) ).to.deep.equal([0, GRANT_OWNER_FLAG]); }); }); @@ -814,7 +854,7 @@ describe('Core: PermissionManager', function () { ) .to.be.revertedWithCustomError( pm, - 'IncorrectApplyTargetMethodGranteeSet' + 'UnrecognizedApplyPermissionsGrantee' ) .withArgs(allowedApplyTargetMethodGrantee); @@ -877,12 +917,7 @@ describe('Core: PermissionManager', function () { await pm .connect(ownerSigner) - .addOwner( - someWhere, - somePermissionId, - FREEZE_ADDRESS, - GRANT_OWNER_FLAG - ); + .addOwner(someWhere, somePermissionId, FREEZE_OWNER, GRANT_OWNER_FLAG); await pm .connect(ownerSigner) @@ -1010,7 +1045,7 @@ describe('Core: PermissionManager', function () { await pm.connect(owner).grant(someWhere, someWhere, somePermissionId); expect( - await pm.getFlags(someWhere, somePermissionId, owner.address) + await pm.getPermissionFlags(someWhere, somePermissionId, owner.address) ).to.deep.equal([FULL_OWNER_FLAG, GRANT_OWNER_FLAG]); }); @@ -1032,7 +1067,7 @@ describe('Core: PermissionManager', function () { await pm.connect(alice).grant(someWhere, someWhere, somePermissionId); - let currentFlags = await pm.getFlags( + let currentFlags = await pm.getPermissionFlags( someWhere, somePermissionId, alice.address @@ -1128,7 +1163,7 @@ describe('Core: PermissionManager', function () { ) .to.be.revertedWithCustomError( pm, - 'IncorrectApplyTargetMethodGranteeSet' + 'UnrecognizedApplyPermissionsGrantee' ) .withArgs(allowedApplyTargetMethodGrantee); @@ -1317,12 +1352,7 @@ describe('Core: PermissionManager', function () { await pm .connect(ownerSigner) - .addOwner( - someWhere, - somePermissionId, - FREEZE_ADDRESS, - GRANT_OWNER_FLAG - ); + .addOwner(someWhere, somePermissionId, FREEZE_OWNER, GRANT_OWNER_FLAG); await pm .connect(ownerSigner) @@ -1548,12 +1578,7 @@ describe('Core: PermissionManager', function () { await pm .connect(ownerSigner) - .addOwner( - someWhere, - somePermissionId, - FREEZE_ADDRESS, - GRANT_OWNER_FLAG - ); + .addOwner(someWhere, somePermissionId, FREEZE_OWNER, GRANT_OWNER_FLAG); await pm .connect(ownerSigner) @@ -1662,7 +1687,7 @@ describe('Core: PermissionManager', function () { await pm.connect(owner).revoke(someWhere, someWhere, somePermissionId); expect( - await pm.getFlags(someWhere, somePermissionId, owner.address) + await pm.getPermissionFlags(someWhere, somePermissionId, owner.address) ).to.deep.equal([FULL_OWNER_FLAG, REVOKE_OWNER_FLAG]); }); @@ -1684,7 +1709,7 @@ describe('Core: PermissionManager', function () { await pm.connect(alice).revoke(someWhere, someWhere, somePermissionId); - let currentFlags = await pm.getFlags( + let currentFlags = await pm.getPermissionFlags( someWhere, somePermissionId, alice.address @@ -2084,7 +2109,7 @@ describe('Core: PermissionManager', function () { // Let's freeze one of the permission. await pm.createPermission(where, permissionId2, ownerSigner.address, []); - await pm.addOwner(where, permissionId2, FREEZE_ADDRESS, FULL_OWNER_FLAG); + await pm.addOwner(where, permissionId2, FREEZE_OWNER, FULL_OWNER_FLAG); await pm.removeOwner(where, permissionId2, FULL_OWNER_FLAG); // make sure that permission is really frozen. @@ -2354,7 +2379,7 @@ describe('Core: PermissionManager', function () { // Let's freeze one of the permission. await pm.createPermission(where, permissionId2, ownerSigner.address, []); - await pm.addOwner(where, permissionId2, FREEZE_ADDRESS, FULL_OWNER_FLAG); + await pm.addOwner(where, permissionId2, FREEZE_OWNER, FULL_OWNER_FLAG); await pm.removeOwner(where, permissionId2, FULL_OWNER_FLAG); // make sure that permission is really frozen.