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/misc): add pledge deploy script #2600

Merged
merged 1 commit into from
Dec 2, 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
3 changes: 3 additions & 0 deletions contracts/misc/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,8 @@
"devDependencies": {
"ds-test": "github:dapphub/ds-test",
"forge-std": "github:foundry-rs/forge-std"
},
"dependencies": {
"createx": "github:pcaversaccio/createx"
}
}
10 changes: 10 additions & 0 deletions contracts/misc/pnpm-lock.yaml

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

29 changes: 29 additions & 0 deletions contracts/misc/script/pledge/Pledge.s.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// SPDX-License-Identifier: GPL-3.0-only
pragma solidity =0.8.24;

import { Pledge } from "../../src/pledge/Pledge.sol";
import { Script, console2 } from "forge-std/Script.sol";
import { ICreateX } from "createx/src/ICreateX.sol";

contract PledgeScript is Script {
ICreateX public createX = ICreateX(0xba5Ed099633D3B313e4D5F7bdc1305d3c28ba5Ed);
address public omni = 0x5e9A8Aa213C912Bf54C86bf64aDB8ed6A79C04d1;
Zodomo marked this conversation as resolved.
Show resolved Hide resolved
bytes32 public salt = 0xa779fc675db318dab004ab8d538cb320d0013f42009066ee4061894802758139;

function getInitCodeHash() public view returns (bytes32) {
bytes memory bytecode = type(Pledge).creationCode;
bytes memory initCode = abi.encodePacked(bytecode, abi.encode(omni));
return keccak256(initCode);
}

function deploy() external {
bytes memory bytecode = type(Pledge).creationCode;
bytes memory initCode = abi.encodePacked(bytecode, abi.encode(omni));

vm.startBroadcast();
address pledge = createX.deployCreate2(salt, initCode);
vm.stopBroadcast();
//solhint-disable-next-line no-console
console2.log("Pledge deployed at", pledge);
}
}
Loading