-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2b44084
commit 2100ab8
Showing
3 changed files
with
26 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity 0.8.25; | ||
|
||
import {Vm} from "@forge-std/Vm.sol"; | ||
import {ERC1967Utils} from "@openzeppelin/contracts/proxy/ERC1967/ERC1967Utils.sol"; | ||
|
||
library ProxyUtils { | ||
address constant CHEATCODE_ADDRESS = | ||
0x7109709ECfa91a80626fF3989D68f67F5b1DD12D; | ||
Vm constant vm = Vm(CHEATCODE_ADDRESS); | ||
|
||
function getAdminAddress(address proxy) public view returns (address) { | ||
bytes32 adminSlot = vm.load(proxy, ERC1967Utils.ADMIN_SLOT); | ||
return address(uint160(uint256(adminSlot))); | ||
} | ||
} |