-
Notifications
You must be signed in to change notification settings - Fork 78
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into bean-ui-stalk-loss
- Loading branch information
Showing
66 changed files
with
80,136 additions
and
16,416 deletions.
There are no files selected for viewing
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
34 changes: 17 additions & 17 deletions
34
projects/subgraph-wells/package.json → projects/subgraph-basin/package.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import { Shift, Swap } from "../../generated/templates/Well/Well"; | ||
import { Swap as SwapEvent } from "../../generated/schema"; | ||
import { Address, BigInt } from "@graphprotocol/graph-ts"; | ||
|
||
export function recordSwapEvent(event: Swap): void { | ||
let swap = new SwapEvent(event.transaction.hash.toHexString() + "-" + event.logIndex.toString()); | ||
let receipt = event.receipt; | ||
|
||
swap.hash = event.transaction.hash; | ||
swap.nonce = event.transaction.nonce; | ||
swap.logIndex = event.logIndex.toI32(); | ||
swap.gasLimit = event.transaction.gasLimit; | ||
if (receipt !== null) { | ||
swap.gasUsed = receipt.gasUsed; | ||
} | ||
swap.gasPrice = event.transaction.gasPrice; | ||
swap.eventType = "SWAP"; | ||
swap.account = event.transaction.from; | ||
swap.well = event.address; | ||
swap.blockNumber = event.block.number; | ||
swap.timestamp = event.block.timestamp; | ||
swap.fromToken = event.params.fromToken; | ||
swap.amountIn = event.params.amountIn; | ||
swap.toToken = event.params.toToken; | ||
swap.amountOut = event.params.amountOut; | ||
swap.save(); | ||
} | ||
|
||
export function recordShiftEvent(event: Shift, fromToken: Address, amountIn: BigInt): void { | ||
let swap = new SwapEvent(event.transaction.hash.toHexString() + "-" + event.logIndex.toString()); | ||
let receipt = event.receipt; | ||
|
||
swap.hash = event.transaction.hash; | ||
swap.nonce = event.transaction.nonce; | ||
swap.logIndex = event.logIndex.toI32(); | ||
swap.gasLimit = event.transaction.gasLimit; | ||
if (receipt !== null) { | ||
swap.gasUsed = receipt.gasUsed; | ||
} | ||
swap.gasPrice = event.transaction.gasPrice; | ||
swap.eventType = "SHIFT"; | ||
swap.account = event.transaction.from; | ||
swap.well = event.address; | ||
swap.blockNumber = event.block.number; | ||
swap.timestamp = event.block.timestamp; | ||
swap.fromToken = fromToken; | ||
swap.amountIn = amountIn; | ||
swap.toToken = event.params.toToken; | ||
swap.amountOut = event.params.amountOut; | ||
swap.save(); | ||
} |
Oops, something went wrong.