Skip to content

Commit a076521

Browse files
test inherited erc165
1 parent 7077b6c commit a076521

File tree

2 files changed

+44
-1
lines changed

2 files changed

+44
-1
lines changed

test/src/concrete/authorize/OffchainAssetReceiptVaultPaymentMintAuthorizerV1.construct.t.sol

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,20 @@ import {IERC20MetadataUpgradeable as IERC20Metadata} from
1818
import {ICloneableV2} from "rain.factory/interface/ICloneableV2.sol";
1919
import {IAuthorizeV1} from "src/interface/IAuthorizeV1.sol";
2020
import {IERC165} from "openzeppelin-contracts/contracts/utils/introspection/IERC165.sol";
21+
import {
22+
WITHDRAW,
23+
DEPOSIT,
24+
CONFISCATE_RECEIPT,
25+
CONFISCATE_SHARES,
26+
CERTIFY
27+
} from "src/concrete/vault/OffchainAssetReceiptVault.sol";
28+
import {
29+
WITHDRAW_ADMIN,
30+
DEPOSIT_ADMIN,
31+
CONFISCATE_RECEIPT_ADMIN,
32+
CONFISCATE_SHARES_ADMIN,
33+
CERTIFY_ADMIN
34+
} from "src/concrete/authorize/OffchainAssetReceiptVaultAuthorizerV1.sol";
2135

2236
contract OffchainAssetReceiptVaultPaymentMintAuthorizerV1ConstructTest is Test {
2337
function testOffchainAssetReceiptVaultPaymentMintAuthorizerV1Construct() external {
@@ -121,13 +135,25 @@ contract OffchainAssetReceiptVaultPaymentMintAuthorizerV1ConstructTest is Test {
121135
address receiptVault,
122136
address owner,
123137
uint8 paymentTokenDecimals,
124-
uint256 maxSharesSupply
138+
uint256 maxSharesSupply,
139+
bytes32 badRole
125140
) external {
126141
address paymentToken = address(0x1234567890123456789012345678901234567890);
127142
vm.assume(receiptVault != address(0));
128143
vm.assume(owner != address(0));
129144
vm.assume(paymentToken != address(0));
130145
vm.assume(maxSharesSupply > 0);
146+
vm.assume(badRole != CERTIFY_ADMIN);
147+
vm.assume(badRole != CONFISCATE_SHARES_ADMIN);
148+
vm.assume(badRole != CONFISCATE_RECEIPT_ADMIN);
149+
vm.assume(badRole != DEPOSIT_ADMIN);
150+
vm.assume(badRole != WITHDRAW_ADMIN);
151+
vm.assume(badRole != CERTIFY);
152+
vm.assume(badRole != CONFISCATE_SHARES);
153+
vm.assume(badRole != CONFISCATE_RECEIPT);
154+
vm.assume(badRole != DEPOSIT);
155+
vm.assume(badRole != WITHDRAW);
156+
131157
OffchainAssetReceiptVaultPaymentMintAuthorizerV1 implementation =
132158
new OffchainAssetReceiptVaultPaymentMintAuthorizerV1();
133159
CloneFactory factory = new CloneFactory();
@@ -159,5 +185,18 @@ contract OffchainAssetReceiptVaultPaymentMintAuthorizerV1ConstructTest is Test {
159185
assertTrue(authorizer.supportsInterface(type(IERC165).interfaceId));
160186
assertTrue(authorizer.supportsInterface(type(ICloneableV2).interfaceId));
161187
assertTrue(authorizer.supportsInterface(type(IAuthorizeV1).interfaceId));
188+
189+
vm.assertTrue(authorizer.hasRole(CERTIFY_ADMIN, owner));
190+
vm.assertTrue(authorizer.hasRole(CONFISCATE_SHARES_ADMIN, owner));
191+
vm.assertTrue(authorizer.hasRole(CONFISCATE_RECEIPT_ADMIN, owner));
192+
vm.assertTrue(authorizer.hasRole(DEPOSIT_ADMIN, owner));
193+
vm.assertTrue(authorizer.hasRole(WITHDRAW_ADMIN, owner));
194+
195+
vm.assertTrue(!authorizer.hasRole(CERTIFY, owner));
196+
vm.assertTrue(!authorizer.hasRole(CONFISCATE_SHARES, owner));
197+
vm.assertTrue(!authorizer.hasRole(CONFISCATE_RECEIPT, owner));
198+
vm.assertTrue(!authorizer.hasRole(DEPOSIT, owner));
199+
vm.assertTrue(!authorizer.hasRole(WITHDRAW, owner));
200+
vm.assertTrue(!authorizer.hasRole(badRole, owner));
162201
}
163202
}

test/src/concrete/authorize/OffchainAssetReceiptVaultPaymentMintAuthorizerV1.ierc165.t.sol

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,22 @@ import {ICloneableV2} from "rain.factory/interface/ICloneableV2.sol";
99
import {IAuthorizeV1} from "src/interface/IAuthorizeV1.sol";
1010
import {OffchainAssetReceiptVaultPaymentMintAuthorizerV1} from
1111
"src/concrete/authorize/OffchainAssetReceiptVaultPaymentMintAuthorizerV1.sol";
12+
import {IAccessControlUpgradeable as IAccessControl} from
13+
"openzeppelin-contracts-upgradeable/contracts/access/IAccessControlUpgradeable.sol";
1214

1315
contract OffchainAssetReceiptVaultPaymentMintAuthorizerV1IERC165Test is Test {
1416
function testOffchainAssetReceiptVaultPaymentMintAuthorizerV1IERC165(bytes4 badInterfaceId) external {
1517
vm.assume(badInterfaceId != type(IERC165).interfaceId);
1618
vm.assume(badInterfaceId != type(ICloneableV2).interfaceId);
1719
vm.assume(badInterfaceId != type(IAuthorizeV1).interfaceId);
20+
vm.assume(badInterfaceId != type(IAccessControl).interfaceId);
1821

1922
OffchainAssetReceiptVaultPaymentMintAuthorizerV1 authorizer =
2023
new OffchainAssetReceiptVaultPaymentMintAuthorizerV1();
2124
assertTrue(authorizer.supportsInterface(type(IERC165).interfaceId));
2225
assertTrue(authorizer.supportsInterface(type(ICloneableV2).interfaceId));
2326
assertTrue(authorizer.supportsInterface(type(IAuthorizeV1).interfaceId));
27+
assertTrue(authorizer.supportsInterface(type(IAccessControl).interfaceId));
2428

2529
assertFalse(authorizer.supportsInterface(badInterfaceId));
2630
}

0 commit comments

Comments
 (0)