From 8a4fc742ea380d1f8a8ebc825ebabfb448a3ab3d Mon Sep 17 00:00:00 2001 From: rndquu Date: Fri, 6 Oct 2023 18:00:40 +0300 Subject: [PATCH] refactor(DiamondTestSetup): rename IAccessControl to accessControlFacet --- .../test/diamond/DiamondTestSetup.sol | 36 ++++++++++++----- .../diamond/ERC20UbiquityDollarTest.t.sol | 18 ++++++--- .../diamond/facets/AccessControlFacet.t.sol | 32 +++++++++++---- .../diamond/facets/BondingCurveFacet.t.sol | 2 +- .../test/diamond/facets/ChefFacet.t.sol | 12 +++--- .../diamond/facets/CollectableDustFacet.t.sol | 2 +- .../facets/CreditNftManagerFacet.t.sol | 40 ++++++++++++------- .../CreditNftRedemptionCalculatorFacet.t.sol | 7 +++- .../CreditRedemptionCalculatorFacet.t.sol | 2 +- .../facets/CurveDollarIncentiveFacet.t.sol | 2 +- .../test/diamond/facets/ManagerFacet.t.sol | 10 ++--- .../test/diamond/facets/StakingFacet.t.sol | 12 +++--- .../diamond/facets/UbiquityPoolFacet.t.sol | 10 ++--- .../test/dollar/core/StakingShare.t.sol | 27 +++++++------ .../dollar/core/UbiquityDollarToken.t.sol | 2 +- .../dollar/core/UbiquityGovernanceToken.t.sol | 2 +- 16 files changed, 138 insertions(+), 78 deletions(-) diff --git a/packages/contracts/test/diamond/DiamondTestSetup.sol b/packages/contracts/test/diamond/DiamondTestSetup.sol index 9a2d608ed..5761c5c59 100644 --- a/packages/contracts/test/diamond/DiamondTestSetup.sol +++ b/packages/contracts/test/diamond/DiamondTestSetup.sol @@ -38,7 +38,7 @@ abstract contract DiamondTestSetup is DiamondTestHelper { DiamondInit diamondInit; // diamond facets (which point to the core diamond and should be used across the tests) - AccessControlFacet IAccessControl; + AccessControlFacet accessControlFacet; BondingCurveFacet bondingCurveFacet; ChefFacet chefFacet; CollectableDustFacet collectableDustFacet; @@ -761,7 +761,7 @@ abstract contract DiamondTestSetup is DiamondTestHelper { diamond = new Diamond(_args, cuts); // initialize diamond facets which point to the core diamond contract - IAccessControl = AccessControlFacet(address(diamond)); + accessControlFacet = AccessControlFacet(address(diamond)); bondingCurveFacet = BondingCurveFacet(address(diamond)); chefFacet = ChefFacet(address(diamond)); collectableDustFacet = CollectableDustFacet(address(diamond)); @@ -790,20 +790,38 @@ abstract contract DiamondTestSetup is DiamondTestHelper { facetAddressList = diamondLoupeFacet.facetAddresses(); vm.startPrank(admin); // grant diamond dollar minting and burning rights - IAccessControl.grantRole(CURVE_DOLLAR_MANAGER_ROLE, address(diamond)); + accessControlFacet.grantRole( + CURVE_DOLLAR_MANAGER_ROLE, + address(diamond) + ); // grant diamond dollar minting and burning rights - IAccessControl.grantRole(DOLLAR_TOKEN_MINTER_ROLE, address(diamond)); - IAccessControl.grantRole(DOLLAR_TOKEN_BURNER_ROLE, address(diamond)); + accessControlFacet.grantRole( + DOLLAR_TOKEN_MINTER_ROLE, + address(diamond) + ); + accessControlFacet.grantRole( + DOLLAR_TOKEN_BURNER_ROLE, + address(diamond) + ); // grand diamond Credit token minting and burning rights - IAccessControl.grantRole(CREDIT_TOKEN_MINTER_ROLE, address(diamond)); - IAccessControl.grantRole(CREDIT_TOKEN_BURNER_ROLE, address(diamond)); + accessControlFacet.grantRole( + CREDIT_TOKEN_MINTER_ROLE, + address(diamond) + ); + accessControlFacet.grantRole( + CREDIT_TOKEN_BURNER_ROLE, + address(diamond) + ); // grant diamond token admin rights - IAccessControl.grantRole( + accessControlFacet.grantRole( GOVERNANCE_TOKEN_MANAGER_ROLE, address(diamond) ); // grant diamond token minter rights - IAccessControl.grantRole(STAKING_SHARE_MINTER_ROLE, address(diamond)); + accessControlFacet.grantRole( + STAKING_SHARE_MINTER_ROLE, + address(diamond) + ); // init UUPS core contracts __setupUUPS(address(diamond)); vm.stopPrank(); diff --git a/packages/contracts/test/diamond/ERC20UbiquityDollarTest.t.sol b/packages/contracts/test/diamond/ERC20UbiquityDollarTest.t.sol index bcd94c92f..6b2bce334 100644 --- a/packages/contracts/test/diamond/ERC20UbiquityDollarTest.t.sol +++ b/packages/contracts/test/diamond/ERC20UbiquityDollarTest.t.sol @@ -169,7 +169,10 @@ contract ERC20UbiquityDollarTest is DiamondTestSetup { // create burner role address burner = makeAddr("burner"); vm.prank(admin); - IAccessControl.grantRole(keccak256("DOLLAR_TOKEN_BURNER_ROLE"), burner); + accessControlFacet.grantRole( + keccak256("DOLLAR_TOKEN_BURNER_ROLE"), + burner + ); // admin pauses contract vm.prank(admin); dollarToken.pause(); @@ -188,7 +191,10 @@ contract ERC20UbiquityDollarTest is DiamondTestSetup { // create burner role address burner = makeAddr("burner"); vm.prank(admin); - IAccessControl.grantRole(keccak256("DOLLAR_TOKEN_BURNER_ROLE"), burner); + accessControlFacet.grantRole( + keccak256("DOLLAR_TOKEN_BURNER_ROLE"), + burner + ); // burn 50 tokens for user vm.prank(burner); vm.expectEmit(true, true, true, true); @@ -245,10 +251,10 @@ contract ERC20UbiquityDollarTest is DiamondTestSetup { function testUnpause_ShouldUnpauseContract() public { vm.startPrank(admin); - IAccessControl.pause(); - assertTrue(IAccessControl.paused()); - IAccessControl.unpause(); - assertFalse(IAccessControl.paused()); + accessControlFacet.pause(); + assertTrue(accessControlFacet.paused()); + accessControlFacet.unpause(); + assertFalse(accessControlFacet.paused()); vm.stopPrank(); } diff --git a/packages/contracts/test/diamond/facets/AccessControlFacet.t.sol b/packages/contracts/test/diamond/facets/AccessControlFacet.t.sol index 1726ddb06..ca5b03e3b 100644 --- a/packages/contracts/test/diamond/facets/AccessControlFacet.t.sol +++ b/packages/contracts/test/diamond/facets/AccessControlFacet.t.sol @@ -33,7 +33,10 @@ contract AccessControlFacetTest is DiamondTestSetup { vm.prank(admin); vm.expectEmit(true, true, true, true); emit RoleGranted(GOVERNANCE_TOKEN_BURNER_ROLE, mock_recipient, admin); - IAccessControl.grantRole(GOVERNANCE_TOKEN_BURNER_ROLE, mock_recipient); + accessControlFacet.grantRole( + GOVERNANCE_TOKEN_BURNER_ROLE, + mock_recipient + ); } // test grantRole function should revert if sender is not admin @@ -48,19 +51,28 @@ contract AccessControlFacetTest is DiamondTestSetup { uint256(DEFAULT_ADMIN_ROLE).toHexString(32) ) ); - IAccessControl.grantRole(GOVERNANCE_TOKEN_BURNER_ROLE, mock_recipient); + accessControlFacet.grantRole( + GOVERNANCE_TOKEN_BURNER_ROLE, + mock_recipient + ); } // test revokeRole function should work only for admin function testRevokeRole_ShouldWork() public { vm.prank(admin); emit RoleGranted(GOVERNANCE_TOKEN_BURNER_ROLE, mock_recipient, admin); - IAccessControl.grantRole(GOVERNANCE_TOKEN_BURNER_ROLE, mock_recipient); + accessControlFacet.grantRole( + GOVERNANCE_TOKEN_BURNER_ROLE, + mock_recipient + ); vm.prank(admin); vm.expectEmit(true, true, true, true); emit RoleRevoked(GOVERNANCE_TOKEN_BURNER_ROLE, mock_recipient, admin); - IAccessControl.revokeRole(GOVERNANCE_TOKEN_BURNER_ROLE, mock_recipient); + accessControlFacet.revokeRole( + GOVERNANCE_TOKEN_BURNER_ROLE, + mock_recipient + ); } // test revokeRole function should revert if sender is not admin @@ -75,7 +87,10 @@ contract AccessControlFacetTest is DiamondTestSetup { uint256(DEFAULT_ADMIN_ROLE).toHexString(32) ) ); - IAccessControl.revokeRole(GOVERNANCE_TOKEN_BURNER_ROLE, mock_recipient); + accessControlFacet.revokeRole( + GOVERNANCE_TOKEN_BURNER_ROLE, + mock_recipient + ); } // test renounceRole function should work for grantee @@ -83,7 +98,10 @@ contract AccessControlFacetTest is DiamondTestSetup { vm.prank(admin); vm.expectEmit(true, true, true, true); emit RoleGranted(GOVERNANCE_TOKEN_BURNER_ROLE, mock_recipient, admin); - IAccessControl.grantRole(GOVERNANCE_TOKEN_BURNER_ROLE, mock_recipient); + accessControlFacet.grantRole( + GOVERNANCE_TOKEN_BURNER_ROLE, + mock_recipient + ); vm.prank(mock_recipient); vm.expectEmit(true, true, true, true); @@ -92,6 +110,6 @@ contract AccessControlFacetTest is DiamondTestSetup { mock_recipient, mock_recipient ); - IAccessControl.renounceRole(GOVERNANCE_TOKEN_BURNER_ROLE); + accessControlFacet.renounceRole(GOVERNANCE_TOKEN_BURNER_ROLE); } } diff --git a/packages/contracts/test/diamond/facets/BondingCurveFacet.t.sol b/packages/contracts/test/diamond/facets/BondingCurveFacet.t.sol index 278b07676..3fcb9a14c 100644 --- a/packages/contracts/test/diamond/facets/BondingCurveFacet.t.sol +++ b/packages/contracts/test/diamond/facets/BondingCurveFacet.t.sol @@ -32,7 +32,7 @@ contract BondingCurveFacetTest is DiamondTestSetup { vm.startPrank(admin); - IAccessControl.grantRole( + accessControlFacet.grantRole( GOVERNANCE_TOKEN_MINTER_ROLE, address(diamond) ); diff --git a/packages/contracts/test/diamond/facets/ChefFacet.t.sol b/packages/contracts/test/diamond/facets/ChefFacet.t.sol index adbfd7ff5..e51488260 100644 --- a/packages/contracts/test/diamond/facets/ChefFacet.t.sol +++ b/packages/contracts/test/diamond/facets/ChefFacet.t.sol @@ -93,7 +93,7 @@ contract ZeroStateChef is DiamondTestSetup { vm.startPrank(admin); managerFacet.setStakingShareAddress(address(stakingShare)); stakingShare.setApprovalForAll(address(diamond), true); - IAccessControl.grantRole( + accessControlFacet.grantRole( GOVERNANCE_TOKEN_MINTER_ROLE, address(stakingShare) ); @@ -119,14 +119,14 @@ contract ZeroStateChef is DiamondTestSetup { vm.startPrank(admin); - IAccessControl.grantRole(GOVERNANCE_TOKEN_MANAGER_ROLE, admin); - IAccessControl.grantRole(CREDIT_NFT_MANAGER_ROLE, address(diamond)); - IAccessControl.grantRole( + accessControlFacet.grantRole(GOVERNANCE_TOKEN_MANAGER_ROLE, admin); + accessControlFacet.grantRole(CREDIT_NFT_MANAGER_ROLE, address(diamond)); + accessControlFacet.grantRole( GOVERNANCE_TOKEN_MINTER_ROLE, address(diamond) ); - IAccessControl.grantRole( + accessControlFacet.grantRole( GOVERNANCE_TOKEN_BURNER_ROLE, address(diamond) ); @@ -170,7 +170,7 @@ contract ZeroStateChef is DiamondTestSetup { metapool.add_liquidity(amounts_, (dyuAD2LP * 99) / 100, fourthAccount); vm.startPrank(admin); - IAccessControl.grantRole( + accessControlFacet.grantRole( GOVERNANCE_TOKEN_MINTER_ROLE, address(diamond) ); diff --git a/packages/contracts/test/diamond/facets/CollectableDustFacet.t.sol b/packages/contracts/test/diamond/facets/CollectableDustFacet.t.sol index acbf5d7af..5d9fd254e 100644 --- a/packages/contracts/test/diamond/facets/CollectableDustFacet.t.sol +++ b/packages/contracts/test/diamond/facets/CollectableDustFacet.t.sol @@ -22,7 +22,7 @@ contract CollectableDustFacetTest is DiamondTestSetup { vm.startPrank(admin); - IAccessControl.grantRole(STAKING_MANAGER_ROLE, stakingManager); + accessControlFacet.grantRole(STAKING_MANAGER_ROLE, stakingManager); // deploy mock token mockToken = new MockERC20("Mock", "MCK", 18); diff --git a/packages/contracts/test/diamond/facets/CreditNftManagerFacet.t.sol b/packages/contracts/test/diamond/facets/CreditNftManagerFacet.t.sol index 8e37c4893..127865064 100644 --- a/packages/contracts/test/diamond/facets/CreditNftManagerFacet.t.sol +++ b/packages/contracts/test/diamond/facets/CreditNftManagerFacet.t.sol @@ -50,13 +50,13 @@ contract CreditNftManagerFacetTest is DiamondTestSetup { // set this contract as minter vm.startPrank(admin); - IAccessControl.grantRole(DOLLAR_TOKEN_MINTER_ROLE, address(this)); - IAccessControl.grantRole(CREDIT_TOKEN_MINTER_ROLE, address(this)); - IAccessControl.grantRole( + accessControlFacet.grantRole(DOLLAR_TOKEN_MINTER_ROLE, address(this)); + accessControlFacet.grantRole(CREDIT_TOKEN_MINTER_ROLE, address(this)); + accessControlFacet.grantRole( GOVERNANCE_TOKEN_MINTER_ROLE, address(diamond) ); - IAccessControl.grantRole(CREDIT_NFT_MANAGER_ROLE, address(diamond)); + accessControlFacet.grantRole(CREDIT_NFT_MANAGER_ROLE, address(diamond)); vm.stopPrank(); } @@ -167,7 +167,7 @@ contract CreditNftManagerFacetTest is DiamondTestSetup { uint256 expiryBlockNumber = 500; vm.startPrank(admin); creditNft.mintCreditNft(mockMessageSender, 2e18, expiryBlockNumber); - IAccessControl.grantRole( + accessControlFacet.grantRole( keccak256("GOVERNANCE_TOKEN_MINTER_ROLE"), creditNftManagerAddress ); @@ -203,7 +203,7 @@ contract CreditNftManagerFacetTest is DiamondTestSetup { vm.startPrank(admin); creditNft.mintCreditNft(mockMessageSender, 2e18, expiryBlockNumber); - IAccessControl.grantRole( + accessControlFacet.grantRole( keccak256("GOVERNANCE_TOKEN_MINTER_ROLE"), creditNftManagerAddress ); @@ -258,8 +258,11 @@ contract CreditNftManagerFacetTest is DiamondTestSetup { function test_redeemCreditNftRevertsIfNotEnoughBalance() public { vm.startPrank(admin); - IAccessControl.grantRole(CREDIT_NFT_MANAGER_ROLE, address(this)); - IAccessControl.grantRole(GOVERNANCE_TOKEN_MINTER_ROLE, address(this)); + accessControlFacet.grantRole(CREDIT_NFT_MANAGER_ROLE, address(this)); + accessControlFacet.grantRole( + GOVERNANCE_TOKEN_MINTER_ROLE, + address(this) + ); vm.stopPrank(); mockTwapFuncs(2e18); @@ -274,8 +277,11 @@ contract CreditNftManagerFacetTest is DiamondTestSetup { function test_redeemCreditNftRevertsIfNotEnoughDollars() public { vm.startPrank(admin); - IAccessControl.grantRole(CREDIT_NFT_MANAGER_ROLE, address(this)); - IAccessControl.grantRole(GOVERNANCE_TOKEN_MINTER_ROLE, address(this)); + accessControlFacet.grantRole(CREDIT_NFT_MANAGER_ROLE, address(this)); + accessControlFacet.grantRole( + GOVERNANCE_TOKEN_MINTER_ROLE, + address(this) + ); vm.stopPrank(); mockTwapFuncs(2e18); @@ -304,8 +310,11 @@ contract CreditNftManagerFacetTest is DiamondTestSetup { function test_redeemCreditNftRevertsIfZeroAmountOfDollars() public { vm.startPrank(admin); - IAccessControl.grantRole(CREDIT_NFT_MANAGER_ROLE, address(this)); - IAccessControl.grantRole(GOVERNANCE_TOKEN_MINTER_ROLE, address(this)); + accessControlFacet.grantRole(CREDIT_NFT_MANAGER_ROLE, address(this)); + accessControlFacet.grantRole( + GOVERNANCE_TOKEN_MINTER_ROLE, + address(this) + ); vm.stopPrank(); mockTwapFuncs(2e18); @@ -333,8 +342,11 @@ contract CreditNftManagerFacetTest is DiamondTestSetup { function test_redeemCreditNftWorks() public { vm.startPrank(admin); - IAccessControl.grantRole(CREDIT_NFT_MANAGER_ROLE, address(this)); - IAccessControl.grantRole(GOVERNANCE_TOKEN_MINTER_ROLE, address(this)); + accessControlFacet.grantRole(CREDIT_NFT_MANAGER_ROLE, address(this)); + accessControlFacet.grantRole( + GOVERNANCE_TOKEN_MINTER_ROLE, + address(this) + ); vm.stopPrank(); mockTwapFuncs(2e18); diff --git a/packages/contracts/test/diamond/facets/CreditNftRedemptionCalculatorFacet.t.sol b/packages/contracts/test/diamond/facets/CreditNftRedemptionCalculatorFacet.t.sol index 19af700c4..11c060aef 100644 --- a/packages/contracts/test/diamond/facets/CreditNftRedemptionCalculatorFacet.t.sol +++ b/packages/contracts/test/diamond/facets/CreditNftRedemptionCalculatorFacet.t.sol @@ -13,8 +13,11 @@ contract CreditNftRedemptionCalculatorFacetTest is DiamondTestSetup { vm.startPrank(admin); managerFacet.setCreditNftAddress(address(creditNft)); - IAccessControl.grantRole(CREDIT_NFT_MANAGER_ROLE, address(this)); - IAccessControl.grantRole(GOVERNANCE_TOKEN_MINTER_ROLE, address(this)); + accessControlFacet.grantRole(CREDIT_NFT_MANAGER_ROLE, address(this)); + accessControlFacet.grantRole( + GOVERNANCE_TOKEN_MINTER_ROLE, + address(this) + ); vm.stopPrank(); } diff --git a/packages/contracts/test/diamond/facets/CreditRedemptionCalculatorFacet.t.sol b/packages/contracts/test/diamond/facets/CreditRedemptionCalculatorFacet.t.sol index 6403a6607..ed0a1424b 100644 --- a/packages/contracts/test/diamond/facets/CreditRedemptionCalculatorFacet.t.sol +++ b/packages/contracts/test/diamond/facets/CreditRedemptionCalculatorFacet.t.sol @@ -13,7 +13,7 @@ contract CreditRedemptionCalculatorFacetTest is DiamondTestSetup { assertEq(admSupply, 10000e18); vm.startPrank(admin); - IAccessControl.grantRole(CREDIT_NFT_MANAGER_ROLE, address(this)); + accessControlFacet.grantRole(CREDIT_NFT_MANAGER_ROLE, address(this)); creditNft.mintCreditNft(user1, 100, 10); managerFacet.setCreditNftAddress(address(creditNft)); vm.stopPrank(); diff --git a/packages/contracts/test/diamond/facets/CurveDollarIncentiveFacet.t.sol b/packages/contracts/test/diamond/facets/CurveDollarIncentiveFacet.t.sol index c4c422b2d..c4e89b134 100644 --- a/packages/contracts/test/diamond/facets/CurveDollarIncentiveFacet.t.sol +++ b/packages/contracts/test/diamond/facets/CurveDollarIncentiveFacet.t.sol @@ -29,7 +29,7 @@ contract CurveDollarIncentiveTest is DiamondTestSetup { twapOracleAddress = address(diamond); vm.startPrank(admin); - IAccessControl.grantRole(CURVE_DOLLAR_MANAGER_ROLE, managerAddr); + accessControlFacet.grantRole(CURVE_DOLLAR_MANAGER_ROLE, managerAddr); vm.stopPrank(); } diff --git a/packages/contracts/test/diamond/facets/ManagerFacet.t.sol b/packages/contracts/test/diamond/facets/ManagerFacet.t.sol index 9f97ecccb..0b517eea0 100644 --- a/packages/contracts/test/diamond/facets/ManagerFacet.t.sol +++ b/packages/contracts/test/diamond/facets/ManagerFacet.t.sol @@ -101,11 +101,11 @@ contract ManagerFacetTest is DiamondTestSetup { function testSetIncentiveToDollar_ShouldSucceed() public prankAs(admin) { assertEq( - IAccessControl.hasRole(GOVERNANCE_TOKEN_MANAGER_ROLE, admin), + accessControlFacet.hasRole(GOVERNANCE_TOKEN_MANAGER_ROLE, admin), true ); assertEq( - IAccessControl.hasRole( + accessControlFacet.hasRole( GOVERNANCE_TOKEN_MANAGER_ROLE, address(diamond) ), @@ -119,7 +119,7 @@ contract ManagerFacetTest is DiamondTestSetup { prankAs(admin) { assertEq( - IAccessControl.hasRole(GOVERNANCE_TOKEN_MINTER_ROLE, admin), + accessControlFacet.hasRole(GOVERNANCE_TOKEN_MINTER_ROLE, admin), true ); } @@ -157,11 +157,11 @@ contract ManagerFacetTest is DiamondTestSetup { } address stakingV1Address = generateAddress("stakingV1", true, 10 ether); - IAccessControl.grantRole( + accessControlFacet.grantRole( GOVERNANCE_TOKEN_MINTER_ROLE, stakingV1Address ); - IAccessControl.grantRole( + accessControlFacet.grantRole( GOVERNANCE_TOKEN_BURNER_ROLE, stakingV1Address ); diff --git a/packages/contracts/test/diamond/facets/StakingFacet.t.sol b/packages/contracts/test/diamond/facets/StakingFacet.t.sol index 4a31d0003..f9c3968f5 100644 --- a/packages/contracts/test/diamond/facets/StakingFacet.t.sol +++ b/packages/contracts/test/diamond/facets/StakingFacet.t.sol @@ -97,7 +97,7 @@ contract ZeroStateStaking is DiamondTestSetup { vm.startPrank(admin); stakingShare.setApprovalForAll(address(diamond), true); - IAccessControl.grantRole( + accessControlFacet.grantRole( GOVERNANCE_TOKEN_MINTER_ROLE, address(stakingShare) ); @@ -128,14 +128,14 @@ contract ZeroStateStaking is DiamondTestSetup { vm.startPrank(admin); - IAccessControl.grantRole(GOVERNANCE_TOKEN_MANAGER_ROLE, admin); - IAccessControl.grantRole(CREDIT_NFT_MANAGER_ROLE, address(diamond)); - IAccessControl.grantRole( + accessControlFacet.grantRole(GOVERNANCE_TOKEN_MANAGER_ROLE, admin); + accessControlFacet.grantRole(CREDIT_NFT_MANAGER_ROLE, address(diamond)); + accessControlFacet.grantRole( GOVERNANCE_TOKEN_MINTER_ROLE, address(diamond) ); - IAccessControl.grantRole( + accessControlFacet.grantRole( GOVERNANCE_TOKEN_BURNER_ROLE, address(diamond) ); @@ -179,7 +179,7 @@ contract ZeroStateStaking is DiamondTestSetup { metapool.add_liquidity(amounts_, (dyuAD2LP * 99) / 100, fourthAccount); vm.startPrank(admin); - IAccessControl.grantRole( + accessControlFacet.grantRole( GOVERNANCE_TOKEN_MINTER_ROLE, address(diamond) ); diff --git a/packages/contracts/test/diamond/facets/UbiquityPoolFacet.t.sol b/packages/contracts/test/diamond/facets/UbiquityPoolFacet.t.sol index 772766967..cf52ccd6c 100644 --- a/packages/contracts/test/diamond/facets/UbiquityPoolFacet.t.sol +++ b/packages/contracts/test/diamond/facets/UbiquityPoolFacet.t.sol @@ -70,7 +70,7 @@ contract UbiquityPoolFacetTest is DiamondTestSetup { vm.startPrank(admin); managerFacet.setStakingShareAddress(address(stakingShare)); stakingShare.setApprovalForAll(address(diamond), true); - IAccessControl.grantRole( + accessControlFacet.grantRole( GOVERNANCE_TOKEN_MINTER_ROLE, address(stakingShare) ); @@ -97,14 +97,14 @@ contract UbiquityPoolFacetTest is DiamondTestSetup { vm.startPrank(admin); - IAccessControl.grantRole(GOVERNANCE_TOKEN_MANAGER_ROLE, admin); - IAccessControl.grantRole(CREDIT_NFT_MANAGER_ROLE, address(diamond)); - IAccessControl.grantRole( + accessControlFacet.grantRole(GOVERNANCE_TOKEN_MANAGER_ROLE, admin); + accessControlFacet.grantRole(CREDIT_NFT_MANAGER_ROLE, address(diamond)); + accessControlFacet.grantRole( GOVERNANCE_TOKEN_MINTER_ROLE, address(diamond) ); - IAccessControl.grantRole( + accessControlFacet.grantRole( GOVERNANCE_TOKEN_BURNER_ROLE, address(diamond) ); diff --git a/packages/contracts/test/dollar/core/StakingShare.t.sol b/packages/contracts/test/dollar/core/StakingShare.t.sol index a77a409a6..0a40ba997 100644 --- a/packages/contracts/test/dollar/core/StakingShare.t.sol +++ b/packages/contracts/test/dollar/core/StakingShare.t.sol @@ -38,7 +38,10 @@ contract DepositStakingShare is LocalTestHelper { super.setUp(); // grant diamond token staking share right rights vm.prank(admin); - IAccessControl.grantRole(STAKING_SHARE_MINTER_ROLE, address(diamond)); + accessControlFacet.grantRole( + STAKING_SHARE_MINTER_ROLE, + address(diamond) + ); metapool = IMetaPool(metaPoolAddress); fourthBal = metapool.balanceOf(fourthAccount); minBal = metapool.balanceOf(stakingMinAccount); @@ -82,7 +85,7 @@ contract StakingShareTest is DepositStakingShare { uint256 end ) public { vm.prank(admin); - IAccessControl.grantRole(STAKING_SHARE_MINTER_ROLE, address(admin)); + accessControlFacet.grantRole(STAKING_SHARE_MINTER_ROLE, address(admin)); vm.prank(admin); stakingShare.updateStake(1, uint256(amount), uint256(debt), end); StakingShare.Stake memory stake = stakingShare.getStake(1); @@ -120,7 +123,7 @@ contract StakingShareTest is DepositStakingShare { uint256 end ) public { vm.prank(admin); - IAccessControl.grantRole(STAKING_SHARE_MINTER_ROLE, address(admin)); + accessControlFacet.grantRole(STAKING_SHARE_MINTER_ROLE, address(admin)); vm.prank(admin); uint256 id = stakingShare.mint( secondAccount, @@ -175,33 +178,33 @@ contract StakingShareTest is DepositStakingShare { emit Paused(admin); vm.prank(admin); - IAccessControl.pause(); + accessControlFacet.pause(); } function testPause_ShouldRevert_IfNotPauser() public { vm.expectRevert("Manager: Caller is not admin"); vm.prank(secondAccount); - IAccessControl.pause(); + accessControlFacet.pause(); } function testUnpause_ShouldUnpause() public { vm.prank(admin); - IAccessControl.pause(); + accessControlFacet.pause(); vm.expectEmit(true, false, false, true); emit Unpaused(admin); vm.prank(admin); - IAccessControl.unpause(); + accessControlFacet.unpause(); } function testUnpause_ShouldRevert_IfNotPauser() public { vm.prank(admin); - IAccessControl.pause(); + accessControlFacet.pause(); vm.expectRevert("Manager: Caller is not admin"); vm.prank(secondAccount); - IAccessControl.unpause(); + accessControlFacet.unpause(); } function testSafeTransferFrom_ShouldTransferTokenId() public { @@ -328,7 +331,7 @@ contract StakingShareTest is DepositStakingShare { function testSetUri_ShouldSetUri() public { vm.prank(admin); - IAccessControl.grantRole(STAKING_SHARE_MINTER_ROLE, address(admin)); + accessControlFacet.grantRole(STAKING_SHARE_MINTER_ROLE, address(admin)); string memory stringTest = "{'name':'Staking Share','description':," "'Ubiquity Staking Share'," @@ -344,7 +347,7 @@ contract StakingShareTest is DepositStakingShare { function testSetBaseUri_ShouldSetUri() public { vm.prank(admin); - IAccessControl.grantRole(STAKING_SHARE_MINTER_ROLE, address(admin)); + accessControlFacet.grantRole(STAKING_SHARE_MINTER_ROLE, address(admin)); string memory stringTest = "{'name':'Staking Share','description':," "'Ubiquity Staking Share'," @@ -360,7 +363,7 @@ contract StakingShareTest is DepositStakingShare { function testSetUriSingle_ShouldSetUri() public { vm.prank(admin); - IAccessControl.grantRole(STAKING_SHARE_MINTER_ROLE, address(admin)); + accessControlFacet.grantRole(STAKING_SHARE_MINTER_ROLE, address(admin)); string memory stringTest = "{'name':'Staking Share','description':," "'Ubiquity Staking Share'," diff --git a/packages/contracts/test/dollar/core/UbiquityDollarToken.t.sol b/packages/contracts/test/dollar/core/UbiquityDollarToken.t.sol index fde4250f0..6772136f0 100644 --- a/packages/contracts/test/dollar/core/UbiquityDollarToken.t.sol +++ b/packages/contracts/test/dollar/core/UbiquityDollarToken.t.sol @@ -35,7 +35,7 @@ contract UbiquityDollarTokenTest is LocalTestHelper { vm.startPrank(admin); dollar_addr = address(dollarToken); - IAccessControl.grantRole( + accessControlFacet.grantRole( keccak256("GOVERNANCE_TOKEN_MANAGER_ROLE"), admin ); diff --git a/packages/contracts/test/dollar/core/UbiquityGovernanceToken.t.sol b/packages/contracts/test/dollar/core/UbiquityGovernanceToken.t.sol index 6a171ecaf..faddc9e7c 100644 --- a/packages/contracts/test/dollar/core/UbiquityGovernanceToken.t.sol +++ b/packages/contracts/test/dollar/core/UbiquityGovernanceToken.t.sol @@ -13,7 +13,7 @@ contract UbiquityGovernanceTokenTest is LocalTestHelper { function setUp() public override { super.setUp(); vm.startPrank(admin); - IAccessControl.grantRole( + accessControlFacet.grantRole( keccak256("GOVERNANCE_TOKEN_MANAGER_ROLE"), admin );