Skip to content

Commit 7666e63

Browse files
committed
refactor: move getProxyAdmin to Utils
1 parent f650cae commit 7666e63

3 files changed

Lines changed: 6 additions & 10 deletions

File tree

claim_contracts/script/DeployAlignedToken.s.sol

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ contract DeployAlignedToken is Script {
4242
"Aligned Token Proxy deployed at address:",
4343
vm.toString(address(_tokenProxy)),
4444
" with proxy admin: ",
45-
vm.toString(getAdminAddress(address(_tokenProxy))),
45+
vm.toString(Utils.getAdminAddress(address(_tokenProxy))),
4646
" and owner: ",
4747
vm.toString(_safe)
4848
)
@@ -94,12 +94,4 @@ contract DeployAlignedToken is Script {
9494
);
9595
return TransparentUpgradeableProxy(payable(_alignedTokenProxy));
9696
}
97-
98-
function getAdminAddress(address proxy) internal view returns (address) {
99-
address CHEATCODE_ADDRESS = 0x7109709ECfa91a80626fF3989D68f67F5b1DD12D;
100-
Vm vm = Vm(CHEATCODE_ADDRESS);
101-
102-
bytes32 adminSlot = vm.load(proxy, ERC1967Utils.ADMIN_SLOT);
103-
return address(uint160(uint256(adminSlot)));
104-
}
10597
}

claim_contracts/script/DeployAll.s.sol

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,6 @@ contract DeployAll is Script {
102102
.alignedTokenProxyDeploymentData(
103103
_proxyAdmin,
104104
address(_token),
105-
_owner,
106105
_foundation,
107106
_claim
108107
);

claim_contracts/script/Utils.sol

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,11 @@ library Utils {
1414
address(uint160(uint256(keccak256("hevm cheat code"))));
1515
Vm internal constant vm = Vm(VM_ADDRESS);
1616

17+
function getAdminAddress(address proxy) internal view returns (address) {
18+
bytes32 adminSlot = vm.load(proxy, ERC1967Utils.ADMIN_SLOT);
19+
return address(uint160(uint256(adminSlot)));
20+
}
21+
1722
/// @notice Address of the deterministic create2 factory.
1823
/// @dev This address corresponds to a contracts that is set in the storage
1924
/// in the genesis file. The same contract with the same address is deployed

0 commit comments

Comments
 (0)