Skip to content

Commit

Permalink
increase test coverage in IpRoyaltyVault
Browse files Browse the repository at this point in the history
  • Loading branch information
Spablob committed Apr 11, 2024
1 parent 5c7922a commit 6b89756
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 10 deletions.
2 changes: 0 additions & 2 deletions contracts/lib/Errors.sol
Original file line number Diff line number Diff line change
Expand Up @@ -287,8 +287,6 @@ library Errors {
error RoyaltyPolicyLAP__ZeroIpRoyaltyVaultBeacon();
error RoyaltyPolicyLAP__ZeroAccessManager();

error IpRoyaltyVault__ZeroIpId();
error IpRoyaltyVault__ZeroSupply();
error IpRoyaltyVault__ZeroRoyaltyPolicyLAP();
error IpRoyaltyVault__NotRoyaltyPolicyLAP();
error IpRoyaltyVault__SnapshotIntervalTooShort();
Expand Down
3 changes: 0 additions & 3 deletions contracts/modules/royalty/policies/IpRoyaltyVault.sol
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,6 @@ contract IpRoyaltyVault is IIpRoyaltyVault, ERC20SnapshotUpgradeable, Reentrancy
uint32 unclaimedTokens,
address ipIdAddress
) external initializer {
if (ipIdAddress == address(0)) revert Errors.IpRoyaltyVault__ZeroIpId();
if (supply == 0) revert Errors.IpRoyaltyVault__ZeroSupply();

IpRoyaltyVaultStorage storage $ = _getIpRoyaltyVaultStorage();

$.ipId = ipIdAddress;
Expand Down
5 changes: 1 addition & 4 deletions test/foundry/modules/dispute/ArbitrationPolicySP.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -106,10 +106,7 @@ contract TestArbitrationPolicySP is BaseTest {

vm.expectRevert(Errors.ArbitrationPolicySP__ZeroAccessManager.selector);
arbitrationPolicySP = ArbitrationPolicySP(
TestProxyHelper.deployUUPSProxy(
impl,
abi.encodeCall(ArbitrationPolicySP.initialize, address(0))
)
TestProxyHelper.deployUUPSProxy(impl, abi.encodeCall(ArbitrationPolicySP.initialize, address(0)))
);
}

Expand Down
7 changes: 6 additions & 1 deletion test/foundry/modules/royalty/IpRoyaltyVault.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ contract TestIpRoyaltyVault is BaseTest {

(, address IpRoyaltyVault2, , , ) = royaltyPolicyLAP.getRoyaltyData(address(2));
ipRoyaltyVault = IpRoyaltyVault(IpRoyaltyVault2);

assertEq(ipRoyaltyVault.ipId(), address(2));
}

function _setupMaxUniqueTree() internal {
Expand Down Expand Up @@ -129,14 +131,17 @@ contract TestIpRoyaltyVault is BaseTest {

vm.startPrank(address(licensingModule));
royaltyModule.onLinkToParents(address(100), address(royaltyPolicyLAP), parents, encodedLicenseData, "");
//royaltyPolicyLAP.onLinkToParents(address(100), parents, encodedLicenseData, "");
}

function test_IpRoyaltyVault_AddIpRoyaltyVaultTokens_NotRoyaltyPolicyLAP() public {
vm.expectRevert(Errors.IpRoyaltyVault__NotRoyaltyPolicyLAP.selector);
ipRoyaltyVault.addIpRoyaltyVaultTokens(address(0));
}

function test_IpRoyaltyVault_decimals() public {
assertEq(ipRoyaltyVault.decimals(), 6);
}

function test_IpRoyaltyVault_AddIpRoyaltyVaultTokens() public {
vm.startPrank(address(royaltyPolicyLAP));
ipRoyaltyVault.addIpRoyaltyVaultTokens(address(1));
Expand Down

0 comments on commit 6b89756

Please sign in to comment.