Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(contracts/avs): added manual deployer for avs impl #2652

Merged
merged 1 commit into from
Dec 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions contracts/avs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"dependencies": {
"@openzeppelin/contracts": "4.9.6",
"@openzeppelin/contracts-upgradeable": "4.9.6",
"createx": "github:pcaversaccio/createx",
"eigenlayer-contracts": "github:Layr-Labs/eigenlayer-contracts",
"eigenlayer-middleware": "github:Layr-Labs/eigenlayer-middleware",
"solmate": "^6.2.0"
Expand Down
10 changes: 10 additions & 0 deletions contracts/avs/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

36 changes: 36 additions & 0 deletions contracts/avs/script/avs/DeployAVS.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ pragma solidity =0.8.12;
import { TransparentUpgradeableProxy } from "@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol";
import { IAVSDirectory } from "eigenlayer-contracts/src/contracts/interfaces/IAVSDirectory.sol";
import { IDelegationManager } from "src/ext/IDelegationManager.sol";
import { ICreateX } from "createx/src/ICreateX.sol";

import { OmniAVS } from "src/OmniAVS.sol";
import { EigenM2Deployments } from "./EigenM2Deployments.sol";
Expand Down Expand Up @@ -39,6 +40,10 @@ contract DeployAVS is Script {
address _proxy;
bytes _proxyConstructorArgs;

ICreateX createX = ICreateX(0xba5Ed099633D3B313e4D5F7bdc1305d3c28ba5Ed);
bytes32 salt = 0xa779fc675db318dab004ab8d538cb320d0013f420081339a3e863be501407ce3;
address expectedAddr = 0x00000000001d2f69b87684287b4Cd996ac95C159;

function run() public {
require(block.chainid == 1, "only mainnet deployment");
require(_proxyAdmin != address(0), "proxyAdmin not set");
Expand Down Expand Up @@ -118,4 +123,35 @@ contract DeployAVS is Script {

return OmniAVS(address(proxy));
}

function manualDeployImpl() public returns (address) {
require(block.chainid == 1, "only mainnet deployment");

bytes memory bytecode = type(OmniAVS).creationCode;
bytes memory initCode = abi.encodePacked(
bytecode,
abi.encode(
IDelegationManager(EigenM2Deployments.DelegationManager), IAVSDirectory(EigenM2Deployments.AVSDirectory)
)
);

vm.startBroadcast();
address avs = createX.deployCreate2(salt, initCode);
vm.stopBroadcast();

require(avs == expectedAddr, "expected address mismatch");

return avs;
}

function getInitCodeHash() public pure returns (bytes32) {
bytes memory bytecode = type(OmniAVS).creationCode;
bytes memory initCode = abi.encodePacked(
bytecode,
abi.encode(
IDelegationManager(EigenM2Deployments.DelegationManager), IAVSDirectory(EigenM2Deployments.AVSDirectory)
)
);
return keccak256(initCode);
}
}
2 changes: 1 addition & 1 deletion contracts/bindings/avsdirectory.go

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion contracts/bindings/delegationmanager.go

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion contracts/bindings/mockerc20.go

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion contracts/bindings/omniavs.go

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion contracts/bindings/strategybase.go

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion contracts/bindings/strategymanager.go

Large diffs are not rendered by default.

Loading