From 61f6aa6d88eebbfe04ca1acba230bf4208f4d094 Mon Sep 17 00:00:00 2001 From: Maikol <86025070+Maikol@users.noreply.github.com> Date: Fri, 14 Jun 2024 09:45:13 -0300 Subject: [PATCH] chore: update subgraphs to use id on encoder (#24) * chore: update subgraphs to use id on encoder * chore: change to use subgraph deployment id and version --- .../json-oracle-encoder/src/abi/submitConfigABI.json | 5 +++-- crates/json-oracle-encoder/src/lib.rs | 10 ++++++---- json-encoder-web/index.ts | 5 +++-- 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/crates/json-oracle-encoder/src/abi/submitConfigABI.json b/crates/json-oracle-encoder/src/abi/submitConfigABI.json index 43cc88f..0c31657 100644 --- a/crates/json-oracle-encoder/src/abi/submitConfigABI.json +++ b/crates/json-oracle-encoder/src/abi/submitConfigABI.json @@ -3,7 +3,7 @@ "constant": false, "inputs": [ { - "name": "commitHash", + "name": "version", "type": "string" }, { @@ -14,7 +14,8 @@ {"name": "period", "type": "string"}, {"name": "gracePeriod", "type": "string"}, {"name": "supportedDataSourceKinds", "type": "string"}, - {"name": "subgraph", "type": "string"}, + {"name": "networkSubgraphDeploymentId", "type": "string"}, + {"name": "epochBlockOracleSubgraphDeploymentId", "type": "string"}, {"name": "subgraphAvailabilityManagerContract", "type": "string"}, {"name": "oracleIndex", "type": "string"} ], diff --git a/crates/json-oracle-encoder/src/lib.rs b/crates/json-oracle-encoder/src/lib.rs index 16f8bf8..e5f1be6 100644 --- a/crates/json-oracle-encoder/src/lib.rs +++ b/crates/json-oracle-encoder/src/lib.rs @@ -11,14 +11,15 @@ struct Config { period: String, grace_period: String, supported_data_source_kinds: String, - subgraph: String, + network_subgraph_deloyment_id: String, + epoch_block_oracle_subgraph_deloyment_id: String, subgraph_availability_manager_contract: String, oracle_index: String, } #[derive(Serialize, Deserialize)] struct Data { - commit_hash: String, + version: String, config: Config, } @@ -29,7 +30,7 @@ pub fn json_to_calldata(json: serde_json::Value) -> anyhow::Result> { let data: Data = serde_json::from_value(json)?; let tokens = vec![ - Token::String(data.commit_hash), + Token::String(data.version), Token::Tuple(vec![ Token::String(data.config.ipfs_concurrency), Token::String(data.config.ipfs_timeout), @@ -37,7 +38,8 @@ pub fn json_to_calldata(json: serde_json::Value) -> anyhow::Result> { Token::String(data.config.period), Token::String(data.config.grace_period), Token::String(data.config.supported_data_source_kinds), - Token::String(data.config.subgraph), + Token::String(data.config.network_subgraph_deloyment_id), + Token::String(data.config.epoch_block_oracle_subgraph_deloyment_id), Token::String(data.config.subgraph_availability_manager_contract), Token::String(data.config.oracle_index), ]), diff --git a/json-encoder-web/index.ts b/json-encoder-web/index.ts index 98c2dd8..dcf08dd 100644 --- a/json-encoder-web/index.ts +++ b/json-encoder-web/index.ts @@ -7,7 +7,7 @@ import { output } from './webpack.config'; require('notie/dist/notie.min.css'); const samplePayload = `{ - "commit_hash": "XXXXX", + "version": "v0.0.1", "config": { "ipfs_concurrency": "4", "ipfs_timeout": "10000", @@ -15,7 +15,8 @@ const samplePayload = `{ "period": "300", "grace_period": "0", "supported_data_source_kinds": "ethereum,ethereum/contract,file/ipfs,substreams,file/arweave", - "subgraph": "https://api.thegraph.com/subgraphs/name/graphprotocol/graph-network-arbitrum", + "network_subgraph_deloyment_id": "QmSWxvd8SaQK6qZKJ7xtfxCCGoRzGnoi2WNzmJYYJW9BXY", + "epoch_block_oracle_subgraph_deloyment_id": "QmQEGDTb3xeykCXLdWx7pPX3qeeGMUvHmGWP4SpMkv5QJf", "subgraph_availability_manager_contract": "CONTRACT_ADDRESS", "oracle_index": "ORACLE_INDEX" }