forked from blockful-io/swaplace-subgraph
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathswaplace.ts
50 lines (41 loc) · 1.48 KB
/
swaplace.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
import {
SwapAccepted as SwapAcceptedEvent,
SwapCanceled as SwapCanceledEvent,
SwapCreated as SwapCreatedEvent
} from "../generated/Swaplace/Swaplace"
import { SwapAccepted, SwapCanceled, SwapCreated } from "../generated/schema"
export function handleSwapAccepted(event: SwapAcceptedEvent): void {
let entity = new SwapAccepted(
event.transaction.hash.concatI32(event.logIndex.toI32())
)
entity.swapId = event.params.swapId
entity.owner = event.params.owner
entity.allowed = event.params.allowed
entity.blockNumber = event.block.number
entity.blockTimestamp = event.block.timestamp
entity.transactionHash = event.transaction.hash
entity.save()
}
export function handleSwapCanceled(event: SwapCanceledEvent): void {
let entity = new SwapCanceled(
event.transaction.hash.concatI32(event.logIndex.toI32())
)
entity.swapId = event.params.swapId
entity.owner = event.params.owner
entity.blockNumber = event.block.number
entity.blockTimestamp = event.block.timestamp
entity.transactionHash = event.transaction.hash
entity.save()
}
export function handleSwapCreated(event: SwapCreatedEvent): void {
let entity = new SwapCreated(
event.transaction.hash.concatI32(event.logIndex.toI32())
)
entity.swapId = event.params.swapId
entity.owner = event.params.owner
entity.allowed = event.params.allowed
entity.blockNumber = event.block.number
entity.blockTimestamp = event.block.timestamp
entity.transactionHash = event.transaction.hash
entity.save()
}