Skip to content

Commit

Permalink
Removed amount from Event entity, updated mapping entities in subgrap…
Browse files Browse the repository at this point in the history
…h.yaml
  • Loading branch information
ioay committed Apr 24, 2024
1 parent 93ca0d1 commit 56633d0
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 6 deletions.
1 change: 0 additions & 1 deletion subgraph/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -47,5 +47,4 @@ type Event @entity {
timestamp: BigInt!
activity: ActivityData
type: EventType!
amount: BigInt!
}
3 changes: 1 addition & 2 deletions subgraph/src/bitcoin-depositor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ export function handleDepositInitialized(event: DepositInitializedEvent): void {

eventEntity.activity = depositEntity.id
eventEntity.timestamp = event.block.timestamp
eventEntity.amount = event.params.initialAmount
eventEntity.type = "Initialized"

depositOwnerEntity.save()
Expand All @@ -41,9 +40,9 @@ export function handleDepositFinalized(event: DepositFinalizedEvent): void {
depositEntity.amountToDeposit = event.params.bridgedAmount

const eventEntity = getOrCreateEvent(event.transaction.hash.toHexString())

eventEntity.activity = depositEntity.id
eventEntity.timestamp = event.block.timestamp
eventEntity.amount = event.params.initialAmount
eventEntity.type = "Finalized"

depositEntity.save()
Expand Down
2 changes: 1 addition & 1 deletion subgraph/subgraph.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ dataSources:
- DepositOwner
- Deposit
- Withdraw
- LogData
- Event
abis:
- name: BitcoinDepositor
file: ./abis/BitcoinDepositor.json
Expand Down
2 changes: 0 additions & 2 deletions subgraph/tests/bitcoin-depositor.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@ describe("handleDepositInitialized", () => {
depositInitializedEvent.block.timestamp.toString(),
)

assert.fieldEquals("Event", txId, "amount", initialAmount.toString())
assert.fieldEquals("Event", txId, "type", "Initialized")
})
})
Expand Down Expand Up @@ -152,7 +151,6 @@ describe("handleDepositFinalized", () => {
depositFinalizedEvent.block.timestamp.toString(),
)

assert.fieldEquals("Event", txId, "amount", initialAmount.toString())
assert.fieldEquals("Event", txId, "type", "Finalized")
})
})

0 comments on commit 56633d0

Please sign in to comment.