diff --git a/.github/workflows/subgraph-test.yaml b/.github/workflows/subgraph-test.yaml index 9b967d724..a8ffaaacc 100644 --- a/.github/workflows/subgraph-test.yaml +++ b/.github/workflows/subgraph-test.yaml @@ -21,6 +21,9 @@ jobs: - name: Forge shallow install run: forge install --shallow + - name: Start docker container + run: docker-compose -f subgraph/docker/docker-compose.yaml up -d + - name: Initialize setup working-directory: ./subgraph run: nix run .#init-setup @@ -30,16 +33,13 @@ jobs: with: toolchain: stable - - name: Start docker container - run: docker-compose -f subgraph/docker/docker-compose.yaml up -d - - name: install npm dependencies working-directory: ./subgraph run: npm install - name: Run test working-directory: ./subgraph - run: RUST_TEST_THREADS=1 cargo test + run: nix run .#ci-test - name: Stop docker container run: docker-compose -f subgraph/docker/docker-compose.yaml down diff --git a/subgraph/.gitignore b/subgraph/.gitignore index ed2d50037..865fc8705 100644 --- a/subgraph/.gitignore +++ b/subgraph/.gitignore @@ -4,6 +4,7 @@ /subgraph.yaml /abis/*.json + # Rust generated files /tests/generated/abigen # Ignore all JSON files diff --git a/subgraph/Cargo.lock b/subgraph/Cargo.lock index f9235a0bf..d01950ca2 100644 --- a/subgraph/Cargo.lock +++ b/subgraph/Cargo.lock @@ -3308,6 +3308,7 @@ dependencies = [ "thiserror", "tiny-keccak", "tokio", + "url", "web3", ] diff --git a/subgraph/Cargo.toml b/subgraph/Cargo.toml index 8d55cafb8..0a014f64b 100644 --- a/subgraph/Cargo.toml +++ b/subgraph/Cargo.toml @@ -31,4 +31,5 @@ once_cell = "1.18.0" minicbor = "0.20.0" tiny-keccak = "2.0.2" bigdecimal = "0.4.2" +url = "2.4.1" diff --git a/subgraph/cli/deploy/mod.rs b/subgraph/cli/deploy/mod.rs new file mode 100644 index 000000000..e7c5c4f0b --- /dev/null +++ b/subgraph/cli/deploy/mod.rs @@ -0,0 +1,94 @@ +use anyhow::anyhow; +use mustache::MapBuilder; +use std::fs; +// use std::{fs, process::Command}; + +use crate::utils::run_cmd; + +use clap::Args; +use url::Url; + +#[derive(Args, Debug)] +pub struct DeployArgs { + /// Subgraph name (eg: User/SubgraphName) + #[arg(long = "name")] + pub subgraph_name: String, + + /// Endpoint URL where the subgraph will be deployed + #[arg(long)] + pub url: Url, + + /// Network that the subgraph will index + #[arg(long)] + pub network: String, + + /// Block number where the subgraph will start indexing + #[arg(long = "block")] + pub block_number: u32, + + /// Contract address that the subgraph will be indexing (Assuming one address) + #[arg(long)] + pub address: String, + + /// (Optional) Subgraph token to deploy the subgraph + #[arg(long)] + pub key: Option, +} + +pub fn deploy_subgraph(config: DeployArgs) -> anyhow::Result<()> { + if config.url.scheme() != "http" && config.url.scheme() != "https" { + return Err(anyhow!("Invalid URL provided")); + } + + let subgraph_template = "subgraph.template.yaml"; + let output_path = "subgraph.yaml"; + + let end_point = config.url.as_str(); + let subgraph_name = config.subgraph_name; + + let data = MapBuilder::new() + .insert_str("network", config.network) + .insert_str("orderbook", config.address) + .insert_str("blockNumber", config.block_number.to_string()) + .build(); + + let template = fs::read_to_string(subgraph_template)?; + let renderd = mustache::compile_str(&template)?.render_data_to_string(&data)?; + let _ = fs::write(output_path, renderd)?; + + // Generate the subgraph code + // let is_built = run_cmd("bash", &["-c", "npx graph codegen && npx graph build"]); + let is_built = run_cmd("bash", &["-c", "npx graph codegen"]); + if !is_built { + return Err(anyhow!("Failed to build subgraph")); + } + + // Create the endpoint node + let is_node_up = run_cmd( + "bash", + &[ + "-c", + &format!("npx graph create --node {} {}", end_point, subgraph_name), + ], + ); + if !is_node_up { + return Err(anyhow!("Failed to create subgraph endpoint node")); + } + + // Deploy Subgraph to the endpoint + let is_deploy = run_cmd( + "bash", + &[ + "-c", + &format!( + "npx graph deploy --node {} --ipfs http://localhost:5001 {} --version-label 1", + end_point, subgraph_name + ), + ], + ); + if !is_deploy { + return Err(anyhow!("Failed to deploy subgraph")); + } + + Ok(()) +} diff --git a/subgraph/cli/main.rs b/subgraph/cli/main.rs index 6ddfac111..05bf7e528 100644 --- a/subgraph/cli/main.rs +++ b/subgraph/cli/main.rs @@ -1,9 +1,11 @@ -use clap::{Args, Parser, Subcommand}; +// extern crate url; +mod deploy; +mod utils; +use clap::{Parser, Subcommand}; + use colored::*; -use std::env; -use std::io::{BufRead, BufReader}; -use std::process::{Command, Stdio}; -use std::thread; +use deploy::{deploy_subgraph, DeployArgs}; +use utils::run_cmd; #[derive(Parser)] #[clap(author, version, about)] @@ -21,112 +23,60 @@ pub enum Subgraph { #[command(about = "Test the rain subgraph")] Test, #[command(about = "Deploy the rain subgraph")] - Deploy(DeployCommand), -} - -#[derive(Args, Debug)] -pub struct DeployCommand { - /// Endpoint URL where the subgraph will be deployed - url: String, - /// Subgraph token to deploy the subgraph - key: String, - /// Network that the subgraph will index - network: String, - /// Block number where the subgraph will start indexing - block_number: String, - /// Contract address that the subgraph will be indexing (Assuming one address) - address: String, + Deploy(DeployArgs), } -// This function will work onthe working directory -fn run_cmd(main_cmd: &str, args: &[&str]) -> bool { - // Get the current working directory - let current_dir = env::current_dir().expect("Failed to get current directory"); - - // Create a new Command to run - let mut cmd = Command::new(main_cmd); - - // Add the arguments - cmd.args(args); - - // Set the directory from where the command wil run - cmd.current_dir(¤t_dir); - - // Tell what to do when try to print the process - cmd.stdout(Stdio::piped()); - cmd.stderr(Stdio::piped()); - - let full_cmd = format!("{} {}", main_cmd, args.join(" ")); - - println!("{} {}", "Running:".green(), full_cmd.blue()); - - // Execute the command - let mut child = cmd - .spawn() - .expect(format!("Failed to run: {}", full_cmd).as_str()); +fn main() -> Result<(), anyhow::Error> { + let args = Cli::parse(); - // Read and print stdout in a separate thread - let stdout_child = child.stdout.take().expect("Failed to get stdout"); - let stdout_reader = BufReader::new(stdout_child); + match args.subgraph { + Subgraph::Install => { + let resp = run_cmd("npm", &["install"]); - let stdout_handle = thread::spawn({ - move || { - for line in stdout_reader.lines() { - if let Ok(line) = line { - println!("{}", line); - } + if !resp { + eprintln!("{}", "Error: Failed at npm install".red()); + std::process::exit(1); } - } - }); - // Read and print stderr in the main thread - let stderr_reader = BufReader::new(child.stderr.take().expect("Failed to get stderr")); - for line in stderr_reader.lines() { - if let Ok(line) = line { - eprintln!("{}", line); + Ok(()) } - } - - // Wait for the command to finish and get the exit status - let status = child - .wait() - .expect(format!("Failed to wait: {}", full_cmd).as_str()); - - // Wait for the stdout thread to finish - stdout_handle.join().expect("Failed to join stdout thread"); - if status.success() { - println!("โœ… {} {}", full_cmd.blue(), "completed".green()); - return true; - } else { - eprintln!( - "โŒ {} {}", - full_cmd.blue(), - format!("failed with exit code: {}", status.code().unwrap_or(-1)).red() - ); - - return false; - } -} - -fn main() { - let args = Cli::parse(); + Subgraph::Build => { + let resp = run_cmd("npm", &["run", "codegen"]); + if !resp { + eprintln!("{}", "Error: Failed at npm run codegen".red()); + std::process::exit(1); + } - match args.subgraph { - Subgraph::Install => { - run_cmd("npm", &["install"]); - } + let resp = run_cmd("npm", &["run", "build"]); + if !resp { + eprintln!("{}", "Error: Failed at npm run build".red()); + std::process::exit(1); + } - Subgraph::Build => { - println!("{}", "Generating subgraph code".blue()); - run_cmd("npx", &["graph", "codegen"]); + Ok(()) } Subgraph::Test => { - println!("Hello tests ๐Ÿงช"); + let resp = run_cmd("nix", &["run", ".#ci-test"]); + if !resp { + std::process::exit(1); + } + + Ok(()) } + Subgraph::Deploy(args) => { - println!("๐Ÿš€ Hello, deploy with: {:?}", args); + match deploy_subgraph(args) { + Ok(_) => { + return Ok(()); + } + Err(err) => { + // Error occurred, print the error message and exit + eprintln!("Error: {}", err); + std::process::exit(1); + } + } } } } diff --git a/subgraph/cli/utils/mod.rs b/subgraph/cli/utils/mod.rs new file mode 100644 index 000000000..d41c871be --- /dev/null +++ b/subgraph/cli/utils/mod.rs @@ -0,0 +1,76 @@ +use colored::*; +use std::env; +use std::io::{BufRead, BufReader}; +use std::process::{Command, Stdio}; +use std::thread; + +// This function will work onthe working directory +pub fn run_cmd(main_cmd: &str, args: &[&str]) -> bool { + // Get the current working directory + let current_dir = env::current_dir().expect("Failed to get current directory"); + + // Create a new Command to run + let mut cmd = Command::new(main_cmd); + + // Add the arguments + cmd.args(args); + + // Set the directory from where the command wil run + cmd.current_dir(¤t_dir); + + // Tell what to do when try to print the process + cmd.stdout(Stdio::piped()); + cmd.stderr(Stdio::piped()); + + let full_cmd = format!("{} {}", main_cmd, args.join(" ")); + + println!("{} {}\n", "Running:".green(), full_cmd.blue()); + + // Execute the command + let mut child = cmd + .spawn() + .expect(format!("Failed to run: {}", full_cmd).as_str()); + + // Read and print stdout in a separate thread + let stdout_child = child.stdout.take().expect("Failed to get stdout"); + let stdout_reader = BufReader::new(stdout_child); + + let stdout_handle = thread::spawn({ + move || { + for line in stdout_reader.lines() { + if let Ok(line) = line { + println!("{}", line); + } + } + } + }); + + // Read and print stderr in the main thread + let stderr_reader = BufReader::new(child.stderr.take().expect("Failed to get stderr")); + for line in stderr_reader.lines() { + if let Ok(line) = line { + eprintln!("{}", line); + } + } + + // Wait for the command to finish and get the exit status + let status = child + .wait() + .expect(format!("Failed to wait: {}", full_cmd).as_str()); + + // Wait for the stdout thread to finish + stdout_handle.join().expect("Failed to join stdout thread"); + + if status.success() { + println!("โœ… {} {}\n", full_cmd.blue(), "completed".green()); + return true; + } else { + eprintln!( + "โŒ {} {}", + full_cmd.blue(), + format!("failed with exit code: {}\n", status.code().unwrap_or(-1)).red() + ); + + return false; + } +} diff --git a/subgraph/flake.nix b/subgraph/flake.nix index 12d70f931..c75efd75c 100644 --- a/subgraph/flake.nix +++ b/subgraph/flake.nix @@ -12,13 +12,10 @@ let pkgs = nixpkgs.legacyPackages.${system}; jq = "${pkgs.jq}/bin/jq"; + graphql_client = "${pkgs.graphql-client}/bin/graphql-client"; in rec { packages = rec { - install = pkgs.writeShellScriptBin "install" ("npm install"); - - build = pkgs.writeShellScriptBin "build" ("npm run codegen && npm run build"); - # ERC20Mock is not present here. It's hardcoded because It's just a ERC20 contract with a mint method. concrete-contracts = ["AuthoringMetaGetter" "OrderBook" "RainterpreterExpressionDeployerNP" "RainterpreterNP" "RainterpreterStore"]; @@ -40,6 +37,21 @@ echo Removed duplicated at: $contract_path ''; + + gen-sg-schema = '' + # Use a arbitrary address to put the endpoint up + cargo run deploy \ + --name test/test \ + --url http://localhost:8020 \ + --network localhost \ + --block 0 \ + --address 0x0000000000000000000000000000000000000000 + + ${graphql_client} introspect-schema \ + --output tests/subgraph/query/schema.json \ + http://localhost:8000/subgraphs/name/test/test + ''; + init-setup = pkgs.writeShellScriptBin "init-setup" ('' # NOTE: This should be called after `npm install` @@ -49,9 +61,14 @@ # Copying the new abis into the SG abi folder cp ../out/OrderBook.sol/OrderBook.json ./abis/ cp ../out/ERC20.sol/ERC20.json ./abis/ERC20.json - '' + pkgs.lib.concatStrings (map copy-abis concrete-contracts) + (remove-duplicate) + '' + pkgs.lib.concatStrings (map copy-abis concrete-contracts) + + (remove-duplicate) ); + run-anvil = pkgs.writeShellScriptBin "run-anvil" ('' + anvil -m "$(cat ./test-mnemonic)" + ''); + docker-up = pkgs.writeShellScriptBin "docker-up" '' docker-compose -f docker/docker-compose.yaml up --build -d ''; @@ -60,31 +77,33 @@ docker-compose -f docker/docker-compose.yaml down ''; - check-args = pkgs.writeShellScriptBin "check-args" ('' - echo "All parameters: $@" - echo "First parameter: $1" - echo "Second parameter: $2" - ''); - - run-anvil = pkgs.writeShellScriptBin "run-anvil" ('' - anvil -m "$(cat ./test-mnemonic)" - ''); - - strong-anvil = pkgs.writeShellScriptBin "strong-anvil" ('' - anvil -m "$(cat ./test-mnemonic)" --code-size-limit 36864 - ''); - end-anvil = pkgs.writeShellScriptBin "end-anvil" ('' kill -9 $(lsof -t -i :8545) ''); + # The graphql file can generate the schema.json file needed for testing + # Of course, this need a graph node at localhost to work + gen-subgraph-schema = pkgs.writeShellScriptBin "gen-subgraph-schema" ('' + # Use a arbitrary address to put the endpoint up + cargo run deploy \ + --name test/test \ + --url http://localhost:8020 \ + --network localhost \ + --block 0 \ + --address 0x0000000000000000000000000000000000000000 + + ${graphql_client} introspect-schema \ + --output tests/subgraph/query/schema.json \ + http://localhost:8000/subgraphs/name/test/test + ''); ci-test = pkgs.writeShellScriptBin "ci-test" ('' + + # Run tests in single thread cargo test -- --test-threads=1 --nocapture; ''); - default = install; - + default = init-setup; }; } ); diff --git a/subgraph/shell.nix b/subgraph/shell.nix deleted file mode 100755 index b38b38bcd..000000000 --- a/subgraph/shell.nix +++ /dev/null @@ -1,93 +0,0 @@ -`let - pkgs = import - (builtins.fetchTarball { - name = "nixos-unstable-2021-10-01"; - url = "https://github.com/nixos/nixpkgs/archive/d3d2c44a26b693293e8c79da0c3e3227fc212882.tar.gz"; - sha256 = "0vi4r7sxzfdaxzlhpmdkvkn3fjg533fcwsy3yrcj5fiyqip2p3kl"; - }) - { }; - - compile = pkgs.writeShellScriptBin "compile" '' - hardhat compile --force - ''; - - codegen = pkgs.writeShellScriptBin "codegen" '' - graph codegen - ''; - - docker-up = pkgs.writeShellScriptBin "docker-up" '' - # docker-down - # rm -rf docker/data - docker-compose -f docker/docker-compose.yaml up --build -d - ''; - - docker-down = pkgs.writeShellScriptBin "docker-down" '' - docker-compose -f docker/docker-compose.yaml down - ''; - - flush-all = pkgs.writeShellScriptBin "flush-all" '' - rm -rf cache - rm -rf node_modules - rm -rf build - rm -rf generated - rm -rf docker/data - ''; - - copy-abis = pkgs.writeShellScriptBin "copy-abis" '' - cp artifacts/contracts/orderbook/OrderBook.sol/OrderBook.json abis - cp artifacts/contracts/test/testToken/ReserveToken.sol/ReserveToken.json abis - ''; - - setup = pkgs.writeShellScriptBin "setup" '' - cp -r rain-protocol/artifacts . - cp -r rain-protocol/typechain . - copy-abis - ''; - - ci-test = pkgs.writeShellScriptBin "ci-test" '' - npx mustache config/localhost.json subgraph.template.yaml subgraph.yaml - codegen - # npx hardhat test --no-compile - cargo run --manifest-path ./Cargo.toml test - ''; - - init = pkgs.writeShellScriptBin "init" '' - npm install - ''; - - ci-prepare-subgraph-polygon = pkgs.writeShellScriptBin "ci-prepare-subgraph-polygon" '' - npx mustache config/polygon.json subgraph.template.yaml subgraph.yaml - graph codegen - graph build - ''; - - ci-prepare-subgraph-mumbai = pkgs.writeShellScriptBin "ci-prepare-subgraph-mumbai" '' - npx mustache config/mumbai.json subgraph.template.yaml subgraph.yaml - graph codegen - graph build - ''; - -in -pkgs.stdenv.mkDerivation { - name = "shell"; - buildInputs = [ - pkgs.nixpkgs-fmt - pkgs.yarn - pkgs.nodejs-16_x - ci-test - compile - codegen - docker-up - docker-down - flush-all - init - ci-prepare-subgraph-polygon - ci-prepare-subgraph-mumbai - copy-abis - setup - ]; - - shellHook = '' - export PATH=$( npm bin ):$PATH - ''; -} diff --git a/subgraph/tests/subgraph/query/schema.json b/subgraph/tests/subgraph/query/schema.json index cfe05288b..a85b01b9a 100644 --- a/subgraph/tests/subgraph/query/schema.json +++ b/subgraph/tests/subgraph/query/schema.json @@ -20,7 +20,11 @@ } ], "description": null, - "locations": ["FIELD", "FRAGMENT_SPREAD", "INLINE_FRAGMENT"], + "locations": [ + "FIELD", + "FRAGMENT_SPREAD", + "INLINE_FRAGMENT" + ], "name": "skip" }, { @@ -41,13 +45,19 @@ } ], "description": null, - "locations": ["FIELD", "FRAGMENT_SPREAD", "INLINE_FRAGMENT"], + "locations": [ + "FIELD", + "FRAGMENT_SPREAD", + "INLINE_FRAGMENT" + ], "name": "include" }, { "args": [], "description": "Marks the GraphQL type as indexable entity. Each type that should be an entity is required to be annotated with this directive.", - "locations": ["OBJECT"], + "locations": [ + "OBJECT" + ], "name": "entity" }, { @@ -68,7 +78,9 @@ } ], "description": "Defined a Subgraph ID for an object type", - "locations": ["OBJECT"], + "locations": [ + "OBJECT" + ], "name": "subgraphId" }, { @@ -89,7 +101,9 @@ } ], "description": "creates a virtual field on the entity that may be queried but cannot be set manually through the mappings API.", - "locations": ["FIELD_DEFINITION"], + "locations": [ + "FIELD_DEFINITION" + ], "name": "derivedFrom" } ], @@ -7617,22 +7631,6 @@ } } }, - { - "args": [], - "deprecationReason": null, - "description": "Base contract", - "isDeprecated": false, - "name": "contract", - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "OrderBook", - "ofType": null - } - } - }, { "args": [], "deprecationReason": null, @@ -7834,13 +7832,7 @@ } ], "inputFields": null, - "interfaces": [ - { - "kind": "INTERFACE", - "name": "Event", - "ofType": null - } - ], + "interfaces": [], "kind": "OBJECT", "name": "ContextEntity", "possibleTypes": null @@ -8172,232 +8164,6 @@ "ofType": null } }, - { - "defaultValue": null, - "description": null, - "name": "contract", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - }, - { - "defaultValue": null, - "description": null, - "name": "contract_not", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - }, - { - "defaultValue": null, - "description": null, - "name": "contract_gt", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - }, - { - "defaultValue": null, - "description": null, - "name": "contract_lt", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - }, - { - "defaultValue": null, - "description": null, - "name": "contract_gte", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - }, - { - "defaultValue": null, - "description": null, - "name": "contract_lte", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - }, - { - "defaultValue": null, - "description": null, - "name": "contract_in", - "type": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - } - } - }, - { - "defaultValue": null, - "description": null, - "name": "contract_not_in", - "type": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - } - } - }, - { - "defaultValue": null, - "description": null, - "name": "contract_contains", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - }, - { - "defaultValue": null, - "description": null, - "name": "contract_contains_nocase", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - }, - { - "defaultValue": null, - "description": null, - "name": "contract_not_contains", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - }, - { - "defaultValue": null, - "description": null, - "name": "contract_not_contains_nocase", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - }, - { - "defaultValue": null, - "description": null, - "name": "contract_starts_with", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - }, - { - "defaultValue": null, - "description": null, - "name": "contract_starts_with_nocase", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - }, - { - "defaultValue": null, - "description": null, - "name": "contract_not_starts_with", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - }, - { - "defaultValue": null, - "description": null, - "name": "contract_not_starts_with_nocase", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - }, - { - "defaultValue": null, - "description": null, - "name": "contract_ends_with", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - }, - { - "defaultValue": null, - "description": null, - "name": "contract_ends_with_nocase", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - }, - { - "defaultValue": null, - "description": null, - "name": "contract_not_ends_with", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - }, - { - "defaultValue": null, - "description": null, - "name": "contract_not_ends_with_nocase", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - }, - { - "defaultValue": null, - "description": null, - "name": "contract_", - "type": { - "kind": "INPUT_OBJECT", - "name": "OrderBook_filter", - "ofType": null - } - }, { "defaultValue": null, "description": null, @@ -9561,30 +9327,6 @@ "isDeprecated": false, "name": "caller__id" }, - { - "deprecationReason": null, - "description": null, - "isDeprecated": false, - "name": "contract" - }, - { - "deprecationReason": null, - "description": null, - "isDeprecated": false, - "name": "contract__id" - }, - { - "deprecationReason": null, - "description": null, - "isDeprecated": false, - "name": "contract__deployer" - }, - { - "deprecationReason": null, - "description": null, - "isDeprecated": false, - "name": "contract__address" - }, { "deprecationReason": null, "description": null, @@ -10782,11 +10524,6 @@ "kind": "OBJECT", "name": "TakeOrderEntity", "ofType": null - }, - { - "kind": "OBJECT", - "name": "ContextEntity", - "ofType": null } ] }, @@ -40452,4 +40189,4 @@ ] } } -} +} \ No newline at end of file diff --git a/subgraph/tests/utils/events.rs b/subgraph/tests/utils/events.rs index 61515f716..40c631008 100644 --- a/subgraph/tests/utils/events.rs +++ b/subgraph/tests/utils/events.rs @@ -382,8 +382,7 @@ pub async fn get_context_event( } } - -pub async fn get_context_events( +pub async fn _get_context_events( contract: &OrderBook, Wallet>>, tx_hash: &TxHash, ) -> Result> { @@ -408,4 +407,3 @@ pub async fn get_context_events( None => return Err(Error::msg("events not found")), } } - diff --git a/subgraph/tests/utils/transactions/mod.rs b/subgraph/tests/utils/transactions/mod.rs index 8ea0e6869..85830fdf6 100644 --- a/subgraph/tests/utils/transactions/mod.rs +++ b/subgraph/tests/utils/transactions/mod.rs @@ -14,7 +14,6 @@ use ethers::{ signers::{Signer, Wallet}, types::{Address, Block, Bytes, TxHash, H256, U256}, }; -use hex::FromHex; use super::{get_provider, get_wallet, hash_keccak};