From 69385bd8d5b4f783b608458fd9eccbfa5edb23a6 Mon Sep 17 00:00:00 2001 From: NetFreak26 Date: Thu, 30 Nov 2023 17:00:21 +0530 Subject: [PATCH] fix: move liquidation logic to datasource from template [SF-925] --- src/liquidation.ts | 2 +- subgraph.yaml | 36 ++++++++++++++++++------------------ test/mocks/liquidation.ts | 2 +- 3 files changed, 20 insertions(+), 20 deletions(-) diff --git a/src/liquidation.ts b/src/liquidation.ts index 57c3d45..be017b0 100644 --- a/src/liquidation.ts +++ b/src/liquidation.ts @@ -1,5 +1,5 @@ import { Address, BigInt, log } from '@graphprotocol/graph-ts'; -import { LiquidationExecuted } from '../generated/templates/LiquidationLogic/LiquidationLogic'; +import { LiquidationExecuted } from '../generated/LiquidationLogic/LiquidationLogic'; import { initLiquidation } from './helper/initializer'; export function handleLiquidationExecuted(event: LiquidationExecuted): void { diff --git a/subgraph.yaml b/subgraph.yaml index bb20684..ba83e27 100644 --- a/subgraph.yaml +++ b/subgraph.yaml @@ -63,6 +63,24 @@ dataSources: - event: OrderPartiallyFilled(uint48,indexed address,indexed bytes32,uint8,uint256,uint256,uint256) handler: handleOrderPartiallyFilled file: ./src/fund-management.ts + - kind: ethereum + name: LiquidationLogic + network: ~ + source: + abi: LiquidationLogic + mapping: + kind: ethereum/events + apiVersion: 0.0.7 + language: wasm/assemblyscript + entities: + - Liquidation + abis: + - name: LiquidationLogic + file: ./abis/protocol/libraries/logics/LiquidationLogic.sol/LiquidationLogic.json + eventHandlers: + - event: LiquidationExecuted(indexed address,bytes32,indexed bytes32,indexed uint256,uint256) + handler: handleLiquidationExecuted + file: ./src/liquidation.ts templates: - kind: ethereum name: OrderActionLogic @@ -110,21 +128,3 @@ templates: - event: ItayoseExecuted(bytes32,uint256,uint256,uint256,uint256,uint256) handler: handleItayoseExecuted file: ./src/lending-market.ts - - kind: ethereum - name: LiquidationLogic - network: ~ - source: - abi: LiquidationLogic - mapping: - kind: ethereum/events - apiVersion: 0.0.7 - language: wasm/assemblyscript - entities: - - Liquidation - abis: - - name: LiquidationLogic - file: ./abis/protocol/libraries/logics/LiquidationLogic.sol/LiquidationLogic.json - eventHandlers: - - event: LiquidationExecuted(indexed address,bytes32,indexed bytes32,indexed uint256,uint256) - handler: handleLiquidationExecuted - file: ./src/liquidation.ts diff --git a/test/mocks/liquidation.ts b/test/mocks/liquidation.ts index 86c949b..6a83f90 100644 --- a/test/mocks/liquidation.ts +++ b/test/mocks/liquidation.ts @@ -1,7 +1,7 @@ /* eslint-disable @typescript-eslint/ban-types */ import { Address, BigInt, Bytes, ethereum } from '@graphprotocol/graph-ts'; import { newMockEvent } from 'matchstick-as/assembly/index'; -import { LiquidationExecuted } from '../../generated/templates/LiquidationLogic/LiquidationLogic'; +import { LiquidationExecuted } from '../../generated/LiquidationLogic/LiquidationLogic'; export function createLiquidationExecutedEvent( user: Address,