Skip to content

Commit 23e87b5

Browse files
committed
fix spot price again
1 parent c531773 commit 23e87b5

File tree

2 files changed

+11
-12
lines changed

2 files changed

+11
-12
lines changed

src/mappings/pool.ts

+5-6
Original file line numberDiff line numberDiff line change
@@ -146,11 +146,9 @@ export function handleSwap(event: LOG_SWAP): void {
146146
poolTx.baseToken = tokenOut.id
147147
poolTx.baseTokenValue = ammountOut.neg()
148148

149-
spotPrice = weiToDecimal(
150-
event.params.newSpotPrice.toBigDecimal(),
151-
tokenOut.decimals
149+
spotPrice = decimal.ONE.div(
150+
weiToDecimal(event.params.newSpotPrice.toBigDecimal(), tokenOut.decimals)
152151
)
153-
154152
pool.baseTokenLiquidity = tokenOutNewBalance
155153
poolSnapshot.swapVolume = poolSnapshot.swapVolume.plus(ammountOut)
156154

@@ -172,8 +170,9 @@ export function handleSwap(event: LOG_SWAP): void {
172170
poolTx.baseToken = tokenIn.id
173171
poolTx.baseTokenValue = ammountIn
174172

175-
spotPrice = decimal.ONE.div(
176-
weiToDecimal(event.params.newSpotPrice.toBigDecimal(), tokenOut.decimals)
173+
spotPrice = weiToDecimal(
174+
event.params.newSpotPrice.toBigDecimal(),
175+
tokenOut.decimals
177176
)
178177
pool.baseTokenLiquidity = tokenInNewBalance
179178
poolSnapshot.swapVolume = poolSnapshot.swapVolume.plus(ammountIn)

subgraph.yaml

+6-6
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ dataSources:
88
name: ERC721Factory
99
network: rinkeby
1010
source:
11-
address: '0x548fd8639eC4Add192f12FC5c3EF6Dd80e1634ce'
11+
address: '0x6eb0184B64f22fB5e1316221E1eC84988F9E6b12'
1212
abi: ERC721Factory
13-
startBlock: 10364536
13+
startBlock: 10422197
1414
mapping:
1515
kind: ethereum/events
1616
apiVersion: 0.0.6
@@ -24,7 +24,7 @@ dataSources:
2424
- name: ERC20
2525
file: ./abis/ERC20.json
2626
eventHandlers:
27-
- event: NFTCreated(indexed address,indexed address,string,address,string,string)
27+
- event: NFTCreated(address,indexed address,string,indexed address,string,string,bool,indexed address)
2828
handler: handleNftCreated
2929
- event: TokenCreated(indexed address,indexed address,string,string,uint256,address)
3030
handler: handleNewToken
@@ -33,9 +33,9 @@ dataSources:
3333
name: FactoryRouter
3434
network: rinkeby
3535
source:
36-
address: '0xfe1a9F07718b40071F4c8d0f4bA22121dD5C0559'
36+
address: '0xF1Ef3C2332E44bdA219D9155E9a97201a1b5eC1C'
3737
abi: FactoryRouter
38-
startBlock: 10364536
38+
startBlock: 10422197
3939
mapping:
4040
kind: ethereum/events
4141
apiVersion: 0.0.6
@@ -134,7 +134,7 @@ templates:
134134
- name: ERC20
135135
file: ./abis/ERC20.json
136136
eventHandlers:
137-
- event: LOG_SWAP(indexed address,indexed address,indexed address,uint256,uint256,uint256)
137+
- event: LOG_SWAP(indexed address,indexed address,indexed address,uint256,uint256,uint256,uint256,uint256,uint256)
138138
handler: handleSwap
139139
- event: LOG_JOIN(indexed address,indexed address,uint256,uint256)
140140
handler: handleJoin

0 commit comments

Comments
 (0)