Skip to content

Commit

Permalink
config
Browse files Browse the repository at this point in the history
  • Loading branch information
toyv0 committed Jan 18, 2024
1 parent 8bf6ea2 commit cdc762e
Show file tree
Hide file tree
Showing 4 changed files with 77 additions and 22 deletions.
78 changes: 56 additions & 22 deletions schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -494,6 +494,18 @@ type AlchemistSnapEvent implements Event @entity {
yieldToken: Bytes!
}

type AlchemistSweepTokensEvent implements Event @entity {
id: ID!
cursor: BigInt!
index: BigInt!
block: Block!
timestamp: BigInt!
contract: Contract!
transaction: Transaction!
amount: BigInt!
rewardToken: Bytes!
}

type AlchemistTokenAdapterUpdatedEvent implements Event @entity {
id: ID!
cursor: BigInt!
Expand Down Expand Up @@ -812,6 +824,15 @@ type TransmuterBufferSetAlchemistEvent implements Event @entity {
alchemist: Bytes!
}

type TransmuterBufferSetTransmuter implements Event @entity {
id: ID!
cursor: BigInt!
index: BigInt!
block: Block!
timestamp: BigInt!
transmuter: Bytes!
}

type TransmuterBufferSetFlowRateEvent implements Event @entity {
id: ID!
cursor: BigInt!
Expand Down Expand Up @@ -985,6 +1006,19 @@ type PoolRemoveLiquidityEvent implements PoolEvent @entity {
transaction: Bytes!
}

type PoolRampAEvent implements PoolEvent @entity {
id: ID!
pool: Pool!
oldA: BigInt!
newA: BigInt!
initialTime: BigInt!
futureTime: BigInt!

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

type PoolRemoveLiquidityOneEvent implements PoolEvent @entity {
id: ID!
pool: Pool!
Expand Down Expand Up @@ -1481,25 +1515,25 @@ type EthAssetManagerReclaimEthEvent implements Event @entity {
amount: BigInt!
}

type EthAssetManagerSweepTokenEvent implements Event @entity {
id: ID!
cursor: BigInt!
index: BigInt!
block: Block!
timestamp: BigInt!
contract: Contract!
transaction: Transaction!
token: Bytes!
amount: BigInt!
}

type EthAssetManagerSweepEthEvent implements Event @entity {
id: ID!
cursor: BigInt!
index: BigInt!
block: Block!
timestamp: BigInt!
contract: Contract!
transaction: Transaction!
amount: BigInt!
}
# type EthAssetManagerSweepTokenEvent implements Event @entity {
# id: ID!
# cursor: BigInt!
# index: BigInt!
# block: Block!
# timestamp: BigInt!
# contract: Contract!
# transaction: Transaction!
# token: Bytes!
# amount: BigInt!
# }

# type EthAssetManagerSweepEthEvent implements Event @entity {
# id: ID!
# cursor: BigInt!
# index: BigInt!
# block: Block!
# timestamp: BigInt!
# contract: Contract!
# transaction: Transaction!
# amount: BigInt!
# }
10 changes: 10 additions & 0 deletions subgraph/handlers/Alchemist.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import {
AlchemistRepayLimitUpdatedEvent,
AlchemistSentinelSetEvent,
AlchemistSnapEvent,
AlchemistSweepTokensEvent,
AlchemistTokenAdapterUpdatedEvent,
AlchemistTransmuterUpdatedEvent,
AlchemistUnderlyingTokenEnabledEvent,
Expand Down Expand Up @@ -58,6 +59,7 @@ import {
RepayLimitUpdated,
SentinelSet,
Snap,
SweepTokens,
TokenAdapterUpdated,
TransmuterUpdated,
UnderlyingTokenEnabled,
Expand All @@ -82,6 +84,7 @@ import {
getOrCreateAlchemistGlobalDebtHistory,
getOrCreateDebtToken,
} from '../utils/entities';
import { SetTransmuter } from '../generated/TransmuterBuffer_alETH/TransmuterBuffer';

function getOrCreateAlchemist(event: ethereum.Event): Alchemist {
let entity = Alchemist.load(event.address.toHex());
Expand Down Expand Up @@ -358,6 +361,13 @@ export function handleSnap(event: Snap): void {
entity.save();
}

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

export function handleTokenAdapterUpdated(event: TokenAdapterUpdated): void {
const entity = createAlchemistEvent<AlchemistTokenAdapterUpdatedEvent>(event);
entity.tokenAdapter = event.params.tokenAdapter;
Expand Down
3 changes: 3 additions & 0 deletions subgraph/handlers/FactoryPool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,9 @@ export function handleAddLiquidity(event: AddLiquidity): void {
}
}

export function handleRampA(): void {}
export function handleStopRampA(): void {}

export function handleRemoveLiquidity(event: RemoveLiquidity): void {
createFactoryPoolEvent<PoolRemoveLiquidityEvent>(event);
let pool = getOrCreatePool(event.address, event);
Expand Down
8 changes: 8 additions & 0 deletions subgraph/handlers/TransmuterBuffer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
TransmuterBufferSetSourceEvent,
TransmuterBufferSetAmoEvent,
TransmuterBufferSetDivertToAmoEvent,
TransmuterBufferSetTransmuter,
} from '../generated/schema';
import {
RefreshStrategies,
Expand All @@ -22,6 +23,7 @@ import {
SetAmo,
SetFlowRate,
SetSource,
SetTransmuter,
} from '../generated/TransmuterBuffer_alETH/TransmuterBuffer';
import { SetDivertToAmo } from '../generated/TransmuterBuffer_alUSD/TransmuterBuffer';
import { createEvent, getOrCreateUnderlyingToken } from '../utils/entities';
Expand Down Expand Up @@ -87,6 +89,12 @@ export function handleSetAlchemist(event: SetAlchemist): void {
entity.save();
}

export function handleSetTransmuter(event: SetTransmuter): void {
const entity = createTransmuterBufferEvent<TransmuterBufferSetTransmuter>(event);
entity.transmuter = event.params.transmuter;
entity.save();
}

export function handleSetFlowRate(event: SetFlowRate): void {
const entity = createTransmuterBufferEvent<TransmuterBufferSetFlowRateEvent>(event);
entity.flowRate = event.params.flowRate;
Expand Down

0 comments on commit cdc762e

Please sign in to comment.