Skip to content

Commit

Permalink
Create a new deployment mechanism
Browse files Browse the repository at this point in the history
  • Loading branch information
CodeSandwich committed Sep 27, 2024
1 parent 3aeccb7 commit 4278b25
Show file tree
Hide file tree
Showing 8 changed files with 730 additions and 422 deletions.
47 changes: 14 additions & 33 deletions deployments/filecoin-test.json
Original file line number Diff line number Diff line change
@@ -1,35 +1,16 @@
{
"Chain": "filecoin",
"Deployment time": "2024-08-12T22:50:45Z",
"Commit hash": "0b04137dff43f83789f4d10169d9a4d78e323332",
"Wallet": "0xEF4B994f97092fD22B8a880c47F053910788471b",
"Safe singleton factory": "0x914d7Fec6aaC8cd542e72Bca78B30650d45643d7",
"CREATE3 factory": "0xe9BE461efaB6f9079741da3b180249F81e66A461",
"DripsDeployer salt": "DripsDeployerTest1",
"DripsDeployer": "0xCD29c13A0f40C6E1a1783f1b0B69D72529CE183F",
"Drips": "0x29252acF5a3dA105CB3aC245B7758F6e50281ba7",
"Drips cycle seconds": "604800 [6.048e5]",
"Drips logic": "0x1ADE6713A488A8AE1DA66b452aCb3DD1821aeB7D",
"Drips admin": "0xEF4B994f97092fD22B8a880c47F053910788471b",
"Caller": "0x6171a47dDc84AF3e138D6d84c5b5D1bFD35615a3",
"AddressDriver": "0xE13A4f3671ee451F81Df3aa1AEb6653e4c33D5e0",
"AddressDriver ID": "0",
"AddressDriver logic": "0x3288D4C292080643E9041602cf0960bfe8fB44F0",
"AddressDriver admin": "0xEF4B994f97092fD22B8a880c47F053910788471b",
"NFTDriver": "0xE03d510d927816f3482C3C0204F14203403c0ee2",
"NFTDriver ID": "1",
"NFTDriver logic": "0xe349116Ab1F17819b080d519B51914DD1D5b6057",
"NFTDriver admin": "0xEF4B994f97092fD22B8a880c47F053910788471b",
"ImmutableSplitsDriver": "0xf07bF47a4a118792f5392560C27EE6530Ca36cA3",
"ImmutableSplitsDriver ID": "2",
"ImmutableSplitsDriver logic": "0x01Ca3Edd523913A7402F682eD1f758C2Ee47e72f",
"ImmutableSplitsDriver admin": "0xEF4B994f97092fD22B8a880c47F053910788471b",
"RepoDriver": "0x249e35aC49ccC4B1F0688Bc4c0bFA866a1b1E3fE",
"RepoDriver ID": "3",
"Gelato Automate": "0x83444851B04Af09e3F2dA745F1AC5F580bB775C6",
"RepoDriver IPFS CID": "",
"RepoDriver max requests per block": "0",
"RepoDriver max requests per 31 days": "0",
"RepoDriver logic": "0xB47AFebbf18Bb7126289eF068097E559E0cC76e4",
"RepoDriver admin": "0xEF4B994f97092fD22B8a880c47F053910788471b"
"AddressDriver": "0xEFcd912a5a67C3a7Cc70a2Fb9aa17781bf1cE68F",
"Caller": "0x7f2457421718A541B9Ee01E2F77F8BA749055F3b",
"Deployer": "0xEF4B994f97092fD22B8a880c47F053910788471b",
"Drips": "0x0B71C2a08d27E86d3841A6772332DEde0bc8DCa5",
"Drips cycle seconds": 86400,
"DripsDeployer": "0x79f3e7Aa55D39bBD42de31677B715B2e4D6e8ab0",
"GiversRegistry": "0x1F83E99813941a9bd701342560BFFaC794D707d1",
"ImmutableSplitsDriver": "0x990806c7EFC1C26be162a46F821ca281618F28AA",
"LZBridgedGovernor": "0x6bC5C5D7dA80dC1c30677852ce9AA01df368E76f",
"NFTDriver": "0x1397579E87AB255C8474907183B074947eBa7338",
"NativeTokenUnwrapper": "0x8A388BE3fb93C28b66365DCbf3eAc344690BD1C4",
"RepoDriver": "0xf3aE6ADDeEE195e91380F5F9Ce73698460BAdf79",
"RepoDriver tasks owner": "0x6D3A0fAE4FBa0f543b9e3280E85F4e4f59ba3D54",
"Salt": "test5"
}
2 changes: 1 addition & 1 deletion foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ evm_version = 'shanghai'
optimizer_runs = 7_700
verbosity = 1
fuzz_runs = 5
script = 'scripts'
fs_permissions = [{ access = "read-write", path = "./"}]
[fmt]
line_length = 100
[fuzz]
Expand Down
File renamed without changes.
74 changes: 74 additions & 0 deletions script/DeployCreate3Factory.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
// SPDX-License-Identifier: GPL-3.0-only
pragma solidity ^0.8.20;

import {console, Script} from "forge-std/Script.sol";
import {Address} from "openzeppelin-contracts/utils/Address.sol";
import {ICreate3Factory} from "script/DripsDeployer.sol";

/// @dev Deployed by Safe, taken from https://github.com/safe-global/safe-singleton-factory.
ICreate3Factory constant CREATE3_FACTORY =
ICreate3Factory(0xe9BE461efaB6f9079741da3b180249F81e66A461);

contract DeployCreate3Factory is Script {
/// @notice
address internal immutable singletonFactory = 0x914d7Fec6aaC8cd542e72Bca78B30650d45643d7;

/// @notice The creation code of Create3Factory.
/// It's reused verbatim to keep it byte-for-byte identical across all deployments and chains,
/// so the Safe singleton factory always deploys it under the same address
/// regardless of the currently used compiler version and configuration.
/// Taken from https://github.com/ZeframLou/create3-factory,
/// originally deployed on Ethereum as `0x9fBB3DF7C40Da2e5A0dE984fFE2CCB7C47cd0ABf`
/// in transaction `0xb05de371a18fc4f02753b34a689939cee69b93a043b926732043780959b7c4e3`.
bytes constant CREATE3_FACTORY_CREATION_CODE =
hex"608060405234801561001057600080fd5b5061063b806100206000396000f3fe6080604052600436106100"
hex"295760003560e01c806350f1c4641461002e578063cdcb760a14610077575b600080fd5b34801561003a57"
hex"600080fd5b5061004e610049366004610489565b61008a565b60405173ffffffffffffffffffffffffffff"
hex"ffffffffffff909116815260200160405180910390f35b61004e6100853660046104fd565b6100ee565b60"
hex"40517fffffffffffffffffffffffffffffffffffffffff000000000000000000000000606084901b166020"
hex"820152603481018290526000906054016040516020818303038152906040528051906020012091506100e7"
hex"8261014c565b9392505050565b6040517fffffffffffffffffffffffffffffffffffffffff000000000000"
hex"0000000000003360601b166020820152603481018390526000906054016040516020818303038152906040"
hex"528051906020012092506100e78383346102b2565b604080518082018252601081527f67363d3d37363d34"
hex"f03d5260086018f30000000000000000000000000000000060209182015290517fff000000000000000000"
hex"00000000000000000000000000000000000000000000918101919091527fffffffffffffffffffffffffff"
hex"ffffffffffffff0000000000000000000000003060601b166021820152603581018290527f21c35dbe1b34"
hex"4a2488cf3321d6ce542f8e9f305544ff09e4993a62319a497c1f6055820152600090819061022890607501"
hex"5b6040516020818303038152906040528051906020012090565b6040517fd6940000000000000000000000"
hex"0000000000000000000000000000000000000060208201527fffffffffffffffffffffffffffffffffffff"
hex"ffff000000000000000000000000606083901b1660228201527f0100000000000000000000000000000000"
hex"00000000000000000000000000000060368201529091506100e79060370161020f565b6000806040518060"
hex"400160405280601081526020017f67363d3d37363d34f03d5260086018f300000000000000000000000000"
hex"00000081525090506000858251602084016000f5905073ffffffffffffffffffffffffffffffffffffffff"
hex"811661037d576040517f08c379a00000000000000000000000000000000000000000000000000000000081"
hex"5260206004820152601160248201527f4445504c4f594d454e545f4641494c454400000000000000000000"
hex"000000000060448201526064015b60405180910390fd5b6103868661014c565b925060008173ffffffffff"
hex"ffffffffffffffffffffffffffffff1685876040516103b091906105d6565b60006040518083038185875a"
hex"f1925050503d80600081146103ed576040519150601f19603f3d011682016040523d82523d600060208401"
hex"3e6103f2565b606091505b50509050808015610419575073ffffffffffffffffffffffffffffffffffffff"
hex"ff84163b15155b61047f576040517f08c379a0000000000000000000000000000000000000000000000000"
hex"00000000815260206004820152601560248201527f494e495449414c495a4154494f4e5f4641494c454400"
hex"000000000000000000006044820152606401610374565b5050509392505050565b60008060408385031215"
hex"61049c57600080fd5b823573ffffffffffffffffffffffffffffffffffffffff811681146104c057600080"
hex"fd5b946020939093013593505050565b7f4e487b7100000000000000000000000000000000000000000000"
hex"000000000000600052604160045260246000fd5b6000806040838503121561051057600080fd5b82359150"
hex"602083013567ffffffffffffffff8082111561052f57600080fd5b818501915085601f8301126105435760"
hex"0080fd5b813581811115610555576105556104ce565b604051601f82017fffffffffffffffffffffffffff"
hex"ffffffffffffffffffffffffffffffffffffe0908116603f0116810190838211818310171561059b576105"
hex"9b6104ce565b816040528281528860208487010111156105b457600080fd5b826020860160208301376000"
hex"6020848301015280955050505050509250929050565b6000825160005b818110156105f757602081860181"
hex"015185830152016105dd565b50600092019182525091905056fea2646970667358221220fd377c185926b3"
hex"110b7e8a544f897646caf36a0e82b2629de851045e2a5f937764736f6c63430008100033";

function run() public {
if (Address.isContract(address(CREATE3_FACTORY))) {
console.log("Create3Factory already deployed");
return;
}
require(Address.isContract(singletonFactory), "Singleton factory not deployed");
bytes32 salt = 0;
bytes memory data = bytes.concat(salt, CREATE3_FACTORY_CREATION_CODE);
vm.broadcast();
Address.functionCall(singletonFactory, data, "Create3Factory deployment failed");
}
}
File renamed without changes.
Loading

0 comments on commit 4278b25

Please sign in to comment.