Author SHA1 Message Date
neeraj 44f77f589d Update README and config 2024-06-06 17:05:24 +05:30
neeraj ad2ebb20cb Generate sushiswap blocks watcher 2024-06-06 16:59:43 +05:30
neeraj 65daa4a665 Update README and config 2024-06-06 16:26:07 +05:30
neeraj ebc876ea91 Generate v3 watcher 2024-06-06 12:05:36 +05:30
neeraj ec4df78a87 Create mono repo for watchers 2024-06-06 12:05:36 +05:30
79 changed files with 1030 additions and 1388 deletions
@@ -1,8 +1,8 @@
# route-processor-watcher
# blocks-watcher
## Source
* Subgraph: sushiswap-subgraphs v0.1.2-watcher
* Subgraph: [sushiswap-subgraphs release-v0.1.0-watcher](https://github.com/cerc-io/sushiswap-subgraphs/releases/tag/v0.1.0-watcher)
## Setup
@@ -16,7 +16,7 @@
```bash
sudo su - postgres
createdb route-processor-watcher
createdb blocks-watcher
```
* If the watcher is an `active` watcher:
@@ -24,19 +24,19 @@
Create database for the job queue and enable the `pgcrypto` extension on them (https://github.com/timgit/pg-boss/blob/master/docs/usage.md#intro):
```
createdb route-processor-watcher-job-queue
createdb blocks-watcher-job-queue
```
```
postgres@tesla:~$ psql -U postgres -h localhost route-processor-watcher-job-queue
postgres@tesla:~$ psql -U postgres -h localhost blocks-watcher-job-queue
Password for user postgres:
psql (12.7 (Ubuntu 12.7-1.pgdg18.04+1))
SSL connection (protocol: TLSv1.3, cipher: TLS_AES_256_GCM_SHA384, bits: 256, compression: off)
Type "help" for help.
route-processor-watcher-job-queue=# CREATE EXTENSION pgcrypto;
blocks-watcher-job-queue=# CREATE EXTENSION pgcrypto;
CREATE EXTENSION
route-processor-watcher-job-queue=# exit
blocks-watcher-job-queue=# exit
```
* In the [config file](./environments/local.toml):
@@ -56,7 +56,7 @@
type = "postgres"
host = "localhost"
port = 5432
database = "route-processor-watcher"
database = "blocks-watcher"
username = "postgres"
password = "postgres"
synchronize = true
@@ -86,7 +86,7 @@
deleteOnStart = false
[jobQueue]
dbConnectionString = "postgres://postgres:postgres@localhost/route-processor-watcher-job-queue"
dbConnectionString = "postgres://postgres:postgres@localhost/blocks-watcher-job-queue"
maxCompletionLagInSecs = 300
jobDelayInMilliSecs = 100
eventsInBatch = 50
@@ -1,7 +1,7 @@
{
"name": "@cerc-io/route-processor-watcher",
"name": "@cerc-io/blocks-watcher",
"version": "0.1.0",
"description": "route-processor-watcher",
"description": "blocks-watcher",
"private": true,
"main": "dist/index.js",
"scripts": {
@@ -39,11 +39,11 @@
"homepage": "https://github.com/cerc-io/watcher-ts#readme",
"dependencies": {
"@apollo/client": "^3.3.19",
"@cerc-io/cli": "^0.2.93",
"@cerc-io/ipld-eth-client": "^0.2.93",
"@cerc-io/solidity-mapper": "^0.2.93",
"@cerc-io/util": "^0.2.93",
"@cerc-io/graph-node": "^0.2.93",
"@cerc-io/cli": "^0.2.94",
"@cerc-io/ipld-eth-client": "^0.2.94",
"@cerc-io/solidity-mapper": "^0.2.94",
"@cerc-io/util": "^0.2.94",
"@cerc-io/graph-node": "^0.2.94",
"@ethersproject/providers": "^5.4.4",
"debug": "^4.3.1",
"decimal.js": "^10.3.1",
@@ -0,0 +1,217 @@
{
"abi": [
{
"inputs": [
{
"internalType": "address",
"name": "_feeToSetter",
"type": "address"
}
],
"stateMutability": "nonpayable",
"type": "constructor"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "token0",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "token1",
"type": "address"
},
{
"indexed": false,
"internalType": "address",
"name": "pair",
"type": "address"
},
{
"indexed": false,
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"name": "PairCreated",
"type": "event"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"name": "allPairs",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "allPairsLength",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "tokenA",
"type": "address"
},
{
"internalType": "address",
"name": "tokenB",
"type": "address"
}
],
"name": "createPair",
"outputs": [
{
"internalType": "address",
"name": "pair",
"type": "address"
}
],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"name": "feeTo",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "feeToSetter",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "",
"type": "address"
},
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"name": "getPair",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "migrator",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "pairCodeHash",
"outputs": [
{
"internalType": "bytes32",
"name": "",
"type": "bytes32"
}
],
"stateMutability": "pure",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "_feeTo",
"type": "address"
}
],
"name": "setFeeTo",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "_feeToSetter",
"type": "address"
}
],
"name": "setFeeToSetter",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "_migrator",
"type": "address"
}
],
"name": "setMigrator",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
}
]
}
@@ -21,11 +21,9 @@ import { SyncStatus } from './entity/SyncStatus';
import { StateSyncStatus } from './entity/StateSyncStatus';
import { BlockProgress } from './entity/BlockProgress';
import { State } from './entity/State';
import { RouteProcessor } from './entity/RouteProcessor';
import { Route } from './entity/Route';
import { User } from './entity/User';
import { Block } from './entity/Block';
export const SUBGRAPH_ENTITIES = new Set([RouteProcessor, Route, User]);
export const SUBGRAPH_ENTITIES = new Set([Block]);
export const ENTITIES = [...SUBGRAPH_ENTITIES];
// Map: Entity to suitable query type.
export const ENTITY_QUERY_TYPE_MAP = new Map<new() => any, ENTITY_QUERY_TYPE>([]);
@@ -0,0 +1,64 @@
//
// Copyright 2021 Vulcanize, Inc.
//
import { Entity, PrimaryColumn, Column, Index } from 'typeorm';
import { bigintTransformer } from '@cerc-io/util';
@Entity()
@Index(['blockNumber'])
export class Block {
@PrimaryColumn('varchar')
id!: string;
@PrimaryColumn('varchar', { length: 66 })
blockHash!: string;
@Column('integer')
blockNumber!: number;
@Column('numeric', { transformer: bigintTransformer })
number!: bigint;
@Column('numeric', { transformer: bigintTransformer })
timestamp!: bigint;
@Column('varchar', { nullable: true })
parentHash!: string | null;
@Column('varchar', { nullable: true })
author!: string | null;
@Column('numeric', { nullable: true, transformer: bigintTransformer })
difficulty!: bigint | null;
@Column('numeric', { nullable: true, transformer: bigintTransformer })
totalDifficulty!: bigint | null;
@Column('numeric', { nullable: true, transformer: bigintTransformer })
gasUsed!: bigint | null;
@Column('numeric', { nullable: true, transformer: bigintTransformer })
gasLimit!: bigint | null;
@Column('varchar', { nullable: true })
receiptsRoot!: string | null;
@Column('varchar', { nullable: true })
transactionsRoot!: string | null;
@Column('varchar', { nullable: true })
stateRoot!: string | null;
@Column('numeric', { nullable: true, transformer: bigintTransformer })
size!: bigint | null;
@Column('varchar', { nullable: true })
unclesHash!: string | null;
@Column('boolean', { default: false })
isPruned!: boolean;
@Column('boolean', { default: false })
isRemoved!: boolean;
}
@@ -0,0 +1,18 @@
query block($id: ID!, $block: Block_height){
block(id: $id, block: $block){
id
number
timestamp
parentHash
author
difficulty
totalDifficulty
gasUsed
gasLimit
receiptsRoot
transactionsRoot
stateRoot
size
unclesHash
}
}
@@ -0,0 +1,18 @@
query blocks($block: Block_height, $where: Block_filter, $orderBy: Block_orderBy, $orderDirection: OrderDirection, $first: Int, $skip: Int){
blocks(block: $block, where: $where, orderBy: $orderBy, orderDirection: $orderDirection, first: $first, skip: $skip){
id
number
timestamp
parentHash
author
difficulty
totalDifficulty
gasUsed
gasLimit
receiptsRoot
transactionsRoot
stateRoot
size
unclesHash
}
}
@@ -16,18 +16,11 @@ query events($blockHash: String!, $contractAddress: String!, $name: String){
contract
eventIndex
event{
... on OwnershipTransferredEvent {
previousOwner
newOwner
}
... on RouteEvent {
from
to
tokenIn
tokenOut
amountIn
amountOutMin
amountOut
... on PairCreatedEvent {
token0
token1
pair
null
}
}
proof{
@@ -16,18 +16,11 @@ query eventsInRange($fromBlockNumber: Int!, $toBlockNumber: Int!){
contract
eventIndex
event{
... on OwnershipTransferredEvent {
previousOwner
newOwner
}
... on RouteEvent {
from
to
tokenIn
tokenOut
amountIn
amountOutMin
amountOut
... on PairCreatedEvent {
token0
token1
pair
null
}
}
proof{
@@ -3,12 +3,8 @@ import path from 'path';
export const events = fs.readFileSync(path.join(__dirname, 'events.gql'), 'utf8');
export const eventsInRange = fs.readFileSync(path.join(__dirname, 'eventsInRange.gql'), 'utf8');
export const routeProcessor = fs.readFileSync(path.join(__dirname, 'routeProcessor.gql'), 'utf8');
export const routeProcessors = fs.readFileSync(path.join(__dirname, 'routeProcessors.gql'), 'utf8');
export const route = fs.readFileSync(path.join(__dirname, 'route.gql'), 'utf8');
export const routes = fs.readFileSync(path.join(__dirname, 'routes.gql'), 'utf8');
export const user = fs.readFileSync(path.join(__dirname, 'user.gql'), 'utf8');
export const users = fs.readFileSync(path.join(__dirname, 'users.gql'), 'utf8');
export const block = fs.readFileSync(path.join(__dirname, 'block.gql'), 'utf8');
export const blocks = fs.readFileSync(path.join(__dirname, 'blocks.gql'), 'utf8');
export const _meta = fs.readFileSync(path.join(__dirname, '_meta.gql'), 'utf8');
export const getStateByCID = fs.readFileSync(path.join(__dirname, 'getStateByCID.gql'), 'utf8');
export const getState = fs.readFileSync(path.join(__dirname, 'getState.gql'), 'utf8');
@@ -16,18 +16,11 @@ subscription onEvent{
contract
eventIndex
event{
... on OwnershipTransferredEvent {
previousOwner
newOwner
}
... on RouteEvent {
from
to
tokenIn
tokenOut
amountIn
amountOutMin
amountOut
... on PairCreatedEvent {
token0
token1
pair
null
}
}
proof{
@@ -38,7 +38,7 @@ import {
} from '@cerc-io/util';
import { GraphWatcher } from '@cerc-io/graph-node';
import RouteProcessorArtifacts from './artifacts/RouteProcessor.json';
import UniswapV2FactoryArtifacts from './artifacts/UniswapV2Factory.json';
import { Database, ENTITIES, SUBGRAPH_ENTITIES } from './database';
import { createInitialState, handleEvent, createStateDiff, createStateCheckpoint } from './hooks';
import { Contract } from './entity/Contract';
@@ -48,9 +48,7 @@ import { StateSyncStatus } from './entity/StateSyncStatus';
import { BlockProgress } from './entity/BlockProgress';
import { State } from './entity/State';
/* eslint-disable @typescript-eslint/no-unused-vars */
import { RouteProcessor } from './entity/RouteProcessor';
import { Route } from './entity/Route';
import { User } from './entity/User';
import { Block } from './entity/Block';
/* eslint-enable @typescript-eslint/no-unused-vars */
import { FrothyEntity } from './entity/FrothyEntity';
@@ -58,7 +56,7 @@ import { FrothyEntity } from './entity/FrothyEntity';
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const log = debug('vulcanize:indexer');
const KIND_ROUTEPROCESSOR = 'RouteProcessor';
const KIND_UNISWAPV2FACTORY = 'UniswapV2Factory';
export class Indexer implements IndexerInterface {
_db: Database;
@@ -107,18 +105,18 @@ export class Indexer implements IndexerInterface {
this._contractMap = new Map();
this.eventSignaturesMap = new Map();
const { abi: RouteProcessorABI } = RouteProcessorArtifacts;
const { abi: UniswapV2FactoryABI } = UniswapV2FactoryArtifacts;
assert(RouteProcessorABI);
this._abiMap.set(KIND_ROUTEPROCESSOR, RouteProcessorABI);
assert(UniswapV2FactoryABI);
this._abiMap.set(KIND_UNISWAPV2FACTORY, UniswapV2FactoryABI);
const RouteProcessorContractInterface = new ethers.utils.Interface(RouteProcessorABI);
this._contractMap.set(KIND_ROUTEPROCESSOR, RouteProcessorContractInterface);
const UniswapV2FactoryContractInterface = new ethers.utils.Interface(UniswapV2FactoryABI);
this._contractMap.set(KIND_UNISWAPV2FACTORY, UniswapV2FactoryContractInterface);
const RouteProcessorEventSignatures = Object.values(RouteProcessorContractInterface.events).map(value => {
return RouteProcessorContractInterface.getEventTopic(value);
const UniswapV2FactoryEventSignatures = Object.values(UniswapV2FactoryContractInterface.events).map(value => {
return UniswapV2FactoryContractInterface.getEventTopic(value);
});
this.eventSignaturesMap.set(KIND_ROUTEPROCESSOR, RouteProcessorEventSignatures);
this.eventSignaturesMap.set(KIND_UNISWAPV2FACTORY, UniswapV2FactoryEventSignatures);
this._entityTypesMap = new Map();
this._populateEntityTypesMap();
@@ -617,25 +615,21 @@ export class Indexer implements IndexerInterface {
}
_populateEntityTypesMap (): void {
this._entityTypesMap.set('RouteProcessor', {
this._entityTypesMap.set('Block', {
id: 'ID',
routeCount: 'BigInt',
userCount: 'BigInt'
});
this._entityTypesMap.set('Route', {
id: 'ID',
from: 'Bytes',
to: 'Bytes',
tokenIn: 'Bytes',
tokenOut: 'Bytes',
amountIn: 'BigInt',
amountOutMin: 'BigInt',
amountOut: 'BigInt',
timestamp: 'BigInt'
});
this._entityTypesMap.set('User', {
id: 'ID',
routeCount: 'BigInt'
number: 'BigInt',
timestamp: 'BigInt',
parentHash: 'String',
author: 'String',
difficulty: 'BigInt',
totalDifficulty: 'BigInt',
gasUsed: 'BigInt',
gasLimit: 'BigInt',
receiptsRoot: 'String',
transactionsRoot: 'String',
stateRoot: 'String',
size: 'BigInt',
unclesHash: 'String'
});
}
@@ -26,9 +26,7 @@ import {
import { Indexer } from './indexer';
import { RouteProcessor } from './entity/RouteProcessor';
import { Route } from './entity/Route';
import { User } from './entity/User';
import { Block } from './entity/Block';
const log = debug('vulcanize:resolver');
@@ -113,13 +111,13 @@ export const createResolvers = async (
},
Query: {
routeProcessor: async (
block: async (
_: any,
{ id, block = {} }: { id: string, block: BlockHeight },
expressContext: ExpressContext,
info: GraphQLResolveInfo
) => {
log('routeProcessor', id, JSON.stringify(block, jsonBigIntStringReplacer));
log('block', id, JSON.stringify(block, jsonBigIntStringReplacer));
// Set cache-control hints
// setGQLCacheHints(info, block, gqlCacheConfig);
@@ -127,19 +125,19 @@ export const createResolvers = async (
return executeAndRecordMetrics(
indexer,
gqlLogger,
'routeProcessor',
'block',
expressContext,
async () => indexer.getSubgraphEntity(RouteProcessor, id, block, info)
async () => indexer.getSubgraphEntity(Block, id, block, info)
);
},
routeProcessors: async (
blocks: async (
_: any,
{ block = {}, where, first, skip, orderBy, orderDirection }: { block: BlockHeight, where: { [key: string]: any }, first: number, skip: number, orderBy: string, orderDirection: OrderDirection },
expressContext: ExpressContext,
info: GraphQLResolveInfo
) => {
log('routeProcessors', JSON.stringify(block, jsonBigIntStringReplacer), JSON.stringify(where, jsonBigIntStringReplacer), first, skip, orderBy, orderDirection);
log('blocks', JSON.stringify(block, jsonBigIntStringReplacer), JSON.stringify(where, jsonBigIntStringReplacer), first, skip, orderBy, orderDirection);
// Set cache-control hints
// setGQLCacheHints(info, block, gqlCacheConfig);
@@ -147,102 +145,10 @@ export const createResolvers = async (
return executeAndRecordMetrics(
indexer,
gqlLogger,
'routeProcessors',
'blocks',
expressContext,
async () => indexer.getSubgraphEntities(
RouteProcessor,
block,
where,
{ limit: first, skip, orderBy, orderDirection },
info
)
);
},
route: async (
_: any,
{ id, block = {} }: { id: string, block: BlockHeight },
expressContext: ExpressContext,
info: GraphQLResolveInfo
) => {
log('route', id, JSON.stringify(block, jsonBigIntStringReplacer));
// Set cache-control hints
// setGQLCacheHints(info, block, gqlCacheConfig);
return executeAndRecordMetrics(
indexer,
gqlLogger,
'route',
expressContext,
async () => indexer.getSubgraphEntity(Route, id, block, info)
);
},
routes: async (
_: any,
{ block = {}, where, first, skip, orderBy, orderDirection }: { block: BlockHeight, where: { [key: string]: any }, first: number, skip: number, orderBy: string, orderDirection: OrderDirection },
expressContext: ExpressContext,
info: GraphQLResolveInfo
) => {
log('routes', JSON.stringify(block, jsonBigIntStringReplacer), JSON.stringify(where, jsonBigIntStringReplacer), first, skip, orderBy, orderDirection);
// Set cache-control hints
// setGQLCacheHints(info, block, gqlCacheConfig);
return executeAndRecordMetrics(
indexer,
gqlLogger,
'routes',
expressContext,
async () => indexer.getSubgraphEntities(
Route,
block,
where,
{ limit: first, skip, orderBy, orderDirection },
info
)
);
},
user: async (
_: any,
{ id, block = {} }: { id: string, block: BlockHeight },
expressContext: ExpressContext,
info: GraphQLResolveInfo
) => {
log('user', id, JSON.stringify(block, jsonBigIntStringReplacer));
// Set cache-control hints
// setGQLCacheHints(info, block, gqlCacheConfig);
return executeAndRecordMetrics(
indexer,
gqlLogger,
'user',
expressContext,
async () => indexer.getSubgraphEntity(User, id, block, info)
);
},
users: async (
_: any,
{ block = {}, where, first, skip, orderBy, orderDirection }: { block: BlockHeight, where: { [key: string]: any }, first: number, skip: number, orderBy: string, orderDirection: OrderDirection },
expressContext: ExpressContext,
info: GraphQLResolveInfo
) => {
log('users', JSON.stringify(block, jsonBigIntStringReplacer), JSON.stringify(where, jsonBigIntStringReplacer), first, skip, orderBy, orderDirection);
// Set cache-control hints
// setGQLCacheHints(info, block, gqlCacheConfig);
return executeAndRecordMetrics(
indexer,
gqlLogger,
'users',
expressContext,
async () => indexer.getSubgraphEntities(
User,
Block,
block,
where,
{ limit: first, skip, orderBy, orderDirection },
+337
View File
@@ -0,0 +1,337 @@
directive @cacheControl(maxAge: Int, inheritMaxAge: Boolean, scope: CacheControlScope) on FIELD_DEFINITION | OBJECT | INTERFACE | UNION
enum CacheControlScope {
PUBLIC
PRIVATE
}
scalar BigInt
scalar BigDecimal
scalar Bytes
type Proof {
data: String!
}
type _Block_ {
cid: String
hash: String!
number: Int!
timestamp: Int!
parentHash: String!
}
type _Transaction_ {
hash: String!
index: Int!
from: String!
to: String!
}
type ResultEvent {
block: _Block_!
tx: _Transaction_!
contract: String!
eventIndex: Int!
event: Event!
proof: Proof
}
union Event = PairCreatedEvent
type PairCreatedEvent {
token0: String!
token1: String!
pair: String!
null: BigInt!
}
input Block_height {
hash: Bytes
number: Int
}
input BlockChangedFilter {
number_gte: Int!
}
enum OrderDirection {
asc
desc
}
enum Block_orderBy {
id
number
timestamp
parentHash
author
difficulty
totalDifficulty
gasUsed
gasLimit
receiptsRoot
transactionsRoot
stateRoot
size
unclesHash
}
input Block_filter {
id: ID
id_not: ID
id_gt: ID
id_lt: ID
id_gte: ID
id_lte: ID
id_in: [ID!]
id_not_in: [ID!]
number: BigInt
number_not: BigInt
number_gt: BigInt
number_lt: BigInt
number_gte: BigInt
number_lte: BigInt
number_in: [BigInt!]
number_not_in: [BigInt!]
timestamp: BigInt
timestamp_not: BigInt
timestamp_gt: BigInt
timestamp_lt: BigInt
timestamp_gte: BigInt
timestamp_lte: BigInt
timestamp_in: [BigInt!]
timestamp_not_in: [BigInt!]
parentHash: String
parentHash_not: String
parentHash_gt: String
parentHash_lt: String
parentHash_gte: String
parentHash_lte: String
parentHash_in: [String!]
parentHash_not_in: [String!]
parentHash_starts_with: String
parentHash_starts_with_nocase: String
parentHash_not_starts_with: String
parentHash_not_starts_with_nocase: String
parentHash_ends_with: String
parentHash_ends_with_nocase: String
parentHash_not_ends_with: String
parentHash_not_ends_with_nocase: String
parentHash_contains: String
parentHash_not_contains: String
parentHash_contains_nocase: String
parentHash_not_contains_nocase: String
author: String
author_not: String
author_gt: String
author_lt: String
author_gte: String
author_lte: String
author_in: [String!]
author_not_in: [String!]
author_starts_with: String
author_starts_with_nocase: String
author_not_starts_with: String
author_not_starts_with_nocase: String
author_ends_with: String
author_ends_with_nocase: String
author_not_ends_with: String
author_not_ends_with_nocase: String
author_contains: String
author_not_contains: String
author_contains_nocase: String
author_not_contains_nocase: String
difficulty: BigInt
difficulty_not: BigInt
difficulty_gt: BigInt
difficulty_lt: BigInt
difficulty_gte: BigInt
difficulty_lte: BigInt
difficulty_in: [BigInt!]
difficulty_not_in: [BigInt!]
totalDifficulty: BigInt
totalDifficulty_not: BigInt
totalDifficulty_gt: BigInt
totalDifficulty_lt: BigInt
totalDifficulty_gte: BigInt
totalDifficulty_lte: BigInt
totalDifficulty_in: [BigInt!]
totalDifficulty_not_in: [BigInt!]
gasUsed: BigInt
gasUsed_not: BigInt
gasUsed_gt: BigInt
gasUsed_lt: BigInt
gasUsed_gte: BigInt
gasUsed_lte: BigInt
gasUsed_in: [BigInt!]
gasUsed_not_in: [BigInt!]
gasLimit: BigInt
gasLimit_not: BigInt
gasLimit_gt: BigInt
gasLimit_lt: BigInt
gasLimit_gte: BigInt
gasLimit_lte: BigInt
gasLimit_in: [BigInt!]
gasLimit_not_in: [BigInt!]
receiptsRoot: String
receiptsRoot_not: String
receiptsRoot_gt: String
receiptsRoot_lt: String
receiptsRoot_gte: String
receiptsRoot_lte: String
receiptsRoot_in: [String!]
receiptsRoot_not_in: [String!]
receiptsRoot_starts_with: String
receiptsRoot_starts_with_nocase: String
receiptsRoot_not_starts_with: String
receiptsRoot_not_starts_with_nocase: String
receiptsRoot_ends_with: String
receiptsRoot_ends_with_nocase: String
receiptsRoot_not_ends_with: String
receiptsRoot_not_ends_with_nocase: String
receiptsRoot_contains: String
receiptsRoot_not_contains: String
receiptsRoot_contains_nocase: String
receiptsRoot_not_contains_nocase: String
transactionsRoot: String
transactionsRoot_not: String
transactionsRoot_gt: String
transactionsRoot_lt: String
transactionsRoot_gte: String
transactionsRoot_lte: String
transactionsRoot_in: [String!]
transactionsRoot_not_in: [String!]
transactionsRoot_starts_with: String
transactionsRoot_starts_with_nocase: String
transactionsRoot_not_starts_with: String
transactionsRoot_not_starts_with_nocase: String
transactionsRoot_ends_with: String
transactionsRoot_ends_with_nocase: String
transactionsRoot_not_ends_with: String
transactionsRoot_not_ends_with_nocase: String
transactionsRoot_contains: String
transactionsRoot_not_contains: String
transactionsRoot_contains_nocase: String
transactionsRoot_not_contains_nocase: String
stateRoot: String
stateRoot_not: String
stateRoot_gt: String
stateRoot_lt: String
stateRoot_gte: String
stateRoot_lte: String
stateRoot_in: [String!]
stateRoot_not_in: [String!]
stateRoot_starts_with: String
stateRoot_starts_with_nocase: String
stateRoot_not_starts_with: String
stateRoot_not_starts_with_nocase: String
stateRoot_ends_with: String
stateRoot_ends_with_nocase: String
stateRoot_not_ends_with: String
stateRoot_not_ends_with_nocase: String
stateRoot_contains: String
stateRoot_not_contains: String
stateRoot_contains_nocase: String
stateRoot_not_contains_nocase: String
size: BigInt
size_not: BigInt
size_gt: BigInt
size_lt: BigInt
size_gte: BigInt
size_lte: BigInt
size_in: [BigInt!]
size_not_in: [BigInt!]
unclesHash: String
unclesHash_not: String
unclesHash_gt: String
unclesHash_lt: String
unclesHash_gte: String
unclesHash_lte: String
unclesHash_in: [String!]
unclesHash_not_in: [String!]
unclesHash_starts_with: String
unclesHash_starts_with_nocase: String
unclesHash_not_starts_with: String
unclesHash_not_starts_with_nocase: String
unclesHash_ends_with: String
unclesHash_ends_with_nocase: String
unclesHash_not_ends_with: String
unclesHash_not_ends_with_nocase: String
unclesHash_contains: String
unclesHash_not_contains: String
unclesHash_contains_nocase: String
unclesHash_not_contains_nocase: String
_change_block: BlockChangedFilter
and: [Block_filter]
or: [Block_filter]
}
type _MetaBlock_ {
hash: Bytes
number: Int!
timestamp: Int
}
type _Meta_ {
block: _MetaBlock_!
deployment: String!
hasIndexingErrors: Boolean!
}
type ResultState {
block: _Block_!
contractAddress: String!
cid: String!
kind: String!
data: String!
}
type SyncStatus {
latestIndexedBlockHash: String!
latestIndexedBlockNumber: Int!
latestCanonicalBlockHash: String!
latestCanonicalBlockNumber: Int!
initialIndexedBlockHash: String!
initialIndexedBlockNumber: Int!
latestProcessedBlockHash: String!
latestProcessedBlockNumber: Int!
}
type Query {
events(blockHash: String!, contractAddress: String!, name: String): [ResultEvent!]
eventsInRange(fromBlockNumber: Int!, toBlockNumber: Int!): [ResultEvent!]
block(id: ID!, block: Block_height): Block
blocks(block: Block_height, where: Block_filter, orderBy: Block_orderBy, orderDirection: OrderDirection, first: Int = 100, skip: Int = 0): [Block!]!
_meta(block: Block_height): _Meta_
getStateByCID(cid: String!): ResultState
getState(blockHash: String!, contractAddress: String!, kind: String): ResultState
getSyncStatus: SyncStatus
}
type Block {
id: ID!
number: BigInt!
timestamp: BigInt!
parentHash: String
author: String
difficulty: BigInt
totalDifficulty: BigInt
gasUsed: BigInt
gasLimit: BigInt
receiptsRoot: String
transactionsRoot: String
stateRoot: String
size: BigInt
unclesHash: String
}
type Mutation {
watchContract(address: String!, kind: String!, checkpoint: Boolean!, startingBlock: Int): Boolean!
}
type Subscription {
onEvent: ResultEvent!
}
@@ -0,0 +1,215 @@
[
{
"inputs": [
{
"internalType": "address",
"name": "_feeToSetter",
"type": "address"
}
],
"stateMutability": "nonpayable",
"type": "constructor"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "token0",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "token1",
"type": "address"
},
{
"indexed": false,
"internalType": "address",
"name": "pair",
"type": "address"
},
{
"indexed": false,
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"name": "PairCreated",
"type": "event"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"name": "allPairs",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "allPairsLength",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "tokenA",
"type": "address"
},
{
"internalType": "address",
"name": "tokenB",
"type": "address"
}
],
"name": "createPair",
"outputs": [
{
"internalType": "address",
"name": "pair",
"type": "address"
}
],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"name": "feeTo",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "feeToSetter",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "",
"type": "address"
},
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"name": "getPair",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "migrator",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "pairCodeHash",
"outputs": [
{
"internalType": "bytes32",
"name": "",
"type": "bytes32"
}
],
"stateMutability": "pure",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "_feeTo",
"type": "address"
}
],
"name": "setFeeTo",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "_feeToSetter",
"type": "address"
}
],
"name": "setFeeToSetter",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "_migrator",
"type": "address"
}
],
"name": "setMigrator",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
}
]
@@ -0,0 +1,16 @@
type Block @entity {
id: ID!
number: BigInt!
timestamp: BigInt!
parentHash: String
author: String
difficulty: BigInt
totalDifficulty: BigInt
gasUsed: BigInt
gasLimit: BigInt
receiptsRoot: String
transactionsRoot: String
stateRoot: String
size: BigInt
unclesHash: String
}
@@ -0,0 +1,25 @@
specVersion: 0.0.4
description: Blocks
repository: https://github.com/sushiswap/subgraphs
schema:
file: schema.graphql
dataSources:
- kind: ethereum/contract
name: UniswapV2Factory
network: mainnet
source:
address: "0x719e14fcb364bb05649bd525eb6c4a2d0d4ea2b7"
startBlock: 2867000
abi: UniswapV2Factory
mapping:
kind: ethereun/events
apiVersion: 0.0.6
language: wasm/assemblyscript
file: UniswapV2Factory/UniswapV2Factory.wasm
entities:
- Blocks
abis:
- name: UniswapV2Factory
file: UniswapV2Factory/abis/UniswapV2Factory.json
blockHandlers:
- handler: onBlock
@@ -1,291 +0,0 @@
{
"abi": [
{
"inputs": [
{
"internalType": "address",
"name": "_bentoBox",
"type": "address"
},
{
"internalType": "address[]",
"name": "priviledgedUserList",
"type": "address[]"
}
],
"stateMutability": "nonpayable",
"type": "constructor"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "previousOwner",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "newOwner",
"type": "address"
}
],
"name": "OwnershipTransferred",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "from",
"type": "address"
},
{
"indexed": false,
"internalType": "address",
"name": "to",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "tokenIn",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "tokenOut",
"type": "address"
},
{
"indexed": false,
"internalType": "uint256",
"name": "amountIn",
"type": "uint256"
},
{
"indexed": false,
"internalType": "uint256",
"name": "amountOutMin",
"type": "uint256"
},
{
"indexed": false,
"internalType": "uint256",
"name": "amountOut",
"type": "uint256"
}
],
"name": "Route",
"type": "event"
},
{
"inputs": [],
"name": "bentoBox",
"outputs": [
{
"internalType": "contract IBentoBoxMinimal",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "owner",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "pause",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "tokenIn",
"type": "address"
},
{
"internalType": "uint256",
"name": "amountIn",
"type": "uint256"
},
{
"internalType": "address",
"name": "tokenOut",
"type": "address"
},
{
"internalType": "uint256",
"name": "amountOutMin",
"type": "uint256"
},
{
"internalType": "address",
"name": "to",
"type": "address"
},
{
"internalType": "bytes",
"name": "route",
"type": "bytes"
}
],
"name": "processRoute",
"outputs": [
{
"internalType": "uint256",
"name": "amountOut",
"type": "uint256"
}
],
"stateMutability": "payable",
"type": "function"
},
{
"inputs": [],
"name": "renounceOwnership",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"name": "resume",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "user",
"type": "address"
},
{
"internalType": "bool",
"name": "priviledge",
"type": "bool"
}
],
"name": "setPriviledge",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "newOwner",
"type": "address"
}
],
"name": "transferOwnership",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address payable",
"name": "transferValueTo",
"type": "address"
},
{
"internalType": "uint256",
"name": "amountValueTransfer",
"type": "uint256"
},
{
"internalType": "address",
"name": "tokenIn",
"type": "address"
},
{
"internalType": "uint256",
"name": "amountIn",
"type": "uint256"
},
{
"internalType": "address",
"name": "tokenOut",
"type": "address"
},
{
"internalType": "uint256",
"name": "amountOutMin",
"type": "uint256"
},
{
"internalType": "address",
"name": "to",
"type": "address"
},
{
"internalType": "bytes",
"name": "route",
"type": "bytes"
}
],
"name": "transferValueAndprocessRoute",
"outputs": [
{
"internalType": "uint256",
"name": "amountOut",
"type": "uint256"
}
],
"stateMutability": "payable",
"type": "function"
},
{
"inputs": [
{
"internalType": "int256",
"name": "amount0Delta",
"type": "int256"
},
{
"internalType": "int256",
"name": "amount1Delta",
"type": "int256"
},
{
"internalType": "bytes",
"name": "data",
"type": "bytes"
}
],
"name": "uniswapV3SwapCallback",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"stateMutability": "payable",
"type": "receive"
}
]
}
@@ -1,49 +0,0 @@
//
// Copyright 2021 Vulcanize, Inc.
//
import { Entity, PrimaryColumn, Column, Index } from 'typeorm';
import { bigintTransformer } from '@cerc-io/util';
@Entity()
@Index(['blockNumber'])
export class Route {
@PrimaryColumn('varchar')
id!: string;
@PrimaryColumn('varchar', { length: 66 })
blockHash!: string;
@Column('integer')
blockNumber!: number;
@Column('varchar')
from!: string;
@Column('varchar')
to!: string;
@Column('varchar')
tokenIn!: string;
@Column('varchar')
tokenOut!: string;
@Column('numeric', { transformer: bigintTransformer })
amountIn!: bigint;
@Column('numeric', { transformer: bigintTransformer })
amountOutMin!: bigint;
@Column('numeric', { transformer: bigintTransformer })
amountOut!: bigint;
@Column('numeric', { transformer: bigintTransformer })
timestamp!: bigint;
@Column('boolean', { default: false })
isPruned!: boolean;
@Column('boolean', { default: false })
isRemoved!: boolean;
}
@@ -1,31 +0,0 @@
//
// Copyright 2021 Vulcanize, Inc.
//
import { Entity, PrimaryColumn, Column, Index } from 'typeorm';
import { bigintTransformer } from '@cerc-io/util';
@Entity()
@Index(['blockNumber'])
export class RouteProcessor {
@PrimaryColumn('varchar')
id!: string;
@PrimaryColumn('varchar', { length: 66 })
blockHash!: string;
@Column('integer')
blockNumber!: number;
@Column('numeric', { transformer: bigintTransformer })
routeCount!: bigint;
@Column('numeric', { transformer: bigintTransformer })
userCount!: bigint;
@Column('boolean', { default: false })
isPruned!: boolean;
@Column('boolean', { default: false })
isRemoved!: boolean;
}
@@ -1,28 +0,0 @@
//
// Copyright 2021 Vulcanize, Inc.
//
import { Entity, PrimaryColumn, Column, Index } from 'typeorm';
import { bigintTransformer } from '@cerc-io/util';
@Entity()
@Index(['blockNumber'])
export class User {
@PrimaryColumn('varchar')
id!: string;
@PrimaryColumn('varchar', { length: 66 })
blockHash!: string;
@Column('integer')
blockNumber!: number;
@Column('numeric', { transformer: bigintTransformer })
routeCount!: bigint;
@Column('boolean', { default: false })
isPruned!: boolean;
@Column('boolean', { default: false })
isRemoved!: boolean;
}
@@ -1,13 +0,0 @@
query route($id: ID!, $block: Block_height){
route(id: $id, block: $block){
id
from
to
tokenIn
tokenOut
amountIn
amountOutMin
amountOut
timestamp
}
}
@@ -1,7 +0,0 @@
query routeProcessor($id: ID!, $block: Block_height){
routeProcessor(id: $id, block: $block){
id
routeCount
userCount
}
}
@@ -1,7 +0,0 @@
query routeProcessors($block: Block_height, $where: RouteProcessor_filter, $orderBy: RouteProcessor_orderBy, $orderDirection: OrderDirection, $first: Int, $skip: Int){
routeProcessors(block: $block, where: $where, orderBy: $orderBy, orderDirection: $orderDirection, first: $first, skip: $skip){
id
routeCount
userCount
}
}
@@ -1,13 +0,0 @@
query routes($block: Block_height, $where: Route_filter, $orderBy: Route_orderBy, $orderDirection: OrderDirection, $first: Int, $skip: Int){
routes(block: $block, where: $where, orderBy: $orderBy, orderDirection: $orderDirection, first: $first, skip: $skip){
id
from
to
tokenIn
tokenOut
amountIn
amountOutMin
amountOut
timestamp
}
}
@@ -1,6 +0,0 @@
query user($id: ID!, $block: Block_height){
user(id: $id, block: $block){
id
routeCount
}
}
@@ -1,6 +0,0 @@
query users($block: Block_height, $where: User_filter, $orderBy: User_orderBy, $orderDirection: OrderDirection, $first: Int, $skip: Int){
users(block: $block, where: $where, orderBy: $orderBy, orderDirection: $orderDirection, first: $first, skip: $skip){
id
routeCount
}
}
@@ -1,309 +0,0 @@
directive @cacheControl(maxAge: Int, inheritMaxAge: Boolean, scope: CacheControlScope) on FIELD_DEFINITION | OBJECT | INTERFACE | UNION
enum CacheControlScope {
PUBLIC
PRIVATE
}
scalar BigInt
scalar BigDecimal
scalar Bytes
type Proof {
data: String!
}
type _Block_ {
cid: String
hash: String!
number: Int!
timestamp: Int!
parentHash: String!
}
type _Transaction_ {
hash: String!
index: Int!
from: String!
to: String!
}
type ResultEvent {
block: _Block_!
tx: _Transaction_!
contract: String!
eventIndex: Int!
event: Event!
proof: Proof
}
union Event = OwnershipTransferredEvent | RouteEvent
type OwnershipTransferredEvent {
previousOwner: String!
newOwner: String!
}
type RouteEvent {
from: String!
to: String!
tokenIn: String!
tokenOut: String!
amountIn: BigInt!
amountOutMin: BigInt!
amountOut: BigInt!
}
input Block_height {
hash: Bytes
number: Int
}
input BlockChangedFilter {
number_gte: Int!
}
enum OrderDirection {
asc
desc
}
enum RouteProcessor_orderBy {
id
routeCount
userCount
}
input RouteProcessor_filter {
id: ID
id_not: ID
id_gt: ID
id_lt: ID
id_gte: ID
id_lte: ID
id_in: [ID!]
id_not_in: [ID!]
routeCount: BigInt
routeCount_not: BigInt
routeCount_gt: BigInt
routeCount_lt: BigInt
routeCount_gte: BigInt
routeCount_lte: BigInt
routeCount_in: [BigInt!]
routeCount_not_in: [BigInt!]
userCount: BigInt
userCount_not: BigInt
userCount_gt: BigInt
userCount_lt: BigInt
userCount_gte: BigInt
userCount_lte: BigInt
userCount_in: [BigInt!]
userCount_not_in: [BigInt!]
_change_block: BlockChangedFilter
and: [RouteProcessor_filter]
or: [RouteProcessor_filter]
}
enum Route_orderBy {
id
from
to
tokenIn
tokenOut
amountIn
amountOutMin
amountOut
timestamp
}
input Route_filter {
id: ID
id_not: ID
id_gt: ID
id_lt: ID
id_gte: ID
id_lte: ID
id_in: [ID!]
id_not_in: [ID!]
from: Bytes
from_not: Bytes
from_gt: Bytes
from_lt: Bytes
from_gte: Bytes
from_lte: Bytes
from_in: [Bytes!]
from_not_in: [Bytes!]
from_contains: Bytes
from_not_contains: Bytes
to: Bytes
to_not: Bytes
to_gt: Bytes
to_lt: Bytes
to_gte: Bytes
to_lte: Bytes
to_in: [Bytes!]
to_not_in: [Bytes!]
to_contains: Bytes
to_not_contains: Bytes
tokenIn: Bytes
tokenIn_not: Bytes
tokenIn_gt: Bytes
tokenIn_lt: Bytes
tokenIn_gte: Bytes
tokenIn_lte: Bytes
tokenIn_in: [Bytes!]
tokenIn_not_in: [Bytes!]
tokenIn_contains: Bytes
tokenIn_not_contains: Bytes
tokenOut: Bytes
tokenOut_not: Bytes
tokenOut_gt: Bytes
tokenOut_lt: Bytes
tokenOut_gte: Bytes
tokenOut_lte: Bytes
tokenOut_in: [Bytes!]
tokenOut_not_in: [Bytes!]
tokenOut_contains: Bytes
tokenOut_not_contains: Bytes
amountIn: BigInt
amountIn_not: BigInt
amountIn_gt: BigInt
amountIn_lt: BigInt
amountIn_gte: BigInt
amountIn_lte: BigInt
amountIn_in: [BigInt!]
amountIn_not_in: [BigInt!]
amountOutMin: BigInt
amountOutMin_not: BigInt
amountOutMin_gt: BigInt
amountOutMin_lt: BigInt
amountOutMin_gte: BigInt
amountOutMin_lte: BigInt
amountOutMin_in: [BigInt!]
amountOutMin_not_in: [BigInt!]
amountOut: BigInt
amountOut_not: BigInt
amountOut_gt: BigInt
amountOut_lt: BigInt
amountOut_gte: BigInt
amountOut_lte: BigInt
amountOut_in: [BigInt!]
amountOut_not_in: [BigInt!]
timestamp: BigInt
timestamp_not: BigInt
timestamp_gt: BigInt
timestamp_lt: BigInt
timestamp_gte: BigInt
timestamp_lte: BigInt
timestamp_in: [BigInt!]
timestamp_not_in: [BigInt!]
_change_block: BlockChangedFilter
and: [Route_filter]
or: [Route_filter]
}
enum User_orderBy {
id
routeCount
}
input User_filter {
id: ID
id_not: ID
id_gt: ID
id_lt: ID
id_gte: ID
id_lte: ID
id_in: [ID!]
id_not_in: [ID!]
routeCount: BigInt
routeCount_not: BigInt
routeCount_gt: BigInt
routeCount_lt: BigInt
routeCount_gte: BigInt
routeCount_lte: BigInt
routeCount_in: [BigInt!]
routeCount_not_in: [BigInt!]
_change_block: BlockChangedFilter
and: [User_filter]
or: [User_filter]
}
type _MetaBlock_ {
hash: Bytes
number: Int!
timestamp: Int
}
type _Meta_ {
block: _MetaBlock_!
deployment: String!
hasIndexingErrors: Boolean!
}
type ResultState {
block: _Block_!
contractAddress: String!
cid: String!
kind: String!
data: String!
}
type SyncStatus {
latestIndexedBlockHash: String!
latestIndexedBlockNumber: Int!
latestCanonicalBlockHash: String!
latestCanonicalBlockNumber: Int!
initialIndexedBlockHash: String!
initialIndexedBlockNumber: Int!
latestProcessedBlockHash: String!
latestProcessedBlockNumber: Int!
}
type Query {
events(blockHash: String!, contractAddress: String!, name: String): [ResultEvent!]
eventsInRange(fromBlockNumber: Int!, toBlockNumber: Int!): [ResultEvent!]
routeProcessor(id: ID!, block: Block_height): RouteProcessor
routeProcessors(block: Block_height, where: RouteProcessor_filter, orderBy: RouteProcessor_orderBy, orderDirection: OrderDirection, first: Int = 100, skip: Int = 0): [RouteProcessor!]!
route(id: ID!, block: Block_height): Route
routes(block: Block_height, where: Route_filter, orderBy: Route_orderBy, orderDirection: OrderDirection, first: Int = 100, skip: Int = 0): [Route!]!
user(id: ID!, block: Block_height): User
users(block: Block_height, where: User_filter, orderBy: User_orderBy, orderDirection: OrderDirection, first: Int = 100, skip: Int = 0): [User!]!
_meta(block: Block_height): _Meta_
getStateByCID(cid: String!): ResultState
getState(blockHash: String!, contractAddress: String!, kind: String): ResultState
getSyncStatus: SyncStatus
}
type RouteProcessor {
id: ID!
routeCount: BigInt!
userCount: BigInt!
}
type Route {
id: ID!
from: Bytes!
to: Bytes!
tokenIn: Bytes!
tokenOut: Bytes!
amountIn: BigInt!
amountOutMin: BigInt!
amountOut: BigInt!
timestamp: BigInt!
}
type User {
id: ID!
routeCount: BigInt!
}
type Mutation {
watchContract(address: String!, kind: String!, checkpoint: Boolean!, startingBlock: Int): Boolean!
}
type Subscription {
onEvent: ResultEvent!
}
@@ -1,289 +0,0 @@
[
{
"inputs": [
{
"internalType": "address",
"name": "_bentoBox",
"type": "address"
},
{
"internalType": "address[]",
"name": "priviledgedUserList",
"type": "address[]"
}
],
"stateMutability": "nonpayable",
"type": "constructor"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "previousOwner",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "newOwner",
"type": "address"
}
],
"name": "OwnershipTransferred",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "from",
"type": "address"
},
{
"indexed": false,
"internalType": "address",
"name": "to",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "tokenIn",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "tokenOut",
"type": "address"
},
{
"indexed": false,
"internalType": "uint256",
"name": "amountIn",
"type": "uint256"
},
{
"indexed": false,
"internalType": "uint256",
"name": "amountOutMin",
"type": "uint256"
},
{
"indexed": false,
"internalType": "uint256",
"name": "amountOut",
"type": "uint256"
}
],
"name": "Route",
"type": "event"
},
{
"inputs": [],
"name": "bentoBox",
"outputs": [
{
"internalType": "contract IBentoBoxMinimal",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "owner",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "pause",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "tokenIn",
"type": "address"
},
{
"internalType": "uint256",
"name": "amountIn",
"type": "uint256"
},
{
"internalType": "address",
"name": "tokenOut",
"type": "address"
},
{
"internalType": "uint256",
"name": "amountOutMin",
"type": "uint256"
},
{
"internalType": "address",
"name": "to",
"type": "address"
},
{
"internalType": "bytes",
"name": "route",
"type": "bytes"
}
],
"name": "processRoute",
"outputs": [
{
"internalType": "uint256",
"name": "amountOut",
"type": "uint256"
}
],
"stateMutability": "payable",
"type": "function"
},
{
"inputs": [],
"name": "renounceOwnership",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"name": "resume",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "user",
"type": "address"
},
{
"internalType": "bool",
"name": "priviledge",
"type": "bool"
}
],
"name": "setPriviledge",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "newOwner",
"type": "address"
}
],
"name": "transferOwnership",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address payable",
"name": "transferValueTo",
"type": "address"
},
{
"internalType": "uint256",
"name": "amountValueTransfer",
"type": "uint256"
},
{
"internalType": "address",
"name": "tokenIn",
"type": "address"
},
{
"internalType": "uint256",
"name": "amountIn",
"type": "uint256"
},
{
"internalType": "address",
"name": "tokenOut",
"type": "address"
},
{
"internalType": "uint256",
"name": "amountOutMin",
"type": "uint256"
},
{
"internalType": "address",
"name": "to",
"type": "address"
},
{
"internalType": "bytes",
"name": "route",
"type": "bytes"
}
],
"name": "transferValueAndprocessRoute",
"outputs": [
{
"internalType": "uint256",
"name": "amountOut",
"type": "uint256"
}
],
"stateMutability": "payable",
"type": "function"
},
{
"inputs": [
{
"internalType": "int256",
"name": "amount0Delta",
"type": "int256"
},
{
"internalType": "int256",
"name": "amount1Delta",
"type": "int256"
},
{
"internalType": "bytes",
"name": "data",
"type": "bytes"
}
],
"name": "uniswapV3SwapCallback",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"stateMutability": "payable",
"type": "receive"
}
]
@@ -1,38 +0,0 @@
type RouteProcessor @entity {
# route processor address
id: ID!
# amount of routes processed
routeCount: BigInt!
# amount of users
userCount: BigInt!
}
type Route @entity {
# tx hash - tx index
id: ID!
# from address
from: Bytes!
# to address
to: Bytes!
# tokenIn address
tokenIn: Bytes!
# tokenOut address
tokenOut: Bytes!
# amount of tokenIn
amountIn: BigInt!
# min amount of tokenOut
amountOutMin: BigInt!
# amount of tokenOut
amountOut: BigInt!
# timestamp
timestamp: BigInt!
}
type User @entity {
# user address
id: ID!
# amount of routes processed
routeCount: BigInt!
# list of routes processed
#routes: [Route!]! @derivedFrom(field: "from")
}
@@ -1,24 +0,0 @@
specVersion: 0.0.4
schema:
file: schema.graphql
dataSources:
- kind: ethereum/contract
name: RouteProcessor
network: mainnet
source:
address: "0x1f2fcf1d036b375b384012e61d3aa33f8c256bbe"
startBlock: 3685230
abi: RouteProcessor
mapping:
kind: ethereum/events
apiVersion: 0.0.6
language: wasm/assemblyscript
file: RouteProcessor/RouteProcessor.wasm
entities: []
abis:
- name: RouteProcessor
file: RouteProcessor/abis/RouteProcessor3.json
eventHandlers:
- event: Route(indexed address,address,indexed address,indexed
address,uint256,uint256,uint256)
handler: handleRoute
+1
View File
@@ -1,6 +1,7 @@
node_modules/
dist/
out/
gql-logs/
.vscode
.idea
+1 -1
View File
@@ -2,7 +2,7 @@
## Source
* Subgraph: sushiswap-subgraphs [v0.1.1-watcher-0.1.0](https://github.com/cerc-io/sushiswap-subgraphs/releases/tag/v0.1.1-watcher-0.1.0)
* Subgraph: sushiswap-subgraphs v0.1.1-watcher
## Setup
+5 -5
View File
@@ -39,11 +39,11 @@
"homepage": "https://github.com/cerc-io/watcher-ts#readme",
"dependencies": {
"@apollo/client": "^3.3.19",
"@cerc-io/cli": "^0.2.94",
"@cerc-io/ipld-eth-client": "^0.2.94",
"@cerc-io/solidity-mapper": "^0.2.94",
"@cerc-io/util": "^0.2.94",
"@cerc-io/graph-node": "^0.2.94",
"@cerc-io/cli": "^0.2.93",
"@cerc-io/ipld-eth-client": "^0.2.93",
"@cerc-io/solidity-mapper": "^0.2.93",
"@cerc-io/util": "^0.2.93",
"@cerc-io/graph-node": "^0.2.93",
"@ethersproject/providers": "^5.4.4",
"debug": "^4.3.1",
"decimal.js": "^10.3.1",
+44 -75
View File
@@ -194,10 +194,10 @@
binaryen "101.0.0-nightly.20210723"
long "^4.0.0"
"@cerc-io/cache@^0.2.94":
version "0.2.94"
resolved "https://git.vdb.to/api/packages/cerc-io/npm/%40cerc-io%2Fcache/-/0.2.94/cache-0.2.94.tgz#e1557bfc3c85ebe3b83f24c79b55c7324797e7ed"
integrity sha512-9NBMd+19aBs3lgiie0X6TJizcn7yBCfEXXlbvMvac9SgYDPcloU+ghauQephAxayRjaWkrgjjfEWR/I0x6FwqA==
"@cerc-io/cache@^0.2.93":
version "0.2.93"
resolved "https://git.vdb.to/api/packages/cerc-io/npm/%40cerc-io%2Fcache/-/0.2.93/cache-0.2.93.tgz#3032714167cac33957aeba16a8066c58437d7002"
integrity sha512-iH18oDRP40sTZkCCWvxZxvrankIJNjI3smXS4WOng1p4fUmt3N+uINCzGmNdZPpfj4ZFdoNgrFGkqeYyUiNCpA==
dependencies:
canonical-json "^0.0.4"
debug "^4.3.1"
@@ -205,19 +205,19 @@
fs-extra "^10.0.0"
level "^7.0.0"
"@cerc-io/cli@^0.2.94":
version "0.2.94"
resolved "https://git.vdb.to/api/packages/cerc-io/npm/%40cerc-io%2Fcli/-/0.2.94/cli-0.2.94.tgz#f193165a4b85174c48150051ea4b0e3df57fdf9e"
integrity sha512-aJGzH630bhYca74efVEU37sCjxRLmERDObzNpKIjbmYjKPg6urMbYI8gs33R2HIS/FUOMS39F5B9NMwgCQd/Vw==
"@cerc-io/cli@^0.2.93":
version "0.2.93"
resolved "https://git.vdb.to/api/packages/cerc-io/npm/%40cerc-io%2Fcli/-/0.2.93/cli-0.2.93.tgz#ee2b22a40f358ecb5ef44301d0ab5120e75bd803"
integrity sha512-QTEerZn4UdYaGNGXv8UZD+T1+MnYp6l2N/dWkCJBw+8df/46ec5dVuLH1kvCk6LwBUOIKrgIsosDhTPQjDS6bA==
dependencies:
"@apollo/client" "^3.7.1"
"@cerc-io/cache" "^0.2.94"
"@cerc-io/ipld-eth-client" "^0.2.94"
"@cerc-io/cache" "^0.2.93"
"@cerc-io/ipld-eth-client" "^0.2.93"
"@cerc-io/libp2p" "^0.42.2-laconic-0.1.4"
"@cerc-io/nitro-node" "^0.1.15"
"@cerc-io/peer" "^0.2.94"
"@cerc-io/rpc-eth-client" "^0.2.94"
"@cerc-io/util" "^0.2.94"
"@cerc-io/peer" "^0.2.93"
"@cerc-io/rpc-eth-client" "^0.2.93"
"@cerc-io/util" "^0.2.93"
"@ethersproject/providers" "^5.4.4"
"@graphql-tools/utils" "^9.1.1"
"@ipld/dag-cbor" "^8.0.0"
@@ -238,16 +238,16 @@
typeorm "0.2.37"
yargs "^17.0.1"
"@cerc-io/graph-node@^0.2.94":
version "0.2.94"
resolved "https://git.vdb.to/api/packages/cerc-io/npm/%40cerc-io%2Fgraph-node/-/0.2.94/graph-node-0.2.94.tgz#e8d346daa9e7733098d039d27e7d575e0f978b20"
integrity sha512-bGqv/5dq2saBcekA/YqDcepvRaZVIMPXt/lDEcP+8lXmavImXO1sdnut7JyMDQCy3DNKXT6IGADPM/olUwnDPQ==
"@cerc-io/graph-node@^0.2.93":
version "0.2.93"
resolved "https://git.vdb.to/api/packages/cerc-io/npm/%40cerc-io%2Fgraph-node/-/0.2.93/graph-node-0.2.93.tgz#a310c6af84bae6f28216e4cdd439396a4e7fb555"
integrity sha512-EbEziMAMuOBel+f4dxJ24AOaQPV41w/1sA5d/0v3KKvOLcrtgs0EysbeJYtUY7ru3fmCcMcP1Y+4k+dsp07nAQ==
dependencies:
"@apollo/client" "^3.3.19"
"@cerc-io/assemblyscript" "0.19.10-watcher-ts-0.1.2"
"@cerc-io/cache" "^0.2.94"
"@cerc-io/ipld-eth-client" "^0.2.94"
"@cerc-io/util" "^0.2.94"
"@cerc-io/cache" "^0.2.93"
"@cerc-io/ipld-eth-client" "^0.2.93"
"@cerc-io/util" "^0.2.93"
"@types/json-diff" "^0.5.2"
"@types/yargs" "^17.0.0"
bn.js "^4.11.9"
@@ -264,14 +264,14 @@
typeorm-naming-strategies "^2.0.0"
yargs "^17.0.1"
"@cerc-io/ipld-eth-client@^0.2.94":
version "0.2.94"
resolved "https://git.vdb.to/api/packages/cerc-io/npm/%40cerc-io%2Fipld-eth-client/-/0.2.94/ipld-eth-client-0.2.94.tgz#22f79eaf82da60a25d8f89f23cf45581c012d6ff"
integrity sha512-IOOZrryZ3M7ndhk8N9NeRaXvzC8eU2OS0z7fVL0xZ/h3Ei4D+dz8fVJbCvgGRB6mJadrMXYyhahOtEAJYxjNHg==
"@cerc-io/ipld-eth-client@^0.2.93":
version "0.2.93"
resolved "https://git.vdb.to/api/packages/cerc-io/npm/%40cerc-io%2Fipld-eth-client/-/0.2.93/ipld-eth-client-0.2.93.tgz#8a8a25fd6a8d9964de9211545e45ecc6d692e124"
integrity sha512-XT9axNOg0mr/mHWrUiadLSqx4EW/8/9flCsTBNiuZjZSv5d8BtCtsPaI5AGBYbsIiA9ffhW36pYknJU0QlHi2g==
dependencies:
"@apollo/client" "^3.7.1"
"@cerc-io/cache" "^0.2.94"
"@cerc-io/util" "^0.2.94"
"@cerc-io/cache" "^0.2.93"
"@cerc-io/util" "^0.2.93"
cross-fetch "^3.1.4"
debug "^4.3.1"
ethers "^5.4.4"
@@ -394,7 +394,7 @@
lodash "^4.17.21"
uint8arrays "^4.0.3"
"@cerc-io/peer@^0.2.65":
"@cerc-io/peer@^0.2.65", "@cerc-io/peer@^0.2.93":
version "0.2.93"
resolved "https://git.vdb.to/api/packages/cerc-io/npm/%40cerc-io%2Fpeer/-/0.2.93/peer-0.2.93.tgz#4290d8e279f4e36d6e6673f493395a78230b5567"
integrity sha512-LA2x973cp4QtuBhILgX/2HYH5hQFB4su7w/gTQEzgKsnm8Zwv+dKriciJP0vxycMlZFRIDsSheYJkRPBz2vVEQ==
@@ -424,36 +424,6 @@
unique-names-generator "^4.7.1"
yargs "^17.0.1"
"@cerc-io/peer@^0.2.94":
version "0.2.94"
resolved "https://git.vdb.to/api/packages/cerc-io/npm/%40cerc-io%2Fpeer/-/0.2.94/peer-0.2.94.tgz#c8776a9968b32d96fb91ed2a2c6d4b62b365e4a0"
integrity sha512-QQANziPnT08guAD/Nwy/HoqgIIX+w1+GS2bOUE4hfS+LJmTiZ+Zquiqcj69qGQeMQxfiUHmsBPttioF+B9rp/A==
dependencies:
"@cerc-io/libp2p" "^0.42.2-laconic-0.1.4"
"@cerc-io/prometheus-metrics" "1.1.4"
"@chainsafe/libp2p-gossipsub" "^6.0.0"
"@chainsafe/libp2p-noise" "^11.0.0"
"@chainsafe/libp2p-yamux" "3.0.7"
"@libp2p/floodsub" "^6.0.0"
"@libp2p/mplex" "^7.1.1"
"@libp2p/peer-id-factory" "^2.0.0"
"@libp2p/pubsub-peer-discovery" "^8.0.0"
"@libp2p/websockets" "^5.0.5"
"@multiformats/multiaddr" "^11.1.4"
assert "^2.0.0"
buffer "^6.0.3"
chai "^4.3.4"
debug "^4.3.1"
it-length-prefixed "^8.0.4"
it-map "^2.0.0"
it-pipe "^2.0.5"
it-pushable "^3.1.2"
mocha "^8.4.0"
p-event "^5.0.1"
uint8arrays "^4.0.3"
unique-names-generator "^4.7.1"
yargs "^17.0.1"
"@cerc-io/prometheus-metrics@1.1.4":
version "1.1.4"
resolved "https://git.vdb.to/api/packages/cerc-io/npm/%40cerc-io%2Fprometheus-metrics/-/1.1.4/prometheus-metrics-1.1.4.tgz#51006b0b5bf6168394390c78072a1c0bb2b02f28"
@@ -466,23 +436,23 @@
it-stream-types "^1.0.4"
promjs "^0.4.2"
"@cerc-io/rpc-eth-client@^0.2.94":
version "0.2.94"
resolved "https://git.vdb.to/api/packages/cerc-io/npm/%40cerc-io%2Frpc-eth-client/-/0.2.94/rpc-eth-client-0.2.94.tgz#0c4f679abacf0aed831cbd295d21780f2a3dd17a"
integrity sha512-S3UvHO7Qb4Z43+fArMbrs78CP8l81D5Ootd225MQ2//TGmu9QsIK9+oqdI1CIVAQCbxI7QAStzdz76Y0px2iFA==
"@cerc-io/rpc-eth-client@^0.2.93":
version "0.2.93"
resolved "https://git.vdb.to/api/packages/cerc-io/npm/%40cerc-io%2Frpc-eth-client/-/0.2.93/rpc-eth-client-0.2.93.tgz#71a695926ce1e256beb6c5b81cc4bc45d44bcd56"
integrity sha512-ZMFhUk7Y5itW5B1Y1zOszdH+0LsYSwFWsmHc7Xf55jSVBMFsZYkyBJrrrcBPKdBRy/f0xfs3GsIAuCbTbG+9+g==
dependencies:
"@cerc-io/cache" "^0.2.94"
"@cerc-io/ipld-eth-client" "^0.2.94"
"@cerc-io/util" "^0.2.94"
"@cerc-io/cache" "^0.2.93"
"@cerc-io/ipld-eth-client" "^0.2.93"
"@cerc-io/util" "^0.2.93"
chai "^4.3.4"
ethers "^5.4.4"
left-pad "^1.3.0"
mocha "^8.4.0"
"@cerc-io/solidity-mapper@^0.2.94":
version "0.2.94"
resolved "https://git.vdb.to/api/packages/cerc-io/npm/%40cerc-io%2Fsolidity-mapper/-/0.2.94/solidity-mapper-0.2.94.tgz#a414653bf20fcbedd91d4a544c6a019c8a02d958"
integrity sha512-kO2xqyAeq2+bbxBcItsT6i8qK1F0BhaYPzV1tTNXgGbkp3j1do86mc6IeTEeV6J/8e9EaeRBsOSQOdGOHUjcDA==
"@cerc-io/solidity-mapper@^0.2.93":
version "0.2.93"
resolved "https://git.vdb.to/api/packages/cerc-io/npm/%40cerc-io%2Fsolidity-mapper/-/0.2.93/solidity-mapper-0.2.93.tgz#ade5e2490a28255a834b9b91c6f11e8d3c4cba87"
integrity sha512-XVYTPHr059+LsTt+2bkQ8XD97F5gnHc9A9JhXbhT8rvDg5o0iFNKHmWzIRMUA8lys4r4BReMlT4ZOA9RpA/aGA==
dependencies:
dotenv "^10.0.0"
@@ -491,15 +461,15 @@
resolved "https://git.vdb.to/api/packages/cerc-io/npm/%40cerc-io%2Fts-channel/-/1.0.3-ts-nitro-0.1.1/ts-channel-1.0.3-ts-nitro-0.1.1.tgz#0768781313a167295c0bf21307f47e02dc17e936"
integrity sha512-2jFICUSyffuZ+8+qRhXuLSJq4GJ6Y02wxiXoubH0Kzv2lIKkJtWICY1ZQQhtXAvP0ncAQB85WJHqtqwH8l7J3Q==
"@cerc-io/util@^0.2.94":
version "0.2.94"
resolved "https://git.vdb.to/api/packages/cerc-io/npm/%40cerc-io%2Futil/-/0.2.94/util-0.2.94.tgz#5d4c8046cf44641eac39a6f6ee11f2eb8b298c1f"
integrity sha512-4B1RkUKZoRMVVxWK5u+5d3GEmn0IN1FoAbkfCsBXMTH+OGI+VVGg6bRozaluy7pegpwDh1KtiH0A7NFjUup4OQ==
"@cerc-io/util@^0.2.93":
version "0.2.93"
resolved "https://git.vdb.to/api/packages/cerc-io/npm/%40cerc-io%2Futil/-/0.2.93/util-0.2.93.tgz#8fcca36b2f539dbfb75e54240542e29f40e87ed6"
integrity sha512-nvlzXfNrtPtovEOigDHEb43Q3ZzY0ZEAyjjrctLvVMSM6clPneaDJI7jdzLuUsPlKJmSphRmoGGf4up+CMcGZg==
dependencies:
"@apollo/utils.keyvaluecache" "^1.0.1"
"@cerc-io/nitro-node" "^0.1.15"
"@cerc-io/peer" "^0.2.94"
"@cerc-io/solidity-mapper" "^0.2.94"
"@cerc-io/peer" "^0.2.93"
"@cerc-io/solidity-mapper" "^0.2.93"
"@cerc-io/ts-channel" "1.0.3-ts-nitro-0.1.1"
"@ethersproject/properties" "^5.7.0"
"@ethersproject/providers" "^5.4.4"
@@ -541,7 +511,6 @@
toml "^3.0.0"
typeorm "0.2.37"
typeorm-naming-strategies "^2.0.0"
winston "^3.13.0"
ws "^8.11.0"
yargs "^17.0.1"