Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Ramarti committed Apr 10, 2024
1 parent 4045981 commit b84280a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
2 changes: 1 addition & 1 deletion contracts/access/AccessController.sol
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ contract AccessController is IAccessController, AccessManagedUpgradeable, UUPSUp
/// @notice initializer for this implementation contract
/// @param accessManager The address of the protocol admin roles contract
function initialize(address accessManager) external initializer {
__AccessManaged_init(accessManaged);
__AccessManaged_init(accessManager);
}

/// @notice Sets the addresses of the IP account registry and the module registry
Expand Down
15 changes: 9 additions & 6 deletions test/foundry/modules/royalty/RoyaltyPolicyLAP.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ contract TestRoyaltyPolicyLAP is BaseTest {

vm.startPrank(address(royaltyModule));
_setupMaxUniqueTree();
vm.stopPrank();
}

function _setupMaxUniqueTree() internal {
Expand Down Expand Up @@ -150,7 +151,7 @@ contract TestRoyaltyPolicyLAP is BaseTest {
vm.expectRevert(
abi.encodeWithSelector(
IAccessManaged.AccessManagedUnauthorized.selector,
address(royaltyModule) // How is this the caller??
address(this)
)
);
royaltyPolicyLAP.setSnapshotInterval(100);
Expand All @@ -166,7 +167,7 @@ contract TestRoyaltyPolicyLAP is BaseTest {
vm.expectRevert(
abi.encodeWithSelector(
IAccessManaged.AccessManagedUnauthorized.selector,
address(royaltyModule) // How is this the caller??
address(this)
)
);
royaltyPolicyLAP.setIpRoyaltyVaultBeacon(address(1));
Expand All @@ -185,13 +186,13 @@ contract TestRoyaltyPolicyLAP is BaseTest {
}

function test_RoyaltyPolicyLAP_onLicenseMinting_revert_NotRoyaltyModule() public {
vm.stopPrank();
vm.expectRevert(Errors.RoyaltyPolicyLAP__NotRoyaltyModule.selector);
royaltyPolicyLAP.onLicenseMinting(address(1), abi.encode(uint32(0)), abi.encode(uint32(0)));
}

function test_RoyaltyPolicyLAP_onLicenseMinting_revert_AboveRoyaltyStackLimit() public {
uint256 excessPercent = royaltyPolicyLAP.TOTAL_RT_SUPPLY() + 1;
vm.prank(address(royaltyModule));
vm.expectRevert(Errors.RoyaltyPolicyLAP__AboveRoyaltyStackLimit.selector);
royaltyPolicyLAP.onLicenseMinting(address(100), abi.encode(excessPercent), "");
}
Expand All @@ -201,14 +202,16 @@ contract TestRoyaltyPolicyLAP is BaseTest {
for (uint32 i = 0; i < parentsIpIds100.length; i++) {
encodedLicenseData[i] = abi.encode(parentsIpIds100[i]);
}

vm.startPrank(address(royaltyModule));
royaltyPolicyLAP.onLinkToParents(address(100), parentsIpIds100, encodedLicenseData, "");

vm.expectRevert(Errors.RoyaltyPolicyLAP__LastPositionNotAbleToMintLicense.selector);
royaltyPolicyLAP.onLicenseMinting(address(100), abi.encode(uint32(0)), "");
vm.stopPrank();
}

function test_RoyaltyPolicyLAP_onLicenseMinting() public {
vm.prank(address(royaltyModule));
royaltyPolicyLAP.onLicenseMinting(address(100), abi.encode(uint32(0)), "");

(
Expand All @@ -231,7 +234,6 @@ contract TestRoyaltyPolicyLAP is BaseTest {
encodedLicenseData[i] = abi.encode(parentsIpIds100[i]);
}

vm.stopPrank();
vm.expectRevert(Errors.RoyaltyPolicyLAP__NotRoyaltyModule.selector);
royaltyPolicyLAP.onLinkToParents(address(100), parentsIpIds100, encodedLicenseData, "");
}
Expand All @@ -247,6 +249,7 @@ contract TestRoyaltyPolicyLAP is BaseTest {
excessParents[1] = address(2);
excessParents[2] = address(3);

vm.prank(address(royaltyModule));
vm.expectRevert(Errors.RoyaltyPolicyLAP__AboveParentLimit.selector);
royaltyPolicyLAP.onLinkToParents(address(100), excessParents, encodedLicenseData, "");
}
Expand All @@ -256,7 +259,7 @@ contract TestRoyaltyPolicyLAP is BaseTest {
for (uint32 i = 0; i < parentsIpIds100.length; i++) {
encodedLicenseData[i] = abi.encode(parentsIpIds100[i]);
}

vm.prank(address(royaltyModule));
royaltyPolicyLAP.onLinkToParents(address(100), parentsIpIds100, encodedLicenseData, "");

(
Expand Down

0 comments on commit b84280a

Please sign in to comment.