Skip to content

Commit

Permalink
chore: update subgraphs to use id on encoder (#24)
Browse files Browse the repository at this point in the history
* chore: update subgraphs to use id on encoder

* chore: change to use subgraph deployment id and version
  • Loading branch information
Maikol committed Jun 14, 2024
1 parent 9ec581d commit 61f6aa6
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
5 changes: 3 additions & 2 deletions crates/json-oracle-encoder/src/abi/submitConfigABI.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"constant": false,
"inputs": [
{
"name": "commitHash",
"name": "version",
"type": "string"
},
{
Expand All @@ -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"}
],
Expand Down
10 changes: 6 additions & 4 deletions crates/json-oracle-encoder/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}

Expand All @@ -29,15 +30,16 @@ pub fn json_to_calldata(json: serde_json::Value) -> anyhow::Result<Vec<u8>> {
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),
Token::String(data.config.min_signal),
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),
]),
Expand Down
5 changes: 3 additions & 2 deletions json-encoder-web/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,16 @@ 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",
"min_signal": "100",
"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"
}
Expand Down

0 comments on commit 61f6aa6

Please sign in to comment.