Skip to content

Commit

Permalink
switch to using chainlinkRelayerWithL2Validity interface. still not s…
Browse files Browse the repository at this point in the history
…ure which relayer factory to use.
  • Loading branch information
MrDeadCe11 committed Jun 28, 2024
1 parent 4ebeef3 commit 4ca972e
Show file tree
Hide file tree
Showing 7 changed files with 174 additions and 18 deletions.
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"solidity.compileUsingRemoteVersion": "latest"
"solidity.compileUsingRemoteVersion": "v0.8.20+commit.a1b79de6"
}
22 changes: 15 additions & 7 deletions gov-input/mainnet/new-DeployChainlinkRelayer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,25 @@
"proposalType": "DeployChainlinkRelayers",
"ODGovernor_Address": "",
"ChainlinkRelayerFactory_Address": "",
"ChainlinkSequencerFeed": "0xFdB631F5EE196F0ed6FAa767959853A9F217697D",
"objectArray": [
{
"symbol": "LINK/USD",
"chainlinkFeed": "0x86E53CF1B870786351Da77A57575e79CB55812CB",
"oracleInterval": "86400"
"chainlinkPriceFeed": "0x86E53CF1B870786351Da77A57575e79CB55812CB",
"staleThreshold": "86400",
"gracePeriod": "3600"
},
{
"symbol": "GRT/USD",
"chainlinkFeed": "0x0F38D86FceF4955B705F35c9e41d1A16e0637c73",
"oracleInterval": "86400"
"chainlinkPriceFeed": "0x0F38D86FceF4955B705F35c9e41d1A16e0637c73",
"staleThreshold": "86400",
"gracePeriod": "3600"
},
{
"symbol": "ETH/USD",
"chainlinkPriceFeed": "0x639Fe6ab55C921f74e7fac1ee960C0B6293ba612",
"staleThreshold": "86400",
"gracePeriod": "3600"
}
],
"arrayLength": "2"
}
]
}
10 changes: 7 additions & 3 deletions gov-input/sepolia/new-DeployChainlinkRelayer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,25 @@
"proposalType": "DeployChainlinkRelayers",
"ODGovernor_Address": "",
"ChainlinkRelayerFactory_Address": "",
"ChainlinkSequencerFeed": "0xFdB631F5EE196F0ed6FAa767959853A9F217697D",
"objectArray": [
{
"symbol": "LINK/USD",
"chainlinkPriceFeed": "0x86E53CF1B870786351Da77A57575e79CB55812CB",
"oracleInterval": "86400"
"staleThreshold": "86400",
"gracePeriod": "3600"
},
{
"symbol": "GRT/USD",
"chainlinkPriceFeed": "0x0F38D86FceF4955B705F35c9e41d1A16e0637c73",
"oracleInterval": "86400"
"staleThreshold": "86400",
"gracePeriod": "3600"
},
{
"symbol": "ETH/USD",
"chainlinkPriceFeed": "0x639Fe6ab55C921f74e7fac1ee960C0B6293ba612",
"oracleInterval": "86400"
"staleThreshold": "86400",
"gracePeriod": "3600"
}
],
"arrayLength": "3",
Expand Down
61 changes: 61 additions & 0 deletions gov-output/sepolia/deploy-chainlink-relayer-61857469.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
{
"ChainlinkRelayerFactory_Address": "0x555691C860015a5CE8748296fbbAa624410F55A4",
"ChainlinkSequencerFeed": "0xFdB631F5EE196F0ed6FAa767959853A9F217697D",
"ODGovernor_Address": "0x69ae232E574352232aB8678869eAA3BEBd885211",
"PredictedRelayerAddresses": [
{
"symbol": "LINK/USD",
"address": "0x3Dc02C28D29D6A4D13dE03E7c596a94c76f7600a"
},
{
"symbol": "GRT/USD",
"address": "0xf589519a17bDC25749AFAcbC6BAFdd05BF5d24Af"
},
{
"symbol": "ETH/USD",
"address": "0x33660aB6E38F6D8011Eca7AAa6F3CC7ef6380d91"
}
],
"arrayLength": "3",
"calldatas": [
"0x251ad9a500000000000000000000000086e53cf1b870786351da77a57575e79cb55812cb000000000000000000000000fdb631f5ee196f0ed6faa767959853a9f217697d00000000000000000000000000000000000000000000000000000000000151800000000000000000000000000000000000000000000000000000000000000e10",
"0x251ad9a50000000000000000000000000f38d86fcef4955b705f35c9e41d1a16e0637c73000000000000000000000000fdb631f5ee196f0ed6faa767959853a9f217697d00000000000000000000000000000000000000000000000000000000000151800000000000000000000000000000000000000000000000000000000000000e10",
"0x251ad9a5000000000000000000000000639fe6ab55c921f74e7fac1ee960c0b6293ba612000000000000000000000000fdb631f5ee196f0ed6faa767959853a9f217697d00000000000000000000000000000000000000000000000000000000000151800000000000000000000000000000000000000000000000000000000000000e10"
],
"chainid": 421614,
"description": "Deploy new chainlink relayers",
"descriptionHash": "0x03087660ad65289d7f9f35887f72e304a35460e94606f1c40d6d3884e0e36a4c",
"network": "sepolia",
"objectArray": [
{
"symbol": "LINK/USD",
"chainlinkPriceFeed": "0x86E53CF1B870786351Da77A57575e79CB55812CB",
"staleThreshold": "86400",
"gracePeriod": "3600"
},
{
"symbol": "GRT/USD",
"chainlinkPriceFeed": "0x0F38D86FceF4955B705F35c9e41d1A16e0637c73",
"staleThreshold": "86400",
"gracePeriod": "3600"
},
{
"symbol": "ETH/USD",
"chainlinkPriceFeed": "0x639Fe6ab55C921f74e7fac1ee960C0B6293ba612",
"staleThreshold": "86400",
"gracePeriod": "3600"
}
],
"proposalId": 61857469553398489852308972851954168900597935201047788453491803085690968636070,
"proposalType": "DeployChainlinkRelayers",
"targets": [
"0x555691C860015a5CE8748296fbbAa624410F55A4",
"0x555691C860015a5CE8748296fbbAa624410F55A4",
"0x555691C860015a5CE8748296fbbAa624410F55A4"
],
"values": [
0,
0,
0
]
}
57 changes: 57 additions & 0 deletions gov-output/sepolia/deploy-chainlink-relayer-89905853.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
{
"ChainlinkRelayerFactory_Address": "0x555691C860015a5CE8748296fbbAa624410F55A4",
"ODGovernor_Address": "0x69ae232E574352232aB8678869eAA3BEBd885211",
"PredictedRelayerAddresses": [
{
"symbol": "LINK/USD",
"address": "0x3Dc02C28D29D6A4D13dE03E7c596a94c76f7600a"
},
{
"symbol": "GRT/USD",
"address": "0xf589519a17bDC25749AFAcbC6BAFdd05BF5d24Af"
},
{
"symbol": "ETH/USD",
"address": "0x33660aB6E38F6D8011Eca7AAa6F3CC7ef6380d91"
}
],
"arrayLength": "3",
"calldatas": [
"0x0e880baf00000000000000000000000086e53cf1b870786351da77a57575e79cb55812cb0000000000000000000000000000000000000000000000000000000000015180",
"0x0e880baf0000000000000000000000000f38d86fcef4955b705f35c9e41d1a16e0637c730000000000000000000000000000000000000000000000000000000000015180",
"0x0e880baf000000000000000000000000639fe6ab55c921f74e7fac1ee960c0b6293ba6120000000000000000000000000000000000000000000000000000000000015180"
],
"chainid": 421614,
"description": "Deploy new chainlink relayers",
"descriptionHash": "0x03087660ad65289d7f9f35887f72e304a35460e94606f1c40d6d3884e0e36a4c",
"network": "sepolia",
"objectArray": [
{
"symbol": "LINK/USD",
"chainlinkPriceFeed": "0x86E53CF1B870786351Da77A57575e79CB55812CB",
"oracleInterval": "86400"
},
{
"symbol": "GRT/USD",
"chainlinkPriceFeed": "0x0F38D86FceF4955B705F35c9e41d1A16e0637c73",
"oracleInterval": "86400"
},
{
"symbol": "ETH/USD",
"chainlinkPriceFeed": "0x639Fe6ab55C921f74e7fac1ee960C0B6293ba612",
"oracleInterval": "86400"
}
],
"proposalId": 89905853856568703090559033767978405054476072179378790781042789157140266282505,
"proposalType": "DeployChainlinkRelayers",
"targets": [
"0x555691C860015a5CE8748296fbbAa624410F55A4",
"0x555691C860015a5CE8748296fbbAa624410F55A4",
"0x555691C860015a5CE8748296fbbAa624410F55A4"
],
"values": [
0,
0,
0
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@ pragma solidity 0.8.20;

import {JSONScript} from '../helpers/JSONScript.s.sol';
import {ODGovernor} from '@opendollar/contracts/gov/ODGovernor.sol';
import {IERC20} from '@openzeppelin/token/ERC20/IERC20.sol';
import {Generator} from '../Generator.s.sol';
import {Strings} from '@openzeppelin/utils/Strings.sol';
import {IChainlinkRelayerFactory} from '@opendollar/interfaces/factories/IChainlinkRelayerFactory.sol';
import {IChainlinkRelayerFactory} from '../interfaces/IChainlinkRelayerFactory.sol';
import 'forge-std/StdJson.sol';

/// @title GenerateDeployChainlinkRelayersProposal Script
Expand All @@ -19,29 +18,34 @@ contract GenerateDeployChainlinkRelayersProposal is Generator, JSONScript {
string public description;
address public governanceAddress;
address public chainlinkRelayerFactory;
address public chainlinkSequencerFeed;
address[] public chainlinkFeed;
uint256[] public oracleInterval;
uint256[] public staleThreshold;
uint256[] public gracePeriod;

function _loadBaseData(string memory json) internal override {
governanceAddress = json.readAddress(string(abi.encodePacked('.ODGovernor_Address:')));
description = json.readString(string(abi.encodePacked('.description')));
chainlinkRelayerFactory = json.readAddress(string(abi.encodePacked('.ChainlinkRelayerFactory_Address')));
chainlinkSequencerFeed = json.readAddress(string(abi.encodePacked('.ChainlinkSequencerFeed')));
uint256 len = json.readUint(string(abi.encodePacked('.arrayLength')));

for (uint256 i; i < len; i++) {
string memory index = Strings.toString(i);
address feed = json.readAddress(string(abi.encodePacked('.objectArray[', index, '].chainlinkPriceFeed')));
uint256 interval = json.readUint(string(abi.encodePacked('.objectArray[', index, '].oracleInterval')));
uint256 interval = json.readUint(string(abi.encodePacked('.objectArray[', index, '].staleThreshold')));
uint256 grace = json.readUint(string(abi.encodePacked('.objectArray[', index, '].gracePeriod')));
chainlinkFeed.push(feed);
oracleInterval.push(interval);
staleThreshold.push(interval);
gracePeriod.push(grace);
}
}

function _generateProposal() internal override {
ODGovernor gov = ODGovernor(payable(governanceAddress));

uint256 len = chainlinkFeed.length;
require(len == oracleInterval.length, 'CHAINLINK RELAYER: mismatched array lengths');
require(len == staleThreshold.length, 'CHAINLINK RELAYER: mismatched array lengths');

address[] memory targets = new address[](len);
uint256[] memory values = new uint256[](len);
Expand All @@ -50,7 +54,11 @@ contract GenerateDeployChainlinkRelayersProposal is Generator, JSONScript {
for (uint256 i = 0; i < len; i++) {
// encode relayer factory function data
calldatas[i] = abi.encodeWithSelector(
IChainlinkRelayerFactory.deployChainlinkRelayer.selector, chainlinkFeed[i], oracleInterval[i]
IChainlinkRelayerFactory.deployChainlinkRelayerWithL2Validity.selector,
chainlinkFeed[i],
chainlinkSequencerFeed,
staleThreshold[i],
gracePeriod[i]
);
targets[i] = chainlinkRelayerFactory;
values[i] = 0; // value is always 0
Expand Down
18 changes: 18 additions & 0 deletions src/contracts/interfaces/IChainlinkRelayerFactory.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// SPDX-License-Identifier: GPL-3.0
pragma solidity 0.8.20;

import {IBaseOracle} from '@opendollar/interfaces/oracles/IBaseOracle.sol';

interface IChainlinkRelayerFactory {
// --- Events ---
event NewChainlinkRelayer(address indexed _chainlinkRelayer, address _aggregator, uint256 _staleThreshold);

function deployChainlinkRelayer(address _aggregator, uint256 _staleThreshold) external returns (IBaseOracle _relayer);

function deployChainlinkRelayerWithL2Validity(
address _priceAggregator,
address _sequencerAggregator,
uint256 _staleThreshold,
uint256 _gracePeriod
) external returns (IBaseOracle _chainlinkRelayer);
}

0 comments on commit 4ca972e

Please sign in to comment.