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: Added 3Hours and 1Day JBDeadlines #246

Merged
merged 1 commit into from
Feb 5, 2025
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
43 changes: 39 additions & 4 deletions script/DeployPeriphery.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import {IJBPriceFeed} from "src/interfaces/IJBPriceFeed.sol";
import {JBPermissions} from "src/JBPermissions.sol";
import {JBProjects} from "src/JBProjects.sol";
import {JBPrices} from "src/JBPrices.sol";
import {JBDeadline3Hours} from "src/periphery/JBDeadline3Hours.sol";
import {JBDeadline1Day} from "src/periphery/JBDeadline1Day.sol";
import {JBDeadline3Days} from "src/periphery/JBDeadline3Days.sol";
import {JBDeadline7Days} from "src/periphery/JBDeadline7Days.sol";
import {JBMatchingPriceFeed} from "src/periphery/JBMatchingPriceFeed.sol";
Expand All @@ -33,7 +35,7 @@ contract DeployPeriphery is Script, Sphinx {
/// @notice tracks the deployment of the core contracts for the chain we are deploying to.
CoreDeployment core;

bytes32 private DEADLINES_SALT = keccak256("JBDeadlines0");
bytes32 private DEADLINES_SALT = keccak256("JBDeadlines");

function configureSphinx() public override {
// TODO: Update to contain JB Emergency Developers
Expand All @@ -43,7 +45,7 @@ contract DeployPeriphery is Script, Sphinx {
}

/// @notice Deploys the protocol.
function run() public sphinx {
function run() public {
// Get the deployment addresses for the nana CORE for this chain.
// We want to do this outside of the `sphinx` modifier.
core = CoreDeploymentLib.getDeployment(vm.envOr("NANA_CORE_DEPLOYMENT_PATH", string("deployments/")));
Expand Down Expand Up @@ -94,7 +96,40 @@ contract DeployPeriphery is Script, Sphinx {
core.prices.addPriceFeedFor(0, uint32(uint160(JBConstants.NATIVE_TOKEN)), JBCurrencyIds.ETH, matchingPriceFeed);

// Deploy the JBDeadlines
new JBDeadline3Days{salt: DEADLINES_SALT}();
new JBDeadline7Days{salt: DEADLINES_SALT}();
if (!_isDeployed(DEADLINES_SALT, type(JBDeadline3Hours).creationCode, "")) {
new JBDeadline3Hours{salt: DEADLINES_SALT}();
}

if (!_isDeployed(DEADLINES_SALT, type(JBDeadline1Day).creationCode, "")) {
new JBDeadline1Day{salt: DEADLINES_SALT}();
}

if (!_isDeployed(DEADLINES_SALT, type(JBDeadline3Days).creationCode, "")) {
new JBDeadline3Days{salt: DEADLINES_SALT}();
}

if (!_isDeployed(DEADLINES_SALT, type(JBDeadline7Days).creationCode, "")) {
new JBDeadline7Days{salt: DEADLINES_SALT}();
}
}

function _isDeployed(
bytes32 salt,
bytes memory creationCode,
bytes memory arguments
)
internal
view
returns (bool)
{
address _deployedTo = vm.computeCreate2Address({
salt: salt,
initCodeHash: keccak256(abi.encodePacked(creationCode, arguments)),
// Arachnid/deterministic-deployment-proxy address.
deployer: address(0x4e59b44847b379578588920cA78FbF26c0B4956C)
});

// Return if code is already present at this address.
return address(_deployedTo).code.length != 0;
}
}
54 changes: 27 additions & 27 deletions sphinx.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
"format": "sphinx-lock-1.0.0",
"orgId": "ea165b21-7cdc-4d7b-be59-ecdd4c26bee4",
"projects": {
"nana-721-hook-testnet": {
"projectId": "aeb85a70-c28c-488c-91c5-94c9778ae26e",
"projectName": "nana-721-hook-testnet",
"nana-core-testnet": {
"projectId": "e45ec646-f618-41fa-adb4-d4f5e5c17bf4",
"projectName": "nana-core-testnet",
"defaultSafe": {
"safeName": "core-test-safe",
"owners": [
Expand All @@ -18,9 +18,9 @@
"saltNonce": "1"
}
},
"nana-fee-project": {
"projectId": "32afc9bc-f0d2-4c9c-ab57-d2b81fb6e8c4",
"projectName": "nana-fee-project",
"nana-address-registry-testnet": {
"projectId": "30294927-9380-442f-9e6f-9caf60fa509b",
"projectName": "nana-address-registry-testnet",
"defaultSafe": {
"safeName": "core-test-safe",
"owners": [
Expand All @@ -33,9 +33,9 @@
"saltNonce": "1"
}
},
"nana-swap-terminal-testnet": {
"projectId": "61d6f98f-8817-48af-bce6-e372aa82eead",
"projectName": "nana-swap-terminal-testnet",
"croptop-core-testnet": {
"projectId": "cbfd9f35-b82e-4eb6-acbd-1f8118122fc0",
"projectName": "croptop-core-testnet",
"defaultSafe": {
"safeName": "core-test-safe",
"owners": [
Expand All @@ -48,9 +48,9 @@
"saltNonce": "1"
}
},
"nana-core-testnet": {
"projectId": "e45ec646-f618-41fa-adb4-d4f5e5c17bf4",
"projectName": "nana-core-testnet",
"nana-fee-project": {
"projectId": "32afc9bc-f0d2-4c9c-ab57-d2b81fb6e8c4",
"projectName": "nana-fee-project",
"defaultSafe": {
"safeName": "core-test-safe",
"owners": [
Expand Down Expand Up @@ -78,9 +78,9 @@
"saltNonce": "1"
}
},
"revnet-core-testnet": {
"projectId": "bedd4475-2c93-439c-8d60-5e2763cea01d",
"projectName": "revnet-core-testnet",
"bannyverse-core-testnet": {
"projectId": "489741d5-1d97-42ee-a355-038ed56b1696",
"projectName": "bannyverse-core-testnet",
"defaultSafe": {
"safeName": "core-test-safe",
"owners": [
Expand All @@ -93,9 +93,9 @@
"saltNonce": "1"
}
},
"nana-suckers-testnet": {
"projectId": "7ca25001-6003-4255-becf-f1fb5a5ae548",
"projectName": "nana-suckers-testnet",
"nana-swap-terminal-testnet": {
"projectId": "61d6f98f-8817-48af-bce6-e372aa82eead",
"projectName": "nana-swap-terminal-testnet",
"defaultSafe": {
"safeName": "core-test-safe",
"owners": [
Expand All @@ -108,9 +108,9 @@
"saltNonce": "1"
}
},
"bannyverse-core-testnet": {
"projectId": "489741d5-1d97-42ee-a355-038ed56b1696",
"projectName": "bannyverse-core-testnet",
"nana-suckers-testnet": {
"projectId": "7ca25001-6003-4255-becf-f1fb5a5ae548",
"projectName": "nana-suckers-testnet",
"defaultSafe": {
"safeName": "core-test-safe",
"owners": [
Expand All @@ -123,9 +123,9 @@
"saltNonce": "1"
}
},
"nana-address-registry-testnet": {
"projectId": "30294927-9380-442f-9e6f-9caf60fa509b",
"projectName": "nana-address-registry-testnet",
"nana-721-hook-testnet": {
"projectId": "aeb85a70-c28c-488c-91c5-94c9778ae26e",
"projectName": "nana-721-hook-testnet",
"defaultSafe": {
"safeName": "core-test-safe",
"owners": [
Expand All @@ -138,9 +138,9 @@
"saltNonce": "1"
}
},
"croptop-core-testnet": {
"projectId": "cbfd9f35-b82e-4eb6-acbd-1f8118122fc0",
"projectName": "croptop-core-testnet",
"revnet-core-testnet": {
"projectId": "bedd4475-2c93-439c-8d60-5e2763cea01d",
"projectName": "revnet-core-testnet",
"defaultSafe": {
"safeName": "core-test-safe",
"owners": [
Expand Down
8 changes: 8 additions & 0 deletions src/periphery/JBDeadline1Day.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// SPDX-License-Identifier: MIT
pragma solidity 0.8.23;

import {JBDeadline} from "../JBDeadline.sol";

contract JBDeadline1Day is JBDeadline {
constructor() JBDeadline(1 days) {}
}
8 changes: 8 additions & 0 deletions src/periphery/JBDeadline3Hours.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// SPDX-License-Identifier: MIT
pragma solidity 0.8.23;

import {JBDeadline} from "../JBDeadline.sol";

contract JBDeadline3Hours is JBDeadline {
constructor() JBDeadline(3 hours) {}
}