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 new matching price feed periphery contract #235

Merged
merged 1 commit into from
Jan 23, 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
9 changes: 8 additions & 1 deletion script/DeployPeriphery.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {JBProjects} from "src/JBProjects.sol";
import {JBPrices} from "src/JBPrices.sol";
import {JBDeadline3Days} from "src/periphery/JBDeadline3Days.sol";
import {JBDeadline7Days} from "src/periphery/JBDeadline7Days.sol";
import {JBMatchingPriceFeed} from "src/periphery/JBMatchingPriceFeed.sol";
import {JBChainlinkV3PriceFeed, AggregatorV3Interface} from "src/JBChainlinkV3PriceFeed.sol";
import {JBChainlinkV3SequencerPriceFeed} from "src/JBChainlinkV3SequencerPriceFeed.sol";
import {JBRulesets} from "src/JBRulesets.sol";
Expand Down Expand Up @@ -55,6 +56,7 @@ contract DeployPeriphery is Script, Sphinx {
function deploy() public sphinx {
// Deploy the ETH/USD price feed.
IJBPriceFeed feed;
IJBPriceFeed matchingPriceFeed = new JBMatchingPriceFeed();

// Perform the deploy for L1(s).
if (block.chainid == 11_155_111) {
Expand Down Expand Up @@ -85,7 +87,12 @@ contract DeployPeriphery is Script, Sphinx {
feed = new JBChainlinkV3PriceFeed(source, 3600 seconds);
}

core.prices.addPriceFeedFor(0, uint160(JBConstants.NATIVE_TOKEN), JBCurrencyIds.USD, feed);
core.prices.addPriceFeedFor(0, uint32(uint160(JBConstants.NATIVE_TOKEN)), JBCurrencyIds.USD, feed);

// If the native asset for this chain is ether, then the conversion from native asset to ether is 1:1.
// NOTE: We need to refactor this the moment we add a chain where its native token is *NOT* ether.
// As otherwise prices for the `NATIVE_TOKEN` will be incorrect!
core.prices.addPriceFeedFor(0, uint32(uint160(JBConstants.NATIVE_TOKEN)), JBCurrencyIds.ETH, matchingPriceFeed);

// Deploy the JBDeadlines
JBDeadline3Days deadline3Days = new JBDeadline3Days{salt: DEADLINES_SALT}();
Expand Down
13 changes: 13 additions & 0 deletions src/periphery/JBMatchingPriceFeed.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// SPDX-License-Identifier: MIT
pragma solidity 0.8.23;

import {IJBPriceFeed} from "src/interfaces/IJBPriceFeed.sol";

contract JBMatchingPriceFeed is IJBPriceFeed {
constructor() {}

/// @inheritdoc IJBPriceFeed
function currentUnitPrice(uint256 decimals) public view virtual override returns (uint256) {
return 10 ** decimals;
}
}
Loading