-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add helper for fetching current implementation (#17)
- Loading branch information
Showing
2 changed files
with
33 additions
and
10 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,30 @@ | ||
// SPDX-License-Identifier: AGPL-3.0 | ||
pragma solidity >=0.7.5 <0.9.0; | ||
|
||
import "forge-std/Vm.sol"; | ||
import 'forge-std/Vm.sol'; | ||
|
||
library ProxyHelpers { | ||
function getInitializableAdminUpgradeabilityProxyAdmin(Vm vm, address proxy) internal returns (address) { | ||
address slot = address( | ||
uint160(uint256(vm.load( | ||
proxy, | ||
0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103 | ||
)))); | ||
return slot; | ||
} | ||
} | ||
function getInitializableAdminUpgradeabilityProxyAdmin(Vm vm, address proxy) | ||
internal | ||
returns (address) | ||
{ | ||
address slot = address( | ||
uint160( | ||
uint256(vm.load(proxy, 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103)) | ||
) | ||
); | ||
return slot; | ||
} | ||
|
||
function getInitializableAdminUpgradeabilityProxyImplementation(Vm vm, address proxy) | ||
internal | ||
returns (address) | ||
{ | ||
address slot = address( | ||
uint160( | ||
uint256(vm.load(proxy, 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc)) | ||
) | ||
); | ||
return slot; | ||
} | ||
} |
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