Skip to content

Commit

Permalink
feat(contracts/avs): added manual deployer for avs impl (#2652)
Browse files Browse the repository at this point in the history
Added a manual foundry script deployer for the OmniAVS implementation.
This script does not perform the proxy upgrade.

issue: omni-network/ops#601
  • Loading branch information
Zodomo authored Dec 11, 2024
1 parent 61d165a commit 681fef7
Show file tree
Hide file tree
Showing 9 changed files with 53 additions and 6 deletions.
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.

0 comments on commit 681fef7

Please sign in to comment.