Skip to content
Merged
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
27 changes: 27 additions & 0 deletions abi/otoken-old.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
[
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"internalType": "uint256",
"name": "totalSupply",
"type": "uint256"
},
{
"indexed": false,
"internalType": "uint256",
"name": "rebasingCredits",
"type": "uint256"
},
{
"indexed": false,
"internalType": "uint256",
"name": "rebasingCreditsPerToken",
"type": "uint256"
}
],
"name": "TotalSupplyUpdated",
"type": "event"
}
]

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 9 additions & 17 deletions schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -1082,11 +1082,6 @@ type ExchangeRate @entity {
rate: BigInt!
}

enum RebasingOption {
OptIn
OptOut
}

enum HistoryType {
Sent
Received
Expand Down Expand Up @@ -1152,9 +1147,6 @@ type NativeBalance @entity {
}

type ERC20 @entity {
"""
Format: 'address'
"""
id: ID!
chainId: Int! @index
address: String! @index
Expand All @@ -1164,9 +1156,6 @@ type ERC20 @entity {
}

type ERC20Holder @entity {
"""
Format: 'address:account'
"""
id: ID!
chainId: Int! @index
address: String! @index
Expand All @@ -1176,9 +1165,6 @@ type ERC20Holder @entity {
}

type ERC20State @entity {
"""
Format: 'address:blockNumber'
"""
id: ID!
chainId: Int! @index
timestamp: DateTime! @index
Expand All @@ -1190,9 +1176,6 @@ type ERC20State @entity {
}

type ERC20Balance @entity {
"""
Format: 'address:account:blockNumber'
"""
id: ID!
chainId: Int! @index
timestamp: DateTime! @index
Expand Down Expand Up @@ -1626,6 +1609,7 @@ type OTokenAddress @entity {
balance: BigInt!
earned: BigInt!
credits: BigInt!
delegatedTo: String
lastUpdated: DateTime!
history: [OTokenHistory!]! @derivedFrom(field: "address")
}
Expand Down Expand Up @@ -1671,6 +1655,7 @@ type OTokenRebaseOption @entity {
txHash: String! @index
address: OTokenAddress!
status: RebasingOption!
delegatedTo: String
}

type OTokenAPY @entity {
Expand Down Expand Up @@ -1813,6 +1798,13 @@ type OTokenWithdrawalRequest @entity {
claimed: Boolean!
txHash: String! @index
}

enum RebasingOption {
OptIn
OptOut
YieldDelegationSource
YieldDelegationTarget
}
type MorphoMarketState @entity {
id: ID!
chainId: Int!
Expand Down
17 changes: 0 additions & 17 deletions schema/general.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,6 @@ type ExchangeRate @entity {
rate: BigInt!
}

enum RebasingOption {
OptIn
OptOut
}

enum HistoryType {
Sent
Received
Expand Down Expand Up @@ -93,9 +88,6 @@ type NativeBalance @entity {
}

type ERC20 @entity {
"""
Format: 'address'
"""
id: ID!
chainId: Int! @index
address: String! @index
Expand All @@ -105,9 +97,6 @@ type ERC20 @entity {
}

type ERC20Holder @entity {
"""
Format: 'address:account'
"""
id: ID!
chainId: Int! @index
address: String! @index
Expand All @@ -117,9 +106,6 @@ type ERC20Holder @entity {
}

type ERC20State @entity {
"""
Format: 'address:blockNumber'
"""
id: ID!
chainId: Int! @index
timestamp: DateTime! @index
Expand All @@ -131,9 +117,6 @@ type ERC20State @entity {
}

type ERC20Balance @entity {
"""
Format: 'address:account:blockNumber'
"""
id: ID!
chainId: Int! @index
timestamp: DateTime! @index
Expand Down
9 changes: 9 additions & 0 deletions schema/otoken.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ type OTokenAddress @entity {
balance: BigInt!
earned: BigInt!
credits: BigInt!
delegatedTo: String
lastUpdated: DateTime!
history: [OTokenHistory!]! @derivedFrom(field: "address")
}
Expand Down Expand Up @@ -72,6 +73,7 @@ type OTokenRebaseOption @entity {
txHash: String! @index
address: OTokenAddress!
status: RebasingOption!
delegatedTo: String
}

type OTokenAPY @entity {
Expand Down Expand Up @@ -214,3 +216,10 @@ type OTokenWithdrawalRequest @entity {
claimed: Boolean!
txHash: String! @index
}

enum RebasingOption {
OptIn
OptOut
YieldDelegationSource
YieldDelegationTarget
}
13 changes: 13 additions & 0 deletions src/abi/otoken-old.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import * as p from '@subsquid/evm-codec'
import { event, fun, viewFun, indexed, ContractBase } from '@subsquid/evm-abi'
import type { EventParams as EParams, FunctionArguments, FunctionReturn } from '@subsquid/evm-abi'

export const events = {
TotalSupplyUpdated: event("0x99e56f783b536ffacf422d59183ea321dd80dcd6d23daa13023e8afea38c3df1", "TotalSupplyUpdated(uint256,uint256,uint256)", {"totalSupply": p.uint256, "rebasingCredits": p.uint256, "rebasingCreditsPerToken": p.uint256}),
}

export class Contract extends ContractBase {
}

/// Event types
export type TotalSupplyUpdatedEventArgs = EParams<typeof events.TotalSupplyUpdated>
7 changes: 6 additions & 1 deletion src/base/erc20.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as otoken from '@abi/otoken'
import { createERC20Tracker } from '@templates/erc20'
import { createERC20SimpleTracker } from '@templates/erc20-simple'
import { createRebasingERC20Tracker } from '@templates/erc20/erc20-rebasing'
import { createRebasingERC20Tracker, getErc20RebasingParams } from '@templates/erc20/erc20-rebasing'
import { OGN_BASE_ADDRESS } from '@utils/addresses'
import { baseAddresses } from '@utils/addresses-base'
import { logFilter } from '@utils/logFilter'
Expand Down Expand Up @@ -31,6 +31,11 @@ export const baseERC20s = [
const oToken = new otoken.Contract(ctx, block.header, baseAddresses.tokens.superOETHb)
return oToken.rebasingCreditsPerTokenHighres()
},
...getErc20RebasingParams({
from: 17819702,
yieldDelegationFrom: 23192884,
address: baseAddresses.tokens.superOETHb,
}),
},
}),
// wsuperOETHb
Expand Down
3 changes: 2 additions & 1 deletion src/mainnet/processors/erc20s.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as otoken from '@abi/otoken'
import { createERC20Tracker } from '@templates/erc20'
import { createERC20SimpleTracker } from '@templates/erc20-simple'
import { createRebasingERC20Tracker } from '@templates/erc20/erc20-rebasing'
import { createRebasingERC20Tracker, getErc20RebasingParams } from '@templates/erc20/erc20-rebasing'
import {
OETH_ADDRESS,
OETH_DRIPPER_ADDRESS,
Expand Down Expand Up @@ -62,6 +62,7 @@ const rebasingTracks: Record<string, Parameters<typeof createRebasingERC20Tracke
const oToken = new otoken.Contract(ctx, block.header, tokens.OETH)
return oToken.rebasingCreditsPerTokenHighres()
},
...getErc20RebasingParams({ from: 16935276, yieldDelegationFrom: 21325305, address: OETH_ADDRESS }),
},
},
}
Expand Down
2 changes: 2 additions & 0 deletions src/model/generated/_rebasingOption.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
export enum RebasingOption {
OptIn = "OptIn",
OptOut = "OptOut",
YieldDelegationSource = "YieldDelegationSource",
YieldDelegationTarget = "YieldDelegationTarget",
}
3 changes: 0 additions & 3 deletions src/model/generated/erc20.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@ export class ERC20 {
Object.assign(this, props)
}

/**
* Format: 'address'
*/
@PrimaryColumn_()
id!: string

Expand Down
3 changes: 0 additions & 3 deletions src/model/generated/erc20Balance.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@ export class ERC20Balance {
Object.assign(this, props)
}

/**
* Format: 'address:account:blockNumber'
*/
@PrimaryColumn_()
id!: string

Expand Down
3 changes: 0 additions & 3 deletions src/model/generated/erc20Holder.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@ export class ERC20Holder {
Object.assign(this, props)
}

/**
* Format: 'address:account'
*/
@PrimaryColumn_()
id!: string

Expand Down
3 changes: 0 additions & 3 deletions src/model/generated/erc20State.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@ export class ERC20State {
Object.assign(this, props)
}

/**
* Format: 'address:blockNumber'
*/
@PrimaryColumn_()
id!: string

Expand Down
5 changes: 4 additions & 1 deletion src/model/generated/oTokenAddress.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export class OTokenAddress {
@BooleanColumn_({nullable: false})
isContract!: boolean

@Column_("varchar", {length: 6, nullable: false})
@Column_("varchar", {length: 21, nullable: false})
rebasingOption!: RebasingOption

@BigIntColumn_({nullable: false})
Expand All @@ -38,6 +38,9 @@ export class OTokenAddress {
@BigIntColumn_({nullable: false})
credits!: bigint

@StringColumn_({nullable: true})
delegatedTo!: string | undefined | null

@DateTimeColumn_({nullable: false})
lastUpdated!: Date

Expand Down
5 changes: 4 additions & 1 deletion src/model/generated/oTokenRebaseOption.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ export class OTokenRebaseOption {
@ManyToOne_(() => OTokenAddress, {nullable: true})
address!: OTokenAddress

@Column_("varchar", {length: 6, nullable: false})
@Column_("varchar", {length: 21, nullable: false})
status!: RebasingOption

@StringColumn_({nullable: true})
delegatedTo!: string | undefined | null
}
2 changes: 1 addition & 1 deletion src/oeth/processors/ccip.ts
Original file line number Diff line number Diff line change
Expand Up @@ -181,5 +181,5 @@ export const ccip = (params: { chainId: 1 | 42161 }) => {
await ctx.store.upsert([...result.bridgeTransferStates.values()])
}

return { from, setup, process }
return { name: `ccip-${params.chainId}`, from, setup, process }
}
1 change: 1 addition & 0 deletions src/oeth/processors/oeth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ const otokenActivityProcessor = createOTokenActivityProcessor({
},
})

export const name = 'oeth'
export const from = Math.min(otokenProcessor.from, otokenActivityProcessor.from)
export const setup = (processor: EvmBatchProcessor) => {
otokenProcessor.setup(processor)
Expand Down
1 change: 1 addition & 0 deletions src/oeth/processors/strategies.ts
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@ const eventProcessors = [
}),
]

export const name = 'strategies'
export const from = Math.min(...strategies.map((s) => s.from))

export const setup = (processor: EvmBatchProcessor) => {
Expand Down
6 changes: 4 additions & 2 deletions src/ousd/processors/erc20s.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import * as otoken from '@abi/otoken'
import * as otokenOld from '@abi/otoken-old'
import { createERC20Tracker } from '@templates/erc20'
import { createRebasingERC20Tracker } from '@templates/erc20/erc20-rebasing'
import { createRebasingERC20Tracker, getErc20RebasingParams } from '@templates/erc20/erc20-rebasing'
import { OUSD_ADDRESS, OUSD_VAULT_ADDRESS, ousdStrategyArray, tokens } from '@utils/addresses'
import { logFilter } from '@utils/logFilter'

Expand All @@ -11,7 +12,7 @@ const rebasingTracks: Record<string, Parameters<typeof createRebasingERC20Tracke
rebasing: {
rebaseEventFilter: logFilter({
address: [OUSD_ADDRESS],
topic0: [otoken.events.TotalSupplyUpdatedHighres.topic],
topic0: [otokenOld.events.TotalSupplyUpdated.topic, otoken.events.TotalSupplyUpdatedHighres.topic],
transaction: true,
range: { from: 11585978 },
}),
Expand All @@ -29,6 +30,7 @@ const rebasingTracks: Record<string, Parameters<typeof createRebasingERC20Tracke
}
return oToken.rebasingCreditsPerTokenHighres()
},
...getErc20RebasingParams({ from: 11585978, yieldDelegationFrom: 21325305, address: OUSD_ADDRESS }),
},
},
}
Expand Down
Loading