Skip to content

Commit

Permalink
add templtae
Browse files Browse the repository at this point in the history
  • Loading branch information
mzywang committed Dec 5, 2024
1 parent ed2d4ab commit e24cb52
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 41 deletions.
17 changes: 0 additions & 17 deletions abis/ERC20NameBytes.json

This file was deleted.

17 changes: 0 additions & 17 deletions abis/ERC20SymbolBytes.json

This file was deleted.

3 changes: 3 additions & 0 deletions src/mappings/factory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { log } from '@graphprotocol/graph-ts'

import { PairCreated } from '../types/Factory/Factory'
import { Pair, Token, UniswapFactory } from '../types/schema'
import { Pair as PairTemplate } from '../types/templates'
import { FACTORY_ADDRESS, fetchTokenDecimals, ZERO_BI } from './helpers'

export function handleNewPair(event: PairCreated): void {
Expand Down Expand Up @@ -58,4 +59,6 @@ export function handleNewPair(event: PairCreated): void {
pair.createdAtBlockNumber = event.block.number
pair.txCount = ZERO_BI
pair.save()

PairTemplate.create(event.params.pair)
}
File renamed without changes.
10 changes: 3 additions & 7 deletions subgraph.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,14 @@ dataSources:
language: wasm/assemblyscript
file: ./src/mappings/factory.ts
entities:
- UniswapFactory
- Pair
- Token
abis:
- name: Factory
file: ./abis/factory.json
- name: ERC20
file: ./abis/ERC20.json
- name: ERC20SymbolBytes
file: ./abis/ERC20SymbolBytes.json
- name: ERC20NameBytes
file: ./abis/ERC20NameBytes.json
eventHandlers:
- event: PairCreated(indexed address,indexed address,address,uint256)
handler: handleNewPair
Expand All @@ -41,15 +38,14 @@ templates:
kind: ethereum/events
apiVersion: 0.0.9
language: wasm/assemblyscript
file: ./src/mappings/core.ts
file: ./src/mappings/pair.ts
entities:
- Pair
- Token
- Mint
abis:
- name: Pair
file: ./abis/pair.json
- name: Factory
file: ./abis/factory.json
eventHandlers:
- event: Mint(indexed address,uint256,uint256)
handler: handleMint
Expand Down

0 comments on commit e24cb52

Please sign in to comment.