Skip to content

Commit 9692685

Browse files
authored
Merge pull request #54 from ianlapham/master
update liquidity provider count, add swap.from
2 parents 8832740 + a9ba250 commit 9692685

File tree

3 files changed

+3
-0
lines changed

3 files changed

+3
-0
lines changed

schema.graphql

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,7 @@ type Swap @entity {
196196

197197
# populated from the Swap event
198198
sender: Bytes!
199+
from: Bytes! # the EOA that initiated the txn
199200
amount0In: BigDecimal!
200201
amount1In: BigDecimal!
201202
amount0Out: BigDecimal!

src/mappings/core.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -488,6 +488,7 @@ export function handleSwap(event: Swap): void {
488488
swap.amount0Out = amount0Out
489489
swap.amount1Out = amount1Out
490490
swap.to = event.params.to
491+
swap.from = event.transaction.from
491492
swap.logIndex = event.logIndex
492493
// use the tracked amount if we have it
493494
swap.amountUSD = trackedAmountUSD === ZERO_BD ? derivedAmountUSD : trackedAmountUSD

src/mappings/helpers.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,7 @@ export function createLiquidityPosition(exchange: Address, user: Address): Liqui
153153
liquidityTokenBalance.pair = exchange.toHexString()
154154
liquidityTokenBalance.user = user.toHexString()
155155
liquidityTokenBalance.save()
156+
pair.save()
156157
}
157158
if (liquidityTokenBalance === null) log.error('LiquidityTokenBalance is null', [id])
158159
return liquidityTokenBalance as LiquidityPosition

0 commit comments

Comments
 (0)