Skip to content

Commit

Permalink
update subgraph
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaoch05 committed Jan 26, 2024
1 parent 4dea42f commit 01c38c9
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 6 deletions.
6 changes: 3 additions & 3 deletions apollo/.env.test
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@ LN_ARBITRUM_DEFAULT_ENDPOINT = https://api.studio.thegraph.com/query/61328/ln-de
LN_ARBITRUM_OPPOSITE_ENDPOINT = https://api.studio.thegraph.com/query/61328/ln-opposite-arbisepolia/version/latest
LN_ZKSYNC_DEFAULT_ENDPOINT = https://api.studio.thegraph.com/query/61328/ln-default-zksepolia/version/latest

ETHEREUM_LNV3_ENDPOINT=https://api.studio.thegraph.com/query/61328/lnv3-sepolia/v1.0.3
ARBITRUM_LNV3_ENDPOINT=https://api.studio.thegraph.com/query/61328/lnv3-arbitrum-sepolia/v1.0.3
ZKSYNC_LNV3_ENDPOINT=https://api.studio.thegraph.com/query/61328/lnv3-zksepolia/v1.0.3
ETHEREUM_LNV3_ENDPOINT=https://api.studio.thegraph.com/query/61328/lnv3-sepolia/v1.0.5
ARBITRUM_LNV3_ENDPOINT=https://api.studio.thegraph.com/query/61328/lnv3-arbitrum-sepolia/v1.0.5
ZKSYNC_LNV3_ENDPOINT=https://api.studio.thegraph.com/query/61328/lnv3-zksepolia/v1.0.5
6 changes: 3 additions & 3 deletions apollo/src/aggregation/aggregation.resolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@ export class AggregationResolver {
const isValid = (item) =>
!Object.values(item).some((value) => isUndefined(value) || isNull(value) || value === '');

const accFilters = [{ sender: sender.toLowerCase() }, { recipient }].filter(isValid);
const relayerFilters = [{ relayer: relayer.toLowerCase() }, { needWithdrawLiquidity }].filter(isValid);
const accFilters = [{ sender: sender?.toLowerCase() }, { recipient }].filter(isValid);
const relayerFilters = [{ relayer: relayer?.toLowerCase() }, { needWithdrawLiquidity }].filter(isValid);
const accountCondition = accFilters.length ? { OR: accFilters } : {};
const relayerCondition = relayerFilters.length ? { AND: relayerFilters } : {};
const resultCondition = results && results.length ? { result: { in: results } } : {};
Expand All @@ -89,7 +89,7 @@ export class AggregationResolver {
const toChainCondition = toChains && toChains.length ? { toChain: { in: toChains } } : {};
const bridgeCondition = bridges && bridges.length ? { bridge: { in: bridges } } : {};
const recvTokenCondition =
recvTokenAddress && recvTokenAddress.length ? { recvTokenAddress: recvTokenAddress.toLowerCase() } : {};
recvTokenAddress && recvTokenAddress.length ? { recvTokenAddress: recvTokenAddress?.toLowerCase() } : {};
const chainConditions = {
AND: {
...resultCondition,
Expand Down
1 change: 1 addition & 0 deletions subgraph/lnv3/generate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ dataSources:
handler: handleSlashRequest
- event: TransferFilled(bytes32,address)
handler: handleTransferFilled
receipt: true
- event: LnProviderPaused(address,uint256,address,address,bool)
handler: handleLnProviderPaused
- event: LiquidityWithdrawn(bytes32[],address,uint256)
Expand Down
1 change: 1 addition & 0 deletions subgraph/lnv3/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ type Lnv3RelayRecord @entity {
relayer: Bytes!
transactionHash: Bytes!
timestamp: BigInt!
fee: BigInt
slashed: Boolean!
requestWithdrawTimestamp: BigInt
}
Expand Down
1 change: 1 addition & 0 deletions subgraph/lnv3/src/HelixLnBridgeV3.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ export function handleTransferFilled(event: TransferFilled): void {
entity.relayer = event.params.provider;
entity.transactionHash = event.transaction.hash;
entity.slashed = false;
entity.fee = event.receipt!.gasUsed * event.transaction.gasPrice;
entity.save();
}

Expand Down

0 comments on commit 01c38c9

Please sign in to comment.