Skip to content

Commit

Permalink
fix: add config for receipts domain (#82)
Browse files Browse the repository at this point in the history
This adds the config options, `chain_id` & `verifying_contract`,
required to contruct the EIP-712 domain used when verifying receipts.
  • Loading branch information
Theodus authored Oct 24, 2023
1 parent cae9f29 commit 1bd7650
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 3 deletions.
21 changes: 21 additions & 0 deletions service/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ pub struct Cli {
#[command(flatten)]
pub ethereum: Ethereum,
#[command(flatten)]
pub receipts: Receipts,
#[command(flatten)]
pub indexer_infrastructure: IndexerInfrastructure,
#[command(flatten)]
pub postgres: Postgres,
Expand Down Expand Up @@ -71,6 +73,25 @@ pub struct Ethereum {
pub indexer_address: Address,
}

#[derive(Clone, Debug, Args, Serialize, Deserialize, Default)]
#[group(required = true, multiple = true)]
pub struct Receipts {
#[clap(
long,
value_name = "receipts-verifier-chain-id",
env = "RECEIPTS_VERIFIER_CHAIN_ID",
help = "Scalar TAP verifier chain ID"
)]
pub receipts_verifier_chain_id: u64,
#[clap(
long,
value_name = "receipts-verifier-address",
env = "RECEIPTS_VERIFIER_ADDRESS",
help = "Scalar TAP verifier contract address"
)]
pub receipts_verifier_address: Address,
}

#[derive(Clone, Debug, Args, Serialize, Deserialize, Default)]
#[group(required = true, multiple = true)]
pub struct IndexerInfrastructure {
Expand Down
6 changes: 3 additions & 3 deletions service/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,12 +127,12 @@ async fn main() -> Result<(), std::io::Error> {
escrow_accounts,
// TODO: arguments for eip712_domain should be a config
eip712_domain! {
name: "TapManager",
name: "Scalar TAP",
version: "1",
verifying_contract: config.ethereum.indexer_address,
chain_id: config.receipts.receipts_verifier_chain_id,
verifying_contract: config.receipts.receipts_verifier_address,
},
);

// Proper initiation of server, query processor
// server health check, graph-node instance connection check
let query_processor =
Expand Down

0 comments on commit 1bd7650

Please sign in to comment.