Skip to content

Commit

Permalink
Merge pull request #151 from Bananapus/fix/permissionReferences
Browse files Browse the repository at this point in the history
fix: references to removed `MIGRATE_CONTROLLER` permission
  • Loading branch information
mejango authored Jun 3, 2024
2 parents 5370d52 + 9584e40 commit bc6005c
Show file tree
Hide file tree
Showing 4 changed files with 67 additions and 86 deletions.
139 changes: 60 additions & 79 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@
"artifacts": "source ./.env && npx sphinx artifacts --org-id 'cltepuu9u0003j58rjtbd0hvu' --project-name 'nana-core'"
},
"dependencies": {
"@bananapus/permission-ids": "^0.0.7",
"@chainlink/contracts": "^1.1.0",
"@bananapus/permission-ids": "^0.0.8",
"@chainlink/contracts": "^1.1.1",
"@openzeppelin/contracts": "^5.0.2",
"@prb/math": "^4.0.2",
"@uniswap/permit2": "github:Uniswap/permit2"
},
"devDependencies": {
"@sphinx-labs/plugins": "^0.31.12"
"@sphinx-labs/plugins": "^0.32.2"
}
}
4 changes: 2 additions & 2 deletions src/JBController.sol
Original file line number Diff line number Diff line change
Expand Up @@ -541,15 +541,15 @@ contract JBController is JBPermissioned, ERC2771Context, IJBController, IJBMigra

/// @notice Migrate a project from this controller to another one.
/// @dev Can only be called by the project's owner or an address with the owner's permission to
/// `MIGRATE_CONTROLLER`.
/// `SET_CONTROLLER`.
/// @param projectId The ID of the project to migrate.
/// @param to The controller to migrate the project to.
function migrateController(uint256 projectId, IJBMigratable to) external virtual override {
// Enforce permissions.
_requirePermissionFrom({
account: PROJECTS.ownerOf(projectId),
projectId: projectId,
permissionId: JBPermissionIds.MIGRATE_CONTROLLER
permissionId: JBPermissionIds.SET_CONTROLLER
});

// Get a reference to the project's ruleset.
Expand Down
4 changes: 2 additions & 2 deletions test/units/static/JBController/TestMigrateController.sol
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ contract TestMigrateController_Local is JBControllerSetup {
_;
}

function test_Revert_When_CallerDoesNotHave_MIGRATE_CONTROLLER_Permission() external {
function test_Revert_When_CallerDoesNotHave_SET_CONTROLLER_Permission() external {
// it should revert
// mock ownerOf call
bytes memory _ownerOfCall = abi.encodeCall(IERC721.ownerOf, (1));
Expand All @@ -118,7 +118,7 @@ contract TestMigrateController_Local is JBControllerSetup {

// mock first permissions call
bytes memory _permissionsCall = abi.encodeCall(
IJBPermissions.hasPermission, (address(this), address(1), 1, JBPermissionIds.MIGRATE_CONTROLLER, true, true)
IJBPermissions.hasPermission, (address(this), address(1), 1, JBPermissionIds.SET_CONTROLLER, true, true)
);
bytes memory _permissionsReturned = abi.encode(false);

Expand Down

0 comments on commit bc6005c

Please sign in to comment.