Skip to content

Commit

Permalink
Merge pull request #5 from snapshot-labs/feat_base_deploy
Browse files Browse the repository at this point in the history
Deploy on base ; use LATEST_COMMIT as salt
  • Loading branch information
pscott authored Oct 3, 2024
2 parents b382240 + 0cca83b commit 0ffb5aa
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 6 deletions.
Empty file removed deployments/.keep
Empty file.
3 changes: 3 additions & 0 deletions deployments/base.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"Schnaps": "0xA92D665c4814c8E1681AaB292BA6d2278D01DEE0"
}
3 changes: 0 additions & 3 deletions deployments/goerli.json

This file was deleted.

2 changes: 1 addition & 1 deletion deployments/sepolia.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"Schnaps": "0x117303a2f3a195C94BBC0bB4979449454b38038D"
"Schnaps": "0xA92D665c4814c8E1681AaB292BA6d2278D01DEE0"
}
8 changes: 6 additions & 2 deletions script/Deployer.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import "forge-std/Script.sol";
import "../src/Schnaps.sol";

interface ICREATE3Factory {
function deploy(bytes32 salt, bytes memory bytecode) external returns (address deployedAddress);
function deploy(bytes32 salt, bytes memory bytecode) external payable returns (address deployedAddress);
}

contract Deployer is Script {
Expand All @@ -20,13 +20,17 @@ contract Deployer is Script {
string memory network = vm.envString("NETWORK");
address owner = vm.envAddress("OWNER");

// We use the latest commit hash as the salt for CREATE3 deployment
// Prepended with `00` to remove any solc warning.
uint256 LATEST_COMMIT = 0x00b382240c00c8d079fcfd2837de873b60ecf062d6;

deploymentsPath = string.concat(string.concat("./deployments/", network), ".json");

vm.startBroadcast(deployerPrivateKey);

// Using the CREATE3 factory maintained by lififinance: https://github.com/lifinance/create3-factory
address deployed = ICREATE3Factory(0x93FEC2C00BfE902F733B57c5a6CeeD7CD1384AE1).deploy(
bytes32(uint256(0)), abi.encodePacked(type(Schnaps).creationCode, abi.encode(owner))
bytes32(LATEST_COMMIT), abi.encodePacked(type(Schnaps).creationCode, abi.encode(owner))
);

deployments = deployments.serialize("Schnaps", deployed);
Expand Down

0 comments on commit 0ffb5aa

Please sign in to comment.