From cf2fa9b6d775f3bc65a2734381c6428be3aeb9cf Mon Sep 17 00:00:00 2001 From: Nabarun Date: Thu, 12 Oct 2023 11:42:37 +0530 Subject: [PATCH] Setup config to pay for watcher to indexer GQL queries --- app/data/compose/docker-compose-ponder.yml | 9 +++++---- app/data/config/ponder/ponder-start.sh | 1 + .../config/ponder/ponder.indexer.config.ts | 5 ++++- .../config/ponder/ponder.watcher.config.ts | 18 +++++++++++++++++- app/data/stacks/fixturenet-payments/stack.yml | 2 +- 5 files changed, 28 insertions(+), 7 deletions(-) diff --git a/app/data/compose/docker-compose-ponder.yml b/app/data/compose/docker-compose-ponder.yml index d86ceffa..58d702a9 100644 --- a/app/data/compose/docker-compose-ponder.yml +++ b/app/data/compose/docker-compose-ponder.yml @@ -9,8 +9,8 @@ services: environment: CERC_PONDER_CHAIN_ID: ${PONDER_CHAIN_ID:-99} CERC_PONDER_RPC_URL_1: ${PONDER_RPC_URL_1:-http://nitro-reverse-payment-proxy:8081} - CERC_PONDER_NITRO_PK: ${CERC_PONDER_NITRO_PK:-58368d20ff12f17669c06158c21d885897aa56f9be430edc789614bf9851d53f} - CERC_PONDER_NITRO_CHAIN_PK: ${CERC_PONDER_NITRO_CHAIN_PK:-fb1e9af328c283ca3e2486e7c24d13582b7912057d8b9542ff41503c85bc05c0} + CERC_PONDER_NITRO_PK: ${CERC_PONDER_INDEXER_NITRO_PK:-58368d20ff12f17669c06158c21d885897aa56f9be430edc789614bf9851d53f} + CERC_PONDER_NITRO_CHAIN_PK: ${CERC_PONDER_INDEXER_NITRO_CHAIN_PK:-fb1e9af328c283ca3e2486e7c24d13582b7912057d8b9542ff41503c85bc05c0} CERC_PONDER_NITRO_CHAIN_URL: ${CERC_PONDER_NITRO_CHAIN_URL:-http://fixturenet-eth-geth-1:8546} CERC_RELAY_MULTIADDR: ${CERC_RELAY_MULTIADDR} CERC_UPSTREAM_NITRO_ADDRESS: ${CERC_UPSTREAM_NITRO_ADDRESS:-0xAAA6628Ec44A8a742987EF3A114dDFE2D4F7aDCE} @@ -37,11 +37,12 @@ services: working_dir: /app/examples/token-erc20 environment: CERC_PONDER_CHAIN_ID: ${PONDER_CHAIN_ID:-99} - CERC_PONDER_NITRO_PK: ${CERC_PONDER_NITRO_PK:-febb3b74b0b52d0976f6571d555f4ac8b91c308dfa25c7b58d1e6a7c3f50c781} - CERC_PONDER_NITRO_CHAIN_PK: ${CERC_PONDER_NITRO_CHAIN_PK:-be4aa664815ea3bc3d63118649a733f6c96b243744310806ecb6d96359ab62cf} + CERC_PONDER_NITRO_PK: ${CERC_PONDER_WATCHER_NITRO_PK:-febb3b74b0b52d0976f6571d555f4ac8b91c308dfa25c7b58d1e6a7c3f50c781} + CERC_PONDER_NITRO_CHAIN_PK: ${CERC_PONDER_WATCHER_NITRO_CHAIN_PK:-be4aa664815ea3bc3d63118649a733f6c96b243744310806ecb6d96359ab62cf} CERC_PONDER_NITRO_CHAIN_URL: ${CERC_PONDER_NITRO_CHAIN_URL:-http://fixturenet-eth-geth-1:8546} CERC_RELAY_MULTIADDR: ${CERC_RELAY_MULTIADDR} CERC_INDEXER_GQL_ENDPOINT: ${CERC_INDEXER_GQL_ENDPOINT:-http://ponder-app-indexer:42070/graphql} + CERC_INDEXER_NITRO_PAY_AMOUNT: ${CERC_INDEXER_NITRO_PAY_AMOUNT:-50} command: ["bash", "./ponder-start.sh"] volumes: - ../config/ponder/ponder-start.sh:/app/examples/token-erc20/ponder-start.sh diff --git a/app/data/config/ponder/ponder-start.sh b/app/data/config/ponder/ponder-start.sh index 9c569ee5..8425c45b 100755 --- a/app/data/config/ponder/ponder-start.sh +++ b/app/data/config/ponder/ponder-start.sh @@ -54,6 +54,7 @@ echo "UPSTREAM_NITRO_ADDRESS=\"$CERC_UPSTREAM_NITRO_ADDRESS\"" >> "$env_file" echo "UPSTREAM_NITRO_MULTIADDR=\"$CERC_UPSTREAM_NITRO_MULTIADDR\"" >> "$env_file" echo "UPSTREAM_NITRO_PAY_AMOUNT=\"$CERC_UPSTREAM_NITRO_PAY_AMOUNT\"" >> "$env_file" echo "INDEXER_GQL_ENDPOINT=\"$CERC_INDEXER_GQL_ENDPOINT\"" >> "$env_file" +echo "INDEXER_NITRO_PAY_AMOUNT=\"$CERC_INDEXER_NITRO_PAY_AMOUNT\"" >> "$env_file" cat "$env_file" diff --git a/app/data/config/ponder/ponder.indexer.config.ts b/app/data/config/ponder/ponder.indexer.config.ts index 998a2308..ddce62d2 100644 --- a/app/data/config/ponder/ponder.indexer.config.ts +++ b/app/data/config/ponder/ponder.indexer.config.ts @@ -1,4 +1,4 @@ -import type { Config } from "@ponder/core"; +import { type Config, AppMode } from "@ponder/core"; import contractAddresses from "./nitro-addresses.json" assert { type: "json" }; @@ -39,6 +39,9 @@ export const config: Config = { maxBlockRange: 100, }, ], + options: { + mode: AppMode.Indexer, + }, nitro: { privateKey: process.env.PONDER_NITRO_PK!, chainPrivateKey: process.env.PONDER_NITRO_CHAIN_PK!, diff --git a/app/data/config/ponder/ponder.watcher.config.ts b/app/data/config/ponder/ponder.watcher.config.ts index fe0685bf..d495d966 100644 --- a/app/data/config/ponder/ponder.watcher.config.ts +++ b/app/data/config/ponder/ponder.watcher.config.ts @@ -1,4 +1,4 @@ -import type { Config } from "@ponder/core"; +import { type Config, AppMode } from "@ponder/core"; import contractAddresses from "./nitro-addresses.json" assert { type: "json" }; @@ -19,6 +19,22 @@ export const config: Config = { maxBlockRange: 100, }, ], + options: { + mode: AppMode.Watcher, + }, + indexer: { + gqlEndpoint: process.env.INDEXER_GQL_ENDPOINT, + payments: { + nitro: { + address: process.env.INDEXER_NITRO_ADDRESS, + fundingAmounts: { + directFund: "1000000000000", + virtualFund: "1000000000", + }, + }, + amount: process.env.INDEXER_NITRO_PAY_AMOUNT, + }, + }, nitro: { privateKey: process.env.PONDER_NITRO_PK!, chainPrivateKey: process.env.PONDER_NITRO_CHAIN_PK!, diff --git a/app/data/stacks/fixturenet-payments/stack.yml b/app/data/stacks/fixturenet-payments/stack.yml index ec52b577..f20cf973 100644 --- a/app/data/stacks/fixturenet-payments/stack.yml +++ b/app/data/stacks/fixturenet-payments/stack.yml @@ -18,7 +18,7 @@ repos: - github.com/cerc-io/mobymask-snap - github.com/cerc-io/mobymask-ui@v0.2.1 # ponder repo - - github.com/cerc-io/ponder@laconic-esm + - github.com/cerc-io/ponder@ng-gql-payment containers: # fixturenet images - cerc/go-ethereum