Skip to content

Commit

Permalink
Removed StakeRequestInitialized entity
Browse files Browse the repository at this point in the history
  • Loading branch information
ioay committed Apr 17, 2024
1 parent 7a58df6 commit c779aab
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 24 deletions.
10 changes: 0 additions & 10 deletions subgraph/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,6 @@ interface ActivityData {
logs: [LogData!]
}

type StakeRequestInitialized @entity {
id: ID!
depositKey: BigInt! # uint256
caller: Bytes! # address
staker: Bytes! # address
blockNumber: BigInt!
blockTimestamp: BigInt!
transactionHash: Bytes!
}

type Staker @entity {
# Id is the ethereum address of the account.
id: ID!
Expand Down
16 changes: 2 additions & 14 deletions subgraph/src/acre-bitcoin-depositor.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
import { StakeRequestInitialized as StakeRequestInitializedEvent } from "../generated/AcreBitcoinDepositor/AcreBitcoinDepositor"
import { Stake, StakeRequestInitialized } from "../generated/schema"
import { Stake } from "../generated/schema"
import { getOrCreateStaker, getOrCreateLog } from "./utils"

// eslint-disable-next-line import/prefer-default-export
export function handleStakeRequestInitialized(
event: StakeRequestInitializedEvent,
): void {
const entity = new StakeRequestInitialized(
event.transaction.hash.toHexString(),
)
const stakeEntity = new Stake(event.transaction.hash.toHexString())
const stakerEntity = getOrCreateStaker(event.params.staker)
const stakeEntity = new Stake(event.transaction.hash.toHexString())

const logDataBtc = getOrCreateLog(
`${event.transaction.hash.toHexString()}btc`,
Expand All @@ -29,16 +26,7 @@ export function handleStakeRequestInitialized(
logDataEth.chain = "Ethereum"
logDataEth.amount = event.params.initialAmount

entity.depositKey = event.params.depositKey
entity.caller = event.params.caller
entity.staker = event.params.staker

entity.blockNumber = event.block.number
entity.blockTimestamp = event.block.timestamp
entity.transactionHash = event.transaction.hash

stakerEntity.save()
logDataBtc.save()
logDataEth.save()
entity.save()
}

0 comments on commit c779aab

Please sign in to comment.