Skip to content

Commit e96eb05

Browse files
committed
feat(monitor): update get escrow accounts for v2
1 parent 48215a6 commit e96eb05

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

crates/monitor/src/escrow_accounts.rs

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ use std::{
99

1010
use anyhow::anyhow;
1111
use indexer_query::escrow_account::{self, EscrowAccountQuery};
12+
use indexer_query::escrow_account_v2::{
13+
self as escrow_account_v2, EscrowAccountQuery as EscrowAccountQueryV2,
14+
};
1215
use thegraph_core::alloy::primitives::{Address, U256};
1316
use thiserror::Error;
1417
use tokio::sync::watch::Receiver;
@@ -131,7 +134,7 @@ async fn get_escrow_accounts_v2(
131134
// 4. Service provider (indexer) receives payments from payer's escrow
132135

133136
let response = escrow_subgraph
134-
.query::<EscrowAccountQuery, _>(escrow_account::Variables {
137+
.query::<EscrowAccountQueryV2, _>(escrow_account_v2::Variables {
135138
indexer: format!("{:x?}", indexer_address),
136139
thaw_end_timestamp: if reject_thawing_signers {
137140
U256::ZERO.to_string()
@@ -156,29 +159,28 @@ async fn get_escrow_accounts_v2(
156159
.unwrap_or_else(|| {
157160
tracing::warn!(
158161
"Balance minus total amount thawing underflowed for V2 account {}. \
159-
Setting balance to 0, no V2 queries will be served for this sender.",
160-
account.sender.id
162+
Setting balance to 0, no V2 queries will be served for this payer.",
163+
account.payer.id
161164
);
162165
U256::from(0)
163166
});
164167

165-
Ok((Address::from_str(&account.sender.id)?, balance))
168+
Ok((Address::from_str(&account.payer.id)?, balance))
166169
})
167170
.collect::<Result<HashMap<_, _>, anyhow::Error>>()?;
168171

169172
let senders_to_signers = response
170173
.escrow_accounts
171174
.into_iter()
172175
.map(|account| {
173-
let sender = Address::from_str(&account.sender.id)?;
176+
let payer = Address::from_str(&account.payer.id)?;
174177
let signers = account
175-
.sender
178+
.payer
176179
.signers
177-
.ok_or(anyhow!("Could not find any signers for V2 sender {sender}"))?
178180
.iter()
179181
.map(|signer| Address::from_str(&signer.id))
180182
.collect::<Result<Vec<_>, _>>()?;
181-
Ok((sender, signers))
183+
Ok((payer, signers))
182184
})
183185
.collect::<Result<HashMap<_, _>, anyhow::Error>>()?;
184186

0 commit comments

Comments
 (0)