Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changes for new graph network #34

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,19 @@
"abigen": "yarn script generate-abis",
"postabigen": "prettier --list-different --write abis",
"precodegen": "rimraf subgraph/generated",
"codegen": "graph codegen subgraph.js --output-dir subgraph/generated --skip-migrations",
"build": "graph build subgraph.js --skip-migrations",
"codegen": "graph codegen subgraph.js --studio --output-dir subgraph/generated",
"build": "graph build subgraph.js --studio --skip-migrations",
"predeploy": "graph create alchemix/alchemix --node http://127.0.0.1:8020 || true",
"deploy": "graph deploy alchemix/alchemix subgraph.js --ipfs http://localhost:5001 --node http://127.0.0.1:8020/ --skip-migrations --version-label local",
"deploy-prod": "graph deploy alchemix-finance/alchemix_v2 subgraph.js --product hosted-service --skip-migrations",
"deploy-dev": "export NETWORK_NAME=mainnet; graph deploy alchemix-finance/alchemix_v2_dev subgraph.js --product hosted-service --skip-migrations",
"deploy-ftm": "export NETWORK_NAME=fantom; graph deploy alchemix-finance/alchemix_v2_ftm subgraph.ftm.js --product hosted-service --skip-migrations",
"deploy-peg": "graph deploy alchemix-finance/alcx-curve-dev subgraph.js --product hosted-service --skip-migrations",
"deploy-prod": "graph deploy --studio alchemix_v2 subgraph.js --studio --skip-migrations",
"deploy-dev": "export NETWORK_NAME=mainnet; graph deploy --studio alchemix_v2_dev --skip-migrations",
"deploy-ftm": "export NETWORK_NAME=fantom; graph deploy --studio alchemix_v2_ftm --skip-migrations",
"deploy-peg": "graph deploy --studio alcx-curve-dev subgraph.js --skip-migrations",
"lint": "prettier --ignore-path .gitignore --list-different \"**/*.{ts,js,json,yaml}\""
},
"devDependencies": {
"@graphprotocol/graph-cli": "^0.26.0",
"@graphprotocol/graph-ts": "^0.24.1",
"@graphprotocol/graph-cli": "^0.37.1",
"@graphprotocol/graph-ts": "^0.29.0",
"@graphql-codegen/cli": "^2.6.2",
"@tsconfig/node16": "^1.0.2",
"@types/fs-extra": "^9.0.13",
Expand Down
14 changes: 7 additions & 7 deletions subgraph/handlers/FactoryPool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ function getEventId(event: ethereum.Event): string {
}

function getPoolSnapshot(pool: Pool, poolAddress: Address, event: ethereum.Event): Pool {
if (pool != null) {
if (pool) {
let poolContract = FactoryPool.bind(poolAddress);

// Update coin balances and underlying coin balances/rates
Expand All @@ -59,7 +59,7 @@ export function handleAddLiquidity(event: AddLiquidity): void {
createFactoryPoolEvent<PoolAddLiquidityEvent>(event);
let pool = getOrCreatePool(event.address, event);

if (pool != null) {
if (pool) {
pool = getPoolSnapshot(pool, event.address, event);

let provider = getOrCreateAccount(event.params.provider);
Expand All @@ -85,7 +85,7 @@ export function handleRemoveLiquidity(event: RemoveLiquidity): void {
createFactoryPoolEvent<PoolRemoveLiquidityEvent>(event);
let pool = getOrCreatePool(event.address, event);

if (pool != null) {
if (pool) {
pool = getPoolSnapshot(pool, event.address, event);

let provider = getOrCreateAccount(event.params.provider);
Expand All @@ -112,7 +112,7 @@ export function handleRemoveLiquidityOne(event: RemoveLiquidityOne): void {
createFactoryPoolEvent<PoolRemoveLiquidityOneEvent>(event);
let pool = getOrCreatePool(event.address, event);

if (pool != null) {
if (pool) {
pool = getPoolSnapshot(pool, event.address, event);

let provider = getOrCreateAccount(event.params.provider);
Expand All @@ -139,7 +139,7 @@ export function handleApproval(event: Transfer): void {}
function getOrCreatePool(address: Address, event: ethereum.Event): Pool {
let pool = Pool.load(address.toHexString());

if (pool == null) {
if (pool === null) {
let poolContract = FactoryPool.bind(address as Address);

pool = new Pool(address.toHexString());
Expand Down Expand Up @@ -340,7 +340,7 @@ class TokenInfo {
export function getOrCreateToken(address: Address, event: ethereum.Event): Token {
let token = Token.load(address.toHexString());

if (token == null) {
if (token === null) {
token = new Token(address.toHexString());
token.address = address;

Expand Down Expand Up @@ -379,7 +379,7 @@ export function handleTokenExchange(event: TokenExchange): void {}
// export function handleTokenExchange(event: TokenExchange): void {
// let pool = getOrCreatePool(event.address, event);

// if (pool != null) {
// if (pool) {
// pool = getPoolSnapshot(pool, event.address, event)

// let coinSold = Coin.load(pool.id + '-' + event.params.sold_id.toString())!
Expand Down
16 changes: 8 additions & 8 deletions subgraph/handlers/MetaPool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ function getEventId(event: ethereum.Event): string {
}

function getPoolSnapshot(pool: Pool, poolAddress: Address, event: ethereum.Event): Pool {
if (pool != null) {
if (pool) {
let poolContract = MetaPool.bind(poolAddress);

// Update coin balances and underlying coin balances/rates
Expand All @@ -60,7 +60,7 @@ export function handleAddLiquidity(event: AddLiquidity): void {
createMetaPoolEvent<PoolAddLiquidityEvent>(event);
let pool = getOrCreatePool(event.address, event);

if (pool != null) {
if (pool) {
pool = getPoolSnapshot(pool, event.address, event);

let provider = getOrCreateAccount(event.params.provider);
Expand All @@ -86,7 +86,7 @@ export function handleRemoveLiquidity(event: RemoveLiquidity): void {
createMetaPoolEvent<PoolRemoveLiquidityEvent>(event);
let pool = getOrCreatePool(event.address, event);

if (pool != null) {
if (pool) {
pool = getPoolSnapshot(pool, event.address, event);

let provider = getOrCreateAccount(event.params.provider);
Expand All @@ -113,7 +113,7 @@ export function handleRemoveLiquidityOne(event: RemoveLiquidityOne): void {
createMetaPoolEvent<PoolRemoveLiquidityOneEvent>(event);
let pool = getOrCreatePool(event.address, event);

if (pool != null) {
if (pool) {
pool = getPoolSnapshot(pool, event.address, event);

let provider = getOrCreateAccount(event.params.provider);
Expand All @@ -137,7 +137,7 @@ export function handleRemoveLiquidityOne(event: RemoveLiquidityOne): void {
function getOrCreatePool(address: Address, event: ethereum.Event): Pool {
let pool = Pool.load(address.toHexString());

if (pool == null) {
if (pool === null) {
let poolContract = MetaPool.bind(address as Address);

pool = new Pool(address.toHexString());
Expand Down Expand Up @@ -344,7 +344,7 @@ class TokenInfo {
export function getOrCreateToken(address: Address, event: ethereum.Event): Token {
let token = Token.load(address.toHexString());

if (token == null) {
if (token === null) {
token = new Token(address.toHexString());
token.address = address;

Expand Down Expand Up @@ -383,7 +383,7 @@ export function handleTokenExchange(event: TokenExchange): void {}
// export function handleTokenExchange(event: TokenExchange): void {
// let pool = getOrCreatePool(event.address, event);

// if (pool != null) {
// if (pool) {
// pool = getPoolSnapshot(pool, event.address, event)

// let coinSold = Coin.load(pool.id + '-' + event.params.sold_id.toString())!
Expand Down Expand Up @@ -433,7 +433,7 @@ export function handleTokenExchangeUnderlying(event: TokenExchangeUnderlying): v
// export function handleTokenExchangeUnderlying(event: TokenExchangeUnderlying): void {
// let pool = getOrCreatePool(event.address, event);

// if (pool != null) {
// if (pool) {
// pool = getPoolSnapshot(pool, event.address, event)

// let coinSold = getOrCreateUnderlyingCoin(pool, token, event.params.sold_id, event);
Expand Down
6 changes: 3 additions & 3 deletions subgraph/handlers/volume.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export function getHourlyTradeVolume(pool: Pool, timestamp: BigInt): HourlyVolum

let volume = HourlyVolume.load(id);

if (volume == null) {
if (volume === null) {
volume = new HourlyVolume(id);
volume.pool = pool.id;
volume.timestamp = hour;
Expand All @@ -27,7 +27,7 @@ export function getDailyTradeVolume(pool: Pool, timestamp: BigInt): DailyVolume

let volume = DailyVolume.load(id);

if (volume == null) {
if (volume === null) {
volume = new DailyVolume(id);
volume.pool = pool.id;
volume.timestamp = day;
Expand All @@ -44,7 +44,7 @@ export function getWeeklyTradeVolume(pool: Pool, timestamp: BigInt): WeeklyVolum

let volume = WeeklyVolume.load(id);

if (volume == null) {
if (volume === null) {
volume = new WeeklyVolume(id);
volume.pool = pool.id;
volume.timestamp = week;
Expand Down
1 change: 0 additions & 1 deletion subgraph/utils/entities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import {
Transaction,
DebtToken,
YieldToken,
DebtToken,
TransmuterBalance,
Transmuter,
TransmuterBalanceHistory,
Expand Down
Loading