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

chore: update subgraphs to use id on encoder #24

Merged
merged 2 commits into from
Jun 14, 2024
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
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
Loading