Skip to content
This repository has been archived by the owner on Apr 30, 2024. It is now read-only.

Commit

Permalink
nit: setUp fix & remove comments, names, and unused vars
Browse files Browse the repository at this point in the history
  • Loading branch information
jdubpark committed Feb 13, 2024
1 parent 9896685 commit 7931072
Show file tree
Hide file tree
Showing 15 changed files with 27 additions and 32 deletions.
2 changes: 1 addition & 1 deletion test/foundry/integration/BaseIntegration.sol
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { BaseTest } from "test/foundry/utils/BaseTest.sol";

contract BaseIntegration is BaseTest {
function setUp() public virtual override(BaseTest) {
BaseTest.setUp();
super.setUp();
// deploy everything as real contracts
buildDeployAccessCondition(DeployAccessCondition({ governance: true, accessController: true }));
buildDeployRegistryCondition(DeployRegistryCondition({ licenseRegistry: true, moduleRegistry: true }));
Expand Down
3 changes: 1 addition & 2 deletions test/foundry/integration/big-bang/NftLicenseRoyalty.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ contract BigBang_Integration_NftLicenseRoyalty is BaseIntegration {

USDC.approve(address(royaltyPolicyLS), royaltyAmount);

(address danSplitClone, address danClaimer, , ) = royaltyPolicyLS.royaltyData(ipAcct_Dan);
(address danSplitClone, , , ) = royaltyPolicyLS.royaltyData(ipAcct_Dan);

vm.expectEmit(address(USDC));
emit IERC20.Transfer(u.alice, address(danSplitClone), royaltyAmount); // destination of payment
Expand All @@ -191,7 +191,6 @@ contract BigBang_Integration_NftLicenseRoyalty is BaseIntegration {
{
vm.startPrank(u.dan);

address ipAcct_Alice = ipAcct[1];
address ipAcct_Dan = ipAcct[4];
(, address danClaimer, , ) = royaltyPolicyLS.royaltyData(ipAcct_Dan);

Expand Down
2 changes: 1 addition & 1 deletion test/foundry/modules/ModuleBase.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ abstract contract ModuleBaseTest is BaseTest {

/// @notice Initializes the base module for testing.
function setUp() public virtual override(BaseTest) {
BaseTest.setUp();
super.setUp();
buildDeployMiscCondition(
DeployMiscCondition({ ipAssetRenderer: false, ipMetadataProvider: false, ipResolver: true })
);
Expand Down
2 changes: 1 addition & 1 deletion test/foundry/modules/dispute/ArbitrationPolicySP.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ contract TestArbitrationPolicySP is BaseTest {
address internal arbitrationRelayer;

function setUp() public override {
BaseTest.setUp();
super.setUp();
buildDeployModuleCondition(
DeployModuleCondition({
registrationModule: true,
Expand Down
2 changes: 1 addition & 1 deletion test/foundry/modules/dispute/DisputeModule.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ contract DisputeModuleTest is BaseTest {
ArbitrationPolicySP internal arbitrationPolicySP2;

function setUp() public override {
BaseTest.setUp();
super.setUp();
buildDeployModuleCondition(
DeployModuleCondition({
registrationModule: true,
Expand Down
28 changes: 14 additions & 14 deletions test/foundry/modules/licensing/UMLPolicyFramework.derivation.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ contract UMLPolicyFrameworkCompatibilityTest is BaseTest {
}

function setUp() public override {
BaseTest.setUp();
super.setUp();
buildDeployRegistryCondition(DeployRegistryCondition({ licenseRegistry: true, moduleRegistry: false }));
buildDeployModuleCondition(
DeployModuleCondition({
Expand Down Expand Up @@ -117,11 +117,11 @@ contract UMLPolicyFrameworkCompatibilityTest is BaseTest {

// Others can mint licenses to make derivatives of IP1 from each different policy,
// as long as they pass the verifications
uint256 licenseId1 = licensingModule.mintLicense(_getUmlPolicyId("comm_deriv"), ipId1, 1, don);
assertEq(licenseRegistry.balanceOf(don, licenseId1), 1, "Don doesn't have license1");
uint256 licenseId1 = licensingModule.mintLicense(_getUmlPolicyId("comm_deriv"), ipId1, 1, dan);
assertEq(licenseRegistry.balanceOf(dan, licenseId1), 1, "Don doesn't have license1");

uint256 licenseId2 = licensingModule.mintLicense(_getUmlPolicyId("comm_non_deriv"), ipId1, 1, don);
assertEq(licenseRegistry.balanceOf(don, licenseId2), 1, "Don doesn't have license2");
uint256 licenseId2 = licensingModule.mintLicense(_getUmlPolicyId("comm_non_deriv"), ipId1, 1, dan);
assertEq(licenseRegistry.balanceOf(dan, licenseId2), 1, "Don doesn't have license2");
}

function test_UMLPolicyFramework_originalWork_bobMintsWithDifferentPolicies()
Expand All @@ -133,11 +133,11 @@ contract UMLPolicyFrameworkCompatibilityTest is BaseTest {

// Bob can add different policies on IP1 without compatibility checks.
vm.startPrank(bob);
uint256 licenseId1 = licensingModule.mintLicense(_getUmlPolicyId("comm_deriv"), ipId1, 2, don);
assertEq(licenseRegistry.balanceOf(don, licenseId1), 2, "Don doesn't have license1");
uint256 licenseId1 = licensingModule.mintLicense(_getUmlPolicyId("comm_deriv"), ipId1, 2, dan);
assertEq(licenseRegistry.balanceOf(dan, licenseId1), 2, "Don doesn't have license1");

uint256 licenseId2 = licensingModule.mintLicense(_getUmlPolicyId("comm_non_deriv"), ipId1, 1, don);
assertEq(licenseRegistry.balanceOf(don, licenseId2), 1, "Don doesn't have license2");
uint256 licenseId2 = licensingModule.mintLicense(_getUmlPolicyId("comm_non_deriv"), ipId1, 1, dan);
assertEq(licenseRegistry.balanceOf(dan, licenseId2), 1, "Don doesn't have license2");
vm.stopPrank();
}

Expand All @@ -162,8 +162,8 @@ contract UMLPolicyFrameworkCompatibilityTest is BaseTest {
mockRoyaltyPolicyLS.setMinRoyalty(ipId2, 100);

vm.expectRevert(Errors.LicensingModule__MintLicenseParamFailed.selector);
vm.startPrank(don);
licensingModule.mintLicense(_getUmlPolicyId("comm_non_deriv"), ipId2, 1, don);
vm.startPrank(dan);
licensingModule.mintLicense(_getUmlPolicyId("comm_non_deriv"), ipId2, 1, dan);

vm.expectRevert(Errors.LicensingModule__MintLicenseParamFailed.selector);
vm.startPrank(alice);
Expand Down Expand Up @@ -202,9 +202,9 @@ contract UMLPolicyFrameworkCompatibilityTest is BaseTest {
{
mockRoyaltyPolicyLS.setMinRoyalty(ipId2, 100);

vm.prank(don);
uint256 licenseId = licensingModule.mintLicense(_getUmlPolicyId("comm_reciprocal"), ipId2, 1, don);
assertEq(licenseRegistry.balanceOf(don, licenseId), 1, "Don doesn't have license");
vm.prank(dan);
uint256 licenseId = licensingModule.mintLicense(_getUmlPolicyId("comm_reciprocal"), ipId2, 1, dan);
assertEq(licenseRegistry.balanceOf(dan, licenseId), 1, "Don doesn't have license");
}

function test_UMLPolicyFramework_reciprocal_AliceMintsLicenseForP1inIP2()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ contract UMLPolicyFrameworkMultiParentTest is BaseTest {
}

function setUp() public override {
BaseTest.setUp();
super.setUp();
buildDeployRegistryCondition(DeployRegistryCondition({ licenseRegistry: true, moduleRegistry: false }));
buildDeployModuleCondition(
DeployModuleCondition({
Expand Down
2 changes: 1 addition & 1 deletion test/foundry/modules/licensing/UMLPolicyFramework.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ contract UMLPolicyFrameworkTest is BaseTest {
MockTokenGatedHook internal tokenGatedHook = new MockTokenGatedHook();

function setUp() public override {
BaseTest.setUp();
super.setUp();
buildDeployRegistryCondition(DeployRegistryCondition({ licenseRegistry: true, moduleRegistry: false }));
buildDeployModuleCondition(
DeployModuleCondition({
Expand Down
2 changes: 1 addition & 1 deletion test/foundry/modules/royalty/LSClaimer.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ contract TestLSClaimer is BaseTest {
uint256[] internal nftIds;

function setUp() public override {
BaseTest.setUp();
super.setUp();
buildDeployModuleCondition(
DeployModuleCondition({
registrationModule: true,
Expand Down
2 changes: 1 addition & 1 deletion test/foundry/modules/royalty/RoyaltyModule.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ contract TestRoyaltyModule is BaseTest {
address internal ipAccount2 = address(0x111000bbb);

function setUp() public override {
BaseTest.setUp();
super.setUp();
buildDeployModuleCondition(
DeployModuleCondition({
registrationModule: false,
Expand Down
2 changes: 1 addition & 1 deletion test/foundry/modules/royalty/RoyaltyPolicyLS.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ contract TestLSClaimer is BaseTest {
address internal ipAccount3 = address(0x111000ccc);

function setUp() public override {
BaseTest.setUp();
super.setUp();
buildDeployModuleCondition(
DeployModuleCondition({
registrationModule: false,
Expand Down
4 changes: 1 addition & 3 deletions test/foundry/registries/IPAssetRegistry.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ contract IPAssetRegistryTest is BaseTest {

/// @notice Initializes the IP asset registry testing contract.
function setUp() public virtual override {
BaseTest.setUp();
super.setUp();
buildDeployRegistryCondition(
DeployRegistryCondition({
licenseRegistry: false, // don't use
Expand All @@ -40,8 +40,6 @@ contract IPAssetRegistryTest is BaseTest {
deployConditionally();
postDeploymentSetup();

// moduleRegistry.registerModule(LICENSING_MODULE_KEY, address(licensingModule));

registry = ipAssetRegistry;

tokenAddress = address(mockNFT);
Expand Down
2 changes: 1 addition & 1 deletion test/foundry/registries/metadata/IPAssetRenderer.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ contract IPAssetRendererTest is BaseTest {

/// @notice Initializes the base token contract for testing.
function setUp() public virtual override(BaseTest) {
BaseTest.setUp();
super.setUp();
buildDeployMiscCondition(
DeployMiscCondition({ ipAssetRenderer: true, ipMetadataProvider: false, ipResolver: true })
);
Expand Down
2 changes: 1 addition & 1 deletion test/foundry/registries/metadata/MetadataProvider.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ contract MetadataProviderTest is BaseTest {

/// @notice Initializes the IP metadata provider contract.
function setUp() public virtual override {
BaseTest.setUp();
super.setUp();
buildDeployModuleCondition(
DeployModuleCondition({
registrationModule: true,
Expand Down
2 changes: 0 additions & 2 deletions test/foundry/utils/BaseTest.sol
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ contract BaseTest is Test, DeployHelper, LicensingHelper {
address internal bob;
address internal carl;
address internal dan;
address internal don; // don is dan, dan is don

/// @dev Aliases for mock assets.
/// NOTE: Must call `postDeploymentSetup` after `deployConditionally` to set these.
Expand All @@ -49,7 +48,6 @@ contract BaseTest is Test, DeployHelper, LicensingHelper {
bob = u.bob;
carl = u.carl;
dan = u.dan;
don = dan;

vm.label(LIQUID_SPLIT_FACTORY, "LIQUID_SPLIT_FACTORY");
vm.label(LIQUID_SPLIT_MAIN, "LIQUID_SPLIT_MAIN");
Expand Down

0 comments on commit 7931072

Please sign in to comment.