Skip to content

Commit

Permalink
format
Browse files Browse the repository at this point in the history
  • Loading branch information
prevostc committed May 11, 2024
1 parent c664e1a commit 0faea43
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 14 deletions.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"name": "subgraphs",
"private": true,
"scripts": {
"prepare": "husky",
"postinstall": "yarn run --silent prepare:arbitrum && yarn run --silent codegen",
"codegen": "rm -Rf generated && graph codegen",
"build": "graph build",
Expand All @@ -27,7 +28,7 @@
"@graphprotocol/graph-cli": "^0.69.2",
"@graphprotocol/graph-ts": "^0.34.0",
"assemblyscript-prettier": "^3.0.1",
"husky": ">=7",
"husky": "^9.0.11",
"lint-staged": ">=10",
"matchstick-as": "^0.6.0",
"mustache": "^4.2.0",
Expand Down
15 changes: 4 additions & 11 deletions src/vault-interaction.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import { Address, BigInt, ethereum } from "@graphprotocol/graph-ts"
import {
Transfer as TransferEvent,
} from "../generated/templates/BeefyCLVault/BeefyVaultConcLiq"
import { Transfer as TransferEvent } from "../generated/templates/BeefyCLVault/BeefyVaultConcLiq"
import { getBeefyCLStrategy, getBeefyCLVault, getBeefyCLVaultSnapshot, isVaultInitialized } from "./entity/vault"
import { getTransaction } from "./entity/transaction"
import { getInvestor } from "./entity/investor"
Expand All @@ -14,7 +12,6 @@ import { InvestorPositionInteraction } from "../generated/schema"
import { getEventIdentifier } from "./utils/event"
import { SHARE_TOKEN_MINT_ADDRESS } from "./config"


export function handleVaultTransfer(event: TransferEvent): void {
// sending to self
if (event.params.from.equals(event.params.to)) {
Expand All @@ -29,18 +26,14 @@ export function handleVaultTransfer(event: TransferEvent): void {
// don't duplicate processing between Transfer and Deposit/Withdraw
if (!event.params.from.equals(SHARE_TOKEN_MINT_ADDRESS)) {
updateUserPosition(event, event.params.from, event.params.value.neg())
}
}

if (!event.params.to.equals(SHARE_TOKEN_MINT_ADDRESS)) {
updateUserPosition(event, event.params.to, event.params.value)
}
}

function updateUserPosition(
event: ethereum.Event,
investorAddress: Address,
sharesDelta: BigInt,
): void {
function updateUserPosition(event: ethereum.Event, investorAddress: Address, sharesDelta: BigInt): void {
let vault = getBeefyCLVault(event.address)
if (!isVaultInitialized(vault)) {
return
Expand Down
4 changes: 2 additions & 2 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1974,9 +1974,9 @@ human-signals@^5.0.0:
resolved "https://registry.npmjs.org/human-signals/-/human-signals-5.0.0.tgz"
integrity sha512-AXcZb6vzzrFAUE61HnN4mpLqd/cSIwNQjtNWR0euPm6y0iqx3G4gOXaIDdtdDwZmhwe82LA6+zinmW4UBWVePQ==

husky@>=7:
husky@^9.0.11:
version "9.0.11"
resolved "https://registry.npmjs.org/husky/-/husky-9.0.11.tgz"
resolved "https://registry.yarnpkg.com/husky/-/husky-9.0.11.tgz#fc91df4c756050de41b3e478b2158b87c1e79af9"
integrity sha512-AB6lFlbwwyIqMdHYhwPe+kjOC3Oc5P3nThEoW/AaO2BX3vJDjWPFxYLxokUZOo6RNX20He3AaT8sESs9NJcmEw==

hyperlinker@^1.0.0:
Expand Down

0 comments on commit 0faea43

Please sign in to comment.