Skip to content

Commit

Permalink
refactor InstanceAdmin constructor to take address instead of IAuthor…
Browse files Browse the repository at this point in the history
…ization
  • Loading branch information
rapidddenis committed Aug 9, 2024
1 parent f62dcdf commit 2b32028
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 8 deletions.
6 changes: 3 additions & 3 deletions contracts/instance/InstanceAdmin.sol
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,11 @@ contract InstanceAdmin is
/// @dev Only used for master instance admin.
/// Contracts created via constructor come with disabled initializers.
constructor(
IAuthorization instanceAuthorization
address instanceAuthorization
)
AccessAdmin()
{
_instanceAuthorization = instanceAuthorization;
_instanceAuthorization = IAuthorization(instanceAuthorization);
}

/// @dev Initializes this instance admin with the provided instances authorization specification.
Expand All @@ -56,7 +56,7 @@ contract InstanceAdmin is
/// Important: Initialization of this instance admin is only complete after calling function initializeInstance.
function initialize(
AccessManagerCloneable accessManager,
IAuthorization instanceAuthorization
address instanceAuthorization
)
external
initializer()
Expand Down
4 changes: 3 additions & 1 deletion contracts/instance/InstanceService.sol
Original file line number Diff line number Diff line change
Expand Up @@ -293,9 +293,11 @@ contract InstanceService is
clonedAccessManager.initialize(
address(clonedInstanceAdmin)); // grant ADMIN_ROLE to instance admin

address authorization = address(
InstanceAdmin(_masterInstanceAdmin).getInstanceAuthorization());
clonedInstanceAdmin.initialize(
clonedAccessManager,
InstanceAdmin(_masterInstanceAdmin).getInstanceAuthorization());
authorization);
}


Expand Down
4 changes: 2 additions & 2 deletions test/authorization/InstanceAdmin.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@ contract TestInstanceAdmin is
GifTest
{
AccessManagerCloneable public someAccessManager;
InstanceAuthorizationV3 public someInstanceAuthz;
address public someInstanceAuthz;
InstanceAdmin public someInstanceAdminMaster;

function setUp() public override {
super.setUp();

someAccessManager = new AccessManagerCloneable();
someInstanceAuthz = new InstanceAuthorizationV3();
someInstanceAuthz = address(new InstanceAuthorizationV3());
someInstanceAdminMaster = new InstanceAdmin(someInstanceAuthz);
someAccessManager = AccessManagerCloneable(someInstanceAdminMaster.authority());
}
Expand Down
4 changes: 2 additions & 2 deletions test/base/GifTest.sol
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ contract GifTest is GifDeployer {

AccessManagerCloneable public masterAccessManager;
InstanceAdmin public masterInstanceAdmin;
InstanceAuthorizationV3 public instanceAuthorizationV3;
address public instanceAuthorizationV3; //InstanceAuthorizationV3
BundleSet public masterBundleSet;
InstanceStore public masterInstanceStore;
Instance public masterInstance;
Expand Down Expand Up @@ -300,7 +300,7 @@ contract GifTest is GifDeployer {
function _deployMasterInstance() internal
{
// create instance supporting contracts
instanceAuthorizationV3 = new InstanceAuthorizationV3();
instanceAuthorizationV3 = address(new InstanceAuthorizationV3());
masterInstanceAdmin = new InstanceAdmin(instanceAuthorizationV3);
masterInstanceStore = new InstanceStore();
masterBundleSet = new BundleSet();
Expand Down

0 comments on commit 2b32028

Please sign in to comment.