Skip to content

Commit d5ea2e0

Browse files
committed
test: wip
1 parent 06b0a84 commit d5ea2e0

File tree

2 files changed

+66
-0
lines changed

2 files changed

+66
-0
lines changed

test/unit/AVSRegistrar.t.sol

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// SPDX-License-Identifier: BUSL-1.1
2+
pragma solidity ^0.8.12;
3+
4+
import {MockAVSDeployer} from "../utils/MockAVSDeployer.sol";
5+
import {BN254} from "../../src/libraries/BN254.sol";
6+
import {IRegistryCoordinator} from "../../src/interfaces/IRegistryCoordinator.sol";
7+
import {IStakeRegistry} from "../../src/interfaces/IStakeRegistry.sol";
8+
import {BitmapUtils} from "../../src/libraries/BitmapUtils.sol";
9+
10+
contract AVSRegistrarTest is MockAVSDeployer {
11+
using BN254 for BN254.G1Point;
12+
13+
function setUp() public virtual {
14+
_deployMockEigenLayerAndAVS();
15+
}
16+
17+
function testTrue() public {
18+
assertTrue(true);
19+
}
20+
}

test/unit/UpgradeableProxyLib.sol

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
// SPDX-License-Identifier: UNLICENSED
2+
pragma solidity ^0.8.0;
3+
import {Vm} from "forge-std/Vm.sol";
4+
import {ProxyAdmin} from "@openzeppelin/contracts/proxy/transparent/ProxyAdmin.sol";
5+
import {TransparentUpgradeableProxy} from
6+
"@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol";
7+
8+
contract EmptyContract {
9+
}
10+
11+
library UpgradeableProxyLib {
12+
bytes32 internal constant IMPLEMENTATION_SLOT =
13+
0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;
14+
bytes32 internal constant ADMIN_SLOT =
15+
0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;
16+
Vm internal constant vm = Vm(address(uint160(uint256(keccak256("hevm cheat code")))));
17+
function deployProxyAdmin() internal returns (address) {
18+
return address(new ProxyAdmin());
19+
}
20+
function setUpEmptyProxy(
21+
address admin
22+
) internal returns (address) {
23+
address emptyContract = address(new EmptyContract());
24+
return address(new TransparentUpgradeableProxy(emptyContract, admin, ""));
25+
}
26+
function upgrade(address proxy, address impl) internal {
27+
ProxyAdmin admin = getProxyAdmin(proxy);
28+
admin.upgrade(TransparentUpgradeableProxy(payable(proxy)), impl);
29+
}
30+
function upgradeAndCall(address proxy, address impl, bytes memory initData) internal {
31+
ProxyAdmin admin = getProxyAdmin(proxy);
32+
admin.upgradeAndCall(TransparentUpgradeableProxy(payable(proxy)), impl, initData);
33+
}
34+
function getImplementation(
35+
address proxy
36+
) internal view returns (address) {
37+
bytes32 value = vm.load(proxy, IMPLEMENTATION_SLOT);
38+
return address(uint160(uint256(value)));
39+
}
40+
function getProxyAdmin(
41+
address proxy
42+
) internal view returns (ProxyAdmin) {
43+
bytes32 value = vm.load(proxy, ADMIN_SLOT);
44+
return ProxyAdmin(address(uint160(uint256(value))));
45+
}
46+
}

0 commit comments

Comments
 (0)