Skip to content

Commit

Permalink
merge with dev
Browse files Browse the repository at this point in the history
  • Loading branch information
toyv0 committed Jan 21, 2024
2 parents cdc762e + 859697f commit 5700df7
Show file tree
Hide file tree
Showing 20 changed files with 1,708 additions and 339 deletions.
2 changes: 1 addition & 1 deletion .env.example
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
NETWORK_NAME=testnet
NETWORK_NAME=MAINNET
JSONRPC_ENDPOINT=https://3.138.194.94:443

# TODO: Extract the start block number from the receipt
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
runs-on: ubuntu-latest
env:
NETWORK_NAME: mainnet
START_BLOCK_NUMBER: 14265505
START_BLOCK_NUMBER: 17265505
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
Expand Down Expand Up @@ -59,7 +59,7 @@ jobs:
if: github.ref == 'refs/heads/dev'
env:
NETWORK_NAME: mainnet
START_BLOCK_NUMBER: 14265505
START_BLOCK_NUMBER: 17265505
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
Expand Down Expand Up @@ -105,7 +105,7 @@ jobs:
if: github.ref == 'refs/heads/main'
env:
NETWORK_NAME: mainnet
START_BLOCK_NUMBER: 14265505
START_BLOCK_NUMBER: 17265505
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
Expand Down
2 changes: 1 addition & 1 deletion deployments
Submodule deployments updated 386 files
7 changes: 3 additions & 4 deletions manifests/manifest.eth.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import 'dotenv/config';

import { createThreePoolAssetManager } from '../sources/ThreePoolAssetManager';
// import { createEthAssetManager } from '../sources/EthAssetManager';
import { createEthAssetManager } from '../sources/EthAssetManager';
import { createAlchemist } from '../sources/Alchemist';
import { createTransmuter } from '../sources/Transmuter';
import { createTransmuterBuffer } from '../sources/TransmuterBuffer';
Expand All @@ -24,9 +24,8 @@ export default {
createTransmuter('TransmuterV2_ETH'),
createTransmuterBuffer('TransmuterBuffer_alUSD'),
createTransmuterBuffer('TransmuterBuffer_alETH'),
createThreePoolAssetManager('ThreePoolAssetManager_alUSD', 14543500, '0x9735F7d3Ea56b454b24fFD74C58E9bD85cfaD31B'),
// createEthAssetManager('EthAssetManager', 14573961, '0xe761bf731A06fE8259FeE05897B2687D56933110'),
// createEthAssetManager('EthAssetManager', 18475576, '0x9fb54d1F6F506Feb4c65B721bE931e59BB538c63'),
createThreePoolAssetManager('ThreePoolAssetManager_alUSD', 17265505, '0x9735F7d3Ea56b454b24fFD74C58E9bD85cfaD31B'),
createEthAssetManager('EthAssetManager', 14573961, '0xe761bf731A06fE8259FeE05897B2687D56933110'),
createMetaPool('alUSDMetaPool', '0x43b4fdfd4ff969587185cdb6f0bd875c5fc83f8c', 11955332),
createFactoryPool('alETHFactoryPool', '0xc4c319e2d4d66cca4464c0c2b32c9bd23ebe784e', 13227440),
],
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
"lint": "prettier --ignore-path .gitignore --list-different \"**/*.{ts,js,json,yaml}\""
},
"devDependencies": {
"@graphprotocol/graph-cli": "^0.67.1",
"@graphprotocol/graph-ts": "^0.32.0",
"@graphprotocol/graph-cli": "0.60.0",
"@graphprotocol/graph-ts": "0.32.0",
"@graphql-codegen/cli": "^2.6.2",
"@tsconfig/node16": "^1.0.2",
"@types/fs-extra": "^9.0.13",
Expand Down
38 changes: 37 additions & 1 deletion schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -502,8 +502,8 @@ type AlchemistSweepTokensEvent implements Event @entity {
timestamp: BigInt!
contract: Contract!
transaction: Transaction!
amount: BigInt!
rewardToken: Bytes!
amount: BigInt!
}

type AlchemistTokenAdapterUpdatedEvent implements Event @entity {
Expand Down Expand Up @@ -857,6 +857,18 @@ type TransmuterBufferSetSourceEvent implements Event @entity {
source: Bytes!
}

type TransmuterBufferSetTransmuterEvent implements Event @entity {
id: ID!
cursor: BigInt!
index: BigInt!
block: Block!
timestamp: BigInt!
contract: Contract!
transaction: Transaction!
underlyingToken: Bytes!
transmuter: Bytes!
}

type TransmuterBufferSetAmoEvent implements Event @entity {
id: ID!
cursor: BigInt!
Expand Down Expand Up @@ -1031,6 +1043,30 @@ type PoolRemoveLiquidityOneEvent implements PoolEvent @entity {
transaction: Bytes!
}

type PoolRampAEvent implements PoolEvent @entity {
id: ID!
pool: Pool!
old_A: BigInt!
new_A: BigInt!
initial_time: BigInt!
future_time: BigInt!

block: Block!
timestamp: BigInt!
transaction: Bytes!
}

type PoolStopRampAEvent implements PoolEvent @entity {
id: ID!
pool: Pool!
A: BigInt!
t: BigInt!

block: Block!
timestamp: BigInt!
transaction: Bytes!
}

type PoolExchange implements PoolEvent @entity {
id: ID!
pool: Pool!
Expand Down
2 changes: 1 addition & 1 deletion sources/Alchemist.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export function createAlchemist(
source: {
abi: 'Alchemist',
address,
startBlock: block,
startBlock: startBlockNumber,
},
};
}
80 changes: 40 additions & 40 deletions sources/EthAssetManager.ts
Original file line number Diff line number Diff line change
@@ -1,42 +1,42 @@
// import { utils } from 'ethers';
// import { eventDeclarations, deploymentAddress } from './utils/abis';
// import { networkName, startBlockNumber } from './utils/constants';
// import { DataSource } from './utils/types';
import { utils } from 'ethers';
import { eventDeclarations, deploymentAddress } from './utils/abis';
import { networkName, startBlockNumber } from './utils/constants';
import { DataSource } from './utils/types';

// const EthAssetManagerInterface = new utils.Interface(require('../abis/EthAssetManager.json'));
// const EthAssetManagerEvents = Object.values(EthAssetManagerInterface.events);
const EthAssetManagerInterface = new utils.Interface(require('../abis/EthAssetManager.json'));
const EthAssetManagerEvents = Object.values(EthAssetManagerInterface.events);

// export function createEthAssetManager(
// name: string,
// block: number = startBlockNumber,
// address: string = deploymentAddress(name),
// ): DataSource {
// return {
// name,
// network: networkName,
// kind: 'ethereum/contract',
// mapping: {
// apiVersion: '0.0.6',
// kind: 'ethereum/events',
// language: 'wasm/assemblyscript',
// file: 'subgraph/handlers/EthAssetManager.ts',
// entities: [],
// eventHandlers: eventDeclarations(EthAssetManagerEvents),
// abis: [
// {
// name: 'EthAssetManager',
// file: 'abis/EthAssetManager.json',
// },
// {
// name: 'ERC20',
// file: 'abis/ERC20.json',
// },
// ],
// },
// source: {
// abi: 'EthAssetManager',
// address,
// startBlock: block,
// },
// };
// }
export function createEthAssetManager(
name: string,
block: number = startBlockNumber,
address: string = deploymentAddress(name),
): DataSource {
return {
name,
network: networkName,
kind: 'ethereum/contract',
mapping: {
apiVersion: '0.0.6',
kind: 'ethereum/events',
language: 'wasm/assemblyscript',
file: 'subgraph/handlers/EthAssetManager.ts',
entities: [],
eventHandlers: eventDeclarations(EthAssetManagerEvents),
abis: [
{
name: 'EthAssetManager',
file: 'abis/EthAssetManager.json',
},
{
name: 'ERC20',
file: 'abis/ERC20.json',
},
],
},
source: {
abi: 'EthAssetManager',
address,
startBlock: startBlockNumber,
},
};
}
6 changes: 3 additions & 3 deletions sources/FactoryPool.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { utils } from 'ethers';
import { eventDeclarations } from './utils/abis';
import { networkName } from './utils/constants';
import { networkName, startBlockNumber } from './utils/constants';
import { DataSource } from './utils/types';

const FactoryPoolInterface = new utils.Interface(require('../abis/FactoryPool.json'));
const FactoryPoolEvents = Object.values(FactoryPoolInterface.events);

export function createFactoryPool(name: string, address: string, block: number): DataSource {
export function createFactoryPool(name: string, address: string, block: number = startBlockNumber): DataSource {
return {
name,
network: networkName,
Expand All @@ -32,7 +32,7 @@ export function createFactoryPool(name: string, address: string, block: number):
source: {
abi: 'FactoryPool',
address,
startBlock: block,
startBlock: startBlockNumber,
},
};
}
6 changes: 3 additions & 3 deletions sources/MetaPool.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { utils } from 'ethers';
import { eventDeclarations } from './utils/abis';
import { networkName } from './utils/constants';
import { networkName, startBlockNumber } from './utils/constants';
import { DataSource } from './utils/types';

const MetaPoolInterface = new utils.Interface(require('../abis/MetaPool.json'));
const MetaPoolEvents = Object.values(MetaPoolInterface.events);

export function createMetaPool(name: string, address: string, block: number): DataSource {
export function createMetaPool(name: string, address: string, block: number = startBlockNumber): DataSource {
return {
name,
network: networkName,
Expand All @@ -32,7 +32,7 @@ export function createMetaPool(name: string, address: string, block: number): Da
source: {
abi: 'MetaPool',
address,
startBlock: block,
startBlock: startBlockNumber,
},
};
}
2 changes: 1 addition & 1 deletion sources/ThreePoolAssetManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export function createThreePoolAssetManager(
source: {
abi: 'ThreePoolAssetManager',
address,
startBlock: block,
startBlock: startBlockNumber,
},
};
}
2 changes: 1 addition & 1 deletion sources/Transmuter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export function createTransmuter(
source: {
abi: 'Transmuter',
address,
startBlock: block,
startBlock: startBlockNumber,
},
};
}
2 changes: 1 addition & 1 deletion sources/TransmuterBuffer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export function createTransmuterBuffer(
source: {
abi: 'TransmuterBuffer',
address,
startBlock: block,
startBlock: startBlockNumber,
},
};
}
2 changes: 1 addition & 1 deletion sources/utils/constants.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export const networkName = process.env.NETWORK_NAME;
export const startBlockNumber = Number(process.env[`START_BLOCK_NUMBER_${process.env.NETWORK_NAME}`]);
export const startBlockNumber = Number(process.env.START_BLOCK_NUMBER);

if (!(!Number.isNaN(startBlockNumber) && Number.isInteger(startBlockNumber)) && startBlockNumber > 0) {
console.error('Invalid or missing start block number');
Expand Down
3 changes: 2 additions & 1 deletion subgraph/handlers/Alchemist.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ import {
Repay1,
Liquidate1,
Liquidate2,
SweepTokens,
} from '../generated/AlchemistV2_alUSD/Alchemist';
import { ERC20 as ERC20Contract } from '../generated/AlchemistV2_alUSD/ERC20';
import {
Expand Down Expand Up @@ -363,8 +364,8 @@ export function handleSnap(event: Snap): void {

export function handleSweepTokens(event: SweepTokens): void {
const entity = createAlchemistEvent<AlchemistSweepTokensEvent>(event);
entity.amount = event.params.amount;
entity.rewardToken = event.params.rewardToken;
entity.amount = event.params.amount;
entity.save();
}

Expand Down
Loading

0 comments on commit 5700df7

Please sign in to comment.