harb/subgraph/base_sepolia/tests/stake-utils.ts
EmberSpirit007 1ea5bc0403 base-sepolia
2024-09-11 15:03:20 +02:00

70 lines
1.9 KiB
TypeScript

import { newMockEvent } from "matchstick-as"
import { ethereum, BigInt, Address } from "@graphprotocol/graph-ts"
import { PositionCreated, PositionRemoved } from "../generated/Stake/Stake"
export function createPositionCreatedEvent(
positionId: BigInt,
owner: Address,
share: BigInt,
creationTime: BigInt,
taxRate: BigInt
): PositionCreated {
let positionCreatedEvent = changetype<PositionCreated>(newMockEvent())
positionCreatedEvent.parameters = new Array()
positionCreatedEvent.parameters.push(
new ethereum.EventParam(
"positionId",
ethereum.Value.fromUnsignedBigInt(positionId)
)
)
positionCreatedEvent.parameters.push(
new ethereum.EventParam("owner", ethereum.Value.fromAddress(owner))
)
positionCreatedEvent.parameters.push(
new ethereum.EventParam("share", ethereum.Value.fromUnsignedBigInt(share))
)
positionCreatedEvent.parameters.push(
new ethereum.EventParam(
"creationTime",
ethereum.Value.fromUnsignedBigInt(creationTime)
)
)
positionCreatedEvent.parameters.push(
new ethereum.EventParam(
"taxRate",
ethereum.Value.fromUnsignedBigInt(taxRate)
)
)
return positionCreatedEvent
}
export function createPositionRemovedEvent(
positionId: BigInt,
share: BigInt,
lastTaxTime: BigInt
): PositionRemoved {
let positionRemovedEvent = changetype<PositionRemoved>(newMockEvent())
positionRemovedEvent.parameters = new Array()
positionRemovedEvent.parameters.push(
new ethereum.EventParam(
"positionId",
ethereum.Value.fromUnsignedBigInt(positionId)
)
)
positionRemovedEvent.parameters.push(
new ethereum.EventParam("share", ethereum.Value.fromUnsignedBigInt(share))
)
positionRemovedEvent.parameters.push(
new ethereum.EventParam(
"lastTaxTime",
ethereum.Value.fromUnsignedBigInt(lastTaxTime)
)
)
return positionRemovedEvent
}