From 52c34d73ed590714b2e466aa9f23e333b4926095 Mon Sep 17 00:00:00 2001 From: Chris Jacobs Date: Thu, 26 Oct 2023 18:03:07 -0700 Subject: [PATCH 01/34] save strategy RewardTokenCollected events --- ...98267277150-Data.js => 1698364374796-Data.js} | 6 +++--- schema-oeth.graphql | 1 + schema.graphql | 1 + .../generated/oethRewardTokenCollected.model.ts | 3 +++ src/oeth/processors/strategies/strategies.ts | 16 +++++++++++++++- .../strategy-rewards/strategy-rewards.ts | 8 ++++++-- 6 files changed, 29 insertions(+), 6 deletions(-) rename db/migrations/{1698267277150-Data.js => 1698364374796-Data.js} (99%) diff --git a/db/migrations/1698267277150-Data.js b/db/migrations/1698364374796-Data.js similarity index 99% rename from db/migrations/1698267277150-Data.js rename to db/migrations/1698364374796-Data.js index 6c668b67..cc0062cf 100644 --- a/db/migrations/1698267277150-Data.js +++ b/db/migrations/1698364374796-Data.js @@ -1,5 +1,5 @@ -module.exports = class Data1698267277150 { - name = 'Data1698267277150' +module.exports = class Data1698364374796 { + name = 'Data1698364374796' async up(db) { await db.query(`CREATE TABLE "exchange_rate" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "pair" text NOT NULL, "base" text NOT NULL, "quote" text NOT NULL, "rate" numeric NOT NULL, CONSTRAINT "PK_5c5d27d2b900ef6cdeef0398472" PRIMARY KEY ("id"))`) @@ -63,7 +63,7 @@ module.exports = class Data1698267277150 { await db.query(`CREATE TABLE "oeth_daily_stat" ("id" character varying NOT NULL, "block_number" integer NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "apr" numeric NOT NULL, "apy" numeric NOT NULL, "apy7_day_avg" numeric NOT NULL, "apy14_day_avg" numeric NOT NULL, "apy30_day_avg" numeric NOT NULL, "total_supply" numeric NOT NULL, "total_supply_usd" numeric NOT NULL, "rebasing_supply" numeric NOT NULL, "non_rebasing_supply" numeric NOT NULL, "amo_supply" numeric NOT NULL, "dripper_weth" numeric NOT NULL, "yield" numeric NOT NULL, "fees" numeric NOT NULL, "revenue" numeric NOT NULL, "revenue7_day_avg" numeric NOT NULL, "revenue7_day_total" numeric NOT NULL, "revenue_all_time" numeric NOT NULL, "peg_price" numeric NOT NULL, CONSTRAINT "PK_9144a02ab13b1baa818a7d5eae5" PRIMARY KEY ("id"))`) await db.query(`CREATE INDEX "IDX_98d9001013aa37425ca47b7126" ON "oeth_daily_stat" ("block_number") `) await db.query(`CREATE INDEX "IDX_c3e66051c7df4efd6a8fa8f9c1" ON "oeth_daily_stat" ("timestamp") `) - await db.query(`CREATE TABLE "oeth_reward_token_collected" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "recipient" text NOT NULL, "reward_token" text NOT NULL, "amount" numeric NOT NULL, CONSTRAINT "PK_47098cc5fbc7cb95c2374fa33cd" PRIMARY KEY ("id"))`) + await db.query(`CREATE TABLE "oeth_reward_token_collected" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "strategy" text NOT NULL, "recipient" text NOT NULL, "reward_token" text NOT NULL, "amount" numeric NOT NULL, CONSTRAINT "PK_47098cc5fbc7cb95c2374fa33cd" PRIMARY KEY ("id"))`) await db.query(`CREATE INDEX "IDX_81a9fa43ae4a6ae63e4103127b" ON "oeth_reward_token_collected" ("timestamp") `) await db.query(`CREATE INDEX "IDX_d36c78b9c3e9d737f067638bc4" ON "oeth_reward_token_collected" ("block_number") `) await db.query(`CREATE TABLE "ogv" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "circulating" numeric NOT NULL, "total" numeric NOT NULL, CONSTRAINT "PK_f16038abf451ce82bd03ea54ee7" PRIMARY KEY ("id"))`) diff --git a/schema-oeth.graphql b/schema-oeth.graphql index 78a253df..fcea7a20 100644 --- a/schema-oeth.graphql +++ b/schema-oeth.graphql @@ -252,6 +252,7 @@ type OETHRewardTokenCollected @entity { id: ID! timestamp: DateTime! @index blockNumber: Int! @index + strategy: String! recipient: String! rewardToken: String! amount: BigInt! diff --git a/schema.graphql b/schema.graphql index c5fc846b..e18001c2 100644 --- a/schema.graphql +++ b/schema.graphql @@ -315,6 +315,7 @@ type OETHRewardTokenCollected @entity { id: ID! timestamp: DateTime! @index blockNumber: Int! @index + strategy: String! recipient: String! rewardToken: String! amount: BigInt! diff --git a/src/model/generated/oethRewardTokenCollected.model.ts b/src/model/generated/oethRewardTokenCollected.model.ts index 91661a61..83eb3ee3 100644 --- a/src/model/generated/oethRewardTokenCollected.model.ts +++ b/src/model/generated/oethRewardTokenCollected.model.ts @@ -18,6 +18,9 @@ export class OETHRewardTokenCollected { @Column_("int4", {nullable: false}) blockNumber!: number + @Column_("text", {nullable: false}) + strategy!: string + @Column_("text", {nullable: false}) recipient!: string diff --git a/src/oeth/processors/strategies/strategies.ts b/src/oeth/processors/strategies/strategies.ts index d4741895..10cd72b8 100644 --- a/src/oeth/processors/strategies/strategies.ts +++ b/src/oeth/processors/strategies/strategies.ts @@ -1,11 +1,16 @@ import { EvmBatchProcessor } from '@subsquid/evm-processor' +import { OETHRewardTokenCollected } from '../../../model' import { Context } from '../../../processor' import { IStrategyData, createStrategyProcessor, createStrategySetup, } from '../../../shared/processor-templates/strategy' +import { + createStrategyRewardProcessor, + createStrategyRewardSetup, +} from '../../../shared/processor-templates/strategy-rewards' import { FRXETH_ADDRESS, OETH_ADDRESS, @@ -118,9 +123,18 @@ export const from = Math.min(...strategies.map((s) => s.from)) export const setup = (processor: EvmBatchProcessor) => { strategies.forEach((s) => createStrategySetup(s.from)(processor)) + strategies.forEach((s) => createStrategyRewardSetup(s)(processor)) } -const processors = strategies.map(createStrategyProcessor) +const processors = [ + ...strategies.map(createStrategyProcessor), + ...strategies.map((strategy) => + createStrategyRewardProcessor({ + ...strategy, + OTokenRewardTokenCollected: OETHRewardTokenCollected, + }), + ), +] export const process = async (ctx: Context) => { await Promise.all(processors.map((p) => p(ctx))) diff --git a/src/shared/processor-templates/strategy-rewards/strategy-rewards.ts b/src/shared/processor-templates/strategy-rewards/strategy-rewards.ts index f1ed8cf5..2aba236c 100644 --- a/src/shared/processor-templates/strategy-rewards/strategy-rewards.ts +++ b/src/shared/processor-templates/strategy-rewards/strategy-rewards.ts @@ -28,6 +28,7 @@ export const createStrategyRewardProcessor = (params: { OTokenRewardTokenCollected: EntityClassT }) => { return async (ctx: Context) => { + const events: OETHRewardTokenCollected[] = [] if (ctx.blocks[ctx.blocks.length - 1].header.height < params.from) return for (const block of ctx.blocks) { if (block.header.height < params.from) continue @@ -38,12 +39,15 @@ export const createStrategyRewardProcessor = (params: { id: log.id, blockNumber: block.header.height, timestamp: new Date(block.header.timestamp), - recipient: data.recipient, - rewardToken: data.rewardToken, + strategy: params.address, + recipient: data.recipient.toLowerCase(), + rewardToken: data.rewardToken.toLowerCase(), amount: data.amount, }) + events.push(event) } } } + await ctx.store.upsert(events) } } From c1335332418e2ef33882a3785e142fd78aab0fd5 Mon Sep 17 00:00:00 2001 From: Chris Jacobs Date: Mon, 30 Oct 2023 14:03:26 -0700 Subject: [PATCH 02/34] wip strategy earnings collection --- abi/frax-eth-strategy.json | 598 ++++++++++++++++++ db/migrations/1698364374796-Data.js | 277 -------- schema-base.graphql | 13 + schema.graphql | 13 + src/main-oeth.ts | 18 +- src/model/generated/index.ts | 1 + src/model/generated/strategyYield.model.ts | 35 + src/oeth/processors/balancer-meta-pool.ts | 2 +- src/oeth/processors/strategies/strategies.ts | 128 ++-- .../exchange-rates/currencies.ts | 7 + .../exchange-rates/exchange-rates.ts | 4 +- .../strategy-rewards/strategy-rewards.ts | 5 +- .../strategy/strategy-balancer.ts | 140 ++++ .../strategy/strategy-curve-amo.ts | 128 ++++ .../strategy/strategy-earnings.ts | 220 +++++++ .../strategy/strategy-generic.ts | 84 +++ .../processor-templates/strategy/strategy.ts | 239 +------ src/utils/addresses.ts | 8 +- src/utils/blockFrequencyUpdater.ts | 27 +- 19 files changed, 1378 insertions(+), 569 deletions(-) create mode 100644 abi/frax-eth-strategy.json delete mode 100644 db/migrations/1698364374796-Data.js create mode 100644 src/model/generated/strategyYield.model.ts create mode 100644 src/shared/processor-templates/strategy/strategy-balancer.ts create mode 100644 src/shared/processor-templates/strategy/strategy-curve-amo.ts create mode 100644 src/shared/processor-templates/strategy/strategy-earnings.ts create mode 100644 src/shared/processor-templates/strategy/strategy-generic.ts diff --git a/abi/frax-eth-strategy.json b/abi/frax-eth-strategy.json new file mode 100644 index 00000000..889f271a --- /dev/null +++ b/abi/frax-eth-strategy.json @@ -0,0 +1,598 @@ +[ + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "_asset", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "_pToken", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + } + ], + "name": "Deposit", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousGovernor", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newGovernor", + "type": "address" + } + ], + "name": "GovernorshipTransferred", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "_oldHarvesterAddress", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "_newHarvesterAddress", + "type": "address" + } + ], + "name": "HarvesterAddressesUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "_asset", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "_pToken", + "type": "address" + } + ], + "name": "PTokenAdded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "_asset", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "_pToken", + "type": "address" + } + ], + "name": "PTokenRemoved", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousGovernor", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newGovernor", + "type": "address" + } + ], + "name": "PendingGovernorshipTransfer", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address[]", + "name": "_oldAddresses", + "type": "address[]" + }, + { + "indexed": false, + "internalType": "address[]", + "name": "_newAddresses", + "type": "address[]" + } + ], + "name": "RewardTokenAddressesUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "recipient", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "rewardToken", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "RewardTokenCollected", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "_asset", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "_pToken", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + } + ], + "name": "Withdrawal", + "type": "event" + }, + { + "inputs": [], + "name": "_deprecated_rewardLiquidationThreshold", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "_deprecated_rewardTokenAddress", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "assetToPToken", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_asset", + "type": "address" + } + ], + "name": "checkBalance", + "outputs": [ + { + "internalType": "uint256", + "name": "balance", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "claimGovernance", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "collectRewardTokens", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_asset", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + } + ], + "name": "deposit", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "depositAll", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "fraxETHMinter", + "outputs": [ + { + "internalType": "contract IFraxETHMinter", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getRewardTokenAddresses", + "outputs": [ + { + "internalType": "address[]", + "name": "", + "type": "address[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "governor", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "harvesterAddress", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_platformAddress", + "type": "address" + }, + { + "internalType": "address", + "name": "_vaultAddress", + "type": "address" + }, + { + "internalType": "address[]", + "name": "_rewardTokenAddresses", + "type": "address[]" + }, + { + "internalType": "address[]", + "name": "_assets", + "type": "address[]" + }, + { + "internalType": "address[]", + "name": "_pTokens", + "type": "address[]" + } + ], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "isGovernor", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "platformAddress", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_assetIndex", + "type": "uint256" + } + ], + "name": "removePToken", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "rewardTokenAddresses", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "safeApproveAllTokens", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_harvesterAddress", + "type": "address" + } + ], + "name": "setHarvesterAddress", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_asset", + "type": "address" + }, + { + "internalType": "address", + "name": "_pToken", + "type": "address" + } + ], + "name": "setPTokenAddress", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address[]", + "name": "_rewardTokenAddresses", + "type": "address[]" + } + ], + "name": "setRewardTokenAddresses", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_asset", + "type": "address" + } + ], + "name": "supportsAsset", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_newGovernor", + "type": "address" + } + ], + "name": "transferGovernance", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_asset", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + } + ], + "name": "transferToken", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "vaultAddress", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "weth", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_recipient", + "type": "address" + }, + { + "internalType": "address", + "name": "_asset", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + } + ], + "name": "withdraw", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "withdrawAll", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "stateMutability": "payable", + "type": "receive" + } +] \ No newline at end of file diff --git a/db/migrations/1698364374796-Data.js b/db/migrations/1698364374796-Data.js deleted file mode 100644 index cc0062cf..00000000 --- a/db/migrations/1698364374796-Data.js +++ /dev/null @@ -1,277 +0,0 @@ -module.exports = class Data1698364374796 { - name = 'Data1698364374796' - - async up(db) { - await db.query(`CREATE TABLE "exchange_rate" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "pair" text NOT NULL, "base" text NOT NULL, "quote" text NOT NULL, "rate" numeric NOT NULL, CONSTRAINT "PK_5c5d27d2b900ef6cdeef0398472" PRIMARY KEY ("id"))`) - await db.query(`CREATE INDEX "IDX_9e23a3f1bf3634820c873a0fe8" ON "exchange_rate" ("timestamp") `) - await db.query(`CREATE INDEX "IDX_c61a93768eed9e58ce399bbe01" ON "exchange_rate" ("block_number") `) - await db.query(`CREATE TABLE "balance" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "token" text NOT NULL, "address" text NOT NULL, "balance" numeric NOT NULL, CONSTRAINT "PK_079dddd31a81672e8143a649ca0" PRIMARY KEY ("id"))`) - await db.query(`CREATE INDEX "IDX_a956b410c329b8eca7898c3c51" ON "balance" ("timestamp") `) - await db.query(`CREATE INDEX "IDX_6b451b59c9f6a6fdd685f530b2" ON "balance" ("block_number") `) - await db.query(`CREATE TABLE "strategy_balance" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "strategy" text NOT NULL, "asset" text NOT NULL, "balance" numeric NOT NULL, CONSTRAINT "PK_ca6f93229d1392e9546d01dae4f" PRIMARY KEY ("id"))`) - await db.query(`CREATE INDEX "IDX_0113bf0b63183bea0d22cd0d08" ON "strategy_balance" ("timestamp") `) - await db.query(`CREATE INDEX "IDX_a88065dcd92011698bbe7df7b1" ON "strategy_balance" ("block_number") `) - await db.query(`CREATE TABLE "curve_pool_balance" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "address" text NOT NULL, "balance0" numeric NOT NULL, "balance1" numeric NOT NULL, "balance2" numeric NOT NULL, CONSTRAINT "PK_40412750bb910ca560aa084dd88" PRIMARY KEY ("id"))`) - await db.query(`CREATE INDEX "IDX_ffb0d0f86f03faacef7cb3e092" ON "curve_pool_balance" ("timestamp") `) - await db.query(`CREATE INDEX "IDX_db5522c865eb8ed76fa7aeb4a8" ON "curve_pool_balance" ("block_number") `) - await db.query(`CREATE TABLE "oeth" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "total_supply" numeric NOT NULL, "rebasing_supply" numeric NOT NULL, "non_rebasing_supply" numeric NOT NULL, CONSTRAINT "PK_de1d885501070dbd1ab6f8577ba" PRIMARY KEY ("id"))`) - await db.query(`CREATE INDEX "IDX_5b81a67229bac2d68e0dc92cc4" ON "oeth" ("timestamp") `) - await db.query(`CREATE INDEX "IDX_408e5f79f83093aa5cf2b0ea32" ON "oeth" ("block_number") `) - await db.query(`CREATE TABLE "oeth_history" ("id" character varying NOT NULL, "value" numeric NOT NULL, "balance" numeric NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "tx_hash" text NOT NULL, "type" character varying(8) NOT NULL, "address_id" character varying, CONSTRAINT "PK_2c7e7571cd9ea02b07a27a303f3" PRIMARY KEY ("id"))`) - await db.query(`CREATE INDEX "IDX_94e47c4c49128c78f60b185b46" ON "oeth_history" ("address_id") `) - await db.query(`CREATE INDEX "IDX_96956b1c8d29eb7066a97d5ea7" ON "oeth_history" ("block_number") `) - await db.query(`CREATE INDEX "IDX_b14170bdb7fbc0775bf55df15d" ON "oeth_history" ("tx_hash") `) - await db.query(`CREATE TABLE "oeth_address" ("id" character varying NOT NULL, "is_contract" boolean NOT NULL, "rebasing_option" character varying(6) NOT NULL, "balance" numeric NOT NULL, "earned" numeric NOT NULL, "credits" numeric NOT NULL, "last_updated" TIMESTAMP WITH TIME ZONE NOT NULL, CONSTRAINT "PK_92a966afe47d584af73ce77a1cd" PRIMARY KEY ("id"))`) - await db.query(`CREATE TABLE "oethapy" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "tx_hash" text NOT NULL, "apr" numeric NOT NULL, "apy" numeric NOT NULL, "apy7_day_avg" numeric NOT NULL, "apy14_day_avg" numeric NOT NULL, "apy30_day_avg" numeric NOT NULL, "rebasing_credits_per_token" numeric NOT NULL, CONSTRAINT "PK_8dbb4d04591848361200f18f62a" PRIMARY KEY ("id"))`) - await db.query(`CREATE INDEX "IDX_b1a448045d1ed9d655b679a371" ON "oethapy" ("timestamp") `) - await db.query(`CREATE INDEX "IDX_6b8a7a706a0701e659a7d81508" ON "oethapy" ("block_number") `) - await db.query(`CREATE INDEX "IDX_c0c03168bb0139e3cffda4f00e" ON "oethapy" ("tx_hash") `) - await db.query(`CREATE TABLE "oeth_rebase" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "tx_hash" text NOT NULL, "total_supply" numeric NOT NULL, "rebasing_credits" numeric NOT NULL, "rebasing_credits_per_token" numeric NOT NULL, "fee" numeric NOT NULL, "yield" numeric NOT NULL, "apy_id" character varying, CONSTRAINT "PK_5f8f4dd071caf685b4ac2d54de3" PRIMARY KEY ("id"))`) - await db.query(`CREATE INDEX "IDX_fbb7b3f2fff9896eb683b86de7" ON "oeth_rebase" ("timestamp") `) - await db.query(`CREATE INDEX "IDX_d3255d02d9407bba89380d01fa" ON "oeth_rebase" ("block_number") `) - await db.query(`CREATE INDEX "IDX_8b6bb0243472af88612fe6a01f" ON "oeth_rebase" ("tx_hash") `) - await db.query(`CREATE INDEX "IDX_3331819842173de7c27c046547" ON "oeth_rebase" ("apy_id") `) - await db.query(`CREATE TABLE "oeth_rebase_option" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "tx_hash" text NOT NULL, "status" character varying(6) NOT NULL, "address_id" character varying, CONSTRAINT "PK_32971725d5523200b4b3b7c07e5" PRIMARY KEY ("id"))`) - await db.query(`CREATE INDEX "IDX_1fc6bbd88037bfbf4361776909" ON "oeth_rebase_option" ("timestamp") `) - await db.query(`CREATE INDEX "IDX_cbb7ceb49ef7c45432d0171296" ON "oeth_rebase_option" ("block_number") `) - await db.query(`CREATE INDEX "IDX_355826dadaacc5ae2d63c82f28" ON "oeth_rebase_option" ("tx_hash") `) - await db.query(`CREATE INDEX "IDX_034428879698039839b4ba6ffe" ON "oeth_rebase_option" ("address_id") `) - await db.query(`CREATE TABLE "oeth_vault" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "weth" numeric NOT NULL, "st_eth" numeric NOT NULL, "r_eth" numeric NOT NULL, "frx_eth" numeric NOT NULL, CONSTRAINT "PK_9debaa84944fe2be9dc4219ba8f" PRIMARY KEY ("id"))`) - await db.query(`CREATE INDEX "IDX_d6298a294864b4eaf793cf35a4" ON "oeth_vault" ("timestamp") `) - await db.query(`CREATE INDEX "IDX_e20cb507a673817b2c68720415" ON "oeth_vault" ("block_number") `) - await db.query(`CREATE TABLE "oeth_curve_lp" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "total_supply" numeric NOT NULL, "eth" numeric NOT NULL, "oeth" numeric NOT NULL, "total_supply_owned" numeric NOT NULL, "eth_owned" numeric NOT NULL, "oeth_owned" numeric NOT NULL, CONSTRAINT "PK_2b055044664e80f44d6172fdf54" PRIMARY KEY ("id"))`) - await db.query(`CREATE INDEX "IDX_d9bbd20e888fa1b4b2c5d2f039" ON "oeth_curve_lp" ("timestamp") `) - await db.query(`CREATE INDEX "IDX_7617d593c36dce1b1565a8d74a" ON "oeth_curve_lp" ("block_number") `) - await db.query(`CREATE TABLE "oeth_frax_staking" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "sfrx_eth" numeric NOT NULL, CONSTRAINT "PK_694f53c8600ae88c7bdcf7305dd" PRIMARY KEY ("id"))`) - await db.query(`CREATE INDEX "IDX_ce6c2c65e90967dfeaac97025b" ON "oeth_frax_staking" ("timestamp") `) - await db.query(`CREATE INDEX "IDX_1a7f7d650390e2f9c212651e05" ON "oeth_frax_staking" ("block_number") `) - await db.query(`CREATE TABLE "oeth_morpho_aave" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "weth" numeric NOT NULL, CONSTRAINT "PK_86de8f846e9335c92b8ad7df3a1" PRIMARY KEY ("id"))`) - await db.query(`CREATE INDEX "IDX_25e239b985844f1d33fac79981" ON "oeth_morpho_aave" ("timestamp") `) - await db.query(`CREATE INDEX "IDX_a6662224e95eb6921bb14cb5f9" ON "oeth_morpho_aave" ("block_number") `) - await db.query(`CREATE TABLE "oeth_dripper" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "weth" numeric NOT NULL, CONSTRAINT "PK_77731281c1564c24eff0c265984" PRIMARY KEY ("id"))`) - await db.query(`CREATE INDEX "IDX_16ac742ceeb05d28e530da9649" ON "oeth_dripper" ("timestamp") `) - await db.query(`CREATE INDEX "IDX_d356832c14603916a492608e7b" ON "oeth_dripper" ("block_number") `) - await db.query(`CREATE TABLE "oeth_balancer_meta_pool_strategy" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "r_eth" numeric NOT NULL, "weth" numeric NOT NULL, CONSTRAINT "PK_6ddf5b8ba878e6d706e59bd6de0" PRIMARY KEY ("id"))`) - await db.query(`CREATE INDEX "IDX_5e7ef383756fa18cb602f50089" ON "oeth_balancer_meta_pool_strategy" ("timestamp") `) - await db.query(`CREATE INDEX "IDX_11d344b3e0e03cdb6697dd61f7" ON "oeth_balancer_meta_pool_strategy" ("block_number") `) - await db.query(`CREATE TABLE "oeth_strategy_holding_daily_stat" ("id" character varying NOT NULL, "symbol" text NOT NULL, "amount" numeric NOT NULL, "value" numeric NOT NULL, "strategy_daily_stat_id_id" character varying, CONSTRAINT "PK_7f1a62da5e53cf264c2f39b4acf" PRIMARY KEY ("id"))`) - await db.query(`CREATE INDEX "IDX_4e867f220975e615e6077d860c" ON "oeth_strategy_holding_daily_stat" ("strategy_daily_stat_id_id") `) - await db.query(`CREATE TABLE "oeth_strategy_daily_stat" ("id" character varying NOT NULL, "name" text NOT NULL, "total" numeric NOT NULL, "tvl" numeric NOT NULL, "daily_stat_id_id" character varying, CONSTRAINT "PK_8af1a0c60e67b05baf928787a8e" PRIMARY KEY ("id"))`) - await db.query(`CREATE INDEX "IDX_6c7096c96a000d8471256ca8fc" ON "oeth_strategy_daily_stat" ("daily_stat_id_id") `) - await db.query(`CREATE TABLE "oeth_collateral_daily_stat" ("id" character varying NOT NULL, "symbol" text NOT NULL, "amount" numeric NOT NULL, "price" numeric NOT NULL, "value" numeric NOT NULL, "daily_stat_id_id" character varying, CONSTRAINT "PK_5fb23d7bae30dffe4543e7aa069" PRIMARY KEY ("id"))`) - await db.query(`CREATE INDEX "IDX_a90045de50406be7bd56efd3ea" ON "oeth_collateral_daily_stat" ("daily_stat_id_id") `) - await db.query(`CREATE TABLE "oeth_daily_stat" ("id" character varying NOT NULL, "block_number" integer NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "apr" numeric NOT NULL, "apy" numeric NOT NULL, "apy7_day_avg" numeric NOT NULL, "apy14_day_avg" numeric NOT NULL, "apy30_day_avg" numeric NOT NULL, "total_supply" numeric NOT NULL, "total_supply_usd" numeric NOT NULL, "rebasing_supply" numeric NOT NULL, "non_rebasing_supply" numeric NOT NULL, "amo_supply" numeric NOT NULL, "dripper_weth" numeric NOT NULL, "yield" numeric NOT NULL, "fees" numeric NOT NULL, "revenue" numeric NOT NULL, "revenue7_day_avg" numeric NOT NULL, "revenue7_day_total" numeric NOT NULL, "revenue_all_time" numeric NOT NULL, "peg_price" numeric NOT NULL, CONSTRAINT "PK_9144a02ab13b1baa818a7d5eae5" PRIMARY KEY ("id"))`) - await db.query(`CREATE INDEX "IDX_98d9001013aa37425ca47b7126" ON "oeth_daily_stat" ("block_number") `) - await db.query(`CREATE INDEX "IDX_c3e66051c7df4efd6a8fa8f9c1" ON "oeth_daily_stat" ("timestamp") `) - await db.query(`CREATE TABLE "oeth_reward_token_collected" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "strategy" text NOT NULL, "recipient" text NOT NULL, "reward_token" text NOT NULL, "amount" numeric NOT NULL, CONSTRAINT "PK_47098cc5fbc7cb95c2374fa33cd" PRIMARY KEY ("id"))`) - await db.query(`CREATE INDEX "IDX_81a9fa43ae4a6ae63e4103127b" ON "oeth_reward_token_collected" ("timestamp") `) - await db.query(`CREATE INDEX "IDX_d36c78b9c3e9d737f067638bc4" ON "oeth_reward_token_collected" ("block_number") `) - await db.query(`CREATE TABLE "ogv" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "circulating" numeric NOT NULL, "total" numeric NOT NULL, CONSTRAINT "PK_f16038abf451ce82bd03ea54ee7" PRIMARY KEY ("id"))`) - await db.query(`CREATE INDEX "IDX_2418a8b8b92b2f5977be761cf9" ON "ogv" ("timestamp") `) - await db.query(`CREATE INDEX "IDX_b8f20bcf48e4aa77e0f48d77db" ON "ogv" ("block_number") `) - await db.query(`CREATE TABLE "staked_ogv" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "total" numeric NOT NULL, "apy" numeric NOT NULL, CONSTRAINT "PK_b135611d9aab36c7889982c3be8" PRIMARY KEY ("id"))`) - await db.query(`CREATE INDEX "IDX_533195c60cfaef9e118789dee9" ON "staked_ogv" ("timestamp") `) - await db.query(`CREATE INDEX "IDX_d601233411a33212b9d616aab0" ON "staked_ogv" ("block_number") `) - await db.query(`CREATE TABLE "ogv_governance" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "registered_voters" integer NOT NULL, "open_source_contributors" integer NOT NULL, "improvement_proposals" integer NOT NULL, CONSTRAINT "PK_b22758cd4ee8ff92c1b7ee0cf20" PRIMARY KEY ("id"))`) - await db.query(`CREATE INDEX "IDX_a0329e7109d5959b9aa3d9d374" ON "ogv_governance" ("timestamp") `) - await db.query(`CREATE INDEX "IDX_63cd1ca46771965c68f6b85898" ON "ogv_governance" ("block_number") `) - await db.query(`CREATE TABLE "ousd" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "total_supply" numeric NOT NULL, "rebasing_supply" numeric NOT NULL, "non_rebasing_supply" numeric NOT NULL, CONSTRAINT "PK_acecae4a20bc14b22d9f6738d8d" PRIMARY KEY ("id"))`) - await db.query(`CREATE INDEX "IDX_c8d1e285213b445b088805ac7c" ON "ousd" ("timestamp") `) - await db.query(`CREATE INDEX "IDX_806949dd853b7e8acab5d03b81" ON "ousd" ("block_number") `) - await db.query(`CREATE TABLE "ousd_history" ("id" character varying NOT NULL, "value" numeric NOT NULL, "balance" numeric NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "tx_hash" text NOT NULL, "type" character varying(8) NOT NULL, "address_id" character varying, CONSTRAINT "PK_dcbe3223b67f92d9ad4cffe8a7c" PRIMARY KEY ("id"))`) - await db.query(`CREATE INDEX "IDX_70291ea600c0c4d67d9bfe6a6b" ON "ousd_history" ("address_id") `) - await db.query(`CREATE INDEX "IDX_4d00d283e1ce3209dc43a0313c" ON "ousd_history" ("block_number") `) - await db.query(`CREATE INDEX "IDX_0c25caa59aa053a688a723d160" ON "ousd_history" ("tx_hash") `) - await db.query(`CREATE TABLE "ousd_address" ("id" character varying NOT NULL, "is_contract" boolean NOT NULL, "rebasing_option" character varying(6) NOT NULL, "balance" numeric NOT NULL, "earned" numeric NOT NULL, "credits" numeric NOT NULL, "last_updated" TIMESTAMP WITH TIME ZONE NOT NULL, CONSTRAINT "PK_bb061344757ede566d62854af6a" PRIMARY KEY ("id"))`) - await db.query(`CREATE TABLE "ousdapy" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "tx_hash" text NOT NULL, "apr" numeric NOT NULL, "apy" numeric NOT NULL, "apy7_day_avg" numeric NOT NULL, "apy14_day_avg" numeric NOT NULL, "apy30_day_avg" numeric NOT NULL, "rebasing_credits_per_token" numeric NOT NULL, CONSTRAINT "PK_d9889b7153efc82dbe88f9a7a33" PRIMARY KEY ("id"))`) - await db.query(`CREATE INDEX "IDX_c514963f42908ce84d65a84a77" ON "ousdapy" ("timestamp") `) - await db.query(`CREATE INDEX "IDX_4f606414b3b5ce1a366bd0fbf6" ON "ousdapy" ("block_number") `) - await db.query(`CREATE INDEX "IDX_0e84a81a109b66fe6f01f77c74" ON "ousdapy" ("tx_hash") `) - await db.query(`CREATE TABLE "ousd_rebase" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "tx_hash" text NOT NULL, "total_supply" numeric NOT NULL, "rebasing_credits" numeric NOT NULL, "rebasing_credits_per_token" numeric NOT NULL, "fee" numeric NOT NULL, "yield" numeric NOT NULL, "apy_id" character varying, CONSTRAINT "PK_04cf0de72399a99798dde61b237" PRIMARY KEY ("id"))`) - await db.query(`CREATE INDEX "IDX_f8eb4a16ce58a146b3227ee21a" ON "ousd_rebase" ("timestamp") `) - await db.query(`CREATE INDEX "IDX_3fb03b1a410e64c7367226d0b6" ON "ousd_rebase" ("block_number") `) - await db.query(`CREATE INDEX "IDX_1a76c478199672aaeec340f619" ON "ousd_rebase" ("tx_hash") `) - await db.query(`CREATE INDEX "IDX_427468c97f9838b804efd6c8e5" ON "ousd_rebase" ("apy_id") `) - await db.query(`CREATE TABLE "ousd_rebase_option" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "tx_hash" text NOT NULL, "status" character varying(6) NOT NULL, "address_id" character varying, CONSTRAINT "PK_d684f90866027104f3c929dfe10" PRIMARY KEY ("id"))`) - await db.query(`CREATE INDEX "IDX_64bd23947dc4c67e3b6a3f9352" ON "ousd_rebase_option" ("timestamp") `) - await db.query(`CREATE INDEX "IDX_9b774e46b8b1cf7f828133809a" ON "ousd_rebase_option" ("block_number") `) - await db.query(`CREATE INDEX "IDX_4e95bf069de04533d83a9a97fd" ON "ousd_rebase_option" ("tx_hash") `) - await db.query(`CREATE INDEX "IDX_b04173f9349ddd991a3b60e914" ON "ousd_rebase_option" ("address_id") `) - await db.query(`CREATE TABLE "ousd_vault" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "dai" numeric NOT NULL, "usdt" numeric NOT NULL, "usdc" numeric NOT NULL, CONSTRAINT "PK_343f5538c71a1cd78f1659ef9d3" PRIMARY KEY ("id"))`) - await db.query(`CREATE INDEX "IDX_6860186ea2f56e2c7d54c22107" ON "ousd_vault" ("timestamp") `) - await db.query(`CREATE INDEX "IDX_0d0a7113a505cf7f7adea9ca81" ON "ousd_vault" ("block_number") `) - await db.query(`CREATE TABLE "ousd_morpho_aave" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "dai" numeric NOT NULL, "usdt" numeric NOT NULL, "usdc" numeric NOT NULL, CONSTRAINT "PK_60676cde905a822ba73ff3a5c85" PRIMARY KEY ("id"))`) - await db.query(`CREATE INDEX "IDX_78e0701c2e9a28242db37bd8f8" ON "ousd_morpho_aave" ("timestamp") `) - await db.query(`CREATE INDEX "IDX_46ccf673b376d654052fbd53e6" ON "ousd_morpho_aave" ("block_number") `) - await db.query(`CREATE TABLE "ousd_morpho_compound" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "dai" numeric NOT NULL, "usdt" numeric NOT NULL, "usdc" numeric NOT NULL, CONSTRAINT "PK_5f715d53ef8fc0fad595cacf4fa" PRIMARY KEY ("id"))`) - await db.query(`CREATE INDEX "IDX_9e7bd0d8ae23b877d5979ef80c" ON "ousd_morpho_compound" ("timestamp") `) - await db.query(`CREATE INDEX "IDX_0bb3a0ad84071f1d80f6d4e90f" ON "ousd_morpho_compound" ("block_number") `) - await db.query(`CREATE TABLE "maker_dsr_strategy" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "dai" numeric NOT NULL, CONSTRAINT "PK_196da2d6910009ae04e3542fe22" PRIMARY KEY ("id"))`) - await db.query(`CREATE INDEX "IDX_a35308a3c5dbaab2d321eb1525" ON "maker_dsr_strategy" ("timestamp") `) - await db.query(`CREATE INDEX "IDX_844b219d8faf9b1d24ab2dba9a" ON "maker_dsr_strategy" ("block_number") `) - await db.query(`CREATE TABLE "ousd_flux_strategy" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "dai" numeric NOT NULL, "usdt" numeric NOT NULL, "usdc" numeric NOT NULL, CONSTRAINT "PK_ac977221429e50e4de1ce253a8b" PRIMARY KEY ("id"))`) - await db.query(`CREATE INDEX "IDX_5b165b5d30b13e363d33a66e14" ON "ousd_flux_strategy" ("timestamp") `) - await db.query(`CREATE INDEX "IDX_80f3392968fde7b99cccb805ac" ON "ousd_flux_strategy" ("block_number") `) - await db.query(`CREATE TABLE "ousd_compound_strategy" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "dai" numeric NOT NULL, "usdt" numeric NOT NULL, "usdc" numeric NOT NULL, CONSTRAINT "PK_9030e82bf3479d03c04e0d1919c" PRIMARY KEY ("id"))`) - await db.query(`CREATE INDEX "IDX_6920b1db5dc577295ac4d1379d" ON "ousd_compound_strategy" ("timestamp") `) - await db.query(`CREATE INDEX "IDX_89c6d7d3104bd36dc88a37add4" ON "ousd_compound_strategy" ("block_number") `) - await db.query(`CREATE TABLE "ousd_convex_strategy" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "dai" numeric NOT NULL, "usdt" numeric NOT NULL, "usdc" numeric NOT NULL, CONSTRAINT "PK_2b8f6e749e15e49d8816f1ac949" PRIMARY KEY ("id"))`) - await db.query(`CREATE INDEX "IDX_2deac473cd0b2dd7082e7da148" ON "ousd_convex_strategy" ("timestamp") `) - await db.query(`CREATE INDEX "IDX_157bf74171817dc5c60ee37036" ON "ousd_convex_strategy" ("block_number") `) - await db.query(`CREATE TABLE "ousd_aave_strategy" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "dai" numeric NOT NULL, "usdt" numeric NOT NULL, "usdc" numeric NOT NULL, CONSTRAINT "PK_b4b7ac6e395aa722df500f93623" PRIMARY KEY ("id"))`) - await db.query(`CREATE INDEX "IDX_ca34b5a0a33bc9abdd8213c2fa" ON "ousd_aave_strategy" ("timestamp") `) - await db.query(`CREATE INDEX "IDX_dacd7c98223d7bc8be074d71e4" ON "ousd_aave_strategy" ("block_number") `) - await db.query(`CREATE TABLE "ousd_meta_strategy" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "dai" numeric NOT NULL, "usdt" numeric NOT NULL, "usdc" numeric NOT NULL, CONSTRAINT "PK_d99170af73d86fe74460bbfacc4" PRIMARY KEY ("id"))`) - await db.query(`CREATE INDEX "IDX_7e998dcf775263bc5df76ef987" ON "ousd_meta_strategy" ("timestamp") `) - await db.query(`CREATE INDEX "IDX_55ce185680512d6a5b9fb0af89" ON "ousd_meta_strategy" ("block_number") `) - await db.query(`CREATE TABLE "ousd_convex_lusd_plus3_crv" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "dai" numeric NOT NULL, "usdt" numeric NOT NULL, "usdc" numeric NOT NULL, CONSTRAINT "PK_47290aa5dfa3cc5595f468e2f39" PRIMARY KEY ("id"))`) - await db.query(`CREATE INDEX "IDX_0783af95efb35fb3f13cde1656" ON "ousd_convex_lusd_plus3_crv" ("timestamp") `) - await db.query(`CREATE INDEX "IDX_74ae01fb596a4f2733087ba454" ON "ousd_convex_lusd_plus3_crv" ("block_number") `) - await db.query(`ALTER TABLE "oeth_history" ADD CONSTRAINT "FK_94e47c4c49128c78f60b185b46b" FOREIGN KEY ("address_id") REFERENCES "oeth_address"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`) - await db.query(`ALTER TABLE "oeth_rebase" ADD CONSTRAINT "FK_3331819842173de7c27c046547a" FOREIGN KEY ("apy_id") REFERENCES "oethapy"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`) - await db.query(`ALTER TABLE "oeth_rebase_option" ADD CONSTRAINT "FK_034428879698039839b4ba6ffe8" FOREIGN KEY ("address_id") REFERENCES "oeth_address"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`) - await db.query(`ALTER TABLE "oeth_strategy_holding_daily_stat" ADD CONSTRAINT "FK_4e867f220975e615e6077d860c1" FOREIGN KEY ("strategy_daily_stat_id_id") REFERENCES "oeth_strategy_daily_stat"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`) - await db.query(`ALTER TABLE "oeth_strategy_daily_stat" ADD CONSTRAINT "FK_6c7096c96a000d8471256ca8fc3" FOREIGN KEY ("daily_stat_id_id") REFERENCES "oeth_daily_stat"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`) - await db.query(`ALTER TABLE "oeth_collateral_daily_stat" ADD CONSTRAINT "FK_a90045de50406be7bd56efd3ea4" FOREIGN KEY ("daily_stat_id_id") REFERENCES "oeth_daily_stat"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`) - await db.query(`ALTER TABLE "ousd_history" ADD CONSTRAINT "FK_70291ea600c0c4d67d9bfe6a6bf" FOREIGN KEY ("address_id") REFERENCES "ousd_address"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`) - await db.query(`ALTER TABLE "ousd_rebase" ADD CONSTRAINT "FK_427468c97f9838b804efd6c8e55" FOREIGN KEY ("apy_id") REFERENCES "ousdapy"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`) - await db.query(`ALTER TABLE "ousd_rebase_option" ADD CONSTRAINT "FK_b04173f9349ddd991a3b60e914a" FOREIGN KEY ("address_id") REFERENCES "ousd_address"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`) - } - - async down(db) { - await db.query(`DROP TABLE "exchange_rate"`) - await db.query(`DROP INDEX "public"."IDX_9e23a3f1bf3634820c873a0fe8"`) - await db.query(`DROP INDEX "public"."IDX_c61a93768eed9e58ce399bbe01"`) - await db.query(`DROP TABLE "balance"`) - await db.query(`DROP INDEX "public"."IDX_a956b410c329b8eca7898c3c51"`) - await db.query(`DROP INDEX "public"."IDX_6b451b59c9f6a6fdd685f530b2"`) - await db.query(`DROP TABLE "strategy_balance"`) - await db.query(`DROP INDEX "public"."IDX_0113bf0b63183bea0d22cd0d08"`) - await db.query(`DROP INDEX "public"."IDX_a88065dcd92011698bbe7df7b1"`) - await db.query(`DROP TABLE "curve_pool_balance"`) - await db.query(`DROP INDEX "public"."IDX_ffb0d0f86f03faacef7cb3e092"`) - await db.query(`DROP INDEX "public"."IDX_db5522c865eb8ed76fa7aeb4a8"`) - await db.query(`DROP TABLE "oeth"`) - await db.query(`DROP INDEX "public"."IDX_5b81a67229bac2d68e0dc92cc4"`) - await db.query(`DROP INDEX "public"."IDX_408e5f79f83093aa5cf2b0ea32"`) - await db.query(`DROP TABLE "oeth_history"`) - await db.query(`DROP INDEX "public"."IDX_94e47c4c49128c78f60b185b46"`) - await db.query(`DROP INDEX "public"."IDX_96956b1c8d29eb7066a97d5ea7"`) - await db.query(`DROP INDEX "public"."IDX_b14170bdb7fbc0775bf55df15d"`) - await db.query(`DROP TABLE "oeth_address"`) - await db.query(`DROP TABLE "oethapy"`) - await db.query(`DROP INDEX "public"."IDX_b1a448045d1ed9d655b679a371"`) - await db.query(`DROP INDEX "public"."IDX_6b8a7a706a0701e659a7d81508"`) - await db.query(`DROP INDEX "public"."IDX_c0c03168bb0139e3cffda4f00e"`) - await db.query(`DROP TABLE "oeth_rebase"`) - await db.query(`DROP INDEX "public"."IDX_fbb7b3f2fff9896eb683b86de7"`) - await db.query(`DROP INDEX "public"."IDX_d3255d02d9407bba89380d01fa"`) - await db.query(`DROP INDEX "public"."IDX_8b6bb0243472af88612fe6a01f"`) - await db.query(`DROP INDEX "public"."IDX_3331819842173de7c27c046547"`) - await db.query(`DROP TABLE "oeth_rebase_option"`) - await db.query(`DROP INDEX "public"."IDX_1fc6bbd88037bfbf4361776909"`) - await db.query(`DROP INDEX "public"."IDX_cbb7ceb49ef7c45432d0171296"`) - await db.query(`DROP INDEX "public"."IDX_355826dadaacc5ae2d63c82f28"`) - await db.query(`DROP INDEX "public"."IDX_034428879698039839b4ba6ffe"`) - await db.query(`DROP TABLE "oeth_vault"`) - await db.query(`DROP INDEX "public"."IDX_d6298a294864b4eaf793cf35a4"`) - await db.query(`DROP INDEX "public"."IDX_e20cb507a673817b2c68720415"`) - await db.query(`DROP TABLE "oeth_curve_lp"`) - await db.query(`DROP INDEX "public"."IDX_d9bbd20e888fa1b4b2c5d2f039"`) - await db.query(`DROP INDEX "public"."IDX_7617d593c36dce1b1565a8d74a"`) - await db.query(`DROP TABLE "oeth_frax_staking"`) - await db.query(`DROP INDEX "public"."IDX_ce6c2c65e90967dfeaac97025b"`) - await db.query(`DROP INDEX "public"."IDX_1a7f7d650390e2f9c212651e05"`) - await db.query(`DROP TABLE "oeth_morpho_aave"`) - await db.query(`DROP INDEX "public"."IDX_25e239b985844f1d33fac79981"`) - await db.query(`DROP INDEX "public"."IDX_a6662224e95eb6921bb14cb5f9"`) - await db.query(`DROP TABLE "oeth_dripper"`) - await db.query(`DROP INDEX "public"."IDX_16ac742ceeb05d28e530da9649"`) - await db.query(`DROP INDEX "public"."IDX_d356832c14603916a492608e7b"`) - await db.query(`DROP TABLE "oeth_balancer_meta_pool_strategy"`) - await db.query(`DROP INDEX "public"."IDX_5e7ef383756fa18cb602f50089"`) - await db.query(`DROP INDEX "public"."IDX_11d344b3e0e03cdb6697dd61f7"`) - await db.query(`DROP TABLE "oeth_strategy_holding_daily_stat"`) - await db.query(`DROP INDEX "public"."IDX_4e867f220975e615e6077d860c"`) - await db.query(`DROP TABLE "oeth_strategy_daily_stat"`) - await db.query(`DROP INDEX "public"."IDX_6c7096c96a000d8471256ca8fc"`) - await db.query(`DROP TABLE "oeth_collateral_daily_stat"`) - await db.query(`DROP INDEX "public"."IDX_a90045de50406be7bd56efd3ea"`) - await db.query(`DROP TABLE "oeth_daily_stat"`) - await db.query(`DROP INDEX "public"."IDX_98d9001013aa37425ca47b7126"`) - await db.query(`DROP INDEX "public"."IDX_c3e66051c7df4efd6a8fa8f9c1"`) - await db.query(`DROP TABLE "oeth_reward_token_collected"`) - await db.query(`DROP INDEX "public"."IDX_81a9fa43ae4a6ae63e4103127b"`) - await db.query(`DROP INDEX "public"."IDX_d36c78b9c3e9d737f067638bc4"`) - await db.query(`DROP TABLE "ogv"`) - await db.query(`DROP INDEX "public"."IDX_2418a8b8b92b2f5977be761cf9"`) - await db.query(`DROP INDEX "public"."IDX_b8f20bcf48e4aa77e0f48d77db"`) - await db.query(`DROP TABLE "staked_ogv"`) - await db.query(`DROP INDEX "public"."IDX_533195c60cfaef9e118789dee9"`) - await db.query(`DROP INDEX "public"."IDX_d601233411a33212b9d616aab0"`) - await db.query(`DROP TABLE "ogv_governance"`) - await db.query(`DROP INDEX "public"."IDX_a0329e7109d5959b9aa3d9d374"`) - await db.query(`DROP INDEX "public"."IDX_63cd1ca46771965c68f6b85898"`) - await db.query(`DROP TABLE "ousd"`) - await db.query(`DROP INDEX "public"."IDX_c8d1e285213b445b088805ac7c"`) - await db.query(`DROP INDEX "public"."IDX_806949dd853b7e8acab5d03b81"`) - await db.query(`DROP TABLE "ousd_history"`) - await db.query(`DROP INDEX "public"."IDX_70291ea600c0c4d67d9bfe6a6b"`) - await db.query(`DROP INDEX "public"."IDX_4d00d283e1ce3209dc43a0313c"`) - await db.query(`DROP INDEX "public"."IDX_0c25caa59aa053a688a723d160"`) - await db.query(`DROP TABLE "ousd_address"`) - await db.query(`DROP TABLE "ousdapy"`) - await db.query(`DROP INDEX "public"."IDX_c514963f42908ce84d65a84a77"`) - await db.query(`DROP INDEX "public"."IDX_4f606414b3b5ce1a366bd0fbf6"`) - await db.query(`DROP INDEX "public"."IDX_0e84a81a109b66fe6f01f77c74"`) - await db.query(`DROP TABLE "ousd_rebase"`) - await db.query(`DROP INDEX "public"."IDX_f8eb4a16ce58a146b3227ee21a"`) - await db.query(`DROP INDEX "public"."IDX_3fb03b1a410e64c7367226d0b6"`) - await db.query(`DROP INDEX "public"."IDX_1a76c478199672aaeec340f619"`) - await db.query(`DROP INDEX "public"."IDX_427468c97f9838b804efd6c8e5"`) - await db.query(`DROP TABLE "ousd_rebase_option"`) - await db.query(`DROP INDEX "public"."IDX_64bd23947dc4c67e3b6a3f9352"`) - await db.query(`DROP INDEX "public"."IDX_9b774e46b8b1cf7f828133809a"`) - await db.query(`DROP INDEX "public"."IDX_4e95bf069de04533d83a9a97fd"`) - await db.query(`DROP INDEX "public"."IDX_b04173f9349ddd991a3b60e914"`) - await db.query(`DROP TABLE "ousd_vault"`) - await db.query(`DROP INDEX "public"."IDX_6860186ea2f56e2c7d54c22107"`) - await db.query(`DROP INDEX "public"."IDX_0d0a7113a505cf7f7adea9ca81"`) - await db.query(`DROP TABLE "ousd_morpho_aave"`) - await db.query(`DROP INDEX "public"."IDX_78e0701c2e9a28242db37bd8f8"`) - await db.query(`DROP INDEX "public"."IDX_46ccf673b376d654052fbd53e6"`) - await db.query(`DROP TABLE "ousd_morpho_compound"`) - await db.query(`DROP INDEX "public"."IDX_9e7bd0d8ae23b877d5979ef80c"`) - await db.query(`DROP INDEX "public"."IDX_0bb3a0ad84071f1d80f6d4e90f"`) - await db.query(`DROP TABLE "maker_dsr_strategy"`) - await db.query(`DROP INDEX "public"."IDX_a35308a3c5dbaab2d321eb1525"`) - await db.query(`DROP INDEX "public"."IDX_844b219d8faf9b1d24ab2dba9a"`) - await db.query(`DROP TABLE "ousd_flux_strategy"`) - await db.query(`DROP INDEX "public"."IDX_5b165b5d30b13e363d33a66e14"`) - await db.query(`DROP INDEX "public"."IDX_80f3392968fde7b99cccb805ac"`) - await db.query(`DROP TABLE "ousd_compound_strategy"`) - await db.query(`DROP INDEX "public"."IDX_6920b1db5dc577295ac4d1379d"`) - await db.query(`DROP INDEX "public"."IDX_89c6d7d3104bd36dc88a37add4"`) - await db.query(`DROP TABLE "ousd_convex_strategy"`) - await db.query(`DROP INDEX "public"."IDX_2deac473cd0b2dd7082e7da148"`) - await db.query(`DROP INDEX "public"."IDX_157bf74171817dc5c60ee37036"`) - await db.query(`DROP TABLE "ousd_aave_strategy"`) - await db.query(`DROP INDEX "public"."IDX_ca34b5a0a33bc9abdd8213c2fa"`) - await db.query(`DROP INDEX "public"."IDX_dacd7c98223d7bc8be074d71e4"`) - await db.query(`DROP TABLE "ousd_meta_strategy"`) - await db.query(`DROP INDEX "public"."IDX_7e998dcf775263bc5df76ef987"`) - await db.query(`DROP INDEX "public"."IDX_55ce185680512d6a5b9fb0af89"`) - await db.query(`DROP TABLE "ousd_convex_lusd_plus3_crv"`) - await db.query(`DROP INDEX "public"."IDX_0783af95efb35fb3f13cde1656"`) - await db.query(`DROP INDEX "public"."IDX_74ae01fb596a4f2733087ba454"`) - await db.query(`ALTER TABLE "oeth_history" DROP CONSTRAINT "FK_94e47c4c49128c78f60b185b46b"`) - await db.query(`ALTER TABLE "oeth_rebase" DROP CONSTRAINT "FK_3331819842173de7c27c046547a"`) - await db.query(`ALTER TABLE "oeth_rebase_option" DROP CONSTRAINT "FK_034428879698039839b4ba6ffe8"`) - await db.query(`ALTER TABLE "oeth_strategy_holding_daily_stat" DROP CONSTRAINT "FK_4e867f220975e615e6077d860c1"`) - await db.query(`ALTER TABLE "oeth_strategy_daily_stat" DROP CONSTRAINT "FK_6c7096c96a000d8471256ca8fc3"`) - await db.query(`ALTER TABLE "oeth_collateral_daily_stat" DROP CONSTRAINT "FK_a90045de50406be7bd56efd3ea4"`) - await db.query(`ALTER TABLE "ousd_history" DROP CONSTRAINT "FK_70291ea600c0c4d67d9bfe6a6bf"`) - await db.query(`ALTER TABLE "ousd_rebase" DROP CONSTRAINT "FK_427468c97f9838b804efd6c8e55"`) - await db.query(`ALTER TABLE "ousd_rebase_option" DROP CONSTRAINT "FK_b04173f9349ddd991a3b60e914a"`) - } -} diff --git a/schema-base.graphql b/schema-base.graphql index 8b650327..1aca0e56 100644 --- a/schema-base.graphql +++ b/schema-base.graphql @@ -50,4 +50,17 @@ type StrategyBalance @entity { strategy: String! asset: String! balance: BigInt! +} + +type StrategyYield @entity { + """ + Format: 'strategy:asset:blockNumber' + """ + id: ID! + timestamp: DateTime! @index + blockNumber: Int! @index + strategy: String! + asset: String! + balance: BigInt! + earnings: BigInt! } \ No newline at end of file diff --git a/schema.graphql b/schema.graphql index e18001c2..097373ed 100644 --- a/schema.graphql +++ b/schema.graphql @@ -52,6 +52,19 @@ type StrategyBalance @entity { strategy: String! asset: String! balance: BigInt! +} + +type StrategyYield @entity { + """ + Format: 'strategy:asset:blockNumber' + """ + id: ID! + timestamp: DateTime! @index + blockNumber: Int! @index + strategy: String! + asset: String! + balance: BigInt! + earnings: BigInt! }type CurvePoolBalance @entity { id: ID! timestamp: DateTime! @index diff --git a/src/main-oeth.ts b/src/main-oeth.ts index 7c6248a5..a6f6fde1 100644 --- a/src/main-oeth.ts +++ b/src/main-oeth.ts @@ -14,15 +14,15 @@ import * as exchangeRates from './shared/post-processors/exchange-rates' run({ stateSchema: 'oeth-processor', processors: [ - oeth, - vault, - fraxStaking, - morphoAave, - dripper, - curveLp, - balancerMetaPoolStrategy, + // oeth, + // vault, + // fraxStaking, + // morphoAave, + // dripper, + // curveLp, + // balancerMetaPoolStrategy, strategies, ], - postProcessors: [exchangeRates, dailyStats], - validators: [validateOeth], + // postProcessors: [exchangeRates, dailyStats], + // validators: [validateOeth], }) diff --git a/src/model/generated/index.ts b/src/model/generated/index.ts index a6443e67..636165fb 100644 --- a/src/model/generated/index.ts +++ b/src/model/generated/index.ts @@ -1,6 +1,7 @@ export * from "./exchangeRate.model" export * from "./balance.model" export * from "./strategyBalance.model" +export * from "./strategyYield.model" export * from "./curvePoolBalance.model" export * from "./oeth.model" export * from "./oethAddress.model" diff --git a/src/model/generated/strategyYield.model.ts b/src/model/generated/strategyYield.model.ts new file mode 100644 index 00000000..690e4c0a --- /dev/null +++ b/src/model/generated/strategyYield.model.ts @@ -0,0 +1,35 @@ +import {Entity as Entity_, Column as Column_, PrimaryColumn as PrimaryColumn_, Index as Index_} from "typeorm" +import * as marshal from "./marshal" + +@Entity_() +export class StrategyYield { + constructor(props?: Partial) { + Object.assign(this, props) + } + + /** + * Format: 'strategy:asset:blockNumber' + */ + @PrimaryColumn_() + id!: string + + @Index_() + @Column_("timestamp with time zone", {nullable: false}) + timestamp!: Date + + @Index_() + @Column_("int4", {nullable: false}) + blockNumber!: number + + @Column_("text", {nullable: false}) + strategy!: string + + @Column_("text", {nullable: false}) + asset!: string + + @Column_("numeric", {transformer: marshal.bigintTransformer, nullable: false}) + balance!: bigint + + @Column_("numeric", {transformer: marshal.bigintTransformer, nullable: false}) + earnings!: bigint +} diff --git a/src/oeth/processors/balancer-meta-pool.ts b/src/oeth/processors/balancer-meta-pool.ts index 8d80edf1..20e8ed7f 100644 --- a/src/oeth/processors/balancer-meta-pool.ts +++ b/src/oeth/processors/balancer-meta-pool.ts @@ -6,7 +6,7 @@ import * as metaStablePool from '../../abi/meta-stable-pool' import { OETHBalancerMetaPoolStrategy } from '../../model' import { Context } from '../../processor' import { ensureExchangeRates } from '../../shared/post-processors/exchange-rates' -import { getBalancerStrategyHoldings } from '../../shared/processor-templates/strategy' +import { getBalancerStrategyHoldings } from '../../shared/processor-templates/strategy/strategy-balancer' import { RETH_ADDRESS, WETH_ADDRESS } from '../../utils/addresses' import { getLatestEntity } from '../../utils/utils' import { oethStrategies } from './strategies' diff --git a/src/oeth/processors/strategies/strategies.ts b/src/oeth/processors/strategies/strategies.ts index 10cd72b8..802b1628 100644 --- a/src/oeth/processors/strategies/strategies.ts +++ b/src/oeth/processors/strategies/strategies.ts @@ -18,6 +18,71 @@ import { WETH_ADDRESS, } from '../../../utils/addresses' +export const oethStrategies: readonly IStrategyData[] = [ + { + from: 17249899, + name: 'OETH Convex ETH+OETH (AMO)', + address: '0x1827f9ea98e0bf96550b2fc20f7233277fcd7e63', + kind: 'CurveAMO', + curvePoolInfo: { + poolAddress: '0x94b17476a93b3262d87b9a326965d1e91f9c13e7', + rewardsPoolAddress: '0x24b65dc1cf053a8d96872c323d29e86ec43eb33a', + }, + assets: [WETH_ADDRESS, OETH_ADDRESS], + }, + // { + // from: 17067232, + // name: 'OETH Frax Staking', + // address: '0x3ff8654d633d4ea0fae24c52aec73b4a20d0d0e5', + // kind: 'Generic', + // assets: [FRXETH_ADDRESS], + // }, + // { + // from: 17367105, + // name: 'OETH Morpho Aave V2', + // address: '0xc1fc9e5ec3058921ea5025d703cbe31764756319', + // kind: 'Generic', + // assets: [WETH_ADDRESS], + // }, + // { + // from: 18156225, + // name: 'OETH Aura rETH/WETH', + // address: '0x49109629ac1deb03f2e9b2fe2ac4a623e0e7dfdc', + // kind: 'BalancerMetaStablePool', + // assets: [WETH_ADDRESS, RETH_ADDRESS], + // balancerPoolInfo: { + // poolId: + // '0x1e19cf2d73a72ef1332c882f20534b6519be0276000200000000000000000112', + // poolAddress: '0x1e19cf2d73a72ef1332c882f20534b6519be0276', + // }, + // }, +] as const + +const strategies = oethStrategies + +export const from = Math.min(...strategies.map((s) => s.from)) + +export const setup = (processor: EvmBatchProcessor) => { + strategies.forEach((s) => createStrategySetup(s)(processor)) + strategies.forEach((s) => createStrategyRewardSetup(s)(processor)) +} + +const processors = [ + ...strategies.map(createStrategyProcessor), + ...strategies.map((strategy) => + createStrategyRewardProcessor({ + ...strategy, + OTokenRewardTokenCollected: OETHRewardTokenCollected, + }), + ), +] + +export const process = async (ctx: Context) => { + await Promise.all(processors.map((p) => p(ctx))) +} + +// Useful values for OUSD later + // const DAI = '0x6b175474e89094c44da98b954eedeac495271d0f'.toLowerCase() // const USDT = '0xdac17f958d2ee523a2206206994597c13d831ec7'.toLowerCase() // const USDC = '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48'.toLowerCase() @@ -76,66 +141,3 @@ import { // address: '0x7A192DD9Cc4Ea9bdEdeC9992df74F1DA55e60a19'.toLowerCase(), // }, // ] as const - -export const oethStrategies: readonly IStrategyData[] = [ - { - from: 18083920, - name: 'OETH Convex ETH+OETH (AMO)', - address: '0x1827f9ea98e0bf96550b2fc20f7233277fcd7e63', - kind: 'CurveAMO', - curvePoolInfo: { - poolAddress: '0x94b17476a93b3262d87b9a326965d1e91f9c13e7', - rewardsPoolAddress: '0x24b65dc1cf053a8d96872c323d29e86ec43eb33a', - }, - assets: [WETH_ADDRESS, OETH_ADDRESS], - }, - { - from: 17513633, - name: 'OETH Frax Staking', - address: '0x3ff8654d633d4ea0fae24c52aec73b4a20d0d0e5', - kind: 'Generic', - assets: [FRXETH_ADDRESS], - }, - { - from: 17612333, - name: 'OETH Morpho Aave V2', - address: '0xc1fc9e5ec3058921ea5025d703cbe31764756319', - kind: 'Generic', - assets: [WETH_ADDRESS], - }, - { - from: 18156225, - name: 'OETH Aura rETH/WETH', - address: '0x49109629ac1deb03f2e9b2fe2ac4a623e0e7dfdc', - kind: 'BalancerMetaStablePool', - assets: [WETH_ADDRESS, RETH_ADDRESS], - balancerPoolInfo: { - poolId: - '0x1e19cf2d73a72ef1332c882f20534b6519be0276000200000000000000000112', - poolAddress: '0x1e19cf2d73a72ef1332c882f20534b6519be0276', - }, - }, -] as const - -const strategies = oethStrategies - -export const from = Math.min(...strategies.map((s) => s.from)) - -export const setup = (processor: EvmBatchProcessor) => { - strategies.forEach((s) => createStrategySetup(s.from)(processor)) - strategies.forEach((s) => createStrategyRewardSetup(s)(processor)) -} - -const processors = [ - ...strategies.map(createStrategyProcessor), - ...strategies.map((strategy) => - createStrategyRewardProcessor({ - ...strategy, - OTokenRewardTokenCollected: OETHRewardTokenCollected, - }), - ), -] - -export const process = async (ctx: Context) => { - await Promise.all(processors.map((p) => p(ctx))) -} diff --git a/src/shared/post-processors/exchange-rates/currencies.ts b/src/shared/post-processors/exchange-rates/currencies.ts index 32cb390c..cbb0e1ab 100644 --- a/src/shared/post-processors/exchange-rates/currencies.ts +++ b/src/shared/post-processors/exchange-rates/currencies.ts @@ -1,3 +1,5 @@ +import { invert, mapKeys } from 'lodash' + export const currencies = { USD: '0x0000000000000000000000000000000000000348', // Chainlink Denominations.USD ETH: '0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE', // Chainlink Denominations.ETH @@ -8,6 +10,11 @@ export const currencies = { rETH: '0xae78736cd615f374d3085123a210448e74fc6393', frxETH: '0x5e8422345238f34275888049021821e8e08caa1f', sfrxETH: '0xac3e018457b222d93114458476f3e3416abbe38f', + CRV: '0xD533a949740bb3306d119CC777fa900bA034cd52', } as const +export const currenciesByAddress = mapKeys(invert(currencies), (v, k) => + k.toLowerCase(), +) as Record + export type Currency = keyof typeof currencies diff --git a/src/shared/post-processors/exchange-rates/exchange-rates.ts b/src/shared/post-processors/exchange-rates/exchange-rates.ts index e2c42a33..2cbcf132 100644 --- a/src/shared/post-processors/exchange-rates/exchange-rates.ts +++ b/src/shared/post-processors/exchange-rates/exchange-rates.ts @@ -1,7 +1,7 @@ import { ExchangeRate } from '../../../model' import { Block, Context } from '../../../processor' import { useProcessorState } from '../../../utils/state' -import { Currency } from './currencies' +import { Currency, currenciesByAddress } from './currencies' import { getPrice } from './price-routing' const useExchangeRates = (ctx: Context) => @@ -21,6 +21,8 @@ export const ensureExchangeRate = async ( base: Currency, quote: Currency, ) => { + if (currenciesByAddress[base]) base = currenciesByAddress[base] + if (currenciesByAddress[quote]) quote = currenciesByAddress[quote] const [exchangeRates] = useExchangeRates(ctx) const pair = `${base}_${quote}` const blockNumber = block.header.height diff --git a/src/shared/processor-templates/strategy-rewards/strategy-rewards.ts b/src/shared/processor-templates/strategy-rewards/strategy-rewards.ts index 2aba236c..5216e62c 100644 --- a/src/shared/processor-templates/strategy-rewards/strategy-rewards.ts +++ b/src/shared/processor-templates/strategy-rewards/strategy-rewards.ts @@ -33,7 +33,10 @@ export const createStrategyRewardProcessor = (params: { for (const block of ctx.blocks) { if (block.header.height < params.from) continue for (const log of block.logs) { - if (log.address === params.address) { + if ( + log.address === params.address && + log.topics[0] === iat.events.RewardTokenCollected.topic + ) { const data = iat.events.RewardTokenCollected.decode(log) const event = new params.OTokenRewardTokenCollected({ id: log.id, diff --git a/src/shared/processor-templates/strategy/strategy-balancer.ts b/src/shared/processor-templates/strategy/strategy-balancer.ts new file mode 100644 index 00000000..db41f05f --- /dev/null +++ b/src/shared/processor-templates/strategy/strategy-balancer.ts @@ -0,0 +1,140 @@ +import { EvmBatchProcessor } from '@subsquid/evm-processor' +import { memoize } from 'lodash' + +import * as balancerMetaStablePoolStrategyAbi from '../../../abi/balancer-meta-pool-strategy' +import * as balancerRateProvider from '../../../abi/balancer-rate-provider' +import * as balancerVaultAbi from '../../../abi/balancer-vault' +import * as abstractStrategyAbi from '../../../abi/initializable-abstract-strategy' +import * as balancerMetaStablePoolAbi from '../../../abi/meta-stable-pool' +import { StrategyBalance } from '../../../model' +import { Block, Context } from '../../../processor' +import { + ADDRESS_ZERO, + BALANCER_VAULT, + ETH_ADDRESS, + OETH_HARVESTER_ADDRESS, + WETH_ADDRESS, +} from '../../../utils/addresses' +import { blockFrequencyTracker } from '../../../utils/blockFrequencyUpdater' +import { IStrategyData } from './index' +import { getStrategyBalances } from './strategy-curve-amo' +import { processStrategyEarnings } from './strategy-earnings' + +export const setup = ( + processor: EvmBatchProcessor, + strategyData: IStrategyData, +) => { + processor.includeAllBlocks({ from: strategyData.from }) + processor.addLog({ + address: [strategyData.address], + topic0: [ + abstractStrategyAbi.events.Deposit.topic, + abstractStrategyAbi.events.Withdrawal.topic, + abstractStrategyAbi.events.RewardTokenCollected.topic, + ], + }) +} + +export const process = async (ctx: Context, strategyData: IStrategyData) => { + const shouldUpdate = blockFrequencyTracker({ from: strategyData.from }) + const data: StrategyBalance[] = [] + for (const block of ctx.blocks) { + if (shouldUpdate(ctx, block)) { + const results = await getBalancerStrategyHoldings( + ctx, + block, + strategyData, + ) + data.push(...results) + } + } + await ctx.store.insert(data) + // await processStrategyEarnings(ctx, strategyData, getStrategyBalances) +} + +export const getBalancerStrategyHoldings = async ( + ctx: Context, + block: Block, + strategyData: IStrategyData, +) => { + const { address, balancerPoolInfo } = strategyData + const { poolAddress, poolId } = balancerPoolInfo! + + const rateProviders = await _getBalancePoolRateProviders( + ctx, + block, + poolAddress, + ) + + const strategy = new balancerMetaStablePoolStrategyAbi.Contract( + ctx, + block.header, + address, + ) + const balancerVault = new balancerVaultAbi.Contract( + ctx, + block.header, + BALANCER_VAULT, + ) + let [poolAssets, balances] = await balancerVault.getPoolTokens(poolId) + + const totalStrategyBalance = await strategy['checkBalance()']() // in WETH + const eth1 = BigInt('1000000000000000000') + + let totalPoolValue = BigInt(0) + const assetBalances: bigint[] = [] + const assetRates: bigint[] = [] + for (let i = 0; i < poolAssets.length; i++) { + let tokenBalance = balances[i] // Balance of asset + + if ([ADDRESS_ZERO, WETH_ADDRESS, ETH_ADDRESS].includes(poolAssets[i])) { + poolAssets[i] = WETH_ADDRESS + } + + if (ADDRESS_ZERO == rateProviders[i]) { + assetRates.push(eth1) + } else { + const provider = new balancerRateProvider.Contract( + ctx, + block.header, + rateProviders[i], + ) + const rate = await provider.getRate() + assetRates.push(rate) + tokenBalance = (tokenBalance * rate) / eth1 + } + + assetBalances.push(tokenBalance) + totalPoolValue += tokenBalance // Balance of asset in WETH + } + + return poolAssets.map((asset, i) => { + const poolAssetSplit = (BigInt(10000) * assetBalances[i]) / totalPoolValue + const balance = + (eth1 * totalStrategyBalance * poolAssetSplit) / + assetRates[i] / + BigInt(10000) + + return new StrategyBalance({ + id: `${address}:${asset}:${block.header.height}`, + strategy: address, + asset, + balance, + blockNumber: block.header.height, + timestamp: new Date(block.header.timestamp), + }) + }) +} + +const _getBalancePoolRateProviders = memoize( + async (ctx: Context, block: Block, address: string) => { + const pool = new balancerMetaStablePoolAbi.Contract( + ctx, + block.header, + address, + ) + const rateProviders = await pool.getRateProviders() + return rateProviders + }, + (_ctx, _block, address) => address.toLowerCase(), +) diff --git a/src/shared/processor-templates/strategy/strategy-curve-amo.ts b/src/shared/processor-templates/strategy/strategy-curve-amo.ts new file mode 100644 index 00000000..604557cb --- /dev/null +++ b/src/shared/processor-templates/strategy/strategy-curve-amo.ts @@ -0,0 +1,128 @@ +import { EvmBatchProcessor } from '@subsquid/evm-processor' +import { pad } from 'viem' + +import * as curvePool from '../../../abi/curve-lp-token' +import * as erc20 from '../../../abi/erc20' +import * as abstractStrategyAbi from '../../../abi/initializable-abstract-strategy' +import { StrategyBalance } from '../../../model' +import { Block, Context } from '../../../processor' +import { + ETH_ADDRESS, + OETH_ADDRESS, + OETH_DRIPPER_ADDRESS, + OETH_HARVESTER_ADDRESS, + WETH_ADDRESS, +} from '../../../utils/addresses' +import { blockFrequencyTracker } from '../../../utils/blockFrequencyUpdater' +import { IStrategyData } from './index' +import { processStrategyEarnings } from './strategy-earnings' + +export const setup = ( + processor: EvmBatchProcessor, + strategyData: IStrategyData, +) => { + processor.includeAllBlocks({ from: strategyData.from }) + processor.addLog({ + address: [strategyData.address], + topic0: [ + abstractStrategyAbi.events.Deposit.topic, + abstractStrategyAbi.events.Withdrawal.topic, + abstractStrategyAbi.events.RewardTokenCollected.topic, + ], + }) + processor.addLog({ + address: [WETH_ADDRESS], + topic0: [erc20.events.Transfer.topic], + topic1: [pad(OETH_HARVESTER_ADDRESS)], + topic2: [pad(OETH_DRIPPER_ADDRESS)], + }) +} + +export const process = async (ctx: Context, strategyData: IStrategyData) => { + const shouldUpdate = blockFrequencyTracker({ from: strategyData.from }) + const data: StrategyBalance[] = [] + for (const block of ctx.blocks) { + if (shouldUpdate(ctx, block)) { + const results = await getCurveAMOStrategyHoldings( + ctx, + block, + strategyData, + ) + data.push(...results) + } + } + await ctx.store.insert(data) + await processStrategyEarnings(ctx, strategyData, getStrategyBalances) +} + +const getCurveAMOStrategyHoldings = async ( + ctx: Context, + block: Block, + strategyData: IStrategyData, +): Promise => { + const balances = await getStrategyBalances(ctx, block.header, strategyData) + return balances.map(({ address, asset, balance }) => { + return new StrategyBalance({ + id: `${address}:${asset}:${block.header.height}`, + strategy: address, + asset, + balance, + blockNumber: block.header.height, + timestamp: new Date(block.header.timestamp), + }) + }) +} + +export const getStrategyBalances = async ( + ctx: Context, + block: { height: number }, + strategyData: IStrategyData, +) => { + const { assets, address, curvePoolInfo } = strategyData + const { poolAddress, rewardsPoolAddress } = curvePoolInfo! + + const pool = new curvePool.Contract(ctx, block, poolAddress) + const rewardsPool = new erc20.Contract(ctx, block, rewardsPoolAddress) + const strategy = new abstractStrategyAbi.Contract(ctx, block, address) + + const lpPrice = await pool.get_virtual_price() + const stakedLPBalance = await rewardsPool.balanceOf(address) + let unstakedBalance = BigInt(0) + + const poolAssets: string[] = [] + const assetBalances: bigint[] = [] + let totalPoolValue = BigInt(0) + let coins: Record = {} + for (let i = 0; i < assets.length; i++) { + const balance = await pool.balances(BigInt(i)) + assetBalances.push(balance) + totalPoolValue += balance + + let coin = (await pool.coins(BigInt(i))).toLowerCase() + if (coin == ETH_ADDRESS) { + // Vault only deals in WETH not ETH + coin = WETH_ADDRESS + coins[i] = WETH_ADDRESS + } else { + coins[i] = coin + } + + if (coin != OETH_ADDRESS) { + const pTokenAddr = await strategy.assetToPToken(assets[i]) + const pToken = new erc20.Contract(ctx, block, pTokenAddr) + unstakedBalance += await pToken.balanceOf(address) + } + + poolAssets.push(coin) + } + + const eth1 = BigInt('1000000000000000000') + const totalStrategyLPBalance = + ((stakedLPBalance + unstakedBalance) * lpPrice) / eth1 + + return poolAssets.map((asset, i) => { + const poolAssetSplit = (BigInt(10000) * assetBalances[i]) / totalPoolValue + const balance = (totalStrategyLPBalance * poolAssetSplit) / BigInt(10000) + return { address, asset: coins[i], balance } + }) +} diff --git a/src/shared/processor-templates/strategy/strategy-earnings.ts b/src/shared/processor-templates/strategy/strategy-earnings.ts new file mode 100644 index 00000000..6496c4fe --- /dev/null +++ b/src/shared/processor-templates/strategy/strategy-earnings.ts @@ -0,0 +1,220 @@ +import { sum } from 'lodash' +import { LessThan } from 'typeorm' +import { formatEther, pad } from 'viem' + +import * as erc20 from '../../../abi/erc20' +import * as abstractStrategyAbi from '../../../abi/initializable-abstract-strategy' +import { StrategyYield } from '../../../model' +import { Block, Context } from '../../../processor' +import { + OETH_DRIPPER_ADDRESS, + OETH_HARVESTER_ADDRESS, + WETH_ADDRESS, +} from '../../../utils/addresses' +import { ensureExchangeRate } from '../../post-processors/exchange-rates' +import { IStrategyData } from './strategy' + +export const processStrategyEarnings = async ( + ctx: Context, + strategyData: IStrategyData, + getStrategyBalances: ( + ctx: Context, + block: { height: number }, + strategyData: IStrategyData, + ) => Promise<{ address: string; asset: string; balance: bigint }[]>, +) => { + ctx.log.info(`NEW CONTEXT`) + + const strategyYields = new Map() + + for (const block of ctx.blocks) { + if (block.logs.length) { + ctx.log.info(`NEW BLOCK: ${block.logs.length} logs`) + } + const txIgnore = new Set() + for (const log of block.logs) { + if (log.address === strategyData.address) { + const topic0 = log.topics[0] + ctx.log.info({ + block: block.header.height, + tx: log.transactionHash, + topic0, + }) + if ( + topic0 === abstractStrategyAbi.events.Deposit.topic || + topic0 === abstractStrategyAbi.events.Withdrawal.topic + ) { + ctx.log.info({ + type: + topic0 === abstractStrategyAbi.events.Deposit.topic + ? 'Deposit' + : 'Withdrawal', + transactionHash: log.transactionHash, + }) + const previousBalances = await getStrategyBalances( + ctx, + { height: block.header.height - 1 }, + strategyData, + ) + const balances = await getStrategyBalances( + ctx, + block.header, + strategyData, + ) + await Promise.all( + strategyData.assets.map((asset) => { + ensureExchangeRate(ctx, block, 'CRV', 'ETH') + return processDepositWithdrawal( + ctx, + strategyData, + block, + strategyYields, + asset, + previousBalances.find((b) => b.asset === asset)!.balance, + balances.find((b) => b.asset === asset)!.balance, + ) + }), + ) + } else if ( + topic0 === abstractStrategyAbi.events.RewardTokenCollected.topic && + !txIgnore.has(log.transactionHash) + ) { + txIgnore.add(log.transactionHash) + const wethTransferLogs = block.logs.filter( + (l) => + l.transactionHash === log.transactionHash && + l.address.toLowerCase() === WETH_ADDRESS && + l.topics[0] === erc20.events.Transfer.topic && + l.topics[1] === pad(OETH_HARVESTER_ADDRESS) && + l.topics[2] === pad(OETH_DRIPPER_ADDRESS), + ) + const amount = wethTransferLogs.reduce( + (sum, l) => sum + BigInt(l.data), + 0n, + ) + + await processRewardTokenCollected( + ctx, + strategyData, + block, + strategyYields, + { + token: WETH_ADDRESS, + amount, + }, + ) + } + } + } + } + await ctx.store.upsert([...strategyYields.values()].flat()) +} + +const processRewardTokenCollected = async ( + ctx: Context, + strategyData: IStrategyData, + block: Block, + resultMap: Map, + params: { token: string; amount: bigint }, +) => { + ctx.log.info(`Amount earned through rewards: ${formatEther(params.amount)}`) + const id = `${block.header.height}:${strategyData.address}:${params.token}` + let { latest, current, results } = await getLatest( + ctx, + block, + resultMap, + strategyData, + params.token, + id, + ) + if (!current) { + current = new StrategyYield({ + id, + blockNumber: block.header.height, + timestamp: new Date(block.header.timestamp), + strategy: strategyData.address, + asset: params.token, + balance: latest?.balance ?? 0n, + earnings: (latest?.earnings ?? 0n) + params.amount, + }) + results.push(current) + } else { + current.earnings += params.amount + } +} + +const processDepositWithdrawal = async ( + ctx: Context, + strategyData: IStrategyData, + block: Block, + resultMap: Map, + asset: string, + previousBalance: bigint, + balance: bigint, +) => { + const id = `${block.header.height}:${strategyData.address}:${asset}` + let { latest, current, results } = await getLatest( + ctx, + block, + resultMap, + strategyData, + asset, + id, + ) + ctx.log.info(`${!!latest} ${!!current} ${results.length}`) + if (!current) { + const earningsChange = + previousBalance - (latest?.balance ?? previousBalance) + current = new StrategyYield({ + id, + blockNumber: block.header.height, + timestamp: new Date(block.header.timestamp), + strategy: strategyData.address, + asset, + balance, + earnings: (latest?.earnings ?? 0n) + earningsChange, + }) + ctx.log.info( + `${asset} Setting balance: ${formatEther( + balance, + )}, last balance: ${formatEther( + latest?.balance ?? 0n, + )}, perceived earnings: ${formatEther( + earningsChange, + )}, total earnings: ${formatEther(current.earnings)}`, + ) + if (earningsChange < 0) { + ctx.log.warn('WARNING: earnings change is negative') + } + results.push(current) + } +} + +const last = (arr?: T[]) => (arr ? arr[arr.length - 1] : undefined) +const getLatest = async ( + ctx: Context, + block: Block, + resultMap: Map, + strategyData: IStrategyData, + asset: string, + id: string, +) => { + let results = resultMap.get(asset) + if (!results) { + ctx.log.info(`creating results set for ${asset}`) + results = [] + resultMap.set(asset, results) + } + let latest = + last(resultMap.get(asset)) ?? + (await ctx.store.findOne(StrategyYield, { + order: { blockNumber: 'desc' }, + where: { + blockNumber: LessThan(block.header.height), + strategy: strategyData.address, + asset, + }, + })) + let current = latest?.id === id ? latest : undefined + return { latest, current, results } +} diff --git a/src/shared/processor-templates/strategy/strategy-generic.ts b/src/shared/processor-templates/strategy/strategy-generic.ts new file mode 100644 index 00000000..5edbaad9 --- /dev/null +++ b/src/shared/processor-templates/strategy/strategy-generic.ts @@ -0,0 +1,84 @@ +import { EvmBatchProcessor } from '@subsquid/evm-processor' +import { LessThan } from 'typeorm' +import { formatEther } from 'viem' + +import * as abstractStrategyAbi from '../../../abi/initializable-abstract-strategy' +import { StrategyBalance, StrategyYield } from '../../../model' +import { Block, Context } from '../../../processor' +import { blockFrequencyTracker } from '../../../utils/blockFrequencyUpdater' +import { IStrategyData } from './index' +import { processStrategyEarnings } from './strategy-earnings' + +export const setup = ( + processor: EvmBatchProcessor, + strategyData: IStrategyData, +) => { + processor.includeAllBlocks({ from: strategyData.from }) + processor.addLog({ + address: [strategyData.address], + topic0: [ + abstractStrategyAbi.events.Deposit.topic, + abstractStrategyAbi.events.Withdrawal.topic, + abstractStrategyAbi.events.RewardTokenCollected.topic, + ], + }) +} + +export const process = async (ctx: Context, strategyData: IStrategyData) => { + ctx.log.info(`NEW CONTEXT`) + + const shouldUpdate = blockFrequencyTracker({ from: strategyData.from }) + const strategyBalances: StrategyBalance[] = [] + const strategyYields = new Map() + + for (const block of ctx.blocks) { + if (block.logs.length) { + ctx.log.info(`NEW BLOCK: ${block.logs.length} logs`) + } + if (shouldUpdate(ctx, block)) { + const results = await getStrategyHoldings(ctx, block, strategyData) + strategyBalances.push(...results) + } + } + await ctx.store.insert(strategyBalances) + await processStrategyEarnings(ctx, strategyData, getStrategyBalances) +} + +const getStrategyHoldings = async ( + ctx: Context, + block: Block, + strategyData: IStrategyData, +): Promise => { + const { assets, address } = strategyData + const balances = await getStrategyBalances(ctx, block.header, strategyData) + const promises = assets.map(async (asset) => { + return new StrategyBalance({ + id: `${address}:${asset}:${block.header.height}`, + strategy: address, + asset: asset, + balance: balances.find((b) => b.asset === asset)?.balance, + blockNumber: block.header.height, + timestamp: new Date(block.header.timestamp), + }) + }) + + return await Promise.all(promises) +} + +const getStrategyBalances = async ( + ctx: Context, + block: { height: number }, + strategyData: IStrategyData, +) => { + return await Promise.all( + strategyData.assets.map(async (asset) => { + const contract = new abstractStrategyAbi.Contract( + ctx, + block, + strategyData.address, + ) + const balance = await contract.checkBalance(asset) + return { address: strategyData.address, asset, balance } + }), + ) +} diff --git a/src/shared/processor-templates/strategy/strategy.ts b/src/shared/processor-templates/strategy/strategy.ts index 11610ff6..0cb05447 100644 --- a/src/shared/processor-templates/strategy/strategy.ts +++ b/src/shared/processor-templates/strategy/strategy.ts @@ -1,23 +1,9 @@ import { EvmBatchProcessor } from '@subsquid/evm-processor' -import { memoize } from 'lodash' -import * as balancerMetaStablePoolStrategyAbi from '../../../abi/balancer-meta-pool-strategy' -import * as balancerRateProvider from '../../../abi/balancer-rate-provider' -import * as balancerVaultAbi from '../../../abi/balancer-vault' -import * as curvePool from '../../../abi/curve-lp-token' -import * as erc20 from '../../../abi/erc20' -import * as abstractStrategyAbi from '../../../abi/initializable-abstract-strategy' -import * as balancerMetaStablePoolAbi from '../../../abi/meta-stable-pool' -import { StrategyBalance } from '../../../model' -import { Block, Context } from '../../../processor' -import { - ADDRESS_ZERO, - BALANCER_VAULT, - ETH_ADDRESS, - OETH_ADDRESS, - WETH_ADDRESS, -} from '../../../utils/addresses' -import { blockFrequencyUpdater } from '../../../utils/blockFrequencyUpdater' +import { Context } from '../../../processor' +import * as strategyBalancer from './strategy-balancer' +import * as strategyCurveAMO from './strategy-curve-amo' +import * as strategyGeneric from './strategy-generic' export type IBalancerPoolInfo = { poolId: string @@ -43,200 +29,39 @@ export type IStrategyData = { curvePoolInfo?: ICurveAMOInfo } -export const createStrategySetup = - (from: number) => (processor: EvmBatchProcessor) => { - processor.includeAllBlocks({ from }) +const processors: Record< + IStrategyData['kind'], + { + setup: (processor: EvmBatchProcessor, strategyData: IStrategyData) => void + process: (ctx: Context, strategyData: IStrategyData) => Promise } - -// Used by `src/processors/strategies/strategies.ts` -export const createStrategyProcessor = (strategyData: IStrategyData) => { - const { from, kind } = strategyData - const update = blockFrequencyUpdater({ from }) - return async (ctx: Context) => { - const results = { - strategyBalances: [] as StrategyBalance[], - } - await update(ctx, async (ctx, block) => { - if (kind == 'Generic') { - results.strategyBalances.push( - ...(await _getStrategyHoldings(ctx, block, strategyData)), - ) - } else if (kind == 'CurveAMO') { - results.strategyBalances.push( - ...(await _getCurveAMOStrategyHoldings(ctx, block, strategyData)), - ) - } else if (kind == 'BalancerMetaStablePool') { - results.strategyBalances.push( - ...(await getBalancerStrategyHoldings(ctx, block, strategyData)), - ) - } - }) - await ctx.store.insert(results.strategyBalances) - } -} - -const _getStrategyHoldings = async ( - ctx: Context, - block: Block, - strategyData: IStrategyData, -): Promise => { - const { assets, address } = strategyData - const strategy = new abstractStrategyAbi.Contract(ctx, block.header, address) - const promises = assets.map(async (asset) => { - return new StrategyBalance({ - id: `${address}:${asset}:${block.header.height}`, - strategy: address, - asset: asset, - balance: await strategy.checkBalance(asset), - blockNumber: block.header.height, - timestamp: new Date(block.header.timestamp), - }) - }) - - return await Promise.all(promises) +> = { + Generic: strategyGeneric, + CurveAMO: strategyCurveAMO, + BalancerMetaStablePool: strategyBalancer, + BalancerComposableStablePool: { + setup: () => Promise.reject('Not implemented.'), + process: () => Promise.reject('Not implemented.'), + }, } -const _getCurveAMOStrategyHoldings = async ( - ctx: Context, - block: Block, - strategyData: IStrategyData, -): Promise => { - const { assets, address, curvePoolInfo } = strategyData - const { poolAddress, rewardsPoolAddress } = curvePoolInfo! - - const pool = new curvePool.Contract(ctx, block.header, poolAddress) - const rewardsPool = new erc20.Contract(ctx, block.header, rewardsPoolAddress) - const strategy = new abstractStrategyAbi.Contract(ctx, block.header, address) - - const lpPrice = await pool.get_virtual_price() - const stakedLPBalance = await rewardsPool.balanceOf(address) - let unstakedBalance = BigInt(0) - - const poolAssets: string[] = [] - const assetBalances: bigint[] = [] - let totalPoolValue = BigInt(0) - for (let i = 0; i < assets.length; i++) { - const balance = await pool.balances(BigInt(i)) - assetBalances.push(balance) - totalPoolValue += balance - - let coin = (await pool.coins(BigInt(i))).toLowerCase() - if (coin == ETH_ADDRESS) { - // Vault only deals in WETH not ETH - coin = WETH_ADDRESS - } - - if (coin != OETH_ADDRESS) { - const pTokenAddr = await strategy.assetToPToken(assets[i]) - const pToken = new erc20.Contract(ctx, block.header, pTokenAddr) - unstakedBalance += await pToken.balanceOf(address) - } - - poolAssets.push(coin) +export const createStrategySetup = (strategyData: IStrategyData) => { + const { kind } = strategyData + const processor = processors[kind] + if (processor) { + return (p: EvmBatchProcessor) => processor.setup(p, strategyData) + } else { + throw new Error(`Unsupported strategy kind: ${kind}`) } - - const eth1 = BigInt('1000000000000000000') - const totalStrategyLPBalance = - ((stakedLPBalance + unstakedBalance) * lpPrice) / eth1 - - return poolAssets.map((asset, i) => { - const poolAssetSplit = (BigInt(10000) * assetBalances[i]) / totalPoolValue - const balance = (totalStrategyLPBalance * poolAssetSplit) / BigInt(10000) - - return new StrategyBalance({ - id: `${address}:${asset}:${block.header.height}`, - strategy: address, - asset, - balance, - blockNumber: block.header.height, - timestamp: new Date(block.header.timestamp), - }) - }) } -export const getBalancerStrategyHoldings = async ( - ctx: Context, - block: Block, - strategyData: IStrategyData, -) => { - const { address, balancerPoolInfo } = strategyData - const { poolAddress, poolId } = balancerPoolInfo! - - const rateProviders = await _getBalancePoolRateProviders( - ctx, - block, - poolAddress, - ) - - const strategy = new balancerMetaStablePoolStrategyAbi.Contract( - ctx, - block.header, - address, - ) - const balancerVault = new balancerVaultAbi.Contract( - ctx, - block.header, - BALANCER_VAULT, - ) - let [poolAssets, balances] = await balancerVault.getPoolTokens(poolId) - - const totalStrategyBalance = await strategy['checkBalance()']() // in WETH - const eth1 = BigInt('1000000000000000000') - - let totalPoolValue = BigInt(0) - const assetBalances: bigint[] = [] - const assetRates: bigint[] = [] - for (let i = 0; i < poolAssets.length; i++) { - let tokenBalance = balances[i] // Balance of asset - - if ([ADDRESS_ZERO, WETH_ADDRESS, ETH_ADDRESS].includes(poolAssets[i])) { - poolAssets[i] = WETH_ADDRESS - } - - if (ADDRESS_ZERO == rateProviders[i]) { - assetRates.push(eth1) - } else { - const provider = new balancerRateProvider.Contract( - ctx, - block.header, - rateProviders[i], - ) - const rate = await provider.getRate() - assetRates.push(rate) - tokenBalance = (tokenBalance * rate) / eth1 - } - - assetBalances.push(tokenBalance) - totalPoolValue += tokenBalance // Balance of asset in WETH +// Used by `src/processors/strategies/strategies.ts` +export const createStrategyProcessor = (strategyData: IStrategyData) => { + const { kind } = strategyData + const processor = processors[kind] + if (processor) { + return (ctx: Context) => processor.process(ctx, strategyData) + } else { + throw new Error(`Unsupported strategy kind: ${kind}`) } - - return poolAssets.map((asset, i) => { - const poolAssetSplit = (BigInt(10000) * assetBalances[i]) / totalPoolValue - const balance = - (eth1 * totalStrategyBalance * poolAssetSplit) / - assetRates[i] / - BigInt(10000) - - return new StrategyBalance({ - id: `${address}:${asset}:${block.header.height}`, - strategy: address, - asset, - balance, - blockNumber: block.header.height, - timestamp: new Date(block.header.timestamp), - }) - }) } - -const _getBalancePoolRateProviders = memoize( - async (ctx: Context, block: Block, address: string) => { - const pool = new balancerMetaStablePoolAbi.Contract( - ctx, - block.header, - address, - ) - const rateProviders = await pool.getRateProviders() - return rateProviders - }, - (_ctx, _block, address) => address.toLowerCase(), -) diff --git a/src/utils/addresses.ts b/src/utils/addresses.ts index bd1ecebd..e3e7d81f 100644 --- a/src/utils/addresses.ts +++ b/src/utils/addresses.ts @@ -8,6 +8,9 @@ export const OUSD_VAULT_ADDRESS = '0xe75d77b1865ae93c7eaa3040b038d7aa7bc02f70' export const OETH_ADDRESS = '0x856c4efb76c1d1ae02e20ceb03a2a6a08b0b8dc3' export const OETH_VAULT_ADDRESS = '0x39254033945aa2e4809cc2977e7087bee48bd7ab' +export const OETH_HARVESTER_ADDRESS = + '0x0d017afa83eace9f10a8ec5b6e13941664a6785c' +export const OETH_DRIPPER_ADDRESS = '0xc0f42f73b8f01849a2dd99753524d4ba14317eb3' export const WETH_ADDRESS = '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2' export const STETH_ADDRESS = '0xae7ab96520de3a18e5e111b5eaab095312d7fe84' @@ -38,10 +41,7 @@ export const OETH_FRAX_STAKING_ADDRESS = export const OETH_MORPHO_AAVE_ADDRESS = '0xc1fc9e5ec3058921ea5025d703cbe31764756319' -export const OETH_DRIPPER_ADDRESS = '0xc0f42f73b8f01849a2dd99753524d4ba14317eb3' - export const OETH_STRATEGY_BALANCER_ADDRESS = '0x49109629ac1deb03f2e9b2fe2ac4a623e0e7dfdc' - -export const BALANCER_VAULT = '0xba12222222228d8ba445958a75a0704d566bf2c8' \ No newline at end of file +export const BALANCER_VAULT = '0xba12222222228d8ba445958a75a0704d566bf2c8' diff --git a/src/utils/blockFrequencyUpdater.ts b/src/utils/blockFrequencyUpdater.ts index 5177e3df..6beaf287 100644 --- a/src/utils/blockFrequencyUpdater.ts +++ b/src/utils/blockFrequencyUpdater.ts @@ -19,17 +19,32 @@ const oneHourAgo = dayjs.utc().subtract(1, 'hour').valueOf() const getFrequency = (bps: number, timestamp: number) => { if (timestamp < oneYearAgo) { - return (SECONDS_PER_WEEK / bps) ^ 0 + return (SECONDS_PER_WEEK / bps) ^ 0 // Older than one year ago } else if (timestamp < oneMonthAgo) { - return (SECONDS_PER_DAY / bps) ^ 0 + return (SECONDS_PER_DAY / bps) ^ 0 // Older than one month ago } else if (timestamp < oneWeekAgo) { - return (SECONDS_PER_DAY / bps / 4) ^ 0 + return (SECONDS_PER_DAY / bps / 4) ^ 0 // Older than one week ago } else if (timestamp < oneDayAgo) { - return (SECONDS_PER_DAY / bps / 24) ^ 0 + return (SECONDS_PER_DAY / bps / 24) ^ 0 // Older than one day ago } else if (timestamp < oneHourAgo) { - return ((SECONDS_PER_MINUTE * 5) / bps) ^ 0 + return ((SECONDS_PER_MINUTE * 5) / bps) ^ 0 // Older than one hour ago + } + return (SECONDS_PER_MINUTE / bps) ^ 0 +} + +export const blockFrequencyTracker = (params: { from: number }) => { + let lastBlockHeightProcessed = 0 + return (ctx: Context, block: Block) => { + if (block.header.height < params.from) return + // If we're not at head, determine our frequency and then process. + const { bps } = ctx + let frequency: number = getFrequency(bps, ctx.blocks[0].header.timestamp) + if (block.header.height >= lastBlockHeightProcessed + frequency) { + lastBlockHeightProcessed = block.header.height + return true + } + return false } - return 1 } export const blockFrequencyUpdater = (params: { from: number }) => { From 4147625e032bcbb9eaf43100cecb00c16d6a79ed Mon Sep 17 00:00:00 2001 From: Chris Jacobs Date: Mon, 30 Oct 2023 19:39:52 -0700 Subject: [PATCH 03/34] wip strategy earnings collection --- src/oeth/processors/strategies/strategies.ts | 56 +++++----- .../strategy/strategy-balancer.ts | 16 ++- .../strategy/strategy-curve-amo.ts | 22 +--- .../strategy/strategy-earnings.ts | 102 ++++++++++++------ .../strategy/strategy-generic.ts | 25 ++--- .../processor-templates/strategy/strategy.ts | 4 + 6 files changed, 122 insertions(+), 103 deletions(-) diff --git a/src/oeth/processors/strategies/strategies.ts b/src/oeth/processors/strategies/strategies.ts index 802b1628..363cceb5 100644 --- a/src/oeth/processors/strategies/strategies.ts +++ b/src/oeth/processors/strategies/strategies.ts @@ -29,33 +29,37 @@ export const oethStrategies: readonly IStrategyData[] = [ rewardsPoolAddress: '0x24b65dc1cf053a8d96872c323d29e86ec43eb33a', }, assets: [WETH_ADDRESS, OETH_ADDRESS], + earnings: { rewardTokenCollected: true }, + }, + { + from: 17067232, + name: 'OETH Frax Staking', + address: '0x3ff8654d633d4ea0fae24c52aec73b4a20d0d0e5', + kind: 'Generic', + assets: [FRXETH_ADDRESS], + earnings: { passiveByDepositWithdrawal: true }, + }, + { + from: 17367105, + name: 'OETH Morpho Aave V2', + address: '0xc1fc9e5ec3058921ea5025d703cbe31764756319', + kind: 'Generic', + assets: [WETH_ADDRESS], + earnings: { passiveByDepositWithdrawal: true }, + }, + { + from: 18156225, + name: 'OETH Aura rETH/WETH', + address: '0x49109629ac1deb03f2e9b2fe2ac4a623e0e7dfdc', + kind: 'BalancerMetaStablePool', + assets: [WETH_ADDRESS, RETH_ADDRESS], + earnings: { passiveByDepositWithdrawal: true }, + balancerPoolInfo: { + poolId: + '0x1e19cf2d73a72ef1332c882f20534b6519be0276000200000000000000000112', + poolAddress: '0x1e19cf2d73a72ef1332c882f20534b6519be0276', + }, }, - // { - // from: 17067232, - // name: 'OETH Frax Staking', - // address: '0x3ff8654d633d4ea0fae24c52aec73b4a20d0d0e5', - // kind: 'Generic', - // assets: [FRXETH_ADDRESS], - // }, - // { - // from: 17367105, - // name: 'OETH Morpho Aave V2', - // address: '0xc1fc9e5ec3058921ea5025d703cbe31764756319', - // kind: 'Generic', - // assets: [WETH_ADDRESS], - // }, - // { - // from: 18156225, - // name: 'OETH Aura rETH/WETH', - // address: '0x49109629ac1deb03f2e9b2fe2ac4a623e0e7dfdc', - // kind: 'BalancerMetaStablePool', - // assets: [WETH_ADDRESS, RETH_ADDRESS], - // balancerPoolInfo: { - // poolId: - // '0x1e19cf2d73a72ef1332c882f20534b6519be0276000200000000000000000112', - // poolAddress: '0x1e19cf2d73a72ef1332c882f20534b6519be0276', - // }, - // }, ] as const const strategies = oethStrategies diff --git a/src/shared/processor-templates/strategy/strategy-balancer.ts b/src/shared/processor-templates/strategy/strategy-balancer.ts index db41f05f..13501fc8 100644 --- a/src/shared/processor-templates/strategy/strategy-balancer.ts +++ b/src/shared/processor-templates/strategy/strategy-balancer.ts @@ -18,21 +18,17 @@ import { import { blockFrequencyTracker } from '../../../utils/blockFrequencyUpdater' import { IStrategyData } from './index' import { getStrategyBalances } from './strategy-curve-amo' -import { processStrategyEarnings } from './strategy-earnings' +import { + processStrategyEarnings, + setupStrategyEarnings, +} from './strategy-earnings' export const setup = ( processor: EvmBatchProcessor, strategyData: IStrategyData, ) => { processor.includeAllBlocks({ from: strategyData.from }) - processor.addLog({ - address: [strategyData.address], - topic0: [ - abstractStrategyAbi.events.Deposit.topic, - abstractStrategyAbi.events.Withdrawal.topic, - abstractStrategyAbi.events.RewardTokenCollected.topic, - ], - }) + setupStrategyEarnings(processor, strategyData) } export const process = async (ctx: Context, strategyData: IStrategyData) => { @@ -49,7 +45,7 @@ export const process = async (ctx: Context, strategyData: IStrategyData) => { } } await ctx.store.insert(data) - // await processStrategyEarnings(ctx, strategyData, getStrategyBalances) + await processStrategyEarnings(ctx, strategyData, getStrategyBalances) } export const getBalancerStrategyHoldings = async ( diff --git a/src/shared/processor-templates/strategy/strategy-curve-amo.ts b/src/shared/processor-templates/strategy/strategy-curve-amo.ts index 604557cb..f4a3aba9 100644 --- a/src/shared/processor-templates/strategy/strategy-curve-amo.ts +++ b/src/shared/processor-templates/strategy/strategy-curve-amo.ts @@ -9,33 +9,21 @@ import { Block, Context } from '../../../processor' import { ETH_ADDRESS, OETH_ADDRESS, - OETH_DRIPPER_ADDRESS, - OETH_HARVESTER_ADDRESS, WETH_ADDRESS, } from '../../../utils/addresses' import { blockFrequencyTracker } from '../../../utils/blockFrequencyUpdater' import { IStrategyData } from './index' -import { processStrategyEarnings } from './strategy-earnings' +import { + processStrategyEarnings, + setupStrategyEarnings, +} from './strategy-earnings' export const setup = ( processor: EvmBatchProcessor, strategyData: IStrategyData, ) => { processor.includeAllBlocks({ from: strategyData.from }) - processor.addLog({ - address: [strategyData.address], - topic0: [ - abstractStrategyAbi.events.Deposit.topic, - abstractStrategyAbi.events.Withdrawal.topic, - abstractStrategyAbi.events.RewardTokenCollected.topic, - ], - }) - processor.addLog({ - address: [WETH_ADDRESS], - topic0: [erc20.events.Transfer.topic], - topic1: [pad(OETH_HARVESTER_ADDRESS)], - topic2: [pad(OETH_DRIPPER_ADDRESS)], - }) + setupStrategyEarnings(processor, strategyData) } export const process = async (ctx: Context, strategyData: IStrategyData) => { diff --git a/src/shared/processor-templates/strategy/strategy-earnings.ts b/src/shared/processor-templates/strategy/strategy-earnings.ts index 6496c4fe..88232ae1 100644 --- a/src/shared/processor-templates/strategy/strategy-earnings.ts +++ b/src/shared/processor-templates/strategy/strategy-earnings.ts @@ -1,4 +1,4 @@ -import { sum } from 'lodash' +import { EvmBatchProcessor } from '@subsquid/evm-processor' import { LessThan } from 'typeorm' import { formatEther, pad } from 'viem' @@ -11,9 +11,40 @@ import { OETH_HARVESTER_ADDRESS, WETH_ADDRESS, } from '../../../utils/addresses' -import { ensureExchangeRate } from '../../post-processors/exchange-rates' import { IStrategyData } from './strategy' +const depositWithdrawalTopics = new Set([ + abstractStrategyAbi.events.Deposit.topic, + abstractStrategyAbi.events.Withdrawal.topic, +]) + +export const setupStrategyEarnings = ( + processor: EvmBatchProcessor, + strategyData: IStrategyData, +) => { + if (strategyData.earnings.passiveByDepositWithdrawal) { + processor.addLog({ + address: [strategyData.address], + topic0: [ + abstractStrategyAbi.events.Deposit.topic, + abstractStrategyAbi.events.Withdrawal.topic, + ], + }) + } + if (strategyData.earnings.rewardTokenCollected) { + processor.addLog({ + address: [strategyData.address], + topic0: [abstractStrategyAbi.events.RewardTokenCollected.topic], + }) + processor.addLog({ + address: [WETH_ADDRESS], + topic0: [erc20.events.Transfer.topic], + topic1: [pad(OETH_HARVESTER_ADDRESS)], + topic2: [pad(OETH_DRIPPER_ADDRESS)], + }) + } +} + export const processStrategyEarnings = async ( ctx: Context, strategyData: IStrategyData, @@ -29,20 +60,50 @@ export const processStrategyEarnings = async ( for (const block of ctx.blocks) { if (block.logs.length) { - ctx.log.info(`NEW BLOCK: ${block.logs.length} logs`) + ctx.log.info( + `${new Date(block.header.timestamp).toJSON()} NEW BLOCK: ${ + block.logs.length + } logs`, + ) } const txIgnore = new Set() for (const log of block.logs) { + const balanceTrackingUpdate = async () => { + const previousBalances = await getStrategyBalances( + ctx, + { height: block.header.height - 1 }, + strategyData, + ) + const balances = await getStrategyBalances( + ctx, + block.header, + strategyData, + ) + await Promise.all( + strategyData.assets.map((asset) => { + return processDepositWithdrawal( + ctx, + strategyData, + block, + strategyYields, + asset, + previousBalances.find((b) => b.asset === asset)!.balance, + balances.find((b) => b.asset === asset)!.balance, + ) + }), + ) + } + const topic0 = log.topics[0] if (log.address === strategyData.address) { - const topic0 = log.topics[0] ctx.log.info({ block: block.header.height, tx: log.transactionHash, topic0, }) + // TODO: TRACK CURVE AMO VIRTUAL PRICE INCREASES if ( - topic0 === abstractStrategyAbi.events.Deposit.topic || - topic0 === abstractStrategyAbi.events.Withdrawal.topic + strategyData.earnings.passiveByDepositWithdrawal && + depositWithdrawalTopics.has(topic0) ) { ctx.log.info({ type: @@ -51,31 +112,9 @@ export const processStrategyEarnings = async ( : 'Withdrawal', transactionHash: log.transactionHash, }) - const previousBalances = await getStrategyBalances( - ctx, - { height: block.header.height - 1 }, - strategyData, - ) - const balances = await getStrategyBalances( - ctx, - block.header, - strategyData, - ) - await Promise.all( - strategyData.assets.map((asset) => { - ensureExchangeRate(ctx, block, 'CRV', 'ETH') - return processDepositWithdrawal( - ctx, - strategyData, - block, - strategyYields, - asset, - previousBalances.find((b) => b.asset === asset)!.balance, - balances.find((b) => b.asset === asset)!.balance, - ) - }), - ) + await balanceTrackingUpdate() } else if ( + strategyData.earnings.rewardTokenCollected && topic0 === abstractStrategyAbi.events.RewardTokenCollected.topic && !txIgnore.has(log.transactionHash) ) { @@ -161,7 +200,6 @@ const processDepositWithdrawal = async ( asset, id, ) - ctx.log.info(`${!!latest} ${!!current} ${results.length}`) if (!current) { const earningsChange = previousBalance - (latest?.balance ?? previousBalance) @@ -179,6 +217,8 @@ const processDepositWithdrawal = async ( balance, )}, last balance: ${formatEther( latest?.balance ?? 0n, + )}, previous block balance: ${formatEther( + previousBalance, )}, perceived earnings: ${formatEther( earningsChange, )}, total earnings: ${formatEther(current.earnings)}`, diff --git a/src/shared/processor-templates/strategy/strategy-generic.ts b/src/shared/processor-templates/strategy/strategy-generic.ts index 5edbaad9..04f73b75 100644 --- a/src/shared/processor-templates/strategy/strategy-generic.ts +++ b/src/shared/processor-templates/strategy/strategy-generic.ts @@ -1,40 +1,27 @@ import { EvmBatchProcessor } from '@subsquid/evm-processor' -import { LessThan } from 'typeorm' -import { formatEther } from 'viem' import * as abstractStrategyAbi from '../../../abi/initializable-abstract-strategy' -import { StrategyBalance, StrategyYield } from '../../../model' +import { StrategyBalance } from '../../../model' import { Block, Context } from '../../../processor' import { blockFrequencyTracker } from '../../../utils/blockFrequencyUpdater' import { IStrategyData } from './index' -import { processStrategyEarnings } from './strategy-earnings' +import { + processStrategyEarnings, + setupStrategyEarnings, +} from './strategy-earnings' export const setup = ( processor: EvmBatchProcessor, strategyData: IStrategyData, ) => { processor.includeAllBlocks({ from: strategyData.from }) - processor.addLog({ - address: [strategyData.address], - topic0: [ - abstractStrategyAbi.events.Deposit.topic, - abstractStrategyAbi.events.Withdrawal.topic, - abstractStrategyAbi.events.RewardTokenCollected.topic, - ], - }) + setupStrategyEarnings(processor, strategyData) } export const process = async (ctx: Context, strategyData: IStrategyData) => { - ctx.log.info(`NEW CONTEXT`) - const shouldUpdate = blockFrequencyTracker({ from: strategyData.from }) const strategyBalances: StrategyBalance[] = [] - const strategyYields = new Map() - for (const block of ctx.blocks) { - if (block.logs.length) { - ctx.log.info(`NEW BLOCK: ${block.logs.length} logs`) - } if (shouldUpdate(ctx, block)) { const results = await getStrategyHoldings(ctx, block, strategyData) strategyBalances.push(...results) diff --git a/src/shared/processor-templates/strategy/strategy.ts b/src/shared/processor-templates/strategy/strategy.ts index 0cb05447..e0f3a0e8 100644 --- a/src/shared/processor-templates/strategy/strategy.ts +++ b/src/shared/processor-templates/strategy/strategy.ts @@ -27,6 +27,10 @@ export type IStrategyData = { assets: readonly string[] balancerPoolInfo?: IBalancerPoolInfo curvePoolInfo?: ICurveAMOInfo + earnings: { + rewardTokenCollected?: boolean + passiveByDepositWithdrawal?: boolean + } } const processors: Record< From 39485b6b64b0de58b60795d92082e7862a887378 Mon Sep 17 00:00:00 2001 From: Chris Jacobs Date: Mon, 30 Oct 2023 19:40:04 -0700 Subject: [PATCH 04/34] fix from prod --- src/shared/processor-templates/otoken/utils.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/shared/processor-templates/otoken/utils.ts b/src/shared/processor-templates/otoken/utils.ts index d2555c64..2ad49be3 100644 --- a/src/shared/processor-templates/otoken/utils.ts +++ b/src/shared/processor-templates/otoken/utils.ts @@ -159,8 +159,11 @@ export async function createRebaseAPY< await Promise.all( [last7daysDateId, last14daysDateId, last30daysDateId].map(async (i) => { const pastAPYs = await ctx.store - .findBy(OTokenAPY, { - id: MoreThanOrEqual(i.value), + .find(OTokenAPY, { + where: { + id: MoreThanOrEqual(i.value), + }, + order: { id: 'asc' }, }) .then((r) => r.slice(0, i.days - 1)) apy![i.key] = From 5f60e65544a11f0120f7bad280d20dea4c49c6a7 Mon Sep 17 00:00:00 2001 From: Chris Jacobs Date: Tue, 31 Oct 2023 16:42:46 -0700 Subject: [PATCH 05/34] wip strategy earnings collection --- abi/balancer-rate-provider.json | 39 ++ abi/frax-eth-strategy.json | 598 ------------------ db/migrations/1698456144669-Data.js | 283 +++++++++ src/oeth/processors/balancer-meta-pool.ts | 18 +- src/oeth/processors/strategies/strategies.ts | 12 +- .../strategy/strategy-balancer.ts | 47 +- .../strategy/strategy-curve-amo.ts | 8 +- .../strategy/strategy-earnings.ts | 92 ++- .../processor-templates/strategy/strategy.ts | 1 + 9 files changed, 438 insertions(+), 660 deletions(-) create mode 100644 abi/balancer-rate-provider.json delete mode 100644 abi/frax-eth-strategy.json create mode 100644 db/migrations/1698456144669-Data.js diff --git a/abi/balancer-rate-provider.json b/abi/balancer-rate-provider.json new file mode 100644 index 00000000..a7d6e94e --- /dev/null +++ b/abi/balancer-rate-provider.json @@ -0,0 +1,39 @@ +[ + { + "inputs": [ + { + "internalType": "contract RocketTokenRETHInterface", + "name": "_rocketTokenRETH", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [], + "name": "getRate", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "rocketTokenRETH", + "outputs": [ + { + "internalType": "contract RocketTokenRETHInterface", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + } +] \ No newline at end of file diff --git a/abi/frax-eth-strategy.json b/abi/frax-eth-strategy.json deleted file mode 100644 index 889f271a..00000000 --- a/abi/frax-eth-strategy.json +++ /dev/null @@ -1,598 +0,0 @@ -[ - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "_asset", - "type": "address" - }, - { - "indexed": false, - "internalType": "address", - "name": "_pToken", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "_amount", - "type": "uint256" - } - ], - "name": "Deposit", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "previousGovernor", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "newGovernor", - "type": "address" - } - ], - "name": "GovernorshipTransferred", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "_oldHarvesterAddress", - "type": "address" - }, - { - "indexed": false, - "internalType": "address", - "name": "_newHarvesterAddress", - "type": "address" - } - ], - "name": "HarvesterAddressesUpdated", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "_asset", - "type": "address" - }, - { - "indexed": false, - "internalType": "address", - "name": "_pToken", - "type": "address" - } - ], - "name": "PTokenAdded", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "_asset", - "type": "address" - }, - { - "indexed": false, - "internalType": "address", - "name": "_pToken", - "type": "address" - } - ], - "name": "PTokenRemoved", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "previousGovernor", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "newGovernor", - "type": "address" - } - ], - "name": "PendingGovernorshipTransfer", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address[]", - "name": "_oldAddresses", - "type": "address[]" - }, - { - "indexed": false, - "internalType": "address[]", - "name": "_newAddresses", - "type": "address[]" - } - ], - "name": "RewardTokenAddressesUpdated", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "recipient", - "type": "address" - }, - { - "indexed": false, - "internalType": "address", - "name": "rewardToken", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "RewardTokenCollected", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "_asset", - "type": "address" - }, - { - "indexed": false, - "internalType": "address", - "name": "_pToken", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "_amount", - "type": "uint256" - } - ], - "name": "Withdrawal", - "type": "event" - }, - { - "inputs": [], - "name": "_deprecated_rewardLiquidationThreshold", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "_deprecated_rewardTokenAddress", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "assetToPToken", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_asset", - "type": "address" - } - ], - "name": "checkBalance", - "outputs": [ - { - "internalType": "uint256", - "name": "balance", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "claimGovernance", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "collectRewardTokens", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_asset", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_amount", - "type": "uint256" - } - ], - "name": "deposit", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "depositAll", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "fraxETHMinter", - "outputs": [ - { - "internalType": "contract IFraxETHMinter", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getRewardTokenAddresses", - "outputs": [ - { - "internalType": "address[]", - "name": "", - "type": "address[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "governor", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "harvesterAddress", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_platformAddress", - "type": "address" - }, - { - "internalType": "address", - "name": "_vaultAddress", - "type": "address" - }, - { - "internalType": "address[]", - "name": "_rewardTokenAddresses", - "type": "address[]" - }, - { - "internalType": "address[]", - "name": "_assets", - "type": "address[]" - }, - { - "internalType": "address[]", - "name": "_pTokens", - "type": "address[]" - } - ], - "name": "initialize", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "isGovernor", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "platformAddress", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_assetIndex", - "type": "uint256" - } - ], - "name": "removePToken", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "rewardTokenAddresses", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "safeApproveAllTokens", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_harvesterAddress", - "type": "address" - } - ], - "name": "setHarvesterAddress", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_asset", - "type": "address" - }, - { - "internalType": "address", - "name": "_pToken", - "type": "address" - } - ], - "name": "setPTokenAddress", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address[]", - "name": "_rewardTokenAddresses", - "type": "address[]" - } - ], - "name": "setRewardTokenAddresses", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_asset", - "type": "address" - } - ], - "name": "supportsAsset", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_newGovernor", - "type": "address" - } - ], - "name": "transferGovernance", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_asset", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_amount", - "type": "uint256" - } - ], - "name": "transferToken", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "vaultAddress", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "weth", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_recipient", - "type": "address" - }, - { - "internalType": "address", - "name": "_asset", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_amount", - "type": "uint256" - } - ], - "name": "withdraw", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "withdrawAll", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "stateMutability": "payable", - "type": "receive" - } -] \ No newline at end of file diff --git a/db/migrations/1698456144669-Data.js b/db/migrations/1698456144669-Data.js new file mode 100644 index 00000000..2ffc4a15 --- /dev/null +++ b/db/migrations/1698456144669-Data.js @@ -0,0 +1,283 @@ +module.exports = class Data1698456144669 { + name = 'Data1698456144669' + + async up(db) { + await db.query(`CREATE TABLE "exchange_rate" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "pair" text NOT NULL, "base" text NOT NULL, "quote" text NOT NULL, "rate" numeric NOT NULL, CONSTRAINT "PK_5c5d27d2b900ef6cdeef0398472" PRIMARY KEY ("id"))`) + await db.query(`CREATE INDEX "IDX_9e23a3f1bf3634820c873a0fe8" ON "exchange_rate" ("timestamp") `) + await db.query(`CREATE INDEX "IDX_c61a93768eed9e58ce399bbe01" ON "exchange_rate" ("block_number") `) + await db.query(`CREATE TABLE "balance" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "token" text NOT NULL, "address" text NOT NULL, "balance" numeric NOT NULL, CONSTRAINT "PK_079dddd31a81672e8143a649ca0" PRIMARY KEY ("id"))`) + await db.query(`CREATE INDEX "IDX_a956b410c329b8eca7898c3c51" ON "balance" ("timestamp") `) + await db.query(`CREATE INDEX "IDX_6b451b59c9f6a6fdd685f530b2" ON "balance" ("block_number") `) + await db.query(`CREATE TABLE "strategy_balance" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "strategy" text NOT NULL, "asset" text NOT NULL, "balance" numeric NOT NULL, CONSTRAINT "PK_ca6f93229d1392e9546d01dae4f" PRIMARY KEY ("id"))`) + await db.query(`CREATE INDEX "IDX_0113bf0b63183bea0d22cd0d08" ON "strategy_balance" ("timestamp") `) + await db.query(`CREATE INDEX "IDX_a88065dcd92011698bbe7df7b1" ON "strategy_balance" ("block_number") `) + await db.query(`CREATE TABLE "strategy_yield" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "strategy" text NOT NULL, "asset" text NOT NULL, "balance" numeric NOT NULL, "earnings" numeric NOT NULL, CONSTRAINT "PK_e87c46575e870fe2202190c2728" PRIMARY KEY ("id"))`) + await db.query(`CREATE INDEX "IDX_5108f2a2563d5665892d0c06b0" ON "strategy_yield" ("timestamp") `) + await db.query(`CREATE INDEX "IDX_41c3567c9d43c598e07a0029c5" ON "strategy_yield" ("block_number") `) + await db.query(`CREATE TABLE "curve_pool_balance" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "address" text NOT NULL, "balance0" numeric NOT NULL, "balance1" numeric NOT NULL, "balance2" numeric NOT NULL, CONSTRAINT "PK_40412750bb910ca560aa084dd88" PRIMARY KEY ("id"))`) + await db.query(`CREATE INDEX "IDX_ffb0d0f86f03faacef7cb3e092" ON "curve_pool_balance" ("timestamp") `) + await db.query(`CREATE INDEX "IDX_db5522c865eb8ed76fa7aeb4a8" ON "curve_pool_balance" ("block_number") `) + await db.query(`CREATE TABLE "oeth" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "total_supply" numeric NOT NULL, "rebasing_supply" numeric NOT NULL, "non_rebasing_supply" numeric NOT NULL, CONSTRAINT "PK_de1d885501070dbd1ab6f8577ba" PRIMARY KEY ("id"))`) + await db.query(`CREATE INDEX "IDX_5b81a67229bac2d68e0dc92cc4" ON "oeth" ("timestamp") `) + await db.query(`CREATE INDEX "IDX_408e5f79f83093aa5cf2b0ea32" ON "oeth" ("block_number") `) + await db.query(`CREATE TABLE "oeth_history" ("id" character varying NOT NULL, "value" numeric NOT NULL, "balance" numeric NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "tx_hash" text NOT NULL, "type" character varying(8) NOT NULL, "address_id" character varying, CONSTRAINT "PK_2c7e7571cd9ea02b07a27a303f3" PRIMARY KEY ("id"))`) + await db.query(`CREATE INDEX "IDX_94e47c4c49128c78f60b185b46" ON "oeth_history" ("address_id") `) + await db.query(`CREATE INDEX "IDX_96956b1c8d29eb7066a97d5ea7" ON "oeth_history" ("block_number") `) + await db.query(`CREATE INDEX "IDX_b14170bdb7fbc0775bf55df15d" ON "oeth_history" ("tx_hash") `) + await db.query(`CREATE TABLE "oeth_address" ("id" character varying NOT NULL, "is_contract" boolean NOT NULL, "rebasing_option" character varying(6) NOT NULL, "balance" numeric NOT NULL, "earned" numeric NOT NULL, "credits" numeric NOT NULL, "last_updated" TIMESTAMP WITH TIME ZONE NOT NULL, CONSTRAINT "PK_92a966afe47d584af73ce77a1cd" PRIMARY KEY ("id"))`) + await db.query(`CREATE TABLE "oethapy" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "tx_hash" text NOT NULL, "apr" numeric NOT NULL, "apy" numeric NOT NULL, "apy7_day_avg" numeric NOT NULL, "apy14_day_avg" numeric NOT NULL, "apy30_day_avg" numeric NOT NULL, "rebasing_credits_per_token" numeric NOT NULL, CONSTRAINT "PK_8dbb4d04591848361200f18f62a" PRIMARY KEY ("id"))`) + await db.query(`CREATE INDEX "IDX_b1a448045d1ed9d655b679a371" ON "oethapy" ("timestamp") `) + await db.query(`CREATE INDEX "IDX_6b8a7a706a0701e659a7d81508" ON "oethapy" ("block_number") `) + await db.query(`CREATE INDEX "IDX_c0c03168bb0139e3cffda4f00e" ON "oethapy" ("tx_hash") `) + await db.query(`CREATE TABLE "oeth_rebase" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "tx_hash" text NOT NULL, "total_supply" numeric NOT NULL, "rebasing_credits" numeric NOT NULL, "rebasing_credits_per_token" numeric NOT NULL, "fee" numeric NOT NULL, "yield" numeric NOT NULL, "apy_id" character varying, CONSTRAINT "PK_5f8f4dd071caf685b4ac2d54de3" PRIMARY KEY ("id"))`) + await db.query(`CREATE INDEX "IDX_fbb7b3f2fff9896eb683b86de7" ON "oeth_rebase" ("timestamp") `) + await db.query(`CREATE INDEX "IDX_d3255d02d9407bba89380d01fa" ON "oeth_rebase" ("block_number") `) + await db.query(`CREATE INDEX "IDX_8b6bb0243472af88612fe6a01f" ON "oeth_rebase" ("tx_hash") `) + await db.query(`CREATE INDEX "IDX_3331819842173de7c27c046547" ON "oeth_rebase" ("apy_id") `) + await db.query(`CREATE TABLE "oeth_rebase_option" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "tx_hash" text NOT NULL, "status" character varying(6) NOT NULL, "address_id" character varying, CONSTRAINT "PK_32971725d5523200b4b3b7c07e5" PRIMARY KEY ("id"))`) + await db.query(`CREATE INDEX "IDX_1fc6bbd88037bfbf4361776909" ON "oeth_rebase_option" ("timestamp") `) + await db.query(`CREATE INDEX "IDX_cbb7ceb49ef7c45432d0171296" ON "oeth_rebase_option" ("block_number") `) + await db.query(`CREATE INDEX "IDX_355826dadaacc5ae2d63c82f28" ON "oeth_rebase_option" ("tx_hash") `) + await db.query(`CREATE INDEX "IDX_034428879698039839b4ba6ffe" ON "oeth_rebase_option" ("address_id") `) + await db.query(`CREATE TABLE "oeth_vault" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "weth" numeric NOT NULL, "st_eth" numeric NOT NULL, "r_eth" numeric NOT NULL, "frx_eth" numeric NOT NULL, CONSTRAINT "PK_9debaa84944fe2be9dc4219ba8f" PRIMARY KEY ("id"))`) + await db.query(`CREATE INDEX "IDX_d6298a294864b4eaf793cf35a4" ON "oeth_vault" ("timestamp") `) + await db.query(`CREATE INDEX "IDX_e20cb507a673817b2c68720415" ON "oeth_vault" ("block_number") `) + await db.query(`CREATE TABLE "oeth_curve_lp" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "total_supply" numeric NOT NULL, "eth" numeric NOT NULL, "oeth" numeric NOT NULL, "total_supply_owned" numeric NOT NULL, "eth_owned" numeric NOT NULL, "oeth_owned" numeric NOT NULL, CONSTRAINT "PK_2b055044664e80f44d6172fdf54" PRIMARY KEY ("id"))`) + await db.query(`CREATE INDEX "IDX_d9bbd20e888fa1b4b2c5d2f039" ON "oeth_curve_lp" ("timestamp") `) + await db.query(`CREATE INDEX "IDX_7617d593c36dce1b1565a8d74a" ON "oeth_curve_lp" ("block_number") `) + await db.query(`CREATE TABLE "oeth_frax_staking" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "sfrx_eth" numeric NOT NULL, CONSTRAINT "PK_694f53c8600ae88c7bdcf7305dd" PRIMARY KEY ("id"))`) + await db.query(`CREATE INDEX "IDX_ce6c2c65e90967dfeaac97025b" ON "oeth_frax_staking" ("timestamp") `) + await db.query(`CREATE INDEX "IDX_1a7f7d650390e2f9c212651e05" ON "oeth_frax_staking" ("block_number") `) + await db.query(`CREATE TABLE "oeth_morpho_aave" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "weth" numeric NOT NULL, CONSTRAINT "PK_86de8f846e9335c92b8ad7df3a1" PRIMARY KEY ("id"))`) + await db.query(`CREATE INDEX "IDX_25e239b985844f1d33fac79981" ON "oeth_morpho_aave" ("timestamp") `) + await db.query(`CREATE INDEX "IDX_a6662224e95eb6921bb14cb5f9" ON "oeth_morpho_aave" ("block_number") `) + await db.query(`CREATE TABLE "oeth_dripper" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "weth" numeric NOT NULL, CONSTRAINT "PK_77731281c1564c24eff0c265984" PRIMARY KEY ("id"))`) + await db.query(`CREATE INDEX "IDX_16ac742ceeb05d28e530da9649" ON "oeth_dripper" ("timestamp") `) + await db.query(`CREATE INDEX "IDX_d356832c14603916a492608e7b" ON "oeth_dripper" ("block_number") `) + await db.query(`CREATE TABLE "oeth_balancer_meta_pool_strategy" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "r_eth" numeric NOT NULL, "weth" numeric NOT NULL, CONSTRAINT "PK_6ddf5b8ba878e6d706e59bd6de0" PRIMARY KEY ("id"))`) + await db.query(`CREATE INDEX "IDX_5e7ef383756fa18cb602f50089" ON "oeth_balancer_meta_pool_strategy" ("timestamp") `) + await db.query(`CREATE INDEX "IDX_11d344b3e0e03cdb6697dd61f7" ON "oeth_balancer_meta_pool_strategy" ("block_number") `) + await db.query(`CREATE TABLE "oeth_strategy_holding_daily_stat" ("id" character varying NOT NULL, "symbol" text NOT NULL, "amount" numeric NOT NULL, "value" numeric NOT NULL, "strategy_daily_stat_id_id" character varying, CONSTRAINT "PK_7f1a62da5e53cf264c2f39b4acf" PRIMARY KEY ("id"))`) + await db.query(`CREATE INDEX "IDX_4e867f220975e615e6077d860c" ON "oeth_strategy_holding_daily_stat" ("strategy_daily_stat_id_id") `) + await db.query(`CREATE TABLE "oeth_strategy_daily_stat" ("id" character varying NOT NULL, "name" text NOT NULL, "total" numeric NOT NULL, "tvl" numeric NOT NULL, "daily_stat_id_id" character varying, CONSTRAINT "PK_8af1a0c60e67b05baf928787a8e" PRIMARY KEY ("id"))`) + await db.query(`CREATE INDEX "IDX_6c7096c96a000d8471256ca8fc" ON "oeth_strategy_daily_stat" ("daily_stat_id_id") `) + await db.query(`CREATE TABLE "oeth_collateral_daily_stat" ("id" character varying NOT NULL, "symbol" text NOT NULL, "amount" numeric NOT NULL, "price" numeric NOT NULL, "value" numeric NOT NULL, "daily_stat_id_id" character varying, CONSTRAINT "PK_5fb23d7bae30dffe4543e7aa069" PRIMARY KEY ("id"))`) + await db.query(`CREATE INDEX "IDX_a90045de50406be7bd56efd3ea" ON "oeth_collateral_daily_stat" ("daily_stat_id_id") `) + await db.query(`CREATE TABLE "oeth_daily_stat" ("id" character varying NOT NULL, "block_number" integer NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "apr" numeric NOT NULL, "apy" numeric NOT NULL, "apy7_day_avg" numeric NOT NULL, "apy14_day_avg" numeric NOT NULL, "apy30_day_avg" numeric NOT NULL, "total_supply" numeric NOT NULL, "total_supply_usd" numeric NOT NULL, "rebasing_supply" numeric NOT NULL, "non_rebasing_supply" numeric NOT NULL, "amo_supply" numeric NOT NULL, "dripper_weth" numeric NOT NULL, "yield" numeric NOT NULL, "fees" numeric NOT NULL, "revenue" numeric NOT NULL, "revenue7_day_avg" numeric NOT NULL, "revenue7_day_total" numeric NOT NULL, "revenue_all_time" numeric NOT NULL, "peg_price" numeric NOT NULL, CONSTRAINT "PK_9144a02ab13b1baa818a7d5eae5" PRIMARY KEY ("id"))`) + await db.query(`CREATE INDEX "IDX_98d9001013aa37425ca47b7126" ON "oeth_daily_stat" ("block_number") `) + await db.query(`CREATE INDEX "IDX_c3e66051c7df4efd6a8fa8f9c1" ON "oeth_daily_stat" ("timestamp") `) + await db.query(`CREATE TABLE "oeth_reward_token_collected" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "strategy" text NOT NULL, "recipient" text NOT NULL, "reward_token" text NOT NULL, "amount" numeric NOT NULL, CONSTRAINT "PK_47098cc5fbc7cb95c2374fa33cd" PRIMARY KEY ("id"))`) + await db.query(`CREATE INDEX "IDX_81a9fa43ae4a6ae63e4103127b" ON "oeth_reward_token_collected" ("timestamp") `) + await db.query(`CREATE INDEX "IDX_d36c78b9c3e9d737f067638bc4" ON "oeth_reward_token_collected" ("block_number") `) + await db.query(`CREATE TABLE "ogv" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "circulating" numeric NOT NULL, "total" numeric NOT NULL, CONSTRAINT "PK_f16038abf451ce82bd03ea54ee7" PRIMARY KEY ("id"))`) + await db.query(`CREATE INDEX "IDX_2418a8b8b92b2f5977be761cf9" ON "ogv" ("timestamp") `) + await db.query(`CREATE INDEX "IDX_b8f20bcf48e4aa77e0f48d77db" ON "ogv" ("block_number") `) + await db.query(`CREATE TABLE "staked_ogv" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "total" numeric NOT NULL, "apy" numeric NOT NULL, CONSTRAINT "PK_b135611d9aab36c7889982c3be8" PRIMARY KEY ("id"))`) + await db.query(`CREATE INDEX "IDX_533195c60cfaef9e118789dee9" ON "staked_ogv" ("timestamp") `) + await db.query(`CREATE INDEX "IDX_d601233411a33212b9d616aab0" ON "staked_ogv" ("block_number") `) + await db.query(`CREATE TABLE "ogv_governance" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "registered_voters" integer NOT NULL, "open_source_contributors" integer NOT NULL, "improvement_proposals" integer NOT NULL, CONSTRAINT "PK_b22758cd4ee8ff92c1b7ee0cf20" PRIMARY KEY ("id"))`) + await db.query(`CREATE INDEX "IDX_a0329e7109d5959b9aa3d9d374" ON "ogv_governance" ("timestamp") `) + await db.query(`CREATE INDEX "IDX_63cd1ca46771965c68f6b85898" ON "ogv_governance" ("block_number") `) + await db.query(`CREATE TABLE "ousd" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "total_supply" numeric NOT NULL, "rebasing_supply" numeric NOT NULL, "non_rebasing_supply" numeric NOT NULL, CONSTRAINT "PK_acecae4a20bc14b22d9f6738d8d" PRIMARY KEY ("id"))`) + await db.query(`CREATE INDEX "IDX_c8d1e285213b445b088805ac7c" ON "ousd" ("timestamp") `) + await db.query(`CREATE INDEX "IDX_806949dd853b7e8acab5d03b81" ON "ousd" ("block_number") `) + await db.query(`CREATE TABLE "ousd_history" ("id" character varying NOT NULL, "value" numeric NOT NULL, "balance" numeric NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "tx_hash" text NOT NULL, "type" character varying(8) NOT NULL, "address_id" character varying, CONSTRAINT "PK_dcbe3223b67f92d9ad4cffe8a7c" PRIMARY KEY ("id"))`) + await db.query(`CREATE INDEX "IDX_70291ea600c0c4d67d9bfe6a6b" ON "ousd_history" ("address_id") `) + await db.query(`CREATE INDEX "IDX_4d00d283e1ce3209dc43a0313c" ON "ousd_history" ("block_number") `) + await db.query(`CREATE INDEX "IDX_0c25caa59aa053a688a723d160" ON "ousd_history" ("tx_hash") `) + await db.query(`CREATE TABLE "ousd_address" ("id" character varying NOT NULL, "is_contract" boolean NOT NULL, "rebasing_option" character varying(6) NOT NULL, "balance" numeric NOT NULL, "earned" numeric NOT NULL, "credits" numeric NOT NULL, "last_updated" TIMESTAMP WITH TIME ZONE NOT NULL, CONSTRAINT "PK_bb061344757ede566d62854af6a" PRIMARY KEY ("id"))`) + await db.query(`CREATE TABLE "ousdapy" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "tx_hash" text NOT NULL, "apr" numeric NOT NULL, "apy" numeric NOT NULL, "apy7_day_avg" numeric NOT NULL, "apy14_day_avg" numeric NOT NULL, "apy30_day_avg" numeric NOT NULL, "rebasing_credits_per_token" numeric NOT NULL, CONSTRAINT "PK_d9889b7153efc82dbe88f9a7a33" PRIMARY KEY ("id"))`) + await db.query(`CREATE INDEX "IDX_c514963f42908ce84d65a84a77" ON "ousdapy" ("timestamp") `) + await db.query(`CREATE INDEX "IDX_4f606414b3b5ce1a366bd0fbf6" ON "ousdapy" ("block_number") `) + await db.query(`CREATE INDEX "IDX_0e84a81a109b66fe6f01f77c74" ON "ousdapy" ("tx_hash") `) + await db.query(`CREATE TABLE "ousd_rebase" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "tx_hash" text NOT NULL, "total_supply" numeric NOT NULL, "rebasing_credits" numeric NOT NULL, "rebasing_credits_per_token" numeric NOT NULL, "fee" numeric NOT NULL, "yield" numeric NOT NULL, "apy_id" character varying, CONSTRAINT "PK_04cf0de72399a99798dde61b237" PRIMARY KEY ("id"))`) + await db.query(`CREATE INDEX "IDX_f8eb4a16ce58a146b3227ee21a" ON "ousd_rebase" ("timestamp") `) + await db.query(`CREATE INDEX "IDX_3fb03b1a410e64c7367226d0b6" ON "ousd_rebase" ("block_number") `) + await db.query(`CREATE INDEX "IDX_1a76c478199672aaeec340f619" ON "ousd_rebase" ("tx_hash") `) + await db.query(`CREATE INDEX "IDX_427468c97f9838b804efd6c8e5" ON "ousd_rebase" ("apy_id") `) + await db.query(`CREATE TABLE "ousd_rebase_option" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "tx_hash" text NOT NULL, "status" character varying(6) NOT NULL, "address_id" character varying, CONSTRAINT "PK_d684f90866027104f3c929dfe10" PRIMARY KEY ("id"))`) + await db.query(`CREATE INDEX "IDX_64bd23947dc4c67e3b6a3f9352" ON "ousd_rebase_option" ("timestamp") `) + await db.query(`CREATE INDEX "IDX_9b774e46b8b1cf7f828133809a" ON "ousd_rebase_option" ("block_number") `) + await db.query(`CREATE INDEX "IDX_4e95bf069de04533d83a9a97fd" ON "ousd_rebase_option" ("tx_hash") `) + await db.query(`CREATE INDEX "IDX_b04173f9349ddd991a3b60e914" ON "ousd_rebase_option" ("address_id") `) + await db.query(`CREATE TABLE "ousd_vault" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "dai" numeric NOT NULL, "usdt" numeric NOT NULL, "usdc" numeric NOT NULL, CONSTRAINT "PK_343f5538c71a1cd78f1659ef9d3" PRIMARY KEY ("id"))`) + await db.query(`CREATE INDEX "IDX_6860186ea2f56e2c7d54c22107" ON "ousd_vault" ("timestamp") `) + await db.query(`CREATE INDEX "IDX_0d0a7113a505cf7f7adea9ca81" ON "ousd_vault" ("block_number") `) + await db.query(`CREATE TABLE "ousd_morpho_aave" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "dai" numeric NOT NULL, "usdt" numeric NOT NULL, "usdc" numeric NOT NULL, CONSTRAINT "PK_60676cde905a822ba73ff3a5c85" PRIMARY KEY ("id"))`) + await db.query(`CREATE INDEX "IDX_78e0701c2e9a28242db37bd8f8" ON "ousd_morpho_aave" ("timestamp") `) + await db.query(`CREATE INDEX "IDX_46ccf673b376d654052fbd53e6" ON "ousd_morpho_aave" ("block_number") `) + await db.query(`CREATE TABLE "ousd_morpho_compound" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "dai" numeric NOT NULL, "usdt" numeric NOT NULL, "usdc" numeric NOT NULL, CONSTRAINT "PK_5f715d53ef8fc0fad595cacf4fa" PRIMARY KEY ("id"))`) + await db.query(`CREATE INDEX "IDX_9e7bd0d8ae23b877d5979ef80c" ON "ousd_morpho_compound" ("timestamp") `) + await db.query(`CREATE INDEX "IDX_0bb3a0ad84071f1d80f6d4e90f" ON "ousd_morpho_compound" ("block_number") `) + await db.query(`CREATE TABLE "maker_dsr_strategy" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "dai" numeric NOT NULL, CONSTRAINT "PK_196da2d6910009ae04e3542fe22" PRIMARY KEY ("id"))`) + await db.query(`CREATE INDEX "IDX_a35308a3c5dbaab2d321eb1525" ON "maker_dsr_strategy" ("timestamp") `) + await db.query(`CREATE INDEX "IDX_844b219d8faf9b1d24ab2dba9a" ON "maker_dsr_strategy" ("block_number") `) + await db.query(`CREATE TABLE "ousd_flux_strategy" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "dai" numeric NOT NULL, "usdt" numeric NOT NULL, "usdc" numeric NOT NULL, CONSTRAINT "PK_ac977221429e50e4de1ce253a8b" PRIMARY KEY ("id"))`) + await db.query(`CREATE INDEX "IDX_5b165b5d30b13e363d33a66e14" ON "ousd_flux_strategy" ("timestamp") `) + await db.query(`CREATE INDEX "IDX_80f3392968fde7b99cccb805ac" ON "ousd_flux_strategy" ("block_number") `) + await db.query(`CREATE TABLE "ousd_compound_strategy" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "dai" numeric NOT NULL, "usdt" numeric NOT NULL, "usdc" numeric NOT NULL, CONSTRAINT "PK_9030e82bf3479d03c04e0d1919c" PRIMARY KEY ("id"))`) + await db.query(`CREATE INDEX "IDX_6920b1db5dc577295ac4d1379d" ON "ousd_compound_strategy" ("timestamp") `) + await db.query(`CREATE INDEX "IDX_89c6d7d3104bd36dc88a37add4" ON "ousd_compound_strategy" ("block_number") `) + await db.query(`CREATE TABLE "ousd_convex_strategy" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "dai" numeric NOT NULL, "usdt" numeric NOT NULL, "usdc" numeric NOT NULL, CONSTRAINT "PK_2b8f6e749e15e49d8816f1ac949" PRIMARY KEY ("id"))`) + await db.query(`CREATE INDEX "IDX_2deac473cd0b2dd7082e7da148" ON "ousd_convex_strategy" ("timestamp") `) + await db.query(`CREATE INDEX "IDX_157bf74171817dc5c60ee37036" ON "ousd_convex_strategy" ("block_number") `) + await db.query(`CREATE TABLE "ousd_aave_strategy" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "dai" numeric NOT NULL, "usdt" numeric NOT NULL, "usdc" numeric NOT NULL, CONSTRAINT "PK_b4b7ac6e395aa722df500f93623" PRIMARY KEY ("id"))`) + await db.query(`CREATE INDEX "IDX_ca34b5a0a33bc9abdd8213c2fa" ON "ousd_aave_strategy" ("timestamp") `) + await db.query(`CREATE INDEX "IDX_dacd7c98223d7bc8be074d71e4" ON "ousd_aave_strategy" ("block_number") `) + await db.query(`CREATE TABLE "ousd_meta_strategy" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "dai" numeric NOT NULL, "usdt" numeric NOT NULL, "usdc" numeric NOT NULL, CONSTRAINT "PK_d99170af73d86fe74460bbfacc4" PRIMARY KEY ("id"))`) + await db.query(`CREATE INDEX "IDX_7e998dcf775263bc5df76ef987" ON "ousd_meta_strategy" ("timestamp") `) + await db.query(`CREATE INDEX "IDX_55ce185680512d6a5b9fb0af89" ON "ousd_meta_strategy" ("block_number") `) + await db.query(`CREATE TABLE "ousd_convex_lusd_plus3_crv" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "dai" numeric NOT NULL, "usdt" numeric NOT NULL, "usdc" numeric NOT NULL, CONSTRAINT "PK_47290aa5dfa3cc5595f468e2f39" PRIMARY KEY ("id"))`) + await db.query(`CREATE INDEX "IDX_0783af95efb35fb3f13cde1656" ON "ousd_convex_lusd_plus3_crv" ("timestamp") `) + await db.query(`CREATE INDEX "IDX_74ae01fb596a4f2733087ba454" ON "ousd_convex_lusd_plus3_crv" ("block_number") `) + await db.query(`ALTER TABLE "oeth_history" ADD CONSTRAINT "FK_94e47c4c49128c78f60b185b46b" FOREIGN KEY ("address_id") REFERENCES "oeth_address"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`) + await db.query(`ALTER TABLE "oeth_rebase" ADD CONSTRAINT "FK_3331819842173de7c27c046547a" FOREIGN KEY ("apy_id") REFERENCES "oethapy"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`) + await db.query(`ALTER TABLE "oeth_rebase_option" ADD CONSTRAINT "FK_034428879698039839b4ba6ffe8" FOREIGN KEY ("address_id") REFERENCES "oeth_address"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`) + await db.query(`ALTER TABLE "oeth_strategy_holding_daily_stat" ADD CONSTRAINT "FK_4e867f220975e615e6077d860c1" FOREIGN KEY ("strategy_daily_stat_id_id") REFERENCES "oeth_strategy_daily_stat"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`) + await db.query(`ALTER TABLE "oeth_strategy_daily_stat" ADD CONSTRAINT "FK_6c7096c96a000d8471256ca8fc3" FOREIGN KEY ("daily_stat_id_id") REFERENCES "oeth_daily_stat"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`) + await db.query(`ALTER TABLE "oeth_collateral_daily_stat" ADD CONSTRAINT "FK_a90045de50406be7bd56efd3ea4" FOREIGN KEY ("daily_stat_id_id") REFERENCES "oeth_daily_stat"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`) + await db.query(`ALTER TABLE "ousd_history" ADD CONSTRAINT "FK_70291ea600c0c4d67d9bfe6a6bf" FOREIGN KEY ("address_id") REFERENCES "ousd_address"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`) + await db.query(`ALTER TABLE "ousd_rebase" ADD CONSTRAINT "FK_427468c97f9838b804efd6c8e55" FOREIGN KEY ("apy_id") REFERENCES "ousdapy"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`) + await db.query(`ALTER TABLE "ousd_rebase_option" ADD CONSTRAINT "FK_b04173f9349ddd991a3b60e914a" FOREIGN KEY ("address_id") REFERENCES "ousd_address"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`) + } + + async down(db) { + await db.query(`DROP TABLE "exchange_rate"`) + await db.query(`DROP INDEX "public"."IDX_9e23a3f1bf3634820c873a0fe8"`) + await db.query(`DROP INDEX "public"."IDX_c61a93768eed9e58ce399bbe01"`) + await db.query(`DROP TABLE "balance"`) + await db.query(`DROP INDEX "public"."IDX_a956b410c329b8eca7898c3c51"`) + await db.query(`DROP INDEX "public"."IDX_6b451b59c9f6a6fdd685f530b2"`) + await db.query(`DROP TABLE "strategy_balance"`) + await db.query(`DROP INDEX "public"."IDX_0113bf0b63183bea0d22cd0d08"`) + await db.query(`DROP INDEX "public"."IDX_a88065dcd92011698bbe7df7b1"`) + await db.query(`DROP TABLE "strategy_yield"`) + await db.query(`DROP INDEX "public"."IDX_5108f2a2563d5665892d0c06b0"`) + await db.query(`DROP INDEX "public"."IDX_41c3567c9d43c598e07a0029c5"`) + await db.query(`DROP TABLE "curve_pool_balance"`) + await db.query(`DROP INDEX "public"."IDX_ffb0d0f86f03faacef7cb3e092"`) + await db.query(`DROP INDEX "public"."IDX_db5522c865eb8ed76fa7aeb4a8"`) + await db.query(`DROP TABLE "oeth"`) + await db.query(`DROP INDEX "public"."IDX_5b81a67229bac2d68e0dc92cc4"`) + await db.query(`DROP INDEX "public"."IDX_408e5f79f83093aa5cf2b0ea32"`) + await db.query(`DROP TABLE "oeth_history"`) + await db.query(`DROP INDEX "public"."IDX_94e47c4c49128c78f60b185b46"`) + await db.query(`DROP INDEX "public"."IDX_96956b1c8d29eb7066a97d5ea7"`) + await db.query(`DROP INDEX "public"."IDX_b14170bdb7fbc0775bf55df15d"`) + await db.query(`DROP TABLE "oeth_address"`) + await db.query(`DROP TABLE "oethapy"`) + await db.query(`DROP INDEX "public"."IDX_b1a448045d1ed9d655b679a371"`) + await db.query(`DROP INDEX "public"."IDX_6b8a7a706a0701e659a7d81508"`) + await db.query(`DROP INDEX "public"."IDX_c0c03168bb0139e3cffda4f00e"`) + await db.query(`DROP TABLE "oeth_rebase"`) + await db.query(`DROP INDEX "public"."IDX_fbb7b3f2fff9896eb683b86de7"`) + await db.query(`DROP INDEX "public"."IDX_d3255d02d9407bba89380d01fa"`) + await db.query(`DROP INDEX "public"."IDX_8b6bb0243472af88612fe6a01f"`) + await db.query(`DROP INDEX "public"."IDX_3331819842173de7c27c046547"`) + await db.query(`DROP TABLE "oeth_rebase_option"`) + await db.query(`DROP INDEX "public"."IDX_1fc6bbd88037bfbf4361776909"`) + await db.query(`DROP INDEX "public"."IDX_cbb7ceb49ef7c45432d0171296"`) + await db.query(`DROP INDEX "public"."IDX_355826dadaacc5ae2d63c82f28"`) + await db.query(`DROP INDEX "public"."IDX_034428879698039839b4ba6ffe"`) + await db.query(`DROP TABLE "oeth_vault"`) + await db.query(`DROP INDEX "public"."IDX_d6298a294864b4eaf793cf35a4"`) + await db.query(`DROP INDEX "public"."IDX_e20cb507a673817b2c68720415"`) + await db.query(`DROP TABLE "oeth_curve_lp"`) + await db.query(`DROP INDEX "public"."IDX_d9bbd20e888fa1b4b2c5d2f039"`) + await db.query(`DROP INDEX "public"."IDX_7617d593c36dce1b1565a8d74a"`) + await db.query(`DROP TABLE "oeth_frax_staking"`) + await db.query(`DROP INDEX "public"."IDX_ce6c2c65e90967dfeaac97025b"`) + await db.query(`DROP INDEX "public"."IDX_1a7f7d650390e2f9c212651e05"`) + await db.query(`DROP TABLE "oeth_morpho_aave"`) + await db.query(`DROP INDEX "public"."IDX_25e239b985844f1d33fac79981"`) + await db.query(`DROP INDEX "public"."IDX_a6662224e95eb6921bb14cb5f9"`) + await db.query(`DROP TABLE "oeth_dripper"`) + await db.query(`DROP INDEX "public"."IDX_16ac742ceeb05d28e530da9649"`) + await db.query(`DROP INDEX "public"."IDX_d356832c14603916a492608e7b"`) + await db.query(`DROP TABLE "oeth_balancer_meta_pool_strategy"`) + await db.query(`DROP INDEX "public"."IDX_5e7ef383756fa18cb602f50089"`) + await db.query(`DROP INDEX "public"."IDX_11d344b3e0e03cdb6697dd61f7"`) + await db.query(`DROP TABLE "oeth_strategy_holding_daily_stat"`) + await db.query(`DROP INDEX "public"."IDX_4e867f220975e615e6077d860c"`) + await db.query(`DROP TABLE "oeth_strategy_daily_stat"`) + await db.query(`DROP INDEX "public"."IDX_6c7096c96a000d8471256ca8fc"`) + await db.query(`DROP TABLE "oeth_collateral_daily_stat"`) + await db.query(`DROP INDEX "public"."IDX_a90045de50406be7bd56efd3ea"`) + await db.query(`DROP TABLE "oeth_daily_stat"`) + await db.query(`DROP INDEX "public"."IDX_98d9001013aa37425ca47b7126"`) + await db.query(`DROP INDEX "public"."IDX_c3e66051c7df4efd6a8fa8f9c1"`) + await db.query(`DROP TABLE "oeth_reward_token_collected"`) + await db.query(`DROP INDEX "public"."IDX_81a9fa43ae4a6ae63e4103127b"`) + await db.query(`DROP INDEX "public"."IDX_d36c78b9c3e9d737f067638bc4"`) + await db.query(`DROP TABLE "ogv"`) + await db.query(`DROP INDEX "public"."IDX_2418a8b8b92b2f5977be761cf9"`) + await db.query(`DROP INDEX "public"."IDX_b8f20bcf48e4aa77e0f48d77db"`) + await db.query(`DROP TABLE "staked_ogv"`) + await db.query(`DROP INDEX "public"."IDX_533195c60cfaef9e118789dee9"`) + await db.query(`DROP INDEX "public"."IDX_d601233411a33212b9d616aab0"`) + await db.query(`DROP TABLE "ogv_governance"`) + await db.query(`DROP INDEX "public"."IDX_a0329e7109d5959b9aa3d9d374"`) + await db.query(`DROP INDEX "public"."IDX_63cd1ca46771965c68f6b85898"`) + await db.query(`DROP TABLE "ousd"`) + await db.query(`DROP INDEX "public"."IDX_c8d1e285213b445b088805ac7c"`) + await db.query(`DROP INDEX "public"."IDX_806949dd853b7e8acab5d03b81"`) + await db.query(`DROP TABLE "ousd_history"`) + await db.query(`DROP INDEX "public"."IDX_70291ea600c0c4d67d9bfe6a6b"`) + await db.query(`DROP INDEX "public"."IDX_4d00d283e1ce3209dc43a0313c"`) + await db.query(`DROP INDEX "public"."IDX_0c25caa59aa053a688a723d160"`) + await db.query(`DROP TABLE "ousd_address"`) + await db.query(`DROP TABLE "ousdapy"`) + await db.query(`DROP INDEX "public"."IDX_c514963f42908ce84d65a84a77"`) + await db.query(`DROP INDEX "public"."IDX_4f606414b3b5ce1a366bd0fbf6"`) + await db.query(`DROP INDEX "public"."IDX_0e84a81a109b66fe6f01f77c74"`) + await db.query(`DROP TABLE "ousd_rebase"`) + await db.query(`DROP INDEX "public"."IDX_f8eb4a16ce58a146b3227ee21a"`) + await db.query(`DROP INDEX "public"."IDX_3fb03b1a410e64c7367226d0b6"`) + await db.query(`DROP INDEX "public"."IDX_1a76c478199672aaeec340f619"`) + await db.query(`DROP INDEX "public"."IDX_427468c97f9838b804efd6c8e5"`) + await db.query(`DROP TABLE "ousd_rebase_option"`) + await db.query(`DROP INDEX "public"."IDX_64bd23947dc4c67e3b6a3f9352"`) + await db.query(`DROP INDEX "public"."IDX_9b774e46b8b1cf7f828133809a"`) + await db.query(`DROP INDEX "public"."IDX_4e95bf069de04533d83a9a97fd"`) + await db.query(`DROP INDEX "public"."IDX_b04173f9349ddd991a3b60e914"`) + await db.query(`DROP TABLE "ousd_vault"`) + await db.query(`DROP INDEX "public"."IDX_6860186ea2f56e2c7d54c22107"`) + await db.query(`DROP INDEX "public"."IDX_0d0a7113a505cf7f7adea9ca81"`) + await db.query(`DROP TABLE "ousd_morpho_aave"`) + await db.query(`DROP INDEX "public"."IDX_78e0701c2e9a28242db37bd8f8"`) + await db.query(`DROP INDEX "public"."IDX_46ccf673b376d654052fbd53e6"`) + await db.query(`DROP TABLE "ousd_morpho_compound"`) + await db.query(`DROP INDEX "public"."IDX_9e7bd0d8ae23b877d5979ef80c"`) + await db.query(`DROP INDEX "public"."IDX_0bb3a0ad84071f1d80f6d4e90f"`) + await db.query(`DROP TABLE "maker_dsr_strategy"`) + await db.query(`DROP INDEX "public"."IDX_a35308a3c5dbaab2d321eb1525"`) + await db.query(`DROP INDEX "public"."IDX_844b219d8faf9b1d24ab2dba9a"`) + await db.query(`DROP TABLE "ousd_flux_strategy"`) + await db.query(`DROP INDEX "public"."IDX_5b165b5d30b13e363d33a66e14"`) + await db.query(`DROP INDEX "public"."IDX_80f3392968fde7b99cccb805ac"`) + await db.query(`DROP TABLE "ousd_compound_strategy"`) + await db.query(`DROP INDEX "public"."IDX_6920b1db5dc577295ac4d1379d"`) + await db.query(`DROP INDEX "public"."IDX_89c6d7d3104bd36dc88a37add4"`) + await db.query(`DROP TABLE "ousd_convex_strategy"`) + await db.query(`DROP INDEX "public"."IDX_2deac473cd0b2dd7082e7da148"`) + await db.query(`DROP INDEX "public"."IDX_157bf74171817dc5c60ee37036"`) + await db.query(`DROP TABLE "ousd_aave_strategy"`) + await db.query(`DROP INDEX "public"."IDX_ca34b5a0a33bc9abdd8213c2fa"`) + await db.query(`DROP INDEX "public"."IDX_dacd7c98223d7bc8be074d71e4"`) + await db.query(`DROP TABLE "ousd_meta_strategy"`) + await db.query(`DROP INDEX "public"."IDX_7e998dcf775263bc5df76ef987"`) + await db.query(`DROP INDEX "public"."IDX_55ce185680512d6a5b9fb0af89"`) + await db.query(`DROP TABLE "ousd_convex_lusd_plus3_crv"`) + await db.query(`DROP INDEX "public"."IDX_0783af95efb35fb3f13cde1656"`) + await db.query(`DROP INDEX "public"."IDX_74ae01fb596a4f2733087ba454"`) + await db.query(`ALTER TABLE "oeth_history" DROP CONSTRAINT "FK_94e47c4c49128c78f60b185b46b"`) + await db.query(`ALTER TABLE "oeth_rebase" DROP CONSTRAINT "FK_3331819842173de7c27c046547a"`) + await db.query(`ALTER TABLE "oeth_rebase_option" DROP CONSTRAINT "FK_034428879698039839b4ba6ffe8"`) + await db.query(`ALTER TABLE "oeth_strategy_holding_daily_stat" DROP CONSTRAINT "FK_4e867f220975e615e6077d860c1"`) + await db.query(`ALTER TABLE "oeth_strategy_daily_stat" DROP CONSTRAINT "FK_6c7096c96a000d8471256ca8fc3"`) + await db.query(`ALTER TABLE "oeth_collateral_daily_stat" DROP CONSTRAINT "FK_a90045de50406be7bd56efd3ea4"`) + await db.query(`ALTER TABLE "ousd_history" DROP CONSTRAINT "FK_70291ea600c0c4d67d9bfe6a6bf"`) + await db.query(`ALTER TABLE "ousd_rebase" DROP CONSTRAINT "FK_427468c97f9838b804efd6c8e55"`) + await db.query(`ALTER TABLE "ousd_rebase_option" DROP CONSTRAINT "FK_b04173f9349ddd991a3b60e914a"`) + } +} diff --git a/src/oeth/processors/balancer-meta-pool.ts b/src/oeth/processors/balancer-meta-pool.ts index 20e8ed7f..a7f1763a 100644 --- a/src/oeth/processors/balancer-meta-pool.ts +++ b/src/oeth/processors/balancer-meta-pool.ts @@ -120,14 +120,16 @@ export const updateValues = async ( result.strategies, timestampId, ), - getBalancerStrategyHoldings(ctx, block, strategyData).then((holdings) => { - return { - rETH: holdings.find((h) => h.asset.toLowerCase() === RETH_ADDRESS)! - .balance, - weth: holdings.find((h) => h.asset.toLowerCase() === WETH_ADDRESS)! - .balance, - } - }), + getBalancerStrategyHoldings(ctx, block.header, strategyData).then( + (holdings) => { + return { + rETH: holdings.find((h) => h.asset.toLowerCase() === RETH_ADDRESS)! + .balance, + weth: holdings.find((h) => h.asset.toLowerCase() === WETH_ADDRESS)! + .balance, + } + }, + ), ]) if (!current) { diff --git a/src/oeth/processors/strategies/strategies.ts b/src/oeth/processors/strategies/strategies.ts index 363cceb5..61b5c26c 100644 --- a/src/oeth/processors/strategies/strategies.ts +++ b/src/oeth/processors/strategies/strategies.ts @@ -22,6 +22,7 @@ export const oethStrategies: readonly IStrategyData[] = [ { from: 17249899, name: 'OETH Convex ETH+OETH (AMO)', + contractName: 'ConvexEthMetaStrategy', address: '0x1827f9ea98e0bf96550b2fc20f7233277fcd7e63', kind: 'CurveAMO', curvePoolInfo: { @@ -29,31 +30,34 @@ export const oethStrategies: readonly IStrategyData[] = [ rewardsPoolAddress: '0x24b65dc1cf053a8d96872c323d29e86ec43eb33a', }, assets: [WETH_ADDRESS, OETH_ADDRESS], - earnings: { rewardTokenCollected: true }, + earnings: { rewardTokenCollected: true, passiveByDepositWithdrawal: true }, }, { from: 17067232, name: 'OETH Frax Staking', + contractName: 'FraxETHStrategy', address: '0x3ff8654d633d4ea0fae24c52aec73b4a20d0d0e5', kind: 'Generic', assets: [FRXETH_ADDRESS], - earnings: { passiveByDepositWithdrawal: true }, + earnings: { passiveByDepositWithdrawal: true, rewardTokenCollected: true }, }, { from: 17367105, name: 'OETH Morpho Aave V2', + contractName: 'MorphoAaveStrategy', address: '0xc1fc9e5ec3058921ea5025d703cbe31764756319', kind: 'Generic', assets: [WETH_ADDRESS], - earnings: { passiveByDepositWithdrawal: true }, + earnings: { passiveByDepositWithdrawal: true, rewardTokenCollected: true }, }, { from: 18156225, name: 'OETH Aura rETH/WETH', + contractName: 'BalancerMetaPoolStrategy', address: '0x49109629ac1deb03f2e9b2fe2ac4a623e0e7dfdc', kind: 'BalancerMetaStablePool', assets: [WETH_ADDRESS, RETH_ADDRESS], - earnings: { passiveByDepositWithdrawal: true }, + earnings: { rewardTokenCollected: true }, balancerPoolInfo: { poolId: '0x1e19cf2d73a72ef1332c882f20534b6519be0276000200000000000000000112', diff --git a/src/shared/processor-templates/strategy/strategy-balancer.ts b/src/shared/processor-templates/strategy/strategy-balancer.ts index 13501fc8..3646dc71 100644 --- a/src/shared/processor-templates/strategy/strategy-balancer.ts +++ b/src/shared/processor-templates/strategy/strategy-balancer.ts @@ -4,20 +4,17 @@ import { memoize } from 'lodash' import * as balancerMetaStablePoolStrategyAbi from '../../../abi/balancer-meta-pool-strategy' import * as balancerRateProvider from '../../../abi/balancer-rate-provider' import * as balancerVaultAbi from '../../../abi/balancer-vault' -import * as abstractStrategyAbi from '../../../abi/initializable-abstract-strategy' import * as balancerMetaStablePoolAbi from '../../../abi/meta-stable-pool' import { StrategyBalance } from '../../../model' -import { Block, Context } from '../../../processor' +import { Context } from '../../../processor' import { ADDRESS_ZERO, BALANCER_VAULT, ETH_ADDRESS, - OETH_HARVESTER_ADDRESS, WETH_ADDRESS, } from '../../../utils/addresses' import { blockFrequencyTracker } from '../../../utils/blockFrequencyUpdater' import { IStrategyData } from './index' -import { getStrategyBalances } from './strategy-curve-amo' import { processStrategyEarnings, setupStrategyEarnings, @@ -38,19 +35,30 @@ export const process = async (ctx: Context, strategyData: IStrategyData) => { if (shouldUpdate(ctx, block)) { const results = await getBalancerStrategyHoldings( ctx, - block, + block.header, strategyData, + ).then((holdings) => + holdings.map(({ address, asset, balance }) => { + return new StrategyBalance({ + id: `${address}:${asset}:${block.header.height}`, + strategy: address, + asset, + balance, + blockNumber: block.header.height, + timestamp: new Date(block.header.timestamp), + }) + }), ) data.push(...results) } } await ctx.store.insert(data) - await processStrategyEarnings(ctx, strategyData, getStrategyBalances) + await processStrategyEarnings(ctx, strategyData, getBalancerStrategyHoldings) } export const getBalancerStrategyHoldings = async ( ctx: Context, - block: Block, + block: { height: number }, strategyData: IStrategyData, ) => { const { address, balancerPoolInfo } = strategyData @@ -64,12 +72,12 @@ export const getBalancerStrategyHoldings = async ( const strategy = new balancerMetaStablePoolStrategyAbi.Contract( ctx, - block.header, + block, address, ) const balancerVault = new balancerVaultAbi.Contract( ctx, - block.header, + block, BALANCER_VAULT, ) let [poolAssets, balances] = await balancerVault.getPoolTokens(poolId) @@ -87,12 +95,12 @@ export const getBalancerStrategyHoldings = async ( poolAssets[i] = WETH_ADDRESS } - if (ADDRESS_ZERO == rateProviders[i]) { + if (ADDRESS_ZERO === rateProviders[i]) { assetRates.push(eth1) } else { const provider = new balancerRateProvider.Contract( ctx, - block.header, + block, rateProviders[i], ) const rate = await provider.getRate() @@ -111,24 +119,13 @@ export const getBalancerStrategyHoldings = async ( assetRates[i] / BigInt(10000) - return new StrategyBalance({ - id: `${address}:${asset}:${block.header.height}`, - strategy: address, - asset, - balance, - blockNumber: block.header.height, - timestamp: new Date(block.header.timestamp), - }) + return { address, asset: asset.toLowerCase(), balance } }) } const _getBalancePoolRateProviders = memoize( - async (ctx: Context, block: Block, address: string) => { - const pool = new balancerMetaStablePoolAbi.Contract( - ctx, - block.header, - address, - ) + async (ctx: Context, block: { height: number }, address: string) => { + const pool = new balancerMetaStablePoolAbi.Contract(ctx, block, address) const rateProviders = await pool.getRateProviders() return rateProviders }, diff --git a/src/shared/processor-templates/strategy/strategy-curve-amo.ts b/src/shared/processor-templates/strategy/strategy-curve-amo.ts index f4a3aba9..88057512 100644 --- a/src/shared/processor-templates/strategy/strategy-curve-amo.ts +++ b/src/shared/processor-templates/strategy/strategy-curve-amo.ts @@ -104,13 +104,13 @@ export const getStrategyBalances = async ( poolAssets.push(coin) } - const eth1 = BigInt('1000000000000000000') + const eth1 = 1000000000000000000n const totalStrategyLPBalance = ((stakedLPBalance + unstakedBalance) * lpPrice) / eth1 return poolAssets.map((asset, i) => { - const poolAssetSplit = (BigInt(10000) * assetBalances[i]) / totalPoolValue - const balance = (totalStrategyLPBalance * poolAssetSplit) / BigInt(10000) - return { address, asset: coins[i], balance } + const poolAssetSplit = (eth1 * assetBalances[i]) / totalPoolValue + const balance = (totalStrategyLPBalance * poolAssetSplit) / eth1 + return { address, asset: coins[i].toLowerCase(), balance } }) } diff --git a/src/shared/processor-templates/strategy/strategy-earnings.ts b/src/shared/processor-templates/strategy/strategy-earnings.ts index 88232ae1..7c9dd56e 100644 --- a/src/shared/processor-templates/strategy/strategy-earnings.ts +++ b/src/shared/processor-templates/strategy/strategy-earnings.ts @@ -2,6 +2,7 @@ import { EvmBatchProcessor } from '@subsquid/evm-processor' import { LessThan } from 'typeorm' import { formatEther, pad } from 'viem' +import * as baseRewardPool from '../../../abi/base-reward-pool' import * as erc20 from '../../../abi/erc20' import * as abstractStrategyAbi from '../../../abi/initializable-abstract-strategy' import { StrategyYield } from '../../../model' @@ -30,6 +31,16 @@ export const setupStrategyEarnings = ( abstractStrategyAbi.events.Withdrawal.topic, ], }) + if (strategyData.kind === 'CurveAMO') { + processor.addLog({ + address: [strategyData.curvePoolInfo!.rewardsPoolAddress], + topic0: [ + baseRewardPool.events.Staked.topic, + baseRewardPool.events.Withdrawn.topic, + ], + topic1: [pad(strategyData.address as `0x${string}`)], + }) + } } if (strategyData.earnings.rewardTokenCollected) { processor.addLog({ @@ -68,6 +79,11 @@ export const processStrategyEarnings = async ( } const txIgnore = new Set() for (const log of block.logs) { + if ( + log.topics[0] === baseRewardPool.events.Staked.topic || + log.topics[0] === baseRewardPool.events.Withdrawn.topic + ) + ctx.log.info(log.topics) const balanceTrackingUpdate = async () => { const previousBalances = await getStrategyBalances( ctx, @@ -79,35 +95,68 @@ export const processStrategyEarnings = async ( block.header, strategyData, ) - await Promise.all( - strategyData.assets.map((asset) => { - return processDepositWithdrawal( - ctx, - strategyData, - block, - strategyYields, - asset, - previousBalances.find((b) => b.asset === asset)!.balance, - balances.find((b) => b.asset === asset)!.balance, - ) - }), - ) + if (strategyData.kind === 'CurveAMO') { + await processDepositWithdrawal( + ctx, + strategyData, + block, + strategyYields, + strategyData.curvePoolInfo!.poolAddress, + previousBalances.reduce((sum, b) => sum + b.balance, 0n), + balances.reduce((sum, b) => sum + b.balance, 0n), + ) + } else { + await Promise.all( + strategyData.assets.map((asset) => { + return processDepositWithdrawal( + ctx, + strategyData, + block, + strategyYields, + asset, + previousBalances.find((b) => b.asset === asset)!.balance, + balances.find((b) => b.asset === asset)!.balance, + ) + }), + ) + } } - const topic0 = log.topics[0] - if (log.address === strategyData.address) { + if ( + strategyData.kind === 'CurveAMO' && + log.address === strategyData.curvePoolInfo!.rewardsPoolAddress && + log.topics[0] === baseRewardPool.events.Staked.topic && + log.topics[1] === pad(strategyData.address as `0x${string}`) + ) { + ctx.log.info({ + type: 'Staked', + transactionHash: log.transactionHash, + }) + await balanceTrackingUpdate() + } else if ( + strategyData.kind === 'CurveAMO' && + log.address === strategyData.curvePoolInfo!.rewardsPoolAddress && + log.topics[0] === baseRewardPool.events.Withdrawn.topic && + log.topics[1] === pad(strategyData.address as `0x${string}`) + ) { ctx.log.info({ - block: block.header.height, - tx: log.transactionHash, - topic0, + type: 'Withdrawn', + transactionHash: log.transactionHash, }) + await balanceTrackingUpdate() + } else if (log.address === strategyData.address) { + // ctx.log.info({ + // block: block.header.height, + // tx: log.transactionHash, + // log.topics[0], + // }) // TODO: TRACK CURVE AMO VIRTUAL PRICE INCREASES if ( strategyData.earnings.passiveByDepositWithdrawal && - depositWithdrawalTopics.has(topic0) + depositWithdrawalTopics.has(log.topics[0]) ) { ctx.log.info({ type: - topic0 === abstractStrategyAbi.events.Deposit.topic + log.topics[0] === abstractStrategyAbi.events.Deposit.topic ? 'Deposit' : 'Withdrawal', transactionHash: log.transactionHash, @@ -115,7 +164,8 @@ export const processStrategyEarnings = async ( await balanceTrackingUpdate() } else if ( strategyData.earnings.rewardTokenCollected && - topic0 === abstractStrategyAbi.events.RewardTokenCollected.topic && + log.topics[0] === + abstractStrategyAbi.events.RewardTokenCollected.topic && !txIgnore.has(log.transactionHash) ) { txIgnore.add(log.transactionHash) diff --git a/src/shared/processor-templates/strategy/strategy.ts b/src/shared/processor-templates/strategy/strategy.ts index e0f3a0e8..6bfad8fa 100644 --- a/src/shared/processor-templates/strategy/strategy.ts +++ b/src/shared/processor-templates/strategy/strategy.ts @@ -18,6 +18,7 @@ export type ICurveAMOInfo = { export type IStrategyData = { from: number name: string + contractName: string address: string kind: | 'Generic' From a6bcbc5ca3e1e53db6efbec2ea5749f5da96b022 Mon Sep 17 00:00:00 2001 From: Chris Jacobs Date: Wed, 1 Nov 2023 11:55:28 -0700 Subject: [PATCH 06/34] regen migrations --- db/migrations/1698697198846-Data.js | 575 ---------------------------- db/migrations/1698864698478-Data.js | 283 ++++++++++++++ 2 files changed, 283 insertions(+), 575 deletions(-) delete mode 100644 db/migrations/1698697198846-Data.js create mode 100644 db/migrations/1698864698478-Data.js diff --git a/db/migrations/1698697198846-Data.js b/db/migrations/1698697198846-Data.js deleted file mode 100644 index 443b565e..00000000 --- a/db/migrations/1698697198846-Data.js +++ /dev/null @@ -1,575 +0,0 @@ -module.exports = class Data1698697198846 { - name = 'Data1698697198846' - - async up(db) { - await db.query( - `CREATE TABLE "exchange_rate" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "pair" text NOT NULL, "base" text NOT NULL, "quote" text NOT NULL, "rate" numeric NOT NULL, CONSTRAINT "PK_5c5d27d2b900ef6cdeef0398472" PRIMARY KEY ("id"))`, - ) - await db.query( - `CREATE INDEX "IDX_9e23a3f1bf3634820c873a0fe8" ON "exchange_rate" ("timestamp") `, - ) - await db.query( - `CREATE INDEX "IDX_c61a93768eed9e58ce399bbe01" ON "exchange_rate" ("block_number") `, - ) - await db.query( - `CREATE TABLE "balance" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "token" text NOT NULL, "address" text NOT NULL, "balance" numeric NOT NULL, CONSTRAINT "PK_079dddd31a81672e8143a649ca0" PRIMARY KEY ("id"))`, - ) - await db.query( - `CREATE INDEX "IDX_a956b410c329b8eca7898c3c51" ON "balance" ("timestamp") `, - ) - await db.query( - `CREATE INDEX "IDX_6b451b59c9f6a6fdd685f530b2" ON "balance" ("block_number") `, - ) - await db.query( - `CREATE TABLE "strategy_balance" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "strategy" text NOT NULL, "asset" text NOT NULL, "balance" numeric NOT NULL, CONSTRAINT "PK_ca6f93229d1392e9546d01dae4f" PRIMARY KEY ("id"))`, - ) - await db.query( - `CREATE INDEX "IDX_0113bf0b63183bea0d22cd0d08" ON "strategy_balance" ("timestamp") `, - ) - await db.query( - `CREATE INDEX "IDX_a88065dcd92011698bbe7df7b1" ON "strategy_balance" ("block_number") `, - ) - await db.query( - `CREATE TABLE "strategy_yield" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "strategy" text NOT NULL, "asset" text NOT NULL, "balance" numeric NOT NULL, "earnings" numeric NOT NULL, CONSTRAINT "PK_e87c46575e870fe2202190c2728" PRIMARY KEY ("id"))`, - ) - await db.query( - `CREATE INDEX "IDX_5108f2a2563d5665892d0c06b0" ON "strategy_yield" ("timestamp") `, - ) - await db.query( - `CREATE INDEX "IDX_41c3567c9d43c598e07a0029c5" ON "strategy_yield" ("block_number") `, - ) - await db.query( - `CREATE TABLE "curve_pool_balance" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "address" text NOT NULL, "balance0" numeric NOT NULL, "balance1" numeric NOT NULL, "balance2" numeric NOT NULL, CONSTRAINT "PK_40412750bb910ca560aa084dd88" PRIMARY KEY ("id"))`, - ) - await db.query( - `CREATE INDEX "IDX_ffb0d0f86f03faacef7cb3e092" ON "curve_pool_balance" ("timestamp") `, - ) - await db.query( - `CREATE INDEX "IDX_db5522c865eb8ed76fa7aeb4a8" ON "curve_pool_balance" ("block_number") `, - ) - await db.query( - `CREATE TABLE "oeth" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "total_supply" numeric NOT NULL, "rebasing_supply" numeric NOT NULL, "non_rebasing_supply" numeric NOT NULL, CONSTRAINT "PK_de1d885501070dbd1ab6f8577ba" PRIMARY KEY ("id"))`, - ) - await db.query( - `CREATE INDEX "IDX_5b81a67229bac2d68e0dc92cc4" ON "oeth" ("timestamp") `, - ) - await db.query( - `CREATE INDEX "IDX_408e5f79f83093aa5cf2b0ea32" ON "oeth" ("block_number") `, - ) - await db.query( - `CREATE TABLE "oeth_history" ("id" character varying NOT NULL, "value" numeric NOT NULL, "balance" numeric NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "tx_hash" text NOT NULL, "type" character varying(8) NOT NULL, "address_id" character varying, CONSTRAINT "PK_2c7e7571cd9ea02b07a27a303f3" PRIMARY KEY ("id"))`, - ) - await db.query( - `CREATE INDEX "IDX_94e47c4c49128c78f60b185b46" ON "oeth_history" ("address_id") `, - ) - await db.query( - `CREATE INDEX "IDX_96956b1c8d29eb7066a97d5ea7" ON "oeth_history" ("block_number") `, - ) - await db.query( - `CREATE INDEX "IDX_b14170bdb7fbc0775bf55df15d" ON "oeth_history" ("tx_hash") `, - ) - await db.query( - `CREATE TABLE "oeth_address" ("id" character varying NOT NULL, "is_contract" boolean NOT NULL, "rebasing_option" character varying(6) NOT NULL, "balance" numeric NOT NULL, "earned" numeric NOT NULL, "credits" numeric NOT NULL, "last_updated" TIMESTAMP WITH TIME ZONE NOT NULL, CONSTRAINT "PK_92a966afe47d584af73ce77a1cd" PRIMARY KEY ("id"))`, - ) - await db.query( - `CREATE TABLE "oethapy" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "tx_hash" text NOT NULL, "apr" numeric NOT NULL, "apy" numeric NOT NULL, "apy7_day_avg" numeric NOT NULL, "apy14_day_avg" numeric NOT NULL, "apy30_day_avg" numeric NOT NULL, "rebasing_credits_per_token" numeric NOT NULL, CONSTRAINT "PK_8dbb4d04591848361200f18f62a" PRIMARY KEY ("id"))`, - ) - await db.query( - `CREATE INDEX "IDX_b1a448045d1ed9d655b679a371" ON "oethapy" ("timestamp") `, - ) - await db.query( - `CREATE INDEX "IDX_6b8a7a706a0701e659a7d81508" ON "oethapy" ("block_number") `, - ) - await db.query( - `CREATE INDEX "IDX_c0c03168bb0139e3cffda4f00e" ON "oethapy" ("tx_hash") `, - ) - await db.query( - `CREATE TABLE "oeth_rebase" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "tx_hash" text NOT NULL, "total_supply" numeric NOT NULL, "rebasing_credits" numeric NOT NULL, "rebasing_credits_per_token" numeric NOT NULL, "fee" numeric NOT NULL, "yield" numeric NOT NULL, "apy_id" character varying, CONSTRAINT "PK_5f8f4dd071caf685b4ac2d54de3" PRIMARY KEY ("id"))`, - ) - await db.query( - `CREATE INDEX "IDX_fbb7b3f2fff9896eb683b86de7" ON "oeth_rebase" ("timestamp") `, - ) - await db.query( - `CREATE INDEX "IDX_d3255d02d9407bba89380d01fa" ON "oeth_rebase" ("block_number") `, - ) - await db.query( - `CREATE INDEX "IDX_8b6bb0243472af88612fe6a01f" ON "oeth_rebase" ("tx_hash") `, - ) - await db.query( - `CREATE INDEX "IDX_3331819842173de7c27c046547" ON "oeth_rebase" ("apy_id") `, - ) - await db.query( - `CREATE TABLE "oeth_rebase_option" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "tx_hash" text NOT NULL, "status" character varying(6) NOT NULL, "address_id" character varying, CONSTRAINT "PK_32971725d5523200b4b3b7c07e5" PRIMARY KEY ("id"))`, - ) - await db.query( - `CREATE INDEX "IDX_1fc6bbd88037bfbf4361776909" ON "oeth_rebase_option" ("timestamp") `, - ) - await db.query( - `CREATE INDEX "IDX_cbb7ceb49ef7c45432d0171296" ON "oeth_rebase_option" ("block_number") `, - ) - await db.query( - `CREATE INDEX "IDX_355826dadaacc5ae2d63c82f28" ON "oeth_rebase_option" ("tx_hash") `, - ) - await db.query( - `CREATE INDEX "IDX_034428879698039839b4ba6ffe" ON "oeth_rebase_option" ("address_id") `, - ) - await db.query( - `CREATE TABLE "oeth_vault" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "weth" numeric NOT NULL, "st_eth" numeric NOT NULL, "r_eth" numeric NOT NULL, "frx_eth" numeric NOT NULL, CONSTRAINT "PK_9debaa84944fe2be9dc4219ba8f" PRIMARY KEY ("id"))`, - ) - await db.query( - `CREATE INDEX "IDX_d6298a294864b4eaf793cf35a4" ON "oeth_vault" ("timestamp") `, - ) - await db.query( - `CREATE INDEX "IDX_e20cb507a673817b2c68720415" ON "oeth_vault" ("block_number") `, - ) - await db.query( - `CREATE TABLE "oeth_curve_lp" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "total_supply" numeric NOT NULL, "eth" numeric NOT NULL, "oeth" numeric NOT NULL, "total_supply_owned" numeric NOT NULL, "eth_owned" numeric NOT NULL, "oeth_owned" numeric NOT NULL, CONSTRAINT "PK_2b055044664e80f44d6172fdf54" PRIMARY KEY ("id"))`, - ) - await db.query( - `CREATE INDEX "IDX_d9bbd20e888fa1b4b2c5d2f039" ON "oeth_curve_lp" ("timestamp") `, - ) - await db.query( - `CREATE INDEX "IDX_7617d593c36dce1b1565a8d74a" ON "oeth_curve_lp" ("block_number") `, - ) - await db.query( - `CREATE TABLE "oeth_frax_staking" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "sfrx_eth" numeric NOT NULL, CONSTRAINT "PK_694f53c8600ae88c7bdcf7305dd" PRIMARY KEY ("id"))`, - ) - await db.query( - `CREATE INDEX "IDX_ce6c2c65e90967dfeaac97025b" ON "oeth_frax_staking" ("timestamp") `, - ) - await db.query( - `CREATE INDEX "IDX_1a7f7d650390e2f9c212651e05" ON "oeth_frax_staking" ("block_number") `, - ) - await db.query( - `CREATE TABLE "oeth_morpho_aave" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "weth" numeric NOT NULL, CONSTRAINT "PK_86de8f846e9335c92b8ad7df3a1" PRIMARY KEY ("id"))`, - ) - await db.query( - `CREATE INDEX "IDX_25e239b985844f1d33fac79981" ON "oeth_morpho_aave" ("timestamp") `, - ) - await db.query( - `CREATE INDEX "IDX_a6662224e95eb6921bb14cb5f9" ON "oeth_morpho_aave" ("block_number") `, - ) - await db.query( - `CREATE TABLE "oeth_dripper" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "weth" numeric NOT NULL, "last_collect_timestamp" integer NOT NULL, "drip_rate_per_block" numeric NOT NULL, "drip_duration" numeric NOT NULL, CONSTRAINT "PK_77731281c1564c24eff0c265984" PRIMARY KEY ("id"))`, - ) - await db.query( - `CREATE INDEX "IDX_16ac742ceeb05d28e530da9649" ON "oeth_dripper" ("timestamp") `, - ) - await db.query( - `CREATE INDEX "IDX_d356832c14603916a492608e7b" ON "oeth_dripper" ("block_number") `, - ) - await db.query( - `CREATE TABLE "oeth_balancer_meta_pool_strategy" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "r_eth" numeric NOT NULL, "weth" numeric NOT NULL, CONSTRAINT "PK_6ddf5b8ba878e6d706e59bd6de0" PRIMARY KEY ("id"))`, - ) - await db.query( - `CREATE INDEX "IDX_5e7ef383756fa18cb602f50089" ON "oeth_balancer_meta_pool_strategy" ("timestamp") `, - ) - await db.query( - `CREATE INDEX "IDX_11d344b3e0e03cdb6697dd61f7" ON "oeth_balancer_meta_pool_strategy" ("block_number") `, - ) - await db.query( - `CREATE TABLE "oeth_strategy_holding_daily_stat" ("id" character varying NOT NULL, "symbol" text NOT NULL, "amount" numeric NOT NULL, "value" numeric NOT NULL, "strategy_daily_stat_id_id" character varying, CONSTRAINT "PK_7f1a62da5e53cf264c2f39b4acf" PRIMARY KEY ("id"))`, - ) - await db.query( - `CREATE INDEX "IDX_4e867f220975e615e6077d860c" ON "oeth_strategy_holding_daily_stat" ("strategy_daily_stat_id_id") `, - ) - await db.query( - `CREATE TABLE "oeth_strategy_daily_stat" ("id" character varying NOT NULL, "name" text NOT NULL, "total" numeric NOT NULL, "tvl" numeric NOT NULL, "daily_stat_id_id" character varying, CONSTRAINT "PK_8af1a0c60e67b05baf928787a8e" PRIMARY KEY ("id"))`, - ) - await db.query( - `CREATE INDEX "IDX_6c7096c96a000d8471256ca8fc" ON "oeth_strategy_daily_stat" ("daily_stat_id_id") `, - ) - await db.query( - `CREATE TABLE "oeth_collateral_daily_stat" ("id" character varying NOT NULL, "symbol" text NOT NULL, "amount" numeric NOT NULL, "price" numeric NOT NULL, "value" numeric NOT NULL, "daily_stat_id_id" character varying, CONSTRAINT "PK_5fb23d7bae30dffe4543e7aa069" PRIMARY KEY ("id"))`, - ) - await db.query( - `CREATE INDEX "IDX_a90045de50406be7bd56efd3ea" ON "oeth_collateral_daily_stat" ("daily_stat_id_id") `, - ) - await db.query( - `CREATE TABLE "oeth_daily_stat" ("id" character varying NOT NULL, "block_number" integer NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "apr" numeric NOT NULL, "apy" numeric NOT NULL, "apy7_day_avg" numeric NOT NULL, "apy14_day_avg" numeric NOT NULL, "apy30_day_avg" numeric NOT NULL, "total_supply" numeric NOT NULL, "total_supply_usd" numeric NOT NULL, "rebasing_supply" numeric NOT NULL, "non_rebasing_supply" numeric NOT NULL, "amo_supply" numeric NOT NULL, "dripper_weth" numeric NOT NULL, "yield" numeric NOT NULL, "fees" numeric NOT NULL, "revenue" numeric NOT NULL, "revenue7_day_avg" numeric NOT NULL, "revenue7_day_total" numeric NOT NULL, "revenue_all_time" numeric NOT NULL, "peg_price" numeric NOT NULL, CONSTRAINT "PK_9144a02ab13b1baa818a7d5eae5" PRIMARY KEY ("id"))`, - ) - await db.query( - `CREATE INDEX "IDX_98d9001013aa37425ca47b7126" ON "oeth_daily_stat" ("block_number") `, - ) - await db.query( - `CREATE INDEX "IDX_c3e66051c7df4efd6a8fa8f9c1" ON "oeth_daily_stat" ("timestamp") `, - ) - await db.query( - `CREATE TABLE "oeth_reward_token_collected" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "strategy" text NOT NULL, "recipient" text NOT NULL, "reward_token" text NOT NULL, "amount" numeric NOT NULL, CONSTRAINT "PK_47098cc5fbc7cb95c2374fa33cd" PRIMARY KEY ("id"))`, - ) - await db.query( - `CREATE INDEX "IDX_81a9fa43ae4a6ae63e4103127b" ON "oeth_reward_token_collected" ("timestamp") `, - ) - await db.query( - `CREATE INDEX "IDX_d36c78b9c3e9d737f067638bc4" ON "oeth_reward_token_collected" ("block_number") `, - ) - await db.query( - `CREATE TABLE "ogv" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "circulating" numeric NOT NULL, "total" numeric NOT NULL, CONSTRAINT "PK_f16038abf451ce82bd03ea54ee7" PRIMARY KEY ("id"))`, - ) - await db.query( - `CREATE INDEX "IDX_2418a8b8b92b2f5977be761cf9" ON "ogv" ("timestamp") `, - ) - await db.query( - `CREATE INDEX "IDX_b8f20bcf48e4aa77e0f48d77db" ON "ogv" ("block_number") `, - ) - await db.query( - `CREATE TABLE "staked_ogv" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "total" numeric NOT NULL, "apy" numeric NOT NULL, CONSTRAINT "PK_b135611d9aab36c7889982c3be8" PRIMARY KEY ("id"))`, - ) - await db.query( - `CREATE INDEX "IDX_533195c60cfaef9e118789dee9" ON "staked_ogv" ("timestamp") `, - ) - await db.query( - `CREATE INDEX "IDX_d601233411a33212b9d616aab0" ON "staked_ogv" ("block_number") `, - ) - await db.query( - `CREATE TABLE "ogv_governance" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "registered_voters" integer NOT NULL, "open_source_contributors" integer NOT NULL, "improvement_proposals" integer NOT NULL, CONSTRAINT "PK_b22758cd4ee8ff92c1b7ee0cf20" PRIMARY KEY ("id"))`, - ) - await db.query( - `CREATE INDEX "IDX_a0329e7109d5959b9aa3d9d374" ON "ogv_governance" ("timestamp") `, - ) - await db.query( - `CREATE INDEX "IDX_63cd1ca46771965c68f6b85898" ON "ogv_governance" ("block_number") `, - ) - await db.query( - `CREATE TABLE "ousd" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "total_supply" numeric NOT NULL, "rebasing_supply" numeric NOT NULL, "non_rebasing_supply" numeric NOT NULL, CONSTRAINT "PK_acecae4a20bc14b22d9f6738d8d" PRIMARY KEY ("id"))`, - ) - await db.query( - `CREATE INDEX "IDX_c8d1e285213b445b088805ac7c" ON "ousd" ("timestamp") `, - ) - await db.query( - `CREATE INDEX "IDX_806949dd853b7e8acab5d03b81" ON "ousd" ("block_number") `, - ) - await db.query( - `CREATE TABLE "ousd_history" ("id" character varying NOT NULL, "value" numeric NOT NULL, "balance" numeric NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "tx_hash" text NOT NULL, "type" character varying(8) NOT NULL, "address_id" character varying, CONSTRAINT "PK_dcbe3223b67f92d9ad4cffe8a7c" PRIMARY KEY ("id"))`, - ) - await db.query( - `CREATE INDEX "IDX_70291ea600c0c4d67d9bfe6a6b" ON "ousd_history" ("address_id") `, - ) - await db.query( - `CREATE INDEX "IDX_4d00d283e1ce3209dc43a0313c" ON "ousd_history" ("block_number") `, - ) - await db.query( - `CREATE INDEX "IDX_0c25caa59aa053a688a723d160" ON "ousd_history" ("tx_hash") `, - ) - await db.query( - `CREATE TABLE "ousd_address" ("id" character varying NOT NULL, "is_contract" boolean NOT NULL, "rebasing_option" character varying(6) NOT NULL, "balance" numeric NOT NULL, "earned" numeric NOT NULL, "credits" numeric NOT NULL, "last_updated" TIMESTAMP WITH TIME ZONE NOT NULL, CONSTRAINT "PK_bb061344757ede566d62854af6a" PRIMARY KEY ("id"))`, - ) - await db.query( - `CREATE TABLE "ousdapy" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "tx_hash" text NOT NULL, "apr" numeric NOT NULL, "apy" numeric NOT NULL, "apy7_day_avg" numeric NOT NULL, "apy14_day_avg" numeric NOT NULL, "apy30_day_avg" numeric NOT NULL, "rebasing_credits_per_token" numeric NOT NULL, CONSTRAINT "PK_d9889b7153efc82dbe88f9a7a33" PRIMARY KEY ("id"))`, - ) - await db.query( - `CREATE INDEX "IDX_c514963f42908ce84d65a84a77" ON "ousdapy" ("timestamp") `, - ) - await db.query( - `CREATE INDEX "IDX_4f606414b3b5ce1a366bd0fbf6" ON "ousdapy" ("block_number") `, - ) - await db.query( - `CREATE INDEX "IDX_0e84a81a109b66fe6f01f77c74" ON "ousdapy" ("tx_hash") `, - ) - await db.query( - `CREATE TABLE "ousd_rebase" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "tx_hash" text NOT NULL, "total_supply" numeric NOT NULL, "rebasing_credits" numeric NOT NULL, "rebasing_credits_per_token" numeric NOT NULL, "fee" numeric NOT NULL, "yield" numeric NOT NULL, "apy_id" character varying, CONSTRAINT "PK_04cf0de72399a99798dde61b237" PRIMARY KEY ("id"))`, - ) - await db.query( - `CREATE INDEX "IDX_f8eb4a16ce58a146b3227ee21a" ON "ousd_rebase" ("timestamp") `, - ) - await db.query( - `CREATE INDEX "IDX_3fb03b1a410e64c7367226d0b6" ON "ousd_rebase" ("block_number") `, - ) - await db.query( - `CREATE INDEX "IDX_1a76c478199672aaeec340f619" ON "ousd_rebase" ("tx_hash") `, - ) - await db.query( - `CREATE INDEX "IDX_427468c97f9838b804efd6c8e5" ON "ousd_rebase" ("apy_id") `, - ) - await db.query( - `CREATE TABLE "ousd_rebase_option" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "tx_hash" text NOT NULL, "status" character varying(6) NOT NULL, "address_id" character varying, CONSTRAINT "PK_d684f90866027104f3c929dfe10" PRIMARY KEY ("id"))`, - ) - await db.query( - `CREATE INDEX "IDX_64bd23947dc4c67e3b6a3f9352" ON "ousd_rebase_option" ("timestamp") `, - ) - await db.query( - `CREATE INDEX "IDX_9b774e46b8b1cf7f828133809a" ON "ousd_rebase_option" ("block_number") `, - ) - await db.query( - `CREATE INDEX "IDX_4e95bf069de04533d83a9a97fd" ON "ousd_rebase_option" ("tx_hash") `, - ) - await db.query( - `CREATE INDEX "IDX_b04173f9349ddd991a3b60e914" ON "ousd_rebase_option" ("address_id") `, - ) - await db.query( - `CREATE TABLE "ousd_vault" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "dai" numeric NOT NULL, "usdt" numeric NOT NULL, "usdc" numeric NOT NULL, CONSTRAINT "PK_343f5538c71a1cd78f1659ef9d3" PRIMARY KEY ("id"))`, - ) - await db.query( - `CREATE INDEX "IDX_6860186ea2f56e2c7d54c22107" ON "ousd_vault" ("timestamp") `, - ) - await db.query( - `CREATE INDEX "IDX_0d0a7113a505cf7f7adea9ca81" ON "ousd_vault" ("block_number") `, - ) - await db.query( - `CREATE TABLE "ousd_morpho_aave" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "dai" numeric NOT NULL, "usdt" numeric NOT NULL, "usdc" numeric NOT NULL, CONSTRAINT "PK_60676cde905a822ba73ff3a5c85" PRIMARY KEY ("id"))`, - ) - await db.query( - `CREATE INDEX "IDX_78e0701c2e9a28242db37bd8f8" ON "ousd_morpho_aave" ("timestamp") `, - ) - await db.query( - `CREATE INDEX "IDX_46ccf673b376d654052fbd53e6" ON "ousd_morpho_aave" ("block_number") `, - ) - await db.query( - `CREATE TABLE "ousd_morpho_compound" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "dai" numeric NOT NULL, "usdt" numeric NOT NULL, "usdc" numeric NOT NULL, CONSTRAINT "PK_5f715d53ef8fc0fad595cacf4fa" PRIMARY KEY ("id"))`, - ) - await db.query( - `CREATE INDEX "IDX_9e7bd0d8ae23b877d5979ef80c" ON "ousd_morpho_compound" ("timestamp") `, - ) - await db.query( - `CREATE INDEX "IDX_0bb3a0ad84071f1d80f6d4e90f" ON "ousd_morpho_compound" ("block_number") `, - ) - await db.query( - `CREATE TABLE "maker_dsr_strategy" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "dai" numeric NOT NULL, CONSTRAINT "PK_196da2d6910009ae04e3542fe22" PRIMARY KEY ("id"))`, - ) - await db.query( - `CREATE INDEX "IDX_a35308a3c5dbaab2d321eb1525" ON "maker_dsr_strategy" ("timestamp") `, - ) - await db.query( - `CREATE INDEX "IDX_844b219d8faf9b1d24ab2dba9a" ON "maker_dsr_strategy" ("block_number") `, - ) - await db.query( - `CREATE TABLE "ousd_flux_strategy" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "dai" numeric NOT NULL, "usdt" numeric NOT NULL, "usdc" numeric NOT NULL, CONSTRAINT "PK_ac977221429e50e4de1ce253a8b" PRIMARY KEY ("id"))`, - ) - await db.query( - `CREATE INDEX "IDX_5b165b5d30b13e363d33a66e14" ON "ousd_flux_strategy" ("timestamp") `, - ) - await db.query( - `CREATE INDEX "IDX_80f3392968fde7b99cccb805ac" ON "ousd_flux_strategy" ("block_number") `, - ) - await db.query( - `CREATE TABLE "ousd_compound_strategy" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "dai" numeric NOT NULL, "usdt" numeric NOT NULL, "usdc" numeric NOT NULL, CONSTRAINT "PK_9030e82bf3479d03c04e0d1919c" PRIMARY KEY ("id"))`, - ) - await db.query( - `CREATE INDEX "IDX_6920b1db5dc577295ac4d1379d" ON "ousd_compound_strategy" ("timestamp") `, - ) - await db.query( - `CREATE INDEX "IDX_89c6d7d3104bd36dc88a37add4" ON "ousd_compound_strategy" ("block_number") `, - ) - await db.query( - `CREATE TABLE "ousd_convex_strategy" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "dai" numeric NOT NULL, "usdt" numeric NOT NULL, "usdc" numeric NOT NULL, CONSTRAINT "PK_2b8f6e749e15e49d8816f1ac949" PRIMARY KEY ("id"))`, - ) - await db.query( - `CREATE INDEX "IDX_2deac473cd0b2dd7082e7da148" ON "ousd_convex_strategy" ("timestamp") `, - ) - await db.query( - `CREATE INDEX "IDX_157bf74171817dc5c60ee37036" ON "ousd_convex_strategy" ("block_number") `, - ) - await db.query( - `CREATE TABLE "ousd_aave_strategy" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "dai" numeric NOT NULL, "usdt" numeric NOT NULL, "usdc" numeric NOT NULL, CONSTRAINT "PK_b4b7ac6e395aa722df500f93623" PRIMARY KEY ("id"))`, - ) - await db.query( - `CREATE INDEX "IDX_ca34b5a0a33bc9abdd8213c2fa" ON "ousd_aave_strategy" ("timestamp") `, - ) - await db.query( - `CREATE INDEX "IDX_dacd7c98223d7bc8be074d71e4" ON "ousd_aave_strategy" ("block_number") `, - ) - await db.query( - `CREATE TABLE "ousd_meta_strategy" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "dai" numeric NOT NULL, "usdt" numeric NOT NULL, "usdc" numeric NOT NULL, CONSTRAINT "PK_d99170af73d86fe74460bbfacc4" PRIMARY KEY ("id"))`, - ) - await db.query( - `CREATE INDEX "IDX_7e998dcf775263bc5df76ef987" ON "ousd_meta_strategy" ("timestamp") `, - ) - await db.query( - `CREATE INDEX "IDX_55ce185680512d6a5b9fb0af89" ON "ousd_meta_strategy" ("block_number") `, - ) - await db.query( - `CREATE TABLE "ousd_convex_lusd_plus3_crv" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "dai" numeric NOT NULL, "usdt" numeric NOT NULL, "usdc" numeric NOT NULL, CONSTRAINT "PK_47290aa5dfa3cc5595f468e2f39" PRIMARY KEY ("id"))`, - ) - await db.query( - `CREATE INDEX "IDX_0783af95efb35fb3f13cde1656" ON "ousd_convex_lusd_plus3_crv" ("timestamp") `, - ) - await db.query( - `CREATE INDEX "IDX_74ae01fb596a4f2733087ba454" ON "ousd_convex_lusd_plus3_crv" ("block_number") `, - ) - await db.query( - `ALTER TABLE "oeth_history" ADD CONSTRAINT "FK_94e47c4c49128c78f60b185b46b" FOREIGN KEY ("address_id") REFERENCES "oeth_address"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`, - ) - await db.query( - `ALTER TABLE "oeth_rebase" ADD CONSTRAINT "FK_3331819842173de7c27c046547a" FOREIGN KEY ("apy_id") REFERENCES "oethapy"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`, - ) - await db.query( - `ALTER TABLE "oeth_rebase_option" ADD CONSTRAINT "FK_034428879698039839b4ba6ffe8" FOREIGN KEY ("address_id") REFERENCES "oeth_address"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`, - ) - await db.query( - `ALTER TABLE "oeth_strategy_holding_daily_stat" ADD CONSTRAINT "FK_4e867f220975e615e6077d860c1" FOREIGN KEY ("strategy_daily_stat_id_id") REFERENCES "oeth_strategy_daily_stat"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`, - ) - await db.query( - `ALTER TABLE "oeth_strategy_daily_stat" ADD CONSTRAINT "FK_6c7096c96a000d8471256ca8fc3" FOREIGN KEY ("daily_stat_id_id") REFERENCES "oeth_daily_stat"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`, - ) - await db.query( - `ALTER TABLE "oeth_collateral_daily_stat" ADD CONSTRAINT "FK_a90045de50406be7bd56efd3ea4" FOREIGN KEY ("daily_stat_id_id") REFERENCES "oeth_daily_stat"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`, - ) - await db.query( - `ALTER TABLE "ousd_history" ADD CONSTRAINT "FK_70291ea600c0c4d67d9bfe6a6bf" FOREIGN KEY ("address_id") REFERENCES "ousd_address"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`, - ) - await db.query( - `ALTER TABLE "ousd_rebase" ADD CONSTRAINT "FK_427468c97f9838b804efd6c8e55" FOREIGN KEY ("apy_id") REFERENCES "ousdapy"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`, - ) - await db.query( - `ALTER TABLE "ousd_rebase_option" ADD CONSTRAINT "FK_b04173f9349ddd991a3b60e914a" FOREIGN KEY ("address_id") REFERENCES "ousd_address"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`, - ) - } - - async down(db) { - await db.query(`DROP TABLE "exchange_rate"`) - await db.query(`DROP INDEX "public"."IDX_9e23a3f1bf3634820c873a0fe8"`) - await db.query(`DROP INDEX "public"."IDX_c61a93768eed9e58ce399bbe01"`) - await db.query(`DROP TABLE "balance"`) - await db.query(`DROP INDEX "public"."IDX_a956b410c329b8eca7898c3c51"`) - await db.query(`DROP INDEX "public"."IDX_6b451b59c9f6a6fdd685f530b2"`) - await db.query(`DROP TABLE "strategy_balance"`) - await db.query(`DROP INDEX "public"."IDX_0113bf0b63183bea0d22cd0d08"`) - await db.query(`DROP INDEX "public"."IDX_a88065dcd92011698bbe7df7b1"`) - await db.query(`DROP TABLE "strategy_yield"`) - await db.query(`DROP INDEX "public"."IDX_5108f2a2563d5665892d0c06b0"`) - await db.query(`DROP INDEX "public"."IDX_41c3567c9d43c598e07a0029c5"`) - await db.query(`DROP TABLE "curve_pool_balance"`) - await db.query(`DROP INDEX "public"."IDX_ffb0d0f86f03faacef7cb3e092"`) - await db.query(`DROP INDEX "public"."IDX_db5522c865eb8ed76fa7aeb4a8"`) - await db.query(`DROP TABLE "oeth"`) - await db.query(`DROP INDEX "public"."IDX_5b81a67229bac2d68e0dc92cc4"`) - await db.query(`DROP INDEX "public"."IDX_408e5f79f83093aa5cf2b0ea32"`) - await db.query(`DROP TABLE "oeth_history"`) - await db.query(`DROP INDEX "public"."IDX_94e47c4c49128c78f60b185b46"`) - await db.query(`DROP INDEX "public"."IDX_96956b1c8d29eb7066a97d5ea7"`) - await db.query(`DROP INDEX "public"."IDX_b14170bdb7fbc0775bf55df15d"`) - await db.query(`DROP TABLE "oeth_address"`) - await db.query(`DROP TABLE "oethapy"`) - await db.query(`DROP INDEX "public"."IDX_b1a448045d1ed9d655b679a371"`) - await db.query(`DROP INDEX "public"."IDX_6b8a7a706a0701e659a7d81508"`) - await db.query(`DROP INDEX "public"."IDX_c0c03168bb0139e3cffda4f00e"`) - await db.query(`DROP TABLE "oeth_rebase"`) - await db.query(`DROP INDEX "public"."IDX_fbb7b3f2fff9896eb683b86de7"`) - await db.query(`DROP INDEX "public"."IDX_d3255d02d9407bba89380d01fa"`) - await db.query(`DROP INDEX "public"."IDX_8b6bb0243472af88612fe6a01f"`) - await db.query(`DROP INDEX "public"."IDX_3331819842173de7c27c046547"`) - await db.query(`DROP TABLE "oeth_rebase_option"`) - await db.query(`DROP INDEX "public"."IDX_1fc6bbd88037bfbf4361776909"`) - await db.query(`DROP INDEX "public"."IDX_cbb7ceb49ef7c45432d0171296"`) - await db.query(`DROP INDEX "public"."IDX_355826dadaacc5ae2d63c82f28"`) - await db.query(`DROP INDEX "public"."IDX_034428879698039839b4ba6ffe"`) - await db.query(`DROP TABLE "oeth_vault"`) - await db.query(`DROP INDEX "public"."IDX_d6298a294864b4eaf793cf35a4"`) - await db.query(`DROP INDEX "public"."IDX_e20cb507a673817b2c68720415"`) - await db.query(`DROP TABLE "oeth_curve_lp"`) - await db.query(`DROP INDEX "public"."IDX_d9bbd20e888fa1b4b2c5d2f039"`) - await db.query(`DROP INDEX "public"."IDX_7617d593c36dce1b1565a8d74a"`) - await db.query(`DROP TABLE "oeth_frax_staking"`) - await db.query(`DROP INDEX "public"."IDX_ce6c2c65e90967dfeaac97025b"`) - await db.query(`DROP INDEX "public"."IDX_1a7f7d650390e2f9c212651e05"`) - await db.query(`DROP TABLE "oeth_morpho_aave"`) - await db.query(`DROP INDEX "public"."IDX_25e239b985844f1d33fac79981"`) - await db.query(`DROP INDEX "public"."IDX_a6662224e95eb6921bb14cb5f9"`) - await db.query(`DROP TABLE "oeth_dripper"`) - await db.query(`DROP INDEX "public"."IDX_16ac742ceeb05d28e530da9649"`) - await db.query(`DROP INDEX "public"."IDX_d356832c14603916a492608e7b"`) - await db.query(`DROP TABLE "oeth_balancer_meta_pool_strategy"`) - await db.query(`DROP INDEX "public"."IDX_5e7ef383756fa18cb602f50089"`) - await db.query(`DROP INDEX "public"."IDX_11d344b3e0e03cdb6697dd61f7"`) - await db.query(`DROP TABLE "oeth_strategy_holding_daily_stat"`) - await db.query(`DROP INDEX "public"."IDX_4e867f220975e615e6077d860c"`) - await db.query(`DROP TABLE "oeth_strategy_daily_stat"`) - await db.query(`DROP INDEX "public"."IDX_6c7096c96a000d8471256ca8fc"`) - await db.query(`DROP TABLE "oeth_collateral_daily_stat"`) - await db.query(`DROP INDEX "public"."IDX_a90045de50406be7bd56efd3ea"`) - await db.query(`DROP TABLE "oeth_daily_stat"`) - await db.query(`DROP INDEX "public"."IDX_98d9001013aa37425ca47b7126"`) - await db.query(`DROP INDEX "public"."IDX_c3e66051c7df4efd6a8fa8f9c1"`) - await db.query(`DROP TABLE "oeth_reward_token_collected"`) - await db.query(`DROP INDEX "public"."IDX_81a9fa43ae4a6ae63e4103127b"`) - await db.query(`DROP INDEX "public"."IDX_d36c78b9c3e9d737f067638bc4"`) - await db.query(`DROP TABLE "ogv"`) - await db.query(`DROP INDEX "public"."IDX_2418a8b8b92b2f5977be761cf9"`) - await db.query(`DROP INDEX "public"."IDX_b8f20bcf48e4aa77e0f48d77db"`) - await db.query(`DROP TABLE "staked_ogv"`) - await db.query(`DROP INDEX "public"."IDX_533195c60cfaef9e118789dee9"`) - await db.query(`DROP INDEX "public"."IDX_d601233411a33212b9d616aab0"`) - await db.query(`DROP TABLE "ogv_governance"`) - await db.query(`DROP INDEX "public"."IDX_a0329e7109d5959b9aa3d9d374"`) - await db.query(`DROP INDEX "public"."IDX_63cd1ca46771965c68f6b85898"`) - await db.query(`DROP TABLE "ousd"`) - await db.query(`DROP INDEX "public"."IDX_c8d1e285213b445b088805ac7c"`) - await db.query(`DROP INDEX "public"."IDX_806949dd853b7e8acab5d03b81"`) - await db.query(`DROP TABLE "ousd_history"`) - await db.query(`DROP INDEX "public"."IDX_70291ea600c0c4d67d9bfe6a6b"`) - await db.query(`DROP INDEX "public"."IDX_4d00d283e1ce3209dc43a0313c"`) - await db.query(`DROP INDEX "public"."IDX_0c25caa59aa053a688a723d160"`) - await db.query(`DROP TABLE "ousd_address"`) - await db.query(`DROP TABLE "ousdapy"`) - await db.query(`DROP INDEX "public"."IDX_c514963f42908ce84d65a84a77"`) - await db.query(`DROP INDEX "public"."IDX_4f606414b3b5ce1a366bd0fbf6"`) - await db.query(`DROP INDEX "public"."IDX_0e84a81a109b66fe6f01f77c74"`) - await db.query(`DROP TABLE "ousd_rebase"`) - await db.query(`DROP INDEX "public"."IDX_f8eb4a16ce58a146b3227ee21a"`) - await db.query(`DROP INDEX "public"."IDX_3fb03b1a410e64c7367226d0b6"`) - await db.query(`DROP INDEX "public"."IDX_1a76c478199672aaeec340f619"`) - await db.query(`DROP INDEX "public"."IDX_427468c97f9838b804efd6c8e5"`) - await db.query(`DROP TABLE "ousd_rebase_option"`) - await db.query(`DROP INDEX "public"."IDX_64bd23947dc4c67e3b6a3f9352"`) - await db.query(`DROP INDEX "public"."IDX_9b774e46b8b1cf7f828133809a"`) - await db.query(`DROP INDEX "public"."IDX_4e95bf069de04533d83a9a97fd"`) - await db.query(`DROP INDEX "public"."IDX_b04173f9349ddd991a3b60e914"`) - await db.query(`DROP TABLE "ousd_vault"`) - await db.query(`DROP INDEX "public"."IDX_6860186ea2f56e2c7d54c22107"`) - await db.query(`DROP INDEX "public"."IDX_0d0a7113a505cf7f7adea9ca81"`) - await db.query(`DROP TABLE "ousd_morpho_aave"`) - await db.query(`DROP INDEX "public"."IDX_78e0701c2e9a28242db37bd8f8"`) - await db.query(`DROP INDEX "public"."IDX_46ccf673b376d654052fbd53e6"`) - await db.query(`DROP TABLE "ousd_morpho_compound"`) - await db.query(`DROP INDEX "public"."IDX_9e7bd0d8ae23b877d5979ef80c"`) - await db.query(`DROP INDEX "public"."IDX_0bb3a0ad84071f1d80f6d4e90f"`) - await db.query(`DROP TABLE "maker_dsr_strategy"`) - await db.query(`DROP INDEX "public"."IDX_a35308a3c5dbaab2d321eb1525"`) - await db.query(`DROP INDEX "public"."IDX_844b219d8faf9b1d24ab2dba9a"`) - await db.query(`DROP TABLE "ousd_flux_strategy"`) - await db.query(`DROP INDEX "public"."IDX_5b165b5d30b13e363d33a66e14"`) - await db.query(`DROP INDEX "public"."IDX_80f3392968fde7b99cccb805ac"`) - await db.query(`DROP TABLE "ousd_compound_strategy"`) - await db.query(`DROP INDEX "public"."IDX_6920b1db5dc577295ac4d1379d"`) - await db.query(`DROP INDEX "public"."IDX_89c6d7d3104bd36dc88a37add4"`) - await db.query(`DROP TABLE "ousd_convex_strategy"`) - await db.query(`DROP INDEX "public"."IDX_2deac473cd0b2dd7082e7da148"`) - await db.query(`DROP INDEX "public"."IDX_157bf74171817dc5c60ee37036"`) - await db.query(`DROP TABLE "ousd_aave_strategy"`) - await db.query(`DROP INDEX "public"."IDX_ca34b5a0a33bc9abdd8213c2fa"`) - await db.query(`DROP INDEX "public"."IDX_dacd7c98223d7bc8be074d71e4"`) - await db.query(`DROP TABLE "ousd_meta_strategy"`) - await db.query(`DROP INDEX "public"."IDX_7e998dcf775263bc5df76ef987"`) - await db.query(`DROP INDEX "public"."IDX_55ce185680512d6a5b9fb0af89"`) - await db.query(`DROP TABLE "ousd_convex_lusd_plus3_crv"`) - await db.query(`DROP INDEX "public"."IDX_0783af95efb35fb3f13cde1656"`) - await db.query(`DROP INDEX "public"."IDX_74ae01fb596a4f2733087ba454"`) - await db.query( - `ALTER TABLE "oeth_history" DROP CONSTRAINT "FK_94e47c4c49128c78f60b185b46b"`, - ) - await db.query( - `ALTER TABLE "oeth_rebase" DROP CONSTRAINT "FK_3331819842173de7c27c046547a"`, - ) - await db.query( - `ALTER TABLE "oeth_rebase_option" DROP CONSTRAINT "FK_034428879698039839b4ba6ffe8"`, - ) - await db.query( - `ALTER TABLE "oeth_strategy_holding_daily_stat" DROP CONSTRAINT "FK_4e867f220975e615e6077d860c1"`, - ) - await db.query( - `ALTER TABLE "oeth_strategy_daily_stat" DROP CONSTRAINT "FK_6c7096c96a000d8471256ca8fc3"`, - ) - await db.query( - `ALTER TABLE "oeth_collateral_daily_stat" DROP CONSTRAINT "FK_a90045de50406be7bd56efd3ea4"`, - ) - await db.query( - `ALTER TABLE "ousd_history" DROP CONSTRAINT "FK_70291ea600c0c4d67d9bfe6a6bf"`, - ) - await db.query( - `ALTER TABLE "ousd_rebase" DROP CONSTRAINT "FK_427468c97f9838b804efd6c8e55"`, - ) - await db.query( - `ALTER TABLE "ousd_rebase_option" DROP CONSTRAINT "FK_b04173f9349ddd991a3b60e914a"`, - ) - } -} diff --git a/db/migrations/1698864698478-Data.js b/db/migrations/1698864698478-Data.js new file mode 100644 index 00000000..05a8dcd6 --- /dev/null +++ b/db/migrations/1698864698478-Data.js @@ -0,0 +1,283 @@ +module.exports = class Data1698864698478 { + name = 'Data1698864698478' + + async up(db) { + await db.query(`CREATE TABLE "exchange_rate" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "pair" text NOT NULL, "base" text NOT NULL, "quote" text NOT NULL, "rate" numeric NOT NULL, CONSTRAINT "PK_5c5d27d2b900ef6cdeef0398472" PRIMARY KEY ("id"))`) + await db.query(`CREATE INDEX "IDX_9e23a3f1bf3634820c873a0fe8" ON "exchange_rate" ("timestamp") `) + await db.query(`CREATE INDEX "IDX_c61a93768eed9e58ce399bbe01" ON "exchange_rate" ("block_number") `) + await db.query(`CREATE TABLE "balance" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "token" text NOT NULL, "address" text NOT NULL, "balance" numeric NOT NULL, CONSTRAINT "PK_079dddd31a81672e8143a649ca0" PRIMARY KEY ("id"))`) + await db.query(`CREATE INDEX "IDX_a956b410c329b8eca7898c3c51" ON "balance" ("timestamp") `) + await db.query(`CREATE INDEX "IDX_6b451b59c9f6a6fdd685f530b2" ON "balance" ("block_number") `) + await db.query(`CREATE TABLE "strategy_balance" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "strategy" text NOT NULL, "asset" text NOT NULL, "balance" numeric NOT NULL, CONSTRAINT "PK_ca6f93229d1392e9546d01dae4f" PRIMARY KEY ("id"))`) + await db.query(`CREATE INDEX "IDX_0113bf0b63183bea0d22cd0d08" ON "strategy_balance" ("timestamp") `) + await db.query(`CREATE INDEX "IDX_a88065dcd92011698bbe7df7b1" ON "strategy_balance" ("block_number") `) + await db.query(`CREATE TABLE "strategy_yield" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "strategy" text NOT NULL, "asset" text NOT NULL, "balance" numeric NOT NULL, "earnings" numeric NOT NULL, CONSTRAINT "PK_e87c46575e870fe2202190c2728" PRIMARY KEY ("id"))`) + await db.query(`CREATE INDEX "IDX_5108f2a2563d5665892d0c06b0" ON "strategy_yield" ("timestamp") `) + await db.query(`CREATE INDEX "IDX_41c3567c9d43c598e07a0029c5" ON "strategy_yield" ("block_number") `) + await db.query(`CREATE TABLE "curve_pool_balance" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "address" text NOT NULL, "balance0" numeric NOT NULL, "balance1" numeric NOT NULL, "balance2" numeric NOT NULL, CONSTRAINT "PK_40412750bb910ca560aa084dd88" PRIMARY KEY ("id"))`) + await db.query(`CREATE INDEX "IDX_ffb0d0f86f03faacef7cb3e092" ON "curve_pool_balance" ("timestamp") `) + await db.query(`CREATE INDEX "IDX_db5522c865eb8ed76fa7aeb4a8" ON "curve_pool_balance" ("block_number") `) + await db.query(`CREATE TABLE "oeth" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "total_supply" numeric NOT NULL, "rebasing_supply" numeric NOT NULL, "non_rebasing_supply" numeric NOT NULL, CONSTRAINT "PK_de1d885501070dbd1ab6f8577ba" PRIMARY KEY ("id"))`) + await db.query(`CREATE INDEX "IDX_5b81a67229bac2d68e0dc92cc4" ON "oeth" ("timestamp") `) + await db.query(`CREATE INDEX "IDX_408e5f79f83093aa5cf2b0ea32" ON "oeth" ("block_number") `) + await db.query(`CREATE TABLE "oeth_history" ("id" character varying NOT NULL, "value" numeric NOT NULL, "balance" numeric NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "tx_hash" text NOT NULL, "type" character varying(8) NOT NULL, "address_id" character varying, CONSTRAINT "PK_2c7e7571cd9ea02b07a27a303f3" PRIMARY KEY ("id"))`) + await db.query(`CREATE INDEX "IDX_94e47c4c49128c78f60b185b46" ON "oeth_history" ("address_id") `) + await db.query(`CREATE INDEX "IDX_96956b1c8d29eb7066a97d5ea7" ON "oeth_history" ("block_number") `) + await db.query(`CREATE INDEX "IDX_b14170bdb7fbc0775bf55df15d" ON "oeth_history" ("tx_hash") `) + await db.query(`CREATE TABLE "oeth_address" ("id" character varying NOT NULL, "is_contract" boolean NOT NULL, "rebasing_option" character varying(6) NOT NULL, "balance" numeric NOT NULL, "earned" numeric NOT NULL, "credits" numeric NOT NULL, "last_updated" TIMESTAMP WITH TIME ZONE NOT NULL, CONSTRAINT "PK_92a966afe47d584af73ce77a1cd" PRIMARY KEY ("id"))`) + await db.query(`CREATE TABLE "oethapy" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "tx_hash" text NOT NULL, "apr" numeric NOT NULL, "apy" numeric NOT NULL, "apy7_day_avg" numeric NOT NULL, "apy14_day_avg" numeric NOT NULL, "apy30_day_avg" numeric NOT NULL, "rebasing_credits_per_token" numeric NOT NULL, CONSTRAINT "PK_8dbb4d04591848361200f18f62a" PRIMARY KEY ("id"))`) + await db.query(`CREATE INDEX "IDX_b1a448045d1ed9d655b679a371" ON "oethapy" ("timestamp") `) + await db.query(`CREATE INDEX "IDX_6b8a7a706a0701e659a7d81508" ON "oethapy" ("block_number") `) + await db.query(`CREATE INDEX "IDX_c0c03168bb0139e3cffda4f00e" ON "oethapy" ("tx_hash") `) + await db.query(`CREATE TABLE "oeth_rebase" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "tx_hash" text NOT NULL, "total_supply" numeric NOT NULL, "rebasing_credits" numeric NOT NULL, "rebasing_credits_per_token" numeric NOT NULL, "fee" numeric NOT NULL, "yield" numeric NOT NULL, "apy_id" character varying, CONSTRAINT "PK_5f8f4dd071caf685b4ac2d54de3" PRIMARY KEY ("id"))`) + await db.query(`CREATE INDEX "IDX_fbb7b3f2fff9896eb683b86de7" ON "oeth_rebase" ("timestamp") `) + await db.query(`CREATE INDEX "IDX_d3255d02d9407bba89380d01fa" ON "oeth_rebase" ("block_number") `) + await db.query(`CREATE INDEX "IDX_8b6bb0243472af88612fe6a01f" ON "oeth_rebase" ("tx_hash") `) + await db.query(`CREATE INDEX "IDX_3331819842173de7c27c046547" ON "oeth_rebase" ("apy_id") `) + await db.query(`CREATE TABLE "oeth_rebase_option" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "tx_hash" text NOT NULL, "status" character varying(6) NOT NULL, "address_id" character varying, CONSTRAINT "PK_32971725d5523200b4b3b7c07e5" PRIMARY KEY ("id"))`) + await db.query(`CREATE INDEX "IDX_1fc6bbd88037bfbf4361776909" ON "oeth_rebase_option" ("timestamp") `) + await db.query(`CREATE INDEX "IDX_cbb7ceb49ef7c45432d0171296" ON "oeth_rebase_option" ("block_number") `) + await db.query(`CREATE INDEX "IDX_355826dadaacc5ae2d63c82f28" ON "oeth_rebase_option" ("tx_hash") `) + await db.query(`CREATE INDEX "IDX_034428879698039839b4ba6ffe" ON "oeth_rebase_option" ("address_id") `) + await db.query(`CREATE TABLE "oeth_vault" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "weth" numeric NOT NULL, "st_eth" numeric NOT NULL, "r_eth" numeric NOT NULL, "frx_eth" numeric NOT NULL, CONSTRAINT "PK_9debaa84944fe2be9dc4219ba8f" PRIMARY KEY ("id"))`) + await db.query(`CREATE INDEX "IDX_d6298a294864b4eaf793cf35a4" ON "oeth_vault" ("timestamp") `) + await db.query(`CREATE INDEX "IDX_e20cb507a673817b2c68720415" ON "oeth_vault" ("block_number") `) + await db.query(`CREATE TABLE "oeth_curve_lp" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "total_supply" numeric NOT NULL, "eth" numeric NOT NULL, "oeth" numeric NOT NULL, "total_supply_owned" numeric NOT NULL, "eth_owned" numeric NOT NULL, "oeth_owned" numeric NOT NULL, CONSTRAINT "PK_2b055044664e80f44d6172fdf54" PRIMARY KEY ("id"))`) + await db.query(`CREATE INDEX "IDX_d9bbd20e888fa1b4b2c5d2f039" ON "oeth_curve_lp" ("timestamp") `) + await db.query(`CREATE INDEX "IDX_7617d593c36dce1b1565a8d74a" ON "oeth_curve_lp" ("block_number") `) + await db.query(`CREATE TABLE "oeth_frax_staking" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "sfrx_eth" numeric NOT NULL, CONSTRAINT "PK_694f53c8600ae88c7bdcf7305dd" PRIMARY KEY ("id"))`) + await db.query(`CREATE INDEX "IDX_ce6c2c65e90967dfeaac97025b" ON "oeth_frax_staking" ("timestamp") `) + await db.query(`CREATE INDEX "IDX_1a7f7d650390e2f9c212651e05" ON "oeth_frax_staking" ("block_number") `) + await db.query(`CREATE TABLE "oeth_morpho_aave" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "weth" numeric NOT NULL, CONSTRAINT "PK_86de8f846e9335c92b8ad7df3a1" PRIMARY KEY ("id"))`) + await db.query(`CREATE INDEX "IDX_25e239b985844f1d33fac79981" ON "oeth_morpho_aave" ("timestamp") `) + await db.query(`CREATE INDEX "IDX_a6662224e95eb6921bb14cb5f9" ON "oeth_morpho_aave" ("block_number") `) + await db.query(`CREATE TABLE "oeth_dripper" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "weth" numeric NOT NULL, "last_collect_timestamp" integer NOT NULL, "drip_rate_per_block" numeric NOT NULL, "drip_duration" numeric NOT NULL, CONSTRAINT "PK_77731281c1564c24eff0c265984" PRIMARY KEY ("id"))`) + await db.query(`CREATE INDEX "IDX_16ac742ceeb05d28e530da9649" ON "oeth_dripper" ("timestamp") `) + await db.query(`CREATE INDEX "IDX_d356832c14603916a492608e7b" ON "oeth_dripper" ("block_number") `) + await db.query(`CREATE TABLE "oeth_balancer_meta_pool_strategy" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "r_eth" numeric NOT NULL, "weth" numeric NOT NULL, CONSTRAINT "PK_6ddf5b8ba878e6d706e59bd6de0" PRIMARY KEY ("id"))`) + await db.query(`CREATE INDEX "IDX_5e7ef383756fa18cb602f50089" ON "oeth_balancer_meta_pool_strategy" ("timestamp") `) + await db.query(`CREATE INDEX "IDX_11d344b3e0e03cdb6697dd61f7" ON "oeth_balancer_meta_pool_strategy" ("block_number") `) + await db.query(`CREATE TABLE "oeth_strategy_holding_daily_stat" ("id" character varying NOT NULL, "symbol" text NOT NULL, "amount" numeric NOT NULL, "value" numeric NOT NULL, "strategy_daily_stat_id_id" character varying, CONSTRAINT "PK_7f1a62da5e53cf264c2f39b4acf" PRIMARY KEY ("id"))`) + await db.query(`CREATE INDEX "IDX_4e867f220975e615e6077d860c" ON "oeth_strategy_holding_daily_stat" ("strategy_daily_stat_id_id") `) + await db.query(`CREATE TABLE "oeth_strategy_daily_stat" ("id" character varying NOT NULL, "name" text NOT NULL, "total" numeric NOT NULL, "tvl" numeric NOT NULL, "daily_stat_id_id" character varying, CONSTRAINT "PK_8af1a0c60e67b05baf928787a8e" PRIMARY KEY ("id"))`) + await db.query(`CREATE INDEX "IDX_6c7096c96a000d8471256ca8fc" ON "oeth_strategy_daily_stat" ("daily_stat_id_id") `) + await db.query(`CREATE TABLE "oeth_collateral_daily_stat" ("id" character varying NOT NULL, "symbol" text NOT NULL, "amount" numeric NOT NULL, "price" numeric NOT NULL, "value" numeric NOT NULL, "daily_stat_id_id" character varying, CONSTRAINT "PK_5fb23d7bae30dffe4543e7aa069" PRIMARY KEY ("id"))`) + await db.query(`CREATE INDEX "IDX_a90045de50406be7bd56efd3ea" ON "oeth_collateral_daily_stat" ("daily_stat_id_id") `) + await db.query(`CREATE TABLE "oeth_daily_stat" ("id" character varying NOT NULL, "block_number" integer NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "apr" numeric NOT NULL, "apy" numeric NOT NULL, "apy7_day_avg" numeric NOT NULL, "apy14_day_avg" numeric NOT NULL, "apy30_day_avg" numeric NOT NULL, "total_supply" numeric NOT NULL, "total_supply_usd" numeric NOT NULL, "rebasing_supply" numeric NOT NULL, "non_rebasing_supply" numeric NOT NULL, "amo_supply" numeric NOT NULL, "dripper_weth" numeric NOT NULL, "yield" numeric NOT NULL, "fees" numeric NOT NULL, "revenue" numeric NOT NULL, "revenue7_day_avg" numeric NOT NULL, "revenue7_day_total" numeric NOT NULL, "revenue_all_time" numeric NOT NULL, "peg_price" numeric NOT NULL, CONSTRAINT "PK_9144a02ab13b1baa818a7d5eae5" PRIMARY KEY ("id"))`) + await db.query(`CREATE INDEX "IDX_98d9001013aa37425ca47b7126" ON "oeth_daily_stat" ("block_number") `) + await db.query(`CREATE INDEX "IDX_c3e66051c7df4efd6a8fa8f9c1" ON "oeth_daily_stat" ("timestamp") `) + await db.query(`CREATE TABLE "oeth_reward_token_collected" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "strategy" text NOT NULL, "recipient" text NOT NULL, "reward_token" text NOT NULL, "amount" numeric NOT NULL, CONSTRAINT "PK_47098cc5fbc7cb95c2374fa33cd" PRIMARY KEY ("id"))`) + await db.query(`CREATE INDEX "IDX_81a9fa43ae4a6ae63e4103127b" ON "oeth_reward_token_collected" ("timestamp") `) + await db.query(`CREATE INDEX "IDX_d36c78b9c3e9d737f067638bc4" ON "oeth_reward_token_collected" ("block_number") `) + await db.query(`CREATE TABLE "ogv" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "circulating" numeric NOT NULL, "total" numeric NOT NULL, CONSTRAINT "PK_f16038abf451ce82bd03ea54ee7" PRIMARY KEY ("id"))`) + await db.query(`CREATE INDEX "IDX_2418a8b8b92b2f5977be761cf9" ON "ogv" ("timestamp") `) + await db.query(`CREATE INDEX "IDX_b8f20bcf48e4aa77e0f48d77db" ON "ogv" ("block_number") `) + await db.query(`CREATE TABLE "staked_ogv" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "total" numeric NOT NULL, "apy" numeric NOT NULL, CONSTRAINT "PK_b135611d9aab36c7889982c3be8" PRIMARY KEY ("id"))`) + await db.query(`CREATE INDEX "IDX_533195c60cfaef9e118789dee9" ON "staked_ogv" ("timestamp") `) + await db.query(`CREATE INDEX "IDX_d601233411a33212b9d616aab0" ON "staked_ogv" ("block_number") `) + await db.query(`CREATE TABLE "ogv_governance" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "registered_voters" integer NOT NULL, "open_source_contributors" integer NOT NULL, "improvement_proposals" integer NOT NULL, CONSTRAINT "PK_b22758cd4ee8ff92c1b7ee0cf20" PRIMARY KEY ("id"))`) + await db.query(`CREATE INDEX "IDX_a0329e7109d5959b9aa3d9d374" ON "ogv_governance" ("timestamp") `) + await db.query(`CREATE INDEX "IDX_63cd1ca46771965c68f6b85898" ON "ogv_governance" ("block_number") `) + await db.query(`CREATE TABLE "ousd" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "total_supply" numeric NOT NULL, "rebasing_supply" numeric NOT NULL, "non_rebasing_supply" numeric NOT NULL, CONSTRAINT "PK_acecae4a20bc14b22d9f6738d8d" PRIMARY KEY ("id"))`) + await db.query(`CREATE INDEX "IDX_c8d1e285213b445b088805ac7c" ON "ousd" ("timestamp") `) + await db.query(`CREATE INDEX "IDX_806949dd853b7e8acab5d03b81" ON "ousd" ("block_number") `) + await db.query(`CREATE TABLE "ousd_history" ("id" character varying NOT NULL, "value" numeric NOT NULL, "balance" numeric NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "tx_hash" text NOT NULL, "type" character varying(8) NOT NULL, "address_id" character varying, CONSTRAINT "PK_dcbe3223b67f92d9ad4cffe8a7c" PRIMARY KEY ("id"))`) + await db.query(`CREATE INDEX "IDX_70291ea600c0c4d67d9bfe6a6b" ON "ousd_history" ("address_id") `) + await db.query(`CREATE INDEX "IDX_4d00d283e1ce3209dc43a0313c" ON "ousd_history" ("block_number") `) + await db.query(`CREATE INDEX "IDX_0c25caa59aa053a688a723d160" ON "ousd_history" ("tx_hash") `) + await db.query(`CREATE TABLE "ousd_address" ("id" character varying NOT NULL, "is_contract" boolean NOT NULL, "rebasing_option" character varying(6) NOT NULL, "balance" numeric NOT NULL, "earned" numeric NOT NULL, "credits" numeric NOT NULL, "last_updated" TIMESTAMP WITH TIME ZONE NOT NULL, CONSTRAINT "PK_bb061344757ede566d62854af6a" PRIMARY KEY ("id"))`) + await db.query(`CREATE TABLE "ousdapy" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "tx_hash" text NOT NULL, "apr" numeric NOT NULL, "apy" numeric NOT NULL, "apy7_day_avg" numeric NOT NULL, "apy14_day_avg" numeric NOT NULL, "apy30_day_avg" numeric NOT NULL, "rebasing_credits_per_token" numeric NOT NULL, CONSTRAINT "PK_d9889b7153efc82dbe88f9a7a33" PRIMARY KEY ("id"))`) + await db.query(`CREATE INDEX "IDX_c514963f42908ce84d65a84a77" ON "ousdapy" ("timestamp") `) + await db.query(`CREATE INDEX "IDX_4f606414b3b5ce1a366bd0fbf6" ON "ousdapy" ("block_number") `) + await db.query(`CREATE INDEX "IDX_0e84a81a109b66fe6f01f77c74" ON "ousdapy" ("tx_hash") `) + await db.query(`CREATE TABLE "ousd_rebase" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "tx_hash" text NOT NULL, "total_supply" numeric NOT NULL, "rebasing_credits" numeric NOT NULL, "rebasing_credits_per_token" numeric NOT NULL, "fee" numeric NOT NULL, "yield" numeric NOT NULL, "apy_id" character varying, CONSTRAINT "PK_04cf0de72399a99798dde61b237" PRIMARY KEY ("id"))`) + await db.query(`CREATE INDEX "IDX_f8eb4a16ce58a146b3227ee21a" ON "ousd_rebase" ("timestamp") `) + await db.query(`CREATE INDEX "IDX_3fb03b1a410e64c7367226d0b6" ON "ousd_rebase" ("block_number") `) + await db.query(`CREATE INDEX "IDX_1a76c478199672aaeec340f619" ON "ousd_rebase" ("tx_hash") `) + await db.query(`CREATE INDEX "IDX_427468c97f9838b804efd6c8e5" ON "ousd_rebase" ("apy_id") `) + await db.query(`CREATE TABLE "ousd_rebase_option" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "tx_hash" text NOT NULL, "status" character varying(6) NOT NULL, "address_id" character varying, CONSTRAINT "PK_d684f90866027104f3c929dfe10" PRIMARY KEY ("id"))`) + await db.query(`CREATE INDEX "IDX_64bd23947dc4c67e3b6a3f9352" ON "ousd_rebase_option" ("timestamp") `) + await db.query(`CREATE INDEX "IDX_9b774e46b8b1cf7f828133809a" ON "ousd_rebase_option" ("block_number") `) + await db.query(`CREATE INDEX "IDX_4e95bf069de04533d83a9a97fd" ON "ousd_rebase_option" ("tx_hash") `) + await db.query(`CREATE INDEX "IDX_b04173f9349ddd991a3b60e914" ON "ousd_rebase_option" ("address_id") `) + await db.query(`CREATE TABLE "ousd_vault" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "dai" numeric NOT NULL, "usdt" numeric NOT NULL, "usdc" numeric NOT NULL, CONSTRAINT "PK_343f5538c71a1cd78f1659ef9d3" PRIMARY KEY ("id"))`) + await db.query(`CREATE INDEX "IDX_6860186ea2f56e2c7d54c22107" ON "ousd_vault" ("timestamp") `) + await db.query(`CREATE INDEX "IDX_0d0a7113a505cf7f7adea9ca81" ON "ousd_vault" ("block_number") `) + await db.query(`CREATE TABLE "ousd_morpho_aave" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "dai" numeric NOT NULL, "usdt" numeric NOT NULL, "usdc" numeric NOT NULL, CONSTRAINT "PK_60676cde905a822ba73ff3a5c85" PRIMARY KEY ("id"))`) + await db.query(`CREATE INDEX "IDX_78e0701c2e9a28242db37bd8f8" ON "ousd_morpho_aave" ("timestamp") `) + await db.query(`CREATE INDEX "IDX_46ccf673b376d654052fbd53e6" ON "ousd_morpho_aave" ("block_number") `) + await db.query(`CREATE TABLE "ousd_morpho_compound" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "dai" numeric NOT NULL, "usdt" numeric NOT NULL, "usdc" numeric NOT NULL, CONSTRAINT "PK_5f715d53ef8fc0fad595cacf4fa" PRIMARY KEY ("id"))`) + await db.query(`CREATE INDEX "IDX_9e7bd0d8ae23b877d5979ef80c" ON "ousd_morpho_compound" ("timestamp") `) + await db.query(`CREATE INDEX "IDX_0bb3a0ad84071f1d80f6d4e90f" ON "ousd_morpho_compound" ("block_number") `) + await db.query(`CREATE TABLE "maker_dsr_strategy" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "dai" numeric NOT NULL, CONSTRAINT "PK_196da2d6910009ae04e3542fe22" PRIMARY KEY ("id"))`) + await db.query(`CREATE INDEX "IDX_a35308a3c5dbaab2d321eb1525" ON "maker_dsr_strategy" ("timestamp") `) + await db.query(`CREATE INDEX "IDX_844b219d8faf9b1d24ab2dba9a" ON "maker_dsr_strategy" ("block_number") `) + await db.query(`CREATE TABLE "ousd_flux_strategy" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "dai" numeric NOT NULL, "usdt" numeric NOT NULL, "usdc" numeric NOT NULL, CONSTRAINT "PK_ac977221429e50e4de1ce253a8b" PRIMARY KEY ("id"))`) + await db.query(`CREATE INDEX "IDX_5b165b5d30b13e363d33a66e14" ON "ousd_flux_strategy" ("timestamp") `) + await db.query(`CREATE INDEX "IDX_80f3392968fde7b99cccb805ac" ON "ousd_flux_strategy" ("block_number") `) + await db.query(`CREATE TABLE "ousd_compound_strategy" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "dai" numeric NOT NULL, "usdt" numeric NOT NULL, "usdc" numeric NOT NULL, CONSTRAINT "PK_9030e82bf3479d03c04e0d1919c" PRIMARY KEY ("id"))`) + await db.query(`CREATE INDEX "IDX_6920b1db5dc577295ac4d1379d" ON "ousd_compound_strategy" ("timestamp") `) + await db.query(`CREATE INDEX "IDX_89c6d7d3104bd36dc88a37add4" ON "ousd_compound_strategy" ("block_number") `) + await db.query(`CREATE TABLE "ousd_convex_strategy" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "dai" numeric NOT NULL, "usdt" numeric NOT NULL, "usdc" numeric NOT NULL, CONSTRAINT "PK_2b8f6e749e15e49d8816f1ac949" PRIMARY KEY ("id"))`) + await db.query(`CREATE INDEX "IDX_2deac473cd0b2dd7082e7da148" ON "ousd_convex_strategy" ("timestamp") `) + await db.query(`CREATE INDEX "IDX_157bf74171817dc5c60ee37036" ON "ousd_convex_strategy" ("block_number") `) + await db.query(`CREATE TABLE "ousd_aave_strategy" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "dai" numeric NOT NULL, "usdt" numeric NOT NULL, "usdc" numeric NOT NULL, CONSTRAINT "PK_b4b7ac6e395aa722df500f93623" PRIMARY KEY ("id"))`) + await db.query(`CREATE INDEX "IDX_ca34b5a0a33bc9abdd8213c2fa" ON "ousd_aave_strategy" ("timestamp") `) + await db.query(`CREATE INDEX "IDX_dacd7c98223d7bc8be074d71e4" ON "ousd_aave_strategy" ("block_number") `) + await db.query(`CREATE TABLE "ousd_meta_strategy" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "dai" numeric NOT NULL, "usdt" numeric NOT NULL, "usdc" numeric NOT NULL, CONSTRAINT "PK_d99170af73d86fe74460bbfacc4" PRIMARY KEY ("id"))`) + await db.query(`CREATE INDEX "IDX_7e998dcf775263bc5df76ef987" ON "ousd_meta_strategy" ("timestamp") `) + await db.query(`CREATE INDEX "IDX_55ce185680512d6a5b9fb0af89" ON "ousd_meta_strategy" ("block_number") `) + await db.query(`CREATE TABLE "ousd_convex_lusd_plus3_crv" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "dai" numeric NOT NULL, "usdt" numeric NOT NULL, "usdc" numeric NOT NULL, CONSTRAINT "PK_47290aa5dfa3cc5595f468e2f39" PRIMARY KEY ("id"))`) + await db.query(`CREATE INDEX "IDX_0783af95efb35fb3f13cde1656" ON "ousd_convex_lusd_plus3_crv" ("timestamp") `) + await db.query(`CREATE INDEX "IDX_74ae01fb596a4f2733087ba454" ON "ousd_convex_lusd_plus3_crv" ("block_number") `) + await db.query(`ALTER TABLE "oeth_history" ADD CONSTRAINT "FK_94e47c4c49128c78f60b185b46b" FOREIGN KEY ("address_id") REFERENCES "oeth_address"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`) + await db.query(`ALTER TABLE "oeth_rebase" ADD CONSTRAINT "FK_3331819842173de7c27c046547a" FOREIGN KEY ("apy_id") REFERENCES "oethapy"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`) + await db.query(`ALTER TABLE "oeth_rebase_option" ADD CONSTRAINT "FK_034428879698039839b4ba6ffe8" FOREIGN KEY ("address_id") REFERENCES "oeth_address"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`) + await db.query(`ALTER TABLE "oeth_strategy_holding_daily_stat" ADD CONSTRAINT "FK_4e867f220975e615e6077d860c1" FOREIGN KEY ("strategy_daily_stat_id_id") REFERENCES "oeth_strategy_daily_stat"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`) + await db.query(`ALTER TABLE "oeth_strategy_daily_stat" ADD CONSTRAINT "FK_6c7096c96a000d8471256ca8fc3" FOREIGN KEY ("daily_stat_id_id") REFERENCES "oeth_daily_stat"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`) + await db.query(`ALTER TABLE "oeth_collateral_daily_stat" ADD CONSTRAINT "FK_a90045de50406be7bd56efd3ea4" FOREIGN KEY ("daily_stat_id_id") REFERENCES "oeth_daily_stat"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`) + await db.query(`ALTER TABLE "ousd_history" ADD CONSTRAINT "FK_70291ea600c0c4d67d9bfe6a6bf" FOREIGN KEY ("address_id") REFERENCES "ousd_address"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`) + await db.query(`ALTER TABLE "ousd_rebase" ADD CONSTRAINT "FK_427468c97f9838b804efd6c8e55" FOREIGN KEY ("apy_id") REFERENCES "ousdapy"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`) + await db.query(`ALTER TABLE "ousd_rebase_option" ADD CONSTRAINT "FK_b04173f9349ddd991a3b60e914a" FOREIGN KEY ("address_id") REFERENCES "ousd_address"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`) + } + + async down(db) { + await db.query(`DROP TABLE "exchange_rate"`) + await db.query(`DROP INDEX "public"."IDX_9e23a3f1bf3634820c873a0fe8"`) + await db.query(`DROP INDEX "public"."IDX_c61a93768eed9e58ce399bbe01"`) + await db.query(`DROP TABLE "balance"`) + await db.query(`DROP INDEX "public"."IDX_a956b410c329b8eca7898c3c51"`) + await db.query(`DROP INDEX "public"."IDX_6b451b59c9f6a6fdd685f530b2"`) + await db.query(`DROP TABLE "strategy_balance"`) + await db.query(`DROP INDEX "public"."IDX_0113bf0b63183bea0d22cd0d08"`) + await db.query(`DROP INDEX "public"."IDX_a88065dcd92011698bbe7df7b1"`) + await db.query(`DROP TABLE "strategy_yield"`) + await db.query(`DROP INDEX "public"."IDX_5108f2a2563d5665892d0c06b0"`) + await db.query(`DROP INDEX "public"."IDX_41c3567c9d43c598e07a0029c5"`) + await db.query(`DROP TABLE "curve_pool_balance"`) + await db.query(`DROP INDEX "public"."IDX_ffb0d0f86f03faacef7cb3e092"`) + await db.query(`DROP INDEX "public"."IDX_db5522c865eb8ed76fa7aeb4a8"`) + await db.query(`DROP TABLE "oeth"`) + await db.query(`DROP INDEX "public"."IDX_5b81a67229bac2d68e0dc92cc4"`) + await db.query(`DROP INDEX "public"."IDX_408e5f79f83093aa5cf2b0ea32"`) + await db.query(`DROP TABLE "oeth_history"`) + await db.query(`DROP INDEX "public"."IDX_94e47c4c49128c78f60b185b46"`) + await db.query(`DROP INDEX "public"."IDX_96956b1c8d29eb7066a97d5ea7"`) + await db.query(`DROP INDEX "public"."IDX_b14170bdb7fbc0775bf55df15d"`) + await db.query(`DROP TABLE "oeth_address"`) + await db.query(`DROP TABLE "oethapy"`) + await db.query(`DROP INDEX "public"."IDX_b1a448045d1ed9d655b679a371"`) + await db.query(`DROP INDEX "public"."IDX_6b8a7a706a0701e659a7d81508"`) + await db.query(`DROP INDEX "public"."IDX_c0c03168bb0139e3cffda4f00e"`) + await db.query(`DROP TABLE "oeth_rebase"`) + await db.query(`DROP INDEX "public"."IDX_fbb7b3f2fff9896eb683b86de7"`) + await db.query(`DROP INDEX "public"."IDX_d3255d02d9407bba89380d01fa"`) + await db.query(`DROP INDEX "public"."IDX_8b6bb0243472af88612fe6a01f"`) + await db.query(`DROP INDEX "public"."IDX_3331819842173de7c27c046547"`) + await db.query(`DROP TABLE "oeth_rebase_option"`) + await db.query(`DROP INDEX "public"."IDX_1fc6bbd88037bfbf4361776909"`) + await db.query(`DROP INDEX "public"."IDX_cbb7ceb49ef7c45432d0171296"`) + await db.query(`DROP INDEX "public"."IDX_355826dadaacc5ae2d63c82f28"`) + await db.query(`DROP INDEX "public"."IDX_034428879698039839b4ba6ffe"`) + await db.query(`DROP TABLE "oeth_vault"`) + await db.query(`DROP INDEX "public"."IDX_d6298a294864b4eaf793cf35a4"`) + await db.query(`DROP INDEX "public"."IDX_e20cb507a673817b2c68720415"`) + await db.query(`DROP TABLE "oeth_curve_lp"`) + await db.query(`DROP INDEX "public"."IDX_d9bbd20e888fa1b4b2c5d2f039"`) + await db.query(`DROP INDEX "public"."IDX_7617d593c36dce1b1565a8d74a"`) + await db.query(`DROP TABLE "oeth_frax_staking"`) + await db.query(`DROP INDEX "public"."IDX_ce6c2c65e90967dfeaac97025b"`) + await db.query(`DROP INDEX "public"."IDX_1a7f7d650390e2f9c212651e05"`) + await db.query(`DROP TABLE "oeth_morpho_aave"`) + await db.query(`DROP INDEX "public"."IDX_25e239b985844f1d33fac79981"`) + await db.query(`DROP INDEX "public"."IDX_a6662224e95eb6921bb14cb5f9"`) + await db.query(`DROP TABLE "oeth_dripper"`) + await db.query(`DROP INDEX "public"."IDX_16ac742ceeb05d28e530da9649"`) + await db.query(`DROP INDEX "public"."IDX_d356832c14603916a492608e7b"`) + await db.query(`DROP TABLE "oeth_balancer_meta_pool_strategy"`) + await db.query(`DROP INDEX "public"."IDX_5e7ef383756fa18cb602f50089"`) + await db.query(`DROP INDEX "public"."IDX_11d344b3e0e03cdb6697dd61f7"`) + await db.query(`DROP TABLE "oeth_strategy_holding_daily_stat"`) + await db.query(`DROP INDEX "public"."IDX_4e867f220975e615e6077d860c"`) + await db.query(`DROP TABLE "oeth_strategy_daily_stat"`) + await db.query(`DROP INDEX "public"."IDX_6c7096c96a000d8471256ca8fc"`) + await db.query(`DROP TABLE "oeth_collateral_daily_stat"`) + await db.query(`DROP INDEX "public"."IDX_a90045de50406be7bd56efd3ea"`) + await db.query(`DROP TABLE "oeth_daily_stat"`) + await db.query(`DROP INDEX "public"."IDX_98d9001013aa37425ca47b7126"`) + await db.query(`DROP INDEX "public"."IDX_c3e66051c7df4efd6a8fa8f9c1"`) + await db.query(`DROP TABLE "oeth_reward_token_collected"`) + await db.query(`DROP INDEX "public"."IDX_81a9fa43ae4a6ae63e4103127b"`) + await db.query(`DROP INDEX "public"."IDX_d36c78b9c3e9d737f067638bc4"`) + await db.query(`DROP TABLE "ogv"`) + await db.query(`DROP INDEX "public"."IDX_2418a8b8b92b2f5977be761cf9"`) + await db.query(`DROP INDEX "public"."IDX_b8f20bcf48e4aa77e0f48d77db"`) + await db.query(`DROP TABLE "staked_ogv"`) + await db.query(`DROP INDEX "public"."IDX_533195c60cfaef9e118789dee9"`) + await db.query(`DROP INDEX "public"."IDX_d601233411a33212b9d616aab0"`) + await db.query(`DROP TABLE "ogv_governance"`) + await db.query(`DROP INDEX "public"."IDX_a0329e7109d5959b9aa3d9d374"`) + await db.query(`DROP INDEX "public"."IDX_63cd1ca46771965c68f6b85898"`) + await db.query(`DROP TABLE "ousd"`) + await db.query(`DROP INDEX "public"."IDX_c8d1e285213b445b088805ac7c"`) + await db.query(`DROP INDEX "public"."IDX_806949dd853b7e8acab5d03b81"`) + await db.query(`DROP TABLE "ousd_history"`) + await db.query(`DROP INDEX "public"."IDX_70291ea600c0c4d67d9bfe6a6b"`) + await db.query(`DROP INDEX "public"."IDX_4d00d283e1ce3209dc43a0313c"`) + await db.query(`DROP INDEX "public"."IDX_0c25caa59aa053a688a723d160"`) + await db.query(`DROP TABLE "ousd_address"`) + await db.query(`DROP TABLE "ousdapy"`) + await db.query(`DROP INDEX "public"."IDX_c514963f42908ce84d65a84a77"`) + await db.query(`DROP INDEX "public"."IDX_4f606414b3b5ce1a366bd0fbf6"`) + await db.query(`DROP INDEX "public"."IDX_0e84a81a109b66fe6f01f77c74"`) + await db.query(`DROP TABLE "ousd_rebase"`) + await db.query(`DROP INDEX "public"."IDX_f8eb4a16ce58a146b3227ee21a"`) + await db.query(`DROP INDEX "public"."IDX_3fb03b1a410e64c7367226d0b6"`) + await db.query(`DROP INDEX "public"."IDX_1a76c478199672aaeec340f619"`) + await db.query(`DROP INDEX "public"."IDX_427468c97f9838b804efd6c8e5"`) + await db.query(`DROP TABLE "ousd_rebase_option"`) + await db.query(`DROP INDEX "public"."IDX_64bd23947dc4c67e3b6a3f9352"`) + await db.query(`DROP INDEX "public"."IDX_9b774e46b8b1cf7f828133809a"`) + await db.query(`DROP INDEX "public"."IDX_4e95bf069de04533d83a9a97fd"`) + await db.query(`DROP INDEX "public"."IDX_b04173f9349ddd991a3b60e914"`) + await db.query(`DROP TABLE "ousd_vault"`) + await db.query(`DROP INDEX "public"."IDX_6860186ea2f56e2c7d54c22107"`) + await db.query(`DROP INDEX "public"."IDX_0d0a7113a505cf7f7adea9ca81"`) + await db.query(`DROP TABLE "ousd_morpho_aave"`) + await db.query(`DROP INDEX "public"."IDX_78e0701c2e9a28242db37bd8f8"`) + await db.query(`DROP INDEX "public"."IDX_46ccf673b376d654052fbd53e6"`) + await db.query(`DROP TABLE "ousd_morpho_compound"`) + await db.query(`DROP INDEX "public"."IDX_9e7bd0d8ae23b877d5979ef80c"`) + await db.query(`DROP INDEX "public"."IDX_0bb3a0ad84071f1d80f6d4e90f"`) + await db.query(`DROP TABLE "maker_dsr_strategy"`) + await db.query(`DROP INDEX "public"."IDX_a35308a3c5dbaab2d321eb1525"`) + await db.query(`DROP INDEX "public"."IDX_844b219d8faf9b1d24ab2dba9a"`) + await db.query(`DROP TABLE "ousd_flux_strategy"`) + await db.query(`DROP INDEX "public"."IDX_5b165b5d30b13e363d33a66e14"`) + await db.query(`DROP INDEX "public"."IDX_80f3392968fde7b99cccb805ac"`) + await db.query(`DROP TABLE "ousd_compound_strategy"`) + await db.query(`DROP INDEX "public"."IDX_6920b1db5dc577295ac4d1379d"`) + await db.query(`DROP INDEX "public"."IDX_89c6d7d3104bd36dc88a37add4"`) + await db.query(`DROP TABLE "ousd_convex_strategy"`) + await db.query(`DROP INDEX "public"."IDX_2deac473cd0b2dd7082e7da148"`) + await db.query(`DROP INDEX "public"."IDX_157bf74171817dc5c60ee37036"`) + await db.query(`DROP TABLE "ousd_aave_strategy"`) + await db.query(`DROP INDEX "public"."IDX_ca34b5a0a33bc9abdd8213c2fa"`) + await db.query(`DROP INDEX "public"."IDX_dacd7c98223d7bc8be074d71e4"`) + await db.query(`DROP TABLE "ousd_meta_strategy"`) + await db.query(`DROP INDEX "public"."IDX_7e998dcf775263bc5df76ef987"`) + await db.query(`DROP INDEX "public"."IDX_55ce185680512d6a5b9fb0af89"`) + await db.query(`DROP TABLE "ousd_convex_lusd_plus3_crv"`) + await db.query(`DROP INDEX "public"."IDX_0783af95efb35fb3f13cde1656"`) + await db.query(`DROP INDEX "public"."IDX_74ae01fb596a4f2733087ba454"`) + await db.query(`ALTER TABLE "oeth_history" DROP CONSTRAINT "FK_94e47c4c49128c78f60b185b46b"`) + await db.query(`ALTER TABLE "oeth_rebase" DROP CONSTRAINT "FK_3331819842173de7c27c046547a"`) + await db.query(`ALTER TABLE "oeth_rebase_option" DROP CONSTRAINT "FK_034428879698039839b4ba6ffe8"`) + await db.query(`ALTER TABLE "oeth_strategy_holding_daily_stat" DROP CONSTRAINT "FK_4e867f220975e615e6077d860c1"`) + await db.query(`ALTER TABLE "oeth_strategy_daily_stat" DROP CONSTRAINT "FK_6c7096c96a000d8471256ca8fc3"`) + await db.query(`ALTER TABLE "oeth_collateral_daily_stat" DROP CONSTRAINT "FK_a90045de50406be7bd56efd3ea4"`) + await db.query(`ALTER TABLE "ousd_history" DROP CONSTRAINT "FK_70291ea600c0c4d67d9bfe6a6bf"`) + await db.query(`ALTER TABLE "ousd_rebase" DROP CONSTRAINT "FK_427468c97f9838b804efd6c8e55"`) + await db.query(`ALTER TABLE "ousd_rebase_option" DROP CONSTRAINT "FK_b04173f9349ddd991a3b60e914a"`) + } +} From 4cc6d62add1d4982ccf4df4174cbd7e7e318fb67 Mon Sep 17 00:00:00 2001 From: Chris Jacobs Date: Sat, 4 Nov 2023 11:16:39 -0700 Subject: [PATCH 07/34] wip on daily earnings with APY --- abi/frx-eth-frax-oracle.json | 570 ++++++++++++++++++ db/migrations/1698864698478-Data.js | 283 --------- schema-base.graphql | 17 + schema.graphql | 17 + src/main-oeth.ts | 20 +- src/model/generated/index.ts | 1 + .../generated/strategyDailyYield.model.ts | 44 ++ src/model/generated/strategyYield.model.ts | 3 + src/oeth/processors/strategies/strategies.ts | 28 +- .../exchange-rates/currencies.ts | 24 +- .../exchange-rates/exchange-rates.ts | 7 +- .../exchange-rates/price-routing.ts | 54 +- .../strategy-rewards/strategy-rewards.ts | 2 +- .../strategy/strategy-balancer.ts | 51 +- .../strategy/strategy-curve-amo.ts | 25 +- .../strategy/strategy-daily-earnings.ts | 129 ++++ .../strategy/strategy-earnings.ts | 260 ++++---- .../strategy/strategy-generic.ts | 21 +- src/utils/addresses.ts | 3 + src/utils/blockFrequencyUpdater.ts | 29 +- src/utils/calculateAPY.ts | 31 +- src/utils/utils.ts | 10 + 22 files changed, 1118 insertions(+), 511 deletions(-) create mode 100644 abi/frx-eth-frax-oracle.json delete mode 100644 db/migrations/1698864698478-Data.js create mode 100644 src/model/generated/strategyDailyYield.model.ts create mode 100644 src/shared/processor-templates/strategy/strategy-daily-earnings.ts diff --git a/abi/frx-eth-frax-oracle.json b/abi/frx-eth-frax-oracle.json new file mode 100644 index 00000000..161c8d44 --- /dev/null +++ b/abi/frx-eth-frax-oracle.json @@ -0,0 +1,570 @@ +[ + { + "inputs": [ + { + "components": [ + { + "internalType": "address", + "name": "timelockAddress", + "type": "address" + }, + { + "internalType": "address", + "name": "baseErc20", + "type": "address" + }, + { + "internalType": "address", + "name": "quoteErc20", + "type": "address" + }, + { + "internalType": "address", + "name": "priceSource", + "type": "address" + }, + { + "internalType": "uint256", + "name": "maximumDeviation", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "maximumOracleDelay", + "type": "uint256" + } + ], + "internalType": "struct ConstructorParams", + "name": "_params", + "type": "tuple" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [], + "name": "CalledWithFutureTimestamp", + "type": "error" + }, + { + "inputs": [], + "name": "CalledWithTimestampBeforePreviousRound", + "type": "error" + }, + { + "inputs": [], + "name": "NoPriceData", + "type": "error" + }, + { + "inputs": [], + "name": "OnlyPendingTimelock", + "type": "error" + }, + { + "inputs": [], + "name": "OnlyPriceSource", + "type": "error" + }, + { + "inputs": [], + "name": "OnlyTimelock", + "type": "error" + }, + { + "inputs": [], + "name": "SameMaximumDeviation", + "type": "error" + }, + { + "inputs": [], + "name": "SameMaximumOracleDelay", + "type": "error" + }, + { + "inputs": [], + "name": "SamePriceSource", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "oldMaxDeviation", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newMaxDeviation", + "type": "uint256" + } + ], + "name": "SetMaximumDeviation", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "oldMaxOracleDelay", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newMaxOracleDelay", + "type": "uint256" + } + ], + "name": "SetMaximumOracleDelay", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "oldPriceSource", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "newPriceSource", + "type": "address" + } + ], + "name": "SetPriceSource", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousTimelock", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newTimelock", + "type": "address" + } + ], + "name": "TimelockTransferStarted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousTimelock", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newTimelock", + "type": "address" + } + ], + "name": "TimelockTransferred", + "type": "event" + }, + { + "inputs": [], + "name": "BASE_TOKEN", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "QUOTE_TOKEN", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "acceptTransferTimelock", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bool", + "name": "_isBadData", + "type": "bool" + }, + { + "internalType": "uint104", + "name": "_priceLow", + "type": "uint104" + }, + { + "internalType": "uint104", + "name": "_priceHigh", + "type": "uint104" + }, + { + "internalType": "uint40", + "name": "_timestamp", + "type": "uint40" + } + ], + "name": "addRoundData", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "decimals", + "outputs": [ + { + "internalType": "uint8", + "name": "_decimals", + "type": "uint8" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [], + "name": "description", + "outputs": [ + { + "internalType": "string", + "name": "_description", + "type": "string" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [], + "name": "getPrices", + "outputs": [ + { + "internalType": "bool", + "name": "_isBadData", + "type": "bool" + }, + { + "internalType": "uint256", + "name": "_priceLow", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_priceHigh", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint80", + "name": "_roundId", + "type": "uint80" + } + ], + "name": "getRoundData", + "outputs": [ + { + "internalType": "uint80", + "name": "roundId", + "type": "uint80" + }, + { + "internalType": "int256", + "name": "answer", + "type": "int256" + }, + { + "internalType": "uint256", + "name": "startedAt", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "updatedAt", + "type": "uint256" + }, + { + "internalType": "uint80", + "name": "answeredInRound", + "type": "uint80" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "lastCorrectRoundId", + "outputs": [ + { + "internalType": "uint80", + "name": "", + "type": "uint80" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "latestRoundData", + "outputs": [ + { + "internalType": "uint80", + "name": "roundId", + "type": "uint80" + }, + { + "internalType": "int256", + "name": "answer", + "type": "int256" + }, + { + "internalType": "uint256", + "name": "startedAt", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "updatedAt", + "type": "uint256" + }, + { + "internalType": "uint80", + "name": "answeredInRound", + "type": "uint80" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "maximumDeviation", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "maximumOracleDelay", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "pendingTimelockAddress", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "priceSource", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "renounceTimelock", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "rounds", + "outputs": [ + { + "internalType": "uint104", + "name": "priceLow", + "type": "uint104" + }, + { + "internalType": "uint104", + "name": "priceHigh", + "type": "uint104" + }, + { + "internalType": "uint40", + "name": "timestamp", + "type": "uint40" + }, + { + "internalType": "bool", + "name": "isBadData", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_newMaxDeviation", + "type": "uint256" + } + ], + "name": "setMaximumDeviation", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_newMaxOracleDelay", + "type": "uint256" + } + ], + "name": "setMaximumOracleDelay", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_newPriceSource", + "type": "address" + } + ], + "name": "setPriceSource", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "interfaceId", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "timelockAddress", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_newTimelock", + "type": "address" + } + ], + "name": "transferTimelock", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "version", + "outputs": [ + { + "internalType": "uint256", + "name": "_version", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + } +] \ No newline at end of file diff --git a/db/migrations/1698864698478-Data.js b/db/migrations/1698864698478-Data.js deleted file mode 100644 index 05a8dcd6..00000000 --- a/db/migrations/1698864698478-Data.js +++ /dev/null @@ -1,283 +0,0 @@ -module.exports = class Data1698864698478 { - name = 'Data1698864698478' - - async up(db) { - await db.query(`CREATE TABLE "exchange_rate" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "pair" text NOT NULL, "base" text NOT NULL, "quote" text NOT NULL, "rate" numeric NOT NULL, CONSTRAINT "PK_5c5d27d2b900ef6cdeef0398472" PRIMARY KEY ("id"))`) - await db.query(`CREATE INDEX "IDX_9e23a3f1bf3634820c873a0fe8" ON "exchange_rate" ("timestamp") `) - await db.query(`CREATE INDEX "IDX_c61a93768eed9e58ce399bbe01" ON "exchange_rate" ("block_number") `) - await db.query(`CREATE TABLE "balance" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "token" text NOT NULL, "address" text NOT NULL, "balance" numeric NOT NULL, CONSTRAINT "PK_079dddd31a81672e8143a649ca0" PRIMARY KEY ("id"))`) - await db.query(`CREATE INDEX "IDX_a956b410c329b8eca7898c3c51" ON "balance" ("timestamp") `) - await db.query(`CREATE INDEX "IDX_6b451b59c9f6a6fdd685f530b2" ON "balance" ("block_number") `) - await db.query(`CREATE TABLE "strategy_balance" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "strategy" text NOT NULL, "asset" text NOT NULL, "balance" numeric NOT NULL, CONSTRAINT "PK_ca6f93229d1392e9546d01dae4f" PRIMARY KEY ("id"))`) - await db.query(`CREATE INDEX "IDX_0113bf0b63183bea0d22cd0d08" ON "strategy_balance" ("timestamp") `) - await db.query(`CREATE INDEX "IDX_a88065dcd92011698bbe7df7b1" ON "strategy_balance" ("block_number") `) - await db.query(`CREATE TABLE "strategy_yield" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "strategy" text NOT NULL, "asset" text NOT NULL, "balance" numeric NOT NULL, "earnings" numeric NOT NULL, CONSTRAINT "PK_e87c46575e870fe2202190c2728" PRIMARY KEY ("id"))`) - await db.query(`CREATE INDEX "IDX_5108f2a2563d5665892d0c06b0" ON "strategy_yield" ("timestamp") `) - await db.query(`CREATE INDEX "IDX_41c3567c9d43c598e07a0029c5" ON "strategy_yield" ("block_number") `) - await db.query(`CREATE TABLE "curve_pool_balance" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "address" text NOT NULL, "balance0" numeric NOT NULL, "balance1" numeric NOT NULL, "balance2" numeric NOT NULL, CONSTRAINT "PK_40412750bb910ca560aa084dd88" PRIMARY KEY ("id"))`) - await db.query(`CREATE INDEX "IDX_ffb0d0f86f03faacef7cb3e092" ON "curve_pool_balance" ("timestamp") `) - await db.query(`CREATE INDEX "IDX_db5522c865eb8ed76fa7aeb4a8" ON "curve_pool_balance" ("block_number") `) - await db.query(`CREATE TABLE "oeth" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "total_supply" numeric NOT NULL, "rebasing_supply" numeric NOT NULL, "non_rebasing_supply" numeric NOT NULL, CONSTRAINT "PK_de1d885501070dbd1ab6f8577ba" PRIMARY KEY ("id"))`) - await db.query(`CREATE INDEX "IDX_5b81a67229bac2d68e0dc92cc4" ON "oeth" ("timestamp") `) - await db.query(`CREATE INDEX "IDX_408e5f79f83093aa5cf2b0ea32" ON "oeth" ("block_number") `) - await db.query(`CREATE TABLE "oeth_history" ("id" character varying NOT NULL, "value" numeric NOT NULL, "balance" numeric NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "tx_hash" text NOT NULL, "type" character varying(8) NOT NULL, "address_id" character varying, CONSTRAINT "PK_2c7e7571cd9ea02b07a27a303f3" PRIMARY KEY ("id"))`) - await db.query(`CREATE INDEX "IDX_94e47c4c49128c78f60b185b46" ON "oeth_history" ("address_id") `) - await db.query(`CREATE INDEX "IDX_96956b1c8d29eb7066a97d5ea7" ON "oeth_history" ("block_number") `) - await db.query(`CREATE INDEX "IDX_b14170bdb7fbc0775bf55df15d" ON "oeth_history" ("tx_hash") `) - await db.query(`CREATE TABLE "oeth_address" ("id" character varying NOT NULL, "is_contract" boolean NOT NULL, "rebasing_option" character varying(6) NOT NULL, "balance" numeric NOT NULL, "earned" numeric NOT NULL, "credits" numeric NOT NULL, "last_updated" TIMESTAMP WITH TIME ZONE NOT NULL, CONSTRAINT "PK_92a966afe47d584af73ce77a1cd" PRIMARY KEY ("id"))`) - await db.query(`CREATE TABLE "oethapy" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "tx_hash" text NOT NULL, "apr" numeric NOT NULL, "apy" numeric NOT NULL, "apy7_day_avg" numeric NOT NULL, "apy14_day_avg" numeric NOT NULL, "apy30_day_avg" numeric NOT NULL, "rebasing_credits_per_token" numeric NOT NULL, CONSTRAINT "PK_8dbb4d04591848361200f18f62a" PRIMARY KEY ("id"))`) - await db.query(`CREATE INDEX "IDX_b1a448045d1ed9d655b679a371" ON "oethapy" ("timestamp") `) - await db.query(`CREATE INDEX "IDX_6b8a7a706a0701e659a7d81508" ON "oethapy" ("block_number") `) - await db.query(`CREATE INDEX "IDX_c0c03168bb0139e3cffda4f00e" ON "oethapy" ("tx_hash") `) - await db.query(`CREATE TABLE "oeth_rebase" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "tx_hash" text NOT NULL, "total_supply" numeric NOT NULL, "rebasing_credits" numeric NOT NULL, "rebasing_credits_per_token" numeric NOT NULL, "fee" numeric NOT NULL, "yield" numeric NOT NULL, "apy_id" character varying, CONSTRAINT "PK_5f8f4dd071caf685b4ac2d54de3" PRIMARY KEY ("id"))`) - await db.query(`CREATE INDEX "IDX_fbb7b3f2fff9896eb683b86de7" ON "oeth_rebase" ("timestamp") `) - await db.query(`CREATE INDEX "IDX_d3255d02d9407bba89380d01fa" ON "oeth_rebase" ("block_number") `) - await db.query(`CREATE INDEX "IDX_8b6bb0243472af88612fe6a01f" ON "oeth_rebase" ("tx_hash") `) - await db.query(`CREATE INDEX "IDX_3331819842173de7c27c046547" ON "oeth_rebase" ("apy_id") `) - await db.query(`CREATE TABLE "oeth_rebase_option" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "tx_hash" text NOT NULL, "status" character varying(6) NOT NULL, "address_id" character varying, CONSTRAINT "PK_32971725d5523200b4b3b7c07e5" PRIMARY KEY ("id"))`) - await db.query(`CREATE INDEX "IDX_1fc6bbd88037bfbf4361776909" ON "oeth_rebase_option" ("timestamp") `) - await db.query(`CREATE INDEX "IDX_cbb7ceb49ef7c45432d0171296" ON "oeth_rebase_option" ("block_number") `) - await db.query(`CREATE INDEX "IDX_355826dadaacc5ae2d63c82f28" ON "oeth_rebase_option" ("tx_hash") `) - await db.query(`CREATE INDEX "IDX_034428879698039839b4ba6ffe" ON "oeth_rebase_option" ("address_id") `) - await db.query(`CREATE TABLE "oeth_vault" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "weth" numeric NOT NULL, "st_eth" numeric NOT NULL, "r_eth" numeric NOT NULL, "frx_eth" numeric NOT NULL, CONSTRAINT "PK_9debaa84944fe2be9dc4219ba8f" PRIMARY KEY ("id"))`) - await db.query(`CREATE INDEX "IDX_d6298a294864b4eaf793cf35a4" ON "oeth_vault" ("timestamp") `) - await db.query(`CREATE INDEX "IDX_e20cb507a673817b2c68720415" ON "oeth_vault" ("block_number") `) - await db.query(`CREATE TABLE "oeth_curve_lp" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "total_supply" numeric NOT NULL, "eth" numeric NOT NULL, "oeth" numeric NOT NULL, "total_supply_owned" numeric NOT NULL, "eth_owned" numeric NOT NULL, "oeth_owned" numeric NOT NULL, CONSTRAINT "PK_2b055044664e80f44d6172fdf54" PRIMARY KEY ("id"))`) - await db.query(`CREATE INDEX "IDX_d9bbd20e888fa1b4b2c5d2f039" ON "oeth_curve_lp" ("timestamp") `) - await db.query(`CREATE INDEX "IDX_7617d593c36dce1b1565a8d74a" ON "oeth_curve_lp" ("block_number") `) - await db.query(`CREATE TABLE "oeth_frax_staking" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "sfrx_eth" numeric NOT NULL, CONSTRAINT "PK_694f53c8600ae88c7bdcf7305dd" PRIMARY KEY ("id"))`) - await db.query(`CREATE INDEX "IDX_ce6c2c65e90967dfeaac97025b" ON "oeth_frax_staking" ("timestamp") `) - await db.query(`CREATE INDEX "IDX_1a7f7d650390e2f9c212651e05" ON "oeth_frax_staking" ("block_number") `) - await db.query(`CREATE TABLE "oeth_morpho_aave" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "weth" numeric NOT NULL, CONSTRAINT "PK_86de8f846e9335c92b8ad7df3a1" PRIMARY KEY ("id"))`) - await db.query(`CREATE INDEX "IDX_25e239b985844f1d33fac79981" ON "oeth_morpho_aave" ("timestamp") `) - await db.query(`CREATE INDEX "IDX_a6662224e95eb6921bb14cb5f9" ON "oeth_morpho_aave" ("block_number") `) - await db.query(`CREATE TABLE "oeth_dripper" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "weth" numeric NOT NULL, "last_collect_timestamp" integer NOT NULL, "drip_rate_per_block" numeric NOT NULL, "drip_duration" numeric NOT NULL, CONSTRAINT "PK_77731281c1564c24eff0c265984" PRIMARY KEY ("id"))`) - await db.query(`CREATE INDEX "IDX_16ac742ceeb05d28e530da9649" ON "oeth_dripper" ("timestamp") `) - await db.query(`CREATE INDEX "IDX_d356832c14603916a492608e7b" ON "oeth_dripper" ("block_number") `) - await db.query(`CREATE TABLE "oeth_balancer_meta_pool_strategy" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "r_eth" numeric NOT NULL, "weth" numeric NOT NULL, CONSTRAINT "PK_6ddf5b8ba878e6d706e59bd6de0" PRIMARY KEY ("id"))`) - await db.query(`CREATE INDEX "IDX_5e7ef383756fa18cb602f50089" ON "oeth_balancer_meta_pool_strategy" ("timestamp") `) - await db.query(`CREATE INDEX "IDX_11d344b3e0e03cdb6697dd61f7" ON "oeth_balancer_meta_pool_strategy" ("block_number") `) - await db.query(`CREATE TABLE "oeth_strategy_holding_daily_stat" ("id" character varying NOT NULL, "symbol" text NOT NULL, "amount" numeric NOT NULL, "value" numeric NOT NULL, "strategy_daily_stat_id_id" character varying, CONSTRAINT "PK_7f1a62da5e53cf264c2f39b4acf" PRIMARY KEY ("id"))`) - await db.query(`CREATE INDEX "IDX_4e867f220975e615e6077d860c" ON "oeth_strategy_holding_daily_stat" ("strategy_daily_stat_id_id") `) - await db.query(`CREATE TABLE "oeth_strategy_daily_stat" ("id" character varying NOT NULL, "name" text NOT NULL, "total" numeric NOT NULL, "tvl" numeric NOT NULL, "daily_stat_id_id" character varying, CONSTRAINT "PK_8af1a0c60e67b05baf928787a8e" PRIMARY KEY ("id"))`) - await db.query(`CREATE INDEX "IDX_6c7096c96a000d8471256ca8fc" ON "oeth_strategy_daily_stat" ("daily_stat_id_id") `) - await db.query(`CREATE TABLE "oeth_collateral_daily_stat" ("id" character varying NOT NULL, "symbol" text NOT NULL, "amount" numeric NOT NULL, "price" numeric NOT NULL, "value" numeric NOT NULL, "daily_stat_id_id" character varying, CONSTRAINT "PK_5fb23d7bae30dffe4543e7aa069" PRIMARY KEY ("id"))`) - await db.query(`CREATE INDEX "IDX_a90045de50406be7bd56efd3ea" ON "oeth_collateral_daily_stat" ("daily_stat_id_id") `) - await db.query(`CREATE TABLE "oeth_daily_stat" ("id" character varying NOT NULL, "block_number" integer NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "apr" numeric NOT NULL, "apy" numeric NOT NULL, "apy7_day_avg" numeric NOT NULL, "apy14_day_avg" numeric NOT NULL, "apy30_day_avg" numeric NOT NULL, "total_supply" numeric NOT NULL, "total_supply_usd" numeric NOT NULL, "rebasing_supply" numeric NOT NULL, "non_rebasing_supply" numeric NOT NULL, "amo_supply" numeric NOT NULL, "dripper_weth" numeric NOT NULL, "yield" numeric NOT NULL, "fees" numeric NOT NULL, "revenue" numeric NOT NULL, "revenue7_day_avg" numeric NOT NULL, "revenue7_day_total" numeric NOT NULL, "revenue_all_time" numeric NOT NULL, "peg_price" numeric NOT NULL, CONSTRAINT "PK_9144a02ab13b1baa818a7d5eae5" PRIMARY KEY ("id"))`) - await db.query(`CREATE INDEX "IDX_98d9001013aa37425ca47b7126" ON "oeth_daily_stat" ("block_number") `) - await db.query(`CREATE INDEX "IDX_c3e66051c7df4efd6a8fa8f9c1" ON "oeth_daily_stat" ("timestamp") `) - await db.query(`CREATE TABLE "oeth_reward_token_collected" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "strategy" text NOT NULL, "recipient" text NOT NULL, "reward_token" text NOT NULL, "amount" numeric NOT NULL, CONSTRAINT "PK_47098cc5fbc7cb95c2374fa33cd" PRIMARY KEY ("id"))`) - await db.query(`CREATE INDEX "IDX_81a9fa43ae4a6ae63e4103127b" ON "oeth_reward_token_collected" ("timestamp") `) - await db.query(`CREATE INDEX "IDX_d36c78b9c3e9d737f067638bc4" ON "oeth_reward_token_collected" ("block_number") `) - await db.query(`CREATE TABLE "ogv" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "circulating" numeric NOT NULL, "total" numeric NOT NULL, CONSTRAINT "PK_f16038abf451ce82bd03ea54ee7" PRIMARY KEY ("id"))`) - await db.query(`CREATE INDEX "IDX_2418a8b8b92b2f5977be761cf9" ON "ogv" ("timestamp") `) - await db.query(`CREATE INDEX "IDX_b8f20bcf48e4aa77e0f48d77db" ON "ogv" ("block_number") `) - await db.query(`CREATE TABLE "staked_ogv" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "total" numeric NOT NULL, "apy" numeric NOT NULL, CONSTRAINT "PK_b135611d9aab36c7889982c3be8" PRIMARY KEY ("id"))`) - await db.query(`CREATE INDEX "IDX_533195c60cfaef9e118789dee9" ON "staked_ogv" ("timestamp") `) - await db.query(`CREATE INDEX "IDX_d601233411a33212b9d616aab0" ON "staked_ogv" ("block_number") `) - await db.query(`CREATE TABLE "ogv_governance" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "registered_voters" integer NOT NULL, "open_source_contributors" integer NOT NULL, "improvement_proposals" integer NOT NULL, CONSTRAINT "PK_b22758cd4ee8ff92c1b7ee0cf20" PRIMARY KEY ("id"))`) - await db.query(`CREATE INDEX "IDX_a0329e7109d5959b9aa3d9d374" ON "ogv_governance" ("timestamp") `) - await db.query(`CREATE INDEX "IDX_63cd1ca46771965c68f6b85898" ON "ogv_governance" ("block_number") `) - await db.query(`CREATE TABLE "ousd" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "total_supply" numeric NOT NULL, "rebasing_supply" numeric NOT NULL, "non_rebasing_supply" numeric NOT NULL, CONSTRAINT "PK_acecae4a20bc14b22d9f6738d8d" PRIMARY KEY ("id"))`) - await db.query(`CREATE INDEX "IDX_c8d1e285213b445b088805ac7c" ON "ousd" ("timestamp") `) - await db.query(`CREATE INDEX "IDX_806949dd853b7e8acab5d03b81" ON "ousd" ("block_number") `) - await db.query(`CREATE TABLE "ousd_history" ("id" character varying NOT NULL, "value" numeric NOT NULL, "balance" numeric NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "tx_hash" text NOT NULL, "type" character varying(8) NOT NULL, "address_id" character varying, CONSTRAINT "PK_dcbe3223b67f92d9ad4cffe8a7c" PRIMARY KEY ("id"))`) - await db.query(`CREATE INDEX "IDX_70291ea600c0c4d67d9bfe6a6b" ON "ousd_history" ("address_id") `) - await db.query(`CREATE INDEX "IDX_4d00d283e1ce3209dc43a0313c" ON "ousd_history" ("block_number") `) - await db.query(`CREATE INDEX "IDX_0c25caa59aa053a688a723d160" ON "ousd_history" ("tx_hash") `) - await db.query(`CREATE TABLE "ousd_address" ("id" character varying NOT NULL, "is_contract" boolean NOT NULL, "rebasing_option" character varying(6) NOT NULL, "balance" numeric NOT NULL, "earned" numeric NOT NULL, "credits" numeric NOT NULL, "last_updated" TIMESTAMP WITH TIME ZONE NOT NULL, CONSTRAINT "PK_bb061344757ede566d62854af6a" PRIMARY KEY ("id"))`) - await db.query(`CREATE TABLE "ousdapy" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "tx_hash" text NOT NULL, "apr" numeric NOT NULL, "apy" numeric NOT NULL, "apy7_day_avg" numeric NOT NULL, "apy14_day_avg" numeric NOT NULL, "apy30_day_avg" numeric NOT NULL, "rebasing_credits_per_token" numeric NOT NULL, CONSTRAINT "PK_d9889b7153efc82dbe88f9a7a33" PRIMARY KEY ("id"))`) - await db.query(`CREATE INDEX "IDX_c514963f42908ce84d65a84a77" ON "ousdapy" ("timestamp") `) - await db.query(`CREATE INDEX "IDX_4f606414b3b5ce1a366bd0fbf6" ON "ousdapy" ("block_number") `) - await db.query(`CREATE INDEX "IDX_0e84a81a109b66fe6f01f77c74" ON "ousdapy" ("tx_hash") `) - await db.query(`CREATE TABLE "ousd_rebase" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "tx_hash" text NOT NULL, "total_supply" numeric NOT NULL, "rebasing_credits" numeric NOT NULL, "rebasing_credits_per_token" numeric NOT NULL, "fee" numeric NOT NULL, "yield" numeric NOT NULL, "apy_id" character varying, CONSTRAINT "PK_04cf0de72399a99798dde61b237" PRIMARY KEY ("id"))`) - await db.query(`CREATE INDEX "IDX_f8eb4a16ce58a146b3227ee21a" ON "ousd_rebase" ("timestamp") `) - await db.query(`CREATE INDEX "IDX_3fb03b1a410e64c7367226d0b6" ON "ousd_rebase" ("block_number") `) - await db.query(`CREATE INDEX "IDX_1a76c478199672aaeec340f619" ON "ousd_rebase" ("tx_hash") `) - await db.query(`CREATE INDEX "IDX_427468c97f9838b804efd6c8e5" ON "ousd_rebase" ("apy_id") `) - await db.query(`CREATE TABLE "ousd_rebase_option" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "tx_hash" text NOT NULL, "status" character varying(6) NOT NULL, "address_id" character varying, CONSTRAINT "PK_d684f90866027104f3c929dfe10" PRIMARY KEY ("id"))`) - await db.query(`CREATE INDEX "IDX_64bd23947dc4c67e3b6a3f9352" ON "ousd_rebase_option" ("timestamp") `) - await db.query(`CREATE INDEX "IDX_9b774e46b8b1cf7f828133809a" ON "ousd_rebase_option" ("block_number") `) - await db.query(`CREATE INDEX "IDX_4e95bf069de04533d83a9a97fd" ON "ousd_rebase_option" ("tx_hash") `) - await db.query(`CREATE INDEX "IDX_b04173f9349ddd991a3b60e914" ON "ousd_rebase_option" ("address_id") `) - await db.query(`CREATE TABLE "ousd_vault" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "dai" numeric NOT NULL, "usdt" numeric NOT NULL, "usdc" numeric NOT NULL, CONSTRAINT "PK_343f5538c71a1cd78f1659ef9d3" PRIMARY KEY ("id"))`) - await db.query(`CREATE INDEX "IDX_6860186ea2f56e2c7d54c22107" ON "ousd_vault" ("timestamp") `) - await db.query(`CREATE INDEX "IDX_0d0a7113a505cf7f7adea9ca81" ON "ousd_vault" ("block_number") `) - await db.query(`CREATE TABLE "ousd_morpho_aave" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "dai" numeric NOT NULL, "usdt" numeric NOT NULL, "usdc" numeric NOT NULL, CONSTRAINT "PK_60676cde905a822ba73ff3a5c85" PRIMARY KEY ("id"))`) - await db.query(`CREATE INDEX "IDX_78e0701c2e9a28242db37bd8f8" ON "ousd_morpho_aave" ("timestamp") `) - await db.query(`CREATE INDEX "IDX_46ccf673b376d654052fbd53e6" ON "ousd_morpho_aave" ("block_number") `) - await db.query(`CREATE TABLE "ousd_morpho_compound" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "dai" numeric NOT NULL, "usdt" numeric NOT NULL, "usdc" numeric NOT NULL, CONSTRAINT "PK_5f715d53ef8fc0fad595cacf4fa" PRIMARY KEY ("id"))`) - await db.query(`CREATE INDEX "IDX_9e7bd0d8ae23b877d5979ef80c" ON "ousd_morpho_compound" ("timestamp") `) - await db.query(`CREATE INDEX "IDX_0bb3a0ad84071f1d80f6d4e90f" ON "ousd_morpho_compound" ("block_number") `) - await db.query(`CREATE TABLE "maker_dsr_strategy" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "dai" numeric NOT NULL, CONSTRAINT "PK_196da2d6910009ae04e3542fe22" PRIMARY KEY ("id"))`) - await db.query(`CREATE INDEX "IDX_a35308a3c5dbaab2d321eb1525" ON "maker_dsr_strategy" ("timestamp") `) - await db.query(`CREATE INDEX "IDX_844b219d8faf9b1d24ab2dba9a" ON "maker_dsr_strategy" ("block_number") `) - await db.query(`CREATE TABLE "ousd_flux_strategy" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "dai" numeric NOT NULL, "usdt" numeric NOT NULL, "usdc" numeric NOT NULL, CONSTRAINT "PK_ac977221429e50e4de1ce253a8b" PRIMARY KEY ("id"))`) - await db.query(`CREATE INDEX "IDX_5b165b5d30b13e363d33a66e14" ON "ousd_flux_strategy" ("timestamp") `) - await db.query(`CREATE INDEX "IDX_80f3392968fde7b99cccb805ac" ON "ousd_flux_strategy" ("block_number") `) - await db.query(`CREATE TABLE "ousd_compound_strategy" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "dai" numeric NOT NULL, "usdt" numeric NOT NULL, "usdc" numeric NOT NULL, CONSTRAINT "PK_9030e82bf3479d03c04e0d1919c" PRIMARY KEY ("id"))`) - await db.query(`CREATE INDEX "IDX_6920b1db5dc577295ac4d1379d" ON "ousd_compound_strategy" ("timestamp") `) - await db.query(`CREATE INDEX "IDX_89c6d7d3104bd36dc88a37add4" ON "ousd_compound_strategy" ("block_number") `) - await db.query(`CREATE TABLE "ousd_convex_strategy" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "dai" numeric NOT NULL, "usdt" numeric NOT NULL, "usdc" numeric NOT NULL, CONSTRAINT "PK_2b8f6e749e15e49d8816f1ac949" PRIMARY KEY ("id"))`) - await db.query(`CREATE INDEX "IDX_2deac473cd0b2dd7082e7da148" ON "ousd_convex_strategy" ("timestamp") `) - await db.query(`CREATE INDEX "IDX_157bf74171817dc5c60ee37036" ON "ousd_convex_strategy" ("block_number") `) - await db.query(`CREATE TABLE "ousd_aave_strategy" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "dai" numeric NOT NULL, "usdt" numeric NOT NULL, "usdc" numeric NOT NULL, CONSTRAINT "PK_b4b7ac6e395aa722df500f93623" PRIMARY KEY ("id"))`) - await db.query(`CREATE INDEX "IDX_ca34b5a0a33bc9abdd8213c2fa" ON "ousd_aave_strategy" ("timestamp") `) - await db.query(`CREATE INDEX "IDX_dacd7c98223d7bc8be074d71e4" ON "ousd_aave_strategy" ("block_number") `) - await db.query(`CREATE TABLE "ousd_meta_strategy" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "dai" numeric NOT NULL, "usdt" numeric NOT NULL, "usdc" numeric NOT NULL, CONSTRAINT "PK_d99170af73d86fe74460bbfacc4" PRIMARY KEY ("id"))`) - await db.query(`CREATE INDEX "IDX_7e998dcf775263bc5df76ef987" ON "ousd_meta_strategy" ("timestamp") `) - await db.query(`CREATE INDEX "IDX_55ce185680512d6a5b9fb0af89" ON "ousd_meta_strategy" ("block_number") `) - await db.query(`CREATE TABLE "ousd_convex_lusd_plus3_crv" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "dai" numeric NOT NULL, "usdt" numeric NOT NULL, "usdc" numeric NOT NULL, CONSTRAINT "PK_47290aa5dfa3cc5595f468e2f39" PRIMARY KEY ("id"))`) - await db.query(`CREATE INDEX "IDX_0783af95efb35fb3f13cde1656" ON "ousd_convex_lusd_plus3_crv" ("timestamp") `) - await db.query(`CREATE INDEX "IDX_74ae01fb596a4f2733087ba454" ON "ousd_convex_lusd_plus3_crv" ("block_number") `) - await db.query(`ALTER TABLE "oeth_history" ADD CONSTRAINT "FK_94e47c4c49128c78f60b185b46b" FOREIGN KEY ("address_id") REFERENCES "oeth_address"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`) - await db.query(`ALTER TABLE "oeth_rebase" ADD CONSTRAINT "FK_3331819842173de7c27c046547a" FOREIGN KEY ("apy_id") REFERENCES "oethapy"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`) - await db.query(`ALTER TABLE "oeth_rebase_option" ADD CONSTRAINT "FK_034428879698039839b4ba6ffe8" FOREIGN KEY ("address_id") REFERENCES "oeth_address"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`) - await db.query(`ALTER TABLE "oeth_strategy_holding_daily_stat" ADD CONSTRAINT "FK_4e867f220975e615e6077d860c1" FOREIGN KEY ("strategy_daily_stat_id_id") REFERENCES "oeth_strategy_daily_stat"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`) - await db.query(`ALTER TABLE "oeth_strategy_daily_stat" ADD CONSTRAINT "FK_6c7096c96a000d8471256ca8fc3" FOREIGN KEY ("daily_stat_id_id") REFERENCES "oeth_daily_stat"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`) - await db.query(`ALTER TABLE "oeth_collateral_daily_stat" ADD CONSTRAINT "FK_a90045de50406be7bd56efd3ea4" FOREIGN KEY ("daily_stat_id_id") REFERENCES "oeth_daily_stat"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`) - await db.query(`ALTER TABLE "ousd_history" ADD CONSTRAINT "FK_70291ea600c0c4d67d9bfe6a6bf" FOREIGN KEY ("address_id") REFERENCES "ousd_address"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`) - await db.query(`ALTER TABLE "ousd_rebase" ADD CONSTRAINT "FK_427468c97f9838b804efd6c8e55" FOREIGN KEY ("apy_id") REFERENCES "ousdapy"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`) - await db.query(`ALTER TABLE "ousd_rebase_option" ADD CONSTRAINT "FK_b04173f9349ddd991a3b60e914a" FOREIGN KEY ("address_id") REFERENCES "ousd_address"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`) - } - - async down(db) { - await db.query(`DROP TABLE "exchange_rate"`) - await db.query(`DROP INDEX "public"."IDX_9e23a3f1bf3634820c873a0fe8"`) - await db.query(`DROP INDEX "public"."IDX_c61a93768eed9e58ce399bbe01"`) - await db.query(`DROP TABLE "balance"`) - await db.query(`DROP INDEX "public"."IDX_a956b410c329b8eca7898c3c51"`) - await db.query(`DROP INDEX "public"."IDX_6b451b59c9f6a6fdd685f530b2"`) - await db.query(`DROP TABLE "strategy_balance"`) - await db.query(`DROP INDEX "public"."IDX_0113bf0b63183bea0d22cd0d08"`) - await db.query(`DROP INDEX "public"."IDX_a88065dcd92011698bbe7df7b1"`) - await db.query(`DROP TABLE "strategy_yield"`) - await db.query(`DROP INDEX "public"."IDX_5108f2a2563d5665892d0c06b0"`) - await db.query(`DROP INDEX "public"."IDX_41c3567c9d43c598e07a0029c5"`) - await db.query(`DROP TABLE "curve_pool_balance"`) - await db.query(`DROP INDEX "public"."IDX_ffb0d0f86f03faacef7cb3e092"`) - await db.query(`DROP INDEX "public"."IDX_db5522c865eb8ed76fa7aeb4a8"`) - await db.query(`DROP TABLE "oeth"`) - await db.query(`DROP INDEX "public"."IDX_5b81a67229bac2d68e0dc92cc4"`) - await db.query(`DROP INDEX "public"."IDX_408e5f79f83093aa5cf2b0ea32"`) - await db.query(`DROP TABLE "oeth_history"`) - await db.query(`DROP INDEX "public"."IDX_94e47c4c49128c78f60b185b46"`) - await db.query(`DROP INDEX "public"."IDX_96956b1c8d29eb7066a97d5ea7"`) - await db.query(`DROP INDEX "public"."IDX_b14170bdb7fbc0775bf55df15d"`) - await db.query(`DROP TABLE "oeth_address"`) - await db.query(`DROP TABLE "oethapy"`) - await db.query(`DROP INDEX "public"."IDX_b1a448045d1ed9d655b679a371"`) - await db.query(`DROP INDEX "public"."IDX_6b8a7a706a0701e659a7d81508"`) - await db.query(`DROP INDEX "public"."IDX_c0c03168bb0139e3cffda4f00e"`) - await db.query(`DROP TABLE "oeth_rebase"`) - await db.query(`DROP INDEX "public"."IDX_fbb7b3f2fff9896eb683b86de7"`) - await db.query(`DROP INDEX "public"."IDX_d3255d02d9407bba89380d01fa"`) - await db.query(`DROP INDEX "public"."IDX_8b6bb0243472af88612fe6a01f"`) - await db.query(`DROP INDEX "public"."IDX_3331819842173de7c27c046547"`) - await db.query(`DROP TABLE "oeth_rebase_option"`) - await db.query(`DROP INDEX "public"."IDX_1fc6bbd88037bfbf4361776909"`) - await db.query(`DROP INDEX "public"."IDX_cbb7ceb49ef7c45432d0171296"`) - await db.query(`DROP INDEX "public"."IDX_355826dadaacc5ae2d63c82f28"`) - await db.query(`DROP INDEX "public"."IDX_034428879698039839b4ba6ffe"`) - await db.query(`DROP TABLE "oeth_vault"`) - await db.query(`DROP INDEX "public"."IDX_d6298a294864b4eaf793cf35a4"`) - await db.query(`DROP INDEX "public"."IDX_e20cb507a673817b2c68720415"`) - await db.query(`DROP TABLE "oeth_curve_lp"`) - await db.query(`DROP INDEX "public"."IDX_d9bbd20e888fa1b4b2c5d2f039"`) - await db.query(`DROP INDEX "public"."IDX_7617d593c36dce1b1565a8d74a"`) - await db.query(`DROP TABLE "oeth_frax_staking"`) - await db.query(`DROP INDEX "public"."IDX_ce6c2c65e90967dfeaac97025b"`) - await db.query(`DROP INDEX "public"."IDX_1a7f7d650390e2f9c212651e05"`) - await db.query(`DROP TABLE "oeth_morpho_aave"`) - await db.query(`DROP INDEX "public"."IDX_25e239b985844f1d33fac79981"`) - await db.query(`DROP INDEX "public"."IDX_a6662224e95eb6921bb14cb5f9"`) - await db.query(`DROP TABLE "oeth_dripper"`) - await db.query(`DROP INDEX "public"."IDX_16ac742ceeb05d28e530da9649"`) - await db.query(`DROP INDEX "public"."IDX_d356832c14603916a492608e7b"`) - await db.query(`DROP TABLE "oeth_balancer_meta_pool_strategy"`) - await db.query(`DROP INDEX "public"."IDX_5e7ef383756fa18cb602f50089"`) - await db.query(`DROP INDEX "public"."IDX_11d344b3e0e03cdb6697dd61f7"`) - await db.query(`DROP TABLE "oeth_strategy_holding_daily_stat"`) - await db.query(`DROP INDEX "public"."IDX_4e867f220975e615e6077d860c"`) - await db.query(`DROP TABLE "oeth_strategy_daily_stat"`) - await db.query(`DROP INDEX "public"."IDX_6c7096c96a000d8471256ca8fc"`) - await db.query(`DROP TABLE "oeth_collateral_daily_stat"`) - await db.query(`DROP INDEX "public"."IDX_a90045de50406be7bd56efd3ea"`) - await db.query(`DROP TABLE "oeth_daily_stat"`) - await db.query(`DROP INDEX "public"."IDX_98d9001013aa37425ca47b7126"`) - await db.query(`DROP INDEX "public"."IDX_c3e66051c7df4efd6a8fa8f9c1"`) - await db.query(`DROP TABLE "oeth_reward_token_collected"`) - await db.query(`DROP INDEX "public"."IDX_81a9fa43ae4a6ae63e4103127b"`) - await db.query(`DROP INDEX "public"."IDX_d36c78b9c3e9d737f067638bc4"`) - await db.query(`DROP TABLE "ogv"`) - await db.query(`DROP INDEX "public"."IDX_2418a8b8b92b2f5977be761cf9"`) - await db.query(`DROP INDEX "public"."IDX_b8f20bcf48e4aa77e0f48d77db"`) - await db.query(`DROP TABLE "staked_ogv"`) - await db.query(`DROP INDEX "public"."IDX_533195c60cfaef9e118789dee9"`) - await db.query(`DROP INDEX "public"."IDX_d601233411a33212b9d616aab0"`) - await db.query(`DROP TABLE "ogv_governance"`) - await db.query(`DROP INDEX "public"."IDX_a0329e7109d5959b9aa3d9d374"`) - await db.query(`DROP INDEX "public"."IDX_63cd1ca46771965c68f6b85898"`) - await db.query(`DROP TABLE "ousd"`) - await db.query(`DROP INDEX "public"."IDX_c8d1e285213b445b088805ac7c"`) - await db.query(`DROP INDEX "public"."IDX_806949dd853b7e8acab5d03b81"`) - await db.query(`DROP TABLE "ousd_history"`) - await db.query(`DROP INDEX "public"."IDX_70291ea600c0c4d67d9bfe6a6b"`) - await db.query(`DROP INDEX "public"."IDX_4d00d283e1ce3209dc43a0313c"`) - await db.query(`DROP INDEX "public"."IDX_0c25caa59aa053a688a723d160"`) - await db.query(`DROP TABLE "ousd_address"`) - await db.query(`DROP TABLE "ousdapy"`) - await db.query(`DROP INDEX "public"."IDX_c514963f42908ce84d65a84a77"`) - await db.query(`DROP INDEX "public"."IDX_4f606414b3b5ce1a366bd0fbf6"`) - await db.query(`DROP INDEX "public"."IDX_0e84a81a109b66fe6f01f77c74"`) - await db.query(`DROP TABLE "ousd_rebase"`) - await db.query(`DROP INDEX "public"."IDX_f8eb4a16ce58a146b3227ee21a"`) - await db.query(`DROP INDEX "public"."IDX_3fb03b1a410e64c7367226d0b6"`) - await db.query(`DROP INDEX "public"."IDX_1a76c478199672aaeec340f619"`) - await db.query(`DROP INDEX "public"."IDX_427468c97f9838b804efd6c8e5"`) - await db.query(`DROP TABLE "ousd_rebase_option"`) - await db.query(`DROP INDEX "public"."IDX_64bd23947dc4c67e3b6a3f9352"`) - await db.query(`DROP INDEX "public"."IDX_9b774e46b8b1cf7f828133809a"`) - await db.query(`DROP INDEX "public"."IDX_4e95bf069de04533d83a9a97fd"`) - await db.query(`DROP INDEX "public"."IDX_b04173f9349ddd991a3b60e914"`) - await db.query(`DROP TABLE "ousd_vault"`) - await db.query(`DROP INDEX "public"."IDX_6860186ea2f56e2c7d54c22107"`) - await db.query(`DROP INDEX "public"."IDX_0d0a7113a505cf7f7adea9ca81"`) - await db.query(`DROP TABLE "ousd_morpho_aave"`) - await db.query(`DROP INDEX "public"."IDX_78e0701c2e9a28242db37bd8f8"`) - await db.query(`DROP INDEX "public"."IDX_46ccf673b376d654052fbd53e6"`) - await db.query(`DROP TABLE "ousd_morpho_compound"`) - await db.query(`DROP INDEX "public"."IDX_9e7bd0d8ae23b877d5979ef80c"`) - await db.query(`DROP INDEX "public"."IDX_0bb3a0ad84071f1d80f6d4e90f"`) - await db.query(`DROP TABLE "maker_dsr_strategy"`) - await db.query(`DROP INDEX "public"."IDX_a35308a3c5dbaab2d321eb1525"`) - await db.query(`DROP INDEX "public"."IDX_844b219d8faf9b1d24ab2dba9a"`) - await db.query(`DROP TABLE "ousd_flux_strategy"`) - await db.query(`DROP INDEX "public"."IDX_5b165b5d30b13e363d33a66e14"`) - await db.query(`DROP INDEX "public"."IDX_80f3392968fde7b99cccb805ac"`) - await db.query(`DROP TABLE "ousd_compound_strategy"`) - await db.query(`DROP INDEX "public"."IDX_6920b1db5dc577295ac4d1379d"`) - await db.query(`DROP INDEX "public"."IDX_89c6d7d3104bd36dc88a37add4"`) - await db.query(`DROP TABLE "ousd_convex_strategy"`) - await db.query(`DROP INDEX "public"."IDX_2deac473cd0b2dd7082e7da148"`) - await db.query(`DROP INDEX "public"."IDX_157bf74171817dc5c60ee37036"`) - await db.query(`DROP TABLE "ousd_aave_strategy"`) - await db.query(`DROP INDEX "public"."IDX_ca34b5a0a33bc9abdd8213c2fa"`) - await db.query(`DROP INDEX "public"."IDX_dacd7c98223d7bc8be074d71e4"`) - await db.query(`DROP TABLE "ousd_meta_strategy"`) - await db.query(`DROP INDEX "public"."IDX_7e998dcf775263bc5df76ef987"`) - await db.query(`DROP INDEX "public"."IDX_55ce185680512d6a5b9fb0af89"`) - await db.query(`DROP TABLE "ousd_convex_lusd_plus3_crv"`) - await db.query(`DROP INDEX "public"."IDX_0783af95efb35fb3f13cde1656"`) - await db.query(`DROP INDEX "public"."IDX_74ae01fb596a4f2733087ba454"`) - await db.query(`ALTER TABLE "oeth_history" DROP CONSTRAINT "FK_94e47c4c49128c78f60b185b46b"`) - await db.query(`ALTER TABLE "oeth_rebase" DROP CONSTRAINT "FK_3331819842173de7c27c046547a"`) - await db.query(`ALTER TABLE "oeth_rebase_option" DROP CONSTRAINT "FK_034428879698039839b4ba6ffe8"`) - await db.query(`ALTER TABLE "oeth_strategy_holding_daily_stat" DROP CONSTRAINT "FK_4e867f220975e615e6077d860c1"`) - await db.query(`ALTER TABLE "oeth_strategy_daily_stat" DROP CONSTRAINT "FK_6c7096c96a000d8471256ca8fc3"`) - await db.query(`ALTER TABLE "oeth_collateral_daily_stat" DROP CONSTRAINT "FK_a90045de50406be7bd56efd3ea4"`) - await db.query(`ALTER TABLE "ousd_history" DROP CONSTRAINT "FK_70291ea600c0c4d67d9bfe6a6bf"`) - await db.query(`ALTER TABLE "ousd_rebase" DROP CONSTRAINT "FK_427468c97f9838b804efd6c8e55"`) - await db.query(`ALTER TABLE "ousd_rebase_option" DROP CONSTRAINT "FK_b04173f9349ddd991a3b60e914a"`) - } -} diff --git a/schema-base.graphql b/schema-base.graphql index 1aca0e56..dbfe1c80 100644 --- a/schema-base.graphql +++ b/schema-base.graphql @@ -63,4 +63,21 @@ type StrategyYield @entity { asset: String! balance: BigInt! earnings: BigInt! + earningsChange: BigInt! +} + +type StrategyDailyYield @entity { + """ + Format: 'strategy:asset:blockNumber' + """ + id: ID! + timestamp: DateTime! @index + blockNumber: Int! @index + strategy: String! + asset: String! + balance: BigInt! + earnings: BigInt! + earningsChange: BigInt! + apr: Float! + apy: Float! } \ No newline at end of file diff --git a/schema.graphql b/schema.graphql index dae9fd9b..966ca223 100644 --- a/schema.graphql +++ b/schema.graphql @@ -65,6 +65,23 @@ type StrategyYield @entity { asset: String! balance: BigInt! earnings: BigInt! + earningsChange: BigInt! +} + +type StrategyDailyYield @entity { + """ + Format: 'strategy:asset:blockNumber' + """ + id: ID! + timestamp: DateTime! @index + blockNumber: Int! @index + strategy: String! + asset: String! + balance: BigInt! + earnings: BigInt! + earningsChange: BigInt! + apr: Float! + apy: Float! }type CurvePoolBalance @entity { id: ID! timestamp: DateTime! @index diff --git a/src/main-oeth.ts b/src/main-oeth.ts index e456107d..eb923c13 100644 --- a/src/main-oeth.ts +++ b/src/main-oeth.ts @@ -15,16 +15,16 @@ import * as exchangeRatesPostProcessor from './shared/post-processors/exchange-r run({ stateSchema: 'oeth-processor', processors: [ - oeth, - vault, - fraxStaking, - morphoAave, - dripper, - curveLp, - balancerMetaPoolStrategy, + // oeth, + // vault, + // fraxStaking, + // morphoAave, + // dripper, + // curveLp, + // balancerMetaPoolStrategy, strategies, - exchangeRates, + // exchangeRates, ], - postProcessors: [exchangeRatesPostProcessor, dailyStats], - validators: [validateOeth], + // postProcessors: [exchangeRatesPostProcessor, dailyStats], + // validators: [validateOeth], }) diff --git a/src/model/generated/index.ts b/src/model/generated/index.ts index 636165fb..8052cba8 100644 --- a/src/model/generated/index.ts +++ b/src/model/generated/index.ts @@ -2,6 +2,7 @@ export * from "./exchangeRate.model" export * from "./balance.model" export * from "./strategyBalance.model" export * from "./strategyYield.model" +export * from "./strategyDailyYield.model" export * from "./curvePoolBalance.model" export * from "./oeth.model" export * from "./oethAddress.model" diff --git a/src/model/generated/strategyDailyYield.model.ts b/src/model/generated/strategyDailyYield.model.ts new file mode 100644 index 00000000..a9ecba62 --- /dev/null +++ b/src/model/generated/strategyDailyYield.model.ts @@ -0,0 +1,44 @@ +import {Entity as Entity_, Column as Column_, PrimaryColumn as PrimaryColumn_, Index as Index_} from "typeorm" +import * as marshal from "./marshal" + +@Entity_() +export class StrategyDailyYield { + constructor(props?: Partial) { + Object.assign(this, props) + } + + /** + * Format: 'strategy:asset:blockNumber' + */ + @PrimaryColumn_() + id!: string + + @Index_() + @Column_("timestamp with time zone", {nullable: false}) + timestamp!: Date + + @Index_() + @Column_("int4", {nullable: false}) + blockNumber!: number + + @Column_("text", {nullable: false}) + strategy!: string + + @Column_("text", {nullable: false}) + asset!: string + + @Column_("numeric", {transformer: marshal.bigintTransformer, nullable: false}) + balance!: bigint + + @Column_("numeric", {transformer: marshal.bigintTransformer, nullable: false}) + earnings!: bigint + + @Column_("numeric", {transformer: marshal.bigintTransformer, nullable: false}) + earningsChange!: bigint + + @Column_("numeric", {transformer: marshal.floatTransformer, nullable: false}) + apr!: number + + @Column_("numeric", {transformer: marshal.floatTransformer, nullable: false}) + apy!: number +} diff --git a/src/model/generated/strategyYield.model.ts b/src/model/generated/strategyYield.model.ts index 690e4c0a..b27c886f 100644 --- a/src/model/generated/strategyYield.model.ts +++ b/src/model/generated/strategyYield.model.ts @@ -32,4 +32,7 @@ export class StrategyYield { @Column_("numeric", {transformer: marshal.bigintTransformer, nullable: false}) earnings!: bigint + + @Column_("numeric", {transformer: marshal.bigintTransformer, nullable: false}) + earningsChange!: bigint } diff --git a/src/oeth/processors/strategies/strategies.ts b/src/oeth/processors/strategies/strategies.ts index 61b5c26c..fdc1dc6b 100644 --- a/src/oeth/processors/strategies/strategies.ts +++ b/src/oeth/processors/strategies/strategies.ts @@ -50,20 +50,20 @@ export const oethStrategies: readonly IStrategyData[] = [ assets: [WETH_ADDRESS], earnings: { passiveByDepositWithdrawal: true, rewardTokenCollected: true }, }, - { - from: 18156225, - name: 'OETH Aura rETH/WETH', - contractName: 'BalancerMetaPoolStrategy', - address: '0x49109629ac1deb03f2e9b2fe2ac4a623e0e7dfdc', - kind: 'BalancerMetaStablePool', - assets: [WETH_ADDRESS, RETH_ADDRESS], - earnings: { rewardTokenCollected: true }, - balancerPoolInfo: { - poolId: - '0x1e19cf2d73a72ef1332c882f20534b6519be0276000200000000000000000112', - poolAddress: '0x1e19cf2d73a72ef1332c882f20534b6519be0276', - }, - }, + // { + // from: 18156225, + // name: 'OETH Aura rETH/WETH', + // contractName: 'BalancerMetaPoolStrategy', + // address: '0x49109629ac1deb03f2e9b2fe2ac4a623e0e7dfdc', + // kind: 'BalancerMetaStablePool', + // assets: [WETH_ADDRESS, RETH_ADDRESS], + // earnings: { rewardTokenCollected: true, passiveByDepositWithdrawal: true }, + // balancerPoolInfo: { + // poolId: + // '0x1e19cf2d73a72ef1332c882f20534b6519be0276000200000000000000000112', + // poolAddress: '0x1e19cf2d73a72ef1332c882f20534b6519be0276', + // }, + // }, ] as const const strategies = oethStrategies diff --git a/src/shared/post-processors/exchange-rates/currencies.ts b/src/shared/post-processors/exchange-rates/currencies.ts index cbb0e1ab..35d46576 100644 --- a/src/shared/post-processors/exchange-rates/currencies.ts +++ b/src/shared/post-processors/exchange-rates/currencies.ts @@ -1,5 +1,7 @@ import { invert, mapKeys } from 'lodash' +import { ExchangeRate } from '../../../model' + export const currencies = { USD: '0x0000000000000000000000000000000000000348', // Chainlink Denominations.USD ETH: '0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE', // Chainlink Denominations.ETH @@ -17,4 +19,24 @@ export const currenciesByAddress = mapKeys(invert(currencies), (v, k) => k.toLowerCase(), ) as Record -export type Currency = keyof typeof currencies +const eth1 = 1000000000000000000n +export const convertRate = ( + rates: ExchangeRate[], + base: Currency, + quote: Currency, + balance: bigint, +) => { + base = currenciesByAddress[base.toLowerCase() as CurrencyAddress] ?? base + quote = currenciesByAddress[quote.toLowerCase() as CurrencyAddress] ?? quote + const rate = rates.find((r) => r.base === base && r.quote === quote) + if (rate) { + return (balance * rate.rate) / eth1 + } else { + return 0n + } +} + +export type CurrencySymbol = keyof typeof currencies +export type CurrencyAddress = (typeof currencies)[keyof typeof currencies] + +export type Currency = CurrencySymbol | CurrencyAddress diff --git a/src/shared/post-processors/exchange-rates/exchange-rates.ts b/src/shared/post-processors/exchange-rates/exchange-rates.ts index 2cbcf132..2df383f8 100644 --- a/src/shared/post-processors/exchange-rates/exchange-rates.ts +++ b/src/shared/post-processors/exchange-rates/exchange-rates.ts @@ -28,11 +28,11 @@ export const ensureExchangeRate = async ( const blockNumber = block.header.height const id = `${blockNumber}:${pair}` let exchangeRate = exchangeRates.get(id) - if (exchangeRate) return + if (exchangeRate) return exchangeRate const timestamp = new Date(block.header.timestamp) const price = await getPrice(ctx, block, base, quote).catch((err) => { - ctx.log.info({ base, quote, err }) + ctx.log.info({ base, quote, err, message: err.message }) throw err }) if (price) { @@ -47,6 +47,7 @@ export const ensureExchangeRate = async ( }) exchangeRates.set(id, exchangeRate) } + return exchangeRate } export const ensureExchangeRates = async ( @@ -54,7 +55,7 @@ export const ensureExchangeRates = async ( block: Block, pairs: [Currency, Currency][], ) => { - await Promise.all( + return await Promise.all( pairs.map(([base, quote]) => ensureExchangeRate(ctx, block, base, quote)), ) } diff --git a/src/shared/post-processors/exchange-rates/price-routing.ts b/src/shared/post-processors/exchange-rates/price-routing.ts index c341891a..845bdf51 100644 --- a/src/shared/post-processors/exchange-rates/price-routing.ts +++ b/src/shared/post-processors/exchange-rates/price-routing.ts @@ -1,9 +1,10 @@ import * as chainlinkFeedRegistry from '../../../abi/chainlink-feed-registry' import * as eacAggregatorProxy from '../../../abi/eac-aggregator-proxy' +import * as frxEthFraxOracle from '../../../abi/frx-eth-frax-oracle' import * as oethOracleRouter from '../../../abi/oeth-oracle-router' import * as stakedFraxEth from '../../../abi/sfrx-eth' import { Block, Context } from '../../../processor' -import { Currency, currencies } from './currencies' +import { Currency, CurrencySymbol, currencies } from './currencies' export const getPrice = async ( ctx: Context, @@ -11,20 +12,29 @@ export const getPrice = async ( base: Currency, quote: Currency, ) => { + if (base === 'ETH' && quote === 'OETH') { + return 1_005_000_000_000_000_000n + } if (base === 'ETH' && quote === 'WETH') { return 1_000_000_000_000_000_000n } if (base === 'ETH' && quote === 'sfrxETH') { - return await getStakedFraxPrice(ctx, block) + return getStakedFraxPrice(ctx, block) } if (base === 'ETH' && quote === 'rETH') { - return await getRETHPrice(ctx, block) + return getRETHPrice(ctx, block) + } + if (base === 'ETH' && quote === 'frxETH') { + return getFrxEthPrice(ctx, block) } - if (base === 'ETH' && oethOracleCurrencies.has(quote)) { - if (block.header.height < 18032298) return undefined - return await getOethOraclePrice(ctx, block, quote) + if ( + base === 'ETH' && + oethOracleCurrencies.has(quote) && + block.header.height >= 18032298 + ) { + return getOethOraclePrice(ctx, block, quote) } - return await getChainlinkPrice(ctx, block, base, quote) + return getChainlinkPrice(ctx, block, base, quote) } const rETHRegistryAddress = '0x536218f9E9Eb48863970252233c8F271f554C2d0' @@ -39,7 +49,7 @@ export const getRETHPrice = (ctx: Context, block: Block) => { } const registryAddress = '0x47fb2585d2c56fe188d0e6ec628a38b74fceeedf' -export const getChainlinkPrice = ( +export const getChainlinkPrice = async ( ctx: Context, block: Block, base: Currency, @@ -50,10 +60,17 @@ export const getChainlinkPrice = ( block.header, registryAddress, ) - return registry.latestAnswer( - currencies[base] ?? base, - currencies[quote] ?? quote, - ) + try { + return await registry.latestAnswer( + currencies[base as CurrencySymbol] ?? base, + currencies[quote as CurrencySymbol] ?? quote, + ) + } catch (err: any) { + if (err.message === 'execution reverted: Feed not found') { + return 0n + } + throw err + } } export const oethOracleCurrencies = new Set(['WETH', 'stETH', 'frxETH']) @@ -69,7 +86,7 @@ export const getOethOraclePrice = ( block.header, oethOracleAddress, ) - return router.price(currencies[quote] ?? quote) + return router.price(currencies[quote as CurrencySymbol] ?? quote) } const stakedFraxAddress = '0xac3e018457b222d93114458476f3e3416abbe38f' @@ -82,3 +99,14 @@ export const getStakedFraxPrice = (ctx: Context, block: Block) => { ) return router.previewRedeem(1_000_000_000_000_000_000n) } + +const frxEthFraxOracleAddress = '0xC58F3385FBc1C8AD2c0C9a061D7c13b141D7A5Df' +export const getFrxEthPrice = (ctx: Context, block: Block) => { + if (block.header.height < 17571367) return 1_000_000_000_000_000_000n + const frxEth = new frxEthFraxOracle.Contract( + ctx, + block.header, + frxEthFraxOracleAddress, + ) + return frxEth.latestRoundData().then((lrd) => lrd.answer) +} diff --git a/src/shared/processor-templates/strategy-rewards/strategy-rewards.ts b/src/shared/processor-templates/strategy-rewards/strategy-rewards.ts index 5216e62c..7b655253 100644 --- a/src/shared/processor-templates/strategy-rewards/strategy-rewards.ts +++ b/src/shared/processor-templates/strategy-rewards/strategy-rewards.ts @@ -16,7 +16,7 @@ export const createStrategyRewardSetup = ({ processor.addLog({ address: [address], topic0: [iat.events.RewardTokenCollected.topic], - transaction: true, + transaction: false, range: { from }, }) } diff --git a/src/shared/processor-templates/strategy/strategy-balancer.ts b/src/shared/processor-templates/strategy/strategy-balancer.ts index 3646dc71..0cdcc34c 100644 --- a/src/shared/processor-templates/strategy/strategy-balancer.ts +++ b/src/shared/processor-templates/strategy/strategy-balancer.ts @@ -13,7 +13,7 @@ import { ETH_ADDRESS, WETH_ADDRESS, } from '../../../utils/addresses' -import { blockFrequencyTracker } from '../../../utils/blockFrequencyUpdater' +import { blockFrequencyUpdater } from '../../../utils/blockFrequencyUpdater' import { IStrategyData } from './index' import { processStrategyEarnings, @@ -28,30 +28,35 @@ export const setup = ( setupStrategyEarnings(processor, strategyData) } +const trackers = new Map>() export const process = async (ctx: Context, strategyData: IStrategyData) => { - const shouldUpdate = blockFrequencyTracker({ from: strategyData.from }) - const data: StrategyBalance[] = [] - for (const block of ctx.blocks) { - if (shouldUpdate(ctx, block)) { - const results = await getBalancerStrategyHoldings( - ctx, - block.header, - strategyData, - ).then((holdings) => - holdings.map(({ address, asset, balance }) => { - return new StrategyBalance({ - id: `${address}:${asset}:${block.header.height}`, - strategy: address, - asset, - balance, - blockNumber: block.header.height, - timestamp: new Date(block.header.timestamp), - }) - }), - ) - data.push(...results) - } + if (!trackers.has(strategyData.address)) { + trackers.set( + strategyData.address, + blockFrequencyUpdater({ from: strategyData.from }), + ) } + const blockFrequencyUpdate = trackers.get(strategyData.address)! + const data: StrategyBalance[] = [] + await blockFrequencyUpdate(ctx, async (ctx, block) => { + const results = await getBalancerStrategyHoldings( + ctx, + block.header, + strategyData, + ).then((holdings) => + holdings.map(({ address, asset, balance }) => { + return new StrategyBalance({ + id: `${address}:${asset}:${block.header.height}`, + strategy: address, + asset, + balance, + blockNumber: block.header.height, + timestamp: new Date(block.header.timestamp), + }) + }), + ) + data.push(...results) + }) await ctx.store.insert(data) await processStrategyEarnings(ctx, strategyData, getBalancerStrategyHoldings) } diff --git a/src/shared/processor-templates/strategy/strategy-curve-amo.ts b/src/shared/processor-templates/strategy/strategy-curve-amo.ts index 88057512..7454eaf8 100644 --- a/src/shared/processor-templates/strategy/strategy-curve-amo.ts +++ b/src/shared/processor-templates/strategy/strategy-curve-amo.ts @@ -11,7 +11,7 @@ import { OETH_ADDRESS, WETH_ADDRESS, } from '../../../utils/addresses' -import { blockFrequencyTracker } from '../../../utils/blockFrequencyUpdater' +import { blockFrequencyUpdater } from '../../../utils/blockFrequencyUpdater' import { IStrategyData } from './index' import { processStrategyEarnings, @@ -26,19 +26,20 @@ export const setup = ( setupStrategyEarnings(processor, strategyData) } +const trackers = new Map>() export const process = async (ctx: Context, strategyData: IStrategyData) => { - const shouldUpdate = blockFrequencyTracker({ from: strategyData.from }) - const data: StrategyBalance[] = [] - for (const block of ctx.blocks) { - if (shouldUpdate(ctx, block)) { - const results = await getCurveAMOStrategyHoldings( - ctx, - block, - strategyData, - ) - data.push(...results) - } + if (!trackers.has(strategyData.address)) { + trackers.set( + strategyData.address, + blockFrequencyUpdater({ from: strategyData.from }), + ) } + const blockFrequencyUpdate = trackers.get(strategyData.address)! + const data: StrategyBalance[] = [] + await blockFrequencyUpdate(ctx, async (ctx, block) => { + const results = await getCurveAMOStrategyHoldings(ctx, block, strategyData) + data.push(...results) + }) await ctx.store.insert(data) await processStrategyEarnings(ctx, strategyData, getStrategyBalances) } diff --git a/src/shared/processor-templates/strategy/strategy-daily-earnings.ts b/src/shared/processor-templates/strategy/strategy-daily-earnings.ts new file mode 100644 index 00000000..2d3cc557 --- /dev/null +++ b/src/shared/processor-templates/strategy/strategy-daily-earnings.ts @@ -0,0 +1,129 @@ +import dayjs from 'dayjs' +import { compact } from 'lodash' +import { Between, In, LessThan } from 'typeorm' + +import { StrategyDailyYield, StrategyYield } from '../../../model' +import { Block, Context } from '../../../processor' +import { ETH_ADDRESS } from '../../../utils/addresses' +import { calculateAPY } from '../../../utils/calculateAPY' +import { lastExcept } from '../../../utils/utils' +import { ensureExchangeRates } from '../../post-processors/exchange-rates' +import { + Currency, + convertRate, +} from '../../post-processors/exchange-rates/currencies' +import { IStrategyData } from './strategy' + +export const processStrategyDailyEarnings = async ( + ctx: Context, + blocks: Block[], + strategyData: IStrategyData, +) => { + const results: StrategyDailyYield[] = [] + for (const block of blocks) { + const day = dayjs.utc(block.header.timestamp).format('YYYY-MM-DD') + const id = `${strategyData.address}:${ETH_ADDRESS}:${day}` + // ctx.log.info(`processStrategyDailyEarnings ${block.header.height} ${id}`) + + // Get or create today's StrategyDailyYield. + let { latest, current } = await getLatest(ctx, results, strategyData, id) + if (!current) { + current = new StrategyDailyYield({ + id, + timestamp: dayjs.utc(block.header.timestamp).endOf('day').toDate(), + blockNumber: block.header.height, + strategy: strategyData.address, + balance: latest?.balance ?? 0n, + earnings: latest?.earnings ?? 0n, + earningsChange: latest?.earningsChange ?? 0n, + asset: ETH_ADDRESS, + apr: latest?.apr ?? 0, + apy: latest?.apy ?? 0, + }) + results.push(current) + } + + // Get the latest StrategyYield results. + const yields = await ctx.store.find(StrategyYield, { + where: { + strategy: strategyData.address, + asset: In(strategyData.assets), + blockNumber: Between(latest?.blockNumber ?? 0, block.header.height), + }, + order: { id: 'desc' }, + }) + + // TODO: This is good except sometimes certain assets get yield while other's don't on a specific day. + // So if for one of our assets this has no results, then we need to look back for whatever the last + // balance/earnings were so we can populate today's values properly. + // (since today's values are an aggregate of all assets) + + // Get ETH rates for all StrategyYield assets. + const rates = await ensureExchangeRates( + ctx, + block, + yields.map((y) => ['ETH', y.asset as Currency]), + ).then(compact) + + // Convert into ETH values + const ethBalance = yields.reduce( + (sum, y) => + sum + convertRate(rates, 'ETH', y.asset as Currency, y.balance), + 0n, + ) + const ethEarnings = yields.reduce( + (sum, y) => + sum + convertRate(rates, 'ETH', y.asset as Currency, y.earnings), + 0n, + ) + const ethEarningsChange = yields.reduce( + (sum, y) => + sum + convertRate(rates, 'ETH', y.asset as Currency, y.earningsChange), + 0n, + ) + + // Apply ETH values + current.balance = ethBalance + current.earnings = ethEarnings + current.earningsChange = ethEarningsChange + + // Calculate APY values + if (latest) { + // ctx.log.info( + // `Calculating APR: ${formatEther(latest.balance)} ${formatEther( + // current.earningsChange, + // )}`, + // ) + const { apr, apy } = calculateAPY( + latest.timestamp, + current.timestamp, + current.balance, + current.balance + current.earningsChange, + ) + current.apr = apr + current.apy = apy + } + + // ctx.log.info(current, `Daily Earnings: ${current.id}`) + } + await ctx.store.upsert(results) +} + +const getLatest = async ( + ctx: Context, + results: StrategyDailyYield[], + strategyData: IStrategyData, + id: string, +) => { + let latest = + lastExcept(results, id) ?? + (await ctx.store.findOne(StrategyDailyYield, { + order: { id: 'desc' }, + where: { + strategy: strategyData.address, + id: LessThan(id), + }, + })) + let current = results.find((l) => l.id === id) + return { latest, current, results } +} diff --git a/src/shared/processor-templates/strategy/strategy-earnings.ts b/src/shared/processor-templates/strategy/strategy-earnings.ts index 7c9dd56e..7afbfc63 100644 --- a/src/shared/processor-templates/strategy/strategy-earnings.ts +++ b/src/shared/processor-templates/strategy/strategy-earnings.ts @@ -1,4 +1,5 @@ import { EvmBatchProcessor } from '@subsquid/evm-processor' +import dayjs from 'dayjs' import { LessThan } from 'typeorm' import { formatEther, pad } from 'viem' @@ -8,40 +9,57 @@ import * as abstractStrategyAbi from '../../../abi/initializable-abstract-strate import { StrategyYield } from '../../../model' import { Block, Context } from '../../../processor' import { + AURA_REWARDS_POOL_ADDRESS, OETH_DRIPPER_ADDRESS, OETH_HARVESTER_ADDRESS, WETH_ADDRESS, } from '../../../utils/addresses' +import { lastExcept } from '../../../utils/utils' import { IStrategyData } from './strategy' +import { processStrategyDailyEarnings } from './strategy-daily-earnings' const depositWithdrawalTopics = new Set([ abstractStrategyAbi.events.Deposit.topic, abstractStrategyAbi.events.Withdrawal.topic, ]) +const baseRewardPoolTopics = new Set([ + baseRewardPool.events.Staked.topic, + baseRewardPool.events.Withdrawn.topic, +]) export const setupStrategyEarnings = ( processor: EvmBatchProcessor, strategyData: IStrategyData, ) => { + // Detect Deposit/Withdraw events + // To help us understand when balances change passively vs from activity. if (strategyData.earnings.passiveByDepositWithdrawal) { processor.addLog({ address: [strategyData.address], - topic0: [ - abstractStrategyAbi.events.Deposit.topic, - abstractStrategyAbi.events.Withdrawal.topic, - ], + topic0: [...depositWithdrawalTopics.values()], }) + + // Detect Staked/Withdrawn events + // The curve incident caused us to fully withdraw from our pool and these logs contain that. if (strategyData.kind === 'CurveAMO') { processor.addLog({ address: [strategyData.curvePoolInfo!.rewardsPoolAddress], - topic0: [ - baseRewardPool.events.Staked.topic, - baseRewardPool.events.Withdrawn.topic, - ], + topic0: [...baseRewardPoolTopics.values()], topic1: [pad(strategyData.address as `0x${string}`)], }) } } + + if (strategyData.kind === 'BalancerMetaStablePool') { + processor.addLog({ + address: [AURA_REWARDS_POOL_ADDRESS], + topic0: [...baseRewardPoolTopics.values()], + topic1: [pad(strategyData.address as `0x${string}`)], + }) + } + + // Listen for RewardTokenCollected events and their associated logs + // showing how much WETH Harvester sent to Dripper. if (strategyData.earnings.rewardTokenCollected) { processor.addLog({ address: [strategyData.address], @@ -65,26 +83,13 @@ export const processStrategyEarnings = async ( strategyData: IStrategyData, ) => Promise<{ address: string; asset: string; balance: bigint }[]>, ) => { - ctx.log.info(`NEW CONTEXT`) - + const days = new Map() const strategyYields = new Map() - for (const block of ctx.blocks) { - if (block.logs.length) { - ctx.log.info( - `${new Date(block.header.timestamp).toJSON()} NEW BLOCK: ${ - block.logs.length - } logs`, - ) - } + const dayId = dayjs.utc(block.header.timestamp).format('YYYY-MM-DD') const txIgnore = new Set() for (const log of block.logs) { - if ( - log.topics[0] === baseRewardPool.events.Staked.topic || - log.topics[0] === baseRewardPool.events.Withdrawn.topic - ) - ctx.log.info(log.topics) - const balanceTrackingUpdate = async () => { + const getBalances = async () => { const previousBalances = await getStrategyBalances( ctx, { height: block.header.height - 1 }, @@ -95,108 +100,105 @@ export const processStrategyEarnings = async ( block.header, strategyData, ) - if (strategyData.kind === 'CurveAMO') { - await processDepositWithdrawal( - ctx, - strategyData, - block, - strategyYields, - strategyData.curvePoolInfo!.poolAddress, - previousBalances.reduce((sum, b) => sum + b.balance, 0n), - balances.reduce((sum, b) => sum + b.balance, 0n), - ) - } else { - await Promise.all( - strategyData.assets.map((asset) => { - return processDepositWithdrawal( - ctx, - strategyData, - block, - strategyYields, - asset, - previousBalances.find((b) => b.asset === asset)!.balance, - balances.find((b) => b.asset === asset)!.balance, - ) - }), - ) - } + return { previousBalances, balances } + } + const balanceTrackingUpdate = async () => { + ctx.log.info(`balanceTrackingUpdate`) + days.set(dayId, block) + const { previousBalances, balances } = await getBalances() + await Promise.all( + strategyData.assets.map((asset) => { + return processDepositWithdrawal( + ctx, + strategyData, + block, + strategyYields, + asset, + previousBalances.find((b) => b.asset === asset)!.balance, + balances.find((b) => b.asset === asset)!.balance, + ) + }), + ) + } + const balanceTrackingUpdateBalancerMetaStablePool = async () => { + ctx.log.info(`balanceTrackingUpdateBalancerMetaStablePool`) + days.set(dayId, block) + const { previousBalances, balances } = await getBalances() + await processDepositWithdrawal( + ctx, + strategyData, + block, + strategyYields, + strategyData.balancerPoolInfo!.poolAddress, + previousBalances.reduce((sum, b) => sum + b.balance, 0n), + balances.reduce((sum, b) => sum + b.balance, 0n), + ) } if ( strategyData.kind === 'CurveAMO' && log.address === strategyData.curvePoolInfo!.rewardsPoolAddress && - log.topics[0] === baseRewardPool.events.Staked.topic && + baseRewardPoolTopics.has(log.topics[0]) && log.topics[1] === pad(strategyData.address as `0x${string}`) ) { - ctx.log.info({ - type: 'Staked', - transactionHash: log.transactionHash, - }) await balanceTrackingUpdate() } else if ( - strategyData.kind === 'CurveAMO' && - log.address === strategyData.curvePoolInfo!.rewardsPoolAddress && - log.topics[0] === baseRewardPool.events.Withdrawn.topic && + strategyData.kind === 'BalancerMetaStablePool' && + log.address === AURA_REWARDS_POOL_ADDRESS && + baseRewardPoolTopics.has(log.topics[0]) && log.topics[1] === pad(strategyData.address as `0x${string}`) + ) { + await balanceTrackingUpdateBalancerMetaStablePool() + } else if ( + log.address === strategyData.address && + strategyData.earnings.passiveByDepositWithdrawal && + depositWithdrawalTopics.has(log.topics[0]) ) { ctx.log.info({ - type: 'Withdrawn', + type: + log.topics[0] === abstractStrategyAbi.events.Deposit.topic + ? 'Deposit' + : 'Withdrawal', transactionHash: log.transactionHash, }) await balanceTrackingUpdate() - } else if (log.address === strategyData.address) { - // ctx.log.info({ - // block: block.header.height, - // tx: log.transactionHash, - // log.topics[0], - // }) - // TODO: TRACK CURVE AMO VIRTUAL PRICE INCREASES - if ( - strategyData.earnings.passiveByDepositWithdrawal && - depositWithdrawalTopics.has(log.topics[0]) - ) { - ctx.log.info({ - type: - log.topics[0] === abstractStrategyAbi.events.Deposit.topic - ? 'Deposit' - : 'Withdrawal', - transactionHash: log.transactionHash, - }) - await balanceTrackingUpdate() - } else if ( - strategyData.earnings.rewardTokenCollected && - log.topics[0] === - abstractStrategyAbi.events.RewardTokenCollected.topic && - !txIgnore.has(log.transactionHash) - ) { - txIgnore.add(log.transactionHash) - const wethTransferLogs = block.logs.filter( - (l) => - l.transactionHash === log.transactionHash && - l.address.toLowerCase() === WETH_ADDRESS && - l.topics[0] === erc20.events.Transfer.topic && - l.topics[1] === pad(OETH_HARVESTER_ADDRESS) && - l.topics[2] === pad(OETH_DRIPPER_ADDRESS), - ) - const amount = wethTransferLogs.reduce( - (sum, l) => sum + BigInt(l.data), - 0n, - ) + } else if ( + log.address === strategyData.address && + strategyData.earnings.rewardTokenCollected && + log.topics[0] === + abstractStrategyAbi.events.RewardTokenCollected.topic && + !txIgnore.has(log.transactionHash) + ) { + days.set(dayId, block) + txIgnore.add(log.transactionHash) + const wethTransferLogs = block.logs.filter( + (l) => + l.transactionHash === log.transactionHash && + l.address.toLowerCase() === WETH_ADDRESS && + l.topics[0] === erc20.events.Transfer.topic && + l.topics[1] === pad(OETH_HARVESTER_ADDRESS) && + l.topics[2] === pad(OETH_DRIPPER_ADDRESS), + ) + const amount = wethTransferLogs.reduce( + (sum, l) => sum + BigInt(l.data), + 0n, + ) - await processRewardTokenCollected( - ctx, - strategyData, - block, - strategyYields, - { - token: WETH_ADDRESS, - amount, - }, - ) - } + await processRewardTokenCollected( + ctx, + strategyData, + block, + strategyYields, + { + token: WETH_ADDRESS, + amount, + }, + ) } } } - await ctx.store.upsert([...strategyYields.values()].flat()) + const results = [...strategyYields.values()].flat() + await ctx.store.upsert(results) + await processStrategyDailyEarnings(ctx, [...days.values()], strategyData) } const processRewardTokenCollected = async ( @@ -206,8 +208,9 @@ const processRewardTokenCollected = async ( resultMap: Map, params: { token: string; amount: bigint }, ) => { - ctx.log.info(`Amount earned through rewards: ${formatEther(params.amount)}`) const id = `${block.header.height}:${strategyData.address}:${params.token}` + // ctx.log.info(`processRewardTokenCollected ${id}`) + // ctx.log.info(`Amount earned through rewards: ${formatEther(params.amount)}`) let { latest, current, results } = await getLatest( ctx, block, @@ -225,10 +228,12 @@ const processRewardTokenCollected = async ( asset: params.token, balance: latest?.balance ?? 0n, earnings: (latest?.earnings ?? 0n) + params.amount, + earningsChange: params.amount, }) results.push(current) } else { current.earnings += params.amount + current.earningsChange += params.amount } } @@ -242,6 +247,7 @@ const processDepositWithdrawal = async ( balance: bigint, ) => { const id = `${block.header.height}:${strategyData.address}:${asset}` + ctx.log.info(`processDepositWithdrawal ${id}`) let { latest, current, results } = await getLatest( ctx, block, @@ -251,28 +257,31 @@ const processDepositWithdrawal = async ( id, ) if (!current) { + const timestamp = new Date(block.header.timestamp) const earningsChange = - previousBalance - (latest?.balance ?? previousBalance) + previousBalance - (latest?.balance ?? previousBalance) ?? 0n current = new StrategyYield({ id, blockNumber: block.header.height, - timestamp: new Date(block.header.timestamp), + timestamp, strategy: strategyData.address, asset, balance, + earningsChange, earnings: (latest?.earnings ?? 0n) + earningsChange, }) - ctx.log.info( - `${asset} Setting balance: ${formatEther( - balance, - )}, last balance: ${formatEther( - latest?.balance ?? 0n, - )}, previous block balance: ${formatEther( - previousBalance, - )}, perceived earnings: ${formatEther( - earningsChange, - )}, total earnings: ${formatEther(current.earnings)}`, - ) + ctx.log.info(`Earnings change: ${formatEther(earningsChange)}`) + // ctx.log.info( + // `${asset} Setting balance: ${formatEther( + // balance, + // )}, last balance: ${formatEther( + // latest?.balance ?? 0n, + // )}, previous block balance: ${formatEther( + // previousBalance, + // )}, perceived earnings: ${formatEther( + // earningsChange, + // )}, total earnings: ${formatEther(current.earnings)}`, + // ) if (earningsChange < 0) { ctx.log.warn('WARNING: earnings change is negative') } @@ -280,7 +289,6 @@ const processDepositWithdrawal = async ( } } -const last = (arr?: T[]) => (arr ? arr[arr.length - 1] : undefined) const getLatest = async ( ctx: Context, block: Block, @@ -291,12 +299,12 @@ const getLatest = async ( ) => { let results = resultMap.get(asset) if (!results) { - ctx.log.info(`creating results set for ${asset}`) + // ctx.log.info(`creating results set for ${asset}`) results = [] resultMap.set(asset, results) } let latest = - last(resultMap.get(asset)) ?? + lastExcept(resultMap.get(asset), id) ?? (await ctx.store.findOne(StrategyYield, { order: { blockNumber: 'desc' }, where: { @@ -305,6 +313,6 @@ const getLatest = async ( asset, }, })) - let current = latest?.id === id ? latest : undefined + let current = resultMap.get(asset)?.find((l) => l.id === id) return { latest, current, results } } diff --git a/src/shared/processor-templates/strategy/strategy-generic.ts b/src/shared/processor-templates/strategy/strategy-generic.ts index 04f73b75..5941bb22 100644 --- a/src/shared/processor-templates/strategy/strategy-generic.ts +++ b/src/shared/processor-templates/strategy/strategy-generic.ts @@ -3,7 +3,7 @@ import { EvmBatchProcessor } from '@subsquid/evm-processor' import * as abstractStrategyAbi from '../../../abi/initializable-abstract-strategy' import { StrategyBalance } from '../../../model' import { Block, Context } from '../../../processor' -import { blockFrequencyTracker } from '../../../utils/blockFrequencyUpdater' +import { blockFrequencyUpdater } from '../../../utils/blockFrequencyUpdater' import { IStrategyData } from './index' import { processStrategyEarnings, @@ -18,15 +18,20 @@ export const setup = ( setupStrategyEarnings(processor, strategyData) } +const trackers = new Map>() export const process = async (ctx: Context, strategyData: IStrategyData) => { - const shouldUpdate = blockFrequencyTracker({ from: strategyData.from }) - const strategyBalances: StrategyBalance[] = [] - for (const block of ctx.blocks) { - if (shouldUpdate(ctx, block)) { - const results = await getStrategyHoldings(ctx, block, strategyData) - strategyBalances.push(...results) - } + if (!trackers.has(strategyData.address)) { + trackers.set( + strategyData.address, + blockFrequencyUpdater({ from: strategyData.from }), + ) } + const blockFrequencyUpdate = trackers.get(strategyData.address)! + const strategyBalances: StrategyBalance[] = [] + await blockFrequencyUpdate(ctx, async (ctx, block) => { + const results = await getStrategyHoldings(ctx, block, strategyData) + strategyBalances.push(...results) + }) await ctx.store.insert(strategyBalances) await processStrategyEarnings(ctx, strategyData, getStrategyBalances) } diff --git a/src/utils/addresses.ts b/src/utils/addresses.ts index e3e7d81f..8dcbb5de 100644 --- a/src/utils/addresses.ts +++ b/src/utils/addresses.ts @@ -45,3 +45,6 @@ export const OETH_STRATEGY_BALANCER_ADDRESS = '0x49109629ac1deb03f2e9b2fe2ac4a623e0e7dfdc' export const BALANCER_VAULT = '0xba12222222228d8ba445958a75a0704d566bf2c8' + +export const AURA_REWARDS_POOL_ADDRESS = + '0xdd1fe5ad401d4777ce89959b7fa587e569bf125d' diff --git a/src/utils/blockFrequencyUpdater.ts b/src/utils/blockFrequencyUpdater.ts index 6beaf287..2933d578 100644 --- a/src/utils/blockFrequencyUpdater.ts +++ b/src/utils/blockFrequencyUpdater.ts @@ -11,6 +11,7 @@ const SECONDS_PER_WEEK = dayjs.duration({ weeks: 1 }).asSeconds() const SECONDS_PER_DAY = dayjs.duration({ days: 1 }).asSeconds() const SECONDS_PER_MINUTE = 60 +// It's OK that these are only calculated at launch. const oneYearAgo = dayjs.utc().subtract(1, 'year').valueOf() const oneMonthAgo = dayjs.utc().subtract(1, 'month').valueOf() const oneWeekAgo = dayjs.utc().subtract(1, 'week').valueOf() @@ -32,20 +33,20 @@ const getFrequency = (bps: number, timestamp: number) => { return (SECONDS_PER_MINUTE / bps) ^ 0 } -export const blockFrequencyTracker = (params: { from: number }) => { - let lastBlockHeightProcessed = 0 - return (ctx: Context, block: Block) => { - if (block.header.height < params.from) return - // If we're not at head, determine our frequency and then process. - const { bps } = ctx - let frequency: number = getFrequency(bps, ctx.blocks[0].header.timestamp) - if (block.header.height >= lastBlockHeightProcessed + frequency) { - lastBlockHeightProcessed = block.header.height - return true - } - return false - } -} +// export const blockFrequencyTracker = (params: { from: number }) => { +// let nextBlockToProcess = 0 +// return (ctx: Context, block: Block) => { +// if (block.header.height < params.from) return +// // If we're not at head, determine our frequency and then process. +// const { bps } = ctx +// const frequency: number = getFrequency(bps, block.header.timestamp) +// if (block.header.height >= nextBlockToProcess) { +// nextBlockToProcess = block.header.height + frequency +// return true +// } +// return false +// } +// } export const blockFrequencyUpdater = (params: { from: number }) => { let lastBlockHeightProcessed = 0 diff --git a/src/utils/calculateAPY.ts b/src/utils/calculateAPY.ts index baface6c..e30f1cd0 100644 --- a/src/utils/calculateAPY.ts +++ b/src/utils/calculateAPY.ts @@ -1,18 +1,43 @@ +import { formatEther } from 'viem' + export const calculateAPY = ( from: Date, to: Date, fromAmount: bigint, toAmount: bigint, ) => { + if (fromAmount === 0n || toAmount === 0n) { + return { apr: 0, apy: 0 } + } + const diffTime = to.getTime() - from.getTime() const dayDiff = diffTime / (1000 * 60 * 60 * 24) - const apr = (Number(toAmount) / Number(fromAmount) - 1) * (365.25 / dayDiff) + const apr = + (Number(formatEther(toAmount)) / Number(formatEther(fromAmount)) - 1) * + (365.25 / dayDiff) const periods_per_year = 365.25 / Number(dayDiff) const apy = (1 + apr / periods_per_year) ** periods_per_year - 1 + if (apy > 1) { + // console.log( + // { + // diffTime, + // dayDiff, + // apr, + // periods_per_year, + // apy, + // fromAmount: formatEther(fromAmount), + // toAmount: formatEther(toAmount), + // }, + // 'HIGH APY CALCULATION', + // ) + // if (apy > 1000) { + // throw new Error('APY calculation is unrealistic') + // } + } return { - apr, - apy, + apr: apr || 0, + apy: apy || 0, } } diff --git a/src/utils/utils.ts b/src/utils/utils.ts index 5567cbed..71b5be13 100644 --- a/src/utils/utils.ts +++ b/src/utils/utils.ts @@ -5,6 +5,16 @@ import { pad } from 'viem' import * as erc20 from '../abi/erc20' import { Context } from '../processor' +export const lastExcept = ( + arr: T[] | undefined, + id: string, +) => + arr + ? arr[arr.length - 1]?.id === id + ? arr[arr.length - 2] + : arr[arr.length - 1] + : undefined + export const trackAddressBalances = async ({ log, address, From 7b27e0a565b313296fdb4912cf39b7236cf80b7e Mon Sep 17 00:00:00 2001 From: Chris Jacobs Date: Sat, 4 Nov 2023 19:54:38 -0700 Subject: [PATCH 08/34] wip on daily earnings with APY --- db/migrations/1699114716587-Data.js | 289 +++++++++ src/abi/frx-eth-frax-oracle.abi.ts | 553 ++++++++++++++++++ src/abi/frx-eth-frax-oracle.ts | 162 +++++ .../strategy/strategy-daily-earnings.ts | 74 ++- 4 files changed, 1065 insertions(+), 13 deletions(-) create mode 100644 db/migrations/1699114716587-Data.js create mode 100644 src/abi/frx-eth-frax-oracle.abi.ts create mode 100644 src/abi/frx-eth-frax-oracle.ts diff --git a/db/migrations/1699114716587-Data.js b/db/migrations/1699114716587-Data.js new file mode 100644 index 00000000..ae40d575 --- /dev/null +++ b/db/migrations/1699114716587-Data.js @@ -0,0 +1,289 @@ +module.exports = class Data1699114716587 { + name = 'Data1699114716587' + + async up(db) { + await db.query(`CREATE TABLE "exchange_rate" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "pair" text NOT NULL, "base" text NOT NULL, "quote" text NOT NULL, "rate" numeric NOT NULL, CONSTRAINT "PK_5c5d27d2b900ef6cdeef0398472" PRIMARY KEY ("id"))`) + await db.query(`CREATE INDEX "IDX_9e23a3f1bf3634820c873a0fe8" ON "exchange_rate" ("timestamp") `) + await db.query(`CREATE INDEX "IDX_c61a93768eed9e58ce399bbe01" ON "exchange_rate" ("block_number") `) + await db.query(`CREATE TABLE "balance" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "token" text NOT NULL, "address" text NOT NULL, "balance" numeric NOT NULL, CONSTRAINT "PK_079dddd31a81672e8143a649ca0" PRIMARY KEY ("id"))`) + await db.query(`CREATE INDEX "IDX_a956b410c329b8eca7898c3c51" ON "balance" ("timestamp") `) + await db.query(`CREATE INDEX "IDX_6b451b59c9f6a6fdd685f530b2" ON "balance" ("block_number") `) + await db.query(`CREATE TABLE "strategy_balance" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "strategy" text NOT NULL, "asset" text NOT NULL, "balance" numeric NOT NULL, CONSTRAINT "PK_ca6f93229d1392e9546d01dae4f" PRIMARY KEY ("id"))`) + await db.query(`CREATE INDEX "IDX_0113bf0b63183bea0d22cd0d08" ON "strategy_balance" ("timestamp") `) + await db.query(`CREATE INDEX "IDX_a88065dcd92011698bbe7df7b1" ON "strategy_balance" ("block_number") `) + await db.query(`CREATE TABLE "strategy_yield" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "strategy" text NOT NULL, "asset" text NOT NULL, "balance" numeric NOT NULL, "earnings" numeric NOT NULL, "earnings_change" numeric NOT NULL, CONSTRAINT "PK_e87c46575e870fe2202190c2728" PRIMARY KEY ("id"))`) + await db.query(`CREATE INDEX "IDX_5108f2a2563d5665892d0c06b0" ON "strategy_yield" ("timestamp") `) + await db.query(`CREATE INDEX "IDX_41c3567c9d43c598e07a0029c5" ON "strategy_yield" ("block_number") `) + await db.query(`CREATE TABLE "strategy_daily_yield" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "strategy" text NOT NULL, "asset" text NOT NULL, "balance" numeric NOT NULL, "earnings" numeric NOT NULL, "earnings_change" numeric NOT NULL, "apr" numeric NOT NULL, "apy" numeric NOT NULL, CONSTRAINT "PK_b0dd2686bc95bb032ff532b3a0e" PRIMARY KEY ("id"))`) + await db.query(`CREATE INDEX "IDX_0ba1974747f1906e0c102cd2cd" ON "strategy_daily_yield" ("timestamp") `) + await db.query(`CREATE INDEX "IDX_df364fb6e82d1feeed2a5dfffa" ON "strategy_daily_yield" ("block_number") `) + await db.query(`CREATE TABLE "curve_pool_balance" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "address" text NOT NULL, "balance0" numeric NOT NULL, "balance1" numeric NOT NULL, "balance2" numeric NOT NULL, CONSTRAINT "PK_40412750bb910ca560aa084dd88" PRIMARY KEY ("id"))`) + await db.query(`CREATE INDEX "IDX_ffb0d0f86f03faacef7cb3e092" ON "curve_pool_balance" ("timestamp") `) + await db.query(`CREATE INDEX "IDX_db5522c865eb8ed76fa7aeb4a8" ON "curve_pool_balance" ("block_number") `) + await db.query(`CREATE TABLE "oeth" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "total_supply" numeric NOT NULL, "rebasing_supply" numeric NOT NULL, "non_rebasing_supply" numeric NOT NULL, CONSTRAINT "PK_de1d885501070dbd1ab6f8577ba" PRIMARY KEY ("id"))`) + await db.query(`CREATE INDEX "IDX_5b81a67229bac2d68e0dc92cc4" ON "oeth" ("timestamp") `) + await db.query(`CREATE INDEX "IDX_408e5f79f83093aa5cf2b0ea32" ON "oeth" ("block_number") `) + await db.query(`CREATE TABLE "oeth_history" ("id" character varying NOT NULL, "value" numeric NOT NULL, "balance" numeric NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "tx_hash" text NOT NULL, "type" character varying(8) NOT NULL, "address_id" character varying, CONSTRAINT "PK_2c7e7571cd9ea02b07a27a303f3" PRIMARY KEY ("id"))`) + await db.query(`CREATE INDEX "IDX_94e47c4c49128c78f60b185b46" ON "oeth_history" ("address_id") `) + await db.query(`CREATE INDEX "IDX_96956b1c8d29eb7066a97d5ea7" ON "oeth_history" ("block_number") `) + await db.query(`CREATE INDEX "IDX_b14170bdb7fbc0775bf55df15d" ON "oeth_history" ("tx_hash") `) + await db.query(`CREATE TABLE "oeth_address" ("id" character varying NOT NULL, "is_contract" boolean NOT NULL, "rebasing_option" character varying(6) NOT NULL, "balance" numeric NOT NULL, "earned" numeric NOT NULL, "credits" numeric NOT NULL, "last_updated" TIMESTAMP WITH TIME ZONE NOT NULL, CONSTRAINT "PK_92a966afe47d584af73ce77a1cd" PRIMARY KEY ("id"))`) + await db.query(`CREATE TABLE "oethapy" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "tx_hash" text NOT NULL, "apr" numeric NOT NULL, "apy" numeric NOT NULL, "apy7_day_avg" numeric NOT NULL, "apy14_day_avg" numeric NOT NULL, "apy30_day_avg" numeric NOT NULL, "rebasing_credits_per_token" numeric NOT NULL, CONSTRAINT "PK_8dbb4d04591848361200f18f62a" PRIMARY KEY ("id"))`) + await db.query(`CREATE INDEX "IDX_b1a448045d1ed9d655b679a371" ON "oethapy" ("timestamp") `) + await db.query(`CREATE INDEX "IDX_6b8a7a706a0701e659a7d81508" ON "oethapy" ("block_number") `) + await db.query(`CREATE INDEX "IDX_c0c03168bb0139e3cffda4f00e" ON "oethapy" ("tx_hash") `) + await db.query(`CREATE TABLE "oeth_rebase" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "tx_hash" text NOT NULL, "total_supply" numeric NOT NULL, "rebasing_credits" numeric NOT NULL, "rebasing_credits_per_token" numeric NOT NULL, "fee" numeric NOT NULL, "yield" numeric NOT NULL, "apy_id" character varying, CONSTRAINT "PK_5f8f4dd071caf685b4ac2d54de3" PRIMARY KEY ("id"))`) + await db.query(`CREATE INDEX "IDX_fbb7b3f2fff9896eb683b86de7" ON "oeth_rebase" ("timestamp") `) + await db.query(`CREATE INDEX "IDX_d3255d02d9407bba89380d01fa" ON "oeth_rebase" ("block_number") `) + await db.query(`CREATE INDEX "IDX_8b6bb0243472af88612fe6a01f" ON "oeth_rebase" ("tx_hash") `) + await db.query(`CREATE INDEX "IDX_3331819842173de7c27c046547" ON "oeth_rebase" ("apy_id") `) + await db.query(`CREATE TABLE "oeth_rebase_option" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "tx_hash" text NOT NULL, "status" character varying(6) NOT NULL, "address_id" character varying, CONSTRAINT "PK_32971725d5523200b4b3b7c07e5" PRIMARY KEY ("id"))`) + await db.query(`CREATE INDEX "IDX_1fc6bbd88037bfbf4361776909" ON "oeth_rebase_option" ("timestamp") `) + await db.query(`CREATE INDEX "IDX_cbb7ceb49ef7c45432d0171296" ON "oeth_rebase_option" ("block_number") `) + await db.query(`CREATE INDEX "IDX_355826dadaacc5ae2d63c82f28" ON "oeth_rebase_option" ("tx_hash") `) + await db.query(`CREATE INDEX "IDX_034428879698039839b4ba6ffe" ON "oeth_rebase_option" ("address_id") `) + await db.query(`CREATE TABLE "oeth_vault" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "weth" numeric NOT NULL, "st_eth" numeric NOT NULL, "r_eth" numeric NOT NULL, "frx_eth" numeric NOT NULL, CONSTRAINT "PK_9debaa84944fe2be9dc4219ba8f" PRIMARY KEY ("id"))`) + await db.query(`CREATE INDEX "IDX_d6298a294864b4eaf793cf35a4" ON "oeth_vault" ("timestamp") `) + await db.query(`CREATE INDEX "IDX_e20cb507a673817b2c68720415" ON "oeth_vault" ("block_number") `) + await db.query(`CREATE TABLE "oeth_curve_lp" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "total_supply" numeric NOT NULL, "eth" numeric NOT NULL, "oeth" numeric NOT NULL, "total_supply_owned" numeric NOT NULL, "eth_owned" numeric NOT NULL, "oeth_owned" numeric NOT NULL, CONSTRAINT "PK_2b055044664e80f44d6172fdf54" PRIMARY KEY ("id"))`) + await db.query(`CREATE INDEX "IDX_d9bbd20e888fa1b4b2c5d2f039" ON "oeth_curve_lp" ("timestamp") `) + await db.query(`CREATE INDEX "IDX_7617d593c36dce1b1565a8d74a" ON "oeth_curve_lp" ("block_number") `) + await db.query(`CREATE TABLE "oeth_frax_staking" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "sfrx_eth" numeric NOT NULL, CONSTRAINT "PK_694f53c8600ae88c7bdcf7305dd" PRIMARY KEY ("id"))`) + await db.query(`CREATE INDEX "IDX_ce6c2c65e90967dfeaac97025b" ON "oeth_frax_staking" ("timestamp") `) + await db.query(`CREATE INDEX "IDX_1a7f7d650390e2f9c212651e05" ON "oeth_frax_staking" ("block_number") `) + await db.query(`CREATE TABLE "oeth_morpho_aave" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "weth" numeric NOT NULL, CONSTRAINT "PK_86de8f846e9335c92b8ad7df3a1" PRIMARY KEY ("id"))`) + await db.query(`CREATE INDEX "IDX_25e239b985844f1d33fac79981" ON "oeth_morpho_aave" ("timestamp") `) + await db.query(`CREATE INDEX "IDX_a6662224e95eb6921bb14cb5f9" ON "oeth_morpho_aave" ("block_number") `) + await db.query(`CREATE TABLE "oeth_dripper" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "weth" numeric NOT NULL, "last_collect_timestamp" integer NOT NULL, "drip_rate_per_block" numeric NOT NULL, "drip_duration" numeric NOT NULL, CONSTRAINT "PK_77731281c1564c24eff0c265984" PRIMARY KEY ("id"))`) + await db.query(`CREATE INDEX "IDX_16ac742ceeb05d28e530da9649" ON "oeth_dripper" ("timestamp") `) + await db.query(`CREATE INDEX "IDX_d356832c14603916a492608e7b" ON "oeth_dripper" ("block_number") `) + await db.query(`CREATE TABLE "oeth_balancer_meta_pool_strategy" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "r_eth" numeric NOT NULL, "weth" numeric NOT NULL, CONSTRAINT "PK_6ddf5b8ba878e6d706e59bd6de0" PRIMARY KEY ("id"))`) + await db.query(`CREATE INDEX "IDX_5e7ef383756fa18cb602f50089" ON "oeth_balancer_meta_pool_strategy" ("timestamp") `) + await db.query(`CREATE INDEX "IDX_11d344b3e0e03cdb6697dd61f7" ON "oeth_balancer_meta_pool_strategy" ("block_number") `) + await db.query(`CREATE TABLE "oeth_strategy_holding_daily_stat" ("id" character varying NOT NULL, "symbol" text NOT NULL, "amount" numeric NOT NULL, "value" numeric NOT NULL, "strategy_daily_stat_id_id" character varying, CONSTRAINT "PK_7f1a62da5e53cf264c2f39b4acf" PRIMARY KEY ("id"))`) + await db.query(`CREATE INDEX "IDX_4e867f220975e615e6077d860c" ON "oeth_strategy_holding_daily_stat" ("strategy_daily_stat_id_id") `) + await db.query(`CREATE TABLE "oeth_strategy_daily_stat" ("id" character varying NOT NULL, "name" text NOT NULL, "total" numeric NOT NULL, "tvl" numeric NOT NULL, "daily_stat_id_id" character varying, CONSTRAINT "PK_8af1a0c60e67b05baf928787a8e" PRIMARY KEY ("id"))`) + await db.query(`CREATE INDEX "IDX_6c7096c96a000d8471256ca8fc" ON "oeth_strategy_daily_stat" ("daily_stat_id_id") `) + await db.query(`CREATE TABLE "oeth_collateral_daily_stat" ("id" character varying NOT NULL, "symbol" text NOT NULL, "amount" numeric NOT NULL, "price" numeric NOT NULL, "value" numeric NOT NULL, "daily_stat_id_id" character varying, CONSTRAINT "PK_5fb23d7bae30dffe4543e7aa069" PRIMARY KEY ("id"))`) + await db.query(`CREATE INDEX "IDX_a90045de50406be7bd56efd3ea" ON "oeth_collateral_daily_stat" ("daily_stat_id_id") `) + await db.query(`CREATE TABLE "oeth_daily_stat" ("id" character varying NOT NULL, "block_number" integer NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "apr" numeric NOT NULL, "apy" numeric NOT NULL, "apy7_day_avg" numeric NOT NULL, "apy14_day_avg" numeric NOT NULL, "apy30_day_avg" numeric NOT NULL, "total_supply" numeric NOT NULL, "total_supply_usd" numeric NOT NULL, "rebasing_supply" numeric NOT NULL, "non_rebasing_supply" numeric NOT NULL, "amo_supply" numeric NOT NULL, "dripper_weth" numeric NOT NULL, "yield" numeric NOT NULL, "fees" numeric NOT NULL, "revenue" numeric NOT NULL, "revenue7_day_avg" numeric NOT NULL, "revenue7_day_total" numeric NOT NULL, "revenue_all_time" numeric NOT NULL, "peg_price" numeric NOT NULL, CONSTRAINT "PK_9144a02ab13b1baa818a7d5eae5" PRIMARY KEY ("id"))`) + await db.query(`CREATE INDEX "IDX_98d9001013aa37425ca47b7126" ON "oeth_daily_stat" ("block_number") `) + await db.query(`CREATE INDEX "IDX_c3e66051c7df4efd6a8fa8f9c1" ON "oeth_daily_stat" ("timestamp") `) + await db.query(`CREATE TABLE "oeth_reward_token_collected" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "strategy" text NOT NULL, "recipient" text NOT NULL, "reward_token" text NOT NULL, "amount" numeric NOT NULL, CONSTRAINT "PK_47098cc5fbc7cb95c2374fa33cd" PRIMARY KEY ("id"))`) + await db.query(`CREATE INDEX "IDX_81a9fa43ae4a6ae63e4103127b" ON "oeth_reward_token_collected" ("timestamp") `) + await db.query(`CREATE INDEX "IDX_d36c78b9c3e9d737f067638bc4" ON "oeth_reward_token_collected" ("block_number") `) + await db.query(`CREATE TABLE "ogv" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "circulating" numeric NOT NULL, "total" numeric NOT NULL, CONSTRAINT "PK_f16038abf451ce82bd03ea54ee7" PRIMARY KEY ("id"))`) + await db.query(`CREATE INDEX "IDX_2418a8b8b92b2f5977be761cf9" ON "ogv" ("timestamp") `) + await db.query(`CREATE INDEX "IDX_b8f20bcf48e4aa77e0f48d77db" ON "ogv" ("block_number") `) + await db.query(`CREATE TABLE "staked_ogv" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "total" numeric NOT NULL, "apy" numeric NOT NULL, CONSTRAINT "PK_b135611d9aab36c7889982c3be8" PRIMARY KEY ("id"))`) + await db.query(`CREATE INDEX "IDX_533195c60cfaef9e118789dee9" ON "staked_ogv" ("timestamp") `) + await db.query(`CREATE INDEX "IDX_d601233411a33212b9d616aab0" ON "staked_ogv" ("block_number") `) + await db.query(`CREATE TABLE "ogv_governance" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "registered_voters" integer NOT NULL, "open_source_contributors" integer NOT NULL, "improvement_proposals" integer NOT NULL, CONSTRAINT "PK_b22758cd4ee8ff92c1b7ee0cf20" PRIMARY KEY ("id"))`) + await db.query(`CREATE INDEX "IDX_a0329e7109d5959b9aa3d9d374" ON "ogv_governance" ("timestamp") `) + await db.query(`CREATE INDEX "IDX_63cd1ca46771965c68f6b85898" ON "ogv_governance" ("block_number") `) + await db.query(`CREATE TABLE "ousd" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "total_supply" numeric NOT NULL, "rebasing_supply" numeric NOT NULL, "non_rebasing_supply" numeric NOT NULL, CONSTRAINT "PK_acecae4a20bc14b22d9f6738d8d" PRIMARY KEY ("id"))`) + await db.query(`CREATE INDEX "IDX_c8d1e285213b445b088805ac7c" ON "ousd" ("timestamp") `) + await db.query(`CREATE INDEX "IDX_806949dd853b7e8acab5d03b81" ON "ousd" ("block_number") `) + await db.query(`CREATE TABLE "ousd_history" ("id" character varying NOT NULL, "value" numeric NOT NULL, "balance" numeric NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "tx_hash" text NOT NULL, "type" character varying(8) NOT NULL, "address_id" character varying, CONSTRAINT "PK_dcbe3223b67f92d9ad4cffe8a7c" PRIMARY KEY ("id"))`) + await db.query(`CREATE INDEX "IDX_70291ea600c0c4d67d9bfe6a6b" ON "ousd_history" ("address_id") `) + await db.query(`CREATE INDEX "IDX_4d00d283e1ce3209dc43a0313c" ON "ousd_history" ("block_number") `) + await db.query(`CREATE INDEX "IDX_0c25caa59aa053a688a723d160" ON "ousd_history" ("tx_hash") `) + await db.query(`CREATE TABLE "ousd_address" ("id" character varying NOT NULL, "is_contract" boolean NOT NULL, "rebasing_option" character varying(6) NOT NULL, "balance" numeric NOT NULL, "earned" numeric NOT NULL, "credits" numeric NOT NULL, "last_updated" TIMESTAMP WITH TIME ZONE NOT NULL, CONSTRAINT "PK_bb061344757ede566d62854af6a" PRIMARY KEY ("id"))`) + await db.query(`CREATE TABLE "ousdapy" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "tx_hash" text NOT NULL, "apr" numeric NOT NULL, "apy" numeric NOT NULL, "apy7_day_avg" numeric NOT NULL, "apy14_day_avg" numeric NOT NULL, "apy30_day_avg" numeric NOT NULL, "rebasing_credits_per_token" numeric NOT NULL, CONSTRAINT "PK_d9889b7153efc82dbe88f9a7a33" PRIMARY KEY ("id"))`) + await db.query(`CREATE INDEX "IDX_c514963f42908ce84d65a84a77" ON "ousdapy" ("timestamp") `) + await db.query(`CREATE INDEX "IDX_4f606414b3b5ce1a366bd0fbf6" ON "ousdapy" ("block_number") `) + await db.query(`CREATE INDEX "IDX_0e84a81a109b66fe6f01f77c74" ON "ousdapy" ("tx_hash") `) + await db.query(`CREATE TABLE "ousd_rebase" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "tx_hash" text NOT NULL, "total_supply" numeric NOT NULL, "rebasing_credits" numeric NOT NULL, "rebasing_credits_per_token" numeric NOT NULL, "fee" numeric NOT NULL, "yield" numeric NOT NULL, "apy_id" character varying, CONSTRAINT "PK_04cf0de72399a99798dde61b237" PRIMARY KEY ("id"))`) + await db.query(`CREATE INDEX "IDX_f8eb4a16ce58a146b3227ee21a" ON "ousd_rebase" ("timestamp") `) + await db.query(`CREATE INDEX "IDX_3fb03b1a410e64c7367226d0b6" ON "ousd_rebase" ("block_number") `) + await db.query(`CREATE INDEX "IDX_1a76c478199672aaeec340f619" ON "ousd_rebase" ("tx_hash") `) + await db.query(`CREATE INDEX "IDX_427468c97f9838b804efd6c8e5" ON "ousd_rebase" ("apy_id") `) + await db.query(`CREATE TABLE "ousd_rebase_option" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "tx_hash" text NOT NULL, "status" character varying(6) NOT NULL, "address_id" character varying, CONSTRAINT "PK_d684f90866027104f3c929dfe10" PRIMARY KEY ("id"))`) + await db.query(`CREATE INDEX "IDX_64bd23947dc4c67e3b6a3f9352" ON "ousd_rebase_option" ("timestamp") `) + await db.query(`CREATE INDEX "IDX_9b774e46b8b1cf7f828133809a" ON "ousd_rebase_option" ("block_number") `) + await db.query(`CREATE INDEX "IDX_4e95bf069de04533d83a9a97fd" ON "ousd_rebase_option" ("tx_hash") `) + await db.query(`CREATE INDEX "IDX_b04173f9349ddd991a3b60e914" ON "ousd_rebase_option" ("address_id") `) + await db.query(`CREATE TABLE "ousd_vault" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "dai" numeric NOT NULL, "usdt" numeric NOT NULL, "usdc" numeric NOT NULL, CONSTRAINT "PK_343f5538c71a1cd78f1659ef9d3" PRIMARY KEY ("id"))`) + await db.query(`CREATE INDEX "IDX_6860186ea2f56e2c7d54c22107" ON "ousd_vault" ("timestamp") `) + await db.query(`CREATE INDEX "IDX_0d0a7113a505cf7f7adea9ca81" ON "ousd_vault" ("block_number") `) + await db.query(`CREATE TABLE "ousd_morpho_aave" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "dai" numeric NOT NULL, "usdt" numeric NOT NULL, "usdc" numeric NOT NULL, CONSTRAINT "PK_60676cde905a822ba73ff3a5c85" PRIMARY KEY ("id"))`) + await db.query(`CREATE INDEX "IDX_78e0701c2e9a28242db37bd8f8" ON "ousd_morpho_aave" ("timestamp") `) + await db.query(`CREATE INDEX "IDX_46ccf673b376d654052fbd53e6" ON "ousd_morpho_aave" ("block_number") `) + await db.query(`CREATE TABLE "ousd_morpho_compound" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "dai" numeric NOT NULL, "usdt" numeric NOT NULL, "usdc" numeric NOT NULL, CONSTRAINT "PK_5f715d53ef8fc0fad595cacf4fa" PRIMARY KEY ("id"))`) + await db.query(`CREATE INDEX "IDX_9e7bd0d8ae23b877d5979ef80c" ON "ousd_morpho_compound" ("timestamp") `) + await db.query(`CREATE INDEX "IDX_0bb3a0ad84071f1d80f6d4e90f" ON "ousd_morpho_compound" ("block_number") `) + await db.query(`CREATE TABLE "maker_dsr_strategy" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "dai" numeric NOT NULL, CONSTRAINT "PK_196da2d6910009ae04e3542fe22" PRIMARY KEY ("id"))`) + await db.query(`CREATE INDEX "IDX_a35308a3c5dbaab2d321eb1525" ON "maker_dsr_strategy" ("timestamp") `) + await db.query(`CREATE INDEX "IDX_844b219d8faf9b1d24ab2dba9a" ON "maker_dsr_strategy" ("block_number") `) + await db.query(`CREATE TABLE "ousd_flux_strategy" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "dai" numeric NOT NULL, "usdt" numeric NOT NULL, "usdc" numeric NOT NULL, CONSTRAINT "PK_ac977221429e50e4de1ce253a8b" PRIMARY KEY ("id"))`) + await db.query(`CREATE INDEX "IDX_5b165b5d30b13e363d33a66e14" ON "ousd_flux_strategy" ("timestamp") `) + await db.query(`CREATE INDEX "IDX_80f3392968fde7b99cccb805ac" ON "ousd_flux_strategy" ("block_number") `) + await db.query(`CREATE TABLE "ousd_compound_strategy" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "dai" numeric NOT NULL, "usdt" numeric NOT NULL, "usdc" numeric NOT NULL, CONSTRAINT "PK_9030e82bf3479d03c04e0d1919c" PRIMARY KEY ("id"))`) + await db.query(`CREATE INDEX "IDX_6920b1db5dc577295ac4d1379d" ON "ousd_compound_strategy" ("timestamp") `) + await db.query(`CREATE INDEX "IDX_89c6d7d3104bd36dc88a37add4" ON "ousd_compound_strategy" ("block_number") `) + await db.query(`CREATE TABLE "ousd_convex_strategy" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "dai" numeric NOT NULL, "usdt" numeric NOT NULL, "usdc" numeric NOT NULL, CONSTRAINT "PK_2b8f6e749e15e49d8816f1ac949" PRIMARY KEY ("id"))`) + await db.query(`CREATE INDEX "IDX_2deac473cd0b2dd7082e7da148" ON "ousd_convex_strategy" ("timestamp") `) + await db.query(`CREATE INDEX "IDX_157bf74171817dc5c60ee37036" ON "ousd_convex_strategy" ("block_number") `) + await db.query(`CREATE TABLE "ousd_aave_strategy" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "dai" numeric NOT NULL, "usdt" numeric NOT NULL, "usdc" numeric NOT NULL, CONSTRAINT "PK_b4b7ac6e395aa722df500f93623" PRIMARY KEY ("id"))`) + await db.query(`CREATE INDEX "IDX_ca34b5a0a33bc9abdd8213c2fa" ON "ousd_aave_strategy" ("timestamp") `) + await db.query(`CREATE INDEX "IDX_dacd7c98223d7bc8be074d71e4" ON "ousd_aave_strategy" ("block_number") `) + await db.query(`CREATE TABLE "ousd_meta_strategy" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "dai" numeric NOT NULL, "usdt" numeric NOT NULL, "usdc" numeric NOT NULL, CONSTRAINT "PK_d99170af73d86fe74460bbfacc4" PRIMARY KEY ("id"))`) + await db.query(`CREATE INDEX "IDX_7e998dcf775263bc5df76ef987" ON "ousd_meta_strategy" ("timestamp") `) + await db.query(`CREATE INDEX "IDX_55ce185680512d6a5b9fb0af89" ON "ousd_meta_strategy" ("block_number") `) + await db.query(`CREATE TABLE "ousd_convex_lusd_plus3_crv" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "dai" numeric NOT NULL, "usdt" numeric NOT NULL, "usdc" numeric NOT NULL, CONSTRAINT "PK_47290aa5dfa3cc5595f468e2f39" PRIMARY KEY ("id"))`) + await db.query(`CREATE INDEX "IDX_0783af95efb35fb3f13cde1656" ON "ousd_convex_lusd_plus3_crv" ("timestamp") `) + await db.query(`CREATE INDEX "IDX_74ae01fb596a4f2733087ba454" ON "ousd_convex_lusd_plus3_crv" ("block_number") `) + await db.query(`ALTER TABLE "oeth_history" ADD CONSTRAINT "FK_94e47c4c49128c78f60b185b46b" FOREIGN KEY ("address_id") REFERENCES "oeth_address"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`) + await db.query(`ALTER TABLE "oeth_rebase" ADD CONSTRAINT "FK_3331819842173de7c27c046547a" FOREIGN KEY ("apy_id") REFERENCES "oethapy"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`) + await db.query(`ALTER TABLE "oeth_rebase_option" ADD CONSTRAINT "FK_034428879698039839b4ba6ffe8" FOREIGN KEY ("address_id") REFERENCES "oeth_address"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`) + await db.query(`ALTER TABLE "oeth_strategy_holding_daily_stat" ADD CONSTRAINT "FK_4e867f220975e615e6077d860c1" FOREIGN KEY ("strategy_daily_stat_id_id") REFERENCES "oeth_strategy_daily_stat"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`) + await db.query(`ALTER TABLE "oeth_strategy_daily_stat" ADD CONSTRAINT "FK_6c7096c96a000d8471256ca8fc3" FOREIGN KEY ("daily_stat_id_id") REFERENCES "oeth_daily_stat"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`) + await db.query(`ALTER TABLE "oeth_collateral_daily_stat" ADD CONSTRAINT "FK_a90045de50406be7bd56efd3ea4" FOREIGN KEY ("daily_stat_id_id") REFERENCES "oeth_daily_stat"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`) + await db.query(`ALTER TABLE "ousd_history" ADD CONSTRAINT "FK_70291ea600c0c4d67d9bfe6a6bf" FOREIGN KEY ("address_id") REFERENCES "ousd_address"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`) + await db.query(`ALTER TABLE "ousd_rebase" ADD CONSTRAINT "FK_427468c97f9838b804efd6c8e55" FOREIGN KEY ("apy_id") REFERENCES "ousdapy"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`) + await db.query(`ALTER TABLE "ousd_rebase_option" ADD CONSTRAINT "FK_b04173f9349ddd991a3b60e914a" FOREIGN KEY ("address_id") REFERENCES "ousd_address"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`) + } + + async down(db) { + await db.query(`DROP TABLE "exchange_rate"`) + await db.query(`DROP INDEX "public"."IDX_9e23a3f1bf3634820c873a0fe8"`) + await db.query(`DROP INDEX "public"."IDX_c61a93768eed9e58ce399bbe01"`) + await db.query(`DROP TABLE "balance"`) + await db.query(`DROP INDEX "public"."IDX_a956b410c329b8eca7898c3c51"`) + await db.query(`DROP INDEX "public"."IDX_6b451b59c9f6a6fdd685f530b2"`) + await db.query(`DROP TABLE "strategy_balance"`) + await db.query(`DROP INDEX "public"."IDX_0113bf0b63183bea0d22cd0d08"`) + await db.query(`DROP INDEX "public"."IDX_a88065dcd92011698bbe7df7b1"`) + await db.query(`DROP TABLE "strategy_yield"`) + await db.query(`DROP INDEX "public"."IDX_5108f2a2563d5665892d0c06b0"`) + await db.query(`DROP INDEX "public"."IDX_41c3567c9d43c598e07a0029c5"`) + await db.query(`DROP TABLE "strategy_daily_yield"`) + await db.query(`DROP INDEX "public"."IDX_0ba1974747f1906e0c102cd2cd"`) + await db.query(`DROP INDEX "public"."IDX_df364fb6e82d1feeed2a5dfffa"`) + await db.query(`DROP TABLE "curve_pool_balance"`) + await db.query(`DROP INDEX "public"."IDX_ffb0d0f86f03faacef7cb3e092"`) + await db.query(`DROP INDEX "public"."IDX_db5522c865eb8ed76fa7aeb4a8"`) + await db.query(`DROP TABLE "oeth"`) + await db.query(`DROP INDEX "public"."IDX_5b81a67229bac2d68e0dc92cc4"`) + await db.query(`DROP INDEX "public"."IDX_408e5f79f83093aa5cf2b0ea32"`) + await db.query(`DROP TABLE "oeth_history"`) + await db.query(`DROP INDEX "public"."IDX_94e47c4c49128c78f60b185b46"`) + await db.query(`DROP INDEX "public"."IDX_96956b1c8d29eb7066a97d5ea7"`) + await db.query(`DROP INDEX "public"."IDX_b14170bdb7fbc0775bf55df15d"`) + await db.query(`DROP TABLE "oeth_address"`) + await db.query(`DROP TABLE "oethapy"`) + await db.query(`DROP INDEX "public"."IDX_b1a448045d1ed9d655b679a371"`) + await db.query(`DROP INDEX "public"."IDX_6b8a7a706a0701e659a7d81508"`) + await db.query(`DROP INDEX "public"."IDX_c0c03168bb0139e3cffda4f00e"`) + await db.query(`DROP TABLE "oeth_rebase"`) + await db.query(`DROP INDEX "public"."IDX_fbb7b3f2fff9896eb683b86de7"`) + await db.query(`DROP INDEX "public"."IDX_d3255d02d9407bba89380d01fa"`) + await db.query(`DROP INDEX "public"."IDX_8b6bb0243472af88612fe6a01f"`) + await db.query(`DROP INDEX "public"."IDX_3331819842173de7c27c046547"`) + await db.query(`DROP TABLE "oeth_rebase_option"`) + await db.query(`DROP INDEX "public"."IDX_1fc6bbd88037bfbf4361776909"`) + await db.query(`DROP INDEX "public"."IDX_cbb7ceb49ef7c45432d0171296"`) + await db.query(`DROP INDEX "public"."IDX_355826dadaacc5ae2d63c82f28"`) + await db.query(`DROP INDEX "public"."IDX_034428879698039839b4ba6ffe"`) + await db.query(`DROP TABLE "oeth_vault"`) + await db.query(`DROP INDEX "public"."IDX_d6298a294864b4eaf793cf35a4"`) + await db.query(`DROP INDEX "public"."IDX_e20cb507a673817b2c68720415"`) + await db.query(`DROP TABLE "oeth_curve_lp"`) + await db.query(`DROP INDEX "public"."IDX_d9bbd20e888fa1b4b2c5d2f039"`) + await db.query(`DROP INDEX "public"."IDX_7617d593c36dce1b1565a8d74a"`) + await db.query(`DROP TABLE "oeth_frax_staking"`) + await db.query(`DROP INDEX "public"."IDX_ce6c2c65e90967dfeaac97025b"`) + await db.query(`DROP INDEX "public"."IDX_1a7f7d650390e2f9c212651e05"`) + await db.query(`DROP TABLE "oeth_morpho_aave"`) + await db.query(`DROP INDEX "public"."IDX_25e239b985844f1d33fac79981"`) + await db.query(`DROP INDEX "public"."IDX_a6662224e95eb6921bb14cb5f9"`) + await db.query(`DROP TABLE "oeth_dripper"`) + await db.query(`DROP INDEX "public"."IDX_16ac742ceeb05d28e530da9649"`) + await db.query(`DROP INDEX "public"."IDX_d356832c14603916a492608e7b"`) + await db.query(`DROP TABLE "oeth_balancer_meta_pool_strategy"`) + await db.query(`DROP INDEX "public"."IDX_5e7ef383756fa18cb602f50089"`) + await db.query(`DROP INDEX "public"."IDX_11d344b3e0e03cdb6697dd61f7"`) + await db.query(`DROP TABLE "oeth_strategy_holding_daily_stat"`) + await db.query(`DROP INDEX "public"."IDX_4e867f220975e615e6077d860c"`) + await db.query(`DROP TABLE "oeth_strategy_daily_stat"`) + await db.query(`DROP INDEX "public"."IDX_6c7096c96a000d8471256ca8fc"`) + await db.query(`DROP TABLE "oeth_collateral_daily_stat"`) + await db.query(`DROP INDEX "public"."IDX_a90045de50406be7bd56efd3ea"`) + await db.query(`DROP TABLE "oeth_daily_stat"`) + await db.query(`DROP INDEX "public"."IDX_98d9001013aa37425ca47b7126"`) + await db.query(`DROP INDEX "public"."IDX_c3e66051c7df4efd6a8fa8f9c1"`) + await db.query(`DROP TABLE "oeth_reward_token_collected"`) + await db.query(`DROP INDEX "public"."IDX_81a9fa43ae4a6ae63e4103127b"`) + await db.query(`DROP INDEX "public"."IDX_d36c78b9c3e9d737f067638bc4"`) + await db.query(`DROP TABLE "ogv"`) + await db.query(`DROP INDEX "public"."IDX_2418a8b8b92b2f5977be761cf9"`) + await db.query(`DROP INDEX "public"."IDX_b8f20bcf48e4aa77e0f48d77db"`) + await db.query(`DROP TABLE "staked_ogv"`) + await db.query(`DROP INDEX "public"."IDX_533195c60cfaef9e118789dee9"`) + await db.query(`DROP INDEX "public"."IDX_d601233411a33212b9d616aab0"`) + await db.query(`DROP TABLE "ogv_governance"`) + await db.query(`DROP INDEX "public"."IDX_a0329e7109d5959b9aa3d9d374"`) + await db.query(`DROP INDEX "public"."IDX_63cd1ca46771965c68f6b85898"`) + await db.query(`DROP TABLE "ousd"`) + await db.query(`DROP INDEX "public"."IDX_c8d1e285213b445b088805ac7c"`) + await db.query(`DROP INDEX "public"."IDX_806949dd853b7e8acab5d03b81"`) + await db.query(`DROP TABLE "ousd_history"`) + await db.query(`DROP INDEX "public"."IDX_70291ea600c0c4d67d9bfe6a6b"`) + await db.query(`DROP INDEX "public"."IDX_4d00d283e1ce3209dc43a0313c"`) + await db.query(`DROP INDEX "public"."IDX_0c25caa59aa053a688a723d160"`) + await db.query(`DROP TABLE "ousd_address"`) + await db.query(`DROP TABLE "ousdapy"`) + await db.query(`DROP INDEX "public"."IDX_c514963f42908ce84d65a84a77"`) + await db.query(`DROP INDEX "public"."IDX_4f606414b3b5ce1a366bd0fbf6"`) + await db.query(`DROP INDEX "public"."IDX_0e84a81a109b66fe6f01f77c74"`) + await db.query(`DROP TABLE "ousd_rebase"`) + await db.query(`DROP INDEX "public"."IDX_f8eb4a16ce58a146b3227ee21a"`) + await db.query(`DROP INDEX "public"."IDX_3fb03b1a410e64c7367226d0b6"`) + await db.query(`DROP INDEX "public"."IDX_1a76c478199672aaeec340f619"`) + await db.query(`DROP INDEX "public"."IDX_427468c97f9838b804efd6c8e5"`) + await db.query(`DROP TABLE "ousd_rebase_option"`) + await db.query(`DROP INDEX "public"."IDX_64bd23947dc4c67e3b6a3f9352"`) + await db.query(`DROP INDEX "public"."IDX_9b774e46b8b1cf7f828133809a"`) + await db.query(`DROP INDEX "public"."IDX_4e95bf069de04533d83a9a97fd"`) + await db.query(`DROP INDEX "public"."IDX_b04173f9349ddd991a3b60e914"`) + await db.query(`DROP TABLE "ousd_vault"`) + await db.query(`DROP INDEX "public"."IDX_6860186ea2f56e2c7d54c22107"`) + await db.query(`DROP INDEX "public"."IDX_0d0a7113a505cf7f7adea9ca81"`) + await db.query(`DROP TABLE "ousd_morpho_aave"`) + await db.query(`DROP INDEX "public"."IDX_78e0701c2e9a28242db37bd8f8"`) + await db.query(`DROP INDEX "public"."IDX_46ccf673b376d654052fbd53e6"`) + await db.query(`DROP TABLE "ousd_morpho_compound"`) + await db.query(`DROP INDEX "public"."IDX_9e7bd0d8ae23b877d5979ef80c"`) + await db.query(`DROP INDEX "public"."IDX_0bb3a0ad84071f1d80f6d4e90f"`) + await db.query(`DROP TABLE "maker_dsr_strategy"`) + await db.query(`DROP INDEX "public"."IDX_a35308a3c5dbaab2d321eb1525"`) + await db.query(`DROP INDEX "public"."IDX_844b219d8faf9b1d24ab2dba9a"`) + await db.query(`DROP TABLE "ousd_flux_strategy"`) + await db.query(`DROP INDEX "public"."IDX_5b165b5d30b13e363d33a66e14"`) + await db.query(`DROP INDEX "public"."IDX_80f3392968fde7b99cccb805ac"`) + await db.query(`DROP TABLE "ousd_compound_strategy"`) + await db.query(`DROP INDEX "public"."IDX_6920b1db5dc577295ac4d1379d"`) + await db.query(`DROP INDEX "public"."IDX_89c6d7d3104bd36dc88a37add4"`) + await db.query(`DROP TABLE "ousd_convex_strategy"`) + await db.query(`DROP INDEX "public"."IDX_2deac473cd0b2dd7082e7da148"`) + await db.query(`DROP INDEX "public"."IDX_157bf74171817dc5c60ee37036"`) + await db.query(`DROP TABLE "ousd_aave_strategy"`) + await db.query(`DROP INDEX "public"."IDX_ca34b5a0a33bc9abdd8213c2fa"`) + await db.query(`DROP INDEX "public"."IDX_dacd7c98223d7bc8be074d71e4"`) + await db.query(`DROP TABLE "ousd_meta_strategy"`) + await db.query(`DROP INDEX "public"."IDX_7e998dcf775263bc5df76ef987"`) + await db.query(`DROP INDEX "public"."IDX_55ce185680512d6a5b9fb0af89"`) + await db.query(`DROP TABLE "ousd_convex_lusd_plus3_crv"`) + await db.query(`DROP INDEX "public"."IDX_0783af95efb35fb3f13cde1656"`) + await db.query(`DROP INDEX "public"."IDX_74ae01fb596a4f2733087ba454"`) + await db.query(`ALTER TABLE "oeth_history" DROP CONSTRAINT "FK_94e47c4c49128c78f60b185b46b"`) + await db.query(`ALTER TABLE "oeth_rebase" DROP CONSTRAINT "FK_3331819842173de7c27c046547a"`) + await db.query(`ALTER TABLE "oeth_rebase_option" DROP CONSTRAINT "FK_034428879698039839b4ba6ffe8"`) + await db.query(`ALTER TABLE "oeth_strategy_holding_daily_stat" DROP CONSTRAINT "FK_4e867f220975e615e6077d860c1"`) + await db.query(`ALTER TABLE "oeth_strategy_daily_stat" DROP CONSTRAINT "FK_6c7096c96a000d8471256ca8fc3"`) + await db.query(`ALTER TABLE "oeth_collateral_daily_stat" DROP CONSTRAINT "FK_a90045de50406be7bd56efd3ea4"`) + await db.query(`ALTER TABLE "ousd_history" DROP CONSTRAINT "FK_70291ea600c0c4d67d9bfe6a6bf"`) + await db.query(`ALTER TABLE "ousd_rebase" DROP CONSTRAINT "FK_427468c97f9838b804efd6c8e55"`) + await db.query(`ALTER TABLE "ousd_rebase_option" DROP CONSTRAINT "FK_b04173f9349ddd991a3b60e914a"`) + } +} diff --git a/src/abi/frx-eth-frax-oracle.abi.ts b/src/abi/frx-eth-frax-oracle.abi.ts new file mode 100644 index 00000000..3a1fb51a --- /dev/null +++ b/src/abi/frx-eth-frax-oracle.abi.ts @@ -0,0 +1,553 @@ +export const ABI_JSON = [ + { + "type": "constructor", + "stateMutability": "undefined", + "payable": false, + "inputs": [ + { + "type": "tuple", + "name": "_params", + "components": [ + { + "type": "address", + "name": "timelockAddress" + }, + { + "type": "address", + "name": "baseErc20" + }, + { + "type": "address", + "name": "quoteErc20" + }, + { + "type": "address", + "name": "priceSource" + }, + { + "type": "uint256", + "name": "maximumDeviation" + }, + { + "type": "uint256", + "name": "maximumOracleDelay" + } + ] + } + ] + }, + { + "type": "error", + "name": "CalledWithFutureTimestamp", + "inputs": [] + }, + { + "type": "error", + "name": "CalledWithTimestampBeforePreviousRound", + "inputs": [] + }, + { + "type": "error", + "name": "NoPriceData", + "inputs": [] + }, + { + "type": "error", + "name": "OnlyPendingTimelock", + "inputs": [] + }, + { + "type": "error", + "name": "OnlyPriceSource", + "inputs": [] + }, + { + "type": "error", + "name": "OnlyTimelock", + "inputs": [] + }, + { + "type": "error", + "name": "SameMaximumDeviation", + "inputs": [] + }, + { + "type": "error", + "name": "SameMaximumOracleDelay", + "inputs": [] + }, + { + "type": "error", + "name": "SamePriceSource", + "inputs": [] + }, + { + "type": "event", + "anonymous": false, + "name": "SetMaximumDeviation", + "inputs": [ + { + "type": "uint256", + "name": "oldMaxDeviation", + "indexed": false + }, + { + "type": "uint256", + "name": "newMaxDeviation", + "indexed": false + } + ] + }, + { + "type": "event", + "anonymous": false, + "name": "SetMaximumOracleDelay", + "inputs": [ + { + "type": "uint256", + "name": "oldMaxOracleDelay", + "indexed": false + }, + { + "type": "uint256", + "name": "newMaxOracleDelay", + "indexed": false + } + ] + }, + { + "type": "event", + "anonymous": false, + "name": "SetPriceSource", + "inputs": [ + { + "type": "address", + "name": "oldPriceSource", + "indexed": false + }, + { + "type": "address", + "name": "newPriceSource", + "indexed": false + } + ] + }, + { + "type": "event", + "anonymous": false, + "name": "TimelockTransferStarted", + "inputs": [ + { + "type": "address", + "name": "previousTimelock", + "indexed": true + }, + { + "type": "address", + "name": "newTimelock", + "indexed": true + } + ] + }, + { + "type": "event", + "anonymous": false, + "name": "TimelockTransferred", + "inputs": [ + { + "type": "address", + "name": "previousTimelock", + "indexed": true + }, + { + "type": "address", + "name": "newTimelock", + "indexed": true + } + ] + }, + { + "type": "function", + "name": "BASE_TOKEN", + "constant": true, + "stateMutability": "view", + "payable": false, + "inputs": [], + "outputs": [ + { + "type": "address", + "name": "" + } + ] + }, + { + "type": "function", + "name": "QUOTE_TOKEN", + "constant": true, + "stateMutability": "view", + "payable": false, + "inputs": [], + "outputs": [ + { + "type": "address", + "name": "" + } + ] + }, + { + "type": "function", + "name": "acceptTransferTimelock", + "constant": false, + "payable": false, + "inputs": [], + "outputs": [] + }, + { + "type": "function", + "name": "addRoundData", + "constant": false, + "payable": false, + "inputs": [ + { + "type": "bool", + "name": "_isBadData" + }, + { + "type": "uint104", + "name": "_priceLow" + }, + { + "type": "uint104", + "name": "_priceHigh" + }, + { + "type": "uint40", + "name": "_timestamp" + } + ], + "outputs": [] + }, + { + "type": "function", + "name": "decimals", + "constant": true, + "stateMutability": "pure", + "payable": false, + "inputs": [], + "outputs": [ + { + "type": "uint8", + "name": "_decimals" + } + ] + }, + { + "type": "function", + "name": "description", + "constant": true, + "stateMutability": "pure", + "payable": false, + "inputs": [], + "outputs": [ + { + "type": "string", + "name": "_description" + } + ] + }, + { + "type": "function", + "name": "getPrices", + "constant": true, + "stateMutability": "view", + "payable": false, + "inputs": [], + "outputs": [ + { + "type": "bool", + "name": "_isBadData" + }, + { + "type": "uint256", + "name": "_priceLow" + }, + { + "type": "uint256", + "name": "_priceHigh" + } + ] + }, + { + "type": "function", + "name": "getRoundData", + "constant": true, + "stateMutability": "view", + "payable": false, + "inputs": [ + { + "type": "uint80", + "name": "_roundId" + } + ], + "outputs": [ + { + "type": "uint80", + "name": "roundId" + }, + { + "type": "int256", + "name": "answer" + }, + { + "type": "uint256", + "name": "startedAt" + }, + { + "type": "uint256", + "name": "updatedAt" + }, + { + "type": "uint80", + "name": "answeredInRound" + } + ] + }, + { + "type": "function", + "name": "lastCorrectRoundId", + "constant": true, + "stateMutability": "view", + "payable": false, + "inputs": [], + "outputs": [ + { + "type": "uint80", + "name": "" + } + ] + }, + { + "type": "function", + "name": "latestRoundData", + "constant": true, + "stateMutability": "view", + "payable": false, + "inputs": [], + "outputs": [ + { + "type": "uint80", + "name": "roundId" + }, + { + "type": "int256", + "name": "answer" + }, + { + "type": "uint256", + "name": "startedAt" + }, + { + "type": "uint256", + "name": "updatedAt" + }, + { + "type": "uint80", + "name": "answeredInRound" + } + ] + }, + { + "type": "function", + "name": "maximumDeviation", + "constant": true, + "stateMutability": "view", + "payable": false, + "inputs": [], + "outputs": [ + { + "type": "uint256", + "name": "" + } + ] + }, + { + "type": "function", + "name": "maximumOracleDelay", + "constant": true, + "stateMutability": "view", + "payable": false, + "inputs": [], + "outputs": [ + { + "type": "uint256", + "name": "" + } + ] + }, + { + "type": "function", + "name": "pendingTimelockAddress", + "constant": true, + "stateMutability": "view", + "payable": false, + "inputs": [], + "outputs": [ + { + "type": "address", + "name": "" + } + ] + }, + { + "type": "function", + "name": "priceSource", + "constant": true, + "stateMutability": "view", + "payable": false, + "inputs": [], + "outputs": [ + { + "type": "address", + "name": "" + } + ] + }, + { + "type": "function", + "name": "renounceTimelock", + "constant": false, + "payable": false, + "inputs": [], + "outputs": [] + }, + { + "type": "function", + "name": "rounds", + "constant": true, + "stateMutability": "view", + "payable": false, + "inputs": [ + { + "type": "uint256", + "name": "" + } + ], + "outputs": [ + { + "type": "uint104", + "name": "priceLow" + }, + { + "type": "uint104", + "name": "priceHigh" + }, + { + "type": "uint40", + "name": "timestamp" + }, + { + "type": "bool", + "name": "isBadData" + } + ] + }, + { + "type": "function", + "name": "setMaximumDeviation", + "constant": false, + "payable": false, + "inputs": [ + { + "type": "uint256", + "name": "_newMaxDeviation" + } + ], + "outputs": [] + }, + { + "type": "function", + "name": "setMaximumOracleDelay", + "constant": false, + "payable": false, + "inputs": [ + { + "type": "uint256", + "name": "_newMaxOracleDelay" + } + ], + "outputs": [] + }, + { + "type": "function", + "name": "setPriceSource", + "constant": false, + "payable": false, + "inputs": [ + { + "type": "address", + "name": "_newPriceSource" + } + ], + "outputs": [] + }, + { + "type": "function", + "name": "supportsInterface", + "constant": true, + "stateMutability": "view", + "payable": false, + "inputs": [ + { + "type": "bytes4", + "name": "interfaceId" + } + ], + "outputs": [ + { + "type": "bool", + "name": "" + } + ] + }, + { + "type": "function", + "name": "timelockAddress", + "constant": true, + "stateMutability": "view", + "payable": false, + "inputs": [], + "outputs": [ + { + "type": "address", + "name": "" + } + ] + }, + { + "type": "function", + "name": "transferTimelock", + "constant": false, + "payable": false, + "inputs": [ + { + "type": "address", + "name": "_newTimelock" + } + ], + "outputs": [] + }, + { + "type": "function", + "name": "version", + "constant": true, + "stateMutability": "view", + "payable": false, + "inputs": [], + "outputs": [ + { + "type": "uint256", + "name": "_version" + } + ] + } +] diff --git a/src/abi/frx-eth-frax-oracle.ts b/src/abi/frx-eth-frax-oracle.ts new file mode 100644 index 00000000..3c6bee1e --- /dev/null +++ b/src/abi/frx-eth-frax-oracle.ts @@ -0,0 +1,162 @@ +import * as ethers from 'ethers' +import {LogEvent, Func, ContractBase} from './abi.support' +import {ABI_JSON} from './frx-eth-frax-oracle.abi' + +export const abi = new ethers.Interface(ABI_JSON); + +export const events = { + SetMaximumDeviation: new LogEvent<([oldMaxDeviation: bigint, newMaxDeviation: bigint] & {oldMaxDeviation: bigint, newMaxDeviation: bigint})>( + abi, '0x7e2a21727a662d0def125b3d1237f41a099a760d472095091724cd8e56c25bf0' + ), + SetMaximumOracleDelay: new LogEvent<([oldMaxOracleDelay: bigint, newMaxOracleDelay: bigint] & {oldMaxOracleDelay: bigint, newMaxOracleDelay: bigint})>( + abi, '0xd72ef688fa430b6a285b84371ba35e8a8e0762b32c1deb7be9d9c111ca79f5ea' + ), + SetPriceSource: new LogEvent<([oldPriceSource: string, newPriceSource: string] & {oldPriceSource: string, newPriceSource: string})>( + abi, '0x964298b435edfc268e11aa89b342ef1ddac566da6759b6dd15d7aad58a1dc935' + ), + TimelockTransferStarted: new LogEvent<([previousTimelock: string, newTimelock: string] & {previousTimelock: string, newTimelock: string})>( + abi, '0x162998b90abc2507f3953aa797827b03a14c42dbd9a35f09feaf02e0d592773a' + ), + TimelockTransferred: new LogEvent<([previousTimelock: string, newTimelock: string] & {previousTimelock: string, newTimelock: string})>( + abi, '0x31b6c5a04b069b6ec1b3cef44c4e7c1eadd721349cda9823d0b1877b3551cdc6' + ), +} + +export const functions = { + BASE_TOKEN: new Func<[], {}, string>( + abi, '0x210663e4' + ), + QUOTE_TOKEN: new Func<[], {}, string>( + abi, '0x78892cea' + ), + acceptTransferTimelock: new Func<[], {}, []>( + abi, '0xf6ccaad4' + ), + addRoundData: new Func<[_isBadData: boolean, _priceLow: bigint, _priceHigh: bigint, _timestamp: number], {_isBadData: boolean, _priceLow: bigint, _priceHigh: bigint, _timestamp: number}, []>( + abi, '0x45d9f582' + ), + decimals: new Func<[], {}, number>( + abi, '0x313ce567' + ), + description: new Func<[], {}, string>( + abi, '0x7284e416' + ), + getPrices: new Func<[], {}, ([_isBadData: boolean, _priceLow: bigint, _priceHigh: bigint] & {_isBadData: boolean, _priceLow: bigint, _priceHigh: bigint})>( + abi, '0xbd9a548b' + ), + getRoundData: new Func<[_roundId: bigint], {_roundId: bigint}, ([roundId: bigint, answer: bigint, startedAt: bigint, updatedAt: bigint, answeredInRound: bigint] & {roundId: bigint, answer: bigint, startedAt: bigint, updatedAt: bigint, answeredInRound: bigint})>( + abi, '0x9a6fc8f5' + ), + lastCorrectRoundId: new Func<[], {}, bigint>( + abi, '0x0f4a05fb' + ), + latestRoundData: new Func<[], {}, ([roundId: bigint, answer: bigint, startedAt: bigint, updatedAt: bigint, answeredInRound: bigint] & {roundId: bigint, answer: bigint, startedAt: bigint, updatedAt: bigint, answeredInRound: bigint})>( + abi, '0xfeaf968c' + ), + maximumDeviation: new Func<[], {}, bigint>( + abi, '0x9152c29d' + ), + maximumOracleDelay: new Func<[], {}, bigint>( + abi, '0xcede91a4' + ), + pendingTimelockAddress: new Func<[], {}, string>( + abi, '0x090f3f50' + ), + priceSource: new Func<[], {}, string>( + abi, '0x20531bc9' + ), + renounceTimelock: new Func<[], {}, []>( + abi, '0x4f8b4ae7' + ), + rounds: new Func<[_: bigint], {}, ([priceLow: bigint, priceHigh: bigint, timestamp: number, isBadData: boolean] & {priceLow: bigint, priceHigh: bigint, timestamp: number, isBadData: boolean})>( + abi, '0x8c65c81f' + ), + setMaximumDeviation: new Func<[_newMaxDeviation: bigint], {_newMaxDeviation: bigint}, []>( + abi, '0x2dfa4267' + ), + setMaximumOracleDelay: new Func<[_newMaxOracleDelay: bigint], {_newMaxOracleDelay: bigint}, []>( + abi, '0xd2333be7' + ), + setPriceSource: new Func<[_newPriceSource: string], {_newPriceSource: string}, []>( + abi, '0xbda53107' + ), + supportsInterface: new Func<[interfaceId: string], {interfaceId: string}, boolean>( + abi, '0x01ffc9a7' + ), + timelockAddress: new Func<[], {}, string>( + abi, '0x4bc66f32' + ), + transferTimelock: new Func<[_newTimelock: string], {_newTimelock: string}, []>( + abi, '0x45014095' + ), + version: new Func<[], {}, bigint>( + abi, '0x54fd4d50' + ), +} + +export class Contract extends ContractBase { + + BASE_TOKEN(): Promise { + return this.eth_call(functions.BASE_TOKEN, []) + } + + QUOTE_TOKEN(): Promise { + return this.eth_call(functions.QUOTE_TOKEN, []) + } + + decimals(): Promise { + return this.eth_call(functions.decimals, []) + } + + description(): Promise { + return this.eth_call(functions.description, []) + } + + getPrices(): Promise<([_isBadData: boolean, _priceLow: bigint, _priceHigh: bigint] & {_isBadData: boolean, _priceLow: bigint, _priceHigh: bigint})> { + return this.eth_call(functions.getPrices, []) + } + + getRoundData(_roundId: bigint): Promise<([roundId: bigint, answer: bigint, startedAt: bigint, updatedAt: bigint, answeredInRound: bigint] & {roundId: bigint, answer: bigint, startedAt: bigint, updatedAt: bigint, answeredInRound: bigint})> { + return this.eth_call(functions.getRoundData, [_roundId]) + } + + lastCorrectRoundId(): Promise { + return this.eth_call(functions.lastCorrectRoundId, []) + } + + latestRoundData(): Promise<([roundId: bigint, answer: bigint, startedAt: bigint, updatedAt: bigint, answeredInRound: bigint] & {roundId: bigint, answer: bigint, startedAt: bigint, updatedAt: bigint, answeredInRound: bigint})> { + return this.eth_call(functions.latestRoundData, []) + } + + maximumDeviation(): Promise { + return this.eth_call(functions.maximumDeviation, []) + } + + maximumOracleDelay(): Promise { + return this.eth_call(functions.maximumOracleDelay, []) + } + + pendingTimelockAddress(): Promise { + return this.eth_call(functions.pendingTimelockAddress, []) + } + + priceSource(): Promise { + return this.eth_call(functions.priceSource, []) + } + + rounds(arg0: bigint): Promise<([priceLow: bigint, priceHigh: bigint, timestamp: number, isBadData: boolean] & {priceLow: bigint, priceHigh: bigint, timestamp: number, isBadData: boolean})> { + return this.eth_call(functions.rounds, [arg0]) + } + + supportsInterface(interfaceId: string): Promise { + return this.eth_call(functions.supportsInterface, [interfaceId]) + } + + timelockAddress(): Promise { + return this.eth_call(functions.timelockAddress, []) + } + + version(): Promise { + return this.eth_call(functions.version, []) + } +} diff --git a/src/shared/processor-templates/strategy/strategy-daily-earnings.ts b/src/shared/processor-templates/strategy/strategy-daily-earnings.ts index 2d3cc557..53ca014b 100644 --- a/src/shared/processor-templates/strategy/strategy-daily-earnings.ts +++ b/src/shared/processor-templates/strategy/strategy-daily-earnings.ts @@ -1,6 +1,6 @@ import dayjs from 'dayjs' import { compact } from 'lodash' -import { Between, In, LessThan } from 'typeorm' +import { Between, In, LessThan, LessThanOrEqual } from 'typeorm' import { StrategyDailyYield, StrategyYield } from '../../../model' import { Block, Context } from '../../../processor' @@ -44,15 +44,40 @@ export const processStrategyDailyEarnings = async ( } // Get the latest StrategyYield results. - const yields = await ctx.store.find(StrategyYield, { + const todayYields = await ctx.store.find(StrategyYield, { where: { strategy: strategyData.address, asset: In(strategyData.assets), - blockNumber: Between(latest?.blockNumber ?? 0, block.header.height), + blockNumber: Between( + (latest?.blockNumber ?? 0) + 1, + block.header.height, + ), }, order: { id: 'desc' }, }) + let yields: StrategyYield[] = [] + await Promise.all( + strategyData.assets.map(async (asset) => { + const todayAssetYields = todayYields.filter((y) => y.asset === asset) + if (todayAssetYields.length > 0) { + yields.push(...todayAssetYields) + } else { + const latestAssetYield = await ctx.store.findOne(StrategyYield, { + where: { + strategy: strategyData.address, + asset, + blockNumber: LessThanOrEqual(block.header.height), + }, + order: { id: 'desc' }, + }) + if (latestAssetYield) { + yields.push(latestAssetYield) + } + } + }), + ) + // TODO: This is good except sometimes certain assets get yield while other's don't on a specific day. // So if for one of our assets this has no results, then we need to look back for whatever the last // balance/earnings were so we can populate today's values properly. @@ -65,28 +90,51 @@ export const processStrategyDailyEarnings = async ( yields.map((y) => ['ETH', y.asset as Currency]), ).then(compact) + // Sort so following `.find` actions get the most recent. + yields.sort((a, b) => b.blockNumber - a.blockNumber) + // Convert into ETH values const ethBalance = yields.reduce( (sum, y) => sum + convertRate(rates, 'ETH', y.asset as Currency, y.balance), 0n, ) - const ethEarnings = yields.reduce( - (sum, y) => - sum + convertRate(rates, 'ETH', y.asset as Currency, y.earnings), - 0n, - ) - const ethEarningsChange = yields.reduce( - (sum, y) => - sum + convertRate(rates, 'ETH', y.asset as Currency, y.earningsChange), - 0n, - ) + const ethEarnings = strategyData.assets.reduce((sum, asset) => { + const strategyYield = yields.find((y) => y.asset === asset) + return ( + sum + + convertRate( + rates, + 'ETH', + asset as Currency, + strategyYield?.earnings ?? 0n, + ) + ) + }, 0n) + + const ethEarningsChange = strategyData.assets.reduce((sum, asset) => { + const strategyYield = yields.find((y) => y.asset === asset) + return ( + sum + + convertRate( + rates, + 'ETH', + asset as Currency, + strategyYield?.earningsChange ?? 0n, + ) + ) + }, 0n) // Apply ETH values current.balance = ethBalance current.earnings = ethEarnings current.earningsChange = ethEarningsChange + if (current.earnings < (latest?.earnings ?? 0n)) { + ctx.log.info({ current, latest, yields }) + // throw new Error('how!??!?!') + } + // Calculate APY values if (latest) { // ctx.log.info( From f1a68fdbe9a47cff7febbb8b4a7b7da5a797c7dd Mon Sep 17 00:00:00 2001 From: Chris Jacobs Date: Sat, 4 Nov 2023 22:11:16 -0700 Subject: [PATCH 09/34] wip on daily earnings with APY --- .../strategy/strategy-daily-earnings.ts | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/shared/processor-templates/strategy/strategy-daily-earnings.ts b/src/shared/processor-templates/strategy/strategy-daily-earnings.ts index 53ca014b..a78fed3d 100644 --- a/src/shared/processor-templates/strategy/strategy-daily-earnings.ts +++ b/src/shared/processor-templates/strategy/strategy-daily-earnings.ts @@ -94,12 +94,7 @@ export const processStrategyDailyEarnings = async ( yields.sort((a, b) => b.blockNumber - a.blockNumber) // Convert into ETH values - const ethBalance = yields.reduce( - (sum, y) => - sum + convertRate(rates, 'ETH', y.asset as Currency, y.balance), - 0n, - ) - const ethEarnings = strategyData.assets.reduce((sum, asset) => { + const ethBalance = strategyData.assets.reduce((sum, asset) => { const strategyYield = yields.find((y) => y.asset === asset) return ( sum + @@ -107,12 +102,11 @@ export const processStrategyDailyEarnings = async ( rates, 'ETH', asset as Currency, - strategyYield?.earnings ?? 0n, + strategyYield?.balance ?? 0n, ) ) }, 0n) - - const ethEarningsChange = strategyData.assets.reduce((sum, asset) => { + const ethEarnings = strategyData.assets.reduce((sum, asset) => { const strategyYield = yields.find((y) => y.asset === asset) return ( sum + @@ -120,11 +114,17 @@ export const processStrategyDailyEarnings = async ( rates, 'ETH', asset as Currency, - strategyYield?.earningsChange ?? 0n, + strategyYield?.earnings ?? 0n, ) ) }, 0n) + const ethEarningsChange = todayYields.reduce( + (sum, y) => + sum + convertRate(rates, 'ETH', y.asset as Currency, y.earningsChange), + 0n, + ) + // Apply ETH values current.balance = ethBalance current.earnings = ethEarnings From 9402e259fd571134102db6783076227455869cba Mon Sep 17 00:00:00 2001 From: Chris Jacobs Date: Sun, 5 Nov 2023 08:56:06 -0800 Subject: [PATCH 10/34] wip on daily earnings with APY --- .../strategy/strategy-daily-earnings.ts | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/shared/processor-templates/strategy/strategy-daily-earnings.ts b/src/shared/processor-templates/strategy/strategy-daily-earnings.ts index a78fed3d..1faeb6e4 100644 --- a/src/shared/processor-templates/strategy/strategy-daily-earnings.ts +++ b/src/shared/processor-templates/strategy/strategy-daily-earnings.ts @@ -137,16 +137,15 @@ export const processStrategyDailyEarnings = async ( // Calculate APY values if (latest) { - // ctx.log.info( - // `Calculating APR: ${formatEther(latest.balance)} ${formatEther( - // current.earningsChange, - // )}`, - // ) + // On Frax Staking if we only use `latest.balance` we get crazy APY. + // (only early on) + // On Morpho Aave v2 if we only use `current.balance` we get 0 APY. + // I've done `current.balance || latest?.balance` to try and balance out what we see. const { apr, apy } = calculateAPY( latest.timestamp, current.timestamp, - current.balance, - current.balance + current.earningsChange, + current.balance || latest?.balance, + (current.balance || latest?.balance) + current.earningsChange, ) current.apr = apr current.apy = apy From 05b0d0b39d977f6efe8a39969743f85576146dca Mon Sep 17 00:00:00 2001 From: Chris Jacobs Date: Mon, 6 Nov 2023 12:25:54 -0800 Subject: [PATCH 11/34] Change StrategyYield to store values as ETH, avoiding conversion work on StrategyDailyYield --- .../exchange-rates/exchange-rates.ts | 4 +- .../exchange-rates/price-routing.ts | 3 + .../strategy/strategy-daily-earnings.ts | 89 ++++-------- .../strategy/strategy-earnings.ts | 129 ++++++++++++------ 4 files changed, 114 insertions(+), 111 deletions(-) diff --git a/src/shared/post-processors/exchange-rates/exchange-rates.ts b/src/shared/post-processors/exchange-rates/exchange-rates.ts index 2df383f8..6162ee77 100644 --- a/src/shared/post-processors/exchange-rates/exchange-rates.ts +++ b/src/shared/post-processors/exchange-rates/exchange-rates.ts @@ -1,3 +1,5 @@ +import { compact } from 'lodash' + import { ExchangeRate } from '../../../model' import { Block, Context } from '../../../processor' import { useProcessorState } from '../../../utils/state' @@ -57,5 +59,5 @@ export const ensureExchangeRates = async ( ) => { return await Promise.all( pairs.map(([base, quote]) => ensureExchangeRate(ctx, block, base, quote)), - ) + ).then(compact) } diff --git a/src/shared/post-processors/exchange-rates/price-routing.ts b/src/shared/post-processors/exchange-rates/price-routing.ts index 845bdf51..7eb34d9c 100644 --- a/src/shared/post-processors/exchange-rates/price-routing.ts +++ b/src/shared/post-processors/exchange-rates/price-routing.ts @@ -18,6 +18,9 @@ export const getPrice = async ( if (base === 'ETH' && quote === 'WETH') { return 1_000_000_000_000_000_000n } + if (base === 'ETH' && quote === 'ETH') { + return 1_000_000_000_000_000_000n + } if (base === 'ETH' && quote === 'sfrxETH') { return getStakedFraxPrice(ctx, block) } diff --git a/src/shared/processor-templates/strategy/strategy-daily-earnings.ts b/src/shared/processor-templates/strategy/strategy-daily-earnings.ts index 1faeb6e4..ae435f1e 100644 --- a/src/shared/processor-templates/strategy/strategy-daily-earnings.ts +++ b/src/shared/processor-templates/strategy/strategy-daily-earnings.ts @@ -47,7 +47,7 @@ export const processStrategyDailyEarnings = async ( const todayYields = await ctx.store.find(StrategyYield, { where: { strategy: strategyData.address, - asset: In(strategyData.assets), + asset: ETH_ADDRESS, blockNumber: Between( (latest?.blockNumber ?? 0) + 1, block.header.height, @@ -57,81 +57,40 @@ export const processStrategyDailyEarnings = async ( }) let yields: StrategyYield[] = [] - await Promise.all( - strategyData.assets.map(async (asset) => { - const todayAssetYields = todayYields.filter((y) => y.asset === asset) - if (todayAssetYields.length > 0) { - yields.push(...todayAssetYields) - } else { - const latestAssetYield = await ctx.store.findOne(StrategyYield, { - where: { - strategy: strategyData.address, - asset, - blockNumber: LessThanOrEqual(block.header.height), - }, - order: { id: 'desc' }, - }) - if (latestAssetYield) { - yields.push(latestAssetYield) - } - } - }), - ) - - // TODO: This is good except sometimes certain assets get yield while other's don't on a specific day. - // So if for one of our assets this has no results, then we need to look back for whatever the last - // balance/earnings were so we can populate today's values properly. - // (since today's values are an aggregate of all assets) - - // Get ETH rates for all StrategyYield assets. - const rates = await ensureExchangeRates( - ctx, - block, - yields.map((y) => ['ETH', y.asset as Currency]), - ).then(compact) + if (todayYields.length > 0) { + yields.push(...todayYields) + } else { + const latestAssetYield = await ctx.store.findOne(StrategyYield, { + where: { + strategy: strategyData.address, + asset: ETH_ADDRESS, + blockNumber: LessThanOrEqual(block.header.height), + }, + order: { id: 'desc' }, + }) + if (latestAssetYield) { + yields.push(latestAssetYield) + } + } // Sort so following `.find` actions get the most recent. yields.sort((a, b) => b.blockNumber - a.blockNumber) // Convert into ETH values - const ethBalance = strategyData.assets.reduce((sum, asset) => { - const strategyYield = yields.find((y) => y.asset === asset) - return ( - sum + - convertRate( - rates, - 'ETH', - asset as Currency, - strategyYield?.balance ?? 0n, - ) - ) - }, 0n) - const ethEarnings = strategyData.assets.reduce((sum, asset) => { - const strategyYield = yields.find((y) => y.asset === asset) - return ( - sum + - convertRate( - rates, - 'ETH', - asset as Currency, - strategyYield?.earnings ?? 0n, - ) - ) - }, 0n) - - const ethEarningsChange = todayYields.reduce( - (sum, y) => - sum + convertRate(rates, 'ETH', y.asset as Currency, y.earningsChange), + const balance = yields[yields.length - 1].balance + const earnings = yields[yields.length - 1].earnings + const earningsChange = todayYields.reduce( + (sum, y) => sum + y.earningsChange, 0n, ) // Apply ETH values - current.balance = ethBalance - current.earnings = ethEarnings - current.earningsChange = ethEarningsChange + current.balance = balance + current.earnings = earnings + current.earningsChange = earningsChange if (current.earnings < (latest?.earnings ?? 0n)) { - ctx.log.info({ current, latest, yields }) + ctx.log.info({ current, latest, yields }, 'earnings went down :(') // throw new Error('how!??!?!') } diff --git a/src/shared/processor-templates/strategy/strategy-earnings.ts b/src/shared/processor-templates/strategy/strategy-earnings.ts index 7afbfc63..a0489e2a 100644 --- a/src/shared/processor-templates/strategy/strategy-earnings.ts +++ b/src/shared/processor-templates/strategy/strategy-earnings.ts @@ -10,11 +10,20 @@ import { StrategyYield } from '../../../model' import { Block, Context } from '../../../processor' import { AURA_REWARDS_POOL_ADDRESS, + ETH_ADDRESS, OETH_DRIPPER_ADDRESS, OETH_HARVESTER_ADDRESS, WETH_ADDRESS, } from '../../../utils/addresses' import { lastExcept } from '../../../utils/utils' +import { + ensureExchangeRate, + ensureExchangeRates, +} from '../../post-processors/exchange-rates' +import { + Currency, + convertRate, +} from '../../post-processors/exchange-rates/currencies' import { IStrategyData } from './strategy' import { processStrategyDailyEarnings } from './strategy-daily-earnings' @@ -100,38 +109,36 @@ export const processStrategyEarnings = async ( block.header, strategyData, ) - return { previousBalances, balances } + return balances.map((balance, i) => { + return { + asset: balance.asset, + balance: balance.balance, + previousBalance: previousBalances[i].balance, + } + }) } const balanceTrackingUpdate = async () => { ctx.log.info(`balanceTrackingUpdate`) days.set(dayId, block) - const { previousBalances, balances } = await getBalances() - await Promise.all( - strategyData.assets.map((asset) => { - return processDepositWithdrawal( - ctx, - strategyData, - block, - strategyYields, - asset, - previousBalances.find((b) => b.asset === asset)!.balance, - balances.find((b) => b.asset === asset)!.balance, - ) - }), + const balances = await getBalances() + await processDepositWithdrawal( + ctx, + strategyData, + block, + strategyYields, + balances, ) } const balanceTrackingUpdateBalancerMetaStablePool = async () => { ctx.log.info(`balanceTrackingUpdateBalancerMetaStablePool`) days.set(dayId, block) - const { previousBalances, balances } = await getBalances() + const balances = await getBalances() await processDepositWithdrawal( ctx, strategyData, block, strategyYields, - strategyData.balancerPoolInfo!.poolAddress, - previousBalances.reduce((sum, b) => sum + b.balance, 0n), - balances.reduce((sum, b) => sum + b.balance, 0n), + balances, ) } if ( @@ -208,7 +215,7 @@ const processRewardTokenCollected = async ( resultMap: Map, params: { token: string; amount: bigint }, ) => { - const id = `${block.header.height}:${strategyData.address}:${params.token}` + const id = `${block.header.height}:${strategyData.address}:${ETH_ADDRESS}` // ctx.log.info(`processRewardTokenCollected ${id}`) // ctx.log.info(`Amount earned through rewards: ${formatEther(params.amount)}`) let { latest, current, results } = await getLatest( @@ -216,24 +223,40 @@ const processRewardTokenCollected = async ( block, resultMap, strategyData, - params.token, + ETH_ADDRESS, id, ) + + // Convert value to ETH + const rate = await ensureExchangeRate( + ctx, + block, + 'ETH', + params.token as Currency, + ) + + const amount = convertRate( + [rate!], + 'ETH', + params.token as Currency, + params.amount, + ) + if (!current) { current = new StrategyYield({ id, blockNumber: block.header.height, timestamp: new Date(block.header.timestamp), strategy: strategyData.address, - asset: params.token, + asset: ETH_ADDRESS, balance: latest?.balance ?? 0n, - earnings: (latest?.earnings ?? 0n) + params.amount, - earningsChange: params.amount, + earnings: (latest?.earnings ?? 0n) + amount, + earningsChange: amount, }) results.push(current) } else { - current.earnings += params.amount - current.earningsChange += params.amount + current.earnings += amount + current.earningsChange += amount } } @@ -242,46 +265,62 @@ const processDepositWithdrawal = async ( strategyData: IStrategyData, block: Block, resultMap: Map, - asset: string, - previousBalance: bigint, - balance: bigint, + assets: { + asset: string + previousBalance: bigint + balance: bigint + }[], ) => { - const id = `${block.header.height}:${strategyData.address}:${asset}` - ctx.log.info(`processDepositWithdrawal ${id}`) + const id = `${block.header.height}:${strategyData.address}:${ETH_ADDRESS}` + ctx.log.info(assets, `processDepositWithdrawal ${id}`) let { latest, current, results } = await getLatest( ctx, block, resultMap, strategyData, - asset, + ETH_ADDRESS, id, ) + if (!current) { + // Convert incoming values to ETH + const rates = await ensureExchangeRates( + ctx, + block, + assets.map((a) => ['ETH', a.asset as Currency]), + ) + const previousBalance = assets.reduce((sum, a) => { + return ( + sum + convertRate(rates, 'ETH', a.asset as Currency, a.previousBalance) + ) + }, 0n) + const balance = assets.reduce((sum, a) => { + return sum + convertRate(rates, 'ETH', a.asset as Currency, a.balance) + }, 0n) + const timestamp = new Date(block.header.timestamp) - const earningsChange = + let earningsChange = previousBalance - (latest?.balance ?? previousBalance) ?? 0n + current = new StrategyYield({ id, blockNumber: block.header.height, timestamp, strategy: strategyData.address, - asset, + asset: ETH_ADDRESS, balance, earningsChange, earnings: (latest?.earnings ?? 0n) + earningsChange, }) - ctx.log.info(`Earnings change: ${formatEther(earningsChange)}`) - // ctx.log.info( - // `${asset} Setting balance: ${formatEther( - // balance, - // )}, last balance: ${formatEther( - // latest?.balance ?? 0n, - // )}, previous block balance: ${formatEther( - // previousBalance, - // )}, perceived earnings: ${formatEther( - // earningsChange, - // )}, total earnings: ${formatEther(current.earnings)}`, - // ) + ctx.log.info( + `Setting balance: ${formatEther(balance)}, last balance: ${formatEther( + latest?.balance ?? 0n, + )}, previous block balance: ${formatEther( + previousBalance, + )}, perceived earnings: ${formatEther( + earningsChange, + )}, total earnings: ${formatEther(current.earnings)}`, + ) if (earningsChange < 0) { ctx.log.warn('WARNING: earnings change is negative') } From ef0e10ec5a623561d31b033344c1705f30c83114 Mon Sep 17 00:00:00 2001 From: Chris Jacobs Date: Tue, 7 Nov 2023 08:41:46 -0800 Subject: [PATCH 12/34] Treat assets as interchangeable rather than converting via rates --- src/main-oeth.ts | 20 +- .../exchange-rates/currencies.ts | 2 +- .../exchange-rates/exchange-rates.ts | 47 ++++- .../exchange-rates/price-routing.ts | 51 ++--- .../strategy/strategy-daily-earnings.ts | 12 +- .../strategy/strategy-earnings.ts | 193 +++++++++++------- src/utils/blockFrequencyUpdater.ts | 27 ++- 7 files changed, 213 insertions(+), 139 deletions(-) diff --git a/src/main-oeth.ts b/src/main-oeth.ts index eb923c13..e456107d 100644 --- a/src/main-oeth.ts +++ b/src/main-oeth.ts @@ -15,16 +15,16 @@ import * as exchangeRatesPostProcessor from './shared/post-processors/exchange-r run({ stateSchema: 'oeth-processor', processors: [ - // oeth, - // vault, - // fraxStaking, - // morphoAave, - // dripper, - // curveLp, - // balancerMetaPoolStrategy, + oeth, + vault, + fraxStaking, + morphoAave, + dripper, + curveLp, + balancerMetaPoolStrategy, strategies, - // exchangeRates, + exchangeRates, ], - // postProcessors: [exchangeRatesPostProcessor, dailyStats], - // validators: [validateOeth], + postProcessors: [exchangeRatesPostProcessor, dailyStats], + validators: [validateOeth], }) diff --git a/src/shared/post-processors/exchange-rates/currencies.ts b/src/shared/post-processors/exchange-rates/currencies.ts index 35d46576..39005629 100644 --- a/src/shared/post-processors/exchange-rates/currencies.ts +++ b/src/shared/post-processors/exchange-rates/currencies.ts @@ -21,7 +21,7 @@ export const currenciesByAddress = mapKeys(invert(currencies), (v, k) => const eth1 = 1000000000000000000n export const convertRate = ( - rates: ExchangeRate[], + rates: Pick[], base: Currency, quote: Currency, balance: bigint, diff --git a/src/shared/post-processors/exchange-rates/exchange-rates.ts b/src/shared/post-processors/exchange-rates/exchange-rates.ts index 6162ee77..828c630c 100644 --- a/src/shared/post-processors/exchange-rates/exchange-rates.ts +++ b/src/shared/post-processors/exchange-rates/exchange-rates.ts @@ -1,4 +1,5 @@ import { compact } from 'lodash' +import { Between } from 'typeorm' import { ExchangeRate } from '../../../model' import { Block, Context } from '../../../processor' @@ -33,10 +34,12 @@ export const ensureExchangeRate = async ( if (exchangeRate) return exchangeRate const timestamp = new Date(block.header.timestamp) - const price = await getPrice(ctx, block, base, quote).catch((err) => { - ctx.log.info({ base, quote, err, message: err.message }) - throw err - }) + const price = await getPrice(ctx, block.header.height, base, quote).catch( + (err) => { + ctx.log.info({ base, quote, err, message: err.message }) + throw err + }, + ) if (price) { exchangeRate = new ExchangeRate({ id, @@ -61,3 +64,39 @@ export const ensureExchangeRates = async ( pairs.map(([base, quote]) => ensureExchangeRate(ctx, block, base, quote)), ).then(compact) } + +// export const ensureExchangeRatesAverages = async ( +// ctx: Context, +// block: Block, +// from: Date, +// to: Date, +// pairs: [Currency, Currency][], +// ) => { +// return await Promise.all( +// pairs.map(([base, quote]) => +// ensureExchangeRate(ctx, block, base, quote) +// .then((rate) => { +// if (!rate) return [] +// return ctx.store +// .find(ExchangeRate, { +// where: { pair: rate?.pair, timestamp: Between(from, to) }, +// }) +// .then((rates) => rates.concat(rate!)) +// }) +// .then((rates) => { +// const pair = `${base}_${quote}` +// const rate = +// rates.reduce((sum, r) => sum + r.rate, 0n) / BigInt(rates.length) +// ctx.log.info( +// `Created average exchange rate of ${rate} using ${rates.length} rates`, +// ) +// return new ExchangeRate({ +// base: rates[0].base, +// quote: rates[0].quote, +// pair, +// rate, +// }) +// }), +// ), +// ) +// } diff --git a/src/shared/post-processors/exchange-rates/price-routing.ts b/src/shared/post-processors/exchange-rates/price-routing.ts index 7eb34d9c..de4d9060 100644 --- a/src/shared/post-processors/exchange-rates/price-routing.ts +++ b/src/shared/post-processors/exchange-rates/price-routing.ts @@ -3,12 +3,12 @@ import * as eacAggregatorProxy from '../../../abi/eac-aggregator-proxy' import * as frxEthFraxOracle from '../../../abi/frx-eth-frax-oracle' import * as oethOracleRouter from '../../../abi/oeth-oracle-router' import * as stakedFraxEth from '../../../abi/sfrx-eth' -import { Block, Context } from '../../../processor' +import { Context } from '../../../processor' import { Currency, CurrencySymbol, currencies } from './currencies' export const getPrice = async ( ctx: Context, - block: Block, + height: number, base: Currency, quote: Currency, ) => { @@ -22,30 +22,26 @@ export const getPrice = async ( return 1_000_000_000_000_000_000n } if (base === 'ETH' && quote === 'sfrxETH') { - return getStakedFraxPrice(ctx, block) + return getStakedFraxPrice(ctx, height) } if (base === 'ETH' && quote === 'rETH') { - return getRETHPrice(ctx, block) + return getRETHPrice(ctx, height) } if (base === 'ETH' && quote === 'frxETH') { - return getFrxEthPrice(ctx, block) + return getFrxEthPrice(ctx, height) } - if ( - base === 'ETH' && - oethOracleCurrencies.has(quote) && - block.header.height >= 18032298 - ) { - return getOethOraclePrice(ctx, block, quote) + if (base === 'ETH' && oethOracleCurrencies.has(quote) && height >= 18032298) { + return getOethOraclePrice(ctx, height, quote) } - return getChainlinkPrice(ctx, block, base, quote) + return getChainlinkPrice(ctx, height, base, quote) } const rETHRegistryAddress = '0x536218f9E9Eb48863970252233c8F271f554C2d0' -export const getRETHPrice = (ctx: Context, block: Block) => { - if (block.header.height < 16700133) return undefined +export const getRETHPrice = (ctx: Context, height: number) => { + if (height < 16700133) return undefined const registry = new eacAggregatorProxy.Contract( ctx, - block.header, + { height }, rETHRegistryAddress, ) return registry.latestAnswer() @@ -54,13 +50,13 @@ export const getRETHPrice = (ctx: Context, block: Block) => { const registryAddress = '0x47fb2585d2c56fe188d0e6ec628a38b74fceeedf' export const getChainlinkPrice = async ( ctx: Context, - block: Block, + height: number, base: Currency, quote: Currency, ) => { const registry = new chainlinkFeedRegistry.Contract( ctx, - block.header, + { height }, registryAddress, ) try { @@ -81,34 +77,31 @@ export const oethOracleCurrencies = new Set(['WETH', 'stETH', 'frxETH']) const oethOracleAddress = '0xbE19cC5654e30dAF04AD3B5E06213D70F4e882eE' export const getOethOraclePrice = ( ctx: Context, - block: Block, + height: number, quote: Currency, ) => { const router = new oethOracleRouter.Contract( ctx, - block.header, + { height }, oethOracleAddress, ) return router.price(currencies[quote as CurrencySymbol] ?? quote) } const stakedFraxAddress = '0xac3e018457b222d93114458476f3e3416abbe38f' -export const getStakedFraxPrice = (ctx: Context, block: Block) => { - if (block.header.height < 15686046) return undefined - const router = new stakedFraxEth.Contract( - ctx, - block.header, - stakedFraxAddress, - ) +export const getStakedFraxPrice = (ctx: Context, height: number) => { + if (height < 15686046) return undefined + const router = new stakedFraxEth.Contract(ctx, { height }, stakedFraxAddress) return router.previewRedeem(1_000_000_000_000_000_000n) } const frxEthFraxOracleAddress = '0xC58F3385FBc1C8AD2c0C9a061D7c13b141D7A5Df' -export const getFrxEthPrice = (ctx: Context, block: Block) => { - if (block.header.height < 17571367) return 1_000_000_000_000_000_000n +export const getFrxEthPrice = (ctx: Context, height: number) => { + // Deploy block of 17571367 doesn't work, so we wait until it is functional. + if (height < 17571500) return 1_000_000_000_000_000_000n const frxEth = new frxEthFraxOracle.Contract( ctx, - block.header, + { height }, frxEthFraxOracleAddress, ) return frxEth.latestRoundData().then((lrd) => lrd.answer) diff --git a/src/shared/processor-templates/strategy/strategy-daily-earnings.ts b/src/shared/processor-templates/strategy/strategy-daily-earnings.ts index ae435f1e..632a0b2f 100644 --- a/src/shared/processor-templates/strategy/strategy-daily-earnings.ts +++ b/src/shared/processor-templates/strategy/strategy-daily-earnings.ts @@ -7,11 +7,6 @@ import { Block, Context } from '../../../processor' import { ETH_ADDRESS } from '../../../utils/addresses' import { calculateAPY } from '../../../utils/calculateAPY' import { lastExcept } from '../../../utils/utils' -import { ensureExchangeRates } from '../../post-processors/exchange-rates' -import { - Currency, - convertRate, -} from '../../post-processors/exchange-rates/currencies' import { IStrategyData } from './strategy' export const processStrategyDailyEarnings = async ( @@ -21,6 +16,7 @@ export const processStrategyDailyEarnings = async ( ) => { const results: StrategyDailyYield[] = [] for (const block of blocks) { + if (block.header.height < strategyData.from) return const day = dayjs.utc(block.header.timestamp).format('YYYY-MM-DD') const id = `${strategyData.address}:${ETH_ADDRESS}:${day}` // ctx.log.info(`processStrategyDailyEarnings ${block.header.height} ${id}`) @@ -53,7 +49,7 @@ export const processStrategyDailyEarnings = async ( block.header.height, ), }, - order: { id: 'desc' }, + order: { id: 'asc' }, }) let yields: StrategyYield[] = [] @@ -77,8 +73,8 @@ export const processStrategyDailyEarnings = async ( yields.sort((a, b) => b.blockNumber - a.blockNumber) // Convert into ETH values - const balance = yields[yields.length - 1].balance - const earnings = yields[yields.length - 1].earnings + const balance = yields[yields.length - 1]?.balance ?? 0n + const earnings = yields[yields.length - 1]?.earnings ?? 0n const earningsChange = todayYields.reduce( (sum, y) => sum + y.earningsChange, 0n, diff --git a/src/shared/processor-templates/strategy/strategy-earnings.ts b/src/shared/processor-templates/strategy/strategy-earnings.ts index a0489e2a..ad584847 100644 --- a/src/shared/processor-templates/strategy/strategy-earnings.ts +++ b/src/shared/processor-templates/strategy/strategy-earnings.ts @@ -15,15 +15,8 @@ import { OETH_HARVESTER_ADDRESS, WETH_ADDRESS, } from '../../../utils/addresses' +import { blockFrequencyTracker } from '../../../utils/blockFrequencyUpdater' import { lastExcept } from '../../../utils/utils' -import { - ensureExchangeRate, - ensureExchangeRates, -} from '../../post-processors/exchange-rates' -import { - Currency, - convertRate, -} from '../../post-processors/exchange-rates/currencies' import { IStrategyData } from './strategy' import { processStrategyDailyEarnings } from './strategy-daily-earnings' @@ -40,6 +33,8 @@ export const setupStrategyEarnings = ( processor: EvmBatchProcessor, strategyData: IStrategyData, ) => { + processor.includeAllBlocks({ from: strategyData.from }) + // Detect Deposit/Withdraw events // To help us understand when balances change passively vs from activity. if (strategyData.earnings.passiveByDepositWithdrawal) { @@ -83,6 +78,7 @@ export const setupStrategyEarnings = ( } } +const trackers = new Map>() export const processStrategyEarnings = async ( ctx: Context, strategyData: IStrategyData, @@ -95,31 +91,35 @@ export const processStrategyEarnings = async ( const days = new Map() const strategyYields = new Map() for (const block of ctx.blocks) { - const dayId = dayjs.utc(block.header.timestamp).format('YYYY-MM-DD') + let didUpdate = false + days.set(dayjs.utc(block.header.timestamp).format('YYYY-MM-DD'), block) const txIgnore = new Set() + const getBalances = async ( + { compare }: { compare: number } = { compare: -1 }, + ) => { + const compareBalances = await getStrategyBalances( + ctx, + { height: block.header.height + compare }, + strategyData, + ) + const balances = + compare === 0 + ? compareBalances + : await getStrategyBalances(ctx, block.header, strategyData) + return balances.map((balance, i) => { + return { + asset: balance.asset, + balance: balance.balance, + compareBalance: compareBalances[i].balance, + } + }) + } + for (const log of block.logs) { - const getBalances = async () => { - const previousBalances = await getStrategyBalances( - ctx, - { height: block.header.height - 1 }, - strategyData, - ) - const balances = await getStrategyBalances( - ctx, - block.header, - strategyData, - ) - return balances.map((balance, i) => { - return { - asset: balance.asset, - balance: balance.balance, - previousBalance: previousBalances[i].balance, - } - }) - } + // Various update functions we might call const balanceTrackingUpdate = async () => { - ctx.log.info(`balanceTrackingUpdate`) - days.set(dayId, block) + // ctx.log.info(`balanceTrackingUpdate`) + didUpdate = true const balances = await getBalances() await processDepositWithdrawal( ctx, @@ -130,8 +130,8 @@ export const processStrategyEarnings = async ( ) } const balanceTrackingUpdateBalancerMetaStablePool = async () => { - ctx.log.info(`balanceTrackingUpdateBalancerMetaStablePool`) - days.set(dayId, block) + // ctx.log.info(`balanceTrackingUpdateBalancerMetaStablePool`) + didUpdate = true const balances = await getBalances() await processDepositWithdrawal( ctx, @@ -141,6 +141,35 @@ export const processStrategyEarnings = async ( balances, ) } + const rewardTokenCollectedUpdate = async () => { + // ctx.log.info(`rewardTokenCollectedUpdate`) + didUpdate = true + txIgnore.add(log.transactionHash) + const wethTransferLogs = block.logs.filter( + (l) => + l.transactionHash === log.transactionHash && + l.address.toLowerCase() === WETH_ADDRESS && + l.topics[0] === erc20.events.Transfer.topic && + l.topics[1] === pad(OETH_HARVESTER_ADDRESS) && + l.topics[2] === pad(OETH_DRIPPER_ADDRESS), + ) + const amount = wethTransferLogs.reduce( + (sum, l) => sum + BigInt(l.data), + 0n, + ) + + await processRewardTokenCollected( + ctx, + strategyData, + block, + strategyYields, + { + token: WETH_ADDRESS, + amount, + }, + ) + } + if ( strategyData.kind === 'CurveAMO' && log.address === strategyData.curvePoolInfo!.rewardsPoolAddress && @@ -175,30 +204,24 @@ export const processStrategyEarnings = async ( abstractStrategyAbi.events.RewardTokenCollected.topic && !txIgnore.has(log.transactionHash) ) { - days.set(dayId, block) - txIgnore.add(log.transactionHash) - const wethTransferLogs = block.logs.filter( - (l) => - l.transactionHash === log.transactionHash && - l.address.toLowerCase() === WETH_ADDRESS && - l.topics[0] === erc20.events.Transfer.topic && - l.topics[1] === pad(OETH_HARVESTER_ADDRESS) && - l.topics[2] === pad(OETH_DRIPPER_ADDRESS), - ) - const amount = wethTransferLogs.reduce( - (sum, l) => sum + BigInt(l.data), - 0n, - ) + await rewardTokenCollectedUpdate() + } + } - await processRewardTokenCollected( + if (!didUpdate) { + let tracker = trackers.get(strategyData.address) + if (!tracker) { + tracker = blockFrequencyTracker({ from: strategyData.from }) + trackers.set(strategyData.address, tracker) + } + if (tracker(ctx, block)) { + const balances = await getBalances({ compare: 0 }) + await processDepositWithdrawal( ctx, strategyData, block, strategyYields, - { - token: WETH_ADDRESS, - amount, - }, + balances, ) } } @@ -228,19 +251,21 @@ const processRewardTokenCollected = async ( ) // Convert value to ETH - const rate = await ensureExchangeRate( - ctx, - block, - 'ETH', - params.token as Currency, - ) + // const rates = await ensureExchangeRatesAverages( + // ctx, + // block, + // dayjs.utc(block.header.timestamp).subtract(1, 'week').toDate(), + // new Date(block.header.timestamp), + // [['ETH', params.token as Currency]], + // ) - const amount = convertRate( - [rate!], - 'ETH', - params.token as Currency, - params.amount, - ) + const amount = params.amount + // const amount = convertRate( + // rates, + // 'ETH', + // params.token as Currency, + // params.amount, + // ) if (!current) { current = new StrategyYield({ @@ -267,7 +292,7 @@ const processDepositWithdrawal = async ( resultMap: Map, assets: { asset: string - previousBalance: bigint + compareBalance: bigint balance: bigint }[], ) => { @@ -284,18 +309,20 @@ const processDepositWithdrawal = async ( if (!current) { // Convert incoming values to ETH - const rates = await ensureExchangeRates( - ctx, - block, - assets.map((a) => ['ETH', a.asset as Currency]), - ) + // const rates = await ensureExchangeRatesAverages( + // ctx, + // block, + // dayjs.utc(block.header.timestamp).subtract(1, 'week').toDate(), + // new Date(block.header.timestamp), + // assets.map((a) => ['ETH', a.asset as Currency]), + // ) const previousBalance = assets.reduce((sum, a) => { return ( - sum + convertRate(rates, 'ETH', a.asset as Currency, a.previousBalance) + sum + a.compareBalance // convertRate(rates, 'ETH', a.asset as Currency, a.compareBalance) ) }, 0n) const balance = assets.reduce((sum, a) => { - return sum + convertRate(rates, 'ETH', a.asset as Currency, a.balance) + return sum + a.balance // convertRate(rates, 'ETH', a.asset as Currency, a.balance) }, 0n) const timestamp = new Date(block.header.timestamp) @@ -313,7 +340,9 @@ const processDepositWithdrawal = async ( earnings: (latest?.earnings ?? 0n) + earningsChange, }) ctx.log.info( - `Setting balance: ${formatEther(balance)}, last balance: ${formatEther( + `${block.header.height} Setting balance: ${formatEther( + balance, + )}, last balance: ${formatEther( latest?.balance ?? 0n, )}, previous block balance: ${formatEther( previousBalance, @@ -321,10 +350,28 @@ const processDepositWithdrawal = async ( earningsChange, )}, total earnings: ${formatEther(current.earnings)}`, ) + + if (+formatEther(earningsChange) > 2000) { + throw new Error('Weird shit yo') + } + if (earningsChange < 0) { ctx.log.warn('WARNING: earnings change is negative') } - results.push(current) + + // Avoid creating this if nothing has changed. + if ( + !( + latest && + latest.strategy === current.strategy && + latest.asset === current.asset && + latest.balance === current.balance && + latest.earningsChange === current.earningsChange && + latest.earnings === current.earnings + ) + ) { + results.push(current) + } } } diff --git a/src/utils/blockFrequencyUpdater.ts b/src/utils/blockFrequencyUpdater.ts index 2933d578..eefa197e 100644 --- a/src/utils/blockFrequencyUpdater.ts +++ b/src/utils/blockFrequencyUpdater.ts @@ -33,20 +33,19 @@ const getFrequency = (bps: number, timestamp: number) => { return (SECONDS_PER_MINUTE / bps) ^ 0 } -// export const blockFrequencyTracker = (params: { from: number }) => { -// let nextBlockToProcess = 0 -// return (ctx: Context, block: Block) => { -// if (block.header.height < params.from) return -// // If we're not at head, determine our frequency and then process. -// const { bps } = ctx -// const frequency: number = getFrequency(bps, block.header.timestamp) -// if (block.header.height >= nextBlockToProcess) { -// nextBlockToProcess = block.header.height + frequency -// return true -// } -// return false -// } -// } +export const blockFrequencyTracker = (params: { from: number }) => { + let nextBlockToProcess = 0 + return (ctx: Context, block: Block) => { + if (block.header.height < params.from) return + const { bps } = ctx + const frequency: number = getFrequency(bps, block.header.timestamp) + if (block.header.height >= nextBlockToProcess) { + nextBlockToProcess = block.header.height + frequency + return true + } + return false + } +} export const blockFrequencyUpdater = (params: { from: number }) => { let lastBlockHeightProcessed = 0 From 8a77d54501466d7f5522940b86cb47b185348a92 Mon Sep 17 00:00:00 2001 From: Chris Jacobs Date: Tue, 7 Nov 2023 14:51:20 -0800 Subject: [PATCH 13/34] More curve AMO work --- ...14716587-Data.js => 1699376932754-Data.js} | 6 ++--- schema-base.graphql | 1 + schema.graphql | 1 + src/model/generated/strategyYield.model.ts | 3 +++ .../strategy/strategy-daily-earnings.ts | 22 +++++++++++------- .../strategy/strategy-earnings.ts | 23 ++++++++++++++++++- src/utils/calculateAPY.ts | 17 -------------- 7 files changed, 44 insertions(+), 29 deletions(-) rename db/migrations/{1699114716587-Data.js => 1699376932754-Data.js} (99%) diff --git a/db/migrations/1699114716587-Data.js b/db/migrations/1699376932754-Data.js similarity index 99% rename from db/migrations/1699114716587-Data.js rename to db/migrations/1699376932754-Data.js index ae40d575..d1a385c1 100644 --- a/db/migrations/1699114716587-Data.js +++ b/db/migrations/1699376932754-Data.js @@ -1,5 +1,5 @@ -module.exports = class Data1699114716587 { - name = 'Data1699114716587' +module.exports = class Data1699376932754 { + name = 'Data1699376932754' async up(db) { await db.query(`CREATE TABLE "exchange_rate" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "pair" text NOT NULL, "base" text NOT NULL, "quote" text NOT NULL, "rate" numeric NOT NULL, CONSTRAINT "PK_5c5d27d2b900ef6cdeef0398472" PRIMARY KEY ("id"))`) @@ -11,7 +11,7 @@ module.exports = class Data1699114716587 { await db.query(`CREATE TABLE "strategy_balance" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "strategy" text NOT NULL, "asset" text NOT NULL, "balance" numeric NOT NULL, CONSTRAINT "PK_ca6f93229d1392e9546d01dae4f" PRIMARY KEY ("id"))`) await db.query(`CREATE INDEX "IDX_0113bf0b63183bea0d22cd0d08" ON "strategy_balance" ("timestamp") `) await db.query(`CREATE INDEX "IDX_a88065dcd92011698bbe7df7b1" ON "strategy_balance" ("block_number") `) - await db.query(`CREATE TABLE "strategy_yield" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "strategy" text NOT NULL, "asset" text NOT NULL, "balance" numeric NOT NULL, "earnings" numeric NOT NULL, "earnings_change" numeric NOT NULL, CONSTRAINT "PK_e87c46575e870fe2202190c2728" PRIMARY KEY ("id"))`) + await db.query(`CREATE TABLE "strategy_yield" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "strategy" text NOT NULL, "asset" text NOT NULL, "balance" numeric NOT NULL, "balance_weight" numeric NOT NULL, "earnings" numeric NOT NULL, "earnings_change" numeric NOT NULL, CONSTRAINT "PK_e87c46575e870fe2202190c2728" PRIMARY KEY ("id"))`) await db.query(`CREATE INDEX "IDX_5108f2a2563d5665892d0c06b0" ON "strategy_yield" ("timestamp") `) await db.query(`CREATE INDEX "IDX_41c3567c9d43c598e07a0029c5" ON "strategy_yield" ("block_number") `) await db.query(`CREATE TABLE "strategy_daily_yield" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "strategy" text NOT NULL, "asset" text NOT NULL, "balance" numeric NOT NULL, "earnings" numeric NOT NULL, "earnings_change" numeric NOT NULL, "apr" numeric NOT NULL, "apy" numeric NOT NULL, CONSTRAINT "PK_b0dd2686bc95bb032ff532b3a0e" PRIMARY KEY ("id"))`) diff --git a/schema-base.graphql b/schema-base.graphql index dbfe1c80..3e180440 100644 --- a/schema-base.graphql +++ b/schema-base.graphql @@ -62,6 +62,7 @@ type StrategyYield @entity { strategy: String! asset: String! balance: BigInt! + balanceWeight: Float! earnings: BigInt! earningsChange: BigInt! } diff --git a/schema.graphql b/schema.graphql index 966ca223..0a632178 100644 --- a/schema.graphql +++ b/schema.graphql @@ -64,6 +64,7 @@ type StrategyYield @entity { strategy: String! asset: String! balance: BigInt! + balanceWeight: Float! earnings: BigInt! earningsChange: BigInt! } diff --git a/src/model/generated/strategyYield.model.ts b/src/model/generated/strategyYield.model.ts index b27c886f..460ba25a 100644 --- a/src/model/generated/strategyYield.model.ts +++ b/src/model/generated/strategyYield.model.ts @@ -30,6 +30,9 @@ export class StrategyYield { @Column_("numeric", {transformer: marshal.bigintTransformer, nullable: false}) balance!: bigint + @Column_("numeric", {transformer: marshal.floatTransformer, nullable: false}) + balanceWeight!: number + @Column_("numeric", {transformer: marshal.bigintTransformer, nullable: false}) earnings!: bigint diff --git a/src/shared/processor-templates/strategy/strategy-daily-earnings.ts b/src/shared/processor-templates/strategy/strategy-daily-earnings.ts index 632a0b2f..7ff1b71c 100644 --- a/src/shared/processor-templates/strategy/strategy-daily-earnings.ts +++ b/src/shared/processor-templates/strategy/strategy-daily-earnings.ts @@ -1,6 +1,6 @@ import dayjs from 'dayjs' -import { compact } from 'lodash' -import { Between, In, LessThan, LessThanOrEqual } from 'typeorm' +import { Between, LessThan, LessThanOrEqual } from 'typeorm' +import { parseEther } from 'viem' import { StrategyDailyYield, StrategyYield } from '../../../model' import { Block, Context } from '../../../processor' @@ -9,6 +9,8 @@ import { calculateAPY } from '../../../utils/calculateAPY' import { lastExcept } from '../../../utils/utils' import { IStrategyData } from './strategy' +const eth1 = 1000000000000000000n + export const processStrategyDailyEarnings = async ( ctx: Context, blocks: Block[], @@ -74,6 +76,7 @@ export const processStrategyDailyEarnings = async ( // Convert into ETH values const balance = yields[yields.length - 1]?.balance ?? 0n + const balanceWeight = yields[yields.length - 1]?.balanceWeight ?? 1 const earnings = yields[yields.length - 1]?.earnings ?? 0n const earningsChange = todayYields.reduce( (sum, y) => sum + y.earningsChange, @@ -92,15 +95,18 @@ export const processStrategyDailyEarnings = async ( // Calculate APY values if (latest) { - // On Frax Staking if we only use `latest.balance` we get crazy APY. - // (only early on) - // On Morpho Aave v2 if we only use `current.balance` we get 0 APY. - // I've done `current.balance || latest?.balance` to try and balance out what we see. + // The use of `balanceWeight` is for the Curve AMO ETH+OETH Strategy + // It is an attempt at excluding OETH from the rate calculations. + const yieldBalance = + ((latest?.balance || current.balance) * + parseEther(balanceWeight.toString())) / + eth1 + const { apr, apy } = calculateAPY( latest.timestamp, current.timestamp, - current.balance || latest?.balance, - (current.balance || latest?.balance) + current.earningsChange, + yieldBalance, + yieldBalance + current.earningsChange, ) current.apr = apr current.apy = apy diff --git a/src/shared/processor-templates/strategy/strategy-earnings.ts b/src/shared/processor-templates/strategy/strategy-earnings.ts index ad584847..82f560c3 100644 --- a/src/shared/processor-templates/strategy/strategy-earnings.ts +++ b/src/shared/processor-templates/strategy/strategy-earnings.ts @@ -1,7 +1,7 @@ import { EvmBatchProcessor } from '@subsquid/evm-processor' import dayjs from 'dayjs' import { LessThan } from 'typeorm' -import { formatEther, pad } from 'viem' +import { formatEther, pad, parseEther, parseUnits } from 'viem' import * as baseRewardPool from '../../../abi/base-reward-pool' import * as erc20 from '../../../abi/erc20' @@ -11,6 +11,7 @@ import { Block, Context } from '../../../processor' import { AURA_REWARDS_POOL_ADDRESS, ETH_ADDRESS, + OETH_ADDRESS, OETH_DRIPPER_ADDRESS, OETH_HARVESTER_ADDRESS, WETH_ADDRESS, @@ -20,6 +21,8 @@ import { lastExcept } from '../../../utils/utils' import { IStrategyData } from './strategy' import { processStrategyDailyEarnings } from './strategy-daily-earnings' +const eth1 = 1000000000000000000n + const depositWithdrawalTopics = new Set([ abstractStrategyAbi.events.Deposit.topic, abstractStrategyAbi.events.Withdrawal.topic, @@ -275,6 +278,7 @@ const processRewardTokenCollected = async ( strategy: strategyData.address, asset: ETH_ADDRESS, balance: latest?.balance ?? 0n, + balanceWeight: latest?.balanceWeight ?? 1, earnings: (latest?.earnings ?? 0n) + amount, earningsChange: amount, }) @@ -325,10 +329,26 @@ const processDepositWithdrawal = async ( return sum + a.balance // convertRate(rates, 'ETH', a.asset as Currency, a.balance) }, 0n) + const oethBalance = + assets.find((a) => a.asset.toLowerCase() === OETH_ADDRESS)?.balance ?? 0n + + const balanceWeightN = + balance === 0n ? eth1 : (oethBalance * eth1) / balance + const balanceWeight = Number(formatEther(balanceWeightN)) + const timestamp = new Date(block.header.timestamp) let earningsChange = previousBalance - (latest?.balance ?? previousBalance) ?? 0n + // TODO: Probably should listen for add/remove liquidity events + // and calculate earnings changes from fees rather than relying on this + // picking up those events. It works fine in some pools, but if we want to + // remove OETH from APY considerations then we need more detail. + if (strategyData.kind === 'CurveAMO') { + // Only consider earnings on this event by ETH proportion. + earningsChange *= balanceWeightN / eth1 + } + current = new StrategyYield({ id, blockNumber: block.header.height, @@ -336,6 +356,7 @@ const processDepositWithdrawal = async ( strategy: strategyData.address, asset: ETH_ADDRESS, balance, + balanceWeight, earningsChange, earnings: (latest?.earnings ?? 0n) + earningsChange, }) diff --git a/src/utils/calculateAPY.ts b/src/utils/calculateAPY.ts index e30f1cd0..2dceddb2 100644 --- a/src/utils/calculateAPY.ts +++ b/src/utils/calculateAPY.ts @@ -19,23 +19,6 @@ export const calculateAPY = ( const periods_per_year = 365.25 / Number(dayDiff) const apy = (1 + apr / periods_per_year) ** periods_per_year - 1 - if (apy > 1) { - // console.log( - // { - // diffTime, - // dayDiff, - // apr, - // periods_per_year, - // apy, - // fromAmount: formatEther(fromAmount), - // toAmount: formatEther(toAmount), - // }, - // 'HIGH APY CALCULATION', - // ) - // if (apy > 1000) { - // throw new Error('APY calculation is unrealistic') - // } - } return { apr: apr || 0, apy: apy || 0, From ea1fb499aa937107e95aa09224dac2b266bc41b9 Mon Sep 17 00:00:00 2001 From: Chris Jacobs Date: Tue, 7 Nov 2023 15:27:45 -0800 Subject: [PATCH 14/34] post merge fixes --- db/migrations/1698911538983-Data.js | 307 ---------------------------- db/migrations/1699376932754-Data.js | 289 -------------------------- squid.yaml | 8 +- src/ousd/processors/ousd/ousd.ts | 4 +- 4 files changed, 6 insertions(+), 602 deletions(-) delete mode 100644 db/migrations/1698911538983-Data.js delete mode 100644 db/migrations/1699376932754-Data.js diff --git a/db/migrations/1698911538983-Data.js b/db/migrations/1698911538983-Data.js deleted file mode 100644 index e2496737..00000000 --- a/db/migrations/1698911538983-Data.js +++ /dev/null @@ -1,307 +0,0 @@ -module.exports = class Data1698911538983 { - name = 'Data1698911538983' - - async up(db) { - await db.query(`CREATE TABLE "exchange_rate" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "pair" text NOT NULL, "base" text NOT NULL, "quote" text NOT NULL, "rate" numeric NOT NULL, CONSTRAINT "PK_5c5d27d2b900ef6cdeef0398472" PRIMARY KEY ("id"))`) - await db.query(`CREATE INDEX "IDX_9e23a3f1bf3634820c873a0fe8" ON "exchange_rate" ("timestamp") `) - await db.query(`CREATE INDEX "IDX_c61a93768eed9e58ce399bbe01" ON "exchange_rate" ("block_number") `) - await db.query(`CREATE TABLE "balance" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "token" text NOT NULL, "address" text NOT NULL, "balance" numeric NOT NULL, CONSTRAINT "PK_079dddd31a81672e8143a649ca0" PRIMARY KEY ("id"))`) - await db.query(`CREATE INDEX "IDX_a956b410c329b8eca7898c3c51" ON "balance" ("timestamp") `) - await db.query(`CREATE INDEX "IDX_6b451b59c9f6a6fdd685f530b2" ON "balance" ("block_number") `) - await db.query(`CREATE TABLE "strategy_balance" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "strategy" text NOT NULL, "asset" text NOT NULL, "balance" numeric NOT NULL, CONSTRAINT "PK_ca6f93229d1392e9546d01dae4f" PRIMARY KEY ("id"))`) - await db.query(`CREATE INDEX "IDX_0113bf0b63183bea0d22cd0d08" ON "strategy_balance" ("timestamp") `) - await db.query(`CREATE INDEX "IDX_a88065dcd92011698bbe7df7b1" ON "strategy_balance" ("block_number") `) - await db.query(`CREATE TABLE "curve_pool_balance" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "address" text NOT NULL, "balance0" numeric NOT NULL, "balance1" numeric NOT NULL, "balance2" numeric NOT NULL, CONSTRAINT "PK_40412750bb910ca560aa084dd88" PRIMARY KEY ("id"))`) - await db.query(`CREATE INDEX "IDX_ffb0d0f86f03faacef7cb3e092" ON "curve_pool_balance" ("timestamp") `) - await db.query(`CREATE INDEX "IDX_db5522c865eb8ed76fa7aeb4a8" ON "curve_pool_balance" ("block_number") `) - await db.query(`CREATE TABLE "oeth" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "total_supply" numeric NOT NULL, "rebasing_supply" numeric NOT NULL, "non_rebasing_supply" numeric NOT NULL, CONSTRAINT "PK_de1d885501070dbd1ab6f8577ba" PRIMARY KEY ("id"))`) - await db.query(`CREATE INDEX "IDX_5b81a67229bac2d68e0dc92cc4" ON "oeth" ("timestamp") `) - await db.query(`CREATE INDEX "IDX_408e5f79f83093aa5cf2b0ea32" ON "oeth" ("block_number") `) - await db.query(`CREATE TABLE "oeth_history" ("id" character varying NOT NULL, "value" numeric NOT NULL, "balance" numeric NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "tx_hash" text NOT NULL, "type" character varying(8) NOT NULL, "address_id" character varying, CONSTRAINT "PK_2c7e7571cd9ea02b07a27a303f3" PRIMARY KEY ("id"))`) - await db.query(`CREATE INDEX "IDX_94e47c4c49128c78f60b185b46" ON "oeth_history" ("address_id") `) - await db.query(`CREATE INDEX "IDX_96956b1c8d29eb7066a97d5ea7" ON "oeth_history" ("block_number") `) - await db.query(`CREATE INDEX "IDX_b14170bdb7fbc0775bf55df15d" ON "oeth_history" ("tx_hash") `) - await db.query(`CREATE TABLE "oeth_address" ("id" character varying NOT NULL, "is_contract" boolean NOT NULL, "rebasing_option" character varying(6) NOT NULL, "balance" numeric NOT NULL, "earned" numeric NOT NULL, "credits" numeric NOT NULL, "last_updated" TIMESTAMP WITH TIME ZONE NOT NULL, CONSTRAINT "PK_92a966afe47d584af73ce77a1cd" PRIMARY KEY ("id"))`) - await db.query(`CREATE TABLE "oethapy" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "tx_hash" text NOT NULL, "apr" numeric NOT NULL, "apy" numeric NOT NULL, "apy7_day_avg" numeric NOT NULL, "apy14_day_avg" numeric NOT NULL, "apy30_day_avg" numeric NOT NULL, "rebasing_credits_per_token" numeric NOT NULL, CONSTRAINT "PK_8dbb4d04591848361200f18f62a" PRIMARY KEY ("id"))`) - await db.query(`CREATE INDEX "IDX_b1a448045d1ed9d655b679a371" ON "oethapy" ("timestamp") `) - await db.query(`CREATE INDEX "IDX_6b8a7a706a0701e659a7d81508" ON "oethapy" ("block_number") `) - await db.query(`CREATE INDEX "IDX_c0c03168bb0139e3cffda4f00e" ON "oethapy" ("tx_hash") `) - await db.query(`CREATE TABLE "oeth_rebase" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "tx_hash" text NOT NULL, "total_supply" numeric NOT NULL, "rebasing_credits" numeric NOT NULL, "rebasing_credits_per_token" numeric NOT NULL, "fee" numeric NOT NULL, "yield" numeric NOT NULL, "apy_id" character varying, CONSTRAINT "PK_5f8f4dd071caf685b4ac2d54de3" PRIMARY KEY ("id"))`) - await db.query(`CREATE INDEX "IDX_fbb7b3f2fff9896eb683b86de7" ON "oeth_rebase" ("timestamp") `) - await db.query(`CREATE INDEX "IDX_d3255d02d9407bba89380d01fa" ON "oeth_rebase" ("block_number") `) - await db.query(`CREATE INDEX "IDX_8b6bb0243472af88612fe6a01f" ON "oeth_rebase" ("tx_hash") `) - await db.query(`CREATE INDEX "IDX_3331819842173de7c27c046547" ON "oeth_rebase" ("apy_id") `) - await db.query(`CREATE TABLE "oeth_rebase_option" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "tx_hash" text NOT NULL, "status" character varying(6) NOT NULL, "address_id" character varying, CONSTRAINT "PK_32971725d5523200b4b3b7c07e5" PRIMARY KEY ("id"))`) - await db.query(`CREATE INDEX "IDX_1fc6bbd88037bfbf4361776909" ON "oeth_rebase_option" ("timestamp") `) - await db.query(`CREATE INDEX "IDX_cbb7ceb49ef7c45432d0171296" ON "oeth_rebase_option" ("block_number") `) - await db.query(`CREATE INDEX "IDX_355826dadaacc5ae2d63c82f28" ON "oeth_rebase_option" ("tx_hash") `) - await db.query(`CREATE INDEX "IDX_034428879698039839b4ba6ffe" ON "oeth_rebase_option" ("address_id") `) - await db.query(`CREATE TABLE "oeth_vault" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "weth" numeric NOT NULL, "st_eth" numeric NOT NULL, "r_eth" numeric NOT NULL, "frx_eth" numeric NOT NULL, CONSTRAINT "PK_9debaa84944fe2be9dc4219ba8f" PRIMARY KEY ("id"))`) - await db.query(`CREATE INDEX "IDX_d6298a294864b4eaf793cf35a4" ON "oeth_vault" ("timestamp") `) - await db.query(`CREATE INDEX "IDX_e20cb507a673817b2c68720415" ON "oeth_vault" ("block_number") `) - await db.query(`CREATE TABLE "oeth_curve_lp" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "total_supply" numeric NOT NULL, "eth" numeric NOT NULL, "oeth" numeric NOT NULL, "total_supply_owned" numeric NOT NULL, "eth_owned" numeric NOT NULL, "oeth_owned" numeric NOT NULL, CONSTRAINT "PK_2b055044664e80f44d6172fdf54" PRIMARY KEY ("id"))`) - await db.query(`CREATE INDEX "IDX_d9bbd20e888fa1b4b2c5d2f039" ON "oeth_curve_lp" ("timestamp") `) - await db.query(`CREATE INDEX "IDX_7617d593c36dce1b1565a8d74a" ON "oeth_curve_lp" ("block_number") `) - await db.query(`CREATE TABLE "oeth_frax_staking" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "sfrx_eth" numeric NOT NULL, CONSTRAINT "PK_694f53c8600ae88c7bdcf7305dd" PRIMARY KEY ("id"))`) - await db.query(`CREATE INDEX "IDX_ce6c2c65e90967dfeaac97025b" ON "oeth_frax_staking" ("timestamp") `) - await db.query(`CREATE INDEX "IDX_1a7f7d650390e2f9c212651e05" ON "oeth_frax_staking" ("block_number") `) - await db.query(`CREATE TABLE "oeth_morpho_aave" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "weth" numeric NOT NULL, CONSTRAINT "PK_86de8f846e9335c92b8ad7df3a1" PRIMARY KEY ("id"))`) - await db.query(`CREATE INDEX "IDX_25e239b985844f1d33fac79981" ON "oeth_morpho_aave" ("timestamp") `) - await db.query(`CREATE INDEX "IDX_a6662224e95eb6921bb14cb5f9" ON "oeth_morpho_aave" ("block_number") `) - await db.query(`CREATE TABLE "oeth_dripper" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "weth" numeric NOT NULL, "last_collect_timestamp" integer NOT NULL, "drip_rate_per_block" numeric NOT NULL, "drip_duration" numeric NOT NULL, CONSTRAINT "PK_77731281c1564c24eff0c265984" PRIMARY KEY ("id"))`) - await db.query(`CREATE INDEX "IDX_16ac742ceeb05d28e530da9649" ON "oeth_dripper" ("timestamp") `) - await db.query(`CREATE INDEX "IDX_d356832c14603916a492608e7b" ON "oeth_dripper" ("block_number") `) - await db.query(`CREATE TABLE "oeth_balancer_meta_pool_strategy" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "r_eth" numeric NOT NULL, "weth" numeric NOT NULL, CONSTRAINT "PK_6ddf5b8ba878e6d706e59bd6de0" PRIMARY KEY ("id"))`) - await db.query(`CREATE INDEX "IDX_5e7ef383756fa18cb602f50089" ON "oeth_balancer_meta_pool_strategy" ("timestamp") `) - await db.query(`CREATE INDEX "IDX_11d344b3e0e03cdb6697dd61f7" ON "oeth_balancer_meta_pool_strategy" ("block_number") `) - await db.query(`CREATE TABLE "oeth_strategy_holding_daily_stat" ("id" character varying NOT NULL, "symbol" text NOT NULL, "amount" numeric NOT NULL, "value" numeric NOT NULL, "strategy_daily_stat_id_id" character varying, CONSTRAINT "PK_7f1a62da5e53cf264c2f39b4acf" PRIMARY KEY ("id"))`) - await db.query(`CREATE INDEX "IDX_4e867f220975e615e6077d860c" ON "oeth_strategy_holding_daily_stat" ("strategy_daily_stat_id_id") `) - await db.query(`CREATE TABLE "oeth_strategy_daily_stat" ("id" character varying NOT NULL, "name" text NOT NULL, "total" numeric NOT NULL, "tvl" numeric NOT NULL, "daily_stat_id_id" character varying, CONSTRAINT "PK_8af1a0c60e67b05baf928787a8e" PRIMARY KEY ("id"))`) - await db.query(`CREATE INDEX "IDX_6c7096c96a000d8471256ca8fc" ON "oeth_strategy_daily_stat" ("daily_stat_id_id") `) - await db.query(`CREATE TABLE "oeth_collateral_daily_stat" ("id" character varying NOT NULL, "symbol" text NOT NULL, "amount" numeric NOT NULL, "price" numeric NOT NULL, "value" numeric NOT NULL, "daily_stat_id_id" character varying, CONSTRAINT "PK_5fb23d7bae30dffe4543e7aa069" PRIMARY KEY ("id"))`) - await db.query(`CREATE INDEX "IDX_a90045de50406be7bd56efd3ea" ON "oeth_collateral_daily_stat" ("daily_stat_id_id") `) - await db.query(`CREATE TABLE "oeth_daily_stat" ("id" character varying NOT NULL, "block_number" integer NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "apr" numeric NOT NULL, "apy" numeric NOT NULL, "apy7_day_avg" numeric NOT NULL, "apy14_day_avg" numeric NOT NULL, "apy30_day_avg" numeric NOT NULL, "total_supply" numeric NOT NULL, "total_supply_usd" numeric NOT NULL, "rebasing_supply" numeric NOT NULL, "non_rebasing_supply" numeric NOT NULL, "amo_supply" numeric NOT NULL, "dripper_weth" numeric NOT NULL, "yield" numeric NOT NULL, "fees" numeric NOT NULL, "revenue" numeric NOT NULL, "revenue7_day_avg" numeric NOT NULL, "revenue7_day_total" numeric NOT NULL, "revenue_all_time" numeric NOT NULL, "peg_price" numeric NOT NULL, CONSTRAINT "PK_9144a02ab13b1baa818a7d5eae5" PRIMARY KEY ("id"))`) - await db.query(`CREATE INDEX "IDX_98d9001013aa37425ca47b7126" ON "oeth_daily_stat" ("block_number") `) - await db.query(`CREATE INDEX "IDX_c3e66051c7df4efd6a8fa8f9c1" ON "oeth_daily_stat" ("timestamp") `) - await db.query(`CREATE TABLE "oeth_reward_token_collected" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "recipient" text NOT NULL, "reward_token" text NOT NULL, "amount" numeric NOT NULL, CONSTRAINT "PK_47098cc5fbc7cb95c2374fa33cd" PRIMARY KEY ("id"))`) - await db.query(`CREATE INDEX "IDX_81a9fa43ae4a6ae63e4103127b" ON "oeth_reward_token_collected" ("timestamp") `) - await db.query(`CREATE INDEX "IDX_d36c78b9c3e9d737f067638bc4" ON "oeth_reward_token_collected" ("block_number") `) - await db.query(`CREATE TABLE "ogv" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "circulating" numeric NOT NULL, "staked" numeric NOT NULL, "total" numeric NOT NULL, CONSTRAINT "PK_f16038abf451ce82bd03ea54ee7" PRIMARY KEY ("id"))`) - await db.query(`CREATE INDEX "IDX_2418a8b8b92b2f5977be761cf9" ON "ogv" ("timestamp") `) - await db.query(`CREATE INDEX "IDX_b8f20bcf48e4aa77e0f48d77db" ON "ogv" ("block_number") `) - await db.query(`CREATE TABLE "ogv_address" ("id" character varying NOT NULL, "balance" numeric NOT NULL, "staked" numeric NOT NULL, "veogv_balance" numeric NOT NULL, "voting_power" numeric NOT NULL, "last_updated" TIMESTAMP WITH TIME ZONE NOT NULL, "delegatee_id" character varying, CONSTRAINT "PK_f13c77575687ef480ca0b7de5d8" PRIMARY KEY ("id"))`) - await db.query(`CREATE INDEX "IDX_49d26f287904b8b1aef6e9ac2b" ON "ogv_address" ("delegatee_id") `) - await db.query(`CREATE TABLE "ogv_lockup" ("id" character varying NOT NULL, "lockup_id" text NOT NULL, "amount" numeric NOT NULL, "end" TIMESTAMP WITH TIME ZONE NOT NULL, "veogv" numeric NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "address_id" character varying, CONSTRAINT "PK_6b6d5ed3a004dd3f546c1b11fa4" PRIMARY KEY ("id"))`) - await db.query(`CREATE INDEX "IDX_8114101b53d9d6bc26fe80838a" ON "ogv_lockup" ("lockup_id") `) - await db.query(`CREATE INDEX "IDX_8be94cd63e35b91adf1301a156" ON "ogv_lockup" ("address_id") `) - await db.query(`CREATE TABLE "ogv_lockup_tx_log" ("id" character varying NOT NULL, "hash" text NOT NULL, "event" character varying(8) NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "ogv_lockup_id" character varying, CONSTRAINT "PK_1c4a8425ce42f0c9da10056adee" PRIMARY KEY ("id"))`) - await db.query(`CREATE INDEX "IDX_b49fca291c97d9b55cd91f935f" ON "ogv_lockup_tx_log" ("ogv_lockup_id") `) - await db.query(`CREATE TABLE "ogv_proposal" ("id" character varying NOT NULL, "description" text, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "start_block" numeric NOT NULL, "end_block" numeric NOT NULL, "last_updated" TIMESTAMP WITH TIME ZONE NOT NULL, "status" character varying(9) NOT NULL, "proposer_id" character varying, CONSTRAINT "PK_b06db02b26fa37882e013579407" PRIMARY KEY ("id"))`) - await db.query(`CREATE INDEX "IDX_c62be3f16dfb3e4a09525c85af" ON "ogv_proposal" ("proposer_id") `) - await db.query(`CREATE TABLE "ogv_proposal_tx_log" ("id" character varying NOT NULL, "hash" text NOT NULL, "event" character varying(8) NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "proposal_id" character varying, CONSTRAINT "PK_da43c287069bba678ca5c60b1ad" PRIMARY KEY ("id"))`) - await db.query(`CREATE INDEX "IDX_5d5f5e10892290ee366d26de7d" ON "ogv_proposal_tx_log" ("proposal_id") `) - await db.query(`CREATE TABLE "ogv_proposal_vote" ("id" character varying NOT NULL, "weight" numeric NOT NULL, "type" character varying(7) NOT NULL, "tx_hash" text NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "proposal_id" character varying, "voter_id" character varying, CONSTRAINT "PK_93c03f35b95221586cb8b83f523" PRIMARY KEY ("id"))`) - await db.query(`CREATE INDEX "IDX_58d732bc6523c2609d2725cc0a" ON "ogv_proposal_vote" ("proposal_id") `) - await db.query(`CREATE INDEX "IDX_2fd621aea353448fb3f17721bc" ON "ogv_proposal_vote" ("voter_id") `) - await db.query(`CREATE TABLE "ousd" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "total_supply" numeric NOT NULL, "rebasing_supply" numeric NOT NULL, "non_rebasing_supply" numeric NOT NULL, CONSTRAINT "PK_acecae4a20bc14b22d9f6738d8d" PRIMARY KEY ("id"))`) - await db.query(`CREATE INDEX "IDX_c8d1e285213b445b088805ac7c" ON "ousd" ("timestamp") `) - await db.query(`CREATE INDEX "IDX_806949dd853b7e8acab5d03b81" ON "ousd" ("block_number") `) - await db.query(`CREATE TABLE "ousd_history" ("id" character varying NOT NULL, "value" numeric NOT NULL, "balance" numeric NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "tx_hash" text NOT NULL, "type" character varying(8) NOT NULL, "address_id" character varying, CONSTRAINT "PK_dcbe3223b67f92d9ad4cffe8a7c" PRIMARY KEY ("id"))`) - await db.query(`CREATE INDEX "IDX_70291ea600c0c4d67d9bfe6a6b" ON "ousd_history" ("address_id") `) - await db.query(`CREATE INDEX "IDX_4d00d283e1ce3209dc43a0313c" ON "ousd_history" ("block_number") `) - await db.query(`CREATE INDEX "IDX_0c25caa59aa053a688a723d160" ON "ousd_history" ("tx_hash") `) - await db.query(`CREATE TABLE "ousd_address" ("id" character varying NOT NULL, "is_contract" boolean NOT NULL, "rebasing_option" character varying(6) NOT NULL, "balance" numeric NOT NULL, "earned" numeric NOT NULL, "credits" numeric NOT NULL, "last_updated" TIMESTAMP WITH TIME ZONE NOT NULL, CONSTRAINT "PK_bb061344757ede566d62854af6a" PRIMARY KEY ("id"))`) - await db.query(`CREATE TABLE "ousdapy" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "tx_hash" text NOT NULL, "apr" numeric NOT NULL, "apy" numeric NOT NULL, "apy7_day_avg" numeric NOT NULL, "apy14_day_avg" numeric NOT NULL, "apy30_day_avg" numeric NOT NULL, "rebasing_credits_per_token" numeric NOT NULL, CONSTRAINT "PK_d9889b7153efc82dbe88f9a7a33" PRIMARY KEY ("id"))`) - await db.query(`CREATE INDEX "IDX_c514963f42908ce84d65a84a77" ON "ousdapy" ("timestamp") `) - await db.query(`CREATE INDEX "IDX_4f606414b3b5ce1a366bd0fbf6" ON "ousdapy" ("block_number") `) - await db.query(`CREATE INDEX "IDX_0e84a81a109b66fe6f01f77c74" ON "ousdapy" ("tx_hash") `) - await db.query(`CREATE TABLE "ousd_rebase" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "tx_hash" text NOT NULL, "total_supply" numeric NOT NULL, "rebasing_credits" numeric NOT NULL, "rebasing_credits_per_token" numeric NOT NULL, "fee" numeric NOT NULL, "yield" numeric NOT NULL, "apy_id" character varying, CONSTRAINT "PK_04cf0de72399a99798dde61b237" PRIMARY KEY ("id"))`) - await db.query(`CREATE INDEX "IDX_f8eb4a16ce58a146b3227ee21a" ON "ousd_rebase" ("timestamp") `) - await db.query(`CREATE INDEX "IDX_3fb03b1a410e64c7367226d0b6" ON "ousd_rebase" ("block_number") `) - await db.query(`CREATE INDEX "IDX_1a76c478199672aaeec340f619" ON "ousd_rebase" ("tx_hash") `) - await db.query(`CREATE INDEX "IDX_427468c97f9838b804efd6c8e5" ON "ousd_rebase" ("apy_id") `) - await db.query(`CREATE TABLE "ousd_rebase_option" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "tx_hash" text NOT NULL, "status" character varying(6) NOT NULL, "address_id" character varying, CONSTRAINT "PK_d684f90866027104f3c929dfe10" PRIMARY KEY ("id"))`) - await db.query(`CREATE INDEX "IDX_64bd23947dc4c67e3b6a3f9352" ON "ousd_rebase_option" ("timestamp") `) - await db.query(`CREATE INDEX "IDX_9b774e46b8b1cf7f828133809a" ON "ousd_rebase_option" ("block_number") `) - await db.query(`CREATE INDEX "IDX_4e95bf069de04533d83a9a97fd" ON "ousd_rebase_option" ("tx_hash") `) - await db.query(`CREATE INDEX "IDX_b04173f9349ddd991a3b60e914" ON "ousd_rebase_option" ("address_id") `) - await db.query(`CREATE TABLE "ousd_vault" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "dai" numeric NOT NULL, "usdt" numeric NOT NULL, "usdc" numeric NOT NULL, CONSTRAINT "PK_343f5538c71a1cd78f1659ef9d3" PRIMARY KEY ("id"))`) - await db.query(`CREATE INDEX "IDX_6860186ea2f56e2c7d54c22107" ON "ousd_vault" ("timestamp") `) - await db.query(`CREATE INDEX "IDX_0d0a7113a505cf7f7adea9ca81" ON "ousd_vault" ("block_number") `) - await db.query(`CREATE TABLE "ousd_morpho_aave" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "dai" numeric NOT NULL, "usdt" numeric NOT NULL, "usdc" numeric NOT NULL, CONSTRAINT "PK_60676cde905a822ba73ff3a5c85" PRIMARY KEY ("id"))`) - await db.query(`CREATE INDEX "IDX_78e0701c2e9a28242db37bd8f8" ON "ousd_morpho_aave" ("timestamp") `) - await db.query(`CREATE INDEX "IDX_46ccf673b376d654052fbd53e6" ON "ousd_morpho_aave" ("block_number") `) - await db.query(`CREATE TABLE "ousd_morpho_compound" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "dai" numeric NOT NULL, "usdt" numeric NOT NULL, "usdc" numeric NOT NULL, CONSTRAINT "PK_5f715d53ef8fc0fad595cacf4fa" PRIMARY KEY ("id"))`) - await db.query(`CREATE INDEX "IDX_9e7bd0d8ae23b877d5979ef80c" ON "ousd_morpho_compound" ("timestamp") `) - await db.query(`CREATE INDEX "IDX_0bb3a0ad84071f1d80f6d4e90f" ON "ousd_morpho_compound" ("block_number") `) - await db.query(`CREATE TABLE "maker_dsr_strategy" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "dai" numeric NOT NULL, CONSTRAINT "PK_196da2d6910009ae04e3542fe22" PRIMARY KEY ("id"))`) - await db.query(`CREATE INDEX "IDX_a35308a3c5dbaab2d321eb1525" ON "maker_dsr_strategy" ("timestamp") `) - await db.query(`CREATE INDEX "IDX_844b219d8faf9b1d24ab2dba9a" ON "maker_dsr_strategy" ("block_number") `) - await db.query(`CREATE TABLE "ousd_flux_strategy" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "dai" numeric NOT NULL, "usdt" numeric NOT NULL, "usdc" numeric NOT NULL, CONSTRAINT "PK_ac977221429e50e4de1ce253a8b" PRIMARY KEY ("id"))`) - await db.query(`CREATE INDEX "IDX_5b165b5d30b13e363d33a66e14" ON "ousd_flux_strategy" ("timestamp") `) - await db.query(`CREATE INDEX "IDX_80f3392968fde7b99cccb805ac" ON "ousd_flux_strategy" ("block_number") `) - await db.query(`CREATE TABLE "ousd_compound_strategy" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "dai" numeric NOT NULL, "usdt" numeric NOT NULL, "usdc" numeric NOT NULL, CONSTRAINT "PK_9030e82bf3479d03c04e0d1919c" PRIMARY KEY ("id"))`) - await db.query(`CREATE INDEX "IDX_6920b1db5dc577295ac4d1379d" ON "ousd_compound_strategy" ("timestamp") `) - await db.query(`CREATE INDEX "IDX_89c6d7d3104bd36dc88a37add4" ON "ousd_compound_strategy" ("block_number") `) - await db.query(`CREATE TABLE "ousd_convex_strategy" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "dai" numeric NOT NULL, "usdt" numeric NOT NULL, "usdc" numeric NOT NULL, CONSTRAINT "PK_2b8f6e749e15e49d8816f1ac949" PRIMARY KEY ("id"))`) - await db.query(`CREATE INDEX "IDX_2deac473cd0b2dd7082e7da148" ON "ousd_convex_strategy" ("timestamp") `) - await db.query(`CREATE INDEX "IDX_157bf74171817dc5c60ee37036" ON "ousd_convex_strategy" ("block_number") `) - await db.query(`CREATE TABLE "ousd_aave_strategy" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "dai" numeric NOT NULL, "usdt" numeric NOT NULL, "usdc" numeric NOT NULL, CONSTRAINT "PK_b4b7ac6e395aa722df500f93623" PRIMARY KEY ("id"))`) - await db.query(`CREATE INDEX "IDX_ca34b5a0a33bc9abdd8213c2fa" ON "ousd_aave_strategy" ("timestamp") `) - await db.query(`CREATE INDEX "IDX_dacd7c98223d7bc8be074d71e4" ON "ousd_aave_strategy" ("block_number") `) - await db.query(`CREATE TABLE "ousd_meta_strategy" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "dai" numeric NOT NULL, "usdt" numeric NOT NULL, "usdc" numeric NOT NULL, CONSTRAINT "PK_d99170af73d86fe74460bbfacc4" PRIMARY KEY ("id"))`) - await db.query(`CREATE INDEX "IDX_7e998dcf775263bc5df76ef987" ON "ousd_meta_strategy" ("timestamp") `) - await db.query(`CREATE INDEX "IDX_55ce185680512d6a5b9fb0af89" ON "ousd_meta_strategy" ("block_number") `) - await db.query(`CREATE TABLE "ousd_convex_lusd_plus3_crv" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "dai" numeric NOT NULL, "usdt" numeric NOT NULL, "usdc" numeric NOT NULL, CONSTRAINT "PK_47290aa5dfa3cc5595f468e2f39" PRIMARY KEY ("id"))`) - await db.query(`CREATE INDEX "IDX_0783af95efb35fb3f13cde1656" ON "ousd_convex_lusd_plus3_crv" ("timestamp") `) - await db.query(`CREATE INDEX "IDX_74ae01fb596a4f2733087ba454" ON "ousd_convex_lusd_plus3_crv" ("block_number") `) - await db.query(`ALTER TABLE "oeth_history" ADD CONSTRAINT "FK_94e47c4c49128c78f60b185b46b" FOREIGN KEY ("address_id") REFERENCES "oeth_address"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`) - await db.query(`ALTER TABLE "oeth_rebase" ADD CONSTRAINT "FK_3331819842173de7c27c046547a" FOREIGN KEY ("apy_id") REFERENCES "oethapy"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`) - await db.query(`ALTER TABLE "oeth_rebase_option" ADD CONSTRAINT "FK_034428879698039839b4ba6ffe8" FOREIGN KEY ("address_id") REFERENCES "oeth_address"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`) - await db.query(`ALTER TABLE "oeth_strategy_holding_daily_stat" ADD CONSTRAINT "FK_4e867f220975e615e6077d860c1" FOREIGN KEY ("strategy_daily_stat_id_id") REFERENCES "oeth_strategy_daily_stat"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`) - await db.query(`ALTER TABLE "oeth_strategy_daily_stat" ADD CONSTRAINT "FK_6c7096c96a000d8471256ca8fc3" FOREIGN KEY ("daily_stat_id_id") REFERENCES "oeth_daily_stat"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`) - await db.query(`ALTER TABLE "oeth_collateral_daily_stat" ADD CONSTRAINT "FK_a90045de50406be7bd56efd3ea4" FOREIGN KEY ("daily_stat_id_id") REFERENCES "oeth_daily_stat"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`) - await db.query(`ALTER TABLE "ogv_address" ADD CONSTRAINT "FK_49d26f287904b8b1aef6e9ac2b3" FOREIGN KEY ("delegatee_id") REFERENCES "ogv_address"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`) - await db.query(`ALTER TABLE "ogv_lockup" ADD CONSTRAINT "FK_8be94cd63e35b91adf1301a156c" FOREIGN KEY ("address_id") REFERENCES "ogv_address"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`) - await db.query(`ALTER TABLE "ogv_lockup_tx_log" ADD CONSTRAINT "FK_b49fca291c97d9b55cd91f935f3" FOREIGN KEY ("ogv_lockup_id") REFERENCES "ogv_lockup"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`) - await db.query(`ALTER TABLE "ogv_proposal" ADD CONSTRAINT "FK_c62be3f16dfb3e4a09525c85af8" FOREIGN KEY ("proposer_id") REFERENCES "ogv_address"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`) - await db.query(`ALTER TABLE "ogv_proposal_tx_log" ADD CONSTRAINT "FK_5d5f5e10892290ee366d26de7dc" FOREIGN KEY ("proposal_id") REFERENCES "ogv_proposal"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`) - await db.query(`ALTER TABLE "ogv_proposal_vote" ADD CONSTRAINT "FK_58d732bc6523c2609d2725cc0ac" FOREIGN KEY ("proposal_id") REFERENCES "ogv_proposal"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`) - await db.query(`ALTER TABLE "ogv_proposal_vote" ADD CONSTRAINT "FK_2fd621aea353448fb3f17721bc8" FOREIGN KEY ("voter_id") REFERENCES "ogv_address"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`) - await db.query(`ALTER TABLE "ousd_history" ADD CONSTRAINT "FK_70291ea600c0c4d67d9bfe6a6bf" FOREIGN KEY ("address_id") REFERENCES "ousd_address"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`) - await db.query(`ALTER TABLE "ousd_rebase" ADD CONSTRAINT "FK_427468c97f9838b804efd6c8e55" FOREIGN KEY ("apy_id") REFERENCES "ousdapy"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`) - await db.query(`ALTER TABLE "ousd_rebase_option" ADD CONSTRAINT "FK_b04173f9349ddd991a3b60e914a" FOREIGN KEY ("address_id") REFERENCES "ousd_address"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`) - } - - async down(db) { - await db.query(`DROP TABLE "exchange_rate"`) - await db.query(`DROP INDEX "public"."IDX_9e23a3f1bf3634820c873a0fe8"`) - await db.query(`DROP INDEX "public"."IDX_c61a93768eed9e58ce399bbe01"`) - await db.query(`DROP TABLE "balance"`) - await db.query(`DROP INDEX "public"."IDX_a956b410c329b8eca7898c3c51"`) - await db.query(`DROP INDEX "public"."IDX_6b451b59c9f6a6fdd685f530b2"`) - await db.query(`DROP TABLE "strategy_balance"`) - await db.query(`DROP INDEX "public"."IDX_0113bf0b63183bea0d22cd0d08"`) - await db.query(`DROP INDEX "public"."IDX_a88065dcd92011698bbe7df7b1"`) - await db.query(`DROP TABLE "curve_pool_balance"`) - await db.query(`DROP INDEX "public"."IDX_ffb0d0f86f03faacef7cb3e092"`) - await db.query(`DROP INDEX "public"."IDX_db5522c865eb8ed76fa7aeb4a8"`) - await db.query(`DROP TABLE "oeth"`) - await db.query(`DROP INDEX "public"."IDX_5b81a67229bac2d68e0dc92cc4"`) - await db.query(`DROP INDEX "public"."IDX_408e5f79f83093aa5cf2b0ea32"`) - await db.query(`DROP TABLE "oeth_history"`) - await db.query(`DROP INDEX "public"."IDX_94e47c4c49128c78f60b185b46"`) - await db.query(`DROP INDEX "public"."IDX_96956b1c8d29eb7066a97d5ea7"`) - await db.query(`DROP INDEX "public"."IDX_b14170bdb7fbc0775bf55df15d"`) - await db.query(`DROP TABLE "oeth_address"`) - await db.query(`DROP TABLE "oethapy"`) - await db.query(`DROP INDEX "public"."IDX_b1a448045d1ed9d655b679a371"`) - await db.query(`DROP INDEX "public"."IDX_6b8a7a706a0701e659a7d81508"`) - await db.query(`DROP INDEX "public"."IDX_c0c03168bb0139e3cffda4f00e"`) - await db.query(`DROP TABLE "oeth_rebase"`) - await db.query(`DROP INDEX "public"."IDX_fbb7b3f2fff9896eb683b86de7"`) - await db.query(`DROP INDEX "public"."IDX_d3255d02d9407bba89380d01fa"`) - await db.query(`DROP INDEX "public"."IDX_8b6bb0243472af88612fe6a01f"`) - await db.query(`DROP INDEX "public"."IDX_3331819842173de7c27c046547"`) - await db.query(`DROP TABLE "oeth_rebase_option"`) - await db.query(`DROP INDEX "public"."IDX_1fc6bbd88037bfbf4361776909"`) - await db.query(`DROP INDEX "public"."IDX_cbb7ceb49ef7c45432d0171296"`) - await db.query(`DROP INDEX "public"."IDX_355826dadaacc5ae2d63c82f28"`) - await db.query(`DROP INDEX "public"."IDX_034428879698039839b4ba6ffe"`) - await db.query(`DROP TABLE "oeth_vault"`) - await db.query(`DROP INDEX "public"."IDX_d6298a294864b4eaf793cf35a4"`) - await db.query(`DROP INDEX "public"."IDX_e20cb507a673817b2c68720415"`) - await db.query(`DROP TABLE "oeth_curve_lp"`) - await db.query(`DROP INDEX "public"."IDX_d9bbd20e888fa1b4b2c5d2f039"`) - await db.query(`DROP INDEX "public"."IDX_7617d593c36dce1b1565a8d74a"`) - await db.query(`DROP TABLE "oeth_frax_staking"`) - await db.query(`DROP INDEX "public"."IDX_ce6c2c65e90967dfeaac97025b"`) - await db.query(`DROP INDEX "public"."IDX_1a7f7d650390e2f9c212651e05"`) - await db.query(`DROP TABLE "oeth_morpho_aave"`) - await db.query(`DROP INDEX "public"."IDX_25e239b985844f1d33fac79981"`) - await db.query(`DROP INDEX "public"."IDX_a6662224e95eb6921bb14cb5f9"`) - await db.query(`DROP TABLE "oeth_dripper"`) - await db.query(`DROP INDEX "public"."IDX_16ac742ceeb05d28e530da9649"`) - await db.query(`DROP INDEX "public"."IDX_d356832c14603916a492608e7b"`) - await db.query(`DROP TABLE "oeth_balancer_meta_pool_strategy"`) - await db.query(`DROP INDEX "public"."IDX_5e7ef383756fa18cb602f50089"`) - await db.query(`DROP INDEX "public"."IDX_11d344b3e0e03cdb6697dd61f7"`) - await db.query(`DROP TABLE "oeth_strategy_holding_daily_stat"`) - await db.query(`DROP INDEX "public"."IDX_4e867f220975e615e6077d860c"`) - await db.query(`DROP TABLE "oeth_strategy_daily_stat"`) - await db.query(`DROP INDEX "public"."IDX_6c7096c96a000d8471256ca8fc"`) - await db.query(`DROP TABLE "oeth_collateral_daily_stat"`) - await db.query(`DROP INDEX "public"."IDX_a90045de50406be7bd56efd3ea"`) - await db.query(`DROP TABLE "oeth_daily_stat"`) - await db.query(`DROP INDEX "public"."IDX_98d9001013aa37425ca47b7126"`) - await db.query(`DROP INDEX "public"."IDX_c3e66051c7df4efd6a8fa8f9c1"`) - await db.query(`DROP TABLE "oeth_reward_token_collected"`) - await db.query(`DROP INDEX "public"."IDX_81a9fa43ae4a6ae63e4103127b"`) - await db.query(`DROP INDEX "public"."IDX_d36c78b9c3e9d737f067638bc4"`) - await db.query(`DROP TABLE "ogv"`) - await db.query(`DROP INDEX "public"."IDX_2418a8b8b92b2f5977be761cf9"`) - await db.query(`DROP INDEX "public"."IDX_b8f20bcf48e4aa77e0f48d77db"`) - await db.query(`DROP TABLE "ogv_address"`) - await db.query(`DROP INDEX "public"."IDX_49d26f287904b8b1aef6e9ac2b"`) - await db.query(`DROP TABLE "ogv_lockup"`) - await db.query(`DROP INDEX "public"."IDX_8114101b53d9d6bc26fe80838a"`) - await db.query(`DROP INDEX "public"."IDX_8be94cd63e35b91adf1301a156"`) - await db.query(`DROP TABLE "ogv_lockup_tx_log"`) - await db.query(`DROP INDEX "public"."IDX_b49fca291c97d9b55cd91f935f"`) - await db.query(`DROP TABLE "ogv_proposal"`) - await db.query(`DROP INDEX "public"."IDX_c62be3f16dfb3e4a09525c85af"`) - await db.query(`DROP TABLE "ogv_proposal_tx_log"`) - await db.query(`DROP INDEX "public"."IDX_5d5f5e10892290ee366d26de7d"`) - await db.query(`DROP TABLE "ogv_proposal_vote"`) - await db.query(`DROP INDEX "public"."IDX_58d732bc6523c2609d2725cc0a"`) - await db.query(`DROP INDEX "public"."IDX_2fd621aea353448fb3f17721bc"`) - await db.query(`DROP TABLE "ousd"`) - await db.query(`DROP INDEX "public"."IDX_c8d1e285213b445b088805ac7c"`) - await db.query(`DROP INDEX "public"."IDX_806949dd853b7e8acab5d03b81"`) - await db.query(`DROP TABLE "ousd_history"`) - await db.query(`DROP INDEX "public"."IDX_70291ea600c0c4d67d9bfe6a6b"`) - await db.query(`DROP INDEX "public"."IDX_4d00d283e1ce3209dc43a0313c"`) - await db.query(`DROP INDEX "public"."IDX_0c25caa59aa053a688a723d160"`) - await db.query(`DROP TABLE "ousd_address"`) - await db.query(`DROP TABLE "ousdapy"`) - await db.query(`DROP INDEX "public"."IDX_c514963f42908ce84d65a84a77"`) - await db.query(`DROP INDEX "public"."IDX_4f606414b3b5ce1a366bd0fbf6"`) - await db.query(`DROP INDEX "public"."IDX_0e84a81a109b66fe6f01f77c74"`) - await db.query(`DROP TABLE "ousd_rebase"`) - await db.query(`DROP INDEX "public"."IDX_f8eb4a16ce58a146b3227ee21a"`) - await db.query(`DROP INDEX "public"."IDX_3fb03b1a410e64c7367226d0b6"`) - await db.query(`DROP INDEX "public"."IDX_1a76c478199672aaeec340f619"`) - await db.query(`DROP INDEX "public"."IDX_427468c97f9838b804efd6c8e5"`) - await db.query(`DROP TABLE "ousd_rebase_option"`) - await db.query(`DROP INDEX "public"."IDX_64bd23947dc4c67e3b6a3f9352"`) - await db.query(`DROP INDEX "public"."IDX_9b774e46b8b1cf7f828133809a"`) - await db.query(`DROP INDEX "public"."IDX_4e95bf069de04533d83a9a97fd"`) - await db.query(`DROP INDEX "public"."IDX_b04173f9349ddd991a3b60e914"`) - await db.query(`DROP TABLE "ousd_vault"`) - await db.query(`DROP INDEX "public"."IDX_6860186ea2f56e2c7d54c22107"`) - await db.query(`DROP INDEX "public"."IDX_0d0a7113a505cf7f7adea9ca81"`) - await db.query(`DROP TABLE "ousd_morpho_aave"`) - await db.query(`DROP INDEX "public"."IDX_78e0701c2e9a28242db37bd8f8"`) - await db.query(`DROP INDEX "public"."IDX_46ccf673b376d654052fbd53e6"`) - await db.query(`DROP TABLE "ousd_morpho_compound"`) - await db.query(`DROP INDEX "public"."IDX_9e7bd0d8ae23b877d5979ef80c"`) - await db.query(`DROP INDEX "public"."IDX_0bb3a0ad84071f1d80f6d4e90f"`) - await db.query(`DROP TABLE "maker_dsr_strategy"`) - await db.query(`DROP INDEX "public"."IDX_a35308a3c5dbaab2d321eb1525"`) - await db.query(`DROP INDEX "public"."IDX_844b219d8faf9b1d24ab2dba9a"`) - await db.query(`DROP TABLE "ousd_flux_strategy"`) - await db.query(`DROP INDEX "public"."IDX_5b165b5d30b13e363d33a66e14"`) - await db.query(`DROP INDEX "public"."IDX_80f3392968fde7b99cccb805ac"`) - await db.query(`DROP TABLE "ousd_compound_strategy"`) - await db.query(`DROP INDEX "public"."IDX_6920b1db5dc577295ac4d1379d"`) - await db.query(`DROP INDEX "public"."IDX_89c6d7d3104bd36dc88a37add4"`) - await db.query(`DROP TABLE "ousd_convex_strategy"`) - await db.query(`DROP INDEX "public"."IDX_2deac473cd0b2dd7082e7da148"`) - await db.query(`DROP INDEX "public"."IDX_157bf74171817dc5c60ee37036"`) - await db.query(`DROP TABLE "ousd_aave_strategy"`) - await db.query(`DROP INDEX "public"."IDX_ca34b5a0a33bc9abdd8213c2fa"`) - await db.query(`DROP INDEX "public"."IDX_dacd7c98223d7bc8be074d71e4"`) - await db.query(`DROP TABLE "ousd_meta_strategy"`) - await db.query(`DROP INDEX "public"."IDX_7e998dcf775263bc5df76ef987"`) - await db.query(`DROP INDEX "public"."IDX_55ce185680512d6a5b9fb0af89"`) - await db.query(`DROP TABLE "ousd_convex_lusd_plus3_crv"`) - await db.query(`DROP INDEX "public"."IDX_0783af95efb35fb3f13cde1656"`) - await db.query(`DROP INDEX "public"."IDX_74ae01fb596a4f2733087ba454"`) - await db.query(`ALTER TABLE "oeth_history" DROP CONSTRAINT "FK_94e47c4c49128c78f60b185b46b"`) - await db.query(`ALTER TABLE "oeth_rebase" DROP CONSTRAINT "FK_3331819842173de7c27c046547a"`) - await db.query(`ALTER TABLE "oeth_rebase_option" DROP CONSTRAINT "FK_034428879698039839b4ba6ffe8"`) - await db.query(`ALTER TABLE "oeth_strategy_holding_daily_stat" DROP CONSTRAINT "FK_4e867f220975e615e6077d860c1"`) - await db.query(`ALTER TABLE "oeth_strategy_daily_stat" DROP CONSTRAINT "FK_6c7096c96a000d8471256ca8fc3"`) - await db.query(`ALTER TABLE "oeth_collateral_daily_stat" DROP CONSTRAINT "FK_a90045de50406be7bd56efd3ea4"`) - await db.query(`ALTER TABLE "ogv_address" DROP CONSTRAINT "FK_49d26f287904b8b1aef6e9ac2b3"`) - await db.query(`ALTER TABLE "ogv_lockup" DROP CONSTRAINT "FK_8be94cd63e35b91adf1301a156c"`) - await db.query(`ALTER TABLE "ogv_lockup_tx_log" DROP CONSTRAINT "FK_b49fca291c97d9b55cd91f935f3"`) - await db.query(`ALTER TABLE "ogv_proposal" DROP CONSTRAINT "FK_c62be3f16dfb3e4a09525c85af8"`) - await db.query(`ALTER TABLE "ogv_proposal_tx_log" DROP CONSTRAINT "FK_5d5f5e10892290ee366d26de7dc"`) - await db.query(`ALTER TABLE "ogv_proposal_vote" DROP CONSTRAINT "FK_58d732bc6523c2609d2725cc0ac"`) - await db.query(`ALTER TABLE "ogv_proposal_vote" DROP CONSTRAINT "FK_2fd621aea353448fb3f17721bc8"`) - await db.query(`ALTER TABLE "ousd_history" DROP CONSTRAINT "FK_70291ea600c0c4d67d9bfe6a6bf"`) - await db.query(`ALTER TABLE "ousd_rebase" DROP CONSTRAINT "FK_427468c97f9838b804efd6c8e55"`) - await db.query(`ALTER TABLE "ousd_rebase_option" DROP CONSTRAINT "FK_b04173f9349ddd991a3b60e914a"`) - } -} diff --git a/db/migrations/1699376932754-Data.js b/db/migrations/1699376932754-Data.js deleted file mode 100644 index d1a385c1..00000000 --- a/db/migrations/1699376932754-Data.js +++ /dev/null @@ -1,289 +0,0 @@ -module.exports = class Data1699376932754 { - name = 'Data1699376932754' - - async up(db) { - await db.query(`CREATE TABLE "exchange_rate" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "pair" text NOT NULL, "base" text NOT NULL, "quote" text NOT NULL, "rate" numeric NOT NULL, CONSTRAINT "PK_5c5d27d2b900ef6cdeef0398472" PRIMARY KEY ("id"))`) - await db.query(`CREATE INDEX "IDX_9e23a3f1bf3634820c873a0fe8" ON "exchange_rate" ("timestamp") `) - await db.query(`CREATE INDEX "IDX_c61a93768eed9e58ce399bbe01" ON "exchange_rate" ("block_number") `) - await db.query(`CREATE TABLE "balance" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "token" text NOT NULL, "address" text NOT NULL, "balance" numeric NOT NULL, CONSTRAINT "PK_079dddd31a81672e8143a649ca0" PRIMARY KEY ("id"))`) - await db.query(`CREATE INDEX "IDX_a956b410c329b8eca7898c3c51" ON "balance" ("timestamp") `) - await db.query(`CREATE INDEX "IDX_6b451b59c9f6a6fdd685f530b2" ON "balance" ("block_number") `) - await db.query(`CREATE TABLE "strategy_balance" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "strategy" text NOT NULL, "asset" text NOT NULL, "balance" numeric NOT NULL, CONSTRAINT "PK_ca6f93229d1392e9546d01dae4f" PRIMARY KEY ("id"))`) - await db.query(`CREATE INDEX "IDX_0113bf0b63183bea0d22cd0d08" ON "strategy_balance" ("timestamp") `) - await db.query(`CREATE INDEX "IDX_a88065dcd92011698bbe7df7b1" ON "strategy_balance" ("block_number") `) - await db.query(`CREATE TABLE "strategy_yield" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "strategy" text NOT NULL, "asset" text NOT NULL, "balance" numeric NOT NULL, "balance_weight" numeric NOT NULL, "earnings" numeric NOT NULL, "earnings_change" numeric NOT NULL, CONSTRAINT "PK_e87c46575e870fe2202190c2728" PRIMARY KEY ("id"))`) - await db.query(`CREATE INDEX "IDX_5108f2a2563d5665892d0c06b0" ON "strategy_yield" ("timestamp") `) - await db.query(`CREATE INDEX "IDX_41c3567c9d43c598e07a0029c5" ON "strategy_yield" ("block_number") `) - await db.query(`CREATE TABLE "strategy_daily_yield" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "strategy" text NOT NULL, "asset" text NOT NULL, "balance" numeric NOT NULL, "earnings" numeric NOT NULL, "earnings_change" numeric NOT NULL, "apr" numeric NOT NULL, "apy" numeric NOT NULL, CONSTRAINT "PK_b0dd2686bc95bb032ff532b3a0e" PRIMARY KEY ("id"))`) - await db.query(`CREATE INDEX "IDX_0ba1974747f1906e0c102cd2cd" ON "strategy_daily_yield" ("timestamp") `) - await db.query(`CREATE INDEX "IDX_df364fb6e82d1feeed2a5dfffa" ON "strategy_daily_yield" ("block_number") `) - await db.query(`CREATE TABLE "curve_pool_balance" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "address" text NOT NULL, "balance0" numeric NOT NULL, "balance1" numeric NOT NULL, "balance2" numeric NOT NULL, CONSTRAINT "PK_40412750bb910ca560aa084dd88" PRIMARY KEY ("id"))`) - await db.query(`CREATE INDEX "IDX_ffb0d0f86f03faacef7cb3e092" ON "curve_pool_balance" ("timestamp") `) - await db.query(`CREATE INDEX "IDX_db5522c865eb8ed76fa7aeb4a8" ON "curve_pool_balance" ("block_number") `) - await db.query(`CREATE TABLE "oeth" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "total_supply" numeric NOT NULL, "rebasing_supply" numeric NOT NULL, "non_rebasing_supply" numeric NOT NULL, CONSTRAINT "PK_de1d885501070dbd1ab6f8577ba" PRIMARY KEY ("id"))`) - await db.query(`CREATE INDEX "IDX_5b81a67229bac2d68e0dc92cc4" ON "oeth" ("timestamp") `) - await db.query(`CREATE INDEX "IDX_408e5f79f83093aa5cf2b0ea32" ON "oeth" ("block_number") `) - await db.query(`CREATE TABLE "oeth_history" ("id" character varying NOT NULL, "value" numeric NOT NULL, "balance" numeric NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "tx_hash" text NOT NULL, "type" character varying(8) NOT NULL, "address_id" character varying, CONSTRAINT "PK_2c7e7571cd9ea02b07a27a303f3" PRIMARY KEY ("id"))`) - await db.query(`CREATE INDEX "IDX_94e47c4c49128c78f60b185b46" ON "oeth_history" ("address_id") `) - await db.query(`CREATE INDEX "IDX_96956b1c8d29eb7066a97d5ea7" ON "oeth_history" ("block_number") `) - await db.query(`CREATE INDEX "IDX_b14170bdb7fbc0775bf55df15d" ON "oeth_history" ("tx_hash") `) - await db.query(`CREATE TABLE "oeth_address" ("id" character varying NOT NULL, "is_contract" boolean NOT NULL, "rebasing_option" character varying(6) NOT NULL, "balance" numeric NOT NULL, "earned" numeric NOT NULL, "credits" numeric NOT NULL, "last_updated" TIMESTAMP WITH TIME ZONE NOT NULL, CONSTRAINT "PK_92a966afe47d584af73ce77a1cd" PRIMARY KEY ("id"))`) - await db.query(`CREATE TABLE "oethapy" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "tx_hash" text NOT NULL, "apr" numeric NOT NULL, "apy" numeric NOT NULL, "apy7_day_avg" numeric NOT NULL, "apy14_day_avg" numeric NOT NULL, "apy30_day_avg" numeric NOT NULL, "rebasing_credits_per_token" numeric NOT NULL, CONSTRAINT "PK_8dbb4d04591848361200f18f62a" PRIMARY KEY ("id"))`) - await db.query(`CREATE INDEX "IDX_b1a448045d1ed9d655b679a371" ON "oethapy" ("timestamp") `) - await db.query(`CREATE INDEX "IDX_6b8a7a706a0701e659a7d81508" ON "oethapy" ("block_number") `) - await db.query(`CREATE INDEX "IDX_c0c03168bb0139e3cffda4f00e" ON "oethapy" ("tx_hash") `) - await db.query(`CREATE TABLE "oeth_rebase" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "tx_hash" text NOT NULL, "total_supply" numeric NOT NULL, "rebasing_credits" numeric NOT NULL, "rebasing_credits_per_token" numeric NOT NULL, "fee" numeric NOT NULL, "yield" numeric NOT NULL, "apy_id" character varying, CONSTRAINT "PK_5f8f4dd071caf685b4ac2d54de3" PRIMARY KEY ("id"))`) - await db.query(`CREATE INDEX "IDX_fbb7b3f2fff9896eb683b86de7" ON "oeth_rebase" ("timestamp") `) - await db.query(`CREATE INDEX "IDX_d3255d02d9407bba89380d01fa" ON "oeth_rebase" ("block_number") `) - await db.query(`CREATE INDEX "IDX_8b6bb0243472af88612fe6a01f" ON "oeth_rebase" ("tx_hash") `) - await db.query(`CREATE INDEX "IDX_3331819842173de7c27c046547" ON "oeth_rebase" ("apy_id") `) - await db.query(`CREATE TABLE "oeth_rebase_option" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "tx_hash" text NOT NULL, "status" character varying(6) NOT NULL, "address_id" character varying, CONSTRAINT "PK_32971725d5523200b4b3b7c07e5" PRIMARY KEY ("id"))`) - await db.query(`CREATE INDEX "IDX_1fc6bbd88037bfbf4361776909" ON "oeth_rebase_option" ("timestamp") `) - await db.query(`CREATE INDEX "IDX_cbb7ceb49ef7c45432d0171296" ON "oeth_rebase_option" ("block_number") `) - await db.query(`CREATE INDEX "IDX_355826dadaacc5ae2d63c82f28" ON "oeth_rebase_option" ("tx_hash") `) - await db.query(`CREATE INDEX "IDX_034428879698039839b4ba6ffe" ON "oeth_rebase_option" ("address_id") `) - await db.query(`CREATE TABLE "oeth_vault" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "weth" numeric NOT NULL, "st_eth" numeric NOT NULL, "r_eth" numeric NOT NULL, "frx_eth" numeric NOT NULL, CONSTRAINT "PK_9debaa84944fe2be9dc4219ba8f" PRIMARY KEY ("id"))`) - await db.query(`CREATE INDEX "IDX_d6298a294864b4eaf793cf35a4" ON "oeth_vault" ("timestamp") `) - await db.query(`CREATE INDEX "IDX_e20cb507a673817b2c68720415" ON "oeth_vault" ("block_number") `) - await db.query(`CREATE TABLE "oeth_curve_lp" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "total_supply" numeric NOT NULL, "eth" numeric NOT NULL, "oeth" numeric NOT NULL, "total_supply_owned" numeric NOT NULL, "eth_owned" numeric NOT NULL, "oeth_owned" numeric NOT NULL, CONSTRAINT "PK_2b055044664e80f44d6172fdf54" PRIMARY KEY ("id"))`) - await db.query(`CREATE INDEX "IDX_d9bbd20e888fa1b4b2c5d2f039" ON "oeth_curve_lp" ("timestamp") `) - await db.query(`CREATE INDEX "IDX_7617d593c36dce1b1565a8d74a" ON "oeth_curve_lp" ("block_number") `) - await db.query(`CREATE TABLE "oeth_frax_staking" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "sfrx_eth" numeric NOT NULL, CONSTRAINT "PK_694f53c8600ae88c7bdcf7305dd" PRIMARY KEY ("id"))`) - await db.query(`CREATE INDEX "IDX_ce6c2c65e90967dfeaac97025b" ON "oeth_frax_staking" ("timestamp") `) - await db.query(`CREATE INDEX "IDX_1a7f7d650390e2f9c212651e05" ON "oeth_frax_staking" ("block_number") `) - await db.query(`CREATE TABLE "oeth_morpho_aave" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "weth" numeric NOT NULL, CONSTRAINT "PK_86de8f846e9335c92b8ad7df3a1" PRIMARY KEY ("id"))`) - await db.query(`CREATE INDEX "IDX_25e239b985844f1d33fac79981" ON "oeth_morpho_aave" ("timestamp") `) - await db.query(`CREATE INDEX "IDX_a6662224e95eb6921bb14cb5f9" ON "oeth_morpho_aave" ("block_number") `) - await db.query(`CREATE TABLE "oeth_dripper" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "weth" numeric NOT NULL, "last_collect_timestamp" integer NOT NULL, "drip_rate_per_block" numeric NOT NULL, "drip_duration" numeric NOT NULL, CONSTRAINT "PK_77731281c1564c24eff0c265984" PRIMARY KEY ("id"))`) - await db.query(`CREATE INDEX "IDX_16ac742ceeb05d28e530da9649" ON "oeth_dripper" ("timestamp") `) - await db.query(`CREATE INDEX "IDX_d356832c14603916a492608e7b" ON "oeth_dripper" ("block_number") `) - await db.query(`CREATE TABLE "oeth_balancer_meta_pool_strategy" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "r_eth" numeric NOT NULL, "weth" numeric NOT NULL, CONSTRAINT "PK_6ddf5b8ba878e6d706e59bd6de0" PRIMARY KEY ("id"))`) - await db.query(`CREATE INDEX "IDX_5e7ef383756fa18cb602f50089" ON "oeth_balancer_meta_pool_strategy" ("timestamp") `) - await db.query(`CREATE INDEX "IDX_11d344b3e0e03cdb6697dd61f7" ON "oeth_balancer_meta_pool_strategy" ("block_number") `) - await db.query(`CREATE TABLE "oeth_strategy_holding_daily_stat" ("id" character varying NOT NULL, "symbol" text NOT NULL, "amount" numeric NOT NULL, "value" numeric NOT NULL, "strategy_daily_stat_id_id" character varying, CONSTRAINT "PK_7f1a62da5e53cf264c2f39b4acf" PRIMARY KEY ("id"))`) - await db.query(`CREATE INDEX "IDX_4e867f220975e615e6077d860c" ON "oeth_strategy_holding_daily_stat" ("strategy_daily_stat_id_id") `) - await db.query(`CREATE TABLE "oeth_strategy_daily_stat" ("id" character varying NOT NULL, "name" text NOT NULL, "total" numeric NOT NULL, "tvl" numeric NOT NULL, "daily_stat_id_id" character varying, CONSTRAINT "PK_8af1a0c60e67b05baf928787a8e" PRIMARY KEY ("id"))`) - await db.query(`CREATE INDEX "IDX_6c7096c96a000d8471256ca8fc" ON "oeth_strategy_daily_stat" ("daily_stat_id_id") `) - await db.query(`CREATE TABLE "oeth_collateral_daily_stat" ("id" character varying NOT NULL, "symbol" text NOT NULL, "amount" numeric NOT NULL, "price" numeric NOT NULL, "value" numeric NOT NULL, "daily_stat_id_id" character varying, CONSTRAINT "PK_5fb23d7bae30dffe4543e7aa069" PRIMARY KEY ("id"))`) - await db.query(`CREATE INDEX "IDX_a90045de50406be7bd56efd3ea" ON "oeth_collateral_daily_stat" ("daily_stat_id_id") `) - await db.query(`CREATE TABLE "oeth_daily_stat" ("id" character varying NOT NULL, "block_number" integer NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "apr" numeric NOT NULL, "apy" numeric NOT NULL, "apy7_day_avg" numeric NOT NULL, "apy14_day_avg" numeric NOT NULL, "apy30_day_avg" numeric NOT NULL, "total_supply" numeric NOT NULL, "total_supply_usd" numeric NOT NULL, "rebasing_supply" numeric NOT NULL, "non_rebasing_supply" numeric NOT NULL, "amo_supply" numeric NOT NULL, "dripper_weth" numeric NOT NULL, "yield" numeric NOT NULL, "fees" numeric NOT NULL, "revenue" numeric NOT NULL, "revenue7_day_avg" numeric NOT NULL, "revenue7_day_total" numeric NOT NULL, "revenue_all_time" numeric NOT NULL, "peg_price" numeric NOT NULL, CONSTRAINT "PK_9144a02ab13b1baa818a7d5eae5" PRIMARY KEY ("id"))`) - await db.query(`CREATE INDEX "IDX_98d9001013aa37425ca47b7126" ON "oeth_daily_stat" ("block_number") `) - await db.query(`CREATE INDEX "IDX_c3e66051c7df4efd6a8fa8f9c1" ON "oeth_daily_stat" ("timestamp") `) - await db.query(`CREATE TABLE "oeth_reward_token_collected" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "strategy" text NOT NULL, "recipient" text NOT NULL, "reward_token" text NOT NULL, "amount" numeric NOT NULL, CONSTRAINT "PK_47098cc5fbc7cb95c2374fa33cd" PRIMARY KEY ("id"))`) - await db.query(`CREATE INDEX "IDX_81a9fa43ae4a6ae63e4103127b" ON "oeth_reward_token_collected" ("timestamp") `) - await db.query(`CREATE INDEX "IDX_d36c78b9c3e9d737f067638bc4" ON "oeth_reward_token_collected" ("block_number") `) - await db.query(`CREATE TABLE "ogv" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "circulating" numeric NOT NULL, "total" numeric NOT NULL, CONSTRAINT "PK_f16038abf451ce82bd03ea54ee7" PRIMARY KEY ("id"))`) - await db.query(`CREATE INDEX "IDX_2418a8b8b92b2f5977be761cf9" ON "ogv" ("timestamp") `) - await db.query(`CREATE INDEX "IDX_b8f20bcf48e4aa77e0f48d77db" ON "ogv" ("block_number") `) - await db.query(`CREATE TABLE "staked_ogv" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "total" numeric NOT NULL, "apy" numeric NOT NULL, CONSTRAINT "PK_b135611d9aab36c7889982c3be8" PRIMARY KEY ("id"))`) - await db.query(`CREATE INDEX "IDX_533195c60cfaef9e118789dee9" ON "staked_ogv" ("timestamp") `) - await db.query(`CREATE INDEX "IDX_d601233411a33212b9d616aab0" ON "staked_ogv" ("block_number") `) - await db.query(`CREATE TABLE "ogv_governance" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "registered_voters" integer NOT NULL, "open_source_contributors" integer NOT NULL, "improvement_proposals" integer NOT NULL, CONSTRAINT "PK_b22758cd4ee8ff92c1b7ee0cf20" PRIMARY KEY ("id"))`) - await db.query(`CREATE INDEX "IDX_a0329e7109d5959b9aa3d9d374" ON "ogv_governance" ("timestamp") `) - await db.query(`CREATE INDEX "IDX_63cd1ca46771965c68f6b85898" ON "ogv_governance" ("block_number") `) - await db.query(`CREATE TABLE "ousd" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "total_supply" numeric NOT NULL, "rebasing_supply" numeric NOT NULL, "non_rebasing_supply" numeric NOT NULL, CONSTRAINT "PK_acecae4a20bc14b22d9f6738d8d" PRIMARY KEY ("id"))`) - await db.query(`CREATE INDEX "IDX_c8d1e285213b445b088805ac7c" ON "ousd" ("timestamp") `) - await db.query(`CREATE INDEX "IDX_806949dd853b7e8acab5d03b81" ON "ousd" ("block_number") `) - await db.query(`CREATE TABLE "ousd_history" ("id" character varying NOT NULL, "value" numeric NOT NULL, "balance" numeric NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "tx_hash" text NOT NULL, "type" character varying(8) NOT NULL, "address_id" character varying, CONSTRAINT "PK_dcbe3223b67f92d9ad4cffe8a7c" PRIMARY KEY ("id"))`) - await db.query(`CREATE INDEX "IDX_70291ea600c0c4d67d9bfe6a6b" ON "ousd_history" ("address_id") `) - await db.query(`CREATE INDEX "IDX_4d00d283e1ce3209dc43a0313c" ON "ousd_history" ("block_number") `) - await db.query(`CREATE INDEX "IDX_0c25caa59aa053a688a723d160" ON "ousd_history" ("tx_hash") `) - await db.query(`CREATE TABLE "ousd_address" ("id" character varying NOT NULL, "is_contract" boolean NOT NULL, "rebasing_option" character varying(6) NOT NULL, "balance" numeric NOT NULL, "earned" numeric NOT NULL, "credits" numeric NOT NULL, "last_updated" TIMESTAMP WITH TIME ZONE NOT NULL, CONSTRAINT "PK_bb061344757ede566d62854af6a" PRIMARY KEY ("id"))`) - await db.query(`CREATE TABLE "ousdapy" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "tx_hash" text NOT NULL, "apr" numeric NOT NULL, "apy" numeric NOT NULL, "apy7_day_avg" numeric NOT NULL, "apy14_day_avg" numeric NOT NULL, "apy30_day_avg" numeric NOT NULL, "rebasing_credits_per_token" numeric NOT NULL, CONSTRAINT "PK_d9889b7153efc82dbe88f9a7a33" PRIMARY KEY ("id"))`) - await db.query(`CREATE INDEX "IDX_c514963f42908ce84d65a84a77" ON "ousdapy" ("timestamp") `) - await db.query(`CREATE INDEX "IDX_4f606414b3b5ce1a366bd0fbf6" ON "ousdapy" ("block_number") `) - await db.query(`CREATE INDEX "IDX_0e84a81a109b66fe6f01f77c74" ON "ousdapy" ("tx_hash") `) - await db.query(`CREATE TABLE "ousd_rebase" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "tx_hash" text NOT NULL, "total_supply" numeric NOT NULL, "rebasing_credits" numeric NOT NULL, "rebasing_credits_per_token" numeric NOT NULL, "fee" numeric NOT NULL, "yield" numeric NOT NULL, "apy_id" character varying, CONSTRAINT "PK_04cf0de72399a99798dde61b237" PRIMARY KEY ("id"))`) - await db.query(`CREATE INDEX "IDX_f8eb4a16ce58a146b3227ee21a" ON "ousd_rebase" ("timestamp") `) - await db.query(`CREATE INDEX "IDX_3fb03b1a410e64c7367226d0b6" ON "ousd_rebase" ("block_number") `) - await db.query(`CREATE INDEX "IDX_1a76c478199672aaeec340f619" ON "ousd_rebase" ("tx_hash") `) - await db.query(`CREATE INDEX "IDX_427468c97f9838b804efd6c8e5" ON "ousd_rebase" ("apy_id") `) - await db.query(`CREATE TABLE "ousd_rebase_option" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "tx_hash" text NOT NULL, "status" character varying(6) NOT NULL, "address_id" character varying, CONSTRAINT "PK_d684f90866027104f3c929dfe10" PRIMARY KEY ("id"))`) - await db.query(`CREATE INDEX "IDX_64bd23947dc4c67e3b6a3f9352" ON "ousd_rebase_option" ("timestamp") `) - await db.query(`CREATE INDEX "IDX_9b774e46b8b1cf7f828133809a" ON "ousd_rebase_option" ("block_number") `) - await db.query(`CREATE INDEX "IDX_4e95bf069de04533d83a9a97fd" ON "ousd_rebase_option" ("tx_hash") `) - await db.query(`CREATE INDEX "IDX_b04173f9349ddd991a3b60e914" ON "ousd_rebase_option" ("address_id") `) - await db.query(`CREATE TABLE "ousd_vault" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "dai" numeric NOT NULL, "usdt" numeric NOT NULL, "usdc" numeric NOT NULL, CONSTRAINT "PK_343f5538c71a1cd78f1659ef9d3" PRIMARY KEY ("id"))`) - await db.query(`CREATE INDEX "IDX_6860186ea2f56e2c7d54c22107" ON "ousd_vault" ("timestamp") `) - await db.query(`CREATE INDEX "IDX_0d0a7113a505cf7f7adea9ca81" ON "ousd_vault" ("block_number") `) - await db.query(`CREATE TABLE "ousd_morpho_aave" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "dai" numeric NOT NULL, "usdt" numeric NOT NULL, "usdc" numeric NOT NULL, CONSTRAINT "PK_60676cde905a822ba73ff3a5c85" PRIMARY KEY ("id"))`) - await db.query(`CREATE INDEX "IDX_78e0701c2e9a28242db37bd8f8" ON "ousd_morpho_aave" ("timestamp") `) - await db.query(`CREATE INDEX "IDX_46ccf673b376d654052fbd53e6" ON "ousd_morpho_aave" ("block_number") `) - await db.query(`CREATE TABLE "ousd_morpho_compound" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "dai" numeric NOT NULL, "usdt" numeric NOT NULL, "usdc" numeric NOT NULL, CONSTRAINT "PK_5f715d53ef8fc0fad595cacf4fa" PRIMARY KEY ("id"))`) - await db.query(`CREATE INDEX "IDX_9e7bd0d8ae23b877d5979ef80c" ON "ousd_morpho_compound" ("timestamp") `) - await db.query(`CREATE INDEX "IDX_0bb3a0ad84071f1d80f6d4e90f" ON "ousd_morpho_compound" ("block_number") `) - await db.query(`CREATE TABLE "maker_dsr_strategy" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "dai" numeric NOT NULL, CONSTRAINT "PK_196da2d6910009ae04e3542fe22" PRIMARY KEY ("id"))`) - await db.query(`CREATE INDEX "IDX_a35308a3c5dbaab2d321eb1525" ON "maker_dsr_strategy" ("timestamp") `) - await db.query(`CREATE INDEX "IDX_844b219d8faf9b1d24ab2dba9a" ON "maker_dsr_strategy" ("block_number") `) - await db.query(`CREATE TABLE "ousd_flux_strategy" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "dai" numeric NOT NULL, "usdt" numeric NOT NULL, "usdc" numeric NOT NULL, CONSTRAINT "PK_ac977221429e50e4de1ce253a8b" PRIMARY KEY ("id"))`) - await db.query(`CREATE INDEX "IDX_5b165b5d30b13e363d33a66e14" ON "ousd_flux_strategy" ("timestamp") `) - await db.query(`CREATE INDEX "IDX_80f3392968fde7b99cccb805ac" ON "ousd_flux_strategy" ("block_number") `) - await db.query(`CREATE TABLE "ousd_compound_strategy" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "dai" numeric NOT NULL, "usdt" numeric NOT NULL, "usdc" numeric NOT NULL, CONSTRAINT "PK_9030e82bf3479d03c04e0d1919c" PRIMARY KEY ("id"))`) - await db.query(`CREATE INDEX "IDX_6920b1db5dc577295ac4d1379d" ON "ousd_compound_strategy" ("timestamp") `) - await db.query(`CREATE INDEX "IDX_89c6d7d3104bd36dc88a37add4" ON "ousd_compound_strategy" ("block_number") `) - await db.query(`CREATE TABLE "ousd_convex_strategy" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "dai" numeric NOT NULL, "usdt" numeric NOT NULL, "usdc" numeric NOT NULL, CONSTRAINT "PK_2b8f6e749e15e49d8816f1ac949" PRIMARY KEY ("id"))`) - await db.query(`CREATE INDEX "IDX_2deac473cd0b2dd7082e7da148" ON "ousd_convex_strategy" ("timestamp") `) - await db.query(`CREATE INDEX "IDX_157bf74171817dc5c60ee37036" ON "ousd_convex_strategy" ("block_number") `) - await db.query(`CREATE TABLE "ousd_aave_strategy" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "dai" numeric NOT NULL, "usdt" numeric NOT NULL, "usdc" numeric NOT NULL, CONSTRAINT "PK_b4b7ac6e395aa722df500f93623" PRIMARY KEY ("id"))`) - await db.query(`CREATE INDEX "IDX_ca34b5a0a33bc9abdd8213c2fa" ON "ousd_aave_strategy" ("timestamp") `) - await db.query(`CREATE INDEX "IDX_dacd7c98223d7bc8be074d71e4" ON "ousd_aave_strategy" ("block_number") `) - await db.query(`CREATE TABLE "ousd_meta_strategy" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "dai" numeric NOT NULL, "usdt" numeric NOT NULL, "usdc" numeric NOT NULL, CONSTRAINT "PK_d99170af73d86fe74460bbfacc4" PRIMARY KEY ("id"))`) - await db.query(`CREATE INDEX "IDX_7e998dcf775263bc5df76ef987" ON "ousd_meta_strategy" ("timestamp") `) - await db.query(`CREATE INDEX "IDX_55ce185680512d6a5b9fb0af89" ON "ousd_meta_strategy" ("block_number") `) - await db.query(`CREATE TABLE "ousd_convex_lusd_plus3_crv" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "dai" numeric NOT NULL, "usdt" numeric NOT NULL, "usdc" numeric NOT NULL, CONSTRAINT "PK_47290aa5dfa3cc5595f468e2f39" PRIMARY KEY ("id"))`) - await db.query(`CREATE INDEX "IDX_0783af95efb35fb3f13cde1656" ON "ousd_convex_lusd_plus3_crv" ("timestamp") `) - await db.query(`CREATE INDEX "IDX_74ae01fb596a4f2733087ba454" ON "ousd_convex_lusd_plus3_crv" ("block_number") `) - await db.query(`ALTER TABLE "oeth_history" ADD CONSTRAINT "FK_94e47c4c49128c78f60b185b46b" FOREIGN KEY ("address_id") REFERENCES "oeth_address"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`) - await db.query(`ALTER TABLE "oeth_rebase" ADD CONSTRAINT "FK_3331819842173de7c27c046547a" FOREIGN KEY ("apy_id") REFERENCES "oethapy"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`) - await db.query(`ALTER TABLE "oeth_rebase_option" ADD CONSTRAINT "FK_034428879698039839b4ba6ffe8" FOREIGN KEY ("address_id") REFERENCES "oeth_address"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`) - await db.query(`ALTER TABLE "oeth_strategy_holding_daily_stat" ADD CONSTRAINT "FK_4e867f220975e615e6077d860c1" FOREIGN KEY ("strategy_daily_stat_id_id") REFERENCES "oeth_strategy_daily_stat"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`) - await db.query(`ALTER TABLE "oeth_strategy_daily_stat" ADD CONSTRAINT "FK_6c7096c96a000d8471256ca8fc3" FOREIGN KEY ("daily_stat_id_id") REFERENCES "oeth_daily_stat"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`) - await db.query(`ALTER TABLE "oeth_collateral_daily_stat" ADD CONSTRAINT "FK_a90045de50406be7bd56efd3ea4" FOREIGN KEY ("daily_stat_id_id") REFERENCES "oeth_daily_stat"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`) - await db.query(`ALTER TABLE "ousd_history" ADD CONSTRAINT "FK_70291ea600c0c4d67d9bfe6a6bf" FOREIGN KEY ("address_id") REFERENCES "ousd_address"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`) - await db.query(`ALTER TABLE "ousd_rebase" ADD CONSTRAINT "FK_427468c97f9838b804efd6c8e55" FOREIGN KEY ("apy_id") REFERENCES "ousdapy"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`) - await db.query(`ALTER TABLE "ousd_rebase_option" ADD CONSTRAINT "FK_b04173f9349ddd991a3b60e914a" FOREIGN KEY ("address_id") REFERENCES "ousd_address"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`) - } - - async down(db) { - await db.query(`DROP TABLE "exchange_rate"`) - await db.query(`DROP INDEX "public"."IDX_9e23a3f1bf3634820c873a0fe8"`) - await db.query(`DROP INDEX "public"."IDX_c61a93768eed9e58ce399bbe01"`) - await db.query(`DROP TABLE "balance"`) - await db.query(`DROP INDEX "public"."IDX_a956b410c329b8eca7898c3c51"`) - await db.query(`DROP INDEX "public"."IDX_6b451b59c9f6a6fdd685f530b2"`) - await db.query(`DROP TABLE "strategy_balance"`) - await db.query(`DROP INDEX "public"."IDX_0113bf0b63183bea0d22cd0d08"`) - await db.query(`DROP INDEX "public"."IDX_a88065dcd92011698bbe7df7b1"`) - await db.query(`DROP TABLE "strategy_yield"`) - await db.query(`DROP INDEX "public"."IDX_5108f2a2563d5665892d0c06b0"`) - await db.query(`DROP INDEX "public"."IDX_41c3567c9d43c598e07a0029c5"`) - await db.query(`DROP TABLE "strategy_daily_yield"`) - await db.query(`DROP INDEX "public"."IDX_0ba1974747f1906e0c102cd2cd"`) - await db.query(`DROP INDEX "public"."IDX_df364fb6e82d1feeed2a5dfffa"`) - await db.query(`DROP TABLE "curve_pool_balance"`) - await db.query(`DROP INDEX "public"."IDX_ffb0d0f86f03faacef7cb3e092"`) - await db.query(`DROP INDEX "public"."IDX_db5522c865eb8ed76fa7aeb4a8"`) - await db.query(`DROP TABLE "oeth"`) - await db.query(`DROP INDEX "public"."IDX_5b81a67229bac2d68e0dc92cc4"`) - await db.query(`DROP INDEX "public"."IDX_408e5f79f83093aa5cf2b0ea32"`) - await db.query(`DROP TABLE "oeth_history"`) - await db.query(`DROP INDEX "public"."IDX_94e47c4c49128c78f60b185b46"`) - await db.query(`DROP INDEX "public"."IDX_96956b1c8d29eb7066a97d5ea7"`) - await db.query(`DROP INDEX "public"."IDX_b14170bdb7fbc0775bf55df15d"`) - await db.query(`DROP TABLE "oeth_address"`) - await db.query(`DROP TABLE "oethapy"`) - await db.query(`DROP INDEX "public"."IDX_b1a448045d1ed9d655b679a371"`) - await db.query(`DROP INDEX "public"."IDX_6b8a7a706a0701e659a7d81508"`) - await db.query(`DROP INDEX "public"."IDX_c0c03168bb0139e3cffda4f00e"`) - await db.query(`DROP TABLE "oeth_rebase"`) - await db.query(`DROP INDEX "public"."IDX_fbb7b3f2fff9896eb683b86de7"`) - await db.query(`DROP INDEX "public"."IDX_d3255d02d9407bba89380d01fa"`) - await db.query(`DROP INDEX "public"."IDX_8b6bb0243472af88612fe6a01f"`) - await db.query(`DROP INDEX "public"."IDX_3331819842173de7c27c046547"`) - await db.query(`DROP TABLE "oeth_rebase_option"`) - await db.query(`DROP INDEX "public"."IDX_1fc6bbd88037bfbf4361776909"`) - await db.query(`DROP INDEX "public"."IDX_cbb7ceb49ef7c45432d0171296"`) - await db.query(`DROP INDEX "public"."IDX_355826dadaacc5ae2d63c82f28"`) - await db.query(`DROP INDEX "public"."IDX_034428879698039839b4ba6ffe"`) - await db.query(`DROP TABLE "oeth_vault"`) - await db.query(`DROP INDEX "public"."IDX_d6298a294864b4eaf793cf35a4"`) - await db.query(`DROP INDEX "public"."IDX_e20cb507a673817b2c68720415"`) - await db.query(`DROP TABLE "oeth_curve_lp"`) - await db.query(`DROP INDEX "public"."IDX_d9bbd20e888fa1b4b2c5d2f039"`) - await db.query(`DROP INDEX "public"."IDX_7617d593c36dce1b1565a8d74a"`) - await db.query(`DROP TABLE "oeth_frax_staking"`) - await db.query(`DROP INDEX "public"."IDX_ce6c2c65e90967dfeaac97025b"`) - await db.query(`DROP INDEX "public"."IDX_1a7f7d650390e2f9c212651e05"`) - await db.query(`DROP TABLE "oeth_morpho_aave"`) - await db.query(`DROP INDEX "public"."IDX_25e239b985844f1d33fac79981"`) - await db.query(`DROP INDEX "public"."IDX_a6662224e95eb6921bb14cb5f9"`) - await db.query(`DROP TABLE "oeth_dripper"`) - await db.query(`DROP INDEX "public"."IDX_16ac742ceeb05d28e530da9649"`) - await db.query(`DROP INDEX "public"."IDX_d356832c14603916a492608e7b"`) - await db.query(`DROP TABLE "oeth_balancer_meta_pool_strategy"`) - await db.query(`DROP INDEX "public"."IDX_5e7ef383756fa18cb602f50089"`) - await db.query(`DROP INDEX "public"."IDX_11d344b3e0e03cdb6697dd61f7"`) - await db.query(`DROP TABLE "oeth_strategy_holding_daily_stat"`) - await db.query(`DROP INDEX "public"."IDX_4e867f220975e615e6077d860c"`) - await db.query(`DROP TABLE "oeth_strategy_daily_stat"`) - await db.query(`DROP INDEX "public"."IDX_6c7096c96a000d8471256ca8fc"`) - await db.query(`DROP TABLE "oeth_collateral_daily_stat"`) - await db.query(`DROP INDEX "public"."IDX_a90045de50406be7bd56efd3ea"`) - await db.query(`DROP TABLE "oeth_daily_stat"`) - await db.query(`DROP INDEX "public"."IDX_98d9001013aa37425ca47b7126"`) - await db.query(`DROP INDEX "public"."IDX_c3e66051c7df4efd6a8fa8f9c1"`) - await db.query(`DROP TABLE "oeth_reward_token_collected"`) - await db.query(`DROP INDEX "public"."IDX_81a9fa43ae4a6ae63e4103127b"`) - await db.query(`DROP INDEX "public"."IDX_d36c78b9c3e9d737f067638bc4"`) - await db.query(`DROP TABLE "ogv"`) - await db.query(`DROP INDEX "public"."IDX_2418a8b8b92b2f5977be761cf9"`) - await db.query(`DROP INDEX "public"."IDX_b8f20bcf48e4aa77e0f48d77db"`) - await db.query(`DROP TABLE "staked_ogv"`) - await db.query(`DROP INDEX "public"."IDX_533195c60cfaef9e118789dee9"`) - await db.query(`DROP INDEX "public"."IDX_d601233411a33212b9d616aab0"`) - await db.query(`DROP TABLE "ogv_governance"`) - await db.query(`DROP INDEX "public"."IDX_a0329e7109d5959b9aa3d9d374"`) - await db.query(`DROP INDEX "public"."IDX_63cd1ca46771965c68f6b85898"`) - await db.query(`DROP TABLE "ousd"`) - await db.query(`DROP INDEX "public"."IDX_c8d1e285213b445b088805ac7c"`) - await db.query(`DROP INDEX "public"."IDX_806949dd853b7e8acab5d03b81"`) - await db.query(`DROP TABLE "ousd_history"`) - await db.query(`DROP INDEX "public"."IDX_70291ea600c0c4d67d9bfe6a6b"`) - await db.query(`DROP INDEX "public"."IDX_4d00d283e1ce3209dc43a0313c"`) - await db.query(`DROP INDEX "public"."IDX_0c25caa59aa053a688a723d160"`) - await db.query(`DROP TABLE "ousd_address"`) - await db.query(`DROP TABLE "ousdapy"`) - await db.query(`DROP INDEX "public"."IDX_c514963f42908ce84d65a84a77"`) - await db.query(`DROP INDEX "public"."IDX_4f606414b3b5ce1a366bd0fbf6"`) - await db.query(`DROP INDEX "public"."IDX_0e84a81a109b66fe6f01f77c74"`) - await db.query(`DROP TABLE "ousd_rebase"`) - await db.query(`DROP INDEX "public"."IDX_f8eb4a16ce58a146b3227ee21a"`) - await db.query(`DROP INDEX "public"."IDX_3fb03b1a410e64c7367226d0b6"`) - await db.query(`DROP INDEX "public"."IDX_1a76c478199672aaeec340f619"`) - await db.query(`DROP INDEX "public"."IDX_427468c97f9838b804efd6c8e5"`) - await db.query(`DROP TABLE "ousd_rebase_option"`) - await db.query(`DROP INDEX "public"."IDX_64bd23947dc4c67e3b6a3f9352"`) - await db.query(`DROP INDEX "public"."IDX_9b774e46b8b1cf7f828133809a"`) - await db.query(`DROP INDEX "public"."IDX_4e95bf069de04533d83a9a97fd"`) - await db.query(`DROP INDEX "public"."IDX_b04173f9349ddd991a3b60e914"`) - await db.query(`DROP TABLE "ousd_vault"`) - await db.query(`DROP INDEX "public"."IDX_6860186ea2f56e2c7d54c22107"`) - await db.query(`DROP INDEX "public"."IDX_0d0a7113a505cf7f7adea9ca81"`) - await db.query(`DROP TABLE "ousd_morpho_aave"`) - await db.query(`DROP INDEX "public"."IDX_78e0701c2e9a28242db37bd8f8"`) - await db.query(`DROP INDEX "public"."IDX_46ccf673b376d654052fbd53e6"`) - await db.query(`DROP TABLE "ousd_morpho_compound"`) - await db.query(`DROP INDEX "public"."IDX_9e7bd0d8ae23b877d5979ef80c"`) - await db.query(`DROP INDEX "public"."IDX_0bb3a0ad84071f1d80f6d4e90f"`) - await db.query(`DROP TABLE "maker_dsr_strategy"`) - await db.query(`DROP INDEX "public"."IDX_a35308a3c5dbaab2d321eb1525"`) - await db.query(`DROP INDEX "public"."IDX_844b219d8faf9b1d24ab2dba9a"`) - await db.query(`DROP TABLE "ousd_flux_strategy"`) - await db.query(`DROP INDEX "public"."IDX_5b165b5d30b13e363d33a66e14"`) - await db.query(`DROP INDEX "public"."IDX_80f3392968fde7b99cccb805ac"`) - await db.query(`DROP TABLE "ousd_compound_strategy"`) - await db.query(`DROP INDEX "public"."IDX_6920b1db5dc577295ac4d1379d"`) - await db.query(`DROP INDEX "public"."IDX_89c6d7d3104bd36dc88a37add4"`) - await db.query(`DROP TABLE "ousd_convex_strategy"`) - await db.query(`DROP INDEX "public"."IDX_2deac473cd0b2dd7082e7da148"`) - await db.query(`DROP INDEX "public"."IDX_157bf74171817dc5c60ee37036"`) - await db.query(`DROP TABLE "ousd_aave_strategy"`) - await db.query(`DROP INDEX "public"."IDX_ca34b5a0a33bc9abdd8213c2fa"`) - await db.query(`DROP INDEX "public"."IDX_dacd7c98223d7bc8be074d71e4"`) - await db.query(`DROP TABLE "ousd_meta_strategy"`) - await db.query(`DROP INDEX "public"."IDX_7e998dcf775263bc5df76ef987"`) - await db.query(`DROP INDEX "public"."IDX_55ce185680512d6a5b9fb0af89"`) - await db.query(`DROP TABLE "ousd_convex_lusd_plus3_crv"`) - await db.query(`DROP INDEX "public"."IDX_0783af95efb35fb3f13cde1656"`) - await db.query(`DROP INDEX "public"."IDX_74ae01fb596a4f2733087ba454"`) - await db.query(`ALTER TABLE "oeth_history" DROP CONSTRAINT "FK_94e47c4c49128c78f60b185b46b"`) - await db.query(`ALTER TABLE "oeth_rebase" DROP CONSTRAINT "FK_3331819842173de7c27c046547a"`) - await db.query(`ALTER TABLE "oeth_rebase_option" DROP CONSTRAINT "FK_034428879698039839b4ba6ffe8"`) - await db.query(`ALTER TABLE "oeth_strategy_holding_daily_stat" DROP CONSTRAINT "FK_4e867f220975e615e6077d860c1"`) - await db.query(`ALTER TABLE "oeth_strategy_daily_stat" DROP CONSTRAINT "FK_6c7096c96a000d8471256ca8fc3"`) - await db.query(`ALTER TABLE "oeth_collateral_daily_stat" DROP CONSTRAINT "FK_a90045de50406be7bd56efd3ea4"`) - await db.query(`ALTER TABLE "ousd_history" DROP CONSTRAINT "FK_70291ea600c0c4d67d9bfe6a6bf"`) - await db.query(`ALTER TABLE "ousd_rebase" DROP CONSTRAINT "FK_427468c97f9838b804efd6c8e55"`) - await db.query(`ALTER TABLE "ousd_rebase_option" DROP CONSTRAINT "FK_b04173f9349ddd991a3b60e914a"`) - } -} diff --git a/squid.yaml b/squid.yaml index f54fe1a8..64eb4258 100644 --- a/squid.yaml +++ b/squid.yaml @@ -14,10 +14,10 @@ deploy: cmd: [ "node", "lib/main-oeth" ] env: RPC_ENV: RPC_ENDPOINT_999 - # - name: ousd-processor - # cmd: [ "node", "lib/main-ousd" ] - # env: - # RPC_ENV: RPC_ENDPOINT_999 + - name: ousd-processor + cmd: [ "node", "lib/main-ousd" ] + env: + RPC_ENV: RPC_ENDPOINT_999 - name: ogv-processor cmd: [ "node", "lib/main-ogv" ] env: diff --git a/src/ousd/processors/ousd/ousd.ts b/src/ousd/processors/ousd/ousd.ts index e3fa2cfa..67912d7c 100644 --- a/src/ousd/processors/ousd/ousd.ts +++ b/src/ousd/processors/ousd/ousd.ts @@ -13,8 +13,8 @@ import { import { OUSD_ADDRESS, OUSD_VAULT_ADDRESS } from '../../../utils/addresses' // export const from = 10884563 // https://etherscan.io/tx/0x9141921f5ebf072e58c00fe56332b6bee0c02f0ae4f54c42999b8a3a88662681 -// export const from = 11585978 // OUSDReset - Has issues with archive queries. :( -export const from = 13533937 // https://etherscan.io/tx/0xc9b6fc6a4fad18dad197ff7d0636f74bf066671d75656849a1c45122e00d54cf +export const from = 11585978 // OUSDReset - Has issues with archive queries. :( +// export const from = 13533937 // https://etherscan.io/tx/0xc9b6fc6a4fad18dad197ff7d0636f74bf066671d75656849a1c45122e00d54cf export const setup = createOTokenSetup({ address: OUSD_ADDRESS, From faa2229ab106e62299e6da0a81bc13a8312734dc Mon Sep 17 00:00:00 2001 From: Chris Jacobs Date: Wed, 8 Nov 2023 16:55:53 -0800 Subject: [PATCH 15/34] work on aave, ousd convex 3crv, thinking about better ways to handle log filtering --- abi/aave-lending-pool.json | 1127 +++++++++++++++++ abi/aave-token.json | 878 +++++++++++++ db/migrations/1699399319368-Data.js | 319 +++++ src/abi/aave-lending-pool.abi.ts | 1023 +++++++++++++++ src/abi/aave-lending-pool.ts | 195 +++ src/abi/aave-token.abi.ts | 825 ++++++++++++ src/abi/aave-token.ts | 207 +++ src/main-ousd.ts | 6 +- src/oeth/processors/strategies/strategies.ts | 18 +- src/ousd/processors/ousd/ousd.ts | 2 +- .../processors/strategies/aave-strategy.ts | 39 + src/ousd/processors/strategies/const.ts | 12 + src/ousd/processors/strategies/index.ts | 1 + src/ousd/processors/strategies/strategies.ts | 131 ++ .../strategy/strategy-curve-amo.ts | 2 +- .../strategy/strategy-daily-earnings.ts | 9 +- .../strategy/strategy-earnings.ts | 106 +- .../strategy/strategy-generic.ts | 10 +- .../processor-templates/strategy/strategy.ts | 15 +- src/utils/logFilter.ts | 52 + src/utils/utils.ts | 24 +- 21 files changed, 4946 insertions(+), 55 deletions(-) create mode 100644 abi/aave-lending-pool.json create mode 100644 abi/aave-token.json create mode 100644 db/migrations/1699399319368-Data.js create mode 100644 src/abi/aave-lending-pool.abi.ts create mode 100644 src/abi/aave-lending-pool.ts create mode 100644 src/abi/aave-token.abi.ts create mode 100644 src/abi/aave-token.ts create mode 100644 src/ousd/processors/strategies/aave-strategy.ts create mode 100644 src/ousd/processors/strategies/const.ts create mode 100644 src/ousd/processors/strategies/index.ts create mode 100644 src/ousd/processors/strategies/strategies.ts create mode 100644 src/utils/logFilter.ts diff --git a/abi/aave-lending-pool.json b/abi/aave-lending-pool.json new file mode 100644 index 00000000..d102d53f --- /dev/null +++ b/abi/aave-lending-pool.json @@ -0,0 +1,1127 @@ +[ + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "reserve", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "onBehalfOf", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "borrowRateMode", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "borrowRate", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "uint16", + "name": "referral", + "type": "uint16" + } + ], + "name": "Borrow", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "reserve", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "onBehalfOf", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "uint16", + "name": "referral", + "type": "uint16" + } + ], + "name": "Deposit", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "target", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "initiator", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "asset", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "premium", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint16", + "name": "referralCode", + "type": "uint16" + } + ], + "name": "FlashLoan", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "collateralAsset", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "debtAsset", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "debtToCover", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "liquidatedCollateralAmount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "address", + "name": "liquidator", + "type": "address" + }, + { + "indexed": false, + "internalType": "bool", + "name": "receiveAToken", + "type": "bool" + } + ], + "name": "LiquidationCall", + "type": "event" + }, + { + "anonymous": false, + "inputs": [], + "name": "Paused", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "reserve", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "user", + "type": "address" + } + ], + "name": "RebalanceStableBorrowRate", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "reserve", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "repayer", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "Repay", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "reserve", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "liquidityRate", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "stableBorrowRate", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "variableBorrowRate", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "liquidityIndex", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "variableBorrowIndex", + "type": "uint256" + } + ], + "name": "ReserveDataUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "reserve", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "user", + "type": "address" + } + ], + "name": "ReserveUsedAsCollateralDisabled", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "reserve", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "user", + "type": "address" + } + ], + "name": "ReserveUsedAsCollateralEnabled", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "reserve", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "rateMode", + "type": "uint256" + } + ], + "name": "Swap", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "tokenRescued", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "receiver", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amountRescued", + "type": "uint256" + } + ], + "name": "TokensRescued", + "type": "event" + }, + { + "anonymous": false, + "inputs": [], + "name": "Unpaused", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "reserve", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "Withdraw", + "type": "event" + }, + { + "inputs": [], + "name": "FLASHLOAN_PREMIUM_TOTAL", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "LENDINGPOOL_REVISION", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "MAX_NUMBER_RESERVES", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "MAX_STABLE_RATE_BORROW_SIZE_PERCENT", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "asset", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "interestRateMode", + "type": "uint256" + }, + { + "internalType": "uint16", + "name": "referralCode", + "type": "uint16" + }, + { + "internalType": "address", + "name": "onBehalfOf", + "type": "address" + } + ], + "name": "borrow", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "asset", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "address", + "name": "onBehalfOf", + "type": "address" + }, + { + "internalType": "uint16", + "name": "referralCode", + "type": "uint16" + } + ], + "name": "deposit", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "asset", + "type": "address" + }, + { + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "balanceFromBefore", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "balanceToBefore", + "type": "uint256" + } + ], + "name": "finalizeTransfer", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "receiverAddress", + "type": "address" + }, + { + "internalType": "address[]", + "name": "assets", + "type": "address[]" + }, + { + "internalType": "uint256[]", + "name": "amounts", + "type": "uint256[]" + }, + { + "internalType": "uint256[]", + "name": "modes", + "type": "uint256[]" + }, + { + "internalType": "address", + "name": "onBehalfOf", + "type": "address" + }, + { + "internalType": "bytes", + "name": "params", + "type": "bytes" + }, + { + "internalType": "uint16", + "name": "referralCode", + "type": "uint16" + } + ], + "name": "flashLoan", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "getAddressesProvider", + "outputs": [ + { + "internalType": "contract ILendingPoolAddressesProvider", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "asset", + "type": "address" + } + ], + "name": "getConfiguration", + "outputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "data", + "type": "uint256" + } + ], + "internalType": "struct DataTypes.ReserveConfigurationMap", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "asset", + "type": "address" + } + ], + "name": "getReserveData", + "outputs": [ + { + "components": [ + { + "components": [ + { + "internalType": "uint256", + "name": "data", + "type": "uint256" + } + ], + "internalType": "struct DataTypes.ReserveConfigurationMap", + "name": "configuration", + "type": "tuple" + }, + { + "internalType": "uint128", + "name": "liquidityIndex", + "type": "uint128" + }, + { + "internalType": "uint128", + "name": "variableBorrowIndex", + "type": "uint128" + }, + { + "internalType": "uint128", + "name": "currentLiquidityRate", + "type": "uint128" + }, + { + "internalType": "uint128", + "name": "currentVariableBorrowRate", + "type": "uint128" + }, + { + "internalType": "uint128", + "name": "currentStableBorrowRate", + "type": "uint128" + }, + { + "internalType": "uint40", + "name": "lastUpdateTimestamp", + "type": "uint40" + }, + { + "internalType": "address", + "name": "aTokenAddress", + "type": "address" + }, + { + "internalType": "address", + "name": "stableDebtTokenAddress", + "type": "address" + }, + { + "internalType": "address", + "name": "variableDebtTokenAddress", + "type": "address" + }, + { + "internalType": "address", + "name": "interestRateStrategyAddress", + "type": "address" + }, + { + "internalType": "uint8", + "name": "id", + "type": "uint8" + } + ], + "internalType": "struct DataTypes.ReserveData", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "asset", + "type": "address" + } + ], + "name": "getReserveNormalizedIncome", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "asset", + "type": "address" + } + ], + "name": "getReserveNormalizedVariableDebt", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getReservesList", + "outputs": [ + { + "internalType": "address[]", + "name": "", + "type": "address[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "user", + "type": "address" + } + ], + "name": "getUserAccountData", + "outputs": [ + { + "internalType": "uint256", + "name": "totalCollateralETH", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "totalDebtETH", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "availableBorrowsETH", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "currentLiquidationThreshold", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "ltv", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "healthFactor", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "user", + "type": "address" + } + ], + "name": "getUserConfiguration", + "outputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "data", + "type": "uint256" + } + ], + "internalType": "struct DataTypes.UserConfigurationMap", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "asset", + "type": "address" + }, + { + "internalType": "address", + "name": "aTokenAddress", + "type": "address" + }, + { + "internalType": "address", + "name": "stableDebtAddress", + "type": "address" + }, + { + "internalType": "address", + "name": "variableDebtAddress", + "type": "address" + }, + { + "internalType": "address", + "name": "interestRateStrategyAddress", + "type": "address" + } + ], + "name": "initReserve", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract ILendingPoolAddressesProvider", + "name": "provider", + "type": "address" + } + ], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "collateralAsset", + "type": "address" + }, + { + "internalType": "address", + "name": "debtAsset", + "type": "address" + }, + { + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "internalType": "uint256", + "name": "debtToCover", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "receiveAToken", + "type": "bool" + } + ], + "name": "liquidationCall", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "paused", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "asset", + "type": "address" + }, + { + "internalType": "address", + "name": "user", + "type": "address" + } + ], + "name": "rebalanceStableBorrowRate", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "asset", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "rateMode", + "type": "uint256" + }, + { + "internalType": "address", + "name": "onBehalfOf", + "type": "address" + } + ], + "name": "repay", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "rescueTokens", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "asset", + "type": "address" + }, + { + "internalType": "uint256", + "name": "configuration", + "type": "uint256" + } + ], + "name": "setConfiguration", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bool", + "name": "val", + "type": "bool" + } + ], + "name": "setPause", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "asset", + "type": "address" + }, + { + "internalType": "address", + "name": "rateStrategyAddress", + "type": "address" + } + ], + "name": "setReserveInterestRateStrategyAddress", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "asset", + "type": "address" + }, + { + "internalType": "bool", + "name": "useAsCollateral", + "type": "bool" + } + ], + "name": "setUserUseReserveAsCollateral", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "asset", + "type": "address" + }, + { + "internalType": "uint256", + "name": "rateMode", + "type": "uint256" + } + ], + "name": "swapBorrowRateMode", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "asset", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + } + ], + "name": "withdraw", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + } +] \ No newline at end of file diff --git a/abi/aave-token.json b/abi/aave-token.json new file mode 100644 index 00000000..27f7a5ff --- /dev/null +++ b/abi/aave-token.json @@ -0,0 +1,878 @@ +[ + { + "inputs": [ + { + "internalType": "contract ILendingPool", + "name": "pool", + "type": "address" + }, + { + "internalType": "address", + "name": "underlyingAssetAddress", + "type": "address" + }, + { + "internalType": "address", + "name": "reserveTreasuryAddress", + "type": "address" + }, + { + "internalType": "string", + "name": "tokenName", + "type": "string" + }, + { + "internalType": "string", + "name": "tokenSymbol", + "type": "string" + }, + { + "internalType": "address", + "name": "incentivesController", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "Approval", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "value", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "index", + "type": "uint256" + } + ], + "name": "BalanceTransfer", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "target", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "value", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "index", + "type": "uint256" + } + ], + "name": "Burn", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "underlyingAsset", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "pool", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "treasury", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "incentivesController", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint8", + "name": "aTokenDecimals", + "type": "uint8" + }, + { + "indexed": false, + "internalType": "string", + "name": "aTokenName", + "type": "string" + }, + { + "indexed": false, + "internalType": "string", + "name": "aTokenSymbol", + "type": "string" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "params", + "type": "bytes" + } + ], + "name": "Initialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "value", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "index", + "type": "uint256" + } + ], + "name": "Mint", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "tokenRescued", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "receiver", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amountRescued", + "type": "uint256" + } + ], + "name": "TokensRescued", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "Transfer", + "type": "event" + }, + { + "inputs": [], + "name": "ATOKEN_REVISION", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "DOMAIN_SEPARATOR", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "EIP712_REVISION", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "PERMIT_TYPEHASH", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "POOL", + "outputs": [ + { + "internalType": "contract ILendingPool", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "RESERVE_TREASURY_ADDRESS", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "UINT_MAX_VALUE", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "UNDERLYING_ASSET_ADDRESS", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "_nonces", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "address", + "name": "spender", + "type": "address" + } + ], + "name": "allowance", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "approve", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "user", + "type": "address" + } + ], + "name": "balanceOf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "internalType": "address", + "name": "receiverOfUnderlying", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "index", + "type": "uint256" + } + ], + "name": "burn", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "decimals", + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "subtractedValue", + "type": "uint256" + } + ], + "name": "decreaseAllowance", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "getIncentivesController", + "outputs": [ + { + "internalType": "contract IAaveIncentivesController", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "user", + "type": "address" + } + ], + "name": "getScaledUserBalanceAndSupply", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "addedValue", + "type": "uint256" + } + ], + "name": "increaseAllowance", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint8", + "name": "underlyingAssetDecimals", + "type": "uint8" + }, + { + "internalType": "string", + "name": "tokenName", + "type": "string" + }, + { + "internalType": "string", + "name": "tokenSymbol", + "type": "string" + } + ], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "index", + "type": "uint256" + } + ], + "name": "mint", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "index", + "type": "uint256" + } + ], + "name": "mintToTreasury", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "name", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "value", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "deadline", + "type": "uint256" + }, + { + "internalType": "uint8", + "name": "v", + "type": "uint8" + }, + { + "internalType": "bytes32", + "name": "r", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "s", + "type": "bytes32" + } + ], + "name": "permit", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "rescueTokens", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "user", + "type": "address" + } + ], + "name": "scaledBalanceOf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "scaledTotalSupply", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "symbol", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "totalSupply", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "recipient", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "transfer", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "internalType": "address", + "name": "recipient", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "transferFrom", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "transferOnLiquidation", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "target", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "transferUnderlyingTo", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + } +] \ No newline at end of file diff --git a/db/migrations/1699399319368-Data.js b/db/migrations/1699399319368-Data.js new file mode 100644 index 00000000..3e00e8d9 --- /dev/null +++ b/db/migrations/1699399319368-Data.js @@ -0,0 +1,319 @@ +module.exports = class Data1699399319368 { + name = 'Data1699399319368' + + async up(db) { + await db.query(`CREATE TABLE "exchange_rate" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "pair" text NOT NULL, "base" text NOT NULL, "quote" text NOT NULL, "rate" numeric NOT NULL, CONSTRAINT "PK_5c5d27d2b900ef6cdeef0398472" PRIMARY KEY ("id"))`) + await db.query(`CREATE INDEX "IDX_9e23a3f1bf3634820c873a0fe8" ON "exchange_rate" ("timestamp") `) + await db.query(`CREATE INDEX "IDX_c61a93768eed9e58ce399bbe01" ON "exchange_rate" ("block_number") `) + await db.query(`CREATE TABLE "balance" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "token" text NOT NULL, "address" text NOT NULL, "balance" numeric NOT NULL, CONSTRAINT "PK_079dddd31a81672e8143a649ca0" PRIMARY KEY ("id"))`) + await db.query(`CREATE INDEX "IDX_a956b410c329b8eca7898c3c51" ON "balance" ("timestamp") `) + await db.query(`CREATE INDEX "IDX_6b451b59c9f6a6fdd685f530b2" ON "balance" ("block_number") `) + await db.query(`CREATE TABLE "strategy_balance" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "strategy" text NOT NULL, "asset" text NOT NULL, "balance" numeric NOT NULL, CONSTRAINT "PK_ca6f93229d1392e9546d01dae4f" PRIMARY KEY ("id"))`) + await db.query(`CREATE INDEX "IDX_0113bf0b63183bea0d22cd0d08" ON "strategy_balance" ("timestamp") `) + await db.query(`CREATE INDEX "IDX_a88065dcd92011698bbe7df7b1" ON "strategy_balance" ("block_number") `) + await db.query(`CREATE TABLE "strategy_yield" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "strategy" text NOT NULL, "asset" text NOT NULL, "balance" numeric NOT NULL, "balance_weight" numeric NOT NULL, "earnings" numeric NOT NULL, "earnings_change" numeric NOT NULL, CONSTRAINT "PK_e87c46575e870fe2202190c2728" PRIMARY KEY ("id"))`) + await db.query(`CREATE INDEX "IDX_5108f2a2563d5665892d0c06b0" ON "strategy_yield" ("timestamp") `) + await db.query(`CREATE INDEX "IDX_41c3567c9d43c598e07a0029c5" ON "strategy_yield" ("block_number") `) + await db.query(`CREATE TABLE "strategy_daily_yield" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "strategy" text NOT NULL, "asset" text NOT NULL, "balance" numeric NOT NULL, "earnings" numeric NOT NULL, "earnings_change" numeric NOT NULL, "apr" numeric NOT NULL, "apy" numeric NOT NULL, CONSTRAINT "PK_b0dd2686bc95bb032ff532b3a0e" PRIMARY KEY ("id"))`) + await db.query(`CREATE INDEX "IDX_0ba1974747f1906e0c102cd2cd" ON "strategy_daily_yield" ("timestamp") `) + await db.query(`CREATE INDEX "IDX_df364fb6e82d1feeed2a5dfffa" ON "strategy_daily_yield" ("block_number") `) + await db.query(`CREATE TABLE "curve_pool_balance" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "address" text NOT NULL, "balance0" numeric NOT NULL, "balance1" numeric NOT NULL, "balance2" numeric NOT NULL, CONSTRAINT "PK_40412750bb910ca560aa084dd88" PRIMARY KEY ("id"))`) + await db.query(`CREATE INDEX "IDX_ffb0d0f86f03faacef7cb3e092" ON "curve_pool_balance" ("timestamp") `) + await db.query(`CREATE INDEX "IDX_db5522c865eb8ed76fa7aeb4a8" ON "curve_pool_balance" ("block_number") `) + await db.query(`CREATE TABLE "oeth" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "total_supply" numeric NOT NULL, "rebasing_supply" numeric NOT NULL, "non_rebasing_supply" numeric NOT NULL, CONSTRAINT "PK_de1d885501070dbd1ab6f8577ba" PRIMARY KEY ("id"))`) + await db.query(`CREATE INDEX "IDX_5b81a67229bac2d68e0dc92cc4" ON "oeth" ("timestamp") `) + await db.query(`CREATE INDEX "IDX_408e5f79f83093aa5cf2b0ea32" ON "oeth" ("block_number") `) + await db.query(`CREATE TABLE "oeth_history" ("id" character varying NOT NULL, "value" numeric NOT NULL, "balance" numeric NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "tx_hash" text NOT NULL, "type" character varying(8) NOT NULL, "address_id" character varying, CONSTRAINT "PK_2c7e7571cd9ea02b07a27a303f3" PRIMARY KEY ("id"))`) + await db.query(`CREATE INDEX "IDX_94e47c4c49128c78f60b185b46" ON "oeth_history" ("address_id") `) + await db.query(`CREATE INDEX "IDX_96956b1c8d29eb7066a97d5ea7" ON "oeth_history" ("block_number") `) + await db.query(`CREATE INDEX "IDX_b14170bdb7fbc0775bf55df15d" ON "oeth_history" ("tx_hash") `) + await db.query(`CREATE TABLE "oeth_address" ("id" character varying NOT NULL, "is_contract" boolean NOT NULL, "rebasing_option" character varying(6) NOT NULL, "balance" numeric NOT NULL, "earned" numeric NOT NULL, "credits" numeric NOT NULL, "last_updated" TIMESTAMP WITH TIME ZONE NOT NULL, CONSTRAINT "PK_92a966afe47d584af73ce77a1cd" PRIMARY KEY ("id"))`) + await db.query(`CREATE TABLE "oethapy" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "tx_hash" text NOT NULL, "apr" numeric NOT NULL, "apy" numeric NOT NULL, "apy7_day_avg" numeric NOT NULL, "apy14_day_avg" numeric NOT NULL, "apy30_day_avg" numeric NOT NULL, "rebasing_credits_per_token" numeric NOT NULL, CONSTRAINT "PK_8dbb4d04591848361200f18f62a" PRIMARY KEY ("id"))`) + await db.query(`CREATE INDEX "IDX_b1a448045d1ed9d655b679a371" ON "oethapy" ("timestamp") `) + await db.query(`CREATE INDEX "IDX_6b8a7a706a0701e659a7d81508" ON "oethapy" ("block_number") `) + await db.query(`CREATE INDEX "IDX_c0c03168bb0139e3cffda4f00e" ON "oethapy" ("tx_hash") `) + await db.query(`CREATE TABLE "oeth_rebase" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "tx_hash" text NOT NULL, "total_supply" numeric NOT NULL, "rebasing_credits" numeric NOT NULL, "rebasing_credits_per_token" numeric NOT NULL, "fee" numeric NOT NULL, "yield" numeric NOT NULL, "apy_id" character varying, CONSTRAINT "PK_5f8f4dd071caf685b4ac2d54de3" PRIMARY KEY ("id"))`) + await db.query(`CREATE INDEX "IDX_fbb7b3f2fff9896eb683b86de7" ON "oeth_rebase" ("timestamp") `) + await db.query(`CREATE INDEX "IDX_d3255d02d9407bba89380d01fa" ON "oeth_rebase" ("block_number") `) + await db.query(`CREATE INDEX "IDX_8b6bb0243472af88612fe6a01f" ON "oeth_rebase" ("tx_hash") `) + await db.query(`CREATE INDEX "IDX_3331819842173de7c27c046547" ON "oeth_rebase" ("apy_id") `) + await db.query(`CREATE TABLE "oeth_rebase_option" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "tx_hash" text NOT NULL, "status" character varying(6) NOT NULL, "address_id" character varying, CONSTRAINT "PK_32971725d5523200b4b3b7c07e5" PRIMARY KEY ("id"))`) + await db.query(`CREATE INDEX "IDX_1fc6bbd88037bfbf4361776909" ON "oeth_rebase_option" ("timestamp") `) + await db.query(`CREATE INDEX "IDX_cbb7ceb49ef7c45432d0171296" ON "oeth_rebase_option" ("block_number") `) + await db.query(`CREATE INDEX "IDX_355826dadaacc5ae2d63c82f28" ON "oeth_rebase_option" ("tx_hash") `) + await db.query(`CREATE INDEX "IDX_034428879698039839b4ba6ffe" ON "oeth_rebase_option" ("address_id") `) + await db.query(`CREATE TABLE "oeth_vault" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "weth" numeric NOT NULL, "st_eth" numeric NOT NULL, "r_eth" numeric NOT NULL, "frx_eth" numeric NOT NULL, CONSTRAINT "PK_9debaa84944fe2be9dc4219ba8f" PRIMARY KEY ("id"))`) + await db.query(`CREATE INDEX "IDX_d6298a294864b4eaf793cf35a4" ON "oeth_vault" ("timestamp") `) + await db.query(`CREATE INDEX "IDX_e20cb507a673817b2c68720415" ON "oeth_vault" ("block_number") `) + await db.query(`CREATE TABLE "oeth_curve_lp" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "total_supply" numeric NOT NULL, "eth" numeric NOT NULL, "oeth" numeric NOT NULL, "total_supply_owned" numeric NOT NULL, "eth_owned" numeric NOT NULL, "oeth_owned" numeric NOT NULL, CONSTRAINT "PK_2b055044664e80f44d6172fdf54" PRIMARY KEY ("id"))`) + await db.query(`CREATE INDEX "IDX_d9bbd20e888fa1b4b2c5d2f039" ON "oeth_curve_lp" ("timestamp") `) + await db.query(`CREATE INDEX "IDX_7617d593c36dce1b1565a8d74a" ON "oeth_curve_lp" ("block_number") `) + await db.query(`CREATE TABLE "oeth_frax_staking" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "sfrx_eth" numeric NOT NULL, CONSTRAINT "PK_694f53c8600ae88c7bdcf7305dd" PRIMARY KEY ("id"))`) + await db.query(`CREATE INDEX "IDX_ce6c2c65e90967dfeaac97025b" ON "oeth_frax_staking" ("timestamp") `) + await db.query(`CREATE INDEX "IDX_1a7f7d650390e2f9c212651e05" ON "oeth_frax_staking" ("block_number") `) + await db.query(`CREATE TABLE "oeth_morpho_aave" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "weth" numeric NOT NULL, CONSTRAINT "PK_86de8f846e9335c92b8ad7df3a1" PRIMARY KEY ("id"))`) + await db.query(`CREATE INDEX "IDX_25e239b985844f1d33fac79981" ON "oeth_morpho_aave" ("timestamp") `) + await db.query(`CREATE INDEX "IDX_a6662224e95eb6921bb14cb5f9" ON "oeth_morpho_aave" ("block_number") `) + await db.query(`CREATE TABLE "oeth_dripper" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "weth" numeric NOT NULL, "last_collect_timestamp" integer NOT NULL, "drip_rate_per_block" numeric NOT NULL, "drip_duration" numeric NOT NULL, CONSTRAINT "PK_77731281c1564c24eff0c265984" PRIMARY KEY ("id"))`) + await db.query(`CREATE INDEX "IDX_16ac742ceeb05d28e530da9649" ON "oeth_dripper" ("timestamp") `) + await db.query(`CREATE INDEX "IDX_d356832c14603916a492608e7b" ON "oeth_dripper" ("block_number") `) + await db.query(`CREATE TABLE "oeth_balancer_meta_pool_strategy" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "r_eth" numeric NOT NULL, "weth" numeric NOT NULL, CONSTRAINT "PK_6ddf5b8ba878e6d706e59bd6de0" PRIMARY KEY ("id"))`) + await db.query(`CREATE INDEX "IDX_5e7ef383756fa18cb602f50089" ON "oeth_balancer_meta_pool_strategy" ("timestamp") `) + await db.query(`CREATE INDEX "IDX_11d344b3e0e03cdb6697dd61f7" ON "oeth_balancer_meta_pool_strategy" ("block_number") `) + await db.query(`CREATE TABLE "oeth_strategy_holding_daily_stat" ("id" character varying NOT NULL, "symbol" text NOT NULL, "amount" numeric NOT NULL, "value" numeric NOT NULL, "strategy_daily_stat_id_id" character varying, CONSTRAINT "PK_7f1a62da5e53cf264c2f39b4acf" PRIMARY KEY ("id"))`) + await db.query(`CREATE INDEX "IDX_4e867f220975e615e6077d860c" ON "oeth_strategy_holding_daily_stat" ("strategy_daily_stat_id_id") `) + await db.query(`CREATE TABLE "oeth_strategy_daily_stat" ("id" character varying NOT NULL, "name" text NOT NULL, "total" numeric NOT NULL, "tvl" numeric NOT NULL, "daily_stat_id_id" character varying, CONSTRAINT "PK_8af1a0c60e67b05baf928787a8e" PRIMARY KEY ("id"))`) + await db.query(`CREATE INDEX "IDX_6c7096c96a000d8471256ca8fc" ON "oeth_strategy_daily_stat" ("daily_stat_id_id") `) + await db.query(`CREATE TABLE "oeth_collateral_daily_stat" ("id" character varying NOT NULL, "symbol" text NOT NULL, "amount" numeric NOT NULL, "price" numeric NOT NULL, "value" numeric NOT NULL, "daily_stat_id_id" character varying, CONSTRAINT "PK_5fb23d7bae30dffe4543e7aa069" PRIMARY KEY ("id"))`) + await db.query(`CREATE INDEX "IDX_a90045de50406be7bd56efd3ea" ON "oeth_collateral_daily_stat" ("daily_stat_id_id") `) + await db.query(`CREATE TABLE "oeth_daily_stat" ("id" character varying NOT NULL, "block_number" integer NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "apr" numeric NOT NULL, "apy" numeric NOT NULL, "apy7_day_avg" numeric NOT NULL, "apy14_day_avg" numeric NOT NULL, "apy30_day_avg" numeric NOT NULL, "total_supply" numeric NOT NULL, "total_supply_usd" numeric NOT NULL, "rebasing_supply" numeric NOT NULL, "non_rebasing_supply" numeric NOT NULL, "amo_supply" numeric NOT NULL, "dripper_weth" numeric NOT NULL, "yield" numeric NOT NULL, "fees" numeric NOT NULL, "revenue" numeric NOT NULL, "revenue7_day_avg" numeric NOT NULL, "revenue7_day_total" numeric NOT NULL, "revenue_all_time" numeric NOT NULL, "peg_price" numeric NOT NULL, CONSTRAINT "PK_9144a02ab13b1baa818a7d5eae5" PRIMARY KEY ("id"))`) + await db.query(`CREATE INDEX "IDX_98d9001013aa37425ca47b7126" ON "oeth_daily_stat" ("block_number") `) + await db.query(`CREATE INDEX "IDX_c3e66051c7df4efd6a8fa8f9c1" ON "oeth_daily_stat" ("timestamp") `) + await db.query(`CREATE TABLE "oeth_reward_token_collected" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "strategy" text NOT NULL, "recipient" text NOT NULL, "reward_token" text NOT NULL, "amount" numeric NOT NULL, CONSTRAINT "PK_47098cc5fbc7cb95c2374fa33cd" PRIMARY KEY ("id"))`) + await db.query(`CREATE INDEX "IDX_81a9fa43ae4a6ae63e4103127b" ON "oeth_reward_token_collected" ("timestamp") `) + await db.query(`CREATE INDEX "IDX_d36c78b9c3e9d737f067638bc4" ON "oeth_reward_token_collected" ("block_number") `) + await db.query(`CREATE TABLE "ogv" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "circulating" numeric NOT NULL, "staked" numeric NOT NULL, "total" numeric NOT NULL, CONSTRAINT "PK_f16038abf451ce82bd03ea54ee7" PRIMARY KEY ("id"))`) + await db.query(`CREATE INDEX "IDX_2418a8b8b92b2f5977be761cf9" ON "ogv" ("timestamp") `) + await db.query(`CREATE INDEX "IDX_b8f20bcf48e4aa77e0f48d77db" ON "ogv" ("block_number") `) + await db.query(`CREATE TABLE "ogv_address" ("id" character varying NOT NULL, "balance" numeric NOT NULL, "staked" numeric NOT NULL, "veogv_balance" numeric NOT NULL, "voting_power" numeric NOT NULL, "last_updated" TIMESTAMP WITH TIME ZONE NOT NULL, "delegatee_id" character varying, CONSTRAINT "PK_f13c77575687ef480ca0b7de5d8" PRIMARY KEY ("id"))`) + await db.query(`CREATE INDEX "IDX_49d26f287904b8b1aef6e9ac2b" ON "ogv_address" ("delegatee_id") `) + await db.query(`CREATE TABLE "ogv_lockup" ("id" character varying NOT NULL, "lockup_id" text NOT NULL, "amount" numeric NOT NULL, "end" TIMESTAMP WITH TIME ZONE NOT NULL, "veogv" numeric NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "address_id" character varying, CONSTRAINT "PK_6b6d5ed3a004dd3f546c1b11fa4" PRIMARY KEY ("id"))`) + await db.query(`CREATE INDEX "IDX_8114101b53d9d6bc26fe80838a" ON "ogv_lockup" ("lockup_id") `) + await db.query(`CREATE INDEX "IDX_8be94cd63e35b91adf1301a156" ON "ogv_lockup" ("address_id") `) + await db.query(`CREATE TABLE "ogv_lockup_tx_log" ("id" character varying NOT NULL, "hash" text NOT NULL, "event" character varying(8) NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "ogv_lockup_id" character varying, CONSTRAINT "PK_1c4a8425ce42f0c9da10056adee" PRIMARY KEY ("id"))`) + await db.query(`CREATE INDEX "IDX_b49fca291c97d9b55cd91f935f" ON "ogv_lockup_tx_log" ("ogv_lockup_id") `) + await db.query(`CREATE TABLE "ogv_proposal" ("id" character varying NOT NULL, "description" text, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "start_block" numeric NOT NULL, "end_block" numeric NOT NULL, "last_updated" TIMESTAMP WITH TIME ZONE NOT NULL, "status" character varying(9) NOT NULL, "proposer_id" character varying, CONSTRAINT "PK_b06db02b26fa37882e013579407" PRIMARY KEY ("id"))`) + await db.query(`CREATE INDEX "IDX_c62be3f16dfb3e4a09525c85af" ON "ogv_proposal" ("proposer_id") `) + await db.query(`CREATE TABLE "ogv_proposal_tx_log" ("id" character varying NOT NULL, "hash" text NOT NULL, "event" character varying(8) NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "proposal_id" character varying, CONSTRAINT "PK_da43c287069bba678ca5c60b1ad" PRIMARY KEY ("id"))`) + await db.query(`CREATE INDEX "IDX_5d5f5e10892290ee366d26de7d" ON "ogv_proposal_tx_log" ("proposal_id") `) + await db.query(`CREATE TABLE "ogv_proposal_vote" ("id" character varying NOT NULL, "weight" numeric NOT NULL, "type" character varying(7) NOT NULL, "tx_hash" text NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "proposal_id" character varying, "voter_id" character varying, CONSTRAINT "PK_93c03f35b95221586cb8b83f523" PRIMARY KEY ("id"))`) + await db.query(`CREATE INDEX "IDX_58d732bc6523c2609d2725cc0a" ON "ogv_proposal_vote" ("proposal_id") `) + await db.query(`CREATE INDEX "IDX_2fd621aea353448fb3f17721bc" ON "ogv_proposal_vote" ("voter_id") `) + await db.query(`CREATE TABLE "ousd" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "total_supply" numeric NOT NULL, "rebasing_supply" numeric NOT NULL, "non_rebasing_supply" numeric NOT NULL, CONSTRAINT "PK_acecae4a20bc14b22d9f6738d8d" PRIMARY KEY ("id"))`) + await db.query(`CREATE INDEX "IDX_c8d1e285213b445b088805ac7c" ON "ousd" ("timestamp") `) + await db.query(`CREATE INDEX "IDX_806949dd853b7e8acab5d03b81" ON "ousd" ("block_number") `) + await db.query(`CREATE TABLE "ousd_history" ("id" character varying NOT NULL, "value" numeric NOT NULL, "balance" numeric NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "tx_hash" text NOT NULL, "type" character varying(8) NOT NULL, "address_id" character varying, CONSTRAINT "PK_dcbe3223b67f92d9ad4cffe8a7c" PRIMARY KEY ("id"))`) + await db.query(`CREATE INDEX "IDX_70291ea600c0c4d67d9bfe6a6b" ON "ousd_history" ("address_id") `) + await db.query(`CREATE INDEX "IDX_4d00d283e1ce3209dc43a0313c" ON "ousd_history" ("block_number") `) + await db.query(`CREATE INDEX "IDX_0c25caa59aa053a688a723d160" ON "ousd_history" ("tx_hash") `) + await db.query(`CREATE TABLE "ousd_address" ("id" character varying NOT NULL, "is_contract" boolean NOT NULL, "rebasing_option" character varying(6) NOT NULL, "balance" numeric NOT NULL, "earned" numeric NOT NULL, "credits" numeric NOT NULL, "last_updated" TIMESTAMP WITH TIME ZONE NOT NULL, CONSTRAINT "PK_bb061344757ede566d62854af6a" PRIMARY KEY ("id"))`) + await db.query(`CREATE TABLE "ousdapy" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "tx_hash" text NOT NULL, "apr" numeric NOT NULL, "apy" numeric NOT NULL, "apy7_day_avg" numeric NOT NULL, "apy14_day_avg" numeric NOT NULL, "apy30_day_avg" numeric NOT NULL, "rebasing_credits_per_token" numeric NOT NULL, CONSTRAINT "PK_d9889b7153efc82dbe88f9a7a33" PRIMARY KEY ("id"))`) + await db.query(`CREATE INDEX "IDX_c514963f42908ce84d65a84a77" ON "ousdapy" ("timestamp") `) + await db.query(`CREATE INDEX "IDX_4f606414b3b5ce1a366bd0fbf6" ON "ousdapy" ("block_number") `) + await db.query(`CREATE INDEX "IDX_0e84a81a109b66fe6f01f77c74" ON "ousdapy" ("tx_hash") `) + await db.query(`CREATE TABLE "ousd_rebase" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "tx_hash" text NOT NULL, "total_supply" numeric NOT NULL, "rebasing_credits" numeric NOT NULL, "rebasing_credits_per_token" numeric NOT NULL, "fee" numeric NOT NULL, "yield" numeric NOT NULL, "apy_id" character varying, CONSTRAINT "PK_04cf0de72399a99798dde61b237" PRIMARY KEY ("id"))`) + await db.query(`CREATE INDEX "IDX_f8eb4a16ce58a146b3227ee21a" ON "ousd_rebase" ("timestamp") `) + await db.query(`CREATE INDEX "IDX_3fb03b1a410e64c7367226d0b6" ON "ousd_rebase" ("block_number") `) + await db.query(`CREATE INDEX "IDX_1a76c478199672aaeec340f619" ON "ousd_rebase" ("tx_hash") `) + await db.query(`CREATE INDEX "IDX_427468c97f9838b804efd6c8e5" ON "ousd_rebase" ("apy_id") `) + await db.query(`CREATE TABLE "ousd_rebase_option" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "tx_hash" text NOT NULL, "status" character varying(6) NOT NULL, "address_id" character varying, CONSTRAINT "PK_d684f90866027104f3c929dfe10" PRIMARY KEY ("id"))`) + await db.query(`CREATE INDEX "IDX_64bd23947dc4c67e3b6a3f9352" ON "ousd_rebase_option" ("timestamp") `) + await db.query(`CREATE INDEX "IDX_9b774e46b8b1cf7f828133809a" ON "ousd_rebase_option" ("block_number") `) + await db.query(`CREATE INDEX "IDX_4e95bf069de04533d83a9a97fd" ON "ousd_rebase_option" ("tx_hash") `) + await db.query(`CREATE INDEX "IDX_b04173f9349ddd991a3b60e914" ON "ousd_rebase_option" ("address_id") `) + await db.query(`CREATE TABLE "ousd_vault" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "dai" numeric NOT NULL, "usdt" numeric NOT NULL, "usdc" numeric NOT NULL, CONSTRAINT "PK_343f5538c71a1cd78f1659ef9d3" PRIMARY KEY ("id"))`) + await db.query(`CREATE INDEX "IDX_6860186ea2f56e2c7d54c22107" ON "ousd_vault" ("timestamp") `) + await db.query(`CREATE INDEX "IDX_0d0a7113a505cf7f7adea9ca81" ON "ousd_vault" ("block_number") `) + await db.query(`CREATE TABLE "ousd_morpho_aave" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "dai" numeric NOT NULL, "usdt" numeric NOT NULL, "usdc" numeric NOT NULL, CONSTRAINT "PK_60676cde905a822ba73ff3a5c85" PRIMARY KEY ("id"))`) + await db.query(`CREATE INDEX "IDX_78e0701c2e9a28242db37bd8f8" ON "ousd_morpho_aave" ("timestamp") `) + await db.query(`CREATE INDEX "IDX_46ccf673b376d654052fbd53e6" ON "ousd_morpho_aave" ("block_number") `) + await db.query(`CREATE TABLE "ousd_morpho_compound" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "dai" numeric NOT NULL, "usdt" numeric NOT NULL, "usdc" numeric NOT NULL, CONSTRAINT "PK_5f715d53ef8fc0fad595cacf4fa" PRIMARY KEY ("id"))`) + await db.query(`CREATE INDEX "IDX_9e7bd0d8ae23b877d5979ef80c" ON "ousd_morpho_compound" ("timestamp") `) + await db.query(`CREATE INDEX "IDX_0bb3a0ad84071f1d80f6d4e90f" ON "ousd_morpho_compound" ("block_number") `) + await db.query(`CREATE TABLE "maker_dsr_strategy" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "dai" numeric NOT NULL, CONSTRAINT "PK_196da2d6910009ae04e3542fe22" PRIMARY KEY ("id"))`) + await db.query(`CREATE INDEX "IDX_a35308a3c5dbaab2d321eb1525" ON "maker_dsr_strategy" ("timestamp") `) + await db.query(`CREATE INDEX "IDX_844b219d8faf9b1d24ab2dba9a" ON "maker_dsr_strategy" ("block_number") `) + await db.query(`CREATE TABLE "ousd_flux_strategy" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "dai" numeric NOT NULL, "usdt" numeric NOT NULL, "usdc" numeric NOT NULL, CONSTRAINT "PK_ac977221429e50e4de1ce253a8b" PRIMARY KEY ("id"))`) + await db.query(`CREATE INDEX "IDX_5b165b5d30b13e363d33a66e14" ON "ousd_flux_strategy" ("timestamp") `) + await db.query(`CREATE INDEX "IDX_80f3392968fde7b99cccb805ac" ON "ousd_flux_strategy" ("block_number") `) + await db.query(`CREATE TABLE "ousd_compound_strategy" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "dai" numeric NOT NULL, "usdt" numeric NOT NULL, "usdc" numeric NOT NULL, CONSTRAINT "PK_9030e82bf3479d03c04e0d1919c" PRIMARY KEY ("id"))`) + await db.query(`CREATE INDEX "IDX_6920b1db5dc577295ac4d1379d" ON "ousd_compound_strategy" ("timestamp") `) + await db.query(`CREATE INDEX "IDX_89c6d7d3104bd36dc88a37add4" ON "ousd_compound_strategy" ("block_number") `) + await db.query(`CREATE TABLE "ousd_convex_strategy" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "dai" numeric NOT NULL, "usdt" numeric NOT NULL, "usdc" numeric NOT NULL, CONSTRAINT "PK_2b8f6e749e15e49d8816f1ac949" PRIMARY KEY ("id"))`) + await db.query(`CREATE INDEX "IDX_2deac473cd0b2dd7082e7da148" ON "ousd_convex_strategy" ("timestamp") `) + await db.query(`CREATE INDEX "IDX_157bf74171817dc5c60ee37036" ON "ousd_convex_strategy" ("block_number") `) + await db.query(`CREATE TABLE "ousd_aave_strategy" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "dai" numeric NOT NULL, "usdt" numeric NOT NULL, "usdc" numeric NOT NULL, CONSTRAINT "PK_b4b7ac6e395aa722df500f93623" PRIMARY KEY ("id"))`) + await db.query(`CREATE INDEX "IDX_ca34b5a0a33bc9abdd8213c2fa" ON "ousd_aave_strategy" ("timestamp") `) + await db.query(`CREATE INDEX "IDX_dacd7c98223d7bc8be074d71e4" ON "ousd_aave_strategy" ("block_number") `) + await db.query(`CREATE TABLE "ousd_meta_strategy" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "dai" numeric NOT NULL, "usdt" numeric NOT NULL, "usdc" numeric NOT NULL, CONSTRAINT "PK_d99170af73d86fe74460bbfacc4" PRIMARY KEY ("id"))`) + await db.query(`CREATE INDEX "IDX_7e998dcf775263bc5df76ef987" ON "ousd_meta_strategy" ("timestamp") `) + await db.query(`CREATE INDEX "IDX_55ce185680512d6a5b9fb0af89" ON "ousd_meta_strategy" ("block_number") `) + await db.query(`CREATE TABLE "ousd_convex_lusd_plus3_crv" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "dai" numeric NOT NULL, "usdt" numeric NOT NULL, "usdc" numeric NOT NULL, CONSTRAINT "PK_47290aa5dfa3cc5595f468e2f39" PRIMARY KEY ("id"))`) + await db.query(`CREATE INDEX "IDX_0783af95efb35fb3f13cde1656" ON "ousd_convex_lusd_plus3_crv" ("timestamp") `) + await db.query(`CREATE INDEX "IDX_74ae01fb596a4f2733087ba454" ON "ousd_convex_lusd_plus3_crv" ("block_number") `) + await db.query(`ALTER TABLE "oeth_history" ADD CONSTRAINT "FK_94e47c4c49128c78f60b185b46b" FOREIGN KEY ("address_id") REFERENCES "oeth_address"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`) + await db.query(`ALTER TABLE "oeth_rebase" ADD CONSTRAINT "FK_3331819842173de7c27c046547a" FOREIGN KEY ("apy_id") REFERENCES "oethapy"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`) + await db.query(`ALTER TABLE "oeth_rebase_option" ADD CONSTRAINT "FK_034428879698039839b4ba6ffe8" FOREIGN KEY ("address_id") REFERENCES "oeth_address"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`) + await db.query(`ALTER TABLE "oeth_strategy_holding_daily_stat" ADD CONSTRAINT "FK_4e867f220975e615e6077d860c1" FOREIGN KEY ("strategy_daily_stat_id_id") REFERENCES "oeth_strategy_daily_stat"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`) + await db.query(`ALTER TABLE "oeth_strategy_daily_stat" ADD CONSTRAINT "FK_6c7096c96a000d8471256ca8fc3" FOREIGN KEY ("daily_stat_id_id") REFERENCES "oeth_daily_stat"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`) + await db.query(`ALTER TABLE "oeth_collateral_daily_stat" ADD CONSTRAINT "FK_a90045de50406be7bd56efd3ea4" FOREIGN KEY ("daily_stat_id_id") REFERENCES "oeth_daily_stat"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`) + await db.query(`ALTER TABLE "ogv_address" ADD CONSTRAINT "FK_49d26f287904b8b1aef6e9ac2b3" FOREIGN KEY ("delegatee_id") REFERENCES "ogv_address"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`) + await db.query(`ALTER TABLE "ogv_lockup" ADD CONSTRAINT "FK_8be94cd63e35b91adf1301a156c" FOREIGN KEY ("address_id") REFERENCES "ogv_address"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`) + await db.query(`ALTER TABLE "ogv_lockup_tx_log" ADD CONSTRAINT "FK_b49fca291c97d9b55cd91f935f3" FOREIGN KEY ("ogv_lockup_id") REFERENCES "ogv_lockup"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`) + await db.query(`ALTER TABLE "ogv_proposal" ADD CONSTRAINT "FK_c62be3f16dfb3e4a09525c85af8" FOREIGN KEY ("proposer_id") REFERENCES "ogv_address"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`) + await db.query(`ALTER TABLE "ogv_proposal_tx_log" ADD CONSTRAINT "FK_5d5f5e10892290ee366d26de7dc" FOREIGN KEY ("proposal_id") REFERENCES "ogv_proposal"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`) + await db.query(`ALTER TABLE "ogv_proposal_vote" ADD CONSTRAINT "FK_58d732bc6523c2609d2725cc0ac" FOREIGN KEY ("proposal_id") REFERENCES "ogv_proposal"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`) + await db.query(`ALTER TABLE "ogv_proposal_vote" ADD CONSTRAINT "FK_2fd621aea353448fb3f17721bc8" FOREIGN KEY ("voter_id") REFERENCES "ogv_address"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`) + await db.query(`ALTER TABLE "ousd_history" ADD CONSTRAINT "FK_70291ea600c0c4d67d9bfe6a6bf" FOREIGN KEY ("address_id") REFERENCES "ousd_address"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`) + await db.query(`ALTER TABLE "ousd_rebase" ADD CONSTRAINT "FK_427468c97f9838b804efd6c8e55" FOREIGN KEY ("apy_id") REFERENCES "ousdapy"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`) + await db.query(`ALTER TABLE "ousd_rebase_option" ADD CONSTRAINT "FK_b04173f9349ddd991a3b60e914a" FOREIGN KEY ("address_id") REFERENCES "ousd_address"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`) + } + + async down(db) { + await db.query(`DROP TABLE "exchange_rate"`) + await db.query(`DROP INDEX "public"."IDX_9e23a3f1bf3634820c873a0fe8"`) + await db.query(`DROP INDEX "public"."IDX_c61a93768eed9e58ce399bbe01"`) + await db.query(`DROP TABLE "balance"`) + await db.query(`DROP INDEX "public"."IDX_a956b410c329b8eca7898c3c51"`) + await db.query(`DROP INDEX "public"."IDX_6b451b59c9f6a6fdd685f530b2"`) + await db.query(`DROP TABLE "strategy_balance"`) + await db.query(`DROP INDEX "public"."IDX_0113bf0b63183bea0d22cd0d08"`) + await db.query(`DROP INDEX "public"."IDX_a88065dcd92011698bbe7df7b1"`) + await db.query(`DROP TABLE "strategy_yield"`) + await db.query(`DROP INDEX "public"."IDX_5108f2a2563d5665892d0c06b0"`) + await db.query(`DROP INDEX "public"."IDX_41c3567c9d43c598e07a0029c5"`) + await db.query(`DROP TABLE "strategy_daily_yield"`) + await db.query(`DROP INDEX "public"."IDX_0ba1974747f1906e0c102cd2cd"`) + await db.query(`DROP INDEX "public"."IDX_df364fb6e82d1feeed2a5dfffa"`) + await db.query(`DROP TABLE "curve_pool_balance"`) + await db.query(`DROP INDEX "public"."IDX_ffb0d0f86f03faacef7cb3e092"`) + await db.query(`DROP INDEX "public"."IDX_db5522c865eb8ed76fa7aeb4a8"`) + await db.query(`DROP TABLE "oeth"`) + await db.query(`DROP INDEX "public"."IDX_5b81a67229bac2d68e0dc92cc4"`) + await db.query(`DROP INDEX "public"."IDX_408e5f79f83093aa5cf2b0ea32"`) + await db.query(`DROP TABLE "oeth_history"`) + await db.query(`DROP INDEX "public"."IDX_94e47c4c49128c78f60b185b46"`) + await db.query(`DROP INDEX "public"."IDX_96956b1c8d29eb7066a97d5ea7"`) + await db.query(`DROP INDEX "public"."IDX_b14170bdb7fbc0775bf55df15d"`) + await db.query(`DROP TABLE "oeth_address"`) + await db.query(`DROP TABLE "oethapy"`) + await db.query(`DROP INDEX "public"."IDX_b1a448045d1ed9d655b679a371"`) + await db.query(`DROP INDEX "public"."IDX_6b8a7a706a0701e659a7d81508"`) + await db.query(`DROP INDEX "public"."IDX_c0c03168bb0139e3cffda4f00e"`) + await db.query(`DROP TABLE "oeth_rebase"`) + await db.query(`DROP INDEX "public"."IDX_fbb7b3f2fff9896eb683b86de7"`) + await db.query(`DROP INDEX "public"."IDX_d3255d02d9407bba89380d01fa"`) + await db.query(`DROP INDEX "public"."IDX_8b6bb0243472af88612fe6a01f"`) + await db.query(`DROP INDEX "public"."IDX_3331819842173de7c27c046547"`) + await db.query(`DROP TABLE "oeth_rebase_option"`) + await db.query(`DROP INDEX "public"."IDX_1fc6bbd88037bfbf4361776909"`) + await db.query(`DROP INDEX "public"."IDX_cbb7ceb49ef7c45432d0171296"`) + await db.query(`DROP INDEX "public"."IDX_355826dadaacc5ae2d63c82f28"`) + await db.query(`DROP INDEX "public"."IDX_034428879698039839b4ba6ffe"`) + await db.query(`DROP TABLE "oeth_vault"`) + await db.query(`DROP INDEX "public"."IDX_d6298a294864b4eaf793cf35a4"`) + await db.query(`DROP INDEX "public"."IDX_e20cb507a673817b2c68720415"`) + await db.query(`DROP TABLE "oeth_curve_lp"`) + await db.query(`DROP INDEX "public"."IDX_d9bbd20e888fa1b4b2c5d2f039"`) + await db.query(`DROP INDEX "public"."IDX_7617d593c36dce1b1565a8d74a"`) + await db.query(`DROP TABLE "oeth_frax_staking"`) + await db.query(`DROP INDEX "public"."IDX_ce6c2c65e90967dfeaac97025b"`) + await db.query(`DROP INDEX "public"."IDX_1a7f7d650390e2f9c212651e05"`) + await db.query(`DROP TABLE "oeth_morpho_aave"`) + await db.query(`DROP INDEX "public"."IDX_25e239b985844f1d33fac79981"`) + await db.query(`DROP INDEX "public"."IDX_a6662224e95eb6921bb14cb5f9"`) + await db.query(`DROP TABLE "oeth_dripper"`) + await db.query(`DROP INDEX "public"."IDX_16ac742ceeb05d28e530da9649"`) + await db.query(`DROP INDEX "public"."IDX_d356832c14603916a492608e7b"`) + await db.query(`DROP TABLE "oeth_balancer_meta_pool_strategy"`) + await db.query(`DROP INDEX "public"."IDX_5e7ef383756fa18cb602f50089"`) + await db.query(`DROP INDEX "public"."IDX_11d344b3e0e03cdb6697dd61f7"`) + await db.query(`DROP TABLE "oeth_strategy_holding_daily_stat"`) + await db.query(`DROP INDEX "public"."IDX_4e867f220975e615e6077d860c"`) + await db.query(`DROP TABLE "oeth_strategy_daily_stat"`) + await db.query(`DROP INDEX "public"."IDX_6c7096c96a000d8471256ca8fc"`) + await db.query(`DROP TABLE "oeth_collateral_daily_stat"`) + await db.query(`DROP INDEX "public"."IDX_a90045de50406be7bd56efd3ea"`) + await db.query(`DROP TABLE "oeth_daily_stat"`) + await db.query(`DROP INDEX "public"."IDX_98d9001013aa37425ca47b7126"`) + await db.query(`DROP INDEX "public"."IDX_c3e66051c7df4efd6a8fa8f9c1"`) + await db.query(`DROP TABLE "oeth_reward_token_collected"`) + await db.query(`DROP INDEX "public"."IDX_81a9fa43ae4a6ae63e4103127b"`) + await db.query(`DROP INDEX "public"."IDX_d36c78b9c3e9d737f067638bc4"`) + await db.query(`DROP TABLE "ogv"`) + await db.query(`DROP INDEX "public"."IDX_2418a8b8b92b2f5977be761cf9"`) + await db.query(`DROP INDEX "public"."IDX_b8f20bcf48e4aa77e0f48d77db"`) + await db.query(`DROP TABLE "ogv_address"`) + await db.query(`DROP INDEX "public"."IDX_49d26f287904b8b1aef6e9ac2b"`) + await db.query(`DROP TABLE "ogv_lockup"`) + await db.query(`DROP INDEX "public"."IDX_8114101b53d9d6bc26fe80838a"`) + await db.query(`DROP INDEX "public"."IDX_8be94cd63e35b91adf1301a156"`) + await db.query(`DROP TABLE "ogv_lockup_tx_log"`) + await db.query(`DROP INDEX "public"."IDX_b49fca291c97d9b55cd91f935f"`) + await db.query(`DROP TABLE "ogv_proposal"`) + await db.query(`DROP INDEX "public"."IDX_c62be3f16dfb3e4a09525c85af"`) + await db.query(`DROP TABLE "ogv_proposal_tx_log"`) + await db.query(`DROP INDEX "public"."IDX_5d5f5e10892290ee366d26de7d"`) + await db.query(`DROP TABLE "ogv_proposal_vote"`) + await db.query(`DROP INDEX "public"."IDX_58d732bc6523c2609d2725cc0a"`) + await db.query(`DROP INDEX "public"."IDX_2fd621aea353448fb3f17721bc"`) + await db.query(`DROP TABLE "ousd"`) + await db.query(`DROP INDEX "public"."IDX_c8d1e285213b445b088805ac7c"`) + await db.query(`DROP INDEX "public"."IDX_806949dd853b7e8acab5d03b81"`) + await db.query(`DROP TABLE "ousd_history"`) + await db.query(`DROP INDEX "public"."IDX_70291ea600c0c4d67d9bfe6a6b"`) + await db.query(`DROP INDEX "public"."IDX_4d00d283e1ce3209dc43a0313c"`) + await db.query(`DROP INDEX "public"."IDX_0c25caa59aa053a688a723d160"`) + await db.query(`DROP TABLE "ousd_address"`) + await db.query(`DROP TABLE "ousdapy"`) + await db.query(`DROP INDEX "public"."IDX_c514963f42908ce84d65a84a77"`) + await db.query(`DROP INDEX "public"."IDX_4f606414b3b5ce1a366bd0fbf6"`) + await db.query(`DROP INDEX "public"."IDX_0e84a81a109b66fe6f01f77c74"`) + await db.query(`DROP TABLE "ousd_rebase"`) + await db.query(`DROP INDEX "public"."IDX_f8eb4a16ce58a146b3227ee21a"`) + await db.query(`DROP INDEX "public"."IDX_3fb03b1a410e64c7367226d0b6"`) + await db.query(`DROP INDEX "public"."IDX_1a76c478199672aaeec340f619"`) + await db.query(`DROP INDEX "public"."IDX_427468c97f9838b804efd6c8e5"`) + await db.query(`DROP TABLE "ousd_rebase_option"`) + await db.query(`DROP INDEX "public"."IDX_64bd23947dc4c67e3b6a3f9352"`) + await db.query(`DROP INDEX "public"."IDX_9b774e46b8b1cf7f828133809a"`) + await db.query(`DROP INDEX "public"."IDX_4e95bf069de04533d83a9a97fd"`) + await db.query(`DROP INDEX "public"."IDX_b04173f9349ddd991a3b60e914"`) + await db.query(`DROP TABLE "ousd_vault"`) + await db.query(`DROP INDEX "public"."IDX_6860186ea2f56e2c7d54c22107"`) + await db.query(`DROP INDEX "public"."IDX_0d0a7113a505cf7f7adea9ca81"`) + await db.query(`DROP TABLE "ousd_morpho_aave"`) + await db.query(`DROP INDEX "public"."IDX_78e0701c2e9a28242db37bd8f8"`) + await db.query(`DROP INDEX "public"."IDX_46ccf673b376d654052fbd53e6"`) + await db.query(`DROP TABLE "ousd_morpho_compound"`) + await db.query(`DROP INDEX "public"."IDX_9e7bd0d8ae23b877d5979ef80c"`) + await db.query(`DROP INDEX "public"."IDX_0bb3a0ad84071f1d80f6d4e90f"`) + await db.query(`DROP TABLE "maker_dsr_strategy"`) + await db.query(`DROP INDEX "public"."IDX_a35308a3c5dbaab2d321eb1525"`) + await db.query(`DROP INDEX "public"."IDX_844b219d8faf9b1d24ab2dba9a"`) + await db.query(`DROP TABLE "ousd_flux_strategy"`) + await db.query(`DROP INDEX "public"."IDX_5b165b5d30b13e363d33a66e14"`) + await db.query(`DROP INDEX "public"."IDX_80f3392968fde7b99cccb805ac"`) + await db.query(`DROP TABLE "ousd_compound_strategy"`) + await db.query(`DROP INDEX "public"."IDX_6920b1db5dc577295ac4d1379d"`) + await db.query(`DROP INDEX "public"."IDX_89c6d7d3104bd36dc88a37add4"`) + await db.query(`DROP TABLE "ousd_convex_strategy"`) + await db.query(`DROP INDEX "public"."IDX_2deac473cd0b2dd7082e7da148"`) + await db.query(`DROP INDEX "public"."IDX_157bf74171817dc5c60ee37036"`) + await db.query(`DROP TABLE "ousd_aave_strategy"`) + await db.query(`DROP INDEX "public"."IDX_ca34b5a0a33bc9abdd8213c2fa"`) + await db.query(`DROP INDEX "public"."IDX_dacd7c98223d7bc8be074d71e4"`) + await db.query(`DROP TABLE "ousd_meta_strategy"`) + await db.query(`DROP INDEX "public"."IDX_7e998dcf775263bc5df76ef987"`) + await db.query(`DROP INDEX "public"."IDX_55ce185680512d6a5b9fb0af89"`) + await db.query(`DROP TABLE "ousd_convex_lusd_plus3_crv"`) + await db.query(`DROP INDEX "public"."IDX_0783af95efb35fb3f13cde1656"`) + await db.query(`DROP INDEX "public"."IDX_74ae01fb596a4f2733087ba454"`) + await db.query(`ALTER TABLE "oeth_history" DROP CONSTRAINT "FK_94e47c4c49128c78f60b185b46b"`) + await db.query(`ALTER TABLE "oeth_rebase" DROP CONSTRAINT "FK_3331819842173de7c27c046547a"`) + await db.query(`ALTER TABLE "oeth_rebase_option" DROP CONSTRAINT "FK_034428879698039839b4ba6ffe8"`) + await db.query(`ALTER TABLE "oeth_strategy_holding_daily_stat" DROP CONSTRAINT "FK_4e867f220975e615e6077d860c1"`) + await db.query(`ALTER TABLE "oeth_strategy_daily_stat" DROP CONSTRAINT "FK_6c7096c96a000d8471256ca8fc3"`) + await db.query(`ALTER TABLE "oeth_collateral_daily_stat" DROP CONSTRAINT "FK_a90045de50406be7bd56efd3ea4"`) + await db.query(`ALTER TABLE "ogv_address" DROP CONSTRAINT "FK_49d26f287904b8b1aef6e9ac2b3"`) + await db.query(`ALTER TABLE "ogv_lockup" DROP CONSTRAINT "FK_8be94cd63e35b91adf1301a156c"`) + await db.query(`ALTER TABLE "ogv_lockup_tx_log" DROP CONSTRAINT "FK_b49fca291c97d9b55cd91f935f3"`) + await db.query(`ALTER TABLE "ogv_proposal" DROP CONSTRAINT "FK_c62be3f16dfb3e4a09525c85af8"`) + await db.query(`ALTER TABLE "ogv_proposal_tx_log" DROP CONSTRAINT "FK_5d5f5e10892290ee366d26de7dc"`) + await db.query(`ALTER TABLE "ogv_proposal_vote" DROP CONSTRAINT "FK_58d732bc6523c2609d2725cc0ac"`) + await db.query(`ALTER TABLE "ogv_proposal_vote" DROP CONSTRAINT "FK_2fd621aea353448fb3f17721bc8"`) + await db.query(`ALTER TABLE "ousd_history" DROP CONSTRAINT "FK_70291ea600c0c4d67d9bfe6a6bf"`) + await db.query(`ALTER TABLE "ousd_rebase" DROP CONSTRAINT "FK_427468c97f9838b804efd6c8e55"`) + await db.query(`ALTER TABLE "ousd_rebase_option" DROP CONSTRAINT "FK_b04173f9349ddd991a3b60e914a"`) + } +} diff --git a/src/abi/aave-lending-pool.abi.ts b/src/abi/aave-lending-pool.abi.ts new file mode 100644 index 00000000..101d94e9 --- /dev/null +++ b/src/abi/aave-lending-pool.abi.ts @@ -0,0 +1,1023 @@ +export const ABI_JSON = [ + { + "type": "event", + "anonymous": false, + "name": "Borrow", + "inputs": [ + { + "type": "address", + "name": "reserve", + "indexed": true + }, + { + "type": "address", + "name": "user", + "indexed": false + }, + { + "type": "address", + "name": "onBehalfOf", + "indexed": true + }, + { + "type": "uint256", + "name": "amount", + "indexed": false + }, + { + "type": "uint256", + "name": "borrowRateMode", + "indexed": false + }, + { + "type": "uint256", + "name": "borrowRate", + "indexed": false + }, + { + "type": "uint16", + "name": "referral", + "indexed": true + } + ] + }, + { + "type": "event", + "anonymous": false, + "name": "Deposit", + "inputs": [ + { + "type": "address", + "name": "reserve", + "indexed": true + }, + { + "type": "address", + "name": "user", + "indexed": false + }, + { + "type": "address", + "name": "onBehalfOf", + "indexed": true + }, + { + "type": "uint256", + "name": "amount", + "indexed": false + }, + { + "type": "uint16", + "name": "referral", + "indexed": true + } + ] + }, + { + "type": "event", + "anonymous": false, + "name": "FlashLoan", + "inputs": [ + { + "type": "address", + "name": "target", + "indexed": true + }, + { + "type": "address", + "name": "initiator", + "indexed": true + }, + { + "type": "address", + "name": "asset", + "indexed": true + }, + { + "type": "uint256", + "name": "amount", + "indexed": false + }, + { + "type": "uint256", + "name": "premium", + "indexed": false + }, + { + "type": "uint16", + "name": "referralCode", + "indexed": false + } + ] + }, + { + "type": "event", + "anonymous": false, + "name": "LiquidationCall", + "inputs": [ + { + "type": "address", + "name": "collateralAsset", + "indexed": true + }, + { + "type": "address", + "name": "debtAsset", + "indexed": true + }, + { + "type": "address", + "name": "user", + "indexed": true + }, + { + "type": "uint256", + "name": "debtToCover", + "indexed": false + }, + { + "type": "uint256", + "name": "liquidatedCollateralAmount", + "indexed": false + }, + { + "type": "address", + "name": "liquidator", + "indexed": false + }, + { + "type": "bool", + "name": "receiveAToken", + "indexed": false + } + ] + }, + { + "type": "event", + "anonymous": false, + "name": "Paused", + "inputs": [] + }, + { + "type": "event", + "anonymous": false, + "name": "RebalanceStableBorrowRate", + "inputs": [ + { + "type": "address", + "name": "reserve", + "indexed": true + }, + { + "type": "address", + "name": "user", + "indexed": true + } + ] + }, + { + "type": "event", + "anonymous": false, + "name": "Repay", + "inputs": [ + { + "type": "address", + "name": "reserve", + "indexed": true + }, + { + "type": "address", + "name": "user", + "indexed": true + }, + { + "type": "address", + "name": "repayer", + "indexed": true + }, + { + "type": "uint256", + "name": "amount", + "indexed": false + } + ] + }, + { + "type": "event", + "anonymous": false, + "name": "ReserveDataUpdated", + "inputs": [ + { + "type": "address", + "name": "reserve", + "indexed": true + }, + { + "type": "uint256", + "name": "liquidityRate", + "indexed": false + }, + { + "type": "uint256", + "name": "stableBorrowRate", + "indexed": false + }, + { + "type": "uint256", + "name": "variableBorrowRate", + "indexed": false + }, + { + "type": "uint256", + "name": "liquidityIndex", + "indexed": false + }, + { + "type": "uint256", + "name": "variableBorrowIndex", + "indexed": false + } + ] + }, + { + "type": "event", + "anonymous": false, + "name": "ReserveUsedAsCollateralDisabled", + "inputs": [ + { + "type": "address", + "name": "reserve", + "indexed": true + }, + { + "type": "address", + "name": "user", + "indexed": true + } + ] + }, + { + "type": "event", + "anonymous": false, + "name": "ReserveUsedAsCollateralEnabled", + "inputs": [ + { + "type": "address", + "name": "reserve", + "indexed": true + }, + { + "type": "address", + "name": "user", + "indexed": true + } + ] + }, + { + "type": "event", + "anonymous": false, + "name": "Swap", + "inputs": [ + { + "type": "address", + "name": "reserve", + "indexed": true + }, + { + "type": "address", + "name": "user", + "indexed": true + }, + { + "type": "uint256", + "name": "rateMode", + "indexed": false + } + ] + }, + { + "type": "event", + "anonymous": false, + "name": "TokensRescued", + "inputs": [ + { + "type": "address", + "name": "tokenRescued", + "indexed": true + }, + { + "type": "address", + "name": "receiver", + "indexed": true + }, + { + "type": "uint256", + "name": "amountRescued", + "indexed": false + } + ] + }, + { + "type": "event", + "anonymous": false, + "name": "Unpaused", + "inputs": [] + }, + { + "type": "event", + "anonymous": false, + "name": "Withdraw", + "inputs": [ + { + "type": "address", + "name": "reserve", + "indexed": true + }, + { + "type": "address", + "name": "user", + "indexed": true + }, + { + "type": "address", + "name": "to", + "indexed": true + }, + { + "type": "uint256", + "name": "amount", + "indexed": false + } + ] + }, + { + "type": "function", + "name": "FLASHLOAN_PREMIUM_TOTAL", + "constant": true, + "stateMutability": "view", + "payable": false, + "inputs": [], + "outputs": [ + { + "type": "uint256", + "name": "" + } + ] + }, + { + "type": "function", + "name": "LENDINGPOOL_REVISION", + "constant": true, + "stateMutability": "view", + "payable": false, + "inputs": [], + "outputs": [ + { + "type": "uint256", + "name": "" + } + ] + }, + { + "type": "function", + "name": "MAX_NUMBER_RESERVES", + "constant": true, + "stateMutability": "view", + "payable": false, + "inputs": [], + "outputs": [ + { + "type": "uint256", + "name": "" + } + ] + }, + { + "type": "function", + "name": "MAX_STABLE_RATE_BORROW_SIZE_PERCENT", + "constant": true, + "stateMutability": "view", + "payable": false, + "inputs": [], + "outputs": [ + { + "type": "uint256", + "name": "" + } + ] + }, + { + "type": "function", + "name": "borrow", + "constant": false, + "payable": false, + "inputs": [ + { + "type": "address", + "name": "asset" + }, + { + "type": "uint256", + "name": "amount" + }, + { + "type": "uint256", + "name": "interestRateMode" + }, + { + "type": "uint16", + "name": "referralCode" + }, + { + "type": "address", + "name": "onBehalfOf" + } + ], + "outputs": [] + }, + { + "type": "function", + "name": "deposit", + "constant": false, + "payable": false, + "inputs": [ + { + "type": "address", + "name": "asset" + }, + { + "type": "uint256", + "name": "amount" + }, + { + "type": "address", + "name": "onBehalfOf" + }, + { + "type": "uint16", + "name": "referralCode" + } + ], + "outputs": [] + }, + { + "type": "function", + "name": "finalizeTransfer", + "constant": false, + "payable": false, + "inputs": [ + { + "type": "address", + "name": "asset" + }, + { + "type": "address", + "name": "from" + }, + { + "type": "address", + "name": "to" + }, + { + "type": "uint256", + "name": "amount" + }, + { + "type": "uint256", + "name": "balanceFromBefore" + }, + { + "type": "uint256", + "name": "balanceToBefore" + } + ], + "outputs": [] + }, + { + "type": "function", + "name": "flashLoan", + "constant": false, + "payable": false, + "inputs": [ + { + "type": "address", + "name": "receiverAddress" + }, + { + "type": "address[]", + "name": "assets" + }, + { + "type": "uint256[]", + "name": "amounts" + }, + { + "type": "uint256[]", + "name": "modes" + }, + { + "type": "address", + "name": "onBehalfOf" + }, + { + "type": "bytes", + "name": "params" + }, + { + "type": "uint16", + "name": "referralCode" + } + ], + "outputs": [] + }, + { + "type": "function", + "name": "getAddressesProvider", + "constant": true, + "stateMutability": "view", + "payable": false, + "inputs": [], + "outputs": [ + { + "type": "address", + "name": "" + } + ] + }, + { + "type": "function", + "name": "getConfiguration", + "constant": true, + "stateMutability": "view", + "payable": false, + "inputs": [ + { + "type": "address", + "name": "asset" + } + ], + "outputs": [ + { + "type": "tuple", + "name": "", + "components": [ + { + "type": "uint256", + "name": "data" + } + ] + } + ] + }, + { + "type": "function", + "name": "getReserveData", + "constant": true, + "stateMutability": "view", + "payable": false, + "inputs": [ + { + "type": "address", + "name": "asset" + } + ], + "outputs": [ + { + "type": "tuple", + "name": "", + "components": [ + { + "type": "tuple", + "name": "configuration", + "components": [ + { + "type": "uint256", + "name": "data" + } + ] + }, + { + "type": "uint128", + "name": "liquidityIndex" + }, + { + "type": "uint128", + "name": "variableBorrowIndex" + }, + { + "type": "uint128", + "name": "currentLiquidityRate" + }, + { + "type": "uint128", + "name": "currentVariableBorrowRate" + }, + { + "type": "uint128", + "name": "currentStableBorrowRate" + }, + { + "type": "uint40", + "name": "lastUpdateTimestamp" + }, + { + "type": "address", + "name": "aTokenAddress" + }, + { + "type": "address", + "name": "stableDebtTokenAddress" + }, + { + "type": "address", + "name": "variableDebtTokenAddress" + }, + { + "type": "address", + "name": "interestRateStrategyAddress" + }, + { + "type": "uint8", + "name": "id" + } + ] + } + ] + }, + { + "type": "function", + "name": "getReserveNormalizedIncome", + "constant": true, + "stateMutability": "view", + "payable": false, + "inputs": [ + { + "type": "address", + "name": "asset" + } + ], + "outputs": [ + { + "type": "uint256", + "name": "" + } + ] + }, + { + "type": "function", + "name": "getReserveNormalizedVariableDebt", + "constant": true, + "stateMutability": "view", + "payable": false, + "inputs": [ + { + "type": "address", + "name": "asset" + } + ], + "outputs": [ + { + "type": "uint256", + "name": "" + } + ] + }, + { + "type": "function", + "name": "getReservesList", + "constant": true, + "stateMutability": "view", + "payable": false, + "inputs": [], + "outputs": [ + { + "type": "address[]", + "name": "" + } + ] + }, + { + "type": "function", + "name": "getUserAccountData", + "constant": true, + "stateMutability": "view", + "payable": false, + "inputs": [ + { + "type": "address", + "name": "user" + } + ], + "outputs": [ + { + "type": "uint256", + "name": "totalCollateralETH" + }, + { + "type": "uint256", + "name": "totalDebtETH" + }, + { + "type": "uint256", + "name": "availableBorrowsETH" + }, + { + "type": "uint256", + "name": "currentLiquidationThreshold" + }, + { + "type": "uint256", + "name": "ltv" + }, + { + "type": "uint256", + "name": "healthFactor" + } + ] + }, + { + "type": "function", + "name": "getUserConfiguration", + "constant": true, + "stateMutability": "view", + "payable": false, + "inputs": [ + { + "type": "address", + "name": "user" + } + ], + "outputs": [ + { + "type": "tuple", + "name": "", + "components": [ + { + "type": "uint256", + "name": "data" + } + ] + } + ] + }, + { + "type": "function", + "name": "initReserve", + "constant": false, + "payable": false, + "inputs": [ + { + "type": "address", + "name": "asset" + }, + { + "type": "address", + "name": "aTokenAddress" + }, + { + "type": "address", + "name": "stableDebtAddress" + }, + { + "type": "address", + "name": "variableDebtAddress" + }, + { + "type": "address", + "name": "interestRateStrategyAddress" + } + ], + "outputs": [] + }, + { + "type": "function", + "name": "initialize", + "constant": false, + "payable": false, + "inputs": [ + { + "type": "address", + "name": "provider" + } + ], + "outputs": [] + }, + { + "type": "function", + "name": "liquidationCall", + "constant": false, + "payable": false, + "inputs": [ + { + "type": "address", + "name": "collateralAsset" + }, + { + "type": "address", + "name": "debtAsset" + }, + { + "type": "address", + "name": "user" + }, + { + "type": "uint256", + "name": "debtToCover" + }, + { + "type": "bool", + "name": "receiveAToken" + } + ], + "outputs": [] + }, + { + "type": "function", + "name": "paused", + "constant": true, + "stateMutability": "view", + "payable": false, + "inputs": [], + "outputs": [ + { + "type": "bool", + "name": "" + } + ] + }, + { + "type": "function", + "name": "rebalanceStableBorrowRate", + "constant": false, + "payable": false, + "inputs": [ + { + "type": "address", + "name": "asset" + }, + { + "type": "address", + "name": "user" + } + ], + "outputs": [] + }, + { + "type": "function", + "name": "repay", + "constant": false, + "payable": false, + "inputs": [ + { + "type": "address", + "name": "asset" + }, + { + "type": "uint256", + "name": "amount" + }, + { + "type": "uint256", + "name": "rateMode" + }, + { + "type": "address", + "name": "onBehalfOf" + } + ], + "outputs": [ + { + "type": "uint256", + "name": "" + } + ] + }, + { + "type": "function", + "name": "rescueTokens", + "constant": false, + "payable": false, + "inputs": [ + { + "type": "address", + "name": "token" + }, + { + "type": "address", + "name": "to" + }, + { + "type": "uint256", + "name": "amount" + } + ], + "outputs": [] + }, + { + "type": "function", + "name": "setConfiguration", + "constant": false, + "payable": false, + "inputs": [ + { + "type": "address", + "name": "asset" + }, + { + "type": "uint256", + "name": "configuration" + } + ], + "outputs": [] + }, + { + "type": "function", + "name": "setPause", + "constant": false, + "payable": false, + "inputs": [ + { + "type": "bool", + "name": "val" + } + ], + "outputs": [] + }, + { + "type": "function", + "name": "setReserveInterestRateStrategyAddress", + "constant": false, + "payable": false, + "inputs": [ + { + "type": "address", + "name": "asset" + }, + { + "type": "address", + "name": "rateStrategyAddress" + } + ], + "outputs": [] + }, + { + "type": "function", + "name": "setUserUseReserveAsCollateral", + "constant": false, + "payable": false, + "inputs": [ + { + "type": "address", + "name": "asset" + }, + { + "type": "bool", + "name": "useAsCollateral" + } + ], + "outputs": [] + }, + { + "type": "function", + "name": "swapBorrowRateMode", + "constant": false, + "payable": false, + "inputs": [ + { + "type": "address", + "name": "asset" + }, + { + "type": "uint256", + "name": "rateMode" + } + ], + "outputs": [] + }, + { + "type": "function", + "name": "withdraw", + "constant": false, + "payable": false, + "inputs": [ + { + "type": "address", + "name": "asset" + }, + { + "type": "uint256", + "name": "amount" + }, + { + "type": "address", + "name": "to" + } + ], + "outputs": [ + { + "type": "uint256", + "name": "" + } + ] + } +] diff --git a/src/abi/aave-lending-pool.ts b/src/abi/aave-lending-pool.ts new file mode 100644 index 00000000..061cd3ff --- /dev/null +++ b/src/abi/aave-lending-pool.ts @@ -0,0 +1,195 @@ +import * as ethers from 'ethers' +import {LogEvent, Func, ContractBase} from './abi.support' +import {ABI_JSON} from './aave-lending-pool.abi' + +export const abi = new ethers.Interface(ABI_JSON); + +export const events = { + Borrow: new LogEvent<([reserve: string, user: string, onBehalfOf: string, amount: bigint, borrowRateMode: bigint, borrowRate: bigint, referral: number] & {reserve: string, user: string, onBehalfOf: string, amount: bigint, borrowRateMode: bigint, borrowRate: bigint, referral: number})>( + abi, '0xc6a898309e823ee50bac64e45ca8adba6690e99e7841c45d754e2a38e9019d9b' + ), + Deposit: new LogEvent<([reserve: string, user: string, onBehalfOf: string, amount: bigint, referral: number] & {reserve: string, user: string, onBehalfOf: string, amount: bigint, referral: number})>( + abi, '0xde6857219544bb5b7746f48ed30be6386fefc61b2f864cacf559893bf50fd951' + ), + FlashLoan: new LogEvent<([target: string, initiator: string, asset: string, amount: bigint, premium: bigint, referralCode: number] & {target: string, initiator: string, asset: string, amount: bigint, premium: bigint, referralCode: number})>( + abi, '0x631042c832b07452973831137f2d73e395028b44b250dedc5abb0ee766e168ac' + ), + LiquidationCall: new LogEvent<([collateralAsset: string, debtAsset: string, user: string, debtToCover: bigint, liquidatedCollateralAmount: bigint, liquidator: string, receiveAToken: boolean] & {collateralAsset: string, debtAsset: string, user: string, debtToCover: bigint, liquidatedCollateralAmount: bigint, liquidator: string, receiveAToken: boolean})>( + abi, '0xe413a321e8681d831f4dbccbca790d2952b56f977908e45be37335533e005286' + ), + Paused: new LogEvent<[]>( + abi, '0x9e87fac88ff661f02d44f95383c817fece4bce600a3dab7a54406878b965e752' + ), + RebalanceStableBorrowRate: new LogEvent<([reserve: string, user: string] & {reserve: string, user: string})>( + abi, '0x9f439ae0c81e41a04d3fdfe07aed54e6a179fb0db15be7702eb66fa8ef6f5300' + ), + Repay: new LogEvent<([reserve: string, user: string, repayer: string, amount: bigint] & {reserve: string, user: string, repayer: string, amount: bigint})>( + abi, '0x4cdde6e09bb755c9a5589ebaec640bbfedff1362d4b255ebf8339782b9942faa' + ), + ReserveDataUpdated: new LogEvent<([reserve: string, liquidityRate: bigint, stableBorrowRate: bigint, variableBorrowRate: bigint, liquidityIndex: bigint, variableBorrowIndex: bigint] & {reserve: string, liquidityRate: bigint, stableBorrowRate: bigint, variableBorrowRate: bigint, liquidityIndex: bigint, variableBorrowIndex: bigint})>( + abi, '0x804c9b842b2748a22bb64b345453a3de7ca54a6ca45ce00d415894979e22897a' + ), + ReserveUsedAsCollateralDisabled: new LogEvent<([reserve: string, user: string] & {reserve: string, user: string})>( + abi, '0x44c58d81365b66dd4b1a7f36c25aa97b8c71c361ee4937adc1a00000227db5dd' + ), + ReserveUsedAsCollateralEnabled: new LogEvent<([reserve: string, user: string] & {reserve: string, user: string})>( + abi, '0x00058a56ea94653cdf4f152d227ace22d4c00ad99e2a43f58cb7d9e3feb295f2' + ), + Swap: new LogEvent<([reserve: string, user: string, rateMode: bigint] & {reserve: string, user: string, rateMode: bigint})>( + abi, '0xea368a40e9570069bb8e6511d668293ad2e1f03b0d982431fd223de9f3b70ca6' + ), + TokensRescued: new LogEvent<([tokenRescued: string, receiver: string, amountRescued: bigint] & {tokenRescued: string, receiver: string, amountRescued: bigint})>( + abi, '0x77023e19c7343ad491fd706c36335ca0e738340a91f29b1fd81e2673d44896c4' + ), + Unpaused: new LogEvent<[]>( + abi, '0xa45f47fdea8a1efdd9029a5691c7f759c32b7c698632b563573e155625d16933' + ), + Withdraw: new LogEvent<([reserve: string, user: string, to: string, amount: bigint] & {reserve: string, user: string, to: string, amount: bigint})>( + abi, '0x3115d1449a7b732c986cba18244e897a450f61e1bb8d589cd2e69e6c8924f9f7' + ), +} + +export const functions = { + FLASHLOAN_PREMIUM_TOTAL: new Func<[], {}, bigint>( + abi, '0x074b2e43' + ), + LENDINGPOOL_REVISION: new Func<[], {}, bigint>( + abi, '0x8afaff02' + ), + MAX_NUMBER_RESERVES: new Func<[], {}, bigint>( + abi, '0xf8119d51' + ), + MAX_STABLE_RATE_BORROW_SIZE_PERCENT: new Func<[], {}, bigint>( + abi, '0xe82fec2f' + ), + borrow: new Func<[asset: string, amount: bigint, interestRateMode: bigint, referralCode: number, onBehalfOf: string], {asset: string, amount: bigint, interestRateMode: bigint, referralCode: number, onBehalfOf: string}, []>( + abi, '0xa415bcad' + ), + deposit: new Func<[asset: string, amount: bigint, onBehalfOf: string, referralCode: number], {asset: string, amount: bigint, onBehalfOf: string, referralCode: number}, []>( + abi, '0xe8eda9df' + ), + finalizeTransfer: new Func<[asset: string, from: string, to: string, amount: bigint, balanceFromBefore: bigint, balanceToBefore: bigint], {asset: string, from: string, to: string, amount: bigint, balanceFromBefore: bigint, balanceToBefore: bigint}, []>( + abi, '0xd5ed3933' + ), + flashLoan: new Func<[receiverAddress: string, assets: Array, amounts: Array, modes: Array, onBehalfOf: string, params: string, referralCode: number], {receiverAddress: string, assets: Array, amounts: Array, modes: Array, onBehalfOf: string, params: string, referralCode: number}, []>( + abi, '0xab9c4b5d' + ), + getAddressesProvider: new Func<[], {}, string>( + abi, '0xfe65acfe' + ), + getConfiguration: new Func<[asset: string], {asset: string}, ([data: bigint] & {data: bigint})>( + abi, '0xc44b11f7' + ), + getReserveData: new Func<[asset: string], {asset: string}, ([configuration: ([data: bigint] & {data: bigint}), liquidityIndex: bigint, variableBorrowIndex: bigint, currentLiquidityRate: bigint, currentVariableBorrowRate: bigint, currentStableBorrowRate: bigint, lastUpdateTimestamp: number, aTokenAddress: string, stableDebtTokenAddress: string, variableDebtTokenAddress: string, interestRateStrategyAddress: string, id: number] & {configuration: ([data: bigint] & {data: bigint}), liquidityIndex: bigint, variableBorrowIndex: bigint, currentLiquidityRate: bigint, currentVariableBorrowRate: bigint, currentStableBorrowRate: bigint, lastUpdateTimestamp: number, aTokenAddress: string, stableDebtTokenAddress: string, variableDebtTokenAddress: string, interestRateStrategyAddress: string, id: number})>( + abi, '0x35ea6a75' + ), + getReserveNormalizedIncome: new Func<[asset: string], {asset: string}, bigint>( + abi, '0xd15e0053' + ), + getReserveNormalizedVariableDebt: new Func<[asset: string], {asset: string}, bigint>( + abi, '0x386497fd' + ), + getReservesList: new Func<[], {}, Array>( + abi, '0xd1946dbc' + ), + getUserAccountData: new Func<[user: string], {user: string}, ([totalCollateralETH: bigint, totalDebtETH: bigint, availableBorrowsETH: bigint, currentLiquidationThreshold: bigint, ltv: bigint, healthFactor: bigint] & {totalCollateralETH: bigint, totalDebtETH: bigint, availableBorrowsETH: bigint, currentLiquidationThreshold: bigint, ltv: bigint, healthFactor: bigint})>( + abi, '0xbf92857c' + ), + getUserConfiguration: new Func<[user: string], {user: string}, ([data: bigint] & {data: bigint})>( + abi, '0x4417a583' + ), + initReserve: new Func<[asset: string, aTokenAddress: string, stableDebtAddress: string, variableDebtAddress: string, interestRateStrategyAddress: string], {asset: string, aTokenAddress: string, stableDebtAddress: string, variableDebtAddress: string, interestRateStrategyAddress: string}, []>( + abi, '0x7a708e92' + ), + initialize: new Func<[provider: string], {provider: string}, []>( + abi, '0xc4d66de8' + ), + liquidationCall: new Func<[collateralAsset: string, debtAsset: string, user: string, debtToCover: bigint, receiveAToken: boolean], {collateralAsset: string, debtAsset: string, user: string, debtToCover: bigint, receiveAToken: boolean}, []>( + abi, '0x00a718a9' + ), + paused: new Func<[], {}, boolean>( + abi, '0x5c975abb' + ), + rebalanceStableBorrowRate: new Func<[asset: string, user: string], {asset: string, user: string}, []>( + abi, '0xcd112382' + ), + repay: new Func<[asset: string, amount: bigint, rateMode: bigint, onBehalfOf: string], {asset: string, amount: bigint, rateMode: bigint, onBehalfOf: string}, bigint>( + abi, '0x573ade81' + ), + rescueTokens: new Func<[token: string, to: string, amount: bigint], {token: string, to: string, amount: bigint}, []>( + abi, '0xcea9d26f' + ), + setConfiguration: new Func<[asset: string, configuration: bigint], {asset: string, configuration: bigint}, []>( + abi, '0xb8d29276' + ), + setPause: new Func<[val: boolean], {val: boolean}, []>( + abi, '0xbedb86fb' + ), + setReserveInterestRateStrategyAddress: new Func<[asset: string, rateStrategyAddress: string], {asset: string, rateStrategyAddress: string}, []>( + abi, '0x1d2118f9' + ), + setUserUseReserveAsCollateral: new Func<[asset: string, useAsCollateral: boolean], {asset: string, useAsCollateral: boolean}, []>( + abi, '0x5a3b74b9' + ), + swapBorrowRateMode: new Func<[asset: string, rateMode: bigint], {asset: string, rateMode: bigint}, []>( + abi, '0x94ba89a2' + ), + withdraw: new Func<[asset: string, amount: bigint, to: string], {asset: string, amount: bigint, to: string}, bigint>( + abi, '0x69328dec' + ), +} + +export class Contract extends ContractBase { + + FLASHLOAN_PREMIUM_TOTAL(): Promise { + return this.eth_call(functions.FLASHLOAN_PREMIUM_TOTAL, []) + } + + LENDINGPOOL_REVISION(): Promise { + return this.eth_call(functions.LENDINGPOOL_REVISION, []) + } + + MAX_NUMBER_RESERVES(): Promise { + return this.eth_call(functions.MAX_NUMBER_RESERVES, []) + } + + MAX_STABLE_RATE_BORROW_SIZE_PERCENT(): Promise { + return this.eth_call(functions.MAX_STABLE_RATE_BORROW_SIZE_PERCENT, []) + } + + getAddressesProvider(): Promise { + return this.eth_call(functions.getAddressesProvider, []) + } + + getConfiguration(asset: string): Promise<([data: bigint] & {data: bigint})> { + return this.eth_call(functions.getConfiguration, [asset]) + } + + getReserveData(asset: string): Promise<([configuration: ([data: bigint] & {data: bigint}), liquidityIndex: bigint, variableBorrowIndex: bigint, currentLiquidityRate: bigint, currentVariableBorrowRate: bigint, currentStableBorrowRate: bigint, lastUpdateTimestamp: number, aTokenAddress: string, stableDebtTokenAddress: string, variableDebtTokenAddress: string, interestRateStrategyAddress: string, id: number] & {configuration: ([data: bigint] & {data: bigint}), liquidityIndex: bigint, variableBorrowIndex: bigint, currentLiquidityRate: bigint, currentVariableBorrowRate: bigint, currentStableBorrowRate: bigint, lastUpdateTimestamp: number, aTokenAddress: string, stableDebtTokenAddress: string, variableDebtTokenAddress: string, interestRateStrategyAddress: string, id: number})> { + return this.eth_call(functions.getReserveData, [asset]) + } + + getReserveNormalizedIncome(asset: string): Promise { + return this.eth_call(functions.getReserveNormalizedIncome, [asset]) + } + + getReserveNormalizedVariableDebt(asset: string): Promise { + return this.eth_call(functions.getReserveNormalizedVariableDebt, [asset]) + } + + getReservesList(): Promise> { + return this.eth_call(functions.getReservesList, []) + } + + getUserAccountData(user: string): Promise<([totalCollateralETH: bigint, totalDebtETH: bigint, availableBorrowsETH: bigint, currentLiquidationThreshold: bigint, ltv: bigint, healthFactor: bigint] & {totalCollateralETH: bigint, totalDebtETH: bigint, availableBorrowsETH: bigint, currentLiquidationThreshold: bigint, ltv: bigint, healthFactor: bigint})> { + return this.eth_call(functions.getUserAccountData, [user]) + } + + getUserConfiguration(user: string): Promise<([data: bigint] & {data: bigint})> { + return this.eth_call(functions.getUserConfiguration, [user]) + } + + paused(): Promise { + return this.eth_call(functions.paused, []) + } +} diff --git a/src/abi/aave-token.abi.ts b/src/abi/aave-token.abi.ts new file mode 100644 index 00000000..6c87ab0e --- /dev/null +++ b/src/abi/aave-token.abi.ts @@ -0,0 +1,825 @@ +export const ABI_JSON = [ + { + "type": "constructor", + "stateMutability": "undefined", + "payable": false, + "inputs": [ + { + "type": "address", + "name": "pool" + }, + { + "type": "address", + "name": "underlyingAssetAddress" + }, + { + "type": "address", + "name": "reserveTreasuryAddress" + }, + { + "type": "string", + "name": "tokenName" + }, + { + "type": "string", + "name": "tokenSymbol" + }, + { + "type": "address", + "name": "incentivesController" + } + ] + }, + { + "type": "event", + "anonymous": false, + "name": "Approval", + "inputs": [ + { + "type": "address", + "name": "owner", + "indexed": true + }, + { + "type": "address", + "name": "spender", + "indexed": true + }, + { + "type": "uint256", + "name": "value", + "indexed": false + } + ] + }, + { + "type": "event", + "anonymous": false, + "name": "BalanceTransfer", + "inputs": [ + { + "type": "address", + "name": "from", + "indexed": true + }, + { + "type": "address", + "name": "to", + "indexed": true + }, + { + "type": "uint256", + "name": "value", + "indexed": false + }, + { + "type": "uint256", + "name": "index", + "indexed": false + } + ] + }, + { + "type": "event", + "anonymous": false, + "name": "Burn", + "inputs": [ + { + "type": "address", + "name": "from", + "indexed": true + }, + { + "type": "address", + "name": "target", + "indexed": true + }, + { + "type": "uint256", + "name": "value", + "indexed": false + }, + { + "type": "uint256", + "name": "index", + "indexed": false + } + ] + }, + { + "type": "event", + "anonymous": false, + "name": "Initialized", + "inputs": [ + { + "type": "address", + "name": "underlyingAsset", + "indexed": true + }, + { + "type": "address", + "name": "pool", + "indexed": true + }, + { + "type": "address", + "name": "treasury", + "indexed": false + }, + { + "type": "address", + "name": "incentivesController", + "indexed": false + }, + { + "type": "uint8", + "name": "aTokenDecimals", + "indexed": false + }, + { + "type": "string", + "name": "aTokenName", + "indexed": false + }, + { + "type": "string", + "name": "aTokenSymbol", + "indexed": false + }, + { + "type": "bytes", + "name": "params", + "indexed": false + } + ] + }, + { + "type": "event", + "anonymous": false, + "name": "Mint", + "inputs": [ + { + "type": "address", + "name": "from", + "indexed": true + }, + { + "type": "uint256", + "name": "value", + "indexed": false + }, + { + "type": "uint256", + "name": "index", + "indexed": false + } + ] + }, + { + "type": "event", + "anonymous": false, + "name": "TokensRescued", + "inputs": [ + { + "type": "address", + "name": "tokenRescued", + "indexed": true + }, + { + "type": "address", + "name": "receiver", + "indexed": true + }, + { + "type": "uint256", + "name": "amountRescued", + "indexed": false + } + ] + }, + { + "type": "event", + "anonymous": false, + "name": "Transfer", + "inputs": [ + { + "type": "address", + "name": "from", + "indexed": true + }, + { + "type": "address", + "name": "to", + "indexed": true + }, + { + "type": "uint256", + "name": "value", + "indexed": false + } + ] + }, + { + "type": "function", + "name": "ATOKEN_REVISION", + "constant": true, + "stateMutability": "view", + "payable": false, + "inputs": [], + "outputs": [ + { + "type": "uint256", + "name": "" + } + ] + }, + { + "type": "function", + "name": "DOMAIN_SEPARATOR", + "constant": true, + "stateMutability": "view", + "payable": false, + "inputs": [], + "outputs": [ + { + "type": "bytes32", + "name": "" + } + ] + }, + { + "type": "function", + "name": "EIP712_REVISION", + "constant": true, + "stateMutability": "view", + "payable": false, + "inputs": [], + "outputs": [ + { + "type": "bytes", + "name": "" + } + ] + }, + { + "type": "function", + "name": "PERMIT_TYPEHASH", + "constant": true, + "stateMutability": "view", + "payable": false, + "inputs": [], + "outputs": [ + { + "type": "bytes32", + "name": "" + } + ] + }, + { + "type": "function", + "name": "POOL", + "constant": true, + "stateMutability": "view", + "payable": false, + "inputs": [], + "outputs": [ + { + "type": "address", + "name": "" + } + ] + }, + { + "type": "function", + "name": "RESERVE_TREASURY_ADDRESS", + "constant": true, + "stateMutability": "view", + "payable": false, + "inputs": [], + "outputs": [ + { + "type": "address", + "name": "" + } + ] + }, + { + "type": "function", + "name": "UINT_MAX_VALUE", + "constant": true, + "stateMutability": "view", + "payable": false, + "inputs": [], + "outputs": [ + { + "type": "uint256", + "name": "" + } + ] + }, + { + "type": "function", + "name": "UNDERLYING_ASSET_ADDRESS", + "constant": true, + "stateMutability": "view", + "payable": false, + "inputs": [], + "outputs": [ + { + "type": "address", + "name": "" + } + ] + }, + { + "type": "function", + "name": "_nonces", + "constant": true, + "stateMutability": "view", + "payable": false, + "inputs": [ + { + "type": "address", + "name": "" + } + ], + "outputs": [ + { + "type": "uint256", + "name": "" + } + ] + }, + { + "type": "function", + "name": "allowance", + "constant": true, + "stateMutability": "view", + "payable": false, + "inputs": [ + { + "type": "address", + "name": "owner" + }, + { + "type": "address", + "name": "spender" + } + ], + "outputs": [ + { + "type": "uint256", + "name": "" + } + ] + }, + { + "type": "function", + "name": "approve", + "constant": false, + "payable": false, + "inputs": [ + { + "type": "address", + "name": "spender" + }, + { + "type": "uint256", + "name": "amount" + } + ], + "outputs": [ + { + "type": "bool", + "name": "" + } + ] + }, + { + "type": "function", + "name": "balanceOf", + "constant": true, + "stateMutability": "view", + "payable": false, + "inputs": [ + { + "type": "address", + "name": "user" + } + ], + "outputs": [ + { + "type": "uint256", + "name": "" + } + ] + }, + { + "type": "function", + "name": "burn", + "constant": false, + "payable": false, + "inputs": [ + { + "type": "address", + "name": "user" + }, + { + "type": "address", + "name": "receiverOfUnderlying" + }, + { + "type": "uint256", + "name": "amount" + }, + { + "type": "uint256", + "name": "index" + } + ], + "outputs": [] + }, + { + "type": "function", + "name": "decimals", + "constant": true, + "stateMutability": "view", + "payable": false, + "inputs": [], + "outputs": [ + { + "type": "uint8", + "name": "" + } + ] + }, + { + "type": "function", + "name": "decreaseAllowance", + "constant": false, + "payable": false, + "inputs": [ + { + "type": "address", + "name": "spender" + }, + { + "type": "uint256", + "name": "subtractedValue" + } + ], + "outputs": [ + { + "type": "bool", + "name": "" + } + ] + }, + { + "type": "function", + "name": "getIncentivesController", + "constant": true, + "stateMutability": "view", + "payable": false, + "inputs": [], + "outputs": [ + { + "type": "address", + "name": "" + } + ] + }, + { + "type": "function", + "name": "getScaledUserBalanceAndSupply", + "constant": true, + "stateMutability": "view", + "payable": false, + "inputs": [ + { + "type": "address", + "name": "user" + } + ], + "outputs": [ + { + "type": "uint256", + "name": "" + }, + { + "type": "uint256", + "name": "" + } + ] + }, + { + "type": "function", + "name": "increaseAllowance", + "constant": false, + "payable": false, + "inputs": [ + { + "type": "address", + "name": "spender" + }, + { + "type": "uint256", + "name": "addedValue" + } + ], + "outputs": [ + { + "type": "bool", + "name": "" + } + ] + }, + { + "type": "function", + "name": "initialize", + "constant": false, + "payable": false, + "inputs": [ + { + "type": "uint8", + "name": "underlyingAssetDecimals" + }, + { + "type": "string", + "name": "tokenName" + }, + { + "type": "string", + "name": "tokenSymbol" + } + ], + "outputs": [] + }, + { + "type": "function", + "name": "mint", + "constant": false, + "payable": false, + "inputs": [ + { + "type": "address", + "name": "user" + }, + { + "type": "uint256", + "name": "amount" + }, + { + "type": "uint256", + "name": "index" + } + ], + "outputs": [ + { + "type": "bool", + "name": "" + } + ] + }, + { + "type": "function", + "name": "mintToTreasury", + "constant": false, + "payable": false, + "inputs": [ + { + "type": "uint256", + "name": "amount" + }, + { + "type": "uint256", + "name": "index" + } + ], + "outputs": [] + }, + { + "type": "function", + "name": "name", + "constant": true, + "stateMutability": "view", + "payable": false, + "inputs": [], + "outputs": [ + { + "type": "string", + "name": "" + } + ] + }, + { + "type": "function", + "name": "permit", + "constant": false, + "payable": false, + "inputs": [ + { + "type": "address", + "name": "owner" + }, + { + "type": "address", + "name": "spender" + }, + { + "type": "uint256", + "name": "value" + }, + { + "type": "uint256", + "name": "deadline" + }, + { + "type": "uint8", + "name": "v" + }, + { + "type": "bytes32", + "name": "r" + }, + { + "type": "bytes32", + "name": "s" + } + ], + "outputs": [] + }, + { + "type": "function", + "name": "rescueTokens", + "constant": false, + "payable": false, + "inputs": [ + { + "type": "address", + "name": "token" + }, + { + "type": "address", + "name": "to" + }, + { + "type": "uint256", + "name": "amount" + } + ], + "outputs": [] + }, + { + "type": "function", + "name": "scaledBalanceOf", + "constant": true, + "stateMutability": "view", + "payable": false, + "inputs": [ + { + "type": "address", + "name": "user" + } + ], + "outputs": [ + { + "type": "uint256", + "name": "" + } + ] + }, + { + "type": "function", + "name": "scaledTotalSupply", + "constant": true, + "stateMutability": "view", + "payable": false, + "inputs": [], + "outputs": [ + { + "type": "uint256", + "name": "" + } + ] + }, + { + "type": "function", + "name": "symbol", + "constant": true, + "stateMutability": "view", + "payable": false, + "inputs": [], + "outputs": [ + { + "type": "string", + "name": "" + } + ] + }, + { + "type": "function", + "name": "totalSupply", + "constant": true, + "stateMutability": "view", + "payable": false, + "inputs": [], + "outputs": [ + { + "type": "uint256", + "name": "" + } + ] + }, + { + "type": "function", + "name": "transfer", + "constant": false, + "payable": false, + "inputs": [ + { + "type": "address", + "name": "recipient" + }, + { + "type": "uint256", + "name": "amount" + } + ], + "outputs": [ + { + "type": "bool", + "name": "" + } + ] + }, + { + "type": "function", + "name": "transferFrom", + "constant": false, + "payable": false, + "inputs": [ + { + "type": "address", + "name": "sender" + }, + { + "type": "address", + "name": "recipient" + }, + { + "type": "uint256", + "name": "amount" + } + ], + "outputs": [ + { + "type": "bool", + "name": "" + } + ] + }, + { + "type": "function", + "name": "transferOnLiquidation", + "constant": false, + "payable": false, + "inputs": [ + { + "type": "address", + "name": "from" + }, + { + "type": "address", + "name": "to" + }, + { + "type": "uint256", + "name": "value" + } + ], + "outputs": [] + }, + { + "type": "function", + "name": "transferUnderlyingTo", + "constant": false, + "payable": false, + "inputs": [ + { + "type": "address", + "name": "target" + }, + { + "type": "uint256", + "name": "amount" + } + ], + "outputs": [ + { + "type": "uint256", + "name": "" + } + ] + } +] diff --git a/src/abi/aave-token.ts b/src/abi/aave-token.ts new file mode 100644 index 00000000..ef8c5d94 --- /dev/null +++ b/src/abi/aave-token.ts @@ -0,0 +1,207 @@ +import * as ethers from 'ethers' +import {LogEvent, Func, ContractBase} from './abi.support' +import {ABI_JSON} from './aave-token.abi' + +export const abi = new ethers.Interface(ABI_JSON); + +export const events = { + Approval: new LogEvent<([owner: string, spender: string, value: bigint] & {owner: string, spender: string, value: bigint})>( + abi, '0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925' + ), + BalanceTransfer: new LogEvent<([from: string, to: string, value: bigint, index: bigint] & {from: string, to: string, value: bigint, index: bigint})>( + abi, '0x4beccb90f994c31aced7a23b5611020728a23d8ec5cddd1a3e9d97b96fda8666' + ), + Burn: new LogEvent<([from: string, target: string, value: bigint, index: bigint] & {from: string, target: string, value: bigint, index: bigint})>( + abi, '0x5d624aa9c148153ab3446c1b154f660ee7701e549fe9b62dab7171b1c80e6fa2' + ), + Initialized: new LogEvent<([underlyingAsset: string, pool: string, treasury: string, incentivesController: string, aTokenDecimals: number, aTokenName: string, aTokenSymbol: string, params: string] & {underlyingAsset: string, pool: string, treasury: string, incentivesController: string, aTokenDecimals: number, aTokenName: string, aTokenSymbol: string, params: string})>( + abi, '0xb19e051f8af41150ccccb3fc2c2d8d15f4a4cf434f32a559ba75fe73d6eea20b' + ), + Mint: new LogEvent<([from: string, value: bigint, index: bigint] & {from: string, value: bigint, index: bigint})>( + abi, '0x4c209b5fc8ad50758f13e2e1088ba56a560dff690a1c6fef26394f4c03821c4f' + ), + TokensRescued: new LogEvent<([tokenRescued: string, receiver: string, amountRescued: bigint] & {tokenRescued: string, receiver: string, amountRescued: bigint})>( + abi, '0x77023e19c7343ad491fd706c36335ca0e738340a91f29b1fd81e2673d44896c4' + ), + Transfer: new LogEvent<([from: string, to: string, value: bigint] & {from: string, to: string, value: bigint})>( + abi, '0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef' + ), +} + +export const functions = { + ATOKEN_REVISION: new Func<[], {}, bigint>( + abi, '0x0bd7ad3b' + ), + DOMAIN_SEPARATOR: new Func<[], {}, string>( + abi, '0x3644e515' + ), + EIP712_REVISION: new Func<[], {}, string>( + abi, '0x78160376' + ), + PERMIT_TYPEHASH: new Func<[], {}, string>( + abi, '0x30adf81f' + ), + POOL: new Func<[], {}, string>( + abi, '0x7535d246' + ), + RESERVE_TREASURY_ADDRESS: new Func<[], {}, string>( + abi, '0xae167335' + ), + UINT_MAX_VALUE: new Func<[], {}, bigint>( + abi, '0xd0fc81d2' + ), + UNDERLYING_ASSET_ADDRESS: new Func<[], {}, string>( + abi, '0xb16a19de' + ), + _nonces: new Func<[_: string], {}, bigint>( + abi, '0xb9844d8d' + ), + allowance: new Func<[owner: string, spender: string], {owner: string, spender: string}, bigint>( + abi, '0xdd62ed3e' + ), + approve: new Func<[spender: string, amount: bigint], {spender: string, amount: bigint}, boolean>( + abi, '0x095ea7b3' + ), + balanceOf: new Func<[user: string], {user: string}, bigint>( + abi, '0x70a08231' + ), + burn: new Func<[user: string, receiverOfUnderlying: string, amount: bigint, index: bigint], {user: string, receiverOfUnderlying: string, amount: bigint, index: bigint}, []>( + abi, '0xd7020d0a' + ), + decimals: new Func<[], {}, number>( + abi, '0x313ce567' + ), + decreaseAllowance: new Func<[spender: string, subtractedValue: bigint], {spender: string, subtractedValue: bigint}, boolean>( + abi, '0xa457c2d7' + ), + getIncentivesController: new Func<[], {}, string>( + abi, '0x75d26413' + ), + getScaledUserBalanceAndSupply: new Func<[user: string], {user: string}, [_: bigint, _: bigint]>( + abi, '0x0afbcdc9' + ), + increaseAllowance: new Func<[spender: string, addedValue: bigint], {spender: string, addedValue: bigint}, boolean>( + abi, '0x39509351' + ), + initialize: new Func<[underlyingAssetDecimals: number, tokenName: string, tokenSymbol: string], {underlyingAssetDecimals: number, tokenName: string, tokenSymbol: string}, []>( + abi, '0x3118724e' + ), + mint: new Func<[user: string, amount: bigint, index: bigint], {user: string, amount: bigint, index: bigint}, boolean>( + abi, '0x156e29f6' + ), + mintToTreasury: new Func<[amount: bigint, index: bigint], {amount: bigint, index: bigint}, []>( + abi, '0x7df5bd3b' + ), + name: new Func<[], {}, string>( + abi, '0x06fdde03' + ), + permit: new Func<[owner: string, spender: string, value: bigint, deadline: bigint, v: number, r: string, s: string], {owner: string, spender: string, value: bigint, deadline: bigint, v: number, r: string, s: string}, []>( + abi, '0xd505accf' + ), + rescueTokens: new Func<[token: string, to: string, amount: bigint], {token: string, to: string, amount: bigint}, []>( + abi, '0xcea9d26f' + ), + scaledBalanceOf: new Func<[user: string], {user: string}, bigint>( + abi, '0x1da24f3e' + ), + scaledTotalSupply: new Func<[], {}, bigint>( + abi, '0xb1bf962d' + ), + symbol: new Func<[], {}, string>( + abi, '0x95d89b41' + ), + totalSupply: new Func<[], {}, bigint>( + abi, '0x18160ddd' + ), + transfer: new Func<[recipient: string, amount: bigint], {recipient: string, amount: bigint}, boolean>( + abi, '0xa9059cbb' + ), + transferFrom: new Func<[sender: string, recipient: string, amount: bigint], {sender: string, recipient: string, amount: bigint}, boolean>( + abi, '0x23b872dd' + ), + transferOnLiquidation: new Func<[from: string, to: string, value: bigint], {from: string, to: string, value: bigint}, []>( + abi, '0xf866c319' + ), + transferUnderlyingTo: new Func<[target: string, amount: bigint], {target: string, amount: bigint}, bigint>( + abi, '0x4efecaa5' + ), +} + +export class Contract extends ContractBase { + + ATOKEN_REVISION(): Promise { + return this.eth_call(functions.ATOKEN_REVISION, []) + } + + DOMAIN_SEPARATOR(): Promise { + return this.eth_call(functions.DOMAIN_SEPARATOR, []) + } + + EIP712_REVISION(): Promise { + return this.eth_call(functions.EIP712_REVISION, []) + } + + PERMIT_TYPEHASH(): Promise { + return this.eth_call(functions.PERMIT_TYPEHASH, []) + } + + POOL(): Promise { + return this.eth_call(functions.POOL, []) + } + + RESERVE_TREASURY_ADDRESS(): Promise { + return this.eth_call(functions.RESERVE_TREASURY_ADDRESS, []) + } + + UINT_MAX_VALUE(): Promise { + return this.eth_call(functions.UINT_MAX_VALUE, []) + } + + UNDERLYING_ASSET_ADDRESS(): Promise { + return this.eth_call(functions.UNDERLYING_ASSET_ADDRESS, []) + } + + _nonces(arg0: string): Promise { + return this.eth_call(functions._nonces, [arg0]) + } + + allowance(owner: string, spender: string): Promise { + return this.eth_call(functions.allowance, [owner, spender]) + } + + balanceOf(user: string): Promise { + return this.eth_call(functions.balanceOf, [user]) + } + + decimals(): Promise { + return this.eth_call(functions.decimals, []) + } + + getIncentivesController(): Promise { + return this.eth_call(functions.getIncentivesController, []) + } + + getScaledUserBalanceAndSupply(user: string): Promise<[_: bigint, _: bigint]> { + return this.eth_call(functions.getScaledUserBalanceAndSupply, [user]) + } + + name(): Promise { + return this.eth_call(functions.name, []) + } + + scaledBalanceOf(user: string): Promise { + return this.eth_call(functions.scaledBalanceOf, [user]) + } + + scaledTotalSupply(): Promise { + return this.eth_call(functions.scaledTotalSupply, []) + } + + symbol(): Promise { + return this.eth_call(functions.symbol, []) + } + + totalSupply(): Promise { + return this.eth_call(functions.totalSupply, []) + } +} diff --git a/src/main-ousd.ts b/src/main-ousd.ts index 61ff8768..79b3dd40 100644 --- a/src/main-ousd.ts +++ b/src/main-ousd.ts @@ -1,10 +1,14 @@ import * as ousd from './ousd/processors/ousd' +import * as strategies from './ousd/processors/strategies/strategies' import { run } from './processor' import * as exchangeRates from './shared/post-processors/exchange-rates' run({ stateSchema: 'ousd-processor', - processors: [ousd], + processors: [ + // ousd, + strategies, + ], postProcessors: [exchangeRates], validators: [], }) diff --git a/src/oeth/processors/strategies/strategies.ts b/src/oeth/processors/strategies/strategies.ts index fdc1dc6b..45c0d384 100644 --- a/src/oeth/processors/strategies/strategies.ts +++ b/src/oeth/processors/strategies/strategies.ts @@ -2,6 +2,7 @@ import { EvmBatchProcessor } from '@subsquid/evm-processor' import { OETHRewardTokenCollected } from '../../../model' import { Context } from '../../../processor' +import { currencies } from '../../../shared/post-processors/exchange-rates/currencies' import { IStrategyData, createStrategyProcessor, @@ -29,7 +30,11 @@ export const oethStrategies: readonly IStrategyData[] = [ poolAddress: '0x94b17476a93b3262d87b9a326965d1e91f9c13e7', rewardsPoolAddress: '0x24b65dc1cf053a8d96872c323d29e86ec43eb33a', }, - assets: [WETH_ADDRESS, OETH_ADDRESS], + base: { address: currencies.ETH, decimals: 18 }, + assets: [WETH_ADDRESS, OETH_ADDRESS].map((address) => ({ + address, + decimals: 18, + })), earnings: { rewardTokenCollected: true, passiveByDepositWithdrawal: true }, }, { @@ -38,7 +43,8 @@ export const oethStrategies: readonly IStrategyData[] = [ contractName: 'FraxETHStrategy', address: '0x3ff8654d633d4ea0fae24c52aec73b4a20d0d0e5', kind: 'Generic', - assets: [FRXETH_ADDRESS], + base: { address: currencies.ETH, decimals: 18 }, + assets: [FRXETH_ADDRESS].map((address) => ({ address, decimals: 18 })), earnings: { passiveByDepositWithdrawal: true, rewardTokenCollected: true }, }, { @@ -47,7 +53,8 @@ export const oethStrategies: readonly IStrategyData[] = [ contractName: 'MorphoAaveStrategy', address: '0xc1fc9e5ec3058921ea5025d703cbe31764756319', kind: 'Generic', - assets: [WETH_ADDRESS], + base: { address: currencies.ETH, decimals: 18 }, + assets: [WETH_ADDRESS].map((address) => ({ address, decimals: 18 })), earnings: { passiveByDepositWithdrawal: true, rewardTokenCollected: true }, }, // { @@ -56,7 +63,8 @@ export const oethStrategies: readonly IStrategyData[] = [ // contractName: 'BalancerMetaPoolStrategy', // address: '0x49109629ac1deb03f2e9b2fe2ac4a623e0e7dfdc', // kind: 'BalancerMetaStablePool', - // assets: [WETH_ADDRESS, RETH_ADDRESS], + // base: { address: currencies.ETH, decimals: 18}, + // assets: [WETH_ADDRESS, RETH_ADDRESS].map(address => ({address, decimals: 18})), // earnings: { rewardTokenCollected: true, passiveByDepositWithdrawal: true }, // balancerPoolInfo: { // poolId: @@ -64,7 +72,7 @@ export const oethStrategies: readonly IStrategyData[] = [ // poolAddress: '0x1e19cf2d73a72ef1332c882f20534b6519be0276', // }, // }, -] as const +] const strategies = oethStrategies diff --git a/src/ousd/processors/ousd/ousd.ts b/src/ousd/processors/ousd/ousd.ts index 67912d7c..e6fc4bdb 100644 --- a/src/ousd/processors/ousd/ousd.ts +++ b/src/ousd/processors/ousd/ousd.ts @@ -13,7 +13,7 @@ import { import { OUSD_ADDRESS, OUSD_VAULT_ADDRESS } from '../../../utils/addresses' // export const from = 10884563 // https://etherscan.io/tx/0x9141921f5ebf072e58c00fe56332b6bee0c02f0ae4f54c42999b8a3a88662681 -export const from = 11585978 // OUSDReset - Has issues with archive queries. :( +export const from = 11585978 // OUSDReset // export const from = 13533937 // https://etherscan.io/tx/0xc9b6fc6a4fad18dad197ff7d0636f74bf066671d75656849a1c45122e00d54cf export const setup = createOTokenSetup({ diff --git a/src/ousd/processors/strategies/aave-strategy.ts b/src/ousd/processors/strategies/aave-strategy.ts new file mode 100644 index 00000000..2d2310db --- /dev/null +++ b/src/ousd/processors/strategies/aave-strategy.ts @@ -0,0 +1,39 @@ +import { pad as viemPad } from 'viem' + +import * as aaveLendingPool from '../../../abi/aave-lending-pool' +import { currencies } from '../../../shared/post-processors/exchange-rates/currencies' +import { IStrategyData } from '../../../shared/processor-templates/strategy' +import { logFilter } from '../../../utils/logFilter' +import { DAI, USDT } from './const' + +export const aaveStrategy: IStrategyData = { + from: 14206832, // 13369326, Initial Deploy + kind: 'Generic', + name: 'OUSD Aave', + contractName: 'AaveStrategy', + address: '0x5e3646a1db86993f73e6b74a57d8640b69f7e259'.toLowerCase(), + base: { address: currencies.USD, decimals: 18 }, + assets: [DAI, USDT], + balanceUpdateFilters: [], + earnings: { passiveByDepositWithdrawal: true, rewardTokenCollected: true }, +} + +const balanceUpdateFilters: IStrategyData['balanceUpdateFilters'] = [] +aaveStrategy.balanceUpdateFilters = balanceUpdateFilters + +const lendingPoolAddress = + '0x7d2768dE32b0b80b7a3454c06BdAc94A69DDc7A9'.toLowerCase() + +const pad = (hex: string) => viemPad(hex as `0x${string}`) + +balanceUpdateFilters.push( + logFilter({ + address: [lendingPoolAddress], + topic0: [ + aaveLendingPool.events.Deposit.topic, + aaveLendingPool.events.Withdraw.topic, + ], + topic1: [DAI, USDT].map((a) => pad(a.address)), + topic2: [pad(aaveStrategy.address)], + }), +) diff --git a/src/ousd/processors/strategies/const.ts b/src/ousd/processors/strategies/const.ts new file mode 100644 index 00000000..d19eddea --- /dev/null +++ b/src/ousd/processors/strategies/const.ts @@ -0,0 +1,12 @@ +export const DAI = { + address: '0x6b175474e89094c44da98b954eedeac495271d0f'.toLowerCase(), + decimals: 18, +} +export const USDT = { + address: '0xdac17f958d2ee523a2206206994597c13d831ec7'.toLowerCase(), + decimals: 6, +} +export const USDC = { + address: '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48'.toLowerCase(), + decimals: 6, +} diff --git a/src/ousd/processors/strategies/index.ts b/src/ousd/processors/strategies/index.ts new file mode 100644 index 00000000..dc043c0f --- /dev/null +++ b/src/ousd/processors/strategies/index.ts @@ -0,0 +1 @@ +export * from './strategies' diff --git a/src/ousd/processors/strategies/strategies.ts b/src/ousd/processors/strategies/strategies.ts new file mode 100644 index 00000000..04e49109 --- /dev/null +++ b/src/ousd/processors/strategies/strategies.ts @@ -0,0 +1,131 @@ +import { EvmBatchProcessor } from '@subsquid/evm-processor' +import { pad } from 'viem' + +import * as aaveLendingPool from '../../../abi/aave-lending-pool' +import * as aToken from '../../../abi/aave-token' +import { OETHRewardTokenCollected } from '../../../model' +import { Context } from '../../../processor' +import { currencies } from '../../../shared/post-processors/exchange-rates/currencies' +import { + IStrategyData, + createStrategyProcessor, + createStrategySetup, +} from '../../../shared/processor-templates/strategy' +import { + createStrategyRewardProcessor, + createStrategyRewardSetup, +} from '../../../shared/processor-templates/strategy-rewards' +import { logFilter } from '../../../utils/logFilter' +import { aaveStrategy } from './aave-strategy' + +const DAI = { + address: '0x6b175474e89094c44da98b954eedeac495271d0f'.toLowerCase(), + decimals: 18, +} +const USDT = { + address: '0xdac17f958d2ee523a2206206994597c13d831ec7'.toLowerCase(), + decimals: 6, +} +const USDC = { + address: '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48'.toLowerCase(), + decimals: 6, +} + +const ousdStrategies: readonly IStrategyData[] = [ + // aaveStrategy, + { + from: 15896478, + kind: 'CurveAMO', + name: 'OUSD Convex OUSD+3Crv (AMO)', + contractName: 'ConvexOUSDMetaStrategy', + address: '0x89eb88fedc50fc77ae8a18aad1ca0ac27f777a90'.toLowerCase(), + base: { address: currencies.USD, decimals: 18 }, + assets: [DAI, USDT, USDC], + earnings: { passiveByDepositWithdrawal: true, rewardTokenCollected: true }, + curvePoolInfo: { + poolAddress: '0xbEbc44782C7dB0a1A60Cb6fe97d0b483032FF1C7'.toLowerCase(), + rewardsPoolAddress: + '0x7D536a737C13561e0D2Decf1152a653B4e615158'.toLowerCase(), + }, + }, + // { + // from: 15949661, + // kind: 'Generic', + // name: 'OUSD Morpho Compound', + // contractName: 'MorphoCompoundStrategy', + // address: '0x5a4eee58744d1430876d5ca93cab5ccb763c037d'.toLowerCase(), + // base: { address: currencies.USD, decimals: 18 }, + // assets: [DAI, USDT, USDC], + // earnings: { passiveByDepositWithdrawal: true, rewardTokenCollected: true }, + // }, + // { + // from: 16331911, + // kind: 'Generic', + // name: 'OUSD Morpho Aave', + // contractName: 'MorphoAaveStrategy', + // address: '0x79F2188EF9350A1dC11A062cca0abE90684b0197'.toLowerCase(), + // base: { address: currencies.USD, decimals: 18 }, + // assets: [DAI, USDT, USDC], + // earnings: { passiveByDepositWithdrawal: true, rewardTokenCollected: true }, + // }, + // { + // from: 17877308, + // kind: 'Generic', + // name: 'OUSD Flux', + // contractName: 'FluxStrategy', + // address: '0x76Bf500B6305Dc4ea851384D3d5502f1C7a0ED44'.toLowerCase(), + // base: { address: currencies.USD, decimals: 18 }, + // assets: [DAI, USDT, USDC], + // earnings: { passiveByDepositWithdrawal: true, rewardTokenCollected: true }, + // }, + // { + // from: 17883036, + // kind: 'Generic', + // name: 'OUSD Maker DSR', + // contractName: 'Generalized4626Strategy', + // address: '0x6b69B755C629590eD59618A2712d8a2957CA98FC'.toLowerCase(), + // base: { address: currencies.USD, decimals: 18 }, + // assets: [DAI, USDT, USDC], + // earnings: { passiveByDepositWithdrawal: true, rewardTokenCollected: true }, + // }, + + // Deprecated + // { + // from: 13369299, + // name: 'CompoundStrategy', + // address: '0x9c459eeb3fa179a40329b81c1635525e9a0ef094'.toLowerCase(), + // }, + // { + // from: 13639477, + // name: 'ConvexStrategy', + // address: '0xea2ef2e2e5a749d4a66b41db9ad85a38aa264cb3'.toLowerCase(), + // }, + // { + // from: 16226229, + // name: 'LUSDMetaStrategy', + // address: '0x7A192DD9Cc4Ea9bdEdeC9992df74F1DA55e60a19'.toLowerCase(), + // }, +] + +const strategies = ousdStrategies + +export const from = Math.min(...strategies.map((s) => s.from)) + +export const setup = (processor: EvmBatchProcessor) => { + strategies.forEach((s) => createStrategySetup(s)(processor)) + strategies.forEach((s) => createStrategyRewardSetup(s)(processor)) +} + +const processors = [ + ...strategies.map(createStrategyProcessor), + ...strategies.map((strategy) => + createStrategyRewardProcessor({ + ...strategy, + OTokenRewardTokenCollected: OETHRewardTokenCollected, + }), + ), +] + +export const process = async (ctx: Context) => { + await Promise.all(processors.map((p) => p(ctx))) +} diff --git a/src/shared/processor-templates/strategy/strategy-curve-amo.ts b/src/shared/processor-templates/strategy/strategy-curve-amo.ts index 7454eaf8..93c154db 100644 --- a/src/shared/processor-templates/strategy/strategy-curve-amo.ts +++ b/src/shared/processor-templates/strategy/strategy-curve-amo.ts @@ -97,7 +97,7 @@ export const getStrategyBalances = async ( } if (coin != OETH_ADDRESS) { - const pTokenAddr = await strategy.assetToPToken(assets[i]) + const pTokenAddr = await strategy.assetToPToken(assets[i].address) const pToken = new erc20.Contract(ctx, block, pTokenAddr) unstakedBalance += await pToken.balanceOf(address) } diff --git a/src/shared/processor-templates/strategy/strategy-daily-earnings.ts b/src/shared/processor-templates/strategy/strategy-daily-earnings.ts index 7ff1b71c..c7a77c2e 100644 --- a/src/shared/processor-templates/strategy/strategy-daily-earnings.ts +++ b/src/shared/processor-templates/strategy/strategy-daily-earnings.ts @@ -4,7 +4,6 @@ import { parseEther } from 'viem' import { StrategyDailyYield, StrategyYield } from '../../../model' import { Block, Context } from '../../../processor' -import { ETH_ADDRESS } from '../../../utils/addresses' import { calculateAPY } from '../../../utils/calculateAPY' import { lastExcept } from '../../../utils/utils' import { IStrategyData } from './strategy' @@ -20,7 +19,7 @@ export const processStrategyDailyEarnings = async ( for (const block of blocks) { if (block.header.height < strategyData.from) return const day = dayjs.utc(block.header.timestamp).format('YYYY-MM-DD') - const id = `${strategyData.address}:${ETH_ADDRESS}:${day}` + const id = `${strategyData.address}:${strategyData.base.address}:${day}` // ctx.log.info(`processStrategyDailyEarnings ${block.header.height} ${id}`) // Get or create today's StrategyDailyYield. @@ -34,7 +33,7 @@ export const processStrategyDailyEarnings = async ( balance: latest?.balance ?? 0n, earnings: latest?.earnings ?? 0n, earningsChange: latest?.earningsChange ?? 0n, - asset: ETH_ADDRESS, + asset: strategyData.base.address, apr: latest?.apr ?? 0, apy: latest?.apy ?? 0, }) @@ -45,7 +44,7 @@ export const processStrategyDailyEarnings = async ( const todayYields = await ctx.store.find(StrategyYield, { where: { strategy: strategyData.address, - asset: ETH_ADDRESS, + asset: strategyData.base.address, blockNumber: Between( (latest?.blockNumber ?? 0) + 1, block.header.height, @@ -61,7 +60,7 @@ export const processStrategyDailyEarnings = async ( const latestAssetYield = await ctx.store.findOne(StrategyYield, { where: { strategy: strategyData.address, - asset: ETH_ADDRESS, + asset: strategyData.base.address, blockNumber: LessThanOrEqual(block.header.height), }, order: { id: 'desc' }, diff --git a/src/shared/processor-templates/strategy/strategy-earnings.ts b/src/shared/processor-templates/strategy/strategy-earnings.ts index 82f560c3..11e5015f 100644 --- a/src/shared/processor-templates/strategy/strategy-earnings.ts +++ b/src/shared/processor-templates/strategy/strategy-earnings.ts @@ -3,6 +3,8 @@ import dayjs from 'dayjs' import { LessThan } from 'typeorm' import { formatEther, pad, parseEther, parseUnits } from 'viem' +import * as aaveLendingPool from '../../../abi/aave-lending-pool' +import * as aToken from '../../../abi/aave-token' import * as baseRewardPool from '../../../abi/base-reward-pool' import * as erc20 from '../../../abi/erc20' import * as abstractStrategyAbi from '../../../abi/initializable-abstract-strategy' @@ -17,7 +19,8 @@ import { WETH_ADDRESS, } from '../../../utils/addresses' import { blockFrequencyTracker } from '../../../utils/blockFrequencyUpdater' -import { lastExcept } from '../../../utils/utils' +import { logFilter } from '../../../utils/logFilter' +import { convertDecimals, lastExcept } from '../../../utils/utils' import { IStrategyData } from './strategy' import { processStrategyDailyEarnings } from './strategy-daily-earnings' @@ -37,6 +40,8 @@ export const setupStrategyEarnings = ( strategyData: IStrategyData, ) => { processor.includeAllBlocks({ from: strategyData.from }) + const balanceUpdateFilters = strategyData.balanceUpdateFilters ?? [] + strategyData.balanceUpdateFilters = balanceUpdateFilters // Detect Deposit/Withdraw events // To help us understand when balances change passively vs from activity. @@ -49,11 +54,13 @@ export const setupStrategyEarnings = ( // Detect Staked/Withdrawn events // The curve incident caused us to fully withdraw from our pool and these logs contain that. if (strategyData.kind === 'CurveAMO') { - processor.addLog({ - address: [strategyData.curvePoolInfo!.rewardsPoolAddress], - topic0: [...baseRewardPoolTopics.values()], - topic1: [pad(strategyData.address as `0x${string}`)], - }) + balanceUpdateFilters.push( + logFilter({ + address: [strategyData.curvePoolInfo!.rewardsPoolAddress], + topic0: [...baseRewardPoolTopics.values()], + topic1: [pad(strategyData.address as `0x${string}`)], + }), + ) } } @@ -79,6 +86,10 @@ export const setupStrategyEarnings = ( topic2: [pad(OETH_DRIPPER_ADDRESS)], }) } + + for (const filter of balanceUpdateFilters) { + processor.addLog(filter.value) + } } const trackers = new Map>() @@ -87,9 +98,17 @@ export const processStrategyEarnings = async ( strategyData: IStrategyData, getStrategyBalances: ( ctx: Context, - block: { height: number }, + block: { + height: number + }, strategyData: IStrategyData, - ) => Promise<{ address: string; asset: string; balance: bigint }[]>, + ) => Promise< + { + address: string + asset: string + balance: bigint + }[] + >, ) => { const days = new Map() const strategyYields = new Map() @@ -98,7 +117,11 @@ export const processStrategyEarnings = async ( days.set(dayjs.utc(block.header.timestamp).format('YYYY-MM-DD'), block) const txIgnore = new Set() const getBalances = async ( - { compare }: { compare: number } = { compare: -1 }, + { + compare, + }: { + compare: number + } = { compare: -1 }, ) => { const compareBalances = await getStrategyBalances( ctx, @@ -109,13 +132,31 @@ export const processStrategyEarnings = async ( compare === 0 ? compareBalances : await getStrategyBalances(ctx, block.header, strategyData) - return balances.map((balance, i) => { - return { - asset: balance.asset, - balance: balance.balance, - compareBalance: compareBalances[i].balance, - } - }) + return balances + .map((balance, i) => { + return { + asset: balance.asset, + balance: balance.balance, + compareBalance: compareBalances[i].balance, + } + }) + .map((b) => { + b.balance = convertDecimals( + strategyData.assets.find( + (a) => a.address === b.asset.toLowerCase(), + )!, + strategyData.base, + b.balance, + ) + b.compareBalance = convertDecimals( + strategyData.assets.find( + (a) => a.address === b.asset.toLowerCase(), + )!, + strategyData.base, + b.compareBalance, + ) + return b + }) } for (const log of block.logs) { @@ -174,19 +215,16 @@ export const processStrategyEarnings = async ( } if ( - strategyData.kind === 'CurveAMO' && - log.address === strategyData.curvePoolInfo!.rewardsPoolAddress && - baseRewardPoolTopics.has(log.topics[0]) && - log.topics[1] === pad(strategyData.address as `0x${string}`) - ) { - await balanceTrackingUpdate() - } else if ( strategyData.kind === 'BalancerMetaStablePool' && log.address === AURA_REWARDS_POOL_ADDRESS && baseRewardPoolTopics.has(log.topics[0]) && log.topics[1] === pad(strategyData.address as `0x${string}`) ) { await balanceTrackingUpdateBalancerMetaStablePool() + } else if ( + strategyData.balanceUpdateFilters?.find((f) => f.matches(log)) + ) { + await balanceTrackingUpdate() } else if ( log.address === strategyData.address && strategyData.earnings.passiveByDepositWithdrawal && @@ -239,9 +277,12 @@ const processRewardTokenCollected = async ( strategyData: IStrategyData, block: Block, resultMap: Map, - params: { token: string; amount: bigint }, + params: { + token: string + amount: bigint + }, ) => { - const id = `${block.header.height}:${strategyData.address}:${ETH_ADDRESS}` + const id = `${block.header.height}:${strategyData.address}:${strategyData.base.address}` // ctx.log.info(`processRewardTokenCollected ${id}`) // ctx.log.info(`Amount earned through rewards: ${formatEther(params.amount)}`) let { latest, current, results } = await getLatest( @@ -249,7 +290,7 @@ const processRewardTokenCollected = async ( block, resultMap, strategyData, - ETH_ADDRESS, + strategyData.base.address, id, ) @@ -276,7 +317,7 @@ const processRewardTokenCollected = async ( blockNumber: block.header.height, timestamp: new Date(block.header.timestamp), strategy: strategyData.address, - asset: ETH_ADDRESS, + asset: strategyData.base.address, balance: latest?.balance ?? 0n, balanceWeight: latest?.balanceWeight ?? 1, earnings: (latest?.earnings ?? 0n) + amount, @@ -300,14 +341,14 @@ const processDepositWithdrawal = async ( balance: bigint }[], ) => { - const id = `${block.header.height}:${strategyData.address}:${ETH_ADDRESS}` + const id = `${block.header.height}:${strategyData.address}:${strategyData.base.address}` ctx.log.info(assets, `processDepositWithdrawal ${id}`) let { latest, current, results } = await getLatest( ctx, block, resultMap, strategyData, - ETH_ADDRESS, + strategyData.base.address, id, ) @@ -354,7 +395,7 @@ const processDepositWithdrawal = async ( blockNumber: block.header.height, timestamp, strategy: strategyData.address, - asset: ETH_ADDRESS, + asset: strategyData.base.address, balance, balanceWeight, earningsChange, @@ -372,12 +413,9 @@ const processDepositWithdrawal = async ( )}, total earnings: ${formatEther(current.earnings)}`, ) - if (+formatEther(earningsChange) > 2000) { - throw new Error('Weird shit yo') - } - if (earningsChange < 0) { ctx.log.warn('WARNING: earnings change is negative') + throw new Error() } // Avoid creating this if nothing has changed. diff --git a/src/shared/processor-templates/strategy/strategy-generic.ts b/src/shared/processor-templates/strategy/strategy-generic.ts index 5941bb22..803d2b6a 100644 --- a/src/shared/processor-templates/strategy/strategy-generic.ts +++ b/src/shared/processor-templates/strategy/strategy-generic.ts @@ -45,10 +45,10 @@ const getStrategyHoldings = async ( const balances = await getStrategyBalances(ctx, block.header, strategyData) const promises = assets.map(async (asset) => { return new StrategyBalance({ - id: `${address}:${asset}:${block.header.height}`, + id: `${address}:${asset.address}:${block.header.height}`, strategy: address, - asset: asset, - balance: balances.find((b) => b.asset === asset)?.balance, + asset: asset.address, + balance: balances.find((b) => b.asset === asset.address)?.balance, blockNumber: block.header.height, timestamp: new Date(block.header.timestamp), }) @@ -69,8 +69,8 @@ const getStrategyBalances = async ( block, strategyData.address, ) - const balance = await contract.checkBalance(asset) - return { address: strategyData.address, asset, balance } + const balance = await contract.checkBalance(asset.address) + return { address: strategyData.address, asset: asset.address, balance } }), ) } diff --git a/src/shared/processor-templates/strategy/strategy.ts b/src/shared/processor-templates/strategy/strategy.ts index 6bfad8fa..adad95bb 100644 --- a/src/shared/processor-templates/strategy/strategy.ts +++ b/src/shared/processor-templates/strategy/strategy.ts @@ -1,6 +1,7 @@ import { EvmBatchProcessor } from '@subsquid/evm-processor' import { Context } from '../../../processor' +import { LogFilter } from '../../../utils/logFilter' import * as strategyBalancer from './strategy-balancer' import * as strategyCurveAMO from './strategy-curve-amo' import * as strategyGeneric from './strategy-generic' @@ -25,7 +26,19 @@ export type IStrategyData = { | 'CurveAMO' | 'BalancerMetaStablePool' | 'BalancerComposableStablePool' - assets: readonly string[] + base: { + address: string + decimals: number + } + assets: { + address: string + decimals: number + }[] + balanceUpdateFilters?: LogFilter[] + aaveInfo?: { + lendingPool: string + pTokens: string[] + } balancerPoolInfo?: IBalancerPoolInfo curvePoolInfo?: ICurveAMOInfo earnings: { diff --git a/src/utils/logFilter.ts b/src/utils/logFilter.ts new file mode 100644 index 00000000..a2d585e4 --- /dev/null +++ b/src/utils/logFilter.ts @@ -0,0 +1,52 @@ +import { EvmBatchProcessor } from '@subsquid/evm-processor' +import { pad as viemPad } from 'viem' + +import { Log } from '../processor' + +const pad = (hex: string) => viemPad(hex as `0x${string}`) +const prepare = (hex: string) => pad(hex.toLowerCase()) + +/** + * Helper to create and match logs, ensuring hex values are lowercase and properly padded. + */ +export const logFilter = ( + filter: Parameters[0], +) => { + filter = { + address: filter.address?.map(prepare), + topic0: filter.topic0?.map(prepare), + topic1: filter.topic1?.map(prepare), + topic2: filter.topic2?.map(prepare), + topic3: filter.topic3?.map(prepare), + } + return { + value: filter, + matches(log: Log) { + if (filter.address && !filter.address.includes(log.address)) { + return false + } + if (filter.topic0 && !filter.topic0.includes(log.topics[0])) { + return false + } + if (filter.topic1 && !filter.topic1.includes(log.topics[1])) { + return false + } + if (filter.topic2 && !filter.topic2.includes(log.topics[2])) { + return false + } + if (filter.topic3 && !filter.topic3.includes(log.topics[3])) { + return false + } + if ( + filter.range && + (log.block.height < filter.range.from || + (filter.range.to && log.block.height > filter.range.to)) + ) { + return false + } + return true + }, + } as const +} + +export type LogFilter = ReturnType diff --git a/src/utils/utils.ts b/src/utils/utils.ts index 71b5be13..3c377dd6 100644 --- a/src/utils/utils.ts +++ b/src/utils/utils.ts @@ -1,11 +1,15 @@ import { Entity, EntityClass } from '@subsquid/typeorm-store' import { LessThanOrEqual } from 'typeorm' -import { pad } from 'viem' +import { formatUnits, pad, parseUnits } from 'viem' import * as erc20 from '../abi/erc20' import { Context } from '../processor' -export const lastExcept = ( +export const lastExcept = < + T extends { + id: string + }, +>( arr: T[] | undefined, id: string, ) => @@ -84,3 +88,19 @@ export const getOrCreate = async ( return value } + +export const convertDecimals = ( + from: { + address: string + decimals: number + }, + to: { + address: string + decimals: number + }, + value: bigint, +) => { + const fromFactor = 10n ** BigInt(from.decimals) + const toFactor = 10n ** BigInt(to.decimals) + return (value * toFactor) / fromFactor +} From cadcc4314f70c729f097dc24caf5b71ef155dbee Mon Sep 17 00:00:00 2001 From: Chris Jacobs Date: Thu, 9 Nov 2023 16:29:11 -0800 Subject: [PATCH 16/34] work on more ousd strategies --- src/oeth/processors/strategies/strategies.ts | 5 +- .../processors/strategies/aave-strategy.ts | 8 +- .../strategies/convex-meta-strategy.ts | 40 ++++++ .../processors/strategies/flux-strategy.ts | 16 +++ .../strategies/maker-dsr-strategy.ts | 16 +++ src/ousd/processors/strategies/morpho-aave.ts | 16 +++ .../processors/strategies/morpho-compound.ts | 16 +++ src/ousd/processors/strategies/strategies.ts | 74 ++-------- .../strategy/strategy-daily-earnings.ts | 11 +- .../strategy/strategy-earnings.ts | 133 ++++++++++++------ .../processor-templates/strategy/strategy.ts | 7 +- src/utils/addresses.ts | 14 +- src/utils/logFilter.ts | 6 +- src/utils/traceFilter.ts | 54 +++++++ src/utils/utils.ts | 6 +- 15 files changed, 299 insertions(+), 123 deletions(-) create mode 100644 src/ousd/processors/strategies/convex-meta-strategy.ts create mode 100644 src/ousd/processors/strategies/flux-strategy.ts create mode 100644 src/ousd/processors/strategies/maker-dsr-strategy.ts create mode 100644 src/ousd/processors/strategies/morpho-aave.ts create mode 100644 src/ousd/processors/strategies/morpho-compound.ts create mode 100644 src/utils/traceFilter.ts diff --git a/src/oeth/processors/strategies/strategies.ts b/src/oeth/processors/strategies/strategies.ts index 45c0d384..b399dcde 100644 --- a/src/oeth/processors/strategies/strategies.ts +++ b/src/oeth/processors/strategies/strategies.ts @@ -15,7 +15,6 @@ import { import { FRXETH_ADDRESS, OETH_ADDRESS, - RETH_ADDRESS, WETH_ADDRESS, } from '../../../utils/addresses' @@ -25,6 +24,7 @@ export const oethStrategies: readonly IStrategyData[] = [ name: 'OETH Convex ETH+OETH (AMO)', contractName: 'ConvexEthMetaStrategy', address: '0x1827f9ea98e0bf96550b2fc20f7233277fcd7e63', + oTokenAddress: OETH_ADDRESS, kind: 'CurveAMO', curvePoolInfo: { poolAddress: '0x94b17476a93b3262d87b9a326965d1e91f9c13e7', @@ -42,6 +42,7 @@ export const oethStrategies: readonly IStrategyData[] = [ name: 'OETH Frax Staking', contractName: 'FraxETHStrategy', address: '0x3ff8654d633d4ea0fae24c52aec73b4a20d0d0e5', + oTokenAddress: OETH_ADDRESS, kind: 'Generic', base: { address: currencies.ETH, decimals: 18 }, assets: [FRXETH_ADDRESS].map((address) => ({ address, decimals: 18 })), @@ -52,6 +53,7 @@ export const oethStrategies: readonly IStrategyData[] = [ name: 'OETH Morpho Aave V2', contractName: 'MorphoAaveStrategy', address: '0xc1fc9e5ec3058921ea5025d703cbe31764756319', + oTokenAddress: OETH_ADDRESS, kind: 'Generic', base: { address: currencies.ETH, decimals: 18 }, assets: [WETH_ADDRESS].map((address) => ({ address, decimals: 18 })), @@ -62,6 +64,7 @@ export const oethStrategies: readonly IStrategyData[] = [ // name: 'OETH Aura rETH/WETH', // contractName: 'BalancerMetaPoolStrategy', // address: '0x49109629ac1deb03f2e9b2fe2ac4a623e0e7dfdc', + // oTokenAddress: OETH_ADDRESS, // kind: 'BalancerMetaStablePool', // base: { address: currencies.ETH, decimals: 18}, // assets: [WETH_ADDRESS, RETH_ADDRESS].map(address => ({address, decimals: 18})), diff --git a/src/ousd/processors/strategies/aave-strategy.ts b/src/ousd/processors/strategies/aave-strategy.ts index 2d2310db..4ccb4296 100644 --- a/src/ousd/processors/strategies/aave-strategy.ts +++ b/src/ousd/processors/strategies/aave-strategy.ts @@ -3,23 +3,24 @@ import { pad as viemPad } from 'viem' import * as aaveLendingPool from '../../../abi/aave-lending-pool' import { currencies } from '../../../shared/post-processors/exchange-rates/currencies' import { IStrategyData } from '../../../shared/processor-templates/strategy' +import { OUSD_ADDRESS } from '../../../utils/addresses' import { logFilter } from '../../../utils/logFilter' import { DAI, USDT } from './const' export const aaveStrategy: IStrategyData = { from: 14206832, // 13369326, Initial Deploy + oTokenAddress: OUSD_ADDRESS, kind: 'Generic', name: 'OUSD Aave', contractName: 'AaveStrategy', address: '0x5e3646a1db86993f73e6b74a57d8640b69f7e259'.toLowerCase(), base: { address: currencies.USD, decimals: 18 }, assets: [DAI, USDT], - balanceUpdateFilters: [], earnings: { passiveByDepositWithdrawal: true, rewardTokenCollected: true }, } -const balanceUpdateFilters: IStrategyData['balanceUpdateFilters'] = [] -aaveStrategy.balanceUpdateFilters = balanceUpdateFilters +const balanceUpdateFilters: IStrategyData['balanceUpdateLogFilters'] = [] +aaveStrategy.balanceUpdateLogFilters = balanceUpdateFilters const lendingPoolAddress = '0x7d2768dE32b0b80b7a3454c06BdAc94A69DDc7A9'.toLowerCase() @@ -35,5 +36,6 @@ balanceUpdateFilters.push( ], topic1: [DAI, USDT].map((a) => pad(a.address)), topic2: [pad(aaveStrategy.address)], + range: { from: aaveStrategy.from }, }), ) diff --git a/src/ousd/processors/strategies/convex-meta-strategy.ts b/src/ousd/processors/strategies/convex-meta-strategy.ts new file mode 100644 index 00000000..d7ce3011 --- /dev/null +++ b/src/ousd/processors/strategies/convex-meta-strategy.ts @@ -0,0 +1,40 @@ +import * as abstractStrategyAbi from '../../../abi/initializable-abstract-strategy' +import { currencies } from '../../../shared/post-processors/exchange-rates/currencies' +import { IStrategyData } from '../../../shared/processor-templates/strategy' +import { OUSD_ADDRESS } from '../../../utils/addresses' +import { traceFilter } from '../../../utils/traceFilter' +import { DAI, USDC, USDT } from './const' + +export const convexMetaStrategy: IStrategyData = { + from: 15896478, + oTokenAddress: OUSD_ADDRESS, + kind: 'CurveAMO', + name: 'OUSD Convex OUSD+3Crv (AMO)', + contractName: 'ConvexOUSDMetaStrategy', + address: '0x89eb88fedc50fc77ae8a18aad1ca0ac27f777a90'.toLowerCase(), + base: { address: currencies.USD, decimals: 18 }, + assets: [DAI, USDT, USDC], + balanceUpdateTraceFilters: [ + traceFilter({ + type: ['call'], + callTo: ['0x89eb88fedc50fc77ae8a18aad1ca0ac27f777a90'.toLowerCase()], + callSighash: [ + abstractStrategyAbi.functions.withdraw.sighash, + abstractStrategyAbi.functions.withdrawAll.sighash, + abstractStrategyAbi.functions.deposit.sighash, + abstractStrategyAbi.functions.depositAll.sighash, + ], + transaction: true, + range: { from: 15896478 }, + }), + ], + earnings: { + passiveByDepositWithdrawal: true, + rewardTokenCollected: true, + }, + curvePoolInfo: { + poolAddress: '0xbEbc44782C7dB0a1A60Cb6fe97d0b483032FF1C7'.toLowerCase(), + rewardsPoolAddress: + '0x7D536a737C13561e0D2Decf1152a653B4e615158'.toLowerCase(), + }, +} diff --git a/src/ousd/processors/strategies/flux-strategy.ts b/src/ousd/processors/strategies/flux-strategy.ts new file mode 100644 index 00000000..2b0bf5b7 --- /dev/null +++ b/src/ousd/processors/strategies/flux-strategy.ts @@ -0,0 +1,16 @@ +import { currencies } from '../../../shared/post-processors/exchange-rates/currencies' +import { IStrategyData } from '../../../shared/processor-templates/strategy' +import { OUSD_ADDRESS } from '../../../utils/addresses' +import { DAI, USDC, USDT } from './const' + +export const fluxStrategy: IStrategyData = { + from: 17877308, + oTokenAddress: OUSD_ADDRESS, + kind: 'Generic', + name: 'OUSD Flux', + contractName: 'FluxStrategy', + address: '0x76Bf500B6305Dc4ea851384D3d5502f1C7a0ED44'.toLowerCase(), + base: { address: currencies.USD, decimals: 18 }, + assets: [DAI, USDT, USDC], + earnings: { passiveByDepositWithdrawal: true, rewardTokenCollected: true }, +} diff --git a/src/ousd/processors/strategies/maker-dsr-strategy.ts b/src/ousd/processors/strategies/maker-dsr-strategy.ts new file mode 100644 index 00000000..3fc8ed31 --- /dev/null +++ b/src/ousd/processors/strategies/maker-dsr-strategy.ts @@ -0,0 +1,16 @@ +import { currencies } from '../../../shared/post-processors/exchange-rates/currencies' +import { IStrategyData } from '../../../shared/processor-templates/strategy' +import { OUSD_ADDRESS } from '../../../utils/addresses' +import { DAI, USDC, USDT } from './const' + +export const makerDsrStrategy: IStrategyData = { + from: 17883036, + oTokenAddress: OUSD_ADDRESS, + kind: 'Generic', + name: 'OUSD Maker DSR', + contractName: 'Generalized4626Strategy', + address: '0x6b69B755C629590eD59618A2712d8a2957CA98FC'.toLowerCase(), + base: { address: currencies.USD, decimals: 18 }, + assets: [DAI, USDT, USDC], + earnings: { passiveByDepositWithdrawal: true, rewardTokenCollected: true }, +} diff --git a/src/ousd/processors/strategies/morpho-aave.ts b/src/ousd/processors/strategies/morpho-aave.ts new file mode 100644 index 00000000..18bd3c41 --- /dev/null +++ b/src/ousd/processors/strategies/morpho-aave.ts @@ -0,0 +1,16 @@ +import { currencies } from '../../../shared/post-processors/exchange-rates/currencies' +import { IStrategyData } from '../../../shared/processor-templates/strategy' +import { OUSD_ADDRESS } from '../../../utils/addresses' +import { DAI, USDC, USDT } from './const' + +export const morphoAave: IStrategyData = { + from: 16331911, + oTokenAddress: OUSD_ADDRESS, + kind: 'Generic', + name: 'OUSD Morpho Aave', + contractName: 'MorphoAaveStrategy', + address: '0x79F2188EF9350A1dC11A062cca0abE90684b0197'.toLowerCase(), + base: { address: currencies.USD, decimals: 18 }, + assets: [DAI, USDT, USDC], + earnings: { passiveByDepositWithdrawal: true, rewardTokenCollected: true }, +} diff --git a/src/ousd/processors/strategies/morpho-compound.ts b/src/ousd/processors/strategies/morpho-compound.ts new file mode 100644 index 00000000..f5c0285a --- /dev/null +++ b/src/ousd/processors/strategies/morpho-compound.ts @@ -0,0 +1,16 @@ +import { currencies } from '../../../shared/post-processors/exchange-rates/currencies' +import { IStrategyData } from '../../../shared/processor-templates/strategy' +import { OUSD_ADDRESS } from '../../../utils/addresses' +import { DAI, USDC, USDT } from './const' + +export const morphoCompound: IStrategyData = { + from: 15949661, + oTokenAddress: OUSD_ADDRESS, + kind: 'Generic', + name: 'OUSD Morpho Compound', + contractName: 'MorphoCompoundStrategy', + address: '0x5a4eee58744d1430876d5ca93cab5ccb763c037d'.toLowerCase(), + base: { address: currencies.USD, decimals: 18 }, + assets: [DAI, USDT, USDC], + earnings: { passiveByDepositWithdrawal: true, rewardTokenCollected: true }, +} diff --git a/src/ousd/processors/strategies/strategies.ts b/src/ousd/processors/strategies/strategies.ts index 04e49109..7de0effd 100644 --- a/src/ousd/processors/strategies/strategies.ts +++ b/src/ousd/processors/strategies/strategies.ts @@ -1,8 +1,6 @@ import { EvmBatchProcessor } from '@subsquid/evm-processor' -import { pad } from 'viem' -import * as aaveLendingPool from '../../../abi/aave-lending-pool' -import * as aToken from '../../../abi/aave-token' +import * as abstractStrategyAbi from '../../../abi/initializable-abstract-strategy' import { OETHRewardTokenCollected } from '../../../model' import { Context } from '../../../processor' import { currencies } from '../../../shared/post-processors/exchange-rates/currencies' @@ -15,8 +13,14 @@ import { createStrategyRewardProcessor, createStrategyRewardSetup, } from '../../../shared/processor-templates/strategy-rewards' -import { logFilter } from '../../../utils/logFilter' +import { OUSD_ADDRESS } from '../../../utils/addresses' +import { traceFilter } from '../../../utils/traceFilter' import { aaveStrategy } from './aave-strategy' +import { convexMetaStrategy } from './convex-meta-strategy' +import { fluxStrategy } from './flux-strategy' +import { makerDsrStrategy } from './maker-dsr-strategy' +import { morphoAave } from './morpho-aave' +import { morphoCompound } from './morpho-compound' const DAI = { address: '0x6b175474e89094c44da98b954eedeac495271d0f'.toLowerCase(), @@ -32,62 +36,12 @@ const USDC = { } const ousdStrategies: readonly IStrategyData[] = [ - // aaveStrategy, - { - from: 15896478, - kind: 'CurveAMO', - name: 'OUSD Convex OUSD+3Crv (AMO)', - contractName: 'ConvexOUSDMetaStrategy', - address: '0x89eb88fedc50fc77ae8a18aad1ca0ac27f777a90'.toLowerCase(), - base: { address: currencies.USD, decimals: 18 }, - assets: [DAI, USDT, USDC], - earnings: { passiveByDepositWithdrawal: true, rewardTokenCollected: true }, - curvePoolInfo: { - poolAddress: '0xbEbc44782C7dB0a1A60Cb6fe97d0b483032FF1C7'.toLowerCase(), - rewardsPoolAddress: - '0x7D536a737C13561e0D2Decf1152a653B4e615158'.toLowerCase(), - }, - }, - // { - // from: 15949661, - // kind: 'Generic', - // name: 'OUSD Morpho Compound', - // contractName: 'MorphoCompoundStrategy', - // address: '0x5a4eee58744d1430876d5ca93cab5ccb763c037d'.toLowerCase(), - // base: { address: currencies.USD, decimals: 18 }, - // assets: [DAI, USDT, USDC], - // earnings: { passiveByDepositWithdrawal: true, rewardTokenCollected: true }, - // }, - // { - // from: 16331911, - // kind: 'Generic', - // name: 'OUSD Morpho Aave', - // contractName: 'MorphoAaveStrategy', - // address: '0x79F2188EF9350A1dC11A062cca0abE90684b0197'.toLowerCase(), - // base: { address: currencies.USD, decimals: 18 }, - // assets: [DAI, USDT, USDC], - // earnings: { passiveByDepositWithdrawal: true, rewardTokenCollected: true }, - // }, - // { - // from: 17877308, - // kind: 'Generic', - // name: 'OUSD Flux', - // contractName: 'FluxStrategy', - // address: '0x76Bf500B6305Dc4ea851384D3d5502f1C7a0ED44'.toLowerCase(), - // base: { address: currencies.USD, decimals: 18 }, - // assets: [DAI, USDT, USDC], - // earnings: { passiveByDepositWithdrawal: true, rewardTokenCollected: true }, - // }, - // { - // from: 17883036, - // kind: 'Generic', - // name: 'OUSD Maker DSR', - // contractName: 'Generalized4626Strategy', - // address: '0x6b69B755C629590eD59618A2712d8a2957CA98FC'.toLowerCase(), - // base: { address: currencies.USD, decimals: 18 }, - // assets: [DAI, USDT, USDC], - // earnings: { passiveByDepositWithdrawal: true, rewardTokenCollected: true }, - // }, + aaveStrategy, + convexMetaStrategy, + morphoCompound, + morphoAave, + fluxStrategy, + makerDsrStrategy, // Deprecated // { diff --git a/src/shared/processor-templates/strategy/strategy-daily-earnings.ts b/src/shared/processor-templates/strategy/strategy-daily-earnings.ts index c7a77c2e..bb6c9b76 100644 --- a/src/shared/processor-templates/strategy/strategy-daily-earnings.ts +++ b/src/shared/processor-templates/strategy/strategy-daily-earnings.ts @@ -5,7 +5,7 @@ import { parseEther } from 'viem' import { StrategyDailyYield, StrategyYield } from '../../../model' import { Block, Context } from '../../../processor' import { calculateAPY } from '../../../utils/calculateAPY' -import { lastExcept } from '../../../utils/utils' +import { lastExcept, max } from '../../../utils/utils' import { IStrategyData } from './strategy' const eth1 = 1000000000000000000n @@ -73,9 +73,8 @@ export const processStrategyDailyEarnings = async ( // Sort so following `.find` actions get the most recent. yields.sort((a, b) => b.blockNumber - a.blockNumber) - // Convert into ETH values - const balance = yields[yields.length - 1]?.balance ?? 0n - const balanceWeight = yields[yields.length - 1]?.balanceWeight ?? 1 + const balance = max(yields.map((y) => y.balance)) // Use the highest balance in the last day. (conservative approach) + const balanceWeight = Math.min(...yields.map((y) => y.balanceWeight)) // Use the lowest balance weight in the last day. (conservative approach) const earnings = yields[yields.length - 1]?.earnings ?? 0n const earningsChange = todayYields.reduce( (sum, y) => sum + y.earningsChange, @@ -88,7 +87,7 @@ export const processStrategyDailyEarnings = async ( current.earningsChange = earningsChange if (current.earnings < (latest?.earnings ?? 0n)) { - ctx.log.info({ current, latest, yields }, 'earnings went down :(') + ctx.log.info('earnings went down :(') // throw new Error('how!??!?!') } @@ -97,7 +96,7 @@ export const processStrategyDailyEarnings = async ( // The use of `balanceWeight` is for the Curve AMO ETH+OETH Strategy // It is an attempt at excluding OETH from the rate calculations. const yieldBalance = - ((latest?.balance || current.balance) * + (max([current.balance, latest.balance]) * // Use the max of either of these two for more realistic APY values. parseEther(balanceWeight.toString())) / eth1 diff --git a/src/shared/processor-templates/strategy/strategy-earnings.ts b/src/shared/processor-templates/strategy/strategy-earnings.ts index 11e5015f..4e698282 100644 --- a/src/shared/processor-templates/strategy/strategy-earnings.ts +++ b/src/shared/processor-templates/strategy/strategy-earnings.ts @@ -8,14 +8,18 @@ import * as aToken from '../../../abi/aave-token' import * as baseRewardPool from '../../../abi/base-reward-pool' import * as erc20 from '../../../abi/erc20' import * as abstractStrategyAbi from '../../../abi/initializable-abstract-strategy' -import { StrategyYield } from '../../../model' +import * as otoken from '../../../abi/otoken' +import { OETH, StrategyYield } from '../../../model' import { Block, Context } from '../../../processor' import { AURA_REWARDS_POOL_ADDRESS, - ETH_ADDRESS, OETH_ADDRESS, OETH_DRIPPER_ADDRESS, OETH_HARVESTER_ADDRESS, + OUSD_ADDRESS, + OUSD_DRIPPER_ADDRESS, + OUSD_HARVESTER_ADDRESS, + USDT_ADDRESS, WETH_ADDRESS, } from '../../../utils/addresses' import { blockFrequencyTracker } from '../../../utils/blockFrequencyUpdater' @@ -35,13 +39,26 @@ const baseRewardPoolTopics = new Set([ baseRewardPool.events.Withdrawn.topic, ]) +const oTokenValues = { + [OUSD_ADDRESS]: { + rewardConversionToken: USDT_ADDRESS, + harvester: OUSD_HARVESTER_ADDRESS, + dripper: OUSD_DRIPPER_ADDRESS, + }, + [OETH_ADDRESS]: { + rewardConversionToken: WETH_ADDRESS, + harvester: OETH_HARVESTER_ADDRESS, + dripper: OETH_DRIPPER_ADDRESS, + }, +} as const + export const setupStrategyEarnings = ( processor: EvmBatchProcessor, strategyData: IStrategyData, ) => { processor.includeAllBlocks({ from: strategyData.from }) - const balanceUpdateFilters = strategyData.balanceUpdateFilters ?? [] - strategyData.balanceUpdateFilters = balanceUpdateFilters + const balanceUpdateFilters = strategyData.balanceUpdateLogFilters ?? [] + strategyData.balanceUpdateLogFilters = balanceUpdateFilters // Detect Deposit/Withdraw events // To help us understand when balances change passively vs from activity. @@ -49,6 +66,7 @@ export const setupStrategyEarnings = ( processor.addLog({ address: [strategyData.address], topic0: [...depositWithdrawalTopics.values()], + range: { from: strategyData.from }, }) // Detect Staked/Withdrawn events @@ -59,16 +77,21 @@ export const setupStrategyEarnings = ( address: [strategyData.curvePoolInfo!.rewardsPoolAddress], topic0: [...baseRewardPoolTopics.values()], topic1: [pad(strategyData.address as `0x${string}`)], + range: { from: strategyData.from }, }), ) } } + for (const filter of strategyData.balanceUpdateTraceFilters ?? []) { + processor.addTrace(filter.value) + } if (strategyData.kind === 'BalancerMetaStablePool') { processor.addLog({ address: [AURA_REWARDS_POOL_ADDRESS], topic0: [...baseRewardPoolTopics.values()], topic1: [pad(strategyData.address as `0x${string}`)], + range: { from: strategyData.from }, }) } @@ -78,12 +101,18 @@ export const setupStrategyEarnings = ( processor.addLog({ address: [strategyData.address], topic0: [abstractStrategyAbi.events.RewardTokenCollected.topic], + range: { from: strategyData.from }, }) processor.addLog({ - address: [WETH_ADDRESS], + address: [ + strategyData.oTokenAddress === OUSD_ADDRESS + ? USDT_ADDRESS + : WETH_ADDRESS, + ], topic0: [erc20.events.Transfer.topic], - topic1: [pad(OETH_HARVESTER_ADDRESS)], - topic2: [pad(OETH_DRIPPER_ADDRESS)], + topic1: [pad(oTokenValues[strategyData.oTokenAddress].harvester)], + topic2: [pad(oTokenValues[strategyData.oTokenAddress].dripper)], + range: { from: strategyData.from }, }) } @@ -158,46 +187,62 @@ export const processStrategyEarnings = async ( return b }) } + const balanceTrackingUpdate = async () => { + // ctx.log.info(`balanceTrackingUpdate`) + didUpdate = true + const balances = await getBalances() + await processDepositWithdrawal( + ctx, + strategyData, + block, + strategyYields, + balances, + ) + } + const balanceTrackingUpdateBalancerMetaStablePool = async () => { + // ctx.log.info(`balanceTrackingUpdateBalancerMetaStablePool`) + didUpdate = true + const balances = await getBalances() + await processDepositWithdrawal( + ctx, + strategyData, + block, + strategyYields, + balances, + ) + } - for (const log of block.logs) { - // Various update functions we might call - const balanceTrackingUpdate = async () => { - // ctx.log.info(`balanceTrackingUpdate`) - didUpdate = true - const balances = await getBalances() - await processDepositWithdrawal( - ctx, - strategyData, - block, - strategyYields, - balances, - ) - } - const balanceTrackingUpdateBalancerMetaStablePool = async () => { - // ctx.log.info(`balanceTrackingUpdateBalancerMetaStablePool`) - didUpdate = true - const balances = await getBalances() - await processDepositWithdrawal( - ctx, - strategyData, - block, - strategyYields, - balances, - ) + if ( + strategyData.balanceUpdateTraceFilters && + strategyData.balanceUpdateTraceFilters.length > 0 + ) { + for (const trace of block.traces) { + if ( + strategyData.balanceUpdateTraceFilters.find((f) => f.matches(trace)) + ) { + await balanceTrackingUpdate() + } } + } + + for (const log of block.logs) { const rewardTokenCollectedUpdate = async () => { // ctx.log.info(`rewardTokenCollectedUpdate`) didUpdate = true txIgnore.add(log.transactionHash) - const wethTransferLogs = block.logs.filter( + + const earningsTransferLogs = block.logs.filter( (l) => l.transactionHash === log.transactionHash && - l.address.toLowerCase() === WETH_ADDRESS && + l.address.toLowerCase() === + oTokenValues[strategyData.oTokenAddress].rewardConversionToken && l.topics[0] === erc20.events.Transfer.topic && - l.topics[1] === pad(OETH_HARVESTER_ADDRESS) && - l.topics[2] === pad(OETH_DRIPPER_ADDRESS), + l.topics[1] === + pad(oTokenValues[strategyData.oTokenAddress].harvester) && + l.topics[2] === + pad(oTokenValues[strategyData.oTokenAddress].dripper), ) - const amount = wethTransferLogs.reduce( + const amount = earningsTransferLogs.reduce( (sum, l) => sum + BigInt(l.data), 0n, ) @@ -222,7 +267,7 @@ export const processStrategyEarnings = async ( ) { await balanceTrackingUpdateBalancerMetaStablePool() } else if ( - strategyData.balanceUpdateFilters?.find((f) => f.matches(log)) + strategyData.balanceUpdateLogFilters?.find((f) => f.matches(log)) ) { await balanceTrackingUpdate() } else if ( @@ -342,7 +387,7 @@ const processDepositWithdrawal = async ( }[], ) => { const id = `${block.header.height}:${strategyData.address}:${strategyData.base.address}` - ctx.log.info(assets, `processDepositWithdrawal ${id}`) + // ctx.log.info(assets, `processDepositWithdrawal ${id}`) let { latest, current, results } = await getLatest( ctx, block, @@ -370,13 +415,16 @@ const processDepositWithdrawal = async ( return sum + a.balance // convertRate(rates, 'ETH', a.asset as Currency, a.balance) }, 0n) - const oethBalance = - assets.find((a) => a.asset.toLowerCase() === OETH_ADDRESS)?.balance ?? 0n + const otokenBalance = + assets.find((a) => a.asset.toLowerCase() === strategyData.oTokenAddress) + ?.balance ?? 0n const balanceWeightN = - balance === 0n ? eth1 : (oethBalance * eth1) / balance + eth1 - (balance === 0n ? 0n : (otokenBalance * eth1) / balance) const balanceWeight = Number(formatEther(balanceWeightN)) + // ctx.log.info({ balanceWeight }) + const timestamp = new Date(block.header.timestamp) let earningsChange = previousBalance - (latest?.balance ?? previousBalance) ?? 0n @@ -415,7 +463,6 @@ const processDepositWithdrawal = async ( if (earningsChange < 0) { ctx.log.warn('WARNING: earnings change is negative') - throw new Error() } // Avoid creating this if nothing has changed. diff --git a/src/shared/processor-templates/strategy/strategy.ts b/src/shared/processor-templates/strategy/strategy.ts index adad95bb..133f0271 100644 --- a/src/shared/processor-templates/strategy/strategy.ts +++ b/src/shared/processor-templates/strategy/strategy.ts @@ -1,7 +1,9 @@ import { EvmBatchProcessor } from '@subsquid/evm-processor' import { Context } from '../../../processor' +import { OETH_ADDRESS, OUSD_ADDRESS } from '../../../utils/addresses' import { LogFilter } from '../../../utils/logFilter' +import { TraceFilter } from '../../../utils/traceFilter' import * as strategyBalancer from './strategy-balancer' import * as strategyCurveAMO from './strategy-curve-amo' import * as strategyGeneric from './strategy-generic' @@ -18,6 +20,7 @@ export type ICurveAMOInfo = { export type IStrategyData = { from: number + oTokenAddress: typeof OUSD_ADDRESS | typeof OETH_ADDRESS name: string contractName: string address: string @@ -34,7 +37,8 @@ export type IStrategyData = { address: string decimals: number }[] - balanceUpdateFilters?: LogFilter[] + balanceUpdateLogFilters?: LogFilter[] + balanceUpdateTraceFilters?: TraceFilter[] aaveInfo?: { lendingPool: string pTokens: string[] @@ -44,6 +48,7 @@ export type IStrategyData = { earnings: { rewardTokenCollected?: boolean passiveByDepositWithdrawal?: boolean + passiveByDepositWithdrawalByTrace?: boolean } } diff --git a/src/utils/addresses.ts b/src/utils/addresses.ts index 4a622c62..bdd7c598 100644 --- a/src/utils/addresses.ts +++ b/src/utils/addresses.ts @@ -4,7 +4,12 @@ export const ADDRESS_ZERO = '0x0000000000000000000000000000000000000000' export const ETH_ADDRESS = '0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee' export const OUSD_ADDRESS = '0x2a8e1e676ec238d8a992307b495b45b3feaa5e86' +export const USDT_ADDRESS = '0xdac17f958d2ee523a2206206994597c13d831ec7' +export const USDC_ADDRESS = '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48' export const OUSD_VAULT_ADDRESS = '0xe75d77b1865ae93c7eaa3040b038d7aa7bc02f70' +export const OUSD_HARVESTER_ADDRESS = + '0x21fb5812d70b3396880d30e90d9e5c1202266c89' +export const OUSD_DRIPPER_ADDRESS = '0x80c898ae5e56f888365e235ceb8cea3eb726cb58' export const OETH_ADDRESS = '0x856c4efb76c1d1ae02e20ceb03a2a6a08b0b8dc3' export const OETH_VAULT_ADDRESS = '0x39254033945aa2e4809cc2977e7087bee48bd7ab' @@ -49,11 +54,8 @@ export const BALANCER_VAULT = '0xba12222222228d8ba445958a75a0704d566bf2c8' export const AURA_REWARDS_POOL_ADDRESS = '0xdd1fe5ad401d4777ce89959b7fa587e569bf125d' -export const GOVERNANCE_ADDRESS = - '0x3cdd07c16614059e66344a7b579dab4f9516c0b6' +export const GOVERNANCE_ADDRESS = '0x3cdd07c16614059e66344a7b579dab4f9516c0b6' -export const OGV_ADDRESS = - '0x9c354503c38481a7a7a51629142963f98ecc12d0' +export const OGV_ADDRESS = '0x9c354503c38481a7a7a51629142963f98ecc12d0' -export const VEOGV_ADDRESS = - '0x0c4576ca1c365868e162554af8e385dc3e7c66d9' +export const VEOGV_ADDRESS = '0x0c4576ca1c365868e162554af8e385dc3e7c66d9' diff --git a/src/utils/logFilter.ts b/src/utils/logFilter.ts index a2d585e4..44a9c2aa 100644 --- a/src/utils/logFilter.ts +++ b/src/utils/logFilter.ts @@ -4,7 +4,8 @@ import { pad as viemPad } from 'viem' import { Log } from '../processor' const pad = (hex: string) => viemPad(hex as `0x${string}`) -const prepare = (hex: string) => pad(hex.toLowerCase()) +const lower = (hex: string) => hex.toLowerCase() +const prepare = (hex: string) => pad(lower(hex)) /** * Helper to create and match logs, ensuring hex values are lowercase and properly padded. @@ -13,11 +14,12 @@ export const logFilter = ( filter: Parameters[0], ) => { filter = { - address: filter.address?.map(prepare), + address: filter.address?.map(lower), topic0: filter.topic0?.map(prepare), topic1: filter.topic1?.map(prepare), topic2: filter.topic2?.map(prepare), topic3: filter.topic3?.map(prepare), + range: filter.range, } return { value: filter, diff --git a/src/utils/traceFilter.ts b/src/utils/traceFilter.ts new file mode 100644 index 00000000..7ecb17a5 --- /dev/null +++ b/src/utils/traceFilter.ts @@ -0,0 +1,54 @@ +import { EvmBatchProcessor } from '@subsquid/evm-processor' +import { pad as viemPad } from 'viem' + +import { Trace } from '../processor' + +const pad = (hex: string) => viemPad(hex as `0x${string}`) +const lower = (hex: string) => hex.toLowerCase() + +/** + * Helper to create and match traces. + */ +export const traceFilter = ( + filter: Pick< + Parameters[0] & { type: ['call'] }, + 'type' | 'callTo' | 'callSighash' | 'transaction' | 'range' + >, +) => { + filter = { + type: filter.type, + callTo: filter.callTo?.map(lower), + callSighash: filter.callSighash?.map(lower), + transaction: filter.transaction, + range: filter.range, + } + return { + value: filter, + matches(trace: Trace) { + if (filter.type && !filter.type.includes(trace.type)) return false + if ( + filter.callTo && + trace.type === 'call' && + !filter.callTo.includes(trace.action.to) + ) + return false + if ( + filter.callSighash && + trace.type === 'call' && + !filter.callSighash.includes(trace.action.sighash) + ) + return false + + if ( + filter.range && + (trace.block.height < filter.range.from || + (filter.range.to && trace.block.height > filter.range.to)) + ) { + return false + } + return true + }, + } as const +} + +export type TraceFilter = ReturnType diff --git a/src/utils/utils.ts b/src/utils/utils.ts index 3c377dd6..80cc621a 100644 --- a/src/utils/utils.ts +++ b/src/utils/utils.ts @@ -1,10 +1,14 @@ import { Entity, EntityClass } from '@subsquid/typeorm-store' import { LessThanOrEqual } from 'typeorm' -import { formatUnits, pad, parseUnits } from 'viem' +import { pad } from 'viem' import * as erc20 from '../abi/erc20' import { Context } from '../processor' +export const max = (values: bigint[], start = 0n) => { + return values.reduce((max, v) => (max > v ? max : v), start) +} + export const lastExcept = < T extends { id: string From c4cf2622fe16f72c68c7fcf4ad623e4f35846a97 Mon Sep 17 00:00:00 2001 From: Chris Jacobs Date: Fri, 10 Nov 2023 11:55:34 -0800 Subject: [PATCH 17/34] fix ousd amo strategy balance gathering and reward token collected decimal handling --- .../strategies/convex-meta-strategy.ts | 15 +++--- src/ousd/processors/strategies/strategies.ts | 25 +++------- .../strategy/strategy-curve-amo.ts | 33 +++++++++++-- .../strategy/strategy-earnings.ts | 48 +++++++------------ src/utils/utils.ts | 16 ++----- 5 files changed, 65 insertions(+), 72 deletions(-) diff --git a/src/ousd/processors/strategies/convex-meta-strategy.ts b/src/ousd/processors/strategies/convex-meta-strategy.ts index d7ce3011..661ec624 100644 --- a/src/ousd/processors/strategies/convex-meta-strategy.ts +++ b/src/ousd/processors/strategies/convex-meta-strategy.ts @@ -1,12 +1,16 @@ +import * as erc20 from '../../../abi/erc20' import * as abstractStrategyAbi from '../../../abi/initializable-abstract-strategy' import { currencies } from '../../../shared/post-processors/exchange-rates/currencies' import { IStrategyData } from '../../../shared/processor-templates/strategy' import { OUSD_ADDRESS } from '../../../utils/addresses' +import { logFilter } from '../../../utils/logFilter' import { traceFilter } from '../../../utils/traceFilter' import { DAI, USDC, USDT } from './const' +const from = 15896478 + export const convexMetaStrategy: IStrategyData = { - from: 15896478, + from, oTokenAddress: OUSD_ADDRESS, kind: 'CurveAMO', name: 'OUSD Convex OUSD+3Crv (AMO)', @@ -18,14 +22,9 @@ export const convexMetaStrategy: IStrategyData = { traceFilter({ type: ['call'], callTo: ['0x89eb88fedc50fc77ae8a18aad1ca0ac27f777a90'.toLowerCase()], - callSighash: [ - abstractStrategyAbi.functions.withdraw.sighash, - abstractStrategyAbi.functions.withdrawAll.sighash, - abstractStrategyAbi.functions.deposit.sighash, - abstractStrategyAbi.functions.depositAll.sighash, - ], + callSighash: [abstractStrategyAbi.functions.withdrawAll.sighash], transaction: true, - range: { from: 15896478 }, + range: { from }, }), ], earnings: { diff --git a/src/ousd/processors/strategies/strategies.ts b/src/ousd/processors/strategies/strategies.ts index 7de0effd..ed5390b5 100644 --- a/src/ousd/processors/strategies/strategies.ts +++ b/src/ousd/processors/strategies/strategies.ts @@ -22,26 +22,15 @@ import { makerDsrStrategy } from './maker-dsr-strategy' import { morphoAave } from './morpho-aave' import { morphoCompound } from './morpho-compound' -const DAI = { - address: '0x6b175474e89094c44da98b954eedeac495271d0f'.toLowerCase(), - decimals: 18, -} -const USDT = { - address: '0xdac17f958d2ee523a2206206994597c13d831ec7'.toLowerCase(), - decimals: 6, -} -const USDC = { - address: '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48'.toLowerCase(), - decimals: 6, -} - const ousdStrategies: readonly IStrategyData[] = [ - aaveStrategy, convexMetaStrategy, - morphoCompound, - morphoAave, - fluxStrategy, - makerDsrStrategy, + + // Reasonable Results + // aaveStrategy, + // morphoCompound, + // morphoAave, + // fluxStrategy, + // makerDsrStrategy, // Deprecated // { diff --git a/src/shared/processor-templates/strategy/strategy-curve-amo.ts b/src/shared/processor-templates/strategy/strategy-curve-amo.ts index 93c154db..9cfb5dad 100644 --- a/src/shared/processor-templates/strategy/strategy-curve-amo.ts +++ b/src/shared/processor-templates/strategy/strategy-curve-amo.ts @@ -66,6 +66,27 @@ export const getStrategyBalances = async ( ctx: Context, block: { height: number }, strategyData: IStrategyData, +) => { + if (strategyData.address === '0x1827f9ea98e0bf96550b2fc20f7233277fcd7e63') { + return getConvexEthMetaStrategyBalances(ctx, block, strategyData) + } + return await Promise.all( + strategyData.assets.map(async (asset) => { + const contract = new abstractStrategyAbi.Contract( + ctx, + block, + strategyData.address, + ) + const balance = await contract.checkBalance(asset.address) + return { address: strategyData.address, asset: asset.address, balance } + }), + ) +} + +export const getConvexEthMetaStrategyBalances = async ( + ctx: Context, + block: { height: number }, + strategyData: IStrategyData, ) => { const { assets, address, curvePoolInfo } = strategyData const { poolAddress, rewardsPoolAddress } = curvePoolInfo! @@ -78,6 +99,7 @@ export const getStrategyBalances = async ( const stakedLPBalance = await rewardsPool.balanceOf(address) let unstakedBalance = BigInt(0) + const pTokenAddresses = new Set() const poolAssets: string[] = [] const assetBalances: bigint[] = [] let totalPoolValue = BigInt(0) @@ -96,10 +118,15 @@ export const getStrategyBalances = async ( coins[i] = coin } - if (coin != OETH_ADDRESS) { + if (coin !== strategyData.oTokenAddress) { const pTokenAddr = await strategy.assetToPToken(assets[i].address) - const pToken = new erc20.Contract(ctx, block, pTokenAddr) - unstakedBalance += await pToken.balanceOf(address) + if (!pTokenAddresses.has(pTokenAddr)) { + pTokenAddresses.add(pTokenAddr) + const pToken = new erc20.Contract(ctx, block, pTokenAddr) + const pTokenBalance = await pToken.balanceOf(address) + ctx.log.info({ height: block.height, pTokenAddr, pTokenBalance }) + unstakedBalance += pTokenBalance + } } poolAssets.push(coin) diff --git a/src/shared/processor-templates/strategy/strategy-earnings.ts b/src/shared/processor-templates/strategy/strategy-earnings.ts index 4e698282..968faf95 100644 --- a/src/shared/processor-templates/strategy/strategy-earnings.ts +++ b/src/shared/processor-templates/strategy/strategy-earnings.ts @@ -42,11 +42,13 @@ const baseRewardPoolTopics = new Set([ const oTokenValues = { [OUSD_ADDRESS]: { rewardConversionToken: USDT_ADDRESS, + rewardConversionTokenDecimals: 6, harvester: OUSD_HARVESTER_ADDRESS, dripper: OUSD_DRIPPER_ADDRESS, }, [OETH_ADDRESS]: { rewardConversionToken: WETH_ADDRESS, + rewardConversionTokenDecimals: 18, harvester: OETH_HARVESTER_ADDRESS, dripper: OETH_DRIPPER_ADDRESS, }, @@ -104,11 +106,7 @@ export const setupStrategyEarnings = ( range: { from: strategyData.from }, }) processor.addLog({ - address: [ - strategyData.oTokenAddress === OUSD_ADDRESS - ? USDT_ADDRESS - : WETH_ADDRESS, - ], + address: [oTokenValues[strategyData.oTokenAddress].rewardConversionToken], topic0: [erc20.events.Transfer.topic], topic1: [pad(oTokenValues[strategyData.oTokenAddress].harvester)], topic2: [pad(oTokenValues[strategyData.oTokenAddress].dripper)], @@ -172,16 +170,16 @@ export const processStrategyEarnings = async ( .map((b) => { b.balance = convertDecimals( strategyData.assets.find( - (a) => a.address === b.asset.toLowerCase(), - )!, - strategyData.base, + (a) => a.address.toLowerCase() === b.asset.toLowerCase(), + )!.decimals, + strategyData.base.decimals, b.balance, ) b.compareBalance = convertDecimals( strategyData.assets.find( - (a) => a.address === b.asset.toLowerCase(), - )!, - strategyData.base, + (a) => a.address.toLowerCase() === b.asset.toLowerCase(), + )!.decimals, + strategyData.base.decimals, b.compareBalance, ) return b @@ -253,8 +251,13 @@ export const processStrategyEarnings = async ( block, strategyYields, { - token: WETH_ADDRESS, - amount, + token: strategyData.base.address, + amount: convertDecimals( + oTokenValues[strategyData.oTokenAddress] + .rewardConversionTokenDecimals, + strategyData.base.decimals, + amount, + ), }, ) } @@ -339,23 +342,7 @@ const processRewardTokenCollected = async ( id, ) - // Convert value to ETH - // const rates = await ensureExchangeRatesAverages( - // ctx, - // block, - // dayjs.utc(block.header.timestamp).subtract(1, 'week').toDate(), - // new Date(block.header.timestamp), - // [['ETH', params.token as Currency]], - // ) - const amount = params.amount - // const amount = convertRate( - // rates, - // 'ETH', - // params.token as Currency, - // params.amount, - // ) - if (!current) { current = new StrategyYield({ id, @@ -429,7 +416,7 @@ const processDepositWithdrawal = async ( let earningsChange = previousBalance - (latest?.balance ?? previousBalance) ?? 0n - // TODO: Probably should listen for add/remove liquidity events + // TODO: ??? Probably should listen for add/remove liquidity events // and calculate earnings changes from fees rather than relying on this // picking up those events. It works fine in some pools, but if we want to // remove OETH from APY considerations then we need more detail. @@ -472,6 +459,7 @@ const processDepositWithdrawal = async ( latest.strategy === current.strategy && latest.asset === current.asset && latest.balance === current.balance && + latest.balanceWeight === current.balanceWeight && latest.earningsChange === current.earningsChange && latest.earnings === current.earnings ) diff --git a/src/utils/utils.ts b/src/utils/utils.ts index 80cc621a..0a1aed23 100644 --- a/src/utils/utils.ts +++ b/src/utils/utils.ts @@ -93,18 +93,8 @@ export const getOrCreate = async ( return value } -export const convertDecimals = ( - from: { - address: string - decimals: number - }, - to: { - address: string - decimals: number - }, - value: bigint, -) => { - const fromFactor = 10n ** BigInt(from.decimals) - const toFactor = 10n ** BigInt(to.decimals) +export const convertDecimals = (from: number, to: number, value: bigint) => { + const fromFactor = 10n ** BigInt(from) + const toFactor = 10n ** BigInt(to) return (value * toFactor) / fromFactor } From 48e415716efffcc3a967481e36bd23affb6ca9f7 Mon Sep 17 00:00:00 2001 From: Chris Jacobs Date: Sun, 12 Nov 2023 13:28:11 -0800 Subject: [PATCH 18/34] ensure block frequency updater runs on the same blocks even after restarts --- src/main-ousd.ts | 3 +- src/ousd/validators/validate-ousd/index.ts | 1 + .../validators/validate-ousd/validate-ousd.ts | 129 ++++++++++++++++++ src/utils/blockFrequencyUpdater.ts | 33 +++-- 4 files changed, 154 insertions(+), 12 deletions(-) create mode 100644 src/ousd/validators/validate-ousd/index.ts create mode 100644 src/ousd/validators/validate-ousd/validate-ousd.ts diff --git a/src/main-ousd.ts b/src/main-ousd.ts index 79b3dd40..f1b4ee42 100644 --- a/src/main-ousd.ts +++ b/src/main-ousd.ts @@ -1,5 +1,6 @@ import * as ousd from './ousd/processors/ousd' import * as strategies from './ousd/processors/strategies/strategies' +import * as validateOusd from './ousd/validators/validate-ousd' import { run } from './processor' import * as exchangeRates from './shared/post-processors/exchange-rates' @@ -10,5 +11,5 @@ run({ strategies, ], postProcessors: [exchangeRates], - validators: [], + validators: [validateOusd], }) diff --git a/src/ousd/validators/validate-ousd/index.ts b/src/ousd/validators/validate-ousd/index.ts new file mode 100644 index 00000000..742fdc1d --- /dev/null +++ b/src/ousd/validators/validate-ousd/index.ts @@ -0,0 +1 @@ +export * from './validate-ousd' diff --git a/src/ousd/validators/validate-ousd/validate-ousd.ts b/src/ousd/validators/validate-ousd/validate-ousd.ts new file mode 100644 index 00000000..3fe97aed --- /dev/null +++ b/src/ousd/validators/validate-ousd/validate-ousd.ts @@ -0,0 +1,129 @@ +import { Entity, EntityClass } from '@subsquid/typeorm-store' +import assert from 'assert' +import { sortBy } from 'lodash' + +import { StrategyYield } from '../../../model' +import { Block, Context } from '../../../processor' +import { env } from '../../../utils/env' +import { jsonify } from '../../../utils/jsonify' + +export const name = 'validate-oeth' + +let firstBlock = true + +export const process = async (ctx: Context) => { + if (env.BLOCK_FROM) return + for (const block of ctx.blocks) { + await validateExpectations( + ctx, + block, + StrategyYield, + expectations.strategyYields, + ) + firstBlock = false + } +} + +const validateExpectations = async < + T extends Entity & { + timestamp: string + blockNumber: number + }, +>( + ctx: Context, + block: Block, + Class: EntityClass, + expectations?: T[], +) => { + if (!expectations) return + if (firstBlock) { + while (expectations[0]?.blockNumber < block.header.height) { + const entity = expectations.shift()! + await validateExpectation(ctx, Class, entity) + } + } + assert( + !expectations.length || expectations[0]?.blockNumber >= block.header.height, + 'Something is missing', + ) + while (expectations[0]?.blockNumber === block.header.height) { + const entity = expectations.shift()! + await validateExpectation(ctx, Class, entity) + } +} + +const validateExpectation = async < + T extends Entity & { + timestamp: string + blockNumber: number + }, +>( + ctx: Context, + Class: EntityClass, + expectation: T, +) => { + const actual = await ctx.store.findOne(Class, { + where: { id: expectation.id }, + }) + assert( + actual, + `Expected entity does not exist: Entity=${Class.name} id=${expectation.id}`, + ) + expectation.timestamp = new Date(expectation.timestamp).toJSON() + // We decide to only care about float decimal accuracy to the 8th. + assert.deepEqual( + JSON.parse( + jsonify(actual, (_key, value) => + typeof value === 'number' ? Number(value.toFixed(8)) : value, + ), + ), + JSON.parse( + jsonify(expectation, (_key, value) => + typeof value === 'number' ? Number(value.toFixed(8)) : value, + ), + ), + ) + ctx.log.info(`Validated entity: Entity=${Class.name} id=${expectation.id}`) +} + +const e = (arr: any[]) => { + return sortBy(arr, (v) => v.blockNumber) +} + +const expectations = { + strategyYields: e([ + { + id: '16421264:0x79f2188ef9350a1dc11a062cca0abe90684b0197:0x0000000000000000000000000000000000000348', + timestamp: '2023-01-16T18:52:35.000000Z', + blockNumber: 16421264, + strategy: '0x79f2188ef9350a1dc11a062cca0abe90684b0197', + asset: '0x0000000000000000000000000000000000000348', + balance: '1494000000000000000000000', + balanceWeight: 1, + earnings: '0', + earningsChange: '0', + }, + { + id: '16421590:0x79f2188ef9350a1dc11a062cca0abe90684b0197:0x0000000000000000000000000000000000000348', + timestamp: '2023-01-16T19:57:59.000000Z', + blockNumber: 16421590, + strategy: '0x79f2188ef9350a1dc11a062cca0abe90684b0197', + asset: '0x0000000000000000000000000000000000000348', + balance: '1494005405114000000000000', + balanceWeight: 1, + earnings: '5405114000000000000', + earningsChange: '5405114000000000000', + }, + { + id: '16427826:0x79f2188ef9350a1dc11a062cca0abe90684b0197:0x0000000000000000000000000000000000000348', + timestamp: '2023-01-17T16:50:23.000000Z', + blockNumber: 16427826, + strategy: '0x79f2188ef9350a1dc11a062cca0abe90684b0197', + asset: '0x0000000000000000000000000000000000000348', + balance: '1513111416702000000000000', + balanceWeight: 1, + earnings: '111399765000000000000', + earningsChange: '105994651000000000000', + }, + ]), +} as const diff --git a/src/utils/blockFrequencyUpdater.ts b/src/utils/blockFrequencyUpdater.ts index eefa197e..f91fc3b7 100644 --- a/src/utils/blockFrequencyUpdater.ts +++ b/src/utils/blockFrequencyUpdater.ts @@ -34,21 +34,33 @@ const getFrequency = (bps: number, timestamp: number) => { } export const blockFrequencyTracker = (params: { from: number }) => { - let nextBlockToProcess = 0 + let nextBlockToProcess = params.from + const shouldProcess = (b: Block, frequency: number) => { + let result = b.header.height >= nextBlockToProcess + if (result) { + nextBlockToProcess = + Math.floor((b.header.height + frequency) / frequency) * frequency + } + return result + } return (ctx: Context, block: Block) => { if (block.header.height < params.from) return const { bps } = ctx const frequency: number = getFrequency(bps, block.header.timestamp) - if (block.header.height >= nextBlockToProcess) { - nextBlockToProcess = block.header.height + frequency - return true - } - return false + return shouldProcess(block, frequency) } } export const blockFrequencyUpdater = (params: { from: number }) => { - let lastBlockHeightProcessed = 0 + let nextBlockToProcess = params.from + const shouldProcess = (b: Block, frequency: number) => { + let result = b.header.height >= nextBlockToProcess + if (result) { + nextBlockToProcess = + Math.floor((b.header.height + frequency) / frequency) * frequency + } + return result + } return async ( ctx: Context, fn: (ctx: Context, block: Block) => Promise, @@ -57,14 +69,13 @@ export const blockFrequencyUpdater = (params: { from: number }) => { // If we're not at head, determine our frequency and then process. const { bps } = ctx let frequency: number = getFrequency(bps, ctx.blocks[0].header.timestamp) - const nextBlockIndex = ctx.blocks.findIndex( - (b) => b.header.height >= lastBlockHeightProcessed + frequency, + const nextBlockIndex = ctx.blocks.findIndex((b) => + shouldProcess(b, frequency), ) for (let i = nextBlockIndex; i < ctx.blocks.length; i += frequency) { const block = ctx.blocks[i] - if (!block || block.header.height < params.from) continue + if (!shouldProcess(block, frequency)) continue await fn(ctx, block) - lastBlockHeightProcessed = block.header.height frequency = getFrequency(bps, block.header.timestamp) } } From c44d654ac1437a78c438751a7f3ac11b13ddc4df Mon Sep 17 00:00:00 2001 From: Chris Jacobs Date: Mon, 13 Nov 2023 13:10:36 -0800 Subject: [PATCH 19/34] fixes --- .../processor-templates/strategy/strategy-daily-earnings.ts | 3 ++- src/utils/blockFrequencyUpdater.ts | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/shared/processor-templates/strategy/strategy-daily-earnings.ts b/src/shared/processor-templates/strategy/strategy-daily-earnings.ts index bb6c9b76..0d1fe968 100644 --- a/src/shared/processor-templates/strategy/strategy-daily-earnings.ts +++ b/src/shared/processor-templates/strategy/strategy-daily-earnings.ts @@ -74,7 +74,8 @@ export const processStrategyDailyEarnings = async ( yields.sort((a, b) => b.blockNumber - a.blockNumber) const balance = max(yields.map((y) => y.balance)) // Use the highest balance in the last day. (conservative approach) - const balanceWeight = Math.min(...yields.map((y) => y.balanceWeight)) // Use the lowest balance weight in the last day. (conservative approach) + const balanceWeight = // Use the lowest balance weight in the last day. (conservative approach) + Math.min(1, ...yields.map((y) => y.balanceWeight)) const earnings = yields[yields.length - 1]?.earnings ?? 0n const earningsChange = todayYields.reduce( (sum, y) => sum + y.earningsChange, diff --git a/src/utils/blockFrequencyUpdater.ts b/src/utils/blockFrequencyUpdater.ts index f91fc3b7..228b3bd3 100644 --- a/src/utils/blockFrequencyUpdater.ts +++ b/src/utils/blockFrequencyUpdater.ts @@ -72,6 +72,7 @@ export const blockFrequencyUpdater = (params: { from: number }) => { const nextBlockIndex = ctx.blocks.findIndex((b) => shouldProcess(b, frequency), ) + if (nextBlockIndex === -1) return for (let i = nextBlockIndex; i < ctx.blocks.length; i += frequency) { const block = ctx.blocks[i] if (!shouldProcess(block, frequency)) continue From 056905ddd897f3e1209fa650ffdca88ed0ccd239 Mon Sep 17 00:00:00 2001 From: Chris Jacobs Date: Mon, 13 Nov 2023 14:19:21 -0800 Subject: [PATCH 20/34] vault strategies rETH and stETH --- src/oeth/processors/strategies/strategies.ts | 95 +++++++------------ src/ousd/processors/strategies/strategies.ts | 14 ++- .../exchange-rates/exchange-rates.ts | 70 +++++++------- .../strategy/strategy-daily-earnings.ts | 1 + .../strategy/strategy-earnings.ts | 65 +++++++++---- .../strategy/strategy-vault.ts | 83 ++++++++++++++++ .../processor-templates/strategy/strategy.ts | 10 +- 7 files changed, 214 insertions(+), 124 deletions(-) create mode 100644 src/shared/processor-templates/strategy/strategy-vault.ts diff --git a/src/oeth/processors/strategies/strategies.ts b/src/oeth/processors/strategies/strategies.ts index b399dcde..8f2707c6 100644 --- a/src/oeth/processors/strategies/strategies.ts +++ b/src/oeth/processors/strategies/strategies.ts @@ -13,8 +13,12 @@ import { createStrategyRewardSetup, } from '../../../shared/processor-templates/strategy-rewards' import { + ETH_ADDRESS, FRXETH_ADDRESS, OETH_ADDRESS, + OETH_VAULT_ADDRESS, + RETH_ADDRESS, + STETH_ADDRESS, WETH_ADDRESS, } from '../../../utils/addresses' @@ -75,6 +79,36 @@ export const oethStrategies: readonly IStrategyData[] = [ // poolAddress: '0x1e19cf2d73a72ef1332c882f20534b6519be0276', // }, // }, + { + from: 17141121, + name: 'OETH Vault (rETH)', + contractName: 'VaultCore', + address: OETH_VAULT_ADDRESS, + oTokenAddress: OETH_ADDRESS, + kind: 'Vault', + base: { address: RETH_ADDRESS, decimals: 18 }, + assets: [RETH_ADDRESS].map((address) => ({ + address, + decimals: 18, + convertTo: { + address: ETH_ADDRESS, + decimals: 18, + }, + })), + }, + { + from: 17067232, + name: 'OETH Vault (stETH)', + contractName: 'VaultCore', + address: OETH_VAULT_ADDRESS, + oTokenAddress: OETH_ADDRESS, + kind: 'Vault', + base: { address: STETH_ADDRESS, decimals: 18 }, + assets: [STETH_ADDRESS].map((address) => ({ + address, + decimals: 18, + })), + }, ] const strategies = oethStrategies @@ -99,64 +133,3 @@ const processors = [ export const process = async (ctx: Context) => { await Promise.all(processors.map((p) => p(ctx))) } - -// Useful values for OUSD later - -// const DAI = '0x6b175474e89094c44da98b954eedeac495271d0f'.toLowerCase() -// const USDT = '0xdac17f958d2ee523a2206206994597c13d831ec7'.toLowerCase() -// const USDC = '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48'.toLowerCase() - -// const ousdStrategies = [ -// { -// from: 14206832, // 13369326, Initial Deploy -// name: 'OUSD Aave', -// address: '0x5e3646a1db86993f73e6b74a57d8640b69f7e259'.toLowerCase(), -// assets: [DAI, USDT, USDC], -// }, -// { -// from: 15896478, -// name: 'OUSD Convex OUSD+3Crv (AMO)', -// address: '0x89eb88fedc50fc77ae8a18aad1ca0ac27f777a90'.toLowerCase(), -// assets: [DAI, USDT, USDC], -// }, -// { -// from: 15949661, -// name: 'OUSD Morpho Compound', -// address: '0x5a4eee58744d1430876d5ca93cab5ccb763c037d'.toLowerCase(), -// assets: [DAI, USDT, USDC], -// }, -// { -// from: 16331911, -// name: 'OUSD Morpho Aave', -// address: '0x79F2188EF9350A1dC11A062cca0abE90684b0197'.toLowerCase(), -// assets: [DAI, USDT, USDC], -// }, -// { -// from: 17877308, -// name: 'OUSD Flux', -// address: '0x76Bf500B6305Dc4ea851384D3d5502f1C7a0ED44'.toLowerCase(), -// assets: [DAI, USDT, USDC], -// }, -// { -// from: 17883036, -// name: 'OUSD Maker DSR', -// address: '0x6b69B755C629590eD59618A2712d8a2957CA98FC'.toLowerCase(), -// assets: [DAI, USDT, USDC], -// }, -// Deprecated -// { -// from: 13369299, -// name: 'CompoundStrategy', -// address: '0x9c459eeb3fa179a40329b81c1635525e9a0ef094'.toLowerCase(), -// }, -// { -// from: 13639477, -// name: 'ConvexStrategy', -// address: '0xea2ef2e2e5a749d4a66b41db9ad85a38aa264cb3'.toLowerCase(), -// }, -// { -// from: 16226229, -// name: 'LUSDMetaStrategy', -// address: '0x7A192DD9Cc4Ea9bdEdeC9992df74F1DA55e60a19'.toLowerCase(), -// }, -// ] as const diff --git a/src/ousd/processors/strategies/strategies.ts b/src/ousd/processors/strategies/strategies.ts index ed5390b5..f296a91e 100644 --- a/src/ousd/processors/strategies/strategies.ts +++ b/src/ousd/processors/strategies/strategies.ts @@ -24,14 +24,12 @@ import { morphoCompound } from './morpho-compound' const ousdStrategies: readonly IStrategyData[] = [ convexMetaStrategy, - - // Reasonable Results - // aaveStrategy, - // morphoCompound, - // morphoAave, - // fluxStrategy, - // makerDsrStrategy, - + aaveStrategy, + morphoCompound, + morphoAave, + fluxStrategy, + makerDsrStrategy, + // Deprecated // { // from: 13369299, diff --git a/src/shared/post-processors/exchange-rates/exchange-rates.ts b/src/shared/post-processors/exchange-rates/exchange-rates.ts index 828c630c..ce7147b1 100644 --- a/src/shared/post-processors/exchange-rates/exchange-rates.ts +++ b/src/shared/post-processors/exchange-rates/exchange-rates.ts @@ -65,38 +65,38 @@ export const ensureExchangeRates = async ( ).then(compact) } -// export const ensureExchangeRatesAverages = async ( -// ctx: Context, -// block: Block, -// from: Date, -// to: Date, -// pairs: [Currency, Currency][], -// ) => { -// return await Promise.all( -// pairs.map(([base, quote]) => -// ensureExchangeRate(ctx, block, base, quote) -// .then((rate) => { -// if (!rate) return [] -// return ctx.store -// .find(ExchangeRate, { -// where: { pair: rate?.pair, timestamp: Between(from, to) }, -// }) -// .then((rates) => rates.concat(rate!)) -// }) -// .then((rates) => { -// const pair = `${base}_${quote}` -// const rate = -// rates.reduce((sum, r) => sum + r.rate, 0n) / BigInt(rates.length) -// ctx.log.info( -// `Created average exchange rate of ${rate} using ${rates.length} rates`, -// ) -// return new ExchangeRate({ -// base: rates[0].base, -// quote: rates[0].quote, -// pair, -// rate, -// }) -// }), -// ), -// ) -// } +export const ensureExchangeRatesAverages = async ( + ctx: Context, + block: Block, + from: Date, + to: Date, + pairs: [Currency, Currency][], +) => { + return await Promise.all( + pairs.map(([base, quote]) => + ensureExchangeRate(ctx, block, base, quote) + .then((rate) => { + if (!rate) return [] + return ctx.store + .find(ExchangeRate, { + where: { pair: rate?.pair, timestamp: Between(from, to) }, + }) + .then((rates) => rates.concat(rate!)) + }) + .then((rates) => { + const pair = `${base}_${quote}` + const rate = + rates.reduce((sum, r) => sum + r.rate, 0n) / BigInt(rates.length) + ctx.log.info( + `Created average exchange rate of ${rate} using ${rates.length} rates`, + ) + return new ExchangeRate({ + base: rates[0].base, + quote: rates[0].quote, + pair, + rate, + }) + }), + ), + ) +} diff --git a/src/shared/processor-templates/strategy/strategy-daily-earnings.ts b/src/shared/processor-templates/strategy/strategy-daily-earnings.ts index 0d1fe968..d1312811 100644 --- a/src/shared/processor-templates/strategy/strategy-daily-earnings.ts +++ b/src/shared/processor-templates/strategy/strategy-daily-earnings.ts @@ -128,6 +128,7 @@ const getLatest = async ( order: { id: 'desc' }, where: { strategy: strategyData.address, + asset: strategyData.base.address, id: LessThan(id), }, })) diff --git a/src/shared/processor-templates/strategy/strategy-earnings.ts b/src/shared/processor-templates/strategy/strategy-earnings.ts index 968faf95..beb34b0f 100644 --- a/src/shared/processor-templates/strategy/strategy-earnings.ts +++ b/src/shared/processor-templates/strategy/strategy-earnings.ts @@ -25,6 +25,11 @@ import { import { blockFrequencyTracker } from '../../../utils/blockFrequencyUpdater' import { logFilter } from '../../../utils/logFilter' import { convertDecimals, lastExcept } from '../../../utils/utils' +import { ensureExchangeRatesAverages } from '../../post-processors/exchange-rates' +import { + Currency, + convertRate, +} from '../../post-processors/exchange-rates/currencies' import { IStrategyData } from './strategy' import { processStrategyDailyEarnings } from './strategy-daily-earnings' @@ -64,7 +69,7 @@ export const setupStrategyEarnings = ( // Detect Deposit/Withdraw events // To help us understand when balances change passively vs from activity. - if (strategyData.earnings.passiveByDepositWithdrawal) { + if (strategyData.earnings?.passiveByDepositWithdrawal) { processor.addLog({ address: [strategyData.address], topic0: [...depositWithdrawalTopics.values()], @@ -99,7 +104,7 @@ export const setupStrategyEarnings = ( // Listen for RewardTokenCollected events and their associated logs // showing how much WETH Harvester sent to Dripper. - if (strategyData.earnings.rewardTokenCollected) { + if (strategyData.earnings?.rewardTokenCollected) { processor.addLog({ address: [strategyData.address], topic0: [abstractStrategyAbi.events.RewardTokenCollected.topic], @@ -114,6 +119,21 @@ export const setupStrategyEarnings = ( }) } + if (strategyData.kind === 'Vault') { + balanceUpdateFilters.push( + logFilter({ + address: strategyData.assets.map((asset) => asset.address), + topic0: [erc20.events.Transfer.topic], + topic1: [strategyData.address], + }), + logFilter({ + address: strategyData.assets.map((asset) => asset.address), + topic0: [erc20.events.Transfer.topic], + topic2: [strategyData.address], + }), + ) + } + for (const filter of balanceUpdateFilters) { processor.addLog(filter.value) } @@ -275,7 +295,7 @@ export const processStrategyEarnings = async ( await balanceTrackingUpdate() } else if ( log.address === strategyData.address && - strategyData.earnings.passiveByDepositWithdrawal && + strategyData.earnings?.passiveByDepositWithdrawal && depositWithdrawalTopics.has(log.topics[0]) ) { ctx.log.info({ @@ -288,7 +308,7 @@ export const processStrategyEarnings = async ( await balanceTrackingUpdate() } else if ( log.address === strategyData.address && - strategyData.earnings.rewardTokenCollected && + strategyData.earnings?.rewardTokenCollected && log.topics[0] === abstractStrategyAbi.events.RewardTokenCollected.topic && !txIgnore.has(log.transactionHash) @@ -386,20 +406,29 @@ const processDepositWithdrawal = async ( if (!current) { // Convert incoming values to ETH - // const rates = await ensureExchangeRatesAverages( - // ctx, - // block, - // dayjs.utc(block.header.timestamp).subtract(1, 'week').toDate(), - // new Date(block.header.timestamp), - // assets.map((a) => ['ETH', a.asset as Currency]), - // ) - const previousBalance = assets.reduce((sum, a) => { - return ( - sum + a.compareBalance // convertRate(rates, 'ETH', a.asset as Currency, a.compareBalance) - ) + const desiredRates = strategyData.assets + .filter((a) => a.convertTo) + .map((a) => [a.convertTo!.address, a.address]) as [Currency, Currency][] + const rates = await ensureExchangeRatesAverages( + ctx, + block, + dayjs.utc(block.header.timestamp).subtract(21, 'days').toDate(), + new Date(block.header.timestamp), + desiredRates, + ) + const previousBalance = assets.reduce((sum, a, index) => { + const asset = strategyData.assets[index] + const compareBalance = asset.convertTo + ? convertRate(rates, 'ETH', a.asset as Currency, a.compareBalance) + : a.compareBalance + return sum + compareBalance }, 0n) - const balance = assets.reduce((sum, a) => { - return sum + a.balance // convertRate(rates, 'ETH', a.asset as Currency, a.balance) + const balance = assets.reduce((sum, a, index) => { + const asset = strategyData.assets[index] + const balance = asset.convertTo + ? convertRate(rates, 'ETH', a.asset as Currency, a.balance) + : a.balance + return sum + balance }, 0n) const otokenBalance = @@ -410,8 +439,6 @@ const processDepositWithdrawal = async ( eth1 - (balance === 0n ? 0n : (otokenBalance * eth1) / balance) const balanceWeight = Number(formatEther(balanceWeightN)) - // ctx.log.info({ balanceWeight }) - const timestamp = new Date(block.header.timestamp) let earningsChange = previousBalance - (latest?.balance ?? previousBalance) ?? 0n diff --git a/src/shared/processor-templates/strategy/strategy-vault.ts b/src/shared/processor-templates/strategy/strategy-vault.ts new file mode 100644 index 00000000..5e4416a8 --- /dev/null +++ b/src/shared/processor-templates/strategy/strategy-vault.ts @@ -0,0 +1,83 @@ +import { EvmBatchProcessor } from '@subsquid/evm-processor' + +import * as erc20 from '../../../abi/erc20' +import { StrategyBalance } from '../../../model' +import { Block, Context } from '../../../processor' +import { blockFrequencyUpdater } from '../../../utils/blockFrequencyUpdater' +import { convertDecimals } from '../../../utils/utils' +import { IStrategyData } from './index' +import { + processStrategyEarnings, + setupStrategyEarnings, +} from './strategy-earnings' + +export const setup = ( + processor: EvmBatchProcessor, + strategyData: IStrategyData, +) => { + processor.includeAllBlocks({ from: strategyData.from }) + setupStrategyEarnings(processor, strategyData) +} + +const trackers = new Map>() +export const process = async (ctx: Context, strategyData: IStrategyData) => { + if (!trackers.has(strategyData.address)) { + trackers.set( + strategyData.address, + blockFrequencyUpdater({ from: strategyData.from }), + ) + } + const blockFrequencyUpdate = trackers.get(strategyData.address)! + const strategyBalances: StrategyBalance[] = [] + await blockFrequencyUpdate(ctx, async (ctx, block) => { + const results = await getStrategyHoldings(ctx, block, strategyData) + strategyBalances.push(...results) + }) + await ctx.store.insert(strategyBalances) + await processStrategyEarnings(ctx, strategyData, getStrategyBalances) +} + +const getStrategyHoldings = async ( + ctx: Context, + block: Block, + strategyData: IStrategyData, +): Promise => { + const { assets, address } = strategyData + const balances = await getStrategyBalances(ctx, block.header, strategyData) + const promises = assets.map(async (asset) => { + return new StrategyBalance({ + id: `${address}:${asset.address}:${block.header.height}`, + strategy: address, + asset: asset.address, + balance: balances.find((b) => b.asset === asset.address)?.balance, + blockNumber: block.header.height, + timestamp: new Date(block.header.timestamp), + }) + }) + + return await Promise.all(promises) +} + +const getStrategyBalances = async ( + ctx: Context, + block: { + height: number + }, + strategyData: IStrategyData, +) => { + return await Promise.all( + strategyData.assets.map(async (asset) => { + const contract = new erc20.Contract(ctx, block, asset.address) + const balance = await contract.balanceOf(strategyData.address) + return { + address: strategyData.address, + asset: asset.address, + balance: convertDecimals( + asset.decimals, + strategyData.base.decimals, + balance, + ), + } + }), + ) +} diff --git a/src/shared/processor-templates/strategy/strategy.ts b/src/shared/processor-templates/strategy/strategy.ts index 133f0271..66c2b3cf 100644 --- a/src/shared/processor-templates/strategy/strategy.ts +++ b/src/shared/processor-templates/strategy/strategy.ts @@ -1,4 +1,5 @@ import { EvmBatchProcessor } from '@subsquid/evm-processor' +import durationPlugin from 'dayjs/plugin/duration' import { Context } from '../../../processor' import { OETH_ADDRESS, OUSD_ADDRESS } from '../../../utils/addresses' @@ -7,6 +8,7 @@ import { TraceFilter } from '../../../utils/traceFilter' import * as strategyBalancer from './strategy-balancer' import * as strategyCurveAMO from './strategy-curve-amo' import * as strategyGeneric from './strategy-generic' +import * as strategyVault from './strategy-vault' export type IBalancerPoolInfo = { poolId: string @@ -26,6 +28,7 @@ export type IStrategyData = { address: string kind: | 'Generic' + | 'Vault' | 'CurveAMO' | 'BalancerMetaStablePool' | 'BalancerComposableStablePool' @@ -36,6 +39,10 @@ export type IStrategyData = { assets: { address: string decimals: number + convertTo?: { + address: string + decimals: number + } }[] balanceUpdateLogFilters?: LogFilter[] balanceUpdateTraceFilters?: TraceFilter[] @@ -45,7 +52,7 @@ export type IStrategyData = { } balancerPoolInfo?: IBalancerPoolInfo curvePoolInfo?: ICurveAMOInfo - earnings: { + earnings?: { rewardTokenCollected?: boolean passiveByDepositWithdrawal?: boolean passiveByDepositWithdrawalByTrace?: boolean @@ -60,6 +67,7 @@ const processors: Record< } > = { Generic: strategyGeneric, + Vault: strategyVault, CurveAMO: strategyCurveAMO, BalancerMetaStablePool: strategyBalancer, BalancerComposableStablePool: { From e1bc846a18d1531d36c2698ee0ce2001aad15075 Mon Sep 17 00:00:00 2001 From: Nick Poulden Date: Mon, 13 Nov 2023 13:42:38 -0800 Subject: [PATCH 21/34] cherry-pick fix from Nick P --- src/shared/processor-templates/otoken/utils.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/shared/processor-templates/otoken/utils.ts b/src/shared/processor-templates/otoken/utils.ts index 2ad49be3..bb33af5e 100644 --- a/src/shared/processor-templates/otoken/utils.ts +++ b/src/shared/processor-templates/otoken/utils.ts @@ -131,8 +131,8 @@ export async function createRebaseAPY< apy.rebasingCreditsPerToken = rebaseEvent.rebasingCreditsPerToken const apyCalc = calculateAPY( - lastApy.timestamp, - apy.timestamp, + dayjs.utc(lastApy.timestamp).endOf('day').toDate(), + dayjs.utc(apy.timestamp).endOf('day').toDate(), apy.rebasingCreditsPerToken, lastApy.rebasingCreditsPerToken, ) From 2659962b66cfb98ee9e15945e2a4b6473f4d5707 Mon Sep 17 00:00:00 2001 From: Chris Jacobs Date: Mon, 13 Nov 2023 15:11:05 -0800 Subject: [PATCH 22/34] prep to run all --- src/main-other.ts | 10 --- src/main-ousd.ts | 5 +- .../validators/validate-oeth/validate-oeth.ts | 68 +------------------ 3 files changed, 2 insertions(+), 81 deletions(-) diff --git a/src/main-other.ts b/src/main-other.ts index 0f6d9bc6..2c213e03 100644 --- a/src/main-other.ts +++ b/src/main-other.ts @@ -1,13 +1,3 @@ -import * as dailyStats from './oeth/post-processors/daily-stats' -import * as oeth from './oeth/processors' -import * as balancerMetaPoolStrategy from './oeth/processors/balancer-meta-pool' -import * as curveLp from './oeth/processors/curve-lp' -import * as dripper from './oeth/processors/dripper' -import * as fraxStaking from './oeth/processors/frax-staking' -import * as morphoAave from './oeth/processors/morpho-aave' -import * as strategies from './oeth/processors/strategies' -import * as vault from './oeth/processors/vault' -import * as validateOeth from './oeth/validators/validate-oeth' import { run } from './processor' import * as exchangeRates from './shared/post-processors/exchange-rates' import * as aaveCompound from './shared/processors/aave-compound' diff --git a/src/main-ousd.ts b/src/main-ousd.ts index f1b4ee42..dfe62119 100644 --- a/src/main-ousd.ts +++ b/src/main-ousd.ts @@ -6,10 +6,7 @@ import * as exchangeRates from './shared/post-processors/exchange-rates' run({ stateSchema: 'ousd-processor', - processors: [ - // ousd, - strategies, - ], + processors: [ousd, strategies], postProcessors: [exchangeRates], validators: [validateOusd], }) diff --git a/src/oeth/validators/validate-oeth/validate-oeth.ts b/src/oeth/validators/validate-oeth/validate-oeth.ts index 63015b30..3a31c518 100644 --- a/src/oeth/validators/validate-oeth/validate-oeth.ts +++ b/src/oeth/validators/validate-oeth/validate-oeth.ts @@ -113,73 +113,7 @@ const e = (arr: any[]) => { } const expectations = { - oethApies: e([ - { - id: '2023-05-21', - blockNumber: 17308770, - timestamp: '2023-05-21T15:56:35.000000Z', - apr: 0.16602547769982764, - apy: 0.18057162002158744, - apy14DayAvg: 0.13580689693628772, - apy30DayAvg: 71.91799220107755, - apy7DayAvg: 0.1316157561741356, - rebasingCreditsPerToken: '973558594004638273359591150', - txHash: - '0x51f29d85120bcfd778966df4e48b76a3c71c9c234cf7b25686e4ac91db412d8c', - }, - { - id: '2023-07-10', - blockNumber: 17665600, - timestamp: '2023-07-10T20:21:35.000000Z', - apr: 0.0733424611059912, - apy: 0.07608887367524164, - apy14DayAvg: 0.09265404218819209, - apy30DayAvg: 0.10058755647324388, - apy7DayAvg: 0.09496520318128009, - rebasingCreditsPerToken: '961364244058751780406499058', - txHash: - '0x6f4bdbbe1ae933cd140a0d438c7e5f4c68b9deead2768263d7641e90d4a0a097', - }, - { - id: '2023-07-11', - blockNumber: 17670987, - timestamp: '2023-07-11T14:32:35.000000Z', - apr: 0.10857842918766517, - apy: 0.11467870202052977, - apy14DayAvg: 0.09535269567741077, - apy30DayAvg: 0.10185645436835511, - apy7DayAvg: 0.09375739816960833, - rebasingCreditsPerToken: '961147770054335281101637566', - txHash: - '0x8f7bf364b8f76174643efc8b32f301d1e2face0f076f1b01f65b8c9f01d408c5', - }, - { - id: '2023-09-17', - blockNumber: 18154149, - timestamp: '2023-09-17T06:59:47.000000Z', - apr: 0.08216005342266121, - apy: 0.0856202277249658, - apy14DayAvg: 0.08075225029410789, - apy30DayAvg: 0.08356906482602125, - apy7DayAvg: 0.08119969703969342, - rebasingCreditsPerToken: '947758663109881526211028768', - txHash: - '0xa4533cc844d8e5a52f444bc32dba546b404860cafa642c210973be6a12242aeb', - }, - { - id: '2023-10-25', - blockNumber: 18425626, - timestamp: '2023-10-25T07:00:11.000000Z', - apr: 0.045516307791970176, - apy: 0.04656591498844653, - apy14DayAvg: 0.04977127541255704, - apy30DayAvg: 0.062044304063055396, - apy7DayAvg: 0.04802668795516692, - rebasingCreditsPerToken: '941364114470046460777492892', - txHash: - '0x67ef6bda379e51a3983f7c2822b39538a40fb93b1d26f66b687da41657f17239', - }, - ]), + oethApies: e([]), oethHistories: e([ { balance: '4994819891394470874', From d06b32ff8856a2e95ff6e9da27e06896f1c58b29 Mon Sep 17 00:00:00 2001 From: Chris Jacobs Date: Tue, 14 Nov 2023 10:25:36 -0800 Subject: [PATCH 23/34] fix issues found after deployment --- commands.json | 12 ++++++ squid.yaml | 35 ++++++++-------- src/main.ts | 43 ++++++++++++++++++++ src/oeth/processors/strategies/strategies.ts | 35 ++++++++-------- src/processor.ts | 2 +- 5 files changed, 94 insertions(+), 33 deletions(-) create mode 100644 src/main.ts diff --git a/commands.json b/commands.json index 41d2394b..a59465bc 100644 --- a/commands.json +++ b/commands.json @@ -88,6 +88,18 @@ "--multicall" ] }, + "process": { + "description": "Load .env and start the squid processor", + "deps": [ + "build", + "migration:apply" + ], + "cmd": [ + "node", + "--require=dotenv/config", + "lib/main.js" + ] + }, "process:oeth": { "description": "Load .env and start the squid processor", "deps": [ diff --git a/squid.yaml b/squid.yaml index 64eb4258..ca2b82af 100644 --- a/squid.yaml +++ b/squid.yaml @@ -10,22 +10,25 @@ deploy: - RPC_ENDPOINT - RPC_ENDPOINT_999 processor: - - name: oeth-processor - cmd: [ "node", "lib/main-oeth" ] - env: - RPC_ENV: RPC_ENDPOINT_999 - - name: ousd-processor - cmd: [ "node", "lib/main-ousd" ] - env: - RPC_ENV: RPC_ENDPOINT_999 - - name: ogv-processor - cmd: [ "node", "lib/main-ogv" ] - env: - RPC_ENV: RPC_ENDPOINT_999 - - name: other-processor - cmd: [ "node", "lib/main-other" ] - env: - RPC_ENV: RPC_ENDPOINT_999 + cmd: [ "node", "lib/main" ] + env: + RPC_ENV: RPC_ENDPOINT_999 + # - name: oeth-processor + # cmd: [ "node", "lib/main-oeth" ] + # env: + # RPC_ENV: RPC_ENDPOINT_999 + # - name: ousd-processor + # cmd: [ "node", "lib/main-ousd" ] + # env: + # RPC_ENV: RPC_ENDPOINT_999 + # - name: ogv-processor + # cmd: [ "node", "lib/main-ogv" ] + # env: + # RPC_ENV: RPC_ENDPOINT_999 + # - name: other-processor + # cmd: [ "node", "lib/main-other" ] + # env: + # RPC_ENV: RPC_ENDPOINT_999 api: cmd: - npx diff --git a/src/main.ts b/src/main.ts new file mode 100644 index 00000000..3d235d16 --- /dev/null +++ b/src/main.ts @@ -0,0 +1,43 @@ +import * as oeth_dailyStats from './oeth/post-processors/daily-stats' +import * as oeth from './oeth/processors' +import * as oeth_balancerMetaPoolStrategy from './oeth/processors/balancer-meta-pool' +import * as oeth_curveLp from './oeth/processors/curve-lp' +import * as oeth_dripper from './oeth/processors/dripper' +import * as oeth_exchangeRates from './oeth/processors/exchange-rates' +import * as oeth_fraxStaking from './oeth/processors/frax-staking' +import * as oeth_morphoAave from './oeth/processors/morpho-aave' +import * as oeth_strategies from './oeth/processors/strategies' +import * as oeth_vault from './oeth/processors/vault' +import * as oeth_validate from './oeth/validators/validate-oeth' +import * as ousd from './ousd/processors/ousd' +import * as ousd_strategies from './ousd/processors/strategies' +import * as ousd_validate from './ousd/validators/validate-ousd' +import { run } from './processor' +import * as exchangeRatesPostProcessor from './shared/post-processors/exchange-rates' +import * as shared_aaveCompound from './shared/processors/aave-compound' +import * as shared_curve from './shared/processors/curve' + +run({ + processors: [ + // OETH + oeth, + oeth_vault, + oeth_fraxStaking, + oeth_morphoAave, + oeth_dripper, + oeth_curveLp, + oeth_balancerMetaPoolStrategy, + oeth_strategies, + oeth_exchangeRates, + + // OUSD + ousd, + ousd_strategies, + + // Shared + shared_aaveCompound, + shared_curve, + ], + postProcessors: [exchangeRatesPostProcessor, oeth_dailyStats], + validators: [oeth_validate, ousd_validate], +}) diff --git a/src/oeth/processors/strategies/strategies.ts b/src/oeth/processors/strategies/strategies.ts index 8f2707c6..65c5bb93 100644 --- a/src/oeth/processors/strategies/strategies.ts +++ b/src/oeth/processors/strategies/strategies.ts @@ -63,22 +63,25 @@ export const oethStrategies: readonly IStrategyData[] = [ assets: [WETH_ADDRESS].map((address) => ({ address, decimals: 18 })), earnings: { passiveByDepositWithdrawal: true, rewardTokenCollected: true }, }, - // { - // from: 18156225, - // name: 'OETH Aura rETH/WETH', - // contractName: 'BalancerMetaPoolStrategy', - // address: '0x49109629ac1deb03f2e9b2fe2ac4a623e0e7dfdc', - // oTokenAddress: OETH_ADDRESS, - // kind: 'BalancerMetaStablePool', - // base: { address: currencies.ETH, decimals: 18}, - // assets: [WETH_ADDRESS, RETH_ADDRESS].map(address => ({address, decimals: 18})), - // earnings: { rewardTokenCollected: true, passiveByDepositWithdrawal: true }, - // balancerPoolInfo: { - // poolId: - // '0x1e19cf2d73a72ef1332c882f20534b6519be0276000200000000000000000112', - // poolAddress: '0x1e19cf2d73a72ef1332c882f20534b6519be0276', - // }, - // }, + { + from: 18156225, + name: 'OETH Aura rETH/WETH', + contractName: 'BalancerMetaPoolStrategy', + address: '0x49109629ac1deb03f2e9b2fe2ac4a623e0e7dfdc', + oTokenAddress: OETH_ADDRESS, + kind: 'BalancerMetaStablePool', + base: { address: currencies.ETH, decimals: 18 }, + assets: [WETH_ADDRESS, RETH_ADDRESS].map((address) => ({ + address, + decimals: 18, + })), + earnings: { rewardTokenCollected: true, passiveByDepositWithdrawal: true }, + balancerPoolInfo: { + poolId: + '0x1e19cf2d73a72ef1332c882f20534b6519be0276000200000000000000000112', + poolAddress: '0x1e19cf2d73a72ef1332c882f20534b6519be0276', + }, + }, { from: 17141121, name: 'OETH Vault (rETH)', diff --git a/src/processor.ts b/src/processor.ts index 68a03229..61ce6fb3 100644 --- a/src/processor.ts +++ b/src/processor.ts @@ -78,7 +78,7 @@ export const run = ({ postProcessors, validators, }: { - stateSchema: string + stateSchema?: string processors: Processor[] postProcessors?: Pick[] validators?: Pick[] From 0403991f869184cd35b3880a59b81f0178ce7919 Mon Sep 17 00:00:00 2001 From: Chris Jacobs Date: Tue, 14 Nov 2023 15:39:04 -0800 Subject: [PATCH 24/34] small fixes --- DEPENDENCIES.md | 1 + .../strategies/maker-dsr-strategy.ts | 4 +- .../validators/validate-ousd/validate-ousd.ts | 71 ++++++++++--------- src/utils/blockFrequencyUpdater.ts | 15 ++-- 4 files changed, 48 insertions(+), 43 deletions(-) diff --git a/DEPENDENCIES.md b/DEPENDENCIES.md index 4df05624..b73ddf68 100644 --- a/DEPENDENCIES.md +++ b/DEPENDENCIES.md @@ -5,3 +5,4 @@ next version. - https://github.com/OriginProtocol/oeth.com - https://github.com/OriginProtocol/origin-defi +- https://origindefi.grafana.net/dashboards \ No newline at end of file diff --git a/src/ousd/processors/strategies/maker-dsr-strategy.ts b/src/ousd/processors/strategies/maker-dsr-strategy.ts index 3fc8ed31..5bb86ea7 100644 --- a/src/ousd/processors/strategies/maker-dsr-strategy.ts +++ b/src/ousd/processors/strategies/maker-dsr-strategy.ts @@ -4,13 +4,13 @@ import { OUSD_ADDRESS } from '../../../utils/addresses' import { DAI, USDC, USDT } from './const' export const makerDsrStrategy: IStrategyData = { - from: 17883036, + from: 17883037, oTokenAddress: OUSD_ADDRESS, kind: 'Generic', name: 'OUSD Maker DSR', contractName: 'Generalized4626Strategy', address: '0x6b69B755C629590eD59618A2712d8a2957CA98FC'.toLowerCase(), base: { address: currencies.USD, decimals: 18 }, - assets: [DAI, USDT, USDC], + assets: [DAI], earnings: { passiveByDepositWithdrawal: true, rewardTokenCollected: true }, } diff --git a/src/ousd/validators/validate-ousd/validate-ousd.ts b/src/ousd/validators/validate-ousd/validate-ousd.ts index 3fe97aed..cc624c1b 100644 --- a/src/ousd/validators/validate-ousd/validate-ousd.ts +++ b/src/ousd/validators/validate-ousd/validate-ousd.ts @@ -91,39 +91,40 @@ const e = (arr: any[]) => { } const expectations = { - strategyYields: e([ - { - id: '16421264:0x79f2188ef9350a1dc11a062cca0abe90684b0197:0x0000000000000000000000000000000000000348', - timestamp: '2023-01-16T18:52:35.000000Z', - blockNumber: 16421264, - strategy: '0x79f2188ef9350a1dc11a062cca0abe90684b0197', - asset: '0x0000000000000000000000000000000000000348', - balance: '1494000000000000000000000', - balanceWeight: 1, - earnings: '0', - earningsChange: '0', - }, - { - id: '16421590:0x79f2188ef9350a1dc11a062cca0abe90684b0197:0x0000000000000000000000000000000000000348', - timestamp: '2023-01-16T19:57:59.000000Z', - blockNumber: 16421590, - strategy: '0x79f2188ef9350a1dc11a062cca0abe90684b0197', - asset: '0x0000000000000000000000000000000000000348', - balance: '1494005405114000000000000', - balanceWeight: 1, - earnings: '5405114000000000000', - earningsChange: '5405114000000000000', - }, - { - id: '16427826:0x79f2188ef9350a1dc11a062cca0abe90684b0197:0x0000000000000000000000000000000000000348', - timestamp: '2023-01-17T16:50:23.000000Z', - blockNumber: 16427826, - strategy: '0x79f2188ef9350a1dc11a062cca0abe90684b0197', - asset: '0x0000000000000000000000000000000000000348', - balance: '1513111416702000000000000', - balanceWeight: 1, - earnings: '111399765000000000000', - earningsChange: '105994651000000000000', - }, - ]), + strategyYields: e([]), + // strategyYields: e([ + // { + // id: '16421264:0x79f2188ef9350a1dc11a062cca0abe90684b0197:0x0000000000000000000000000000000000000348', + // timestamp: '2023-01-16T18:52:35.000000Z', + // blockNumber: 16421264, + // strategy: '0x79f2188ef9350a1dc11a062cca0abe90684b0197', + // asset: '0x0000000000000000000000000000000000000348', + // balance: '1494000000000000000000000', + // balanceWeight: 1, + // earnings: '0', + // earningsChange: '0', + // }, + // { + // id: '16421590:0x79f2188ef9350a1dc11a062cca0abe90684b0197:0x0000000000000000000000000000000000000348', + // timestamp: '2023-01-16T19:57:59.000000Z', + // blockNumber: 16421590, + // strategy: '0x79f2188ef9350a1dc11a062cca0abe90684b0197', + // asset: '0x0000000000000000000000000000000000000348', + // balance: '1494005405114000000000000', + // balanceWeight: 1, + // earnings: '5405114000000000000', + // earningsChange: '5405114000000000000', + // }, + // { + // id: '16427826:0x79f2188ef9350a1dc11a062cca0abe90684b0197:0x0000000000000000000000000000000000000348', + // timestamp: '2023-01-17T16:50:23.000000Z', + // blockNumber: 16427826, + // strategy: '0x79f2188ef9350a1dc11a062cca0abe90684b0197', + // asset: '0x0000000000000000000000000000000000000348', + // balance: '1513111416702000000000000', + // balanceWeight: 1, + // earnings: '111399765000000000000', + // earningsChange: '105994651000000000000', + // }, + // ]), } as const diff --git a/src/utils/blockFrequencyUpdater.ts b/src/utils/blockFrequencyUpdater.ts index 228b3bd3..69c3c4a4 100644 --- a/src/utils/blockFrequencyUpdater.ts +++ b/src/utils/blockFrequencyUpdater.ts @@ -19,18 +19,21 @@ const oneDayAgo = dayjs.utc().subtract(1, 'day').valueOf() const oneHourAgo = dayjs.utc().subtract(1, 'hour').valueOf() const getFrequency = (bps: number, timestamp: number) => { + let frequency = 1 if (timestamp < oneYearAgo) { - return (SECONDS_PER_WEEK / bps) ^ 0 // Older than one year ago + frequency = (SECONDS_PER_WEEK / bps) ^ 0 // Older than one year ago } else if (timestamp < oneMonthAgo) { - return (SECONDS_PER_DAY / bps) ^ 0 // Older than one month ago + frequency = (SECONDS_PER_DAY / bps) ^ 0 // Older than one month ago } else if (timestamp < oneWeekAgo) { - return (SECONDS_PER_DAY / bps / 4) ^ 0 // Older than one week ago + frequency = (SECONDS_PER_DAY / bps / 4) ^ 0 // Older than one week ago } else if (timestamp < oneDayAgo) { - return (SECONDS_PER_DAY / bps / 24) ^ 0 // Older than one day ago + frequency = (SECONDS_PER_DAY / bps / 24) ^ 0 // Older than one day ago } else if (timestamp < oneHourAgo) { - return ((SECONDS_PER_MINUTE * 5) / bps) ^ 0 // Older than one hour ago + frequency = ((SECONDS_PER_MINUTE * 5) / bps) ^ 0 // Older than one hour ago + } else { + frequency = (SECONDS_PER_MINUTE / bps) ^ 0 } - return (SECONDS_PER_MINUTE / bps) ^ 0 + return frequency || 1 } export const blockFrequencyTracker = (params: { from: number }) => { From 80597d110337fab7c5292cdf4daa27515a63aff3 Mon Sep 17 00:00:00 2001 From: Chris Jacobs Date: Wed, 15 Nov 2023 18:14:29 -0800 Subject: [PATCH 25/34] grafana dashboards, add balanceWeight to daily yields --- ...99319368-Data.js => 1700062923237-Data.js} | 6 +- grafana/README.md | 3 + grafana/oeth-dashboard.json | 3976 +++++++++++++++++ grafana/oeth-strategy-earnings.json | 2719 +++++++++++ grafana/ousd-dashboard.json | 1737 +++++++ grafana/ousd-strategy-earnings.json | 2656 +++++++++++ schema-base.graphql | 1 + schema.graphql | 1 + .../generated/strategyDailyYield.model.ts | 3 + .../processors/strategies/aave-strategy.ts | 2 +- src/ousd/processors/strategies/const.ts | 6 +- .../strategies/convex-meta-strategy.ts | 2 +- .../processors/strategies/flux-strategy.ts | 2 +- .../strategies/maker-dsr-strategy.ts | 2 +- src/ousd/processors/strategies/morpho-aave.ts | 2 +- .../processors/strategies/morpho-compound.ts | 2 +- .../strategy/strategy-daily-earnings.ts | 2 + 17 files changed, 11110 insertions(+), 12 deletions(-) rename db/migrations/{1699399319368-Data.js => 1700062923237-Data.js} (99%) create mode 100644 grafana/README.md create mode 100644 grafana/oeth-dashboard.json create mode 100644 grafana/oeth-strategy-earnings.json create mode 100644 grafana/ousd-dashboard.json create mode 100644 grafana/ousd-strategy-earnings.json diff --git a/db/migrations/1699399319368-Data.js b/db/migrations/1700062923237-Data.js similarity index 99% rename from db/migrations/1699399319368-Data.js rename to db/migrations/1700062923237-Data.js index 3e00e8d9..819dfeb0 100644 --- a/db/migrations/1699399319368-Data.js +++ b/db/migrations/1700062923237-Data.js @@ -1,5 +1,5 @@ -module.exports = class Data1699399319368 { - name = 'Data1699399319368' +module.exports = class Data1700062923237 { + name = 'Data1700062923237' async up(db) { await db.query(`CREATE TABLE "exchange_rate" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "pair" text NOT NULL, "base" text NOT NULL, "quote" text NOT NULL, "rate" numeric NOT NULL, CONSTRAINT "PK_5c5d27d2b900ef6cdeef0398472" PRIMARY KEY ("id"))`) @@ -14,7 +14,7 @@ module.exports = class Data1699399319368 { await db.query(`CREATE TABLE "strategy_yield" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "strategy" text NOT NULL, "asset" text NOT NULL, "balance" numeric NOT NULL, "balance_weight" numeric NOT NULL, "earnings" numeric NOT NULL, "earnings_change" numeric NOT NULL, CONSTRAINT "PK_e87c46575e870fe2202190c2728" PRIMARY KEY ("id"))`) await db.query(`CREATE INDEX "IDX_5108f2a2563d5665892d0c06b0" ON "strategy_yield" ("timestamp") `) await db.query(`CREATE INDEX "IDX_41c3567c9d43c598e07a0029c5" ON "strategy_yield" ("block_number") `) - await db.query(`CREATE TABLE "strategy_daily_yield" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "strategy" text NOT NULL, "asset" text NOT NULL, "balance" numeric NOT NULL, "earnings" numeric NOT NULL, "earnings_change" numeric NOT NULL, "apr" numeric NOT NULL, "apy" numeric NOT NULL, CONSTRAINT "PK_b0dd2686bc95bb032ff532b3a0e" PRIMARY KEY ("id"))`) + await db.query(`CREATE TABLE "strategy_daily_yield" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "strategy" text NOT NULL, "asset" text NOT NULL, "balance" numeric NOT NULL, "balance_weight" numeric NOT NULL, "earnings" numeric NOT NULL, "earnings_change" numeric NOT NULL, "apr" numeric NOT NULL, "apy" numeric NOT NULL, CONSTRAINT "PK_b0dd2686bc95bb032ff532b3a0e" PRIMARY KEY ("id"))`) await db.query(`CREATE INDEX "IDX_0ba1974747f1906e0c102cd2cd" ON "strategy_daily_yield" ("timestamp") `) await db.query(`CREATE INDEX "IDX_df364fb6e82d1feeed2a5dfffa" ON "strategy_daily_yield" ("block_number") `) await db.query(`CREATE TABLE "curve_pool_balance" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "address" text NOT NULL, "balance0" numeric NOT NULL, "balance1" numeric NOT NULL, "balance2" numeric NOT NULL, CONSTRAINT "PK_40412750bb910ca560aa084dd88" PRIMARY KEY ("id"))`) diff --git a/grafana/README.md b/grafana/README.md new file mode 100644 index 00000000..8a259460 --- /dev/null +++ b/grafana/README.md @@ -0,0 +1,3 @@ +The grafana dashboard JSON models found here may be out of date. + +Reference the live version and consider these as backups. \ No newline at end of file diff --git a/grafana/oeth-dashboard.json b/grafana/oeth-dashboard.json new file mode 100644 index 00000000..1ca39fa5 --- /dev/null +++ b/grafana/oeth-dashboard.json @@ -0,0 +1,3976 @@ +{ + "annotations": { + "list": [ + { + "builtIn": 1, + "datasource": { + "type": "datasource", + "uid": "grafana" + }, + "enable": true, + "hide": true, + "iconColor": "rgba(0, 211, 255, 1)", + "name": "Annotations & Alerts", + "target": { + "limit": 100, + "matchAny": false, + "tags": [], + "type": "dashboard" + }, + "type": "dashboard" + } + ] + }, + "editable": true, + "fiscalYearStartMonth": 0, + "graphTooltip": 0, + "id": 17, + "links": [], + "liveNow": false, + "panels": [ + { + "collapsed": false, + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + }, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 0 + }, + "id": 8, + "panels": [], + "targets": [ + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + }, + "refId": "A" + } + ], + "title": "OETH General", + "type": "row" + }, + { + "datasource": { + "type": "postgres", + "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "stepAfter", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 9, + "w": 12, + "x": 0, + "y": 1 + }, + "id": 2, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "multi", + "sort": "none" + } + }, + "targets": [ + { + "datasource": { + "type": "postgres", + "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + }, + "editorMode": "code", + "format": "time_series", + "group": [], + "metricColumn": "none", + "rawQuery": true, + "rawSql": "SELECT\n \"timestamp\" AS \"time\",\n frx_eth / 1000000000000000000 as frx_eth,\n r_eth / 1000000000000000000 as r_eth,\n st_eth / 1000000000000000000 as st_eth,\n weth / 1000000000000000000 as weth\nFROM oeth_vault\nWHERE\n $__timeFilter(\"timestamp\")\nORDER BY 1", + "refId": "A", + "select": [ + [ + { + "params": [ + "frx_eth" + ], + "type": "column" + } + ], + [ + { + "params": [ + "r_eth" + ], + "type": "column" + } + ], + [ + { + "params": [ + "st_eth" + ], + "type": "column" + } + ], + [ + { + "params": [ + "weth" + ], + "type": "column" + } + ] + ], + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, + "table": "oeth_vault", + "timeColumn": "\"timestamp\"", + "timeColumnType": "timestamptz", + "where": [ + { + "name": "$__timeFilter", + "params": [], + "type": "macro" + } + ] + } + ], + "title": "Vault Balances", + "type": "timeseries" + }, + { + "datasource": { + "type": "postgres", + "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisGridShow": true, + "axisLabel": "", + "axisPlacement": "auto", + "axisSoftMin": 0, + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "stepAfter", + "lineStyle": { + "fill": "solid" + }, + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 9, + "w": 12, + "x": 12, + "y": 1 + }, + "id": 4, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "datasource": { + "type": "postgres", + "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + }, + "editorMode": "code", + "format": "time_series", + "group": [], + "metricColumn": "none", + "rawQuery": true, + "rawSql": "SELECT\n \"timestamp\" AS \"time\",\n total_supply / 1e18 as total_supply,\n rebasing_supply / 1e18 as rebasing_supply,\n non_rebasing_supply / 1e18 as non_rebasing_supply\nFROM oeth\nWHERE\n $__timeFilter(\"timestamp\")\nORDER BY 1", + "refId": "A", + "select": [ + [ + { + "params": [ + "total_supply" + ], + "type": "column" + } + ], + [ + { + "params": [ + "rebasing_supply" + ], + "type": "column" + } + ], + [ + { + "params": [ + "non_rebasing_supply" + ], + "type": "column" + } + ] + ], + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, + "table": "oeth", + "timeColumn": "\"timestamp\"", + "timeColumnType": "timestamptz", + "where": [ + { + "name": "$__timeFilter", + "params": [], + "type": "macro" + } + ] + } + ], + "title": "OETH Supply", + "type": "timeseries" + }, + { + "datasource": { + "type": "postgres", + "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "smooth", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "max": 0.25, + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "percentunit" + }, + "overrides": [ + { + "matcher": { + "id": "byName", + "options": "apy" + }, + "properties": [ + { + "id": "custom.lineWidth", + "value": 0 + }, + { + "id": "custom.fillOpacity", + "value": 16 + }, + { + "id": "custom.barAlignment", + "value": 0 + }, + { + "id": "custom.lineInterpolation", + "value": "stepBefore" + } + ] + } + ] + }, + "gridPos": { + "h": 12, + "w": 24, + "x": 0, + "y": 10 + }, + "id": 6, + "options": { + "legend": { + "calcs": [ + "lastNotNull" + ], + "displayMode": "table", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "datasource": { + "type": "postgres", + "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + }, + "format": "time_series", + "group": [], + "metricColumn": "none", + "rawQuery": false, + "rawSql": "SELECT\n \"timestamp\" AS \"time\",\n apy7_day_avg,\n apy14_day_avg,\n apy30_day_avg,\n apy\nFROM oethapy\nWHERE\n $__timeFilter(\"timestamp\")\nORDER BY 1", + "refId": "A", + "select": [ + [ + { + "params": [ + "apy7_day_avg" + ], + "type": "column" + } + ], + [ + { + "params": [ + "apy14_day_avg" + ], + "type": "column" + } + ], + [ + { + "params": [ + "apy30_day_avg" + ], + "type": "column" + } + ], + [ + { + "params": [ + "apy" + ], + "type": "column" + } + ] + ], + "table": "oethapy", + "timeColumn": "\"timestamp\"", + "timeColumnType": "timestamptz", + "where": [ + { + "name": "$__timeFilter", + "params": [], + "type": "macro" + } + ] + } + ], + "title": "APY", + "type": "timeseries" + }, + { + "datasource": { + "type": "postgres", + "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "stepAfter", + "lineStyle": { + "fill": "solid" + }, + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "decimals": 2, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [ + { + "__systemRef": "hideSeriesFrom", + "matcher": { + "id": "byNames", + "options": { + "mode": "exclude", + "names": [ + "yield_eth" + ], + "prefix": "All except:", + "readOnly": true + } + }, + "properties": [ + { + "id": "custom.hideFrom", + "value": { + "legend": true, + "tooltip": true, + "viz": true + } + } + ] + } + ] + }, + "gridPos": { + "h": 11, + "w": 12, + "x": 0, + "y": 22 + }, + "id": 38, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "datasource": { + "type": "postgres", + "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + }, + "editorMode": "code", + "format": "time_series", + "group": [], + "metricColumn": "none", + "rawQuery": true, + "rawSql": "SELECT\n \"timestamp\" AS \"time\",\n yield\nFROM oeth_rebase\nWHERE\n $__timeFilter(\"timestamp\")\nORDER BY 1", + "refId": "A", + "select": [ + [ + { + "params": [ + "yield" + ], + "type": "column" + }, + { + "params": [ + "sum" + ], + "type": "window" + }, + { + "params": [ + "yield" + ], + "type": "alias" + } + ] + ], + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, + "table": "oeth_rebase", + "timeColumn": "\"timestamp\"", + "timeColumnType": "timestamptz", + "where": [ + { + "name": "$__timeFilter", + "params": [], + "type": "macro" + } + ] + } + ], + "title": "Yield Accrual", + "transformations": [ + { + "id": "convertFieldType", + "options": {} + }, + { + "id": "calculateField", + "options": { + "alias": "yield_eth", + "binary": { + "left": "yield", + "operator": "/", + "reducer": "sum", + "right": "1000000000000000000" + }, + "mode": "binary", + "reduce": { + "include": [ + "yield" + ], + "reducer": "sum" + } + } + } + ], + "type": "timeseries" + }, + { + "datasource": { + "type": "postgres", + "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "stepAfter", + "lineStyle": { + "fill": "solid" + }, + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "decimals": 2, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [ + { + "__systemRef": "hideSeriesFrom", + "matcher": { + "id": "byNames", + "options": { + "mode": "exclude", + "names": [ + "fee_eth" + ], + "prefix": "All except:", + "readOnly": true + } + }, + "properties": [ + { + "id": "custom.hideFrom", + "value": { + "legend": true, + "tooltip": true, + "viz": true + } + } + ] + } + ] + }, + "gridPos": { + "h": 11, + "w": 12, + "x": 12, + "y": 22 + }, + "id": 37, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "datasource": { + "type": "postgres", + "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + }, + "editorMode": "code", + "format": "time_series", + "group": [], + "metricColumn": "none", + "rawQuery": true, + "rawSql": "SELECT\n \"timestamp\" AS \"time\",\n fee\nFROM oeth_rebase\nWHERE\n $__timeFilter(\"timestamp\")\nORDER BY 1", + "refId": "A", + "select": [ + [ + { + "params": [ + "fee" + ], + "type": "column" + }, + { + "params": [ + "sum" + ], + "type": "window" + }, + { + "params": [ + "fee" + ], + "type": "alias" + } + ] + ], + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, + "table": "oeth_rebase", + "timeColumn": "\"timestamp\"", + "timeColumnType": "timestamptz", + "where": [ + { + "name": "$__timeFilter", + "params": [], + "type": "macro" + } + ] + } + ], + "title": "Fee Accrual", + "transformations": [ + { + "id": "calculateField", + "options": { + "alias": "fee_eth", + "binary": { + "left": "fee", + "operator": "/", + "reducer": "sum", + "right": "1000000000000000000" + }, + "mode": "binary", + "reduce": { + "include": [ + "yield" + ], + "reducer": "sum" + } + } + } + ], + "type": "timeseries" + }, + { + "collapsed": false, + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + }, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 33 + }, + "id": 40, + "panels": [], + "targets": [ + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + }, + "refId": "A" + } + ], + "title": "OETH Strategies", + "type": "row" + }, + { + "datasource": { + "type": "postgres", + "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + }, + "description": "", + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "stepAfter", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 34 + }, + "id": 44, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "datasource": { + "type": "postgres", + "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + }, + "editorMode": "code", + "format": "time_series", + "group": [], + "metricColumn": "asset", + "rawQuery": true, + "rawSql": "SELECT\n \"timestamp\" AS \"time\",\n asset AS metric,\n balance / 1e18 as balance\nFROM strategy_balance\nWHERE\n $__timeFilter(\"timestamp\") AND\n strategy = '0x1827f9ea98e0bf96550b2fc20f7233277fcd7e63'\nORDER BY 1,2", + "refId": "A", + "select": [ + [ + { + "params": [ + "balance" + ], + "type": "column" + } + ] + ], + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, + "table": "strategy_balance", + "timeColumn": "\"timestamp\"", + "timeColumnType": "timestamptz", + "where": [ + { + "name": "$__timeFilter", + "params": [], + "type": "macro" + }, + { + "datatype": "text", + "name": "", + "params": [ + "strategy", + "=", + "'0x1827f9ea98e0bf96550b2fc20f7233277fcd7e63'" + ], + "type": "expression" + } + ] + } + ], + "title": "Convex ETH+OETH (AMO)", + "transformations": [], + "type": "timeseries" + }, + { + "datasource": { + "type": "postgres", + "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + }, + "description": "", + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "stepAfter", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 12, + "y": 34 + }, + "id": 43, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "datasource": { + "type": "postgres", + "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + }, + "editorMode": "code", + "format": "time_series", + "group": [], + "metricColumn": "asset", + "rawQuery": true, + "rawSql": "SELECT\n \"timestamp\" AS \"time\",\n asset AS metric,\n balance / 1e18 as balance\nFROM strategy_balance\nWHERE\n $__timeFilter(\"timestamp\") AND\n strategy = '0x3ff8654d633d4ea0fae24c52aec73b4a20d0d0e5'\nORDER BY 1,2", + "refId": "A", + "select": [ + [ + { + "params": [ + "balance" + ], + "type": "column" + } + ] + ], + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, + "table": "strategy_balance", + "timeColumn": "\"timestamp\"", + "timeColumnType": "timestamptz", + "where": [ + { + "name": "$__timeFilter", + "params": [], + "type": "macro" + }, + { + "datatype": "text", + "name": "", + "params": [ + "strategy", + "=", + "'0x3ff8654d633d4ea0fae24c52aec73b4a20d0d0e5'" + ], + "type": "expression" + } + ] + } + ], + "title": "Frax Staking", + "transformations": [], + "type": "timeseries" + }, + { + "datasource": { + "type": "postgres", + "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + }, + "description": "", + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "stepAfter", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 42 + }, + "id": 42, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "datasource": { + "type": "postgres", + "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + }, + "editorMode": "code", + "format": "time_series", + "group": [], + "metricColumn": "asset", + "rawQuery": true, + "rawSql": "SELECT\n \"timestamp\" AS \"time\",\n asset AS metric,\n balance / 1e18 as balance\nFROM strategy_balance\nWHERE\n $__timeFilter(\"timestamp\") AND\n strategy = '0xc1fc9e5ec3058921ea5025d703cbe31764756319'\nORDER BY 1,2", + "refId": "A", + "select": [ + [ + { + "params": [ + "balance" + ], + "type": "column" + } + ] + ], + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, + "table": "strategy_balance", + "timeColumn": "\"timestamp\"", + "timeColumnType": "timestamptz", + "where": [ + { + "name": "$__timeFilter", + "params": [], + "type": "macro" + }, + { + "datatype": "text", + "name": "", + "params": [ + "strategy", + "=", + "'0xc1fc9e5ec3058921ea5025d703cbe31764756319'" + ], + "type": "expression" + } + ] + } + ], + "title": "Morpho Aave", + "transformations": [], + "type": "timeseries" + }, + { + "datasource": { + "type": "postgres", + "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + }, + "description": "", + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "stepAfter", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "decimals": 2, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [ + { + "__systemRef": "hideSeriesFrom", + "matcher": { + "id": "byNames", + "options": { + "mode": "exclude", + "names": [ + "rETH", + "WETH" + ], + "prefix": "All except:", + "readOnly": true + } + }, + "properties": [ + { + "id": "custom.hideFrom", + "value": { + "legend": true, + "tooltip": true, + "viz": true + } + } + ] + } + ] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 12, + "y": 42 + }, + "id": 41, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "datasource": { + "type": "postgres", + "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + }, + "editorMode": "code", + "format": "time_series", + "group": [], + "metricColumn": "asset", + "rawQuery": true, + "rawSql": "SELECT\n \"timestamp\" AS \"time\",\n asset AS metric,\n balance / 1e18 as balance\nFROM strategy_balance\nWHERE\n $__timeFilter(\"timestamp\") AND\n strategy = '0x49109629ac1deb03f2e9b2fe2ac4a623e0e7dfdc'\nORDER BY 1,2", + "refId": "A", + "select": [ + [ + { + "params": [ + "balance" + ], + "type": "column" + } + ] + ], + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, + "table": "strategy_balance", + "timeColumn": "\"timestamp\"", + "timeColumnType": "timestamptz", + "where": [ + { + "name": "$__timeFilter", + "params": [], + "type": "macro" + }, + { + "datatype": "text", + "name": "", + "params": [ + "strategy", + "=", + "'0x49109629ac1deb03f2e9b2fe2ac4a623e0e7dfdc'" + ], + "type": "expression" + } + ] + } + ], + "title": "Aura Balancer Metapool", + "transformations": [ + { + "id": "calculateField", + "options": { + "alias": "WETH", + "binary": { + "left": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", + "operator": "/", + "reducer": "sum", + "right": "1000000000000000000" + }, + "mode": "binary", + "reduce": { + "reducer": "sum" + } + } + }, + { + "id": "calculateField", + "options": { + "alias": "rETH", + "binary": { + "left": "0xae78736Cd615f374D3085123A210448E74Fc6393", + "operator": "/", + "reducer": "sum", + "right": "1000000000000000000" + }, + "mode": "binary", + "reduce": { + "reducer": "sum" + } + } + } + ], + "type": "timeseries" + }, + { + "collapsed": false, + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + }, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 50 + }, + "id": 10, + "panels": [], + "targets": [ + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + }, + "refId": "A" + } + ], + "title": "OETH/ETH Curve Metapool", + "type": "row" + }, + { + "datasource": { + "type": "postgres", + "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "stepAfter", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 51 + }, + "id": 12, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "datasource": { + "type": "postgres", + "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + }, + "editorMode": "code", + "format": "time_series", + "group": [], + "metricColumn": "none", + "rawQuery": true, + "rawSql": "SELECT\n \"timestamp\" AS \"time\",\n balance0 / 1e18 as balance0,\n balance1 / 1e18 as balance1\nFROM curve_pool_balance\nWHERE\n $__timeFilter(\"timestamp\") AND\n address = '0x94b17476a93b3262d87b9a326965d1e91f9c13e7'\nORDER BY 1", + "refId": "A", + "select": [ + [ + { + "params": [ + "balance0" + ], + "type": "column" + } + ], + [ + { + "params": [ + "balance1" + ], + "type": "column" + } + ] + ], + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, + "table": "curve_pool_balance", + "timeColumn": "\"timestamp\"", + "timeColumnType": "timestamptz", + "where": [ + { + "name": "$__timeFilter", + "params": [], + "type": "macro" + }, + { + "datatype": "text", + "name": "", + "params": [ + "address", + "=", + "'0x94b17476a93b3262d87b9a326965d1e91f9c13e7'" + ], + "type": "expression" + } + ] + } + ], + "title": "Balances", + "type": "timeseries" + }, + { + "datasource": { + "type": "postgres", + "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "stepAfter", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [ + { + "__systemRef": "hideSeriesFrom", + "matcher": { + "id": "byNames", + "options": { + "mode": "exclude", + "names": [ + "balance0_p", + "balance1_p" + ], + "prefix": "All except:", + "readOnly": true + } + }, + "properties": [ + { + "id": "custom.hideFrom", + "value": { + "legend": true, + "tooltip": true, + "viz": true + } + } + ] + } + ] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 12, + "y": 51 + }, + "id": 13, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "datasource": { + "type": "postgres", + "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + }, + "format": "time_series", + "group": [], + "hide": false, + "metricColumn": "none", + "rawQuery": false, + "rawSql": "SELECT\n \"timestamp\" AS \"time\",\n balance0,\n balance1\nFROM curve_pool_balance\nWHERE\n $__timeFilter(\"timestamp\") AND\n address = '0x94b17476a93b3262d87b9a326965d1e91f9c13e7'\nORDER BY 1", + "refId": "A", + "select": [ + [ + { + "params": [ + "balance0" + ], + "type": "column" + } + ], + [ + { + "params": [ + "balance1" + ], + "type": "column" + } + ] + ], + "table": "curve_pool_balance", + "timeColumn": "\"timestamp\"", + "timeColumnType": "timestamptz", + "where": [ + { + "name": "$__timeFilter", + "params": [], + "type": "macro" + }, + { + "datatype": "text", + "name": "", + "params": [ + "address", + "=", + "'0x94b17476a93b3262d87b9a326965d1e91f9c13e7'" + ], + "type": "expression" + } + ] + } + ], + "title": "Balance %", + "transformations": [ + { + "id": "calculateField", + "options": { + "binary": { + "left": "balance0", + "operator": "+", + "reducer": "sum", + "right": "balance1" + }, + "mode": "binary", + "reduce": { + "reducer": "sum" + } + } + }, + { + "id": "calculateField", + "options": { + "alias": "balance0_p", + "binary": { + "left": "balance0", + "operator": "/", + "reducer": "sum", + "right": "balance0 + balance1" + }, + "mode": "binary", + "reduce": { + "reducer": "sum" + } + } + }, + { + "id": "calculateField", + "options": { + "alias": "balance1_p", + "binary": { + "left": "balance1", + "operator": "/", + "reducer": "sum", + "right": "balance0 + balance1" + }, + "mode": "binary", + "reduce": { + "reducer": "sum" + } + } + } + ], + "type": "timeseries" + }, + { + "collapsed": false, + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + }, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 59 + }, + "id": 15, + "panels": [], + "targets": [ + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + }, + "refId": "A" + } + ], + "title": "WETH/stETH Curve Metapool", + "type": "row" + }, + { + "datasource": { + "type": "postgres", + "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "stepAfter", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 60 + }, + "id": 16, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "datasource": { + "type": "postgres", + "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + }, + "editorMode": "code", + "format": "time_series", + "group": [], + "metricColumn": "none", + "rawQuery": true, + "rawSql": "SELECT\n \"timestamp\" AS \"time\",\n balance0 / 1e18 as balance0,\n balance1 / 1e18 as balance1\nFROM curve_pool_balance\nWHERE\n $__timeFilter(\"timestamp\") AND\n address = '0x828b154032950c8ff7cf8085d841723db2696056'\nORDER BY 1", + "refId": "A", + "select": [ + [ + { + "params": [ + "balance0" + ], + "type": "column" + } + ], + [ + { + "params": [ + "balance1" + ], + "type": "column" + } + ] + ], + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, + "table": "curve_pool_balance", + "timeColumn": "\"timestamp\"", + "timeColumnType": "timestamptz", + "where": [ + { + "name": "$__timeFilter", + "params": [], + "type": "macro" + }, + { + "datatype": "text", + "name": "", + "params": [ + "address", + "=", + "'0x828b154032950c8ff7cf8085d841723db2696056'" + ], + "type": "expression" + } + ] + } + ], + "title": "Balances", + "type": "timeseries" + }, + { + "datasource": { + "type": "postgres", + "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "stepAfter", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [ + { + "__systemRef": "hideSeriesFrom", + "matcher": { + "id": "byNames", + "options": { + "mode": "exclude", + "names": [ + "balance0_p", + "balance1_p" + ], + "prefix": "All except:", + "readOnly": true + } + }, + "properties": [ + { + "id": "custom.hideFrom", + "value": { + "legend": true, + "tooltip": true, + "viz": true + } + } + ] + } + ] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 12, + "y": 60 + }, + "id": 17, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "datasource": { + "type": "postgres", + "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + }, + "format": "time_series", + "group": [], + "hide": false, + "metricColumn": "none", + "rawQuery": false, + "rawSql": "SELECT\n \"timestamp\" AS \"time\",\n balance0,\n balance1\nFROM curve_pool_balance\nWHERE\n $__timeFilter(\"timestamp\") AND\n address = '0x828b154032950c8ff7cf8085d841723db2696056'\nORDER BY 1", + "refId": "A", + "select": [ + [ + { + "params": [ + "balance0" + ], + "type": "column" + } + ], + [ + { + "params": [ + "balance1" + ], + "type": "column" + } + ] + ], + "table": "curve_pool_balance", + "timeColumn": "\"timestamp\"", + "timeColumnType": "timestamptz", + "where": [ + { + "name": "$__timeFilter", + "params": [], + "type": "macro" + }, + { + "datatype": "text", + "name": "", + "params": [ + "address", + "=", + "'0x828b154032950c8ff7cf8085d841723db2696056'" + ], + "type": "expression" + } + ] + } + ], + "title": "Balance %", + "transformations": [ + { + "id": "calculateField", + "options": { + "binary": { + "left": "balance0", + "operator": "+", + "reducer": "sum", + "right": "balance1" + }, + "mode": "binary", + "reduce": { + "reducer": "sum" + } + } + }, + { + "id": "calculateField", + "options": { + "alias": "balance0_p", + "binary": { + "left": "balance0", + "operator": "/", + "reducer": "sum", + "right": "balance0 + balance1" + }, + "mode": "binary", + "reduce": { + "reducer": "sum" + } + } + }, + { + "id": "calculateField", + "options": { + "alias": "balance1_p", + "binary": { + "left": "balance1", + "operator": "/", + "reducer": "sum", + "right": "balance0 + balance1" + }, + "mode": "binary", + "reduce": { + "reducer": "sum" + } + } + } + ], + "type": "timeseries" + }, + { + "collapsed": false, + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + }, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 68 + }, + "id": 19, + "panels": [], + "targets": [ + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + }, + "refId": "A" + } + ], + "title": "ETH/stETH Curve Metapool", + "type": "row" + }, + { + "datasource": { + "type": "postgres", + "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "stepAfter", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 69 + }, + "id": 20, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "datasource": { + "type": "postgres", + "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + }, + "editorMode": "code", + "format": "time_series", + "group": [], + "metricColumn": "none", + "rawQuery": true, + "rawSql": "SELECT\n \"timestamp\" AS \"time\",\n balance0 / 1e18 as balance0,\n balance1 / 1e18 as balance1\nFROM curve_pool_balance\nWHERE\n $__timeFilter(\"timestamp\") AND\n address = '0xdc24316b9ae028f1497c275eb9192a3ea0f67022'\nORDER BY 1", + "refId": "A", + "select": [ + [ + { + "params": [ + "balance0" + ], + "type": "column" + } + ], + [ + { + "params": [ + "balance1" + ], + "type": "column" + } + ] + ], + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, + "table": "curve_pool_balance", + "timeColumn": "\"timestamp\"", + "timeColumnType": "timestamptz", + "where": [ + { + "name": "$__timeFilter", + "params": [], + "type": "macro" + }, + { + "datatype": "text", + "name": "", + "params": [ + "address", + "=", + "'0xdc24316b9ae028f1497c275eb9192a3ea0f67022'" + ], + "type": "expression" + } + ] + } + ], + "title": "Balances", + "type": "timeseries" + }, + { + "datasource": { + "type": "postgres", + "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "stepAfter", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [ + { + "__systemRef": "hideSeriesFrom", + "matcher": { + "id": "byNames", + "options": { + "mode": "exclude", + "names": [ + "balance0_p", + "balance1_p" + ], + "prefix": "All except:", + "readOnly": true + } + }, + "properties": [ + { + "id": "custom.hideFrom", + "value": { + "legend": true, + "tooltip": true, + "viz": true + } + } + ] + } + ] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 12, + "y": 69 + }, + "id": 21, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "datasource": { + "type": "postgres", + "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + }, + "format": "time_series", + "group": [], + "hide": false, + "metricColumn": "none", + "rawQuery": false, + "rawSql": "SELECT\n \"timestamp\" AS \"time\",\n balance0,\n balance1\nFROM curve_pool_balance\nWHERE\n $__timeFilter(\"timestamp\") AND\n address = '0xdc24316b9ae028f1497c275eb9192a3ea0f67022'\nORDER BY 1", + "refId": "A", + "select": [ + [ + { + "params": [ + "balance0" + ], + "type": "column" + } + ], + [ + { + "params": [ + "balance1" + ], + "type": "column" + } + ] + ], + "table": "curve_pool_balance", + "timeColumn": "\"timestamp\"", + "timeColumnType": "timestamptz", + "where": [ + { + "name": "$__timeFilter", + "params": [], + "type": "macro" + }, + { + "datatype": "text", + "name": "", + "params": [ + "address", + "=", + "'0xdc24316b9ae028f1497c275eb9192a3ea0f67022'" + ], + "type": "expression" + } + ] + } + ], + "title": "Balance %", + "transformations": [ + { + "id": "calculateField", + "options": { + "binary": { + "left": "balance0", + "operator": "+", + "reducer": "sum", + "right": "balance1" + }, + "mode": "binary", + "reduce": { + "reducer": "sum" + } + } + }, + { + "id": "calculateField", + "options": { + "alias": "balance0_p", + "binary": { + "left": "balance0", + "operator": "/", + "reducer": "sum", + "right": "balance0 + balance1" + }, + "mode": "binary", + "reduce": { + "reducer": "sum" + } + } + }, + { + "id": "calculateField", + "options": { + "alias": "balance1_p", + "binary": { + "left": "balance1", + "operator": "/", + "reducer": "sum", + "right": "balance0 + balance1" + }, + "mode": "binary", + "reduce": { + "reducer": "sum" + } + } + } + ], + "type": "timeseries" + }, + { + "collapsed": false, + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + }, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 77 + }, + "id": 23, + "panels": [], + "targets": [ + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + }, + "refId": "A" + } + ], + "title": "ETH/frxETH Curve Metapool", + "type": "row" + }, + { + "datasource": { + "type": "postgres", + "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "stepAfter", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 78 + }, + "id": 24, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "datasource": { + "type": "postgres", + "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + }, + "editorMode": "code", + "format": "time_series", + "group": [], + "metricColumn": "none", + "rawQuery": true, + "rawSql": "SELECT\n \"timestamp\" AS \"time\",\n balance0 / 1e18 as balance0,\n balance1 / 1e18 as balance1\nFROM curve_pool_balance\nWHERE\n $__timeFilter(\"timestamp\") AND\n address = '0xa1f8a6807c402e4a15ef4eba36528a3fed24e577'\nORDER BY 1", + "refId": "A", + "select": [ + [ + { + "params": [ + "balance0" + ], + "type": "column" + } + ], + [ + { + "params": [ + "balance1" + ], + "type": "column" + } + ] + ], + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, + "table": "curve_pool_balance", + "timeColumn": "\"timestamp\"", + "timeColumnType": "timestamptz", + "where": [ + { + "name": "$__timeFilter", + "params": [], + "type": "macro" + }, + { + "datatype": "text", + "name": "", + "params": [ + "address", + "=", + "'0xa1f8a6807c402e4a15ef4eba36528a3fed24e577'" + ], + "type": "expression" + } + ] + } + ], + "title": "Balances", + "type": "timeseries" + }, + { + "datasource": { + "type": "postgres", + "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "stepAfter", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [ + { + "__systemRef": "hideSeriesFrom", + "matcher": { + "id": "byNames", + "options": { + "mode": "exclude", + "names": [ + "balance0_p", + "balance1_p" + ], + "prefix": "All except:", + "readOnly": true + } + }, + "properties": [ + { + "id": "custom.hideFrom", + "value": { + "legend": true, + "tooltip": true, + "viz": true + } + } + ] + } + ] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 12, + "y": 78 + }, + "id": 25, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "datasource": { + "type": "postgres", + "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + }, + "format": "time_series", + "group": [], + "hide": false, + "metricColumn": "none", + "rawQuery": false, + "rawSql": "SELECT\n \"timestamp\" AS \"time\",\n balance0,\n balance1\nFROM curve_pool_balance\nWHERE\n $__timeFilter(\"timestamp\") AND\n address = '0xa1f8a6807c402e4a15ef4eba36528a3fed24e577'\nORDER BY 1", + "refId": "A", + "select": [ + [ + { + "params": [ + "balance0" + ], + "type": "column" + } + ], + [ + { + "params": [ + "balance1" + ], + "type": "column" + } + ] + ], + "table": "curve_pool_balance", + "timeColumn": "\"timestamp\"", + "timeColumnType": "timestamptz", + "where": [ + { + "name": "$__timeFilter", + "params": [], + "type": "macro" + }, + { + "datatype": "text", + "name": "", + "params": [ + "address", + "=", + "'0xa1f8a6807c402e4a15ef4eba36528a3fed24e577'" + ], + "type": "expression" + } + ] + } + ], + "title": "Balance %", + "transformations": [ + { + "id": "calculateField", + "options": { + "binary": { + "left": "balance0", + "operator": "+", + "reducer": "sum", + "right": "balance1" + }, + "mode": "binary", + "reduce": { + "reducer": "sum" + } + } + }, + { + "id": "calculateField", + "options": { + "alias": "balance0_p", + "binary": { + "left": "balance0", + "operator": "/", + "reducer": "sum", + "right": "balance0 + balance1" + }, + "mode": "binary", + "reduce": { + "reducer": "sum" + } + } + }, + { + "id": "calculateField", + "options": { + "alias": "balance1_p", + "binary": { + "left": "balance1", + "operator": "/", + "reducer": "sum", + "right": "balance0 + balance1" + }, + "mode": "binary", + "reduce": { + "reducer": "sum" + } + } + } + ], + "type": "timeseries" + }, + { + "collapsed": false, + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + }, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 86 + }, + "id": 27, + "panels": [], + "targets": [ + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + }, + "refId": "A" + } + ], + "title": "ETH/rETH Curve Metapool", + "type": "row" + }, + { + "datasource": { + "type": "postgres", + "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "stepAfter", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 87 + }, + "id": 28, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "datasource": { + "type": "postgres", + "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + }, + "editorMode": "code", + "format": "time_series", + "group": [], + "metricColumn": "none", + "rawQuery": true, + "rawSql": "SELECT\n \"timestamp\" AS \"time\",\n balance0 / 1e18 as balance0,\n balance1 / 1e18 as balance1\nFROM curve_pool_balance\nWHERE\n $__timeFilter(\"timestamp\") AND\n address = '0x0f3159811670c117c372428d4e69ac32325e4d0f'\nORDER BY 1", + "refId": "A", + "select": [ + [ + { + "params": [ + "balance0" + ], + "type": "column" + } + ], + [ + { + "params": [ + "balance1" + ], + "type": "column" + } + ] + ], + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, + "table": "curve_pool_balance", + "timeColumn": "\"timestamp\"", + "timeColumnType": "timestamptz", + "where": [ + { + "name": "$__timeFilter", + "params": [], + "type": "macro" + }, + { + "datatype": "text", + "name": "", + "params": [ + "address", + "=", + "'0x0f3159811670c117c372428d4e69ac32325e4d0f'" + ], + "type": "expression" + } + ] + } + ], + "title": "Balances", + "type": "timeseries" + }, + { + "datasource": { + "type": "postgres", + "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "stepAfter", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [ + { + "__systemRef": "hideSeriesFrom", + "matcher": { + "id": "byNames", + "options": { + "mode": "exclude", + "names": [ + "balance0_p", + "balance1_p" + ], + "prefix": "All except:", + "readOnly": true + } + }, + "properties": [ + { + "id": "custom.hideFrom", + "value": { + "legend": true, + "tooltip": true, + "viz": true + } + } + ] + } + ] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 12, + "y": 87 + }, + "id": 29, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "datasource": { + "type": "postgres", + "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + }, + "format": "time_series", + "group": [], + "hide": false, + "metricColumn": "none", + "rawQuery": false, + "rawSql": "SELECT\n \"timestamp\" AS \"time\",\n balance0,\n balance1\nFROM curve_pool_balance\nWHERE\n $__timeFilter(\"timestamp\") AND\n address = '0x0f3159811670c117c372428d4e69ac32325e4d0f'\nORDER BY 1", + "refId": "A", + "select": [ + [ + { + "params": [ + "balance0" + ], + "type": "column" + } + ], + [ + { + "params": [ + "balance1" + ], + "type": "column" + } + ] + ], + "table": "curve_pool_balance", + "timeColumn": "\"timestamp\"", + "timeColumnType": "timestamptz", + "where": [ + { + "name": "$__timeFilter", + "params": [], + "type": "macro" + }, + { + "datatype": "text", + "name": "", + "params": [ + "address", + "=", + "'0x0f3159811670c117c372428d4e69ac32325e4d0f'" + ], + "type": "expression" + } + ] + } + ], + "title": "Balance %", + "transformations": [ + { + "id": "calculateField", + "options": { + "binary": { + "left": "balance0", + "operator": "+", + "reducer": "sum", + "right": "balance1" + }, + "mode": "binary", + "reduce": { + "reducer": "sum" + } + } + }, + { + "id": "calculateField", + "options": { + "alias": "balance0_p", + "binary": { + "left": "balance0", + "operator": "/", + "reducer": "sum", + "right": "balance0 + balance1" + }, + "mode": "binary", + "reduce": { + "reducer": "sum" + } + } + }, + { + "id": "calculateField", + "options": { + "alias": "balance1_p", + "binary": { + "left": "balance1", + "operator": "/", + "reducer": "sum", + "right": "balance0 + balance1" + }, + "mode": "binary", + "reduce": { + "reducer": "sum" + } + } + } + ], + "type": "timeseries" + }, + { + "collapsed": true, + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + }, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 95 + }, + "id": 31, + "panels": [ + { + "datasource": { + "type": "postgres", + "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + }, + "description": "", + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "stepAfter", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 96 + }, + "id": 34, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "datasource": { + "type": "postgres", + "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + }, + "editorMode": "code", + "format": "time_series", + "group": [], + "metricColumn": "none", + "rawQuery": true, + "rawSql": "SELECT\n \"timestamp\" AS \"time\",\n eth_owned / 1e18 as eth_owned,\n oeth_owned / 1e18 as oeth_owned\nFROM oeth_curve_lp\nWHERE\n $__timeFilter(\"timestamp\")\nORDER BY 1", + "refId": "A", + "select": [ + [ + { + "params": [ + "eth_owned" + ], + "type": "column" + } + ], + [ + { + "params": [ + "oeth_owned" + ], + "type": "column" + } + ] + ], + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, + "table": "oeth_curve_lp", + "timeColumn": "\"timestamp\"", + "timeColumnType": "timestamptz", + "where": [ + { + "name": "$__timeFilter", + "params": [], + "type": "macro" + } + ] + } + ], + "title": "Curve AMO", + "transformations": [], + "type": "timeseries" + }, + { + "datasource": { + "type": "postgres", + "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + }, + "description": "", + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "stepAfter", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 12, + "y": 96 + }, + "id": 33, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "datasource": { + "type": "postgres", + "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + }, + "editorMode": "code", + "format": "time_series", + "group": [], + "metricColumn": "none", + "rawQuery": true, + "rawSql": "SELECT\n \"timestamp\" AS \"time\",\n sfrx_eth / 1e18 as sfrx_eth\nFROM oeth_frax_staking\nWHERE\n $__timeFilter(\"timestamp\")\nORDER BY 1", + "refId": "A", + "select": [ + [ + { + "params": [ + "sfrx_eth" + ], + "type": "column" + } + ] + ], + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, + "table": "oeth_frax_staking", + "timeColumn": "\"timestamp\"", + "timeColumnType": "timestamptz", + "where": [ + { + "name": "$__timeFilter", + "params": [], + "type": "macro" + } + ] + } + ], + "title": "FraxETH", + "transformations": [], + "type": "timeseries" + }, + { + "datasource": { + "type": "postgres", + "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + }, + "description": "", + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "stepAfter", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 12, + "y": 104 + }, + "id": 35, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "datasource": { + "type": "postgres", + "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + }, + "editorMode": "code", + "format": "time_series", + "group": [], + "metricColumn": "none", + "rawQuery": true, + "rawSql": "SELECT\n \"timestamp\" AS \"time\",\n r_eth / 1e18 as r_eth,\n weth / 1e18 as weth\nFROM oeth_balancer_meta_pool_strategy\nWHERE\n $__timeFilter(\"timestamp\")\nORDER BY 1", + "refId": "A", + "select": [ + [ + { + "params": [ + "r_eth" + ], + "type": "column" + } + ], + [ + { + "params": [ + "weth" + ], + "type": "column" + } + ] + ], + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, + "table": "oeth_balancer_meta_pool_strategy", + "timeColumn": "\"timestamp\"", + "timeColumnType": "timestamptz", + "where": [ + { + "name": "$__timeFilter", + "params": [], + "type": "macro" + } + ] + } + ], + "title": "Aura Balancer Metapool", + "transformations": [], + "type": "timeseries" + } + ], + "targets": [ + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + }, + "refId": "A" + } + ], + "title": "OETH Strategies (Old method)", + "type": "row" + } + ], + "refresh": "", + "schemaVersion": 39, + "tags": [ + "oeth" + ], + "templating": { + "list": [] + }, + "time": { + "from": "now-30d", + "to": "now" + }, + "timepicker": {}, + "timezone": "", + "title": "OETH Dashboard", + "uid": "5RW4zO7Sk", + "version": 11, + "weekStart": "" +} \ No newline at end of file diff --git a/grafana/oeth-strategy-earnings.json b/grafana/oeth-strategy-earnings.json new file mode 100644 index 00000000..32f45d2f --- /dev/null +++ b/grafana/oeth-strategy-earnings.json @@ -0,0 +1,2719 @@ +{ + "annotations": { + "list": [ + { + "builtIn": 1, + "datasource": { + "type": "grafana", + "uid": "-- Grafana --" + }, + "enable": true, + "hide": true, + "iconColor": "rgba(0, 211, 255, 1)", + "name": "Annotations & Alerts", + "type": "dashboard" + } + ] + }, + "editable": true, + "fiscalYearStartMonth": 0, + "graphTooltip": 1, + "id": 15, + "links": [], + "liveNow": false, + "panels": [ + { + "collapsed": false, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 0 + }, + "id": 9, + "panels": [], + "title": "OETH Convex ETH+OETH", + "type": "row" + }, + { + "datasource": { + "type": "postgres", + "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "stepAfter", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [ + { + "matcher": { + "id": "byName", + "options": "earnings_change" + }, + "properties": [ + { + "id": "custom.axisPlacement", + "value": "right" + }, + { + "id": "custom.fillOpacity", + "value": 25 + }, + { + "id": "custom.lineWidth", + "value": 0 + } + ] + } + ] + }, + "gridPos": { + "h": 9, + "w": 11, + "x": 0, + "y": 1 + }, + "id": 17, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "multi", + "sort": "none" + } + }, + "targets": [ + { + "datasource": { + "type": "postgres", + "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + }, + "editorMode": "code", + "format": "table", + "rawQuery": true, + "rawSql": "SELECT timestamp as time, earnings_change / 1000000000000000000 as earnings_change, balance / 1000000000000000000 as balance\nFROM strategy_daily_yield\nWHERE strategy = '0x1827f9ea98e0bf96550b2fc20f7233277fcd7e63'", + "refId": "A", + "sql": { + "columns": [ + { + "parameters": [ + { + "name": "strategy", + "type": "functionParameter" + } + ], + "type": "function" + }, + { + "parameters": [ + { + "name": "asset", + "type": "functionParameter" + } + ], + "type": "function" + }, + { + "parameters": [ + { + "name": "earnings", + "type": "functionParameter" + } + ], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, + "table": "strategy_daily_yield" + } + ], + "title": "OETH Convex ETH+OETH (AMO) - Earnings", + "type": "timeseries" + }, + { + "datasource": { + "type": "postgres", + "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + }, + "description": "", + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "axisSoftMax": -4, + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "hue", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "stepAfter", + "lineStyle": { + "fill": "solid" + }, + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": true, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "max": 0.75, + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [ + { + "matcher": { + "id": "byRegexp", + "options": "/apy.*/" + }, + "properties": [ + { + "id": "custom.axisPlacement", + "value": "auto" + }, + { + "id": "custom.showPoints", + "value": "never" + }, + { + "id": "custom.lineWidth", + "value": 1 + }, + { + "id": "custom.lineInterpolation", + "value": "stepBefore" + }, + { + "id": "unit", + "value": "percentunit" + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "apy" + }, + "properties": [ + { + "id": "custom.fillOpacity", + "value": 32 + }, + { + "id": "custom.lineWidth", + "value": 0 + } + ] + } + ] + }, + "gridPos": { + "h": 9, + "w": 11, + "x": 11, + "y": 1 + }, + "id": 13, + "options": { + "legend": { + "calcs": [ + "lastNotNull" + ], + "displayMode": "table", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "multi", + "sort": "none" + } + }, + "targets": [ + { + "datasource": { + "type": "postgres", + "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + }, + "editorMode": "code", + "format": "time_series", + "hide": false, + "rawQuery": true, + "rawSql": "SELECT\n \"timestamp\" AS \"time\",\n -- earnings / 1000000000000000000 as earnings,\n apy,\n AVG(apy) OVER(ORDER BY timestamp ROWS BETWEEN 6 PRECEDING AND CURRENT ROW) AS apy7,\n AVG(apy) OVER(ORDER BY timestamp ROWS BETWEEN 13 PRECEDING AND CURRENT ROW) AS apy14,\n AVG(apy) OVER(ORDER BY timestamp ROWS BETWEEN 29 PRECEDING AND CURRENT ROW) AS apy30\nFROM\n strategy_daily_yield \n where strategy = '0x1827f9ea98e0bf96550b2fc20f7233277fcd7e63'\nORDER BY timestamp", + "refId": "A", + "sql": { + "columns": [ + { + "parameters": [ + { + "name": "earnings", + "type": "functionParameter" + } + ], + "type": "function" + }, + { + "parameters": [ + { + "name": "asset", + "type": "functionParameter" + } + ], + "type": "function" + }, + { + "alias": "\"time\"", + "parameters": [ + { + "name": "\"timestamp\"", + "type": "functionParameter" + } + ], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, + "table": "strategy_yield" + } + ], + "title": "OETH Convex ETH+OETH (AMO) - APY by Day", + "transformations": [], + "type": "timeseries" + }, + { + "datasource": { + "type": "postgres", + "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "percentunit" + }, + "overrides": [] + }, + "gridPos": { + "h": 9, + "w": 2, + "x": 22, + "y": 1 + }, + "id": 36, + "options": { + "colorMode": "value", + "graphMode": "area", + "justifyMode": "auto", + "orientation": "auto", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "textMode": "auto" + }, + "pluginVersion": "10.3.0-63137", + "targets": [ + { + "datasource": { + "type": "postgres", + "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + }, + "editorMode": "code", + "format": "table", + "rawQuery": true, + "rawSql": "SELECT \n \"timestamp\" as time,\n AVG(apy) OVER(ORDER BY timestamp ROWS BETWEEN 1 PRECEDING AND 1 PRECEDING) AS previous,\n AVG(apy) OVER(ORDER BY timestamp ROWS BETWEEN 6 PRECEDING AND CURRENT ROW) AS apy7,\n AVG(apy) OVER(ORDER BY timestamp ROWS BETWEEN 13 PRECEDING AND CURRENT ROW) AS apy14,\n AVG(apy) OVER(ORDER BY timestamp ROWS BETWEEN 29 PRECEDING AND CURRENT ROW) AS apy30\nFROM strategy_daily_yield\nwhere strategy = '0x1827f9ea98e0bf96550b2fc20f7233277fcd7e63'\nORDER by timestamp desc\nLIMIT 1 ", + "refId": "A", + "sql": { + "columns": [ + { + "parameters": [ + { + "name": "apy", + "type": "functionParameter" + } + ], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, + "table": "strategy_daily_yield" + } + ], + "title": "Latest APY", + "type": "stat" + }, + { + "collapsed": false, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 10 + }, + "id": 10, + "panels": [], + "title": "OETH Frax Staking", + "type": "row" + }, + { + "datasource": { + "type": "postgres", + "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "stepAfter", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": true, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [ + { + "matcher": { + "id": "byName", + "options": "earnings_change" + }, + "properties": [ + { + "id": "custom.axisPlacement", + "value": "right" + }, + { + "id": "custom.fillOpacity", + "value": 25 + }, + { + "id": "custom.lineWidth", + "value": 0 + } + ] + } + ] + }, + "gridPos": { + "h": 9, + "w": 11, + "x": 0, + "y": 11 + }, + "id": 2, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "datasource": { + "type": "postgres", + "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + }, + "editorMode": "code", + "format": "time_series", + "rawQuery": true, + "rawSql": "SELECT timestamp as time, earnings_change / 1000000000000000000 as earnings_change, balance / 1000000000000000000 as balance\nFROM strategy_daily_yield\nwhere strategy = '0x3ff8654d633d4ea0fae24c52aec73b4a20d0d0e5'\n", + "refId": "A", + "sql": { + "columns": [ + { + "parameters": [ + { + "name": "earnings", + "type": "functionParameter" + } + ], + "type": "function" + }, + { + "parameters": [ + { + "name": "asset", + "type": "functionParameter" + } + ], + "type": "function" + }, + { + "alias": "\"time\"", + "parameters": [ + { + "name": "\"timestamp\"", + "type": "functionParameter" + } + ], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, + "table": "strategy_yield" + } + ], + "title": "OETH Frax Staking - Earnings", + "transformations": [], + "type": "timeseries" + }, + { + "datasource": { + "type": "postgres", + "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + }, + "description": "", + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "axisSoftMax": -4, + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "hue", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "stepAfter", + "lineStyle": { + "fill": "solid" + }, + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": true, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [ + { + "matcher": { + "id": "byRegexp", + "options": "/apy.*/" + }, + "properties": [ + { + "id": "custom.axisPlacement", + "value": "auto" + }, + { + "id": "custom.showPoints", + "value": "never" + }, + { + "id": "custom.lineWidth", + "value": 1 + }, + { + "id": "custom.lineInterpolation", + "value": "stepBefore" + }, + { + "id": "unit", + "value": "percentunit" + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "apy" + }, + "properties": [ + { + "id": "custom.fillOpacity", + "value": 25 + }, + { + "id": "custom.lineWidth", + "value": 0 + } + ] + } + ] + }, + "gridPos": { + "h": 9, + "w": 11, + "x": 11, + "y": 11 + }, + "id": 6, + "options": { + "legend": { + "calcs": [ + "lastNotNull" + ], + "displayMode": "table", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "multi", + "sort": "none" + } + }, + "targets": [ + { + "datasource": { + "type": "postgres", + "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + }, + "editorMode": "code", + "format": "time_series", + "hide": false, + "rawQuery": true, + "rawSql": "SELECT\n \"timestamp\" AS \"time\",\n -- earnings / 1000000000000000000 as earnings,\n apy,\n AVG(apy) OVER(ORDER BY timestamp ROWS BETWEEN 6 PRECEDING AND CURRENT ROW) AS apy7,\n AVG(apy) OVER(ORDER BY timestamp ROWS BETWEEN 13 PRECEDING AND CURRENT ROW) AS apy14,\n AVG(apy) OVER(ORDER BY timestamp ROWS BETWEEN 29 PRECEDING AND CURRENT ROW) AS apy30\nFROM\n strategy_daily_yield \n where strategy = '0x3ff8654d633d4ea0fae24c52aec73b4a20d0d0e5'\nORDER BY timestamp", + "refId": "A", + "sql": { + "columns": [ + { + "parameters": [ + { + "name": "earnings", + "type": "functionParameter" + } + ], + "type": "function" + }, + { + "parameters": [ + { + "name": "asset", + "type": "functionParameter" + } + ], + "type": "function" + }, + { + "alias": "\"time\"", + "parameters": [ + { + "name": "\"timestamp\"", + "type": "functionParameter" + } + ], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, + "table": "strategy_yield" + } + ], + "title": "OETH Frax Staking - APY by Day", + "transformations": [], + "type": "timeseries" + }, + { + "datasource": { + "type": "postgres", + "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "percentunit" + }, + "overrides": [] + }, + "gridPos": { + "h": 9, + "w": 2, + "x": 22, + "y": 11 + }, + "id": 38, + "options": { + "colorMode": "value", + "graphMode": "area", + "justifyMode": "auto", + "orientation": "auto", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "textMode": "auto" + }, + "pluginVersion": "10.3.0-63137", + "targets": [ + { + "datasource": { + "type": "postgres", + "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + }, + "editorMode": "code", + "format": "table", + "rawQuery": true, + "rawSql": "SELECT \n \"timestamp\" as time,\n AVG(apy) OVER(ORDER BY timestamp ROWS BETWEEN 1 PRECEDING AND 1 PRECEDING) AS previous,\n AVG(apy) OVER(ORDER BY timestamp ROWS BETWEEN 6 PRECEDING AND CURRENT ROW) AS apy7,\n AVG(apy) OVER(ORDER BY timestamp ROWS BETWEEN 13 PRECEDING AND CURRENT ROW) AS apy14,\n AVG(apy) OVER(ORDER BY timestamp ROWS BETWEEN 29 PRECEDING AND CURRENT ROW) AS apy30\nFROM strategy_daily_yield\nwhere strategy = '0x3ff8654d633d4ea0fae24c52aec73b4a20d0d0e5'\nORDER by timestamp desc\nLIMIT 1 ", + "refId": "A", + "sql": { + "columns": [ + { + "parameters": [ + { + "name": "apy", + "type": "functionParameter" + } + ], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, + "table": "strategy_daily_yield" + } + ], + "title": "Latest APY", + "type": "stat" + }, + { + "collapsed": false, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 20 + }, + "id": 11, + "panels": [], + "title": "OETH Morpho Aave V2", + "type": "row" + }, + { + "datasource": { + "type": "postgres", + "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "stepAfter", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": true, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [ + { + "matcher": { + "id": "byName", + "options": "earnings_change" + }, + "properties": [ + { + "id": "custom.axisPlacement", + "value": "right" + }, + { + "id": "custom.fillOpacity", + "value": 25 + }, + { + "id": "custom.lineWidth", + "value": 0 + } + ] + } + ] + }, + "gridPos": { + "h": 9, + "w": 11, + "x": 0, + "y": 21 + }, + "id": 4, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "multi", + "sort": "none" + } + }, + "targets": [ + { + "datasource": { + "type": "postgres", + "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + }, + "editorMode": "code", + "format": "time_series", + "rawQuery": true, + "rawSql": "SELECT timestamp as time, earnings_change / 1000000000000000000 as earnings_change, balance / 1000000000000000000 as balance\nFROM strategy_daily_yield\nwhere strategy = '0xc1fc9e5ec3058921ea5025d703cbe31764756319'", + "refId": "A", + "sql": { + "columns": [ + { + "parameters": [ + { + "name": "earnings", + "type": "functionParameter" + } + ], + "type": "function" + }, + { + "parameters": [ + { + "name": "asset", + "type": "functionParameter" + } + ], + "type": "function" + }, + { + "alias": "\"time\"", + "parameters": [ + { + "name": "\"timestamp\"", + "type": "functionParameter" + } + ], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, + "table": "strategy_yield" + } + ], + "title": "OETH Morpho Aave V2 - Earnings", + "transformations": [], + "type": "timeseries" + }, + { + "datasource": { + "type": "postgres", + "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + }, + "description": "", + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "axisSoftMax": -4, + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "hue", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "stepAfter", + "lineStyle": { + "fill": "solid" + }, + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": true, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [ + { + "matcher": { + "id": "byRegexp", + "options": "/apy.*/" + }, + "properties": [ + { + "id": "custom.axisPlacement", + "value": "auto" + }, + { + "id": "custom.showPoints", + "value": "never" + }, + { + "id": "custom.lineWidth", + "value": 1 + }, + { + "id": "custom.lineInterpolation", + "value": "stepBefore" + }, + { + "id": "unit", + "value": "percentunit" + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "apy" + }, + "properties": [ + { + "id": "custom.fillOpacity", + "value": 25 + }, + { + "id": "custom.lineWidth", + "value": 0 + }, + { + "id": "custom.axisPlacement", + "value": "auto" + } + ] + } + ] + }, + "gridPos": { + "h": 9, + "w": 11, + "x": 11, + "y": 21 + }, + "id": 14, + "options": { + "legend": { + "calcs": [ + "lastNotNull" + ], + "displayMode": "table", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "multi", + "sort": "none" + } + }, + "targets": [ + { + "datasource": { + "type": "postgres", + "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + }, + "editorMode": "code", + "format": "time_series", + "hide": false, + "rawQuery": true, + "rawSql": "SELECT\n \"timestamp\" AS \"time\",\n -- earnings / 1000000000000000000 as earnings,\n apy,\n AVG(apy) OVER(ORDER BY timestamp ROWS BETWEEN 6 PRECEDING AND CURRENT ROW) AS apy7,\n AVG(apy) OVER(ORDER BY timestamp ROWS BETWEEN 13 PRECEDING AND CURRENT ROW) AS apy14,\n AVG(apy) OVER(ORDER BY timestamp ROWS BETWEEN 29 PRECEDING AND CURRENT ROW) AS apy30\nFROM strategy_daily_yield \nwhere strategy = '0xc1fc9e5ec3058921ea5025d703cbe31764756319'\nORDER BY timestamp", + "refId": "A", + "sql": { + "columns": [ + { + "parameters": [ + { + "name": "earnings", + "type": "functionParameter" + } + ], + "type": "function" + }, + { + "parameters": [ + { + "name": "asset", + "type": "functionParameter" + } + ], + "type": "function" + }, + { + "alias": "\"time\"", + "parameters": [ + { + "name": "\"timestamp\"", + "type": "functionParameter" + } + ], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, + "table": "strategy_yield" + } + ], + "title": "OETH Morpho Aave V2 - APY by Day", + "transformations": [], + "type": "timeseries" + }, + { + "datasource": { + "type": "postgres", + "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "percentunit" + }, + "overrides": [] + }, + "gridPos": { + "h": 9, + "w": 2, + "x": 22, + "y": 21 + }, + "id": 37, + "options": { + "colorMode": "value", + "graphMode": "area", + "justifyMode": "auto", + "orientation": "auto", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "textMode": "auto" + }, + "pluginVersion": "10.3.0-63137", + "targets": [ + { + "datasource": { + "type": "postgres", + "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + }, + "editorMode": "code", + "format": "table", + "rawQuery": true, + "rawSql": "SELECT \n \"timestamp\" as time,\n AVG(apy) OVER(ORDER BY timestamp ROWS BETWEEN 1 PRECEDING AND 1 PRECEDING) AS previous,\n AVG(apy) OVER(ORDER BY timestamp ROWS BETWEEN 6 PRECEDING AND CURRENT ROW) AS apy7,\n AVG(apy) OVER(ORDER BY timestamp ROWS BETWEEN 13 PRECEDING AND CURRENT ROW) AS apy14,\n AVG(apy) OVER(ORDER BY timestamp ROWS BETWEEN 29 PRECEDING AND CURRENT ROW) AS apy30\nFROM strategy_daily_yield\nwhere strategy = '0xc1fc9e5ec3058921ea5025d703cbe31764756319'\nORDER by timestamp desc\nLIMIT 1 ", + "refId": "A", + "sql": { + "columns": [ + { + "parameters": [ + { + "name": "apy", + "type": "functionParameter" + } + ], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, + "table": "strategy_daily_yield" + } + ], + "title": "Latest APY", + "type": "stat" + }, + { + "collapsed": false, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 30 + }, + "id": 31, + "panels": [], + "title": "OETH Vault Strategies", + "type": "row" + }, + { + "datasource": { + "type": "postgres", + "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "stepAfter", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [ + { + "matcher": { + "id": "byName", + "options": "earnings_change" + }, + "properties": [ + { + "id": "custom.axisPlacement", + "value": "right" + }, + { + "id": "custom.fillOpacity", + "value": 25 + }, + { + "id": "custom.lineWidth", + "value": 0 + } + ] + } + ] + }, + "gridPos": { + "h": 9, + "w": 11, + "x": 0, + "y": 31 + }, + "id": 32, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "datasource": { + "type": "postgres", + "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + }, + "editorMode": "code", + "format": "table", + "rawQuery": true, + "rawSql": "SELECT timestamp as time, earnings_change / 1000000000000000000 as earnings_change, balance / 1000000000000000000 as balance\nFROM strategy_daily_yield\nWHERE strategy = '0x39254033945aa2e4809cc2977e7087bee48bd7ab' and asset = '0xae78736cd615f374d3085123a210448e74fc6393'\nORDER BY timestamp", + "refId": "A", + "sql": { + "columns": [ + { + "parameters": [ + { + "name": "strategy", + "type": "functionParameter" + } + ], + "type": "function" + }, + { + "parameters": [ + { + "name": "asset", + "type": "functionParameter" + } + ], + "type": "function" + }, + { + "parameters": [ + { + "name": "earnings", + "type": "functionParameter" + } + ], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, + "table": "strategy_daily_yield" + } + ], + "title": "OETH Vault (rETH) - Earnings", + "type": "timeseries" + }, + { + "datasource": { + "type": "postgres", + "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + }, + "description": "These values are based on the ETH/rETH exchange rate which is why we see APY values that are quite variable.", + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "axisSoftMax": -4, + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "hue", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "stepAfter", + "lineStyle": { + "fill": "solid" + }, + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": true, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [ + { + "matcher": { + "id": "byRegexp", + "options": "/apy.*/" + }, + "properties": [ + { + "id": "custom.axisPlacement", + "value": "auto" + }, + { + "id": "custom.showPoints", + "value": "never" + }, + { + "id": "custom.lineWidth", + "value": 1 + }, + { + "id": "custom.lineInterpolation", + "value": "stepBefore" + }, + { + "id": "unit", + "value": "percentunit" + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "apy" + }, + "properties": [ + { + "id": "custom.fillOpacity", + "value": 25 + }, + { + "id": "custom.lineWidth", + "value": 0 + } + ] + } + ] + }, + "gridPos": { + "h": 9, + "w": 11, + "x": 11, + "y": 31 + }, + "id": 33, + "options": { + "legend": { + "calcs": [ + "lastNotNull" + ], + "displayMode": "table", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "multi", + "sort": "none" + } + }, + "targets": [ + { + "datasource": { + "type": "postgres", + "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + }, + "editorMode": "code", + "format": "time_series", + "hide": false, + "rawQuery": true, + "rawSql": "SELECT\n \"timestamp\" AS \"time\",\n -- earnings / 1000000000000000000 as earnings,\n apy,\n AVG(apy) OVER(ORDER BY timestamp ROWS BETWEEN 6 PRECEDING AND CURRENT ROW) AS apy7,\n AVG(apy) OVER(ORDER BY timestamp ROWS BETWEEN 13 PRECEDING AND CURRENT ROW) AS apy14,\n AVG(apy) OVER(ORDER BY timestamp ROWS BETWEEN 29 PRECEDING AND CURRENT ROW) AS apy30\nFROM\n strategy_daily_yield \n where strategy = '0x39254033945aa2e4809cc2977e7087bee48bd7ab' and asset = '0xae78736cd615f374d3085123a210448e74fc6393'\nORDER BY timestamp", + "refId": "A", + "sql": { + "columns": [ + { + "parameters": [ + { + "name": "earnings", + "type": "functionParameter" + } + ], + "type": "function" + }, + { + "parameters": [ + { + "name": "asset", + "type": "functionParameter" + } + ], + "type": "function" + }, + { + "alias": "\"time\"", + "parameters": [ + { + "name": "\"timestamp\"", + "type": "functionParameter" + } + ], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, + "table": "strategy_yield" + } + ], + "title": "OETH Vault (rETH) - APY", + "transformations": [], + "type": "timeseries" + }, + { + "datasource": { + "type": "postgres", + "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "percentunit" + }, + "overrides": [] + }, + "gridPos": { + "h": 9, + "w": 2, + "x": 22, + "y": 31 + }, + "id": 39, + "options": { + "colorMode": "value", + "graphMode": "area", + "justifyMode": "auto", + "orientation": "auto", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "textMode": "auto" + }, + "pluginVersion": "10.3.0-63137", + "targets": [ + { + "datasource": { + "type": "postgres", + "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + }, + "editorMode": "code", + "format": "table", + "rawQuery": true, + "rawSql": "SELECT \n \"timestamp\" as time,\n AVG(apy) OVER(ORDER BY timestamp ROWS BETWEEN 1 PRECEDING AND 1 PRECEDING) AS previous,\n AVG(apy) OVER(ORDER BY timestamp ROWS BETWEEN 6 PRECEDING AND CURRENT ROW) AS apy7,\n AVG(apy) OVER(ORDER BY timestamp ROWS BETWEEN 13 PRECEDING AND CURRENT ROW) AS apy14,\n AVG(apy) OVER(ORDER BY timestamp ROWS BETWEEN 29 PRECEDING AND CURRENT ROW) AS apy30\nFROM strategy_daily_yield\nwhere strategy = '0x39254033945aa2e4809cc2977e7087bee48bd7ab' and asset = '0xae78736cd615f374d3085123a210448e74fc6393'\nORDER by timestamp desc\nLIMIT 1 ", + "refId": "A", + "sql": { + "columns": [ + { + "parameters": [ + { + "name": "apy", + "type": "functionParameter" + } + ], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, + "table": "strategy_daily_yield" + } + ], + "title": "Latest APY", + "type": "stat" + }, + { + "datasource": { + "type": "postgres", + "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "stepAfter", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [ + { + "matcher": { + "id": "byName", + "options": "earnings_change" + }, + "properties": [ + { + "id": "custom.axisPlacement", + "value": "right" + }, + { + "id": "custom.fillOpacity", + "value": 25 + }, + { + "id": "custom.lineWidth", + "value": 0 + } + ] + } + ] + }, + "gridPos": { + "h": 9, + "w": 11, + "x": 0, + "y": 40 + }, + "id": 34, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "datasource": { + "type": "postgres", + "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + }, + "editorMode": "code", + "format": "table", + "rawQuery": true, + "rawSql": "SELECT timestamp as time, earnings_change / 1000000000000000000 as earnings_change, balance / 1000000000000000000 as balance\nFROM strategy_daily_yield\nWHERE strategy = '0x39254033945aa2e4809cc2977e7087bee48bd7ab' and asset = '0xae7ab96520de3a18e5e111b5eaab095312d7fe84'\nORDER BY timestamp", + "refId": "A", + "sql": { + "columns": [ + { + "parameters": [ + { + "name": "strategy", + "type": "functionParameter" + } + ], + "type": "function" + }, + { + "parameters": [ + { + "name": "asset", + "type": "functionParameter" + } + ], + "type": "function" + }, + { + "parameters": [ + { + "name": "earnings", + "type": "functionParameter" + } + ], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, + "table": "strategy_daily_yield" + } + ], + "title": "OETH Vault (stETH) - Earnings", + "type": "timeseries" + }, + { + "datasource": { + "type": "postgres", + "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + }, + "description": "", + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "hue", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "stepAfter", + "lineStyle": { + "fill": "solid" + }, + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": true, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "max": 0.2, + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [ + { + "matcher": { + "id": "byRegexp", + "options": "/apy.*/" + }, + "properties": [ + { + "id": "custom.axisPlacement", + "value": "auto" + }, + { + "id": "custom.showPoints", + "value": "never" + }, + { + "id": "custom.lineWidth", + "value": 1 + }, + { + "id": "custom.lineInterpolation", + "value": "stepBefore" + }, + { + "id": "unit", + "value": "percentunit" + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "apy" + }, + "properties": [ + { + "id": "custom.fillOpacity", + "value": 25 + }, + { + "id": "custom.lineWidth", + "value": 0 + } + ] + } + ] + }, + "gridPos": { + "h": 9, + "w": 11, + "x": 11, + "y": 40 + }, + "id": 35, + "options": { + "legend": { + "calcs": [ + "lastNotNull" + ], + "displayMode": "table", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "multi", + "sort": "none" + } + }, + "targets": [ + { + "datasource": { + "type": "postgres", + "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + }, + "editorMode": "code", + "format": "time_series", + "hide": false, + "rawQuery": true, + "rawSql": "SELECT\n \"timestamp\" AS \"time\",\n -- earnings / 1000000000000000000 as earnings,\n apy,\n AVG(apy) OVER(ORDER BY timestamp ROWS BETWEEN 6 PRECEDING AND CURRENT ROW) AS apy7,\n AVG(apy) OVER(ORDER BY timestamp ROWS BETWEEN 13 PRECEDING AND CURRENT ROW) AS apy14,\n AVG(apy) OVER(ORDER BY timestamp ROWS BETWEEN 29 PRECEDING AND CURRENT ROW) AS apy30\nFROM\n strategy_daily_yield \n where strategy = '0x39254033945aa2e4809cc2977e7087bee48bd7ab' and asset = '0xae7ab96520de3a18e5e111b5eaab095312d7fe84'\nORDER BY timestamp", + "refId": "A", + "sql": { + "columns": [ + { + "parameters": [ + { + "name": "earnings", + "type": "functionParameter" + } + ], + "type": "function" + }, + { + "parameters": [ + { + "name": "asset", + "type": "functionParameter" + } + ], + "type": "function" + }, + { + "alias": "\"time\"", + "parameters": [ + { + "name": "\"timestamp\"", + "type": "functionParameter" + } + ], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, + "table": "strategy_yield" + } + ], + "title": "OETH Vault (stETH) - APY", + "transformations": [], + "type": "timeseries" + }, + { + "datasource": { + "type": "postgres", + "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "percentunit" + }, + "overrides": [] + }, + "gridPos": { + "h": 9, + "w": 2, + "x": 22, + "y": 40 + }, + "id": 41, + "options": { + "colorMode": "value", + "graphMode": "area", + "justifyMode": "auto", + "orientation": "auto", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "textMode": "auto" + }, + "pluginVersion": "10.3.0-63137", + "targets": [ + { + "datasource": { + "type": "postgres", + "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + }, + "editorMode": "code", + "format": "table", + "rawQuery": true, + "rawSql": "SELECT \n \"timestamp\" as time,\n AVG(apy) OVER(ORDER BY timestamp ROWS BETWEEN 1 PRECEDING AND 1 PRECEDING) AS previous,\n AVG(apy) OVER(ORDER BY timestamp ROWS BETWEEN 6 PRECEDING AND CURRENT ROW) AS apy7,\n AVG(apy) OVER(ORDER BY timestamp ROWS BETWEEN 13 PRECEDING AND CURRENT ROW) AS apy14,\n AVG(apy) OVER(ORDER BY timestamp ROWS BETWEEN 29 PRECEDING AND CURRENT ROW) AS apy30\nFROM strategy_daily_yield\nwhere strategy = '0x39254033945aa2e4809cc2977e7087bee48bd7ab' and asset = '0xae7ab96520de3a18e5e111b5eaab095312d7fe84'\nORDER by timestamp desc\nLIMIT 1 ", + "refId": "A", + "sql": { + "columns": [ + { + "parameters": [ + { + "name": "apy", + "type": "functionParameter" + } + ], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, + "table": "strategy_daily_yield" + } + ], + "title": "Latest APY", + "type": "stat" + }, + { + "collapsed": false, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 49 + }, + "id": 12, + "panels": [], + "title": "OETH Aura rETH/WETH", + "type": "row" + }, + { + "datasource": { + "type": "postgres", + "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "stepAfter", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": true, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [ + { + "matcher": { + "id": "byName", + "options": "earnings_change" + }, + "properties": [ + { + "id": "custom.axisPlacement", + "value": "right" + }, + { + "id": "custom.fillOpacity", + "value": 25 + }, + { + "id": "custom.lineWidth", + "value": 0 + } + ] + } + ] + }, + "gridPos": { + "h": 9, + "w": 11, + "x": 0, + "y": 50 + }, + "id": 3, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "datasource": { + "type": "postgres", + "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + }, + "editorMode": "code", + "format": "time_series", + "rawQuery": true, + "rawSql": "SELECT\n \"timestamp\" AS \"time\",\n earnings_change / 1000000000000000000 as earnings_change,\n balance / 1000000000000000000 as balance\nFROM\n strategy_daily_yield\n where strategy = '0x49109629ac1deb03f2e9b2fe2ac4a623e0e7dfdc'\nORDER BY timestamp", + "refId": "A", + "sql": { + "columns": [ + { + "parameters": [ + { + "name": "earnings", + "type": "functionParameter" + } + ], + "type": "function" + }, + { + "parameters": [ + { + "name": "asset", + "type": "functionParameter" + } + ], + "type": "function" + }, + { + "alias": "\"time\"", + "parameters": [ + { + "name": "\"timestamp\"", + "type": "functionParameter" + } + ], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, + "table": "strategy_yield" + } + ], + "title": "OETH Aura rETH/WETH - Earnings", + "transformations": [], + "type": "timeseries" + }, + { + "datasource": { + "type": "postgres", + "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + }, + "description": "", + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "axisSoftMax": -3, + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "hue", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "stepAfter", + "lineStyle": { + "fill": "solid" + }, + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": true, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "max": 2, + "min": -0.5, + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [ + { + "matcher": { + "id": "byRegexp", + "options": "/apy.*/" + }, + "properties": [ + { + "id": "custom.showPoints", + "value": "never" + }, + { + "id": "custom.lineWidth", + "value": 1 + }, + { + "id": "custom.lineInterpolation", + "value": "stepBefore" + }, + { + "id": "unit", + "value": "percentunit" + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "apy" + }, + "properties": [ + { + "id": "custom.fillOpacity", + "value": 25 + }, + { + "id": "custom.lineWidth", + "value": 0 + } + ] + } + ] + }, + "gridPos": { + "h": 9, + "w": 11, + "x": 11, + "y": 50 + }, + "id": 15, + "options": { + "legend": { + "calcs": [ + "lastNotNull" + ], + "displayMode": "table", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "multi", + "sort": "none" + } + }, + "targets": [ + { + "datasource": { + "type": "postgres", + "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + }, + "editorMode": "code", + "format": "time_series", + "hide": false, + "rawQuery": true, + "rawSql": "SELECT\n \"timestamp\" AS \"time\",\n apy,\n AVG(apy) OVER(ORDER BY timestamp ROWS BETWEEN 6 PRECEDING AND CURRENT ROW) AS apy7,\n AVG(apy) OVER(ORDER BY timestamp ROWS BETWEEN 13 PRECEDING AND CURRENT ROW) AS apy14,\n AVG(apy) OVER(ORDER BY timestamp ROWS BETWEEN 29 PRECEDING AND CURRENT ROW) AS apy30\nFROM\n strategy_daily_yield \n where strategy = '0x49109629ac1deb03f2e9b2fe2ac4a623e0e7dfdc'\nORDER BY timestamp", + "refId": "A", + "sql": { + "columns": [ + { + "parameters": [ + { + "name": "earnings", + "type": "functionParameter" + } + ], + "type": "function" + }, + { + "parameters": [ + { + "name": "asset", + "type": "functionParameter" + } + ], + "type": "function" + }, + { + "alias": "\"time\"", + "parameters": [ + { + "name": "\"timestamp\"", + "type": "functionParameter" + } + ], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, + "table": "strategy_yield" + } + ], + "title": "OETH Aura rETH/WETH - APY by Day", + "transformations": [], + "type": "timeseries" + }, + { + "datasource": { + "type": "postgres", + "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "percentunit" + }, + "overrides": [] + }, + "gridPos": { + "h": 9, + "w": 2, + "x": 22, + "y": 50 + }, + "id": 40, + "options": { + "colorMode": "value", + "graphMode": "area", + "justifyMode": "auto", + "orientation": "auto", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "textMode": "auto" + }, + "pluginVersion": "10.3.0-63137", + "targets": [ + { + "datasource": { + "type": "postgres", + "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + }, + "editorMode": "code", + "format": "table", + "rawQuery": true, + "rawSql": "SELECT \n \"timestamp\" as time,\n AVG(apy) OVER(ORDER BY timestamp ROWS BETWEEN 1 PRECEDING AND 1 PRECEDING) AS previous,\n AVG(apy) OVER(ORDER BY timestamp ROWS BETWEEN 6 PRECEDING AND CURRENT ROW) AS apy7,\n AVG(apy) OVER(ORDER BY timestamp ROWS BETWEEN 13 PRECEDING AND CURRENT ROW) AS apy14,\n AVG(apy) OVER(ORDER BY timestamp ROWS BETWEEN 29 PRECEDING AND CURRENT ROW) AS apy30\nFROM strategy_daily_yield\nwhere strategy = '0x49109629ac1deb03f2e9b2fe2ac4a623e0e7dfdc'\nORDER by timestamp desc\nLIMIT 1 ", + "refId": "A", + "sql": { + "columns": [ + { + "parameters": [ + { + "name": "apy", + "type": "functionParameter" + } + ], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, + "table": "strategy_daily_yield" + } + ], + "title": "Latest APY", + "type": "stat" + } + ], + "refresh": "30s", + "schemaVersion": 39, + "tags": [ + "oeth" + ], + "templating": { + "list": [] + }, + "time": { + "from": "now-6M", + "to": "now" + }, + "timepicker": {}, + "timezone": "", + "title": "OETH Strategy Earnings", + "uid": "c178206e-0cd7-4b2c-98c3-8f16e0d3b58b", + "version": 41, + "weekStart": "" +} \ No newline at end of file diff --git a/grafana/ousd-dashboard.json b/grafana/ousd-dashboard.json new file mode 100644 index 00000000..af740dd9 --- /dev/null +++ b/grafana/ousd-dashboard.json @@ -0,0 +1,1737 @@ +{ + "annotations": { + "list": [ + { + "builtIn": 1, + "datasource": { + "type": "datasource", + "uid": "grafana" + }, + "enable": true, + "hide": true, + "iconColor": "rgba(0, 211, 255, 1)", + "name": "Annotations & Alerts", + "target": { + "limit": 100, + "matchAny": false, + "tags": [], + "type": "dashboard" + }, + "type": "dashboard" + } + ] + }, + "editable": true, + "fiscalYearStartMonth": 0, + "graphTooltip": 0, + "id": 18, + "links": [], + "liveNow": false, + "panels": [ + { + "collapsed": false, + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + }, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 0 + }, + "id": 8, + "panels": [], + "targets": [ + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + }, + "refId": "A" + } + ], + "title": "OUSD General", + "type": "row" + }, + { + "datasource": { + "type": "postgres", + "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "stepAfter", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 9, + "w": 12, + "x": 0, + "y": 1 + }, + "id": 2, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "multi", + "sort": "none" + } + }, + "targets": [ + { + "datasource": { + "type": "postgres", + "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + }, + "editorMode": "code", + "format": "time_series", + "group": [], + "metricColumn": "none", + "rawQuery": true, + "rawSql": "SELECT\n \"timestamp\" AS \"time\",\n dai / 1000000000000000000 as dai,\n usdc / 1000000000000000000 as usdc,\n usdt / 1000000000000000000 as usdt\nFROM ousd_vault\nWHERE\n $__timeFilter(\"timestamp\")\nORDER BY 1", + "refId": "A", + "select": [ + [ + { + "params": [ + "frx_eth" + ], + "type": "column" + } + ], + [ + { + "params": [ + "r_eth" + ], + "type": "column" + } + ], + [ + { + "params": [ + "st_eth" + ], + "type": "column" + } + ], + [ + { + "params": [ + "weth" + ], + "type": "column" + } + ] + ], + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, + "table": "ousd_vault", + "timeColumn": "\"timestamp\"", + "timeColumnType": "timestamptz", + "where": [ + { + "name": "$__timeFilter", + "params": [], + "type": "macro" + } + ] + } + ], + "title": "Vault Balances", + "type": "timeseries" + }, + { + "datasource": { + "type": "postgres", + "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisGridShow": true, + "axisLabel": "", + "axisPlacement": "auto", + "axisSoftMin": 0, + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "stepAfter", + "lineStyle": { + "fill": "solid" + }, + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 9, + "w": 12, + "x": 12, + "y": 1 + }, + "id": 4, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "datasource": { + "type": "postgres", + "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + }, + "editorMode": "code", + "format": "time_series", + "group": [], + "metricColumn": "none", + "rawQuery": true, + "rawSql": "SELECT\n \"timestamp\" AS \"time\",\n total_supply / 1e18 as total_supply,\n rebasing_supply / 1e18 as rebasing_supply,\n non_rebasing_supply / 1e18 as non_rebasing_supply\nFROM ousd\nWHERE\n $__timeFilter(\"timestamp\")\nORDER BY 1", + "refId": "A", + "select": [ + [ + { + "params": [ + "total_supply" + ], + "type": "column" + } + ], + [ + { + "params": [ + "rebasing_supply" + ], + "type": "column" + } + ], + [ + { + "params": [ + "non_rebasing_supply" + ], + "type": "column" + } + ] + ], + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, + "table": "ousd", + "timeColumn": "\"timestamp\"", + "timeColumnType": "timestamptz", + "where": [ + { + "name": "$__timeFilter", + "params": [], + "type": "macro" + } + ] + } + ], + "title": "OUSD Supply", + "type": "timeseries" + }, + { + "datasource": { + "type": "postgres", + "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "smooth", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "max": 0.25, + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "percentunit" + }, + "overrides": [ + { + "matcher": { + "id": "byName", + "options": "apy" + }, + "properties": [ + { + "id": "custom.lineWidth", + "value": 0 + }, + { + "id": "custom.fillOpacity", + "value": 16 + }, + { + "id": "custom.barAlignment", + "value": 0 + }, + { + "id": "custom.lineInterpolation", + "value": "stepBefore" + } + ] + } + ] + }, + "gridPos": { + "h": 12, + "w": 22, + "x": 0, + "y": 10 + }, + "id": 6, + "options": { + "legend": { + "calcs": [ + "lastNotNull" + ], + "displayMode": "table", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "datasource": { + "type": "postgres", + "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + }, + "format": "time_series", + "group": [], + "metricColumn": "none", + "rawQuery": false, + "rawSql": "SELECT\n \"timestamp\" AS \"time\",\n apy7_day_avg,\n apy14_day_avg,\n apy30_day_avg,\n apy\nFROM ousdapy\nWHERE\n $__timeFilter(\"timestamp\")\nORDER BY 1", + "refId": "A", + "select": [ + [ + { + "params": [ + "apy7_day_avg" + ], + "type": "column" + } + ], + [ + { + "params": [ + "apy14_day_avg" + ], + "type": "column" + } + ], + [ + { + "params": [ + "apy30_day_avg" + ], + "type": "column" + } + ], + [ + { + "params": [ + "apy" + ], + "type": "column" + } + ] + ], + "table": "ousdapy", + "timeColumn": "\"timestamp\"", + "timeColumnType": "timestamptz", + "where": [ + { + "name": "$__timeFilter", + "params": [], + "type": "macro" + } + ] + } + ], + "title": "APY", + "type": "timeseries" + }, + { + "datasource": { + "type": "postgres", + "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "percentunit" + }, + "overrides": [] + }, + "gridPos": { + "h": 12, + "w": 2, + "x": 22, + "y": 10 + }, + "id": 39, + "options": { + "colorMode": "value", + "graphMode": "area", + "justifyMode": "auto", + "orientation": "auto", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "textMode": "auto" + }, + "pluginVersion": "10.3.0-63137", + "targets": [ + { + "datasource": { + "type": "postgres", + "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + }, + "editorMode": "code", + "format": "table", + "rawQuery": true, + "rawSql": "select timestamp as time, apy, apy7_day_avg, apy14_day_avg, apy30_day_avg from ousdapy order by id desc limit 1", + "refId": "A", + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + } + } + ], + "title": "Panel Title", + "type": "stat" + }, + { + "datasource": { + "type": "postgres", + "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "stepAfter", + "lineStyle": { + "fill": "solid" + }, + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "decimals": 2, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 11, + "w": 12, + "x": 0, + "y": 22 + }, + "id": 38, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "datasource": { + "type": "postgres", + "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + }, + "editorMode": "code", + "format": "time_series", + "group": [], + "metricColumn": "none", + "rawQuery": true, + "rawSql": "SELECT\n \"timestamp\" AS \"time\",\n yield / 1e18 as yield\nFROM ousd_rebase\nWHERE\n $__timeFilter(\"timestamp\")\nORDER BY 1", + "refId": "A", + "select": [ + [ + { + "params": [ + "yield" + ], + "type": "column" + }, + { + "params": [ + "sum" + ], + "type": "window" + }, + { + "params": [ + "yield" + ], + "type": "alias" + } + ] + ], + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, + "table": "ousd_rebase", + "timeColumn": "\"timestamp\"", + "timeColumnType": "timestamptz", + "where": [ + { + "name": "$__timeFilter", + "params": [], + "type": "macro" + } + ] + } + ], + "title": "Yield Accrual", + "transformations": [], + "type": "timeseries" + }, + { + "datasource": { + "type": "postgres", + "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "stepAfter", + "lineStyle": { + "fill": "solid" + }, + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "decimals": 2, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 11, + "w": 12, + "x": 12, + "y": 22 + }, + "id": 37, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "datasource": { + "type": "postgres", + "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + }, + "editorMode": "code", + "format": "time_series", + "group": [], + "metricColumn": "none", + "rawQuery": true, + "rawSql": "SELECT\n \"timestamp\" AS \"time\",\n fee / 1e18 as fee\nFROM ousd_rebase\nWHERE\n $__timeFilter(\"timestamp\")\nORDER BY 1", + "refId": "A", + "select": [ + [ + { + "params": [ + "fee" + ], + "type": "column" + }, + { + "params": [ + "sum" + ], + "type": "window" + }, + { + "params": [ + "fee" + ], + "type": "alias" + } + ] + ], + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, + "table": "ousd_rebase", + "timeColumn": "\"timestamp\"", + "timeColumnType": "timestamptz", + "where": [ + { + "name": "$__timeFilter", + "params": [], + "type": "macro" + } + ] + } + ], + "title": "Fee Accrual", + "transformations": [], + "type": "timeseries" + }, + { + "collapsed": false, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 33 + }, + "id": 46, + "panels": [], + "title": "OUSD Strategy Balances", + "type": "row" + }, + { + "datasource": { + "type": "postgres", + "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 34 + }, + "id": 41, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "datasource": { + "type": "postgres", + "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + }, + "editorMode": "code", + "format": "table", + "rawQuery": true, + "rawSql": "SELECT \ntimestamp as time, \nasset, \nbalance / case asset \n when '0x6b175474e89094c44da98b954eedeac495271d0f' then 1e18 \n when '0xdac17f958d2ee523a2206206994597c13d831ec7' then 1e6 \n when '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48' then 1e6 \nend as balance\nFROM strategy_balance where strategy = '0x89eb88fedc50fc77ae8a18aad1ca0ac27f777a90'", + "refId": "A", + "sql": { + "columns": [ + { + "parameters": [ + { + "name": "asset", + "type": "functionParameter" + } + ], + "type": "function" + }, + { + "parameters": [ + { + "name": "balance", + "type": "functionParameter" + } + ], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, + "table": "strategy_balance" + } + ], + "title": "OUSD Convex OUSD+3Crv (AMO)", + "type": "timeseries" + }, + { + "datasource": { + "type": "postgres", + "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 12, + "y": 34 + }, + "id": 45, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "datasource": { + "type": "postgres", + "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + }, + "editorMode": "code", + "format": "time_series", + "rawQuery": true, + "rawSql": "SELECT \ntimestamp as time, \nasset, \nbalance / case asset \n when '0x6b175474e89094c44da98b954eedeac495271d0f' then 1e18 \n when '0xdac17f958d2ee523a2206206994597c13d831ec7' then 1e6 \n when '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48' then 1e6 \nend as balance\nFROM strategy_balance where strategy = '0x76bf500b6305dc4ea851384d3d5502f1c7a0ed44'\norder by timestamp, asset desc", + "refId": "A", + "sql": { + "columns": [ + { + "parameters": [ + { + "name": "asset", + "type": "functionParameter" + } + ], + "type": "function" + }, + { + "parameters": [ + { + "name": "balance", + "type": "functionParameter" + } + ], + "type": "function" + }, + { + "parameters": [ + { + "name": "\"timestamp\"", + "type": "functionParameter" + } + ], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, + "table": "strategy_balance" + } + ], + "title": "OUSD Flux", + "type": "timeseries" + }, + { + "datasource": { + "type": "postgres", + "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 42 + }, + "id": 40, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "datasource": { + "type": "postgres", + "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + }, + "editorMode": "code", + "format": "time_series", + "rawQuery": true, + "rawSql": "SELECT \ntimestamp as time, \nasset, \nbalance / case asset \n when '0x6b175474e89094c44da98b954eedeac495271d0f' then 1e18 \n when '0xdac17f958d2ee523a2206206994597c13d831ec7' then 1e6 \n when '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48' then 1e6 \nend as balance\nFROM strategy_balance where strategy = '0x6b69b755c629590ed59618a2712d8a2957ca98fc'\norder by timestamp, asset desc", + "refId": "A", + "sql": { + "columns": [ + { + "parameters": [ + { + "name": "asset", + "type": "functionParameter" + } + ], + "type": "function" + }, + { + "parameters": [ + { + "name": "balance", + "type": "functionParameter" + } + ], + "type": "function" + }, + { + "parameters": [ + { + "name": "\"timestamp\"", + "type": "functionParameter" + } + ], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, + "table": "strategy_balance" + } + ], + "title": "OUSD Maker DSR", + "type": "timeseries" + }, + { + "datasource": { + "type": "postgres", + "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 12, + "y": 42 + }, + "id": 43, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "datasource": { + "type": "postgres", + "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + }, + "editorMode": "code", + "format": "time_series", + "rawQuery": true, + "rawSql": "SELECT \ntimestamp as time, \nasset, \nbalance / case asset \n when '0x6b175474e89094c44da98b954eedeac495271d0f' then 1e18 \n when '0xdac17f958d2ee523a2206206994597c13d831ec7' then 1e6 \n when '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48' then 1e6 \nend as balance\nFROM strategy_balance where strategy = '0x5a4eee58744d1430876d5ca93cab5ccb763c037d'\norder by timestamp, asset desc", + "refId": "A", + "sql": { + "columns": [ + { + "parameters": [ + { + "name": "asset", + "type": "functionParameter" + } + ], + "type": "function" + }, + { + "parameters": [ + { + "name": "balance", + "type": "functionParameter" + } + ], + "type": "function" + }, + { + "parameters": [ + { + "name": "\"timestamp\"", + "type": "functionParameter" + } + ], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, + "table": "strategy_balance" + } + ], + "title": "OUSD Morpho Compound", + "type": "timeseries" + }, + { + "datasource": { + "type": "postgres", + "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 50 + }, + "id": 44, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "datasource": { + "type": "postgres", + "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + }, + "editorMode": "code", + "format": "time_series", + "rawQuery": true, + "rawSql": "SELECT \ntimestamp as time, \nasset, \nbalance / case asset \n when '0x6b175474e89094c44da98b954eedeac495271d0f' then 1e18 \n when '0xdac17f958d2ee523a2206206994597c13d831ec7' then 1e6 \n when '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48' then 1e6 \nend as balance\nFROM strategy_balance where strategy = '0x79f2188ef9350a1dc11a062cca0abe90684b0197'\norder by timestamp, asset desc", + "refId": "A", + "sql": { + "columns": [ + { + "parameters": [ + { + "name": "asset", + "type": "functionParameter" + } + ], + "type": "function" + }, + { + "parameters": [ + { + "name": "balance", + "type": "functionParameter" + } + ], + "type": "function" + }, + { + "parameters": [ + { + "name": "\"timestamp\"", + "type": "functionParameter" + } + ], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, + "table": "strategy_balance" + } + ], + "title": "OUSD Morpho Aave", + "type": "timeseries" + }, + { + "datasource": { + "type": "postgres", + "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 12, + "y": 50 + }, + "id": 42, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "datasource": { + "type": "postgres", + "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + }, + "editorMode": "code", + "format": "table", + "rawQuery": true, + "rawSql": "SELECT \ntimestamp as time, \nasset, \nbalance / case asset \n when '0x6b175474e89094c44da98b954eedeac495271d0f' then 1e18 \n when '0xdac17f958d2ee523a2206206994597c13d831ec7' then 1e6 \n when '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48' then 1e6 \nend as balance\nFROM strategy_balance where strategy = '0x5e3646a1db86993f73e6b74a57d8640b69f7e259'", + "refId": "A", + "sql": { + "columns": [ + { + "parameters": [ + { + "name": "asset", + "type": "functionParameter" + } + ], + "type": "function" + }, + { + "parameters": [ + { + "name": "balance", + "type": "functionParameter" + } + ], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, + "table": "strategy_balance" + } + ], + "title": "OUSD Aave", + "type": "timeseries" + } + ], + "refresh": "", + "schemaVersion": 39, + "tags": [ + "ousd" + ], + "templating": { + "list": [] + }, + "time": { + "from": "now-6M", + "to": "now" + }, + "timepicker": {}, + "timezone": "", + "title": "OUSD Dashboard", + "uid": "5RW4zO7Sj", + "version": 14, + "weekStart": "" +} \ No newline at end of file diff --git a/grafana/ousd-strategy-earnings.json b/grafana/ousd-strategy-earnings.json new file mode 100644 index 00000000..bee8832b --- /dev/null +++ b/grafana/ousd-strategy-earnings.json @@ -0,0 +1,2656 @@ +{ + "annotations": { + "list": [ + { + "builtIn": 1, + "datasource": { + "type": "grafana", + "uid": "-- Grafana --" + }, + "enable": true, + "hide": true, + "iconColor": "rgba(0, 211, 255, 1)", + "name": "Annotations & Alerts", + "type": "dashboard" + } + ] + }, + "editable": true, + "fiscalYearStartMonth": 0, + "graphTooltip": 1, + "id": 16, + "links": [], + "liveNow": false, + "panels": [ + { + "collapsed": false, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 0 + }, + "id": 30, + "panels": [], + "title": "OUSD Strategies", + "type": "row" + }, + { + "datasource": { + "type": "postgres", + "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "stepAfter", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [ + { + "matcher": { + "id": "byName", + "options": "earnings_change" + }, + "properties": [ + { + "id": "custom.axisPlacement", + "value": "right" + }, + { + "id": "custom.fillOpacity", + "value": 25 + }, + { + "id": "custom.lineWidth", + "value": 0 + } + ] + } + ] + }, + "gridPos": { + "h": 9, + "w": 11, + "x": 0, + "y": 1 + }, + "id": 31, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "multi", + "sort": "none" + } + }, + "targets": [ + { + "datasource": { + "type": "postgres", + "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + }, + "editorMode": "code", + "format": "table", + "rawQuery": true, + "rawSql": "SELECT timestamp as time, earnings_change / 1000000000000000000 as earnings_change, balance / 1000000000000000000 as balance\nFROM strategy_daily_yield\nWHERE strategy = '0x6b69b755c629590ed59618a2712d8a2957ca98fc'\nORDER BY timestamp", + "refId": "A", + "sql": { + "columns": [ + { + "parameters": [ + { + "name": "strategy", + "type": "functionParameter" + } + ], + "type": "function" + }, + { + "parameters": [ + { + "name": "asset", + "type": "functionParameter" + } + ], + "type": "function" + }, + { + "parameters": [ + { + "name": "earnings", + "type": "functionParameter" + } + ], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, + "table": "strategy_daily_yield" + } + ], + "title": "OUSD Maker DSR - Earnings", + "type": "timeseries" + }, + { + "datasource": { + "type": "postgres", + "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + }, + "description": "", + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "axisSoftMax": -4, + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "hue", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "stepAfter", + "lineStyle": { + "fill": "solid" + }, + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": true, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [ + { + "matcher": { + "id": "byRegexp", + "options": "/apy.*/" + }, + "properties": [ + { + "id": "custom.axisPlacement", + "value": "auto" + }, + { + "id": "custom.showPoints", + "value": "never" + }, + { + "id": "custom.lineWidth", + "value": 1 + }, + { + "id": "custom.lineInterpolation", + "value": "stepBefore" + }, + { + "id": "unit", + "value": "percentunit" + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "earnings" + }, + "properties": [ + { + "id": "custom.fillOpacity", + "value": 10 + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "apy" + }, + "properties": [ + { + "id": "custom.fillOpacity", + "value": 25 + }, + { + "id": "custom.lineWidth", + "value": 0 + } + ] + } + ] + }, + "gridPos": { + "h": 9, + "w": 11, + "x": 11, + "y": 1 + }, + "id": 20, + "options": { + "legend": { + "calcs": [ + "lastNotNull" + ], + "displayMode": "table", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "multi", + "sort": "none" + } + }, + "targets": [ + { + "datasource": { + "type": "postgres", + "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + }, + "editorMode": "code", + "format": "time_series", + "hide": false, + "rawQuery": true, + "rawSql": "SELECT\n \"timestamp\" AS \"time\",\n -- earnings_change / 1000000000000000000 as earnings_change,\n apy,\n AVG(apy) OVER(ORDER BY timestamp ROWS BETWEEN 6 PRECEDING AND CURRENT ROW) AS apy7,\n AVG(apy) OVER(ORDER BY timestamp ROWS BETWEEN 13 PRECEDING AND CURRENT ROW) AS apy14,\n AVG(apy) OVER(ORDER BY timestamp ROWS BETWEEN 29 PRECEDING AND CURRENT ROW) AS apy30\nFROM\n strategy_daily_yield \n where strategy = '0x6b69b755c629590ed59618a2712d8a2957ca98fc'\nORDER BY timestamp", + "refId": "A", + "sql": { + "columns": [ + { + "parameters": [ + { + "name": "earnings", + "type": "functionParameter" + } + ], + "type": "function" + }, + { + "parameters": [ + { + "name": "asset", + "type": "functionParameter" + } + ], + "type": "function" + }, + { + "alias": "\"time\"", + "parameters": [ + { + "name": "\"timestamp\"", + "type": "functionParameter" + } + ], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, + "table": "strategy_yield" + } + ], + "title": "OUSD Maker DSR - APY", + "transformations": [], + "type": "timeseries" + }, + { + "datasource": { + "type": "postgres", + "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "percentunit" + }, + "overrides": [] + }, + "gridPos": { + "h": 9, + "w": 2, + "x": 22, + "y": 1 + }, + "id": 33, + "options": { + "colorMode": "value", + "graphMode": "area", + "justifyMode": "center", + "orientation": "horizontal", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "textMode": "auto" + }, + "pluginVersion": "10.3.0-63137", + "targets": [ + { + "datasource": { + "type": "postgres", + "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + }, + "editorMode": "code", + "format": "table", + "rawQuery": true, + "rawSql": "SELECT\n AVG(apy) OVER(ORDER BY timestamp ROWS BETWEEN 1 PRECEDING AND 1 PRECEDING) AS apy,\n AVG(apy) OVER(ORDER BY timestamp ROWS BETWEEN 6 PRECEDING AND CURRENT ROW) AS apy7,\n AVG(apy) OVER(ORDER BY timestamp ROWS BETWEEN 13 PRECEDING AND CURRENT ROW) AS apy14,\n AVG(apy) OVER(ORDER BY timestamp ROWS BETWEEN 29 PRECEDING AND CURRENT ROW) AS apy30\nFROM\n strategy_daily_yield \n where strategy = '0x6b69b755c629590ed59618a2712d8a2957ca98fc'\nORDER BY timestamp desc\nlimit 1", + "refId": "A", + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + } + } + ], + "title": "Latest APY", + "type": "stat" + }, + { + "datasource": { + "type": "postgres", + "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "stepAfter", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [ + { + "matcher": { + "id": "byName", + "options": "earnings_change" + }, + "properties": [ + { + "id": "custom.axisPlacement", + "value": "right" + }, + { + "id": "custom.fillOpacity", + "value": 25 + }, + { + "id": "custom.lineWidth", + "value": 0 + } + ] + } + ] + }, + "gridPos": { + "h": 9, + "w": 11, + "x": 0, + "y": 10 + }, + "id": 27, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "multi", + "sort": "none" + } + }, + "targets": [ + { + "datasource": { + "type": "postgres", + "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + }, + "editorMode": "code", + "format": "table", + "rawQuery": true, + "rawSql": "SELECT timestamp as time, earnings_change / 1000000000000000000 as earnings_change, balance / 1000000000000000000 as balance\nFROM strategy_daily_yield\nWHERE strategy = '0x76bf500b6305dc4ea851384d3d5502f1c7a0ed44'\nORDER BY timestamp", + "refId": "A", + "sql": { + "columns": [ + { + "parameters": [ + { + "name": "strategy", + "type": "functionParameter" + } + ], + "type": "function" + }, + { + "parameters": [ + { + "name": "asset", + "type": "functionParameter" + } + ], + "type": "function" + }, + { + "parameters": [ + { + "name": "earnings", + "type": "functionParameter" + } + ], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, + "table": "strategy_daily_yield" + } + ], + "title": "OUSD Flux - Earnings", + "type": "timeseries" + }, + { + "datasource": { + "type": "postgres", + "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + }, + "description": "", + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "axisSoftMax": -4, + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "hue", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "stepAfter", + "lineStyle": { + "fill": "solid" + }, + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": true, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [ + { + "matcher": { + "id": "byRegexp", + "options": "/apy.*/" + }, + "properties": [ + { + "id": "custom.axisPlacement", + "value": "auto" + }, + { + "id": "custom.showPoints", + "value": "never" + }, + { + "id": "custom.lineWidth", + "value": 1 + }, + { + "id": "custom.lineInterpolation", + "value": "stepBefore" + }, + { + "id": "unit", + "value": "percentunit" + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "earnings" + }, + "properties": [ + { + "id": "custom.fillOpacity", + "value": 10 + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "apy" + }, + "properties": [ + { + "id": "custom.lineWidth", + "value": 0 + }, + { + "id": "custom.fillOpacity", + "value": 25 + } + ] + } + ] + }, + "gridPos": { + "h": 9, + "w": 11, + "x": 11, + "y": 10 + }, + "id": 32, + "options": { + "legend": { + "calcs": [ + "lastNotNull" + ], + "displayMode": "table", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "multi", + "sort": "none" + } + }, + "targets": [ + { + "datasource": { + "type": "postgres", + "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + }, + "editorMode": "code", + "format": "time_series", + "hide": false, + "rawQuery": true, + "rawSql": "SELECT\n \"timestamp\" AS \"time\",\n -- earnings_change / 1000000000000000000 as earnings_change,\n apy,\n AVG(apy) OVER(ORDER BY timestamp ROWS BETWEEN 6 PRECEDING AND CURRENT ROW) AS apy7,\n AVG(apy) OVER(ORDER BY timestamp ROWS BETWEEN 13 PRECEDING AND CURRENT ROW) AS apy14,\n AVG(apy) OVER(ORDER BY timestamp ROWS BETWEEN 29 PRECEDING AND CURRENT ROW) AS apy30\nFROM\n strategy_daily_yield \n where strategy = '0x76bf500b6305dc4ea851384d3d5502f1c7a0ed44'\nORDER BY timestamp", + "refId": "A", + "sql": { + "columns": [ + { + "parameters": [ + { + "name": "earnings", + "type": "functionParameter" + } + ], + "type": "function" + }, + { + "parameters": [ + { + "name": "asset", + "type": "functionParameter" + } + ], + "type": "function" + }, + { + "alias": "\"time\"", + "parameters": [ + { + "name": "\"timestamp\"", + "type": "functionParameter" + } + ], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, + "table": "strategy_yield" + } + ], + "title": "OUSD Flux - APY", + "transformations": [], + "type": "timeseries" + }, + { + "datasource": { + "type": "postgres", + "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "percentunit" + }, + "overrides": [] + }, + "gridPos": { + "h": 9, + "w": 2, + "x": 22, + "y": 10 + }, + "id": 36, + "options": { + "colorMode": "value", + "graphMode": "area", + "justifyMode": "center", + "orientation": "horizontal", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "textMode": "auto" + }, + "pluginVersion": "10.3.0-63137", + "targets": [ + { + "datasource": { + "type": "postgres", + "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + }, + "editorMode": "code", + "format": "table", + "rawQuery": true, + "rawSql": "SELECT\n AVG(apy) OVER(ORDER BY timestamp ROWS BETWEEN 1 PRECEDING AND 1 PRECEDING) AS apy,\n AVG(apy) OVER(ORDER BY timestamp ROWS BETWEEN 6 PRECEDING AND CURRENT ROW) AS apy7,\n AVG(apy) OVER(ORDER BY timestamp ROWS BETWEEN 13 PRECEDING AND CURRENT ROW) AS apy14,\n AVG(apy) OVER(ORDER BY timestamp ROWS BETWEEN 29 PRECEDING AND CURRENT ROW) AS apy30\nFROM\n strategy_daily_yield \n where strategy = '0x76bf500b6305dc4ea851384d3d5502f1c7a0ed44'\nORDER BY timestamp desc\nlimit 1", + "refId": "A", + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + } + } + ], + "title": "Latest APY", + "type": "stat" + }, + { + "datasource": { + "type": "postgres", + "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "stepAfter", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [ + { + "matcher": { + "id": "byName", + "options": "earnings_change" + }, + "properties": [ + { + "id": "custom.axisPlacement", + "value": "right" + }, + { + "id": "custom.fillOpacity", + "value": 25 + }, + { + "id": "custom.lineWidth", + "value": 0 + } + ] + } + ] + }, + "gridPos": { + "h": 9, + "w": 11, + "x": 0, + "y": 19 + }, + "id": 29, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "multi", + "sort": "none" + } + }, + "targets": [ + { + "datasource": { + "type": "postgres", + "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + }, + "editorMode": "code", + "format": "table", + "rawQuery": true, + "rawSql": "SELECT timestamp as time, earnings_change / 1000000000000000000 as earnings_change, balance / 1000000000000000000 as balance\nFROM strategy_daily_yield\nWHERE strategy = '0x79f2188ef9350a1dc11a062cca0abe90684b0197'\nORDER BY timestamp", + "refId": "A", + "sql": { + "columns": [ + { + "parameters": [ + { + "name": "strategy", + "type": "functionParameter" + } + ], + "type": "function" + }, + { + "parameters": [ + { + "name": "asset", + "type": "functionParameter" + } + ], + "type": "function" + }, + { + "parameters": [ + { + "name": "earnings", + "type": "functionParameter" + } + ], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, + "table": "strategy_daily_yield" + } + ], + "title": "OUSD Morpho Aave - Earnings", + "type": "timeseries" + }, + { + "datasource": { + "type": "postgres", + "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + }, + "description": "", + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "axisSoftMax": -4, + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "hue", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "stepAfter", + "lineStyle": { + "fill": "solid" + }, + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": true, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [ + { + "matcher": { + "id": "byRegexp", + "options": "/apy.*/" + }, + "properties": [ + { + "id": "custom.axisPlacement", + "value": "auto" + }, + { + "id": "custom.showPoints", + "value": "never" + }, + { + "id": "custom.lineWidth", + "value": 1 + }, + { + "id": "custom.lineInterpolation", + "value": "stepBefore" + }, + { + "id": "unit", + "value": "percentunit" + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "apy" + }, + "properties": [ + { + "id": "custom.fillOpacity", + "value": 25 + }, + { + "id": "custom.lineWidth", + "value": 0 + } + ] + } + ] + }, + "gridPos": { + "h": 9, + "w": 11, + "x": 11, + "y": 19 + }, + "id": 28, + "options": { + "legend": { + "calcs": [ + "lastNotNull" + ], + "displayMode": "table", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "multi", + "sort": "none" + } + }, + "targets": [ + { + "datasource": { + "type": "postgres", + "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + }, + "editorMode": "code", + "format": "time_series", + "hide": false, + "rawQuery": true, + "rawSql": "SELECT\n \"timestamp\" AS \"time\",\n -- earnings_change / 1000000000000000000 as earnings_change,\n apy,\n AVG(apy) OVER(ORDER BY timestamp ROWS BETWEEN 6 PRECEDING AND CURRENT ROW) AS apy7,\n AVG(apy) OVER(ORDER BY timestamp ROWS BETWEEN 13 PRECEDING AND CURRENT ROW) AS apy14,\n AVG(apy) OVER(ORDER BY timestamp ROWS BETWEEN 29 PRECEDING AND CURRENT ROW) AS apy30\nFROM\n strategy_daily_yield \n where strategy = '0x79f2188ef9350a1dc11a062cca0abe90684b0197'\nORDER BY timestamp", + "refId": "A", + "sql": { + "columns": [ + { + "parameters": [ + { + "name": "earnings", + "type": "functionParameter" + } + ], + "type": "function" + }, + { + "parameters": [ + { + "name": "asset", + "type": "functionParameter" + } + ], + "type": "function" + }, + { + "alias": "\"time\"", + "parameters": [ + { + "name": "\"timestamp\"", + "type": "functionParameter" + } + ], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, + "table": "strategy_yield" + } + ], + "title": "OUSD Morpho Aave - APY", + "transformations": [], + "type": "timeseries" + }, + { + "datasource": { + "type": "postgres", + "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "percentunit" + }, + "overrides": [] + }, + "gridPos": { + "h": 9, + "w": 2, + "x": 22, + "y": 19 + }, + "id": 35, + "options": { + "colorMode": "value", + "graphMode": "area", + "justifyMode": "center", + "orientation": "horizontal", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "textMode": "auto" + }, + "pluginVersion": "10.3.0-63137", + "targets": [ + { + "datasource": { + "type": "postgres", + "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + }, + "editorMode": "code", + "format": "table", + "rawQuery": true, + "rawSql": "SELECT\n AVG(apy) OVER(ORDER BY timestamp ROWS BETWEEN 1 PRECEDING AND 1 PRECEDING) AS apy,\n AVG(apy) OVER(ORDER BY timestamp ROWS BETWEEN 6 PRECEDING AND CURRENT ROW) AS apy7,\n AVG(apy) OVER(ORDER BY timestamp ROWS BETWEEN 13 PRECEDING AND CURRENT ROW) AS apy14,\n AVG(apy) OVER(ORDER BY timestamp ROWS BETWEEN 29 PRECEDING AND CURRENT ROW) AS apy30\nFROM\n strategy_daily_yield \n where strategy = '0x79f2188ef9350a1dc11a062cca0abe90684b0197'\nORDER BY timestamp desc\nlimit 1", + "refId": "A", + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + } + } + ], + "title": "Latest APY", + "type": "stat" + }, + { + "datasource": { + "type": "postgres", + "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "stepAfter", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [ + { + "matcher": { + "id": "byName", + "options": "earnings_change" + }, + "properties": [ + { + "id": "custom.axisPlacement", + "value": "right" + }, + { + "id": "custom.fillOpacity", + "value": 25 + }, + { + "id": "custom.lineWidth", + "value": 0 + } + ] + } + ] + }, + "gridPos": { + "h": 9, + "w": 11, + "x": 0, + "y": 28 + }, + "id": 22, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "multi", + "sort": "none" + } + }, + "targets": [ + { + "datasource": { + "type": "postgres", + "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + }, + "editorMode": "code", + "format": "table", + "rawQuery": true, + "rawSql": "SELECT timestamp as time, earnings_change / 1000000000000000000 as earnings_change, balance / 1000000000000000000 as balance\nFROM strategy_daily_yield\nWHERE strategy = '0x5a4eee58744d1430876d5ca93cab5ccb763c037d'\nORDER BY timestamp", + "refId": "A", + "sql": { + "columns": [ + { + "parameters": [ + { + "name": "strategy", + "type": "functionParameter" + } + ], + "type": "function" + }, + { + "parameters": [ + { + "name": "asset", + "type": "functionParameter" + } + ], + "type": "function" + }, + { + "parameters": [ + { + "name": "earnings", + "type": "functionParameter" + } + ], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, + "table": "strategy_daily_yield" + } + ], + "title": "OUSD Morpho Compound - Earnings", + "type": "timeseries" + }, + { + "datasource": { + "type": "postgres", + "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + }, + "description": "", + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "axisSoftMax": -4, + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "hue", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "stepAfter", + "lineStyle": { + "fill": "solid" + }, + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": true, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [ + { + "matcher": { + "id": "byRegexp", + "options": "/apy.*/" + }, + "properties": [ + { + "id": "custom.axisPlacement", + "value": "auto" + }, + { + "id": "custom.showPoints", + "value": "never" + }, + { + "id": "custom.lineWidth", + "value": 1 + }, + { + "id": "custom.lineInterpolation", + "value": "stepBefore" + }, + { + "id": "unit", + "value": "percentunit" + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "apy" + }, + "properties": [ + { + "id": "custom.fillOpacity", + "value": 25 + }, + { + "id": "custom.lineWidth", + "value": 0 + } + ] + } + ] + }, + "gridPos": { + "h": 9, + "w": 11, + "x": 11, + "y": 28 + }, + "id": 26, + "options": { + "legend": { + "calcs": [ + "lastNotNull" + ], + "displayMode": "table", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "multi", + "sort": "none" + } + }, + "targets": [ + { + "datasource": { + "type": "postgres", + "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + }, + "editorMode": "code", + "format": "time_series", + "hide": false, + "rawQuery": true, + "rawSql": "SELECT\n \"timestamp\" AS \"time\",\n -- earnings_change / 1000000000000000000 as earnings_change,\n apy,\n AVG(apy) OVER(ORDER BY timestamp ROWS BETWEEN 6 PRECEDING AND CURRENT ROW) AS apy7,\n AVG(apy) OVER(ORDER BY timestamp ROWS BETWEEN 13 PRECEDING AND CURRENT ROW) AS apy14,\n AVG(apy) OVER(ORDER BY timestamp ROWS BETWEEN 29 PRECEDING AND CURRENT ROW) AS apy30\nFROM\n strategy_daily_yield \n where strategy = '0x5a4eee58744d1430876d5ca93cab5ccb763c037d'\nORDER BY timestamp", + "refId": "A", + "sql": { + "columns": [ + { + "parameters": [ + { + "name": "earnings", + "type": "functionParameter" + } + ], + "type": "function" + }, + { + "parameters": [ + { + "name": "asset", + "type": "functionParameter" + } + ], + "type": "function" + }, + { + "alias": "\"time\"", + "parameters": [ + { + "name": "\"timestamp\"", + "type": "functionParameter" + } + ], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, + "table": "strategy_yield" + } + ], + "title": "OUSD Morpho Compound - APY by Day", + "transformations": [], + "type": "timeseries" + }, + { + "datasource": { + "type": "postgres", + "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "percentunit" + }, + "overrides": [] + }, + "gridPos": { + "h": 9, + "w": 2, + "x": 22, + "y": 28 + }, + "id": 34, + "options": { + "colorMode": "value", + "graphMode": "area", + "justifyMode": "center", + "orientation": "horizontal", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "textMode": "auto" + }, + "pluginVersion": "10.3.0-63137", + "targets": [ + { + "datasource": { + "type": "postgres", + "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + }, + "editorMode": "code", + "format": "table", + "rawQuery": true, + "rawSql": "SELECT\n AVG(apy) OVER(ORDER BY timestamp ROWS BETWEEN 1 PRECEDING AND 1 PRECEDING) AS apy,\n AVG(apy) OVER(ORDER BY timestamp ROWS BETWEEN 6 PRECEDING AND CURRENT ROW) AS apy7,\n AVG(apy) OVER(ORDER BY timestamp ROWS BETWEEN 13 PRECEDING AND CURRENT ROW) AS apy14,\n AVG(apy) OVER(ORDER BY timestamp ROWS BETWEEN 29 PRECEDING AND CURRENT ROW) AS apy30\nFROM\n strategy_daily_yield \n where strategy = '0x5a4eee58744d1430876d5ca93cab5ccb763c037d'\nORDER BY timestamp desc\nlimit 1", + "refId": "A", + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + } + } + ], + "title": "Latest APY", + "type": "stat" + }, + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "stepAfter", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [ + { + "matcher": { + "id": "byName", + "options": "earnings_change" + }, + "properties": [ + { + "id": "custom.axisPlacement", + "value": "right" + }, + { + "id": "custom.fillOpacity", + "value": 25 + }, + { + "id": "custom.lineWidth", + "value": 0 + } + ] + } + ] + }, + "gridPos": { + "h": 9, + "w": 11, + "x": 0, + "y": 37 + }, + "id": 24, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "multi", + "sort": "none" + } + }, + "targets": [ + { + "datasource": { + "type": "postgres", + "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + }, + "editorMode": "code", + "format": "table", + "rawQuery": true, + "rawSql": "SELECT timestamp as time, earnings_change / 1000000000000000000 as earnings_change, balance / 1000000000000000000 as balance\nFROM strategy_daily_yield\nWHERE strategy = '0x89eb88fedc50fc77ae8a18aad1ca0ac27f777a90'\nORDER BY timestamp", + "refId": "A", + "sql": { + "columns": [ + { + "parameters": [ + { + "name": "strategy", + "type": "functionParameter" + } + ], + "type": "function" + }, + { + "parameters": [ + { + "name": "asset", + "type": "functionParameter" + } + ], + "type": "function" + }, + { + "parameters": [ + { + "name": "earnings", + "type": "functionParameter" + } + ], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, + "table": "strategy_daily_yield" + } + ], + "title": "OUSD Convex OUSD+3Crv (AMO) - Earnings", + "type": "timeseries" + }, + { + "datasource": { + "type": "postgres", + "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + }, + "description": "", + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "axisSoftMax": -4, + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "hue", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "stepAfter", + "lineStyle": { + "fill": "solid" + }, + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": true, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "max": 0.12, + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [ + { + "matcher": { + "id": "byRegexp", + "options": "/apy.*/" + }, + "properties": [ + { + "id": "custom.axisPlacement", + "value": "auto" + }, + { + "id": "custom.showPoints", + "value": "never" + }, + { + "id": "custom.lineWidth", + "value": 1 + }, + { + "id": "custom.lineInterpolation", + "value": "stepBefore" + }, + { + "id": "unit", + "value": "percentunit" + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "apy" + }, + "properties": [ + { + "id": "custom.fillOpacity", + "value": 25 + }, + { + "id": "custom.lineWidth", + "value": 0 + } + ] + } + ] + }, + "gridPos": { + "h": 9, + "w": 11, + "x": 11, + "y": 37 + }, + "id": 25, + "options": { + "legend": { + "calcs": [ + "lastNotNull" + ], + "displayMode": "table", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "multi", + "sort": "none" + } + }, + "targets": [ + { + "datasource": { + "type": "postgres", + "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + }, + "editorMode": "code", + "format": "time_series", + "hide": false, + "rawQuery": true, + "rawSql": "SELECT\n \"timestamp\" AS \"time\",\n -- earnings_change / 1000000000000000000 as earnings_change,\n apy,\n AVG(apy) OVER(ORDER BY timestamp ROWS BETWEEN 6 PRECEDING AND CURRENT ROW) AS apy7,\n AVG(apy) OVER(ORDER BY timestamp ROWS BETWEEN 13 PRECEDING AND CURRENT ROW) AS apy14,\n AVG(apy) OVER(ORDER BY timestamp ROWS BETWEEN 29 PRECEDING AND CURRENT ROW) AS apy30\nFROM\n strategy_daily_yield \n where strategy = '0x89eb88fedc50fc77ae8a18aad1ca0ac27f777a90'\nORDER BY timestamp", + "refId": "A", + "sql": { + "columns": [ + { + "parameters": [ + { + "name": "earnings", + "type": "functionParameter" + } + ], + "type": "function" + }, + { + "parameters": [ + { + "name": "asset", + "type": "functionParameter" + } + ], + "type": "function" + }, + { + "alias": "\"time\"", + "parameters": [ + { + "name": "\"timestamp\"", + "type": "functionParameter" + } + ], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, + "table": "strategy_yield" + } + ], + "title": "OUSD Convex OUSD+3Crv (AMO) - APY by Day", + "transformations": [], + "type": "timeseries" + }, + { + "datasource": { + "type": "postgres", + "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "percentunit" + }, + "overrides": [] + }, + "gridPos": { + "h": 9, + "w": 2, + "x": 22, + "y": 37 + }, + "id": 38, + "options": { + "colorMode": "value", + "graphMode": "area", + "justifyMode": "center", + "orientation": "horizontal", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "textMode": "auto" + }, + "pluginVersion": "10.3.0-63137", + "targets": [ + { + "datasource": { + "type": "postgres", + "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + }, + "editorMode": "code", + "format": "table", + "rawQuery": true, + "rawSql": "SELECT\n AVG(apy) OVER(ORDER BY timestamp ROWS BETWEEN 1 PRECEDING AND 1 PRECEDING) AS apy,\n AVG(apy) OVER(ORDER BY timestamp ROWS BETWEEN 6 PRECEDING AND CURRENT ROW) AS apy7,\n AVG(apy) OVER(ORDER BY timestamp ROWS BETWEEN 13 PRECEDING AND CURRENT ROW) AS apy14,\n AVG(apy) OVER(ORDER BY timestamp ROWS BETWEEN 29 PRECEDING AND CURRENT ROW) AS apy30\nFROM\n strategy_daily_yield \n where strategy = '0x89eb88fedc50fc77ae8a18aad1ca0ac27f777a90'\nORDER BY timestamp desc\nlimit 1", + "refId": "A", + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + } + } + ], + "title": "Latest APY", + "type": "stat" + }, + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "stepAfter", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [ + { + "matcher": { + "id": "byName", + "options": "earnings_change" + }, + "properties": [ + { + "id": "custom.axisPlacement", + "value": "right" + }, + { + "id": "custom.fillOpacity", + "value": 25 + }, + { + "id": "custom.lineWidth", + "value": 0 + } + ] + } + ] + }, + "gridPos": { + "h": 9, + "w": 11, + "x": 0, + "y": 46 + }, + "id": 21, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "multi", + "sort": "none" + } + }, + "targets": [ + { + "datasource": { + "type": "postgres", + "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + }, + "editorMode": "code", + "format": "table", + "rawQuery": true, + "rawSql": "SELECT timestamp as time, earnings_change / 1000000000000000000 as earnings_change, balance / 1000000000000000000 as balance\nFROM strategy_daily_yield\nWHERE strategy = '0x5e3646a1db86993f73e6b74a57d8640b69f7e259'\norder by timestamp", + "refId": "A", + "sql": { + "columns": [ + { + "parameters": [ + { + "name": "strategy", + "type": "functionParameter" + } + ], + "type": "function" + }, + { + "parameters": [ + { + "name": "asset", + "type": "functionParameter" + } + ], + "type": "function" + }, + { + "parameters": [ + { + "name": "earnings", + "type": "functionParameter" + } + ], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, + "table": "strategy_daily_yield" + } + ], + "title": "OUSD Aave - Earnings", + "type": "timeseries" + }, + { + "datasource": { + "type": "postgres", + "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + }, + "description": "", + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "axisSoftMax": -4, + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "hue", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "stepAfter", + "lineStyle": { + "fill": "solid" + }, + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": true, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [ + { + "matcher": { + "id": "byRegexp", + "options": "/apy.*/" + }, + "properties": [ + { + "id": "custom.axisPlacement", + "value": "auto" + }, + { + "id": "custom.showPoints", + "value": "never" + }, + { + "id": "custom.lineWidth", + "value": 1 + }, + { + "id": "custom.lineInterpolation", + "value": "stepBefore" + }, + { + "id": "unit", + "value": "percentunit" + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "apy" + }, + "properties": [ + { + "id": "custom.fillOpacity", + "value": 25 + }, + { + "id": "custom.lineWidth", + "value": 0 + } + ] + } + ] + }, + "gridPos": { + "h": 9, + "w": 11, + "x": 11, + "y": 46 + }, + "id": 23, + "options": { + "legend": { + "calcs": [ + "lastNotNull" + ], + "displayMode": "table", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "multi", + "sort": "none" + } + }, + "targets": [ + { + "datasource": { + "type": "postgres", + "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + }, + "editorMode": "code", + "format": "time_series", + "hide": false, + "rawQuery": true, + "rawSql": "SELECT\n \"timestamp\" AS \"time\",\n -- earnings_change / 1000000000000000000 as earnings_change,\n apy,\n AVG(apy) OVER(ORDER BY timestamp ROWS BETWEEN 6 PRECEDING AND CURRENT ROW) AS apy7,\n AVG(apy) OVER(ORDER BY timestamp ROWS BETWEEN 13 PRECEDING AND CURRENT ROW) AS apy14,\n AVG(apy) OVER(ORDER BY timestamp ROWS BETWEEN 29 PRECEDING AND CURRENT ROW) AS apy30\nFROM\n strategy_daily_yield \n where strategy = '0x5e3646a1db86993f73e6b74a57d8640b69f7e259'\nORDER BY timestamp", + "refId": "A", + "sql": { + "columns": [ + { + "parameters": [ + { + "name": "earnings", + "type": "functionParameter" + } + ], + "type": "function" + }, + { + "parameters": [ + { + "name": "asset", + "type": "functionParameter" + } + ], + "type": "function" + }, + { + "alias": "\"time\"", + "parameters": [ + { + "name": "\"timestamp\"", + "type": "functionParameter" + } + ], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, + "table": "strategy_yield" + } + ], + "title": "OUSD Aave - APY by Day", + "transformations": [], + "type": "timeseries" + }, + { + "datasource": { + "type": "postgres", + "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "percentunit" + }, + "overrides": [] + }, + "gridPos": { + "h": 9, + "w": 2, + "x": 22, + "y": 46 + }, + "id": 37, + "options": { + "colorMode": "value", + "graphMode": "area", + "justifyMode": "center", + "orientation": "horizontal", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "textMode": "auto" + }, + "pluginVersion": "10.3.0-63137", + "targets": [ + { + "datasource": { + "type": "postgres", + "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + }, + "editorMode": "code", + "format": "table", + "rawQuery": true, + "rawSql": "SELECT\n AVG(apy) OVER(ORDER BY timestamp ROWS BETWEEN 1 PRECEDING AND 1 PRECEDING) AS apy,\n AVG(apy) OVER(ORDER BY timestamp ROWS BETWEEN 6 PRECEDING AND CURRENT ROW) AS apy7,\n AVG(apy) OVER(ORDER BY timestamp ROWS BETWEEN 13 PRECEDING AND CURRENT ROW) AS apy14,\n AVG(apy) OVER(ORDER BY timestamp ROWS BETWEEN 29 PRECEDING AND CURRENT ROW) AS apy30\nFROM\n strategy_daily_yield \n where strategy = '0x5e3646a1db86993f73e6b74a57d8640b69f7e259'\nORDER BY timestamp desc\nlimit 1", + "refId": "A", + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + } + } + ], + "title": "Latest APY", + "type": "stat" + } + ], + "refresh": "", + "schemaVersion": 39, + "tags": [ + "ousd" + ], + "templating": { + "list": [] + }, + "time": { + "from": "now-6M", + "to": "now" + }, + "timepicker": {}, + "timezone": "", + "title": "OUSD Strategy Earnings", + "uid": "f40d88db-86e6-43c6-933d-e7bc1ad5ced0", + "version": 25, + "weekStart": "" +} \ No newline at end of file diff --git a/schema-base.graphql b/schema-base.graphql index 3e180440..e50e83bd 100644 --- a/schema-base.graphql +++ b/schema-base.graphql @@ -77,6 +77,7 @@ type StrategyDailyYield @entity { strategy: String! asset: String! balance: BigInt! + balanceWeight: Float! earnings: BigInt! earningsChange: BigInt! apr: Float! diff --git a/schema.graphql b/schema.graphql index af4500a2..f3b33da1 100644 --- a/schema.graphql +++ b/schema.graphql @@ -79,6 +79,7 @@ type StrategyDailyYield @entity { strategy: String! asset: String! balance: BigInt! + balanceWeight: Float! earnings: BigInt! earningsChange: BigInt! apr: Float! diff --git a/src/model/generated/strategyDailyYield.model.ts b/src/model/generated/strategyDailyYield.model.ts index a9ecba62..3e6ea8f9 100644 --- a/src/model/generated/strategyDailyYield.model.ts +++ b/src/model/generated/strategyDailyYield.model.ts @@ -30,6 +30,9 @@ export class StrategyDailyYield { @Column_("numeric", {transformer: marshal.bigintTransformer, nullable: false}) balance!: bigint + @Column_("numeric", {transformer: marshal.floatTransformer, nullable: false}) + balanceWeight!: number + @Column_("numeric", {transformer: marshal.bigintTransformer, nullable: false}) earnings!: bigint diff --git a/src/ousd/processors/strategies/aave-strategy.ts b/src/ousd/processors/strategies/aave-strategy.ts index 4ccb4296..2e490571 100644 --- a/src/ousd/processors/strategies/aave-strategy.ts +++ b/src/ousd/processors/strategies/aave-strategy.ts @@ -13,7 +13,7 @@ export const aaveStrategy: IStrategyData = { kind: 'Generic', name: 'OUSD Aave', contractName: 'AaveStrategy', - address: '0x5e3646a1db86993f73e6b74a57d8640b69f7e259'.toLowerCase(), + address: '0x5e3646a1db86993f73e6b74a57d8640b69f7e259', base: { address: currencies.USD, decimals: 18 }, assets: [DAI, USDT], earnings: { passiveByDepositWithdrawal: true, rewardTokenCollected: true }, diff --git a/src/ousd/processors/strategies/const.ts b/src/ousd/processors/strategies/const.ts index d19eddea..e5b00978 100644 --- a/src/ousd/processors/strategies/const.ts +++ b/src/ousd/processors/strategies/const.ts @@ -1,12 +1,12 @@ export const DAI = { - address: '0x6b175474e89094c44da98b954eedeac495271d0f'.toLowerCase(), + address: '0x6b175474e89094c44da98b954eedeac495271d0f', decimals: 18, } export const USDT = { - address: '0xdac17f958d2ee523a2206206994597c13d831ec7'.toLowerCase(), + address: '0xdac17f958d2ee523a2206206994597c13d831ec7', decimals: 6, } export const USDC = { - address: '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48'.toLowerCase(), + address: '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48', decimals: 6, } diff --git a/src/ousd/processors/strategies/convex-meta-strategy.ts b/src/ousd/processors/strategies/convex-meta-strategy.ts index 661ec624..4f2dd8ee 100644 --- a/src/ousd/processors/strategies/convex-meta-strategy.ts +++ b/src/ousd/processors/strategies/convex-meta-strategy.ts @@ -15,7 +15,7 @@ export const convexMetaStrategy: IStrategyData = { kind: 'CurveAMO', name: 'OUSD Convex OUSD+3Crv (AMO)', contractName: 'ConvexOUSDMetaStrategy', - address: '0x89eb88fedc50fc77ae8a18aad1ca0ac27f777a90'.toLowerCase(), + address: '0x89eb88fedc50fc77ae8a18aad1ca0ac27f777a90', base: { address: currencies.USD, decimals: 18 }, assets: [DAI, USDT, USDC], balanceUpdateTraceFilters: [ diff --git a/src/ousd/processors/strategies/flux-strategy.ts b/src/ousd/processors/strategies/flux-strategy.ts index 2b0bf5b7..6fcad6b0 100644 --- a/src/ousd/processors/strategies/flux-strategy.ts +++ b/src/ousd/processors/strategies/flux-strategy.ts @@ -9,7 +9,7 @@ export const fluxStrategy: IStrategyData = { kind: 'Generic', name: 'OUSD Flux', contractName: 'FluxStrategy', - address: '0x76Bf500B6305Dc4ea851384D3d5502f1C7a0ED44'.toLowerCase(), + address: '0x76bf500b6305dc4ea851384d3d5502f1c7a0ed44', base: { address: currencies.USD, decimals: 18 }, assets: [DAI, USDT, USDC], earnings: { passiveByDepositWithdrawal: true, rewardTokenCollected: true }, diff --git a/src/ousd/processors/strategies/maker-dsr-strategy.ts b/src/ousd/processors/strategies/maker-dsr-strategy.ts index 5bb86ea7..94b75c6e 100644 --- a/src/ousd/processors/strategies/maker-dsr-strategy.ts +++ b/src/ousd/processors/strategies/maker-dsr-strategy.ts @@ -9,7 +9,7 @@ export const makerDsrStrategy: IStrategyData = { kind: 'Generic', name: 'OUSD Maker DSR', contractName: 'Generalized4626Strategy', - address: '0x6b69B755C629590eD59618A2712d8a2957CA98FC'.toLowerCase(), + address: '0x6b69b755c629590ed59618a2712d8a2957ca98fc', base: { address: currencies.USD, decimals: 18 }, assets: [DAI], earnings: { passiveByDepositWithdrawal: true, rewardTokenCollected: true }, diff --git a/src/ousd/processors/strategies/morpho-aave.ts b/src/ousd/processors/strategies/morpho-aave.ts index 18bd3c41..4c0d3863 100644 --- a/src/ousd/processors/strategies/morpho-aave.ts +++ b/src/ousd/processors/strategies/morpho-aave.ts @@ -9,7 +9,7 @@ export const morphoAave: IStrategyData = { kind: 'Generic', name: 'OUSD Morpho Aave', contractName: 'MorphoAaveStrategy', - address: '0x79F2188EF9350A1dC11A062cca0abE90684b0197'.toLowerCase(), + address: '0x79f2188ef9350a1dc11a062cca0abe90684b0197', base: { address: currencies.USD, decimals: 18 }, assets: [DAI, USDT, USDC], earnings: { passiveByDepositWithdrawal: true, rewardTokenCollected: true }, diff --git a/src/ousd/processors/strategies/morpho-compound.ts b/src/ousd/processors/strategies/morpho-compound.ts index f5c0285a..c21e6809 100644 --- a/src/ousd/processors/strategies/morpho-compound.ts +++ b/src/ousd/processors/strategies/morpho-compound.ts @@ -9,7 +9,7 @@ export const morphoCompound: IStrategyData = { kind: 'Generic', name: 'OUSD Morpho Compound', contractName: 'MorphoCompoundStrategy', - address: '0x5a4eee58744d1430876d5ca93cab5ccb763c037d'.toLowerCase(), + address: '0x5a4eee58744d1430876d5ca93cab5ccb763c037d', base: { address: currencies.USD, decimals: 18 }, assets: [DAI, USDT, USDC], earnings: { passiveByDepositWithdrawal: true, rewardTokenCollected: true }, diff --git a/src/shared/processor-templates/strategy/strategy-daily-earnings.ts b/src/shared/processor-templates/strategy/strategy-daily-earnings.ts index d1312811..57ed9a53 100644 --- a/src/shared/processor-templates/strategy/strategy-daily-earnings.ts +++ b/src/shared/processor-templates/strategy/strategy-daily-earnings.ts @@ -31,6 +31,7 @@ export const processStrategyDailyEarnings = async ( blockNumber: block.header.height, strategy: strategyData.address, balance: latest?.balance ?? 0n, + balanceWeight: latest?.balanceWeight ?? 1, earnings: latest?.earnings ?? 0n, earningsChange: latest?.earningsChange ?? 0n, asset: strategyData.base.address, @@ -84,6 +85,7 @@ export const processStrategyDailyEarnings = async ( // Apply ETH values current.balance = balance + current.balanceWeight = balanceWeight current.earnings = earnings current.earningsChange = earningsChange From 9011a35862a4f4918ee263d6bf000a36385c55b7 Mon Sep 17 00:00:00 2001 From: Chris Jacobs Date: Wed, 15 Nov 2023 18:26:53 -0800 Subject: [PATCH 26/34] add ousd vault processing, and get ready for new v999 full run --- src/main.ts | 2 + src/oeth/processors/vault.ts | 8 +-- src/ousd/processors/vault.ts | 108 +++++++++++++++++++++++++++++++++++ src/utils/addresses.ts | 9 ++- 4 files changed, 122 insertions(+), 5 deletions(-) create mode 100644 src/ousd/processors/vault.ts diff --git a/src/main.ts b/src/main.ts index 3d235d16..89fd7494 100644 --- a/src/main.ts +++ b/src/main.ts @@ -11,6 +11,7 @@ import * as oeth_vault from './oeth/processors/vault' import * as oeth_validate from './oeth/validators/validate-oeth' import * as ousd from './ousd/processors/ousd' import * as ousd_strategies from './ousd/processors/strategies' +import * as ousd_vault from './ousd/processors/vault' import * as ousd_validate from './ousd/validators/validate-ousd' import { run } from './processor' import * as exchangeRatesPostProcessor from './shared/post-processors/exchange-rates' @@ -32,6 +33,7 @@ run({ // OUSD ousd, + ousd_vault, ousd_strategies, // Shared diff --git a/src/oeth/processors/vault.ts b/src/oeth/processors/vault.ts index 6d76e236..d5be4be4 100644 --- a/src/oeth/processors/vault.ts +++ b/src/oeth/processors/vault.ts @@ -9,9 +9,9 @@ import { ensureExchangeRates } from '../../shared/post-processors/exchange-rates import { FRXETH_ADDRESS, OETH_VAULT_ADDRESS, + OETH_VAULT_ERC20_ADDRESSES, RETH_ADDRESS, STETH_ADDRESS, - VAULT_ERC20_ADDRESSES, WETH_ADDRESS, } from '../../utils/addresses' import { getLatestEntity, trackAddressBalances } from '../../utils/utils' @@ -25,13 +25,13 @@ export const from = 17067001 // https://etherscan.io/tx/0x0b81a0e2b7d824ce493465 export const setup = (processor: EvmBatchProcessor) => { processor.addLog({ - address: VAULT_ERC20_ADDRESSES, + address: OETH_VAULT_ERC20_ADDRESSES, topic0: [erc20.events.Transfer.topic], topic1: [pad(OETH_VAULT_ADDRESS)], range: { from }, }) processor.addLog({ - address: VAULT_ERC20_ADDRESSES, + address: OETH_VAULT_ERC20_ADDRESSES, topic0: [erc20.events.Transfer.topic], topic2: [pad(OETH_VAULT_ADDRESS)], range: { from }, @@ -85,7 +85,7 @@ const processTransfer = async ( await trackAddressBalances({ log, address: OETH_VAULT_ADDRESS, - tokens: VAULT_ERC20_ADDRESSES, + tokens: OETH_VAULT_ERC20_ADDRESSES, fn: async ({ token, change }) => { const { vault } = await getLatestOETHVault(ctx, result, block) if (token === WETH_ADDRESS) { diff --git a/src/ousd/processors/vault.ts b/src/ousd/processors/vault.ts new file mode 100644 index 00000000..4c9737f4 --- /dev/null +++ b/src/ousd/processors/vault.ts @@ -0,0 +1,108 @@ +import { EvmBatchProcessor } from '@subsquid/evm-processor' +import { pad } from 'viem' + +import * as erc20 from '../../abi/erc20' +import { OUSDVault } from '../../model' +import { Context } from '../../processor' +import { + DAI_ADDRESS, + OUSD_VAULT_ADDRESS, + OUSD_VAULT_ERC20_ADDRESSES, + USDC_ADDRESS, + USDT_ADDRESS, +} from '../../utils/addresses' +import { getLatestEntity, trackAddressBalances } from '../../utils/utils' + +interface ProcessResult { + vaults: OUSDVault[] + promises: Promise[] +} + +export const from = 11551793 // https://etherscan.io/tx/0x797a2dfb970903521b963b45df61063ed67e95e0069abbc62d92241ca6e9b531 + +export const setup = (processor: EvmBatchProcessor) => { + processor.addLog({ + address: OUSD_VAULT_ERC20_ADDRESSES, + topic0: [erc20.events.Transfer.topic], + topic1: [pad(OUSD_VAULT_ADDRESS)], + range: { from }, + }) + processor.addLog({ + address: OUSD_VAULT_ERC20_ADDRESSES, + topic0: [erc20.events.Transfer.topic], + topic2: [pad(OUSD_VAULT_ADDRESS)], + range: { from }, + }) +} + +export const process = async (ctx: Context) => { + const result: ProcessResult = { + vaults: [], + promises: [], // Anything async we can wait for at the end of our loop. + } + + for (const block of ctx.blocks) { + for (const log of block.logs) { + await processTransfer(ctx, result, block, log) + } + } + + await ctx.store.insert(result.vaults) +} + +const processTransfer = async ( + ctx: Context, + result: ProcessResult, + block: Context['blocks']['0'], + log: Context['blocks']['0']['logs']['0'], +) => { + if (log.topics[0] === erc20.events.Transfer.topic) { + await trackAddressBalances({ + log, + address: OUSD_VAULT_ADDRESS, + tokens: OUSD_VAULT_ERC20_ADDRESSES, + fn: async ({ token, change }) => { + const { vault } = await getLatestOUSDVault(ctx, result, block) + if (token === DAI_ADDRESS) { + vault.dai += change + } else if (token === USDC_ADDRESS) { + vault.usdc += change + } else if (token === USDT_ADDRESS) { + vault.usdt += change + } + }, + }) + } +} + +const getLatestOUSDVault = async ( + ctx: Context, + result: ProcessResult, + block: Context['blocks']['0'], +) => { + let isNew = false + const timestampId = new Date(block.header.timestamp).toISOString() + const { latest, current } = await getLatestEntity( + ctx, + OUSDVault, + result.vaults, + timestampId, + ) + let vault = current + if (!vault) { + // result.promises.push( + // ensureExchangeRates(ctx, block, []), + // ) + vault = new OUSDVault({ + id: timestampId, + timestamp: new Date(block.header.timestamp), + blockNumber: block.header.height, + dai: latest?.dai ?? 0n, + usdc: latest?.usdc ?? 0n, + usdt: latest?.usdt ?? 0n, + }) + isNew = true + result.vaults.push(vault) + } + return { vault, isNew } +} diff --git a/src/utils/addresses.ts b/src/utils/addresses.ts index bdd7c598..44d68a80 100644 --- a/src/utils/addresses.ts +++ b/src/utils/addresses.ts @@ -4,6 +4,7 @@ export const ADDRESS_ZERO = '0x0000000000000000000000000000000000000000' export const ETH_ADDRESS = '0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee' export const OUSD_ADDRESS = '0x2a8e1e676ec238d8a992307b495b45b3feaa5e86' +export const DAI_ADDRESS = '0x6b175474e89094c44da98b954eedeac495271d0f' export const USDT_ADDRESS = '0xdac17f958d2ee523a2206206994597c13d831ec7' export const USDC_ADDRESS = '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48' export const OUSD_VAULT_ADDRESS = '0xe75d77b1865ae93c7eaa3040b038d7aa7bc02f70' @@ -24,7 +25,13 @@ export const RETH_ADDRESS = '0xae78736cd615f374d3085123a210448e74fc6393' export const FRXETH_ADDRESS = '0x5e8422345238f34275888049021821e8e08caa1f' export const SFRXETH_ADDRESS = '0xac3e018457b222d93114458476f3e3416abbe38f' -export const VAULT_ERC20_ADDRESSES = [ +export const OUSD_VAULT_ERC20_ADDRESSES = [ + DAI_ADDRESS, + USDC_ADDRESS, + USDT_ADDRESS, +] + +export const OETH_VAULT_ERC20_ADDRESSES = [ WETH_ADDRESS, STETH_ADDRESS, RETH_ADDRESS, From 3da5262dbc9634100afcd42f106c951bd090f4f5 Mon Sep 17 00:00:00 2001 From: Chris Jacobs Date: Thu, 16 Nov 2023 12:37:41 -0800 Subject: [PATCH 27/34] fixes --- grafana/ousd-dashboard.json | 80 +++++++++++-------- .../strategy/strategy-generic.ts | 5 +- src/utils/blockFrequencyUpdater.ts | 19 ++--- 3 files changed, 55 insertions(+), 49 deletions(-) diff --git a/grafana/ousd-dashboard.json b/grafana/ousd-dashboard.json index af740dd9..3be27456 100644 --- a/grafana/ousd-dashboard.json +++ b/grafana/ousd-dashboard.json @@ -24,7 +24,7 @@ "editable": true, "fiscalYearStartMonth": 0, "graphTooltip": 0, - "id": 18, + "id": 6, "links": [], "liveNow": false, "panels": [ @@ -65,7 +65,6 @@ "mode": "palette-classic" }, "custom": { - "axisBorderShow": false, "axisCenteredZero": false, "axisColorMode": "text", "axisLabel": "", @@ -143,7 +142,7 @@ "group": [], "metricColumn": "none", "rawQuery": true, - "rawSql": "SELECT\n \"timestamp\" AS \"time\",\n dai / 1000000000000000000 as dai,\n usdc / 1000000000000000000 as usdc,\n usdt / 1000000000000000000 as usdt\nFROM ousd_vault\nWHERE\n $__timeFilter(\"timestamp\")\nORDER BY 1", + "rawSql": "SELECT\n \"timestamp\" AS \"time\",\n dai / 1000000000000000000 as dai,\n usdc / 1000000000000000000 as usdc,\n usdt / 1000000000000000000 as usdt\nFROM ousd_vault\nORDER BY 1", "refId": "A", "select": [ [ @@ -222,7 +221,6 @@ "mode": "palette-classic" }, "custom": { - "axisBorderShow": false, "axisCenteredZero": false, "axisColorMode": "text", "axisGridShow": true, @@ -305,7 +303,7 @@ "group": [], "metricColumn": "none", "rawQuery": true, - "rawSql": "SELECT\n \"timestamp\" AS \"time\",\n total_supply / 1e18 as total_supply,\n rebasing_supply / 1e18 as rebasing_supply,\n non_rebasing_supply / 1e18 as non_rebasing_supply\nFROM ousd\nWHERE\n $__timeFilter(\"timestamp\")\nORDER BY 1", + "rawSql": "SELECT\n \"timestamp\" AS \"time\",\n total_supply / 1e18 as total_supply,\n rebasing_supply / 1e18 as rebasing_supply,\n non_rebasing_supply / 1e18 as non_rebasing_supply\nFROM ousd\nORDER BY 1", "refId": "A", "select": [ [ @@ -376,7 +374,6 @@ "mode": "palette-classic" }, "custom": { - "axisBorderShow": false, "axisCenteredZero": false, "axisColorMode": "text", "axisLabel": "", @@ -478,11 +475,12 @@ "type": "postgres", "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" }, + "editorMode": "code", "format": "time_series", "group": [], "metricColumn": "none", - "rawQuery": false, - "rawSql": "SELECT\n \"timestamp\" AS \"time\",\n apy7_day_avg,\n apy14_day_avg,\n apy30_day_avg,\n apy\nFROM ousdapy\nWHERE\n $__timeFilter(\"timestamp\")\nORDER BY 1", + "rawQuery": true, + "rawSql": "SELECT\n \"timestamp\" AS \"time\",\n apy7_day_avg,\n apy14_day_avg,\n apy30_day_avg,\n apy\nFROM ousdapy\nORDER BY 1", "refId": "A", "select": [ [ @@ -518,6 +516,23 @@ } ] ], + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, "table": "ousdapy", "timeColumn": "\"timestamp\"", "timeColumnType": "timestamptz", @@ -582,7 +597,7 @@ }, "textMode": "auto" }, - "pluginVersion": "10.3.0-63137", + "pluginVersion": "10.1.1", "targets": [ { "datasource": { @@ -627,7 +642,6 @@ "mode": "palette-classic" }, "custom": { - "axisBorderShow": false, "axisCenteredZero": false, "axisColorMode": "text", "axisLabel": "", @@ -709,7 +723,7 @@ "group": [], "metricColumn": "none", "rawQuery": true, - "rawSql": "SELECT\n \"timestamp\" AS \"time\",\n yield / 1e18 as yield\nFROM ousd_rebase\nWHERE\n $__timeFilter(\"timestamp\")\nORDER BY 1", + "rawSql": "SELECT\n \"timestamp\" AS \"time\",\n yield / 1e18 as yield\nFROM ousd_rebase\nORDER BY 1", "refId": "A", "select": [ [ @@ -777,7 +791,6 @@ "mode": "palette-classic" }, "custom": { - "axisBorderShow": false, "axisCenteredZero": false, "axisColorMode": "text", "axisLabel": "", @@ -859,7 +872,7 @@ "group": [], "metricColumn": "none", "rawQuery": true, - "rawSql": "SELECT\n \"timestamp\" AS \"time\",\n fee / 1e18 as fee\nFROM ousd_rebase\nWHERE\n $__timeFilter(\"timestamp\")\nORDER BY 1", + "rawSql": "SELECT\n \"timestamp\" AS \"time\",\n fee / 1e18 as fee\nFROM ousd_rebase\nORDER BY 1", "refId": "A", "select": [ [ @@ -940,7 +953,6 @@ "mode": "palette-classic" }, "custom": { - "axisBorderShow": false, "axisCenteredZero": false, "axisColorMode": "text", "axisLabel": "", @@ -976,7 +988,8 @@ "mode": "absolute", "steps": [ { - "color": "green" + "color": "green", + "value": null }, { "color": "red", @@ -1013,9 +1026,9 @@ "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" }, "editorMode": "code", - "format": "table", + "format": "time_series", "rawQuery": true, - "rawSql": "SELECT \ntimestamp as time, \nasset, \nbalance / case asset \n when '0x6b175474e89094c44da98b954eedeac495271d0f' then 1e18 \n when '0xdac17f958d2ee523a2206206994597c13d831ec7' then 1e6 \n when '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48' then 1e6 \nend as balance\nFROM strategy_balance where strategy = '0x89eb88fedc50fc77ae8a18aad1ca0ac27f777a90'", + "rawSql": "SELECT \ntimestamp as time, \nasset, \nbalance / case asset \n when '0x6b175474e89094c44da98b954eedeac495271d0f' then 1e18 \n when '0xdac17f958d2ee523a2206206994597c13d831ec7' then 1e6 \n when '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48' then 1e6 \nend as balance\nFROM strategy_balance where strategy = '0x89eb88fedc50fc77ae8a18aad1ca0ac27f777a90'\norder by time, asset", "refId": "A", "sql": { "columns": [ @@ -1065,7 +1078,6 @@ "mode": "palette-classic" }, "custom": { - "axisBorderShow": false, "axisCenteredZero": false, "axisColorMode": "text", "axisLabel": "", @@ -1101,7 +1113,8 @@ "mode": "absolute", "steps": [ { - "color": "green" + "color": "green", + "value": null }, { "color": "red", @@ -1199,7 +1212,6 @@ "mode": "palette-classic" }, "custom": { - "axisBorderShow": false, "axisCenteredZero": false, "axisColorMode": "text", "axisLabel": "", @@ -1235,7 +1247,8 @@ "mode": "absolute", "steps": [ { - "color": "green" + "color": "green", + "value": null }, { "color": "red", @@ -1333,7 +1346,6 @@ "mode": "palette-classic" }, "custom": { - "axisBorderShow": false, "axisCenteredZero": false, "axisColorMode": "text", "axisLabel": "", @@ -1369,7 +1381,8 @@ "mode": "absolute", "steps": [ { - "color": "green" + "color": "green", + "value": null }, { "color": "red", @@ -1467,7 +1480,6 @@ "mode": "palette-classic" }, "custom": { - "axisBorderShow": false, "axisCenteredZero": false, "axisColorMode": "text", "axisLabel": "", @@ -1503,7 +1515,8 @@ "mode": "absolute", "steps": [ { - "color": "green" + "color": "green", + "value": null }, { "color": "red", @@ -1601,7 +1614,6 @@ "mode": "palette-classic" }, "custom": { - "axisBorderShow": false, "axisCenteredZero": false, "axisColorMode": "text", "axisLabel": "", @@ -1637,7 +1649,8 @@ "mode": "absolute", "steps": [ { - "color": "green" + "color": "green", + "value": null }, { "color": "red", @@ -1674,9 +1687,9 @@ "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" }, "editorMode": "code", - "format": "table", + "format": "time_series", "rawQuery": true, - "rawSql": "SELECT \ntimestamp as time, \nasset, \nbalance / case asset \n when '0x6b175474e89094c44da98b954eedeac495271d0f' then 1e18 \n when '0xdac17f958d2ee523a2206206994597c13d831ec7' then 1e6 \n when '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48' then 1e6 \nend as balance\nFROM strategy_balance where strategy = '0x5e3646a1db86993f73e6b74a57d8640b69f7e259'", + "rawSql": "SELECT \ntimestamp as time, \nasset, \nbalance / case asset \n when '0x6b175474e89094c44da98b954eedeac495271d0f' then 1e18 \n when '0xdac17f958d2ee523a2206206994597c13d831ec7' then 1e6 \n when '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48' then 1e6 \nend as balance\nFROM strategy_balance where strategy = '0x5e3646a1db86993f73e6b74a57d8640b69f7e259'\norder by time, asset", "refId": "A", "sql": { "columns": [ @@ -1716,8 +1729,9 @@ "type": "timeseries" } ], - "refresh": "", - "schemaVersion": 39, + "refresh": false, + "schemaVersion": 38, + "style": "dark", "tags": [ "ousd" ], @@ -1725,13 +1739,13 @@ "list": [] }, "time": { - "from": "now-6M", + "from": "now-2y", "to": "now" }, "timepicker": {}, "timezone": "", "title": "OUSD Dashboard", "uid": "5RW4zO7Sj", - "version": 14, + "version": 4, "weekStart": "" } \ No newline at end of file diff --git a/src/shared/processor-templates/strategy/strategy-generic.ts b/src/shared/processor-templates/strategy/strategy-generic.ts index 803d2b6a..fa42b386 100644 --- a/src/shared/processor-templates/strategy/strategy-generic.ts +++ b/src/shared/processor-templates/strategy/strategy-generic.ts @@ -42,8 +42,8 @@ const getStrategyHoldings = async ( strategyData: IStrategyData, ): Promise => { const { assets, address } = strategyData - const balances = await getStrategyBalances(ctx, block.header, strategyData) const promises = assets.map(async (asset) => { + const balances = await getStrategyBalances(ctx, block.header, strategyData) return new StrategyBalance({ id: `${address}:${asset.address}:${block.header.height}`, strategy: address, @@ -53,8 +53,7 @@ const getStrategyHoldings = async ( timestamp: new Date(block.header.timestamp), }) }) - - return await Promise.all(promises) + return Promise.all(promises) } const getStrategyBalances = async ( diff --git a/src/utils/blockFrequencyUpdater.ts b/src/utils/blockFrequencyUpdater.ts index 69c3c4a4..4912294b 100644 --- a/src/utils/blockFrequencyUpdater.ts +++ b/src/utils/blockFrequencyUpdater.ts @@ -56,13 +56,8 @@ export const blockFrequencyTracker = (params: { from: number }) => { export const blockFrequencyUpdater = (params: { from: number }) => { let nextBlockToProcess = params.from - const shouldProcess = (b: Block, frequency: number) => { - let result = b.header.height >= nextBlockToProcess - if (result) { - nextBlockToProcess = - Math.floor((b.header.height + frequency) / frequency) * frequency - } - return result + const shouldProcess = (b: Block) => { + return b.header.height >= nextBlockToProcess } return async ( ctx: Context, @@ -72,14 +67,12 @@ export const blockFrequencyUpdater = (params: { from: number }) => { // If we're not at head, determine our frequency and then process. const { bps } = ctx let frequency: number = getFrequency(bps, ctx.blocks[0].header.timestamp) - const nextBlockIndex = ctx.blocks.findIndex((b) => - shouldProcess(b, frequency), - ) - if (nextBlockIndex === -1) return - for (let i = nextBlockIndex; i < ctx.blocks.length; i += frequency) { + for (let i = 0; i < ctx.blocks.length; i += frequency) { const block = ctx.blocks[i] - if (!shouldProcess(block, frequency)) continue + if (!shouldProcess(block)) continue await fn(ctx, block) + nextBlockToProcess = + Math.floor((block.header.height + frequency) / frequency) * frequency frequency = getFrequency(bps, block.header.timestamp) } } From 4c5d6502dae910f9f868af9babd3b07fac645768 Mon Sep 17 00:00:00 2001 From: Chris Jacobs Date: Thu, 16 Nov 2023 14:39:15 -0800 Subject: [PATCH 28/34] use upsert on the exchange rates post processor --- src/shared/post-processors/exchange-rates/exchange-rates.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/shared/post-processors/exchange-rates/exchange-rates.ts b/src/shared/post-processors/exchange-rates/exchange-rates.ts index ce7147b1..95a357f3 100644 --- a/src/shared/post-processors/exchange-rates/exchange-rates.ts +++ b/src/shared/post-processors/exchange-rates/exchange-rates.ts @@ -14,7 +14,7 @@ export const process = async (ctx: Context) => { const [rates] = useExchangeRates(ctx) if (rates.size > 0) { ctx.log.debug({ count: rates.size }, 'exchange-rates') - await ctx.store.insert([...rates.values()]) + await ctx.store.upsert([...rates.values()]) } } From 57b26d896f0e5494ea5686a39387a0a472d6d299 Mon Sep 17 00:00:00 2001 From: Chris Jacobs Date: Thu, 16 Nov 2023 15:55:18 -0800 Subject: [PATCH 29/34] improvements --- src/main-oeth.ts | 9 ++- src/main-ogv.ts | 13 ++-- src/main-other.ts | 9 ++- src/main-ousd.ts | 9 ++- src/main.ts | 65 +++++++---------- .../validators/validate-ousd/validate-ousd.ts | 71 +++++++++---------- .../strategy/strategy-earnings.ts | 2 + 7 files changed, 91 insertions(+), 87 deletions(-) diff --git a/src/main-oeth.ts b/src/main-oeth.ts index e456107d..b1316932 100644 --- a/src/main-oeth.ts +++ b/src/main-oeth.ts @@ -12,7 +12,7 @@ import * as validateOeth from './oeth/validators/validate-oeth' import { run } from './processor' import * as exchangeRatesPostProcessor from './shared/post-processors/exchange-rates' -run({ +export const processor = { stateSchema: 'oeth-processor', processors: [ oeth, @@ -27,4 +27,9 @@ run({ ], postProcessors: [exchangeRatesPostProcessor, dailyStats], validators: [validateOeth], -}) +} +export default processor + +if (require.main === module) { + run(processor) +} diff --git a/src/main-ogv.ts b/src/main-ogv.ts index 30589c20..a219f3d6 100644 --- a/src/main-ogv.ts +++ b/src/main-ogv.ts @@ -1,11 +1,16 @@ -import { run } from './processor' +import * as governance from './ogv/post-processors/governance' import * as ogv from './ogv/processors/ogv' import * as ogvSupply from './ogv/processors/ogv-supply' -import * as governance from './ogv/post-processors/governance' +import { run } from './processor' -run({ +export const processor = { stateSchema: 'ogv-processor', processors: [ogvSupply, ogv], postProcessors: [governance], validators: [], -}) +} +export default processor + +if (require.main === module) { + run(processor) +} diff --git a/src/main-other.ts b/src/main-other.ts index 2c213e03..64398ed1 100644 --- a/src/main-other.ts +++ b/src/main-other.ts @@ -3,9 +3,14 @@ import * as exchangeRates from './shared/post-processors/exchange-rates' import * as aaveCompound from './shared/processors/aave-compound' import * as curve from './shared/processors/curve' -run({ +export const processor = { stateSchema: 'other-processor', processors: [aaveCompound, curve], postProcessors: [exchangeRates], validators: [], -}) +} +export default processor + +if (require.main === module) { + run(processor) +} diff --git a/src/main-ousd.ts b/src/main-ousd.ts index dfe62119..b384c389 100644 --- a/src/main-ousd.ts +++ b/src/main-ousd.ts @@ -4,9 +4,14 @@ import * as validateOusd from './ousd/validators/validate-ousd' import { run } from './processor' import * as exchangeRates from './shared/post-processors/exchange-rates' -run({ +export const processor = { stateSchema: 'ousd-processor', processors: [ousd, strategies], postProcessors: [exchangeRates], validators: [validateOusd], -}) +} +export default processor + +if (require.main === module) { + run(processor) +} diff --git a/src/main.ts b/src/main.ts index 89fd7494..d912d582 100644 --- a/src/main.ts +++ b/src/main.ts @@ -1,45 +1,28 @@ -import * as oeth_dailyStats from './oeth/post-processors/daily-stats' -import * as oeth from './oeth/processors' -import * as oeth_balancerMetaPoolStrategy from './oeth/processors/balancer-meta-pool' -import * as oeth_curveLp from './oeth/processors/curve-lp' -import * as oeth_dripper from './oeth/processors/dripper' -import * as oeth_exchangeRates from './oeth/processors/exchange-rates' -import * as oeth_fraxStaking from './oeth/processors/frax-staking' -import * as oeth_morphoAave from './oeth/processors/morpho-aave' -import * as oeth_strategies from './oeth/processors/strategies' -import * as oeth_vault from './oeth/processors/vault' -import * as oeth_validate from './oeth/validators/validate-oeth' -import * as ousd from './ousd/processors/ousd' -import * as ousd_strategies from './ousd/processors/strategies' -import * as ousd_vault from './ousd/processors/vault' -import * as ousd_validate from './ousd/validators/validate-ousd' +import { uniq } from 'lodash' + +import oeth from './main-oeth' +import ogv from './main-ogv' +import other from './main-other' +import ousd from './main-ousd' import { run } from './processor' -import * as exchangeRatesPostProcessor from './shared/post-processors/exchange-rates' -import * as shared_aaveCompound from './shared/processors/aave-compound' -import * as shared_curve from './shared/processors/curve' run({ - processors: [ - // OETH - oeth, - oeth_vault, - oeth_fraxStaking, - oeth_morphoAave, - oeth_dripper, - oeth_curveLp, - oeth_balancerMetaPoolStrategy, - oeth_strategies, - oeth_exchangeRates, - - // OUSD - ousd, - ousd_vault, - ousd_strategies, - - // Shared - shared_aaveCompound, - shared_curve, - ], - postProcessors: [exchangeRatesPostProcessor, oeth_dailyStats], - validators: [oeth_validate, ousd_validate], + processors: uniq([ + ...oeth.processors, + ...ousd.processors, + ...ogv.processors, + ...other.processors, + ]), + postProcessors: uniq([ + ...oeth.postProcessors, + ...ousd.postProcessors, + ...ogv.postProcessors, + ...other.postProcessors, + ]), + validators: uniq([ + ...oeth.validators, + ...ousd.validators, + ...ogv.validators, + ...other.validators, + ]), }) diff --git a/src/ousd/validators/validate-ousd/validate-ousd.ts b/src/ousd/validators/validate-ousd/validate-ousd.ts index cc624c1b..3fe97aed 100644 --- a/src/ousd/validators/validate-ousd/validate-ousd.ts +++ b/src/ousd/validators/validate-ousd/validate-ousd.ts @@ -91,40 +91,39 @@ const e = (arr: any[]) => { } const expectations = { - strategyYields: e([]), - // strategyYields: e([ - // { - // id: '16421264:0x79f2188ef9350a1dc11a062cca0abe90684b0197:0x0000000000000000000000000000000000000348', - // timestamp: '2023-01-16T18:52:35.000000Z', - // blockNumber: 16421264, - // strategy: '0x79f2188ef9350a1dc11a062cca0abe90684b0197', - // asset: '0x0000000000000000000000000000000000000348', - // balance: '1494000000000000000000000', - // balanceWeight: 1, - // earnings: '0', - // earningsChange: '0', - // }, - // { - // id: '16421590:0x79f2188ef9350a1dc11a062cca0abe90684b0197:0x0000000000000000000000000000000000000348', - // timestamp: '2023-01-16T19:57:59.000000Z', - // blockNumber: 16421590, - // strategy: '0x79f2188ef9350a1dc11a062cca0abe90684b0197', - // asset: '0x0000000000000000000000000000000000000348', - // balance: '1494005405114000000000000', - // balanceWeight: 1, - // earnings: '5405114000000000000', - // earningsChange: '5405114000000000000', - // }, - // { - // id: '16427826:0x79f2188ef9350a1dc11a062cca0abe90684b0197:0x0000000000000000000000000000000000000348', - // timestamp: '2023-01-17T16:50:23.000000Z', - // blockNumber: 16427826, - // strategy: '0x79f2188ef9350a1dc11a062cca0abe90684b0197', - // asset: '0x0000000000000000000000000000000000000348', - // balance: '1513111416702000000000000', - // balanceWeight: 1, - // earnings: '111399765000000000000', - // earningsChange: '105994651000000000000', - // }, - // ]), + strategyYields: e([ + { + id: '16421264:0x79f2188ef9350a1dc11a062cca0abe90684b0197:0x0000000000000000000000000000000000000348', + timestamp: '2023-01-16T18:52:35.000000Z', + blockNumber: 16421264, + strategy: '0x79f2188ef9350a1dc11a062cca0abe90684b0197', + asset: '0x0000000000000000000000000000000000000348', + balance: '1494000000000000000000000', + balanceWeight: 1, + earnings: '0', + earningsChange: '0', + }, + { + id: '16421590:0x79f2188ef9350a1dc11a062cca0abe90684b0197:0x0000000000000000000000000000000000000348', + timestamp: '2023-01-16T19:57:59.000000Z', + blockNumber: 16421590, + strategy: '0x79f2188ef9350a1dc11a062cca0abe90684b0197', + asset: '0x0000000000000000000000000000000000000348', + balance: '1494005405114000000000000', + balanceWeight: 1, + earnings: '5405114000000000000', + earningsChange: '5405114000000000000', + }, + { + id: '16427826:0x79f2188ef9350a1dc11a062cca0abe90684b0197:0x0000000000000000000000000000000000000348', + timestamp: '2023-01-17T16:50:23.000000Z', + blockNumber: 16427826, + strategy: '0x79f2188ef9350a1dc11a062cca0abe90684b0197', + asset: '0x0000000000000000000000000000000000000348', + balance: '1513111416702000000000000', + balanceWeight: 1, + earnings: '111399765000000000000', + earningsChange: '105994651000000000000', + }, + ]), } as const diff --git a/src/shared/processor-templates/strategy/strategy-earnings.ts b/src/shared/processor-templates/strategy/strategy-earnings.ts index beb34b0f..c5b17673 100644 --- a/src/shared/processor-templates/strategy/strategy-earnings.ts +++ b/src/shared/processor-templates/strategy/strategy-earnings.ts @@ -125,11 +125,13 @@ export const setupStrategyEarnings = ( address: strategyData.assets.map((asset) => asset.address), topic0: [erc20.events.Transfer.topic], topic1: [strategyData.address], + range: { from: strategyData.from }, }), logFilter({ address: strategyData.assets.map((asset) => asset.address), topic0: [erc20.events.Transfer.topic], topic2: [strategyData.address], + range: { from: strategyData.from }, }), ) } From 68a3f0a9979a414eeb723332f0e82677e58123e9 Mon Sep 17 00:00:00 2001 From: Chris Jacobs Date: Tue, 21 Nov 2023 08:23:02 -0800 Subject: [PATCH 30/34] Run multiple processors --- squid.yaml | 39 ++++++++++++++++++++------------------- 1 file changed, 20 insertions(+), 19 deletions(-) diff --git a/squid.yaml b/squid.yaml index ca2b82af..b276aa31 100644 --- a/squid.yaml +++ b/squid.yaml @@ -10,25 +10,26 @@ deploy: - RPC_ENDPOINT - RPC_ENDPOINT_999 processor: - cmd: [ "node", "lib/main" ] - env: - RPC_ENV: RPC_ENDPOINT_999 - # - name: oeth-processor - # cmd: [ "node", "lib/main-oeth" ] - # env: - # RPC_ENV: RPC_ENDPOINT_999 - # - name: ousd-processor - # cmd: [ "node", "lib/main-ousd" ] - # env: - # RPC_ENV: RPC_ENDPOINT_999 - # - name: ogv-processor - # cmd: [ "node", "lib/main-ogv" ] - # env: - # RPC_ENV: RPC_ENDPOINT_999 - # - name: other-processor - # cmd: [ "node", "lib/main-other" ] - # env: - # RPC_ENV: RPC_ENDPOINT_999 + # cmd: [ "node", "lib/main" ] + # env: + # RPC_ENV: RPC_ENDPOINT_999 + ################################ + - name: oeth-processor + cmd: [ "node", "lib/main-oeth" ] + env: + RPC_ENV: RPC_ENDPOINT_999 + - name: ousd-processor + cmd: [ "node", "lib/main-ousd" ] + env: + RPC_ENV: RPC_ENDPOINT_999 + - name: ogv-processor + cmd: [ "node", "lib/main-ogv" ] + env: + RPC_ENV: RPC_ENDPOINT_999 + - name: other-processor + cmd: [ "node", "lib/main-other" ] + env: + RPC_ENV: RPC_ENDPOINT_999 api: cmd: - npx From 18804add4f3bf82bf6532a695d5a8f76f936aaf2 Mon Sep 17 00:00:00 2001 From: Chris Jacobs Date: Tue, 21 Nov 2023 09:03:52 -0800 Subject: [PATCH 31/34] remake migration file --- .../{1700586142636-Data.js => 1700586218500-Data.js} | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename db/migrations/{1700586142636-Data.js => 1700586218500-Data.js} (99%) diff --git a/db/migrations/1700586142636-Data.js b/db/migrations/1700586218500-Data.js similarity index 99% rename from db/migrations/1700586142636-Data.js rename to db/migrations/1700586218500-Data.js index da394003..3a49c4cf 100644 --- a/db/migrations/1700586142636-Data.js +++ b/db/migrations/1700586218500-Data.js @@ -1,5 +1,5 @@ -module.exports = class Data1700586142636 { - name = 'Data1700586142636' +module.exports = class Data1700586218500 { + name = 'Data1700586218500' async up(db) { await db.query(`CREATE TABLE "exchange_rate" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "pair" text NOT NULL, "base" text NOT NULL, "quote" text NOT NULL, "rate" numeric NOT NULL, CONSTRAINT "PK_5c5d27d2b900ef6cdeef0398472" PRIMARY KEY ("id"))`) From 8bfb44029de3181824b08ef584b5a63207d81e17 Mon Sep 17 00:00:00 2001 From: Chris Jacobs Date: Tue, 21 Nov 2023 09:11:15 -0800 Subject: [PATCH 32/34] lock fix/update --- package-lock.json | 367 ++++++ yarn.lock | 3108 --------------------------------------------- 2 files changed, 367 insertions(+), 3108 deletions(-) delete mode 100644 yarn.lock diff --git a/package-lock.json b/package-lock.json index bdf63f00..abaa0144 100644 --- a/package-lock.json +++ b/package-lock.json @@ -14,6 +14,7 @@ "@types/lodash": "^4.14.200", "dayjs": "^1.11.10", "dotenv": "^16.1.4", + "esbuild": "^0.19.5", "ethers": "^6.5.1", "js-yaml": "^4.1.0", "lodash": "^4.17.21", @@ -470,6 +471,336 @@ "node": ">=6.9.0" } }, + "node_modules/@esbuild/android-arm": { + "version": "0.19.7", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.19.7.tgz", + "integrity": "sha512-YGSPnndkcLo4PmVl2tKatEn+0mlVMr3yEpOOT0BeMria87PhvoJb5dg5f5Ft9fbCVgtAz4pWMzZVgSEGpDAlww==", + "cpu": [ + "arm" + ], + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/android-arm64": { + "version": "0.19.7", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.19.7.tgz", + "integrity": "sha512-YEDcw5IT7hW3sFKZBkCAQaOCJQLONVcD4bOyTXMZz5fr66pTHnAet46XAtbXAkJRfIn2YVhdC6R9g4xa27jQ1w==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/android-x64": { + "version": "0.19.7", + "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.19.7.tgz", + "integrity": "sha512-jhINx8DEjz68cChFvM72YzrqfwJuFbfvSxZAk4bebpngGfNNRm+zRl4rtT9oAX6N9b6gBcFaJHFew5Blf6CvUw==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/darwin-arm64": { + "version": "0.19.7", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.19.7.tgz", + "integrity": "sha512-dr81gbmWN//3ZnBIm6YNCl4p3pjnabg1/ZVOgz2fJoUO1a3mq9WQ/1iuEluMs7mCL+Zwv7AY5e3g1hjXqQZ9Iw==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/darwin-x64": { + "version": "0.19.7", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.19.7.tgz", + "integrity": "sha512-Lc0q5HouGlzQEwLkgEKnWcSazqr9l9OdV2HhVasWJzLKeOt0PLhHaUHuzb8s/UIya38DJDoUm74GToZ6Wc7NGQ==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/freebsd-arm64": { + "version": "0.19.7", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.19.7.tgz", + "integrity": "sha512-+y2YsUr0CxDFF7GWiegWjGtTUF6gac2zFasfFkRJPkMAuMy9O7+2EH550VlqVdpEEchWMynkdhC9ZjtnMiHImQ==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/freebsd-x64": { + "version": "0.19.7", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.19.7.tgz", + "integrity": "sha512-CdXOxIbIzPJmJhrpmJTLx+o35NoiKBIgOvmvT+jeSadYiWJn0vFKsl+0bSG/5lwjNHoIDEyMYc/GAPR9jxusTA==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-arm": { + "version": "0.19.7", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.19.7.tgz", + "integrity": "sha512-Y+SCmWxsJOdQtjcBxoacn/pGW9HDZpwsoof0ttL+2vGcHokFlfqV666JpfLCSP2xLxFpF1lj7T3Ox3sr95YXww==", + "cpu": [ + "arm" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-arm64": { + "version": "0.19.7", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.19.7.tgz", + "integrity": "sha512-inHqdOVCkUhHNvuQPT1oCB7cWz9qQ/Cz46xmVe0b7UXcuIJU3166aqSunsqkgSGMtUCWOZw3+KMwI6otINuC9g==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-ia32": { + "version": "0.19.7", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.19.7.tgz", + "integrity": "sha512-2BbiL7nLS5ZO96bxTQkdO0euGZIUQEUXMTrqLxKUmk/Y5pmrWU84f+CMJpM8+EHaBPfFSPnomEaQiG/+Gmh61g==", + "cpu": [ + "ia32" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-loong64": { + "version": "0.19.7", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.19.7.tgz", + "integrity": "sha512-BVFQla72KXv3yyTFCQXF7MORvpTo4uTA8FVFgmwVrqbB/4DsBFWilUm1i2Oq6zN36DOZKSVUTb16jbjedhfSHw==", + "cpu": [ + "loong64" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-mips64el": { + "version": "0.19.7", + "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.19.7.tgz", + "integrity": "sha512-DzAYckIaK+pS31Q/rGpvUKu7M+5/t+jI+cdleDgUwbU7KdG2eC3SUbZHlo6Q4P1CfVKZ1lUERRFP8+q0ob9i2w==", + "cpu": [ + "mips64el" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-ppc64": { + "version": "0.19.7", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.19.7.tgz", + "integrity": "sha512-JQ1p0SmUteNdUaaiRtyS59GkkfTW0Edo+e0O2sihnY4FoZLz5glpWUQEKMSzMhA430ctkylkS7+vn8ziuhUugQ==", + "cpu": [ + "ppc64" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-riscv64": { + "version": "0.19.7", + "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.19.7.tgz", + "integrity": "sha512-xGwVJ7eGhkprY/nB7L7MXysHduqjpzUl40+XoYDGC4UPLbnG+gsyS1wQPJ9lFPcxYAaDXbdRXd1ACs9AE9lxuw==", + "cpu": [ + "riscv64" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-s390x": { + "version": "0.19.7", + "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.19.7.tgz", + "integrity": "sha512-U8Rhki5PVU0L0nvk+E8FjkV8r4Lh4hVEb9duR6Zl21eIEYEwXz8RScj4LZWA2i3V70V4UHVgiqMpszXvG0Yqhg==", + "cpu": [ + "s390x" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-x64": { + "version": "0.19.7", + "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.19.7.tgz", + "integrity": "sha512-ZYZopyLhm4mcoZXjFt25itRlocKlcazDVkB4AhioiL9hOWhDldU9n38g62fhOI4Pth6vp+Mrd5rFKxD0/S+7aQ==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/netbsd-x64": { + "version": "0.19.7", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.19.7.tgz", + "integrity": "sha512-/yfjlsYmT1O3cum3J6cmGG16Fd5tqKMcg5D+sBYLaOQExheAJhqr8xOAEIuLo8JYkevmjM5zFD9rVs3VBcsjtQ==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/openbsd-x64": { + "version": "0.19.7", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.19.7.tgz", + "integrity": "sha512-MYDFyV0EW1cTP46IgUJ38OnEY5TaXxjoDmwiTXPjezahQgZd+j3T55Ht8/Q9YXBM0+T9HJygrSRGV5QNF/YVDQ==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/sunos-x64": { + "version": "0.19.7", + "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.19.7.tgz", + "integrity": "sha512-JcPvgzf2NN/y6X3UUSqP6jSS06V0DZAV/8q0PjsZyGSXsIGcG110XsdmuWiHM+pno7/mJF6fjH5/vhUz/vA9fw==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "sunos" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/win32-arm64": { + "version": "0.19.7", + "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.19.7.tgz", + "integrity": "sha512-ZA0KSYti5w5toax5FpmfcAgu3ZNJxYSRm0AW/Dao5up0YV1hDVof1NvwLomjEN+3/GMtaWDI+CIyJOMTRSTdMw==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/win32-ia32": { + "version": "0.19.7", + "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.19.7.tgz", + "integrity": "sha512-CTOnijBKc5Jpk6/W9hQMMvJnsSYRYgveN6O75DTACCY18RA2nqka8dTZR+x/JqXCRiKk84+5+bRKXUSbbwsS0A==", + "cpu": [ + "ia32" + ], + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/win32-x64": { + "version": "0.19.7", + "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.19.7.tgz", + "integrity": "sha512-gRaP2sk6hc98N734luX4VpF318l3w+ofrtTu9j5L8EQXF+FzQKV6alCOHMVoJJHvVK/mGbwBXfOL1HETQu9IGQ==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=12" + } + }, "node_modules/@graphql-tools/merge": { "version": "8.4.2", "resolved": "https://registry.npmjs.org/@graphql-tools/merge/-/merge-8.4.2.tgz", @@ -2583,6 +2914,42 @@ "ext": "^1.1.2" } }, + "node_modules/esbuild": { + "version": "0.19.7", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.19.7.tgz", + "integrity": "sha512-6brbTZVqxhqgbpqBR5MzErImcpA0SQdoKOkcWK/U30HtQxnokIpG3TX2r0IJqbFUzqLjhU/zC1S5ndgakObVCQ==", + "hasInstallScript": true, + "bin": { + "esbuild": "bin/esbuild" + }, + "engines": { + "node": ">=12" + }, + "optionalDependencies": { + "@esbuild/android-arm": "0.19.7", + "@esbuild/android-arm64": "0.19.7", + "@esbuild/android-x64": "0.19.7", + "@esbuild/darwin-arm64": "0.19.7", + "@esbuild/darwin-x64": "0.19.7", + "@esbuild/freebsd-arm64": "0.19.7", + "@esbuild/freebsd-x64": "0.19.7", + "@esbuild/linux-arm": "0.19.7", + "@esbuild/linux-arm64": "0.19.7", + "@esbuild/linux-ia32": "0.19.7", + "@esbuild/linux-loong64": "0.19.7", + "@esbuild/linux-mips64el": "0.19.7", + "@esbuild/linux-ppc64": "0.19.7", + "@esbuild/linux-riscv64": "0.19.7", + "@esbuild/linux-s390x": "0.19.7", + "@esbuild/linux-x64": "0.19.7", + "@esbuild/netbsd-x64": "0.19.7", + "@esbuild/openbsd-x64": "0.19.7", + "@esbuild/sunos-x64": "0.19.7", + "@esbuild/win32-arm64": "0.19.7", + "@esbuild/win32-ia32": "0.19.7", + "@esbuild/win32-x64": "0.19.7" + } + }, "node_modules/escalade": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz", diff --git a/yarn.lock b/yarn.lock deleted file mode 100644 index 81356081..00000000 --- a/yarn.lock +++ /dev/null @@ -1,3108 +0,0 @@ -# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. -# yarn lockfile v1 - - -"@adraffy/ens-normalize@1.10.0": - version "1.10.0" - resolved "https://registry.yarnpkg.com/@adraffy/ens-normalize/-/ens-normalize-1.10.0.tgz#d2a39395c587e092d77cbbc80acf956a54f38bf7" - integrity sha512-nA9XHtlAkYfJxY7bce8DcN7eKxWWCWkU+1GR9d+U6MbNpfwQp8TI7vqOsBsMcHoT4mBu2kypKoSKnghEzOOq5Q== - -"@apollo/protobufjs@1.2.6": - version "1.2.6" - resolved "https://registry.yarnpkg.com/@apollo/protobufjs/-/protobufjs-1.2.6.tgz#d601e65211e06ae1432bf5993a1a0105f2862f27" - integrity sha512-Wqo1oSHNUj/jxmsVp4iR3I480p6qdqHikn38lKrFhfzcDJ7lwd7Ck7cHRl4JE81tWNArl77xhnG/OkZhxKBYOw== - dependencies: - "@protobufjs/aspromise" "^1.1.2" - "@protobufjs/base64" "^1.1.2" - "@protobufjs/codegen" "^2.0.4" - "@protobufjs/eventemitter" "^1.1.0" - "@protobufjs/fetch" "^1.1.0" - "@protobufjs/float" "^1.0.2" - "@protobufjs/inquire" "^1.1.0" - "@protobufjs/path" "^1.1.2" - "@protobufjs/pool" "^1.1.0" - "@protobufjs/utf8" "^1.1.0" - "@types/long" "^4.0.0" - "@types/node" "^10.1.0" - long "^4.0.0" - -"@apollo/protobufjs@1.2.7": - version "1.2.7" - resolved "https://registry.yarnpkg.com/@apollo/protobufjs/-/protobufjs-1.2.7.tgz#3a8675512817e4a046a897e5f4f16415f16a7d8a" - integrity sha512-Lahx5zntHPZia35myYDBRuF58tlwPskwHc5CWBZC/4bMKB6siTBWwtMrkqXcsNwQiFSzSx5hKdRPUmemrEp3Gg== - dependencies: - "@protobufjs/aspromise" "^1.1.2" - "@protobufjs/base64" "^1.1.2" - "@protobufjs/codegen" "^2.0.4" - "@protobufjs/eventemitter" "^1.1.0" - "@protobufjs/fetch" "^1.1.0" - "@protobufjs/float" "^1.0.2" - "@protobufjs/inquire" "^1.1.0" - "@protobufjs/path" "^1.1.2" - "@protobufjs/pool" "^1.1.0" - "@protobufjs/utf8" "^1.1.0" - "@types/long" "^4.0.0" - long "^4.0.0" - -"@apollo/usage-reporting-protobuf@^4.0.0": - version "4.1.1" - resolved "https://registry.yarnpkg.com/@apollo/usage-reporting-protobuf/-/usage-reporting-protobuf-4.1.1.tgz#407c3d18c7fbed7a264f3b9a3812620b93499de1" - integrity sha512-u40dIUePHaSKVshcedO7Wp+mPiZsaU6xjv9J+VyxpoU/zL6Jle+9zWeG98tr/+SZ0nZ4OXhrbb8SNr0rAPpIDA== - dependencies: - "@apollo/protobufjs" "1.2.7" - -"@apollo/utils.dropunuseddefinitions@^1.1.0": - version "1.1.0" - resolved "https://registry.yarnpkg.com/@apollo/utils.dropunuseddefinitions/-/utils.dropunuseddefinitions-1.1.0.tgz#02b04006442eaf037f4c4624146b12775d70d929" - integrity sha512-jU1XjMr6ec9pPoL+BFWzEPW7VHHulVdGKMkPAMiCigpVIT11VmCbnij0bWob8uS3ODJ65tZLYKAh/55vLw2rbg== - -"@apollo/utils.keyvadapter@~1.1.2": - version "1.1.2" - resolved "https://registry.yarnpkg.com/@apollo/utils.keyvadapter/-/utils.keyvadapter-1.1.2.tgz#e0aceed9eba21e0d155342accfb22a9e743ced5e" - integrity sha512-vPC5e97uwHuZ2iMHVrEeRsV4dLw0lNx2UY9APhb7StC/RMR3BdnuPwS/+5yR9tUF5IUut+iJZocHkS4y6mR9aA== - dependencies: - "@apollo/utils.keyvaluecache" "^1.0.1" - dataloader "^2.1.0" - keyv "^4.4.0" - -"@apollo/utils.keyvaluecache@^1.0.1", "@apollo/utils.keyvaluecache@~1.0.2": - version "1.0.2" - resolved "https://registry.yarnpkg.com/@apollo/utils.keyvaluecache/-/utils.keyvaluecache-1.0.2.tgz#2bfe358c4d82f3a0950518451996758c52613f57" - integrity sha512-p7PVdLPMnPzmXSQVEsy27cYEjVON+SH/Wb7COyW3rQN8+wJgT1nv9jZouYtztWW8ZgTkii5T6tC9qfoDREd4mg== - dependencies: - "@apollo/utils.logger" "^1.0.0" - lru-cache "7.10.1 - 7.13.1" - -"@apollo/utils.logger@^1.0.0": - version "1.0.1" - resolved "https://registry.yarnpkg.com/@apollo/utils.logger/-/utils.logger-1.0.1.tgz#aea0d1bb7ceb237f506c6bbf38f10a555b99a695" - integrity sha512-XdlzoY7fYNK4OIcvMD2G94RoFZbzTQaNP0jozmqqMudmaGo2I/2Jx71xlDJ801mWA/mbYRihyaw6KJii7k5RVA== - -"@apollo/utils.printwithreducedwhitespace@^1.1.0": - version "1.1.0" - resolved "https://registry.yarnpkg.com/@apollo/utils.printwithreducedwhitespace/-/utils.printwithreducedwhitespace-1.1.0.tgz#c466299a4766eef8577a2a64c8f27712e8bd7e30" - integrity sha512-GfFSkAv3n1toDZ4V6u2d7L4xMwLA+lv+6hqXicMN9KELSJ9yy9RzuEXaX73c/Ry+GzRsBy/fdSUGayGqdHfT2Q== - -"@apollo/utils.removealiases@1.0.0": - version "1.0.0" - resolved "https://registry.yarnpkg.com/@apollo/utils.removealiases/-/utils.removealiases-1.0.0.tgz#75f6d83098af1fcae2d3beb4f515ad4a8452a8c1" - integrity sha512-6cM8sEOJW2LaGjL/0vHV0GtRaSekrPQR4DiywaApQlL9EdROASZU5PsQibe2MWeZCOhNrPRuHh4wDMwPsWTn8A== - -"@apollo/utils.sortast@^1.1.0": - version "1.1.0" - resolved "https://registry.yarnpkg.com/@apollo/utils.sortast/-/utils.sortast-1.1.0.tgz#93218c7008daf3e2a0725196085a33f5aab5ad07" - integrity sha512-VPlTsmUnOwzPK5yGZENN069y6uUHgeiSlpEhRnLFYwYNoJHsuJq2vXVwIaSmts015WTPa2fpz1inkLYByeuRQA== - dependencies: - lodash.sortby "^4.7.0" - -"@apollo/utils.stripsensitiveliterals@^1.2.0": - version "1.2.0" - resolved "https://registry.yarnpkg.com/@apollo/utils.stripsensitiveliterals/-/utils.stripsensitiveliterals-1.2.0.tgz#4920651f36beee8e260e12031a0c5863ad0c7b28" - integrity sha512-E41rDUzkz/cdikM5147d8nfCFVKovXxKBcjvLEQ7bjZm/cg9zEcXvS6vFY8ugTubI3fn6zoqo0CyU8zT+BGP9w== - -"@apollo/utils.usagereporting@^1.0.0": - version "1.0.1" - resolved "https://registry.yarnpkg.com/@apollo/utils.usagereporting/-/utils.usagereporting-1.0.1.tgz#3c70b49e554771659576fe35381c7a4b321d27fd" - integrity sha512-6dk+0hZlnDbahDBB2mP/PZ5ybrtCJdLMbeNJD+TJpKyZmSY6bA3SjI8Cr2EM9QA+AdziywuWg+SgbWUF3/zQqQ== - dependencies: - "@apollo/usage-reporting-protobuf" "^4.0.0" - "@apollo/utils.dropunuseddefinitions" "^1.1.0" - "@apollo/utils.printwithreducedwhitespace" "^1.1.0" - "@apollo/utils.removealiases" "1.0.0" - "@apollo/utils.sortast" "^1.1.0" - "@apollo/utils.stripsensitiveliterals" "^1.2.0" - -"@apollographql/apollo-tools@^0.5.3": - version "0.5.4" - resolved "https://registry.yarnpkg.com/@apollographql/apollo-tools/-/apollo-tools-0.5.4.tgz#cb3998c6cf12e494b90c733f44dd9935e2d8196c" - integrity sha512-shM3q7rUbNyXVVRkQJQseXv6bnYM3BUma/eZhwXR4xsuM+bqWnJKvW7SAfRjP7LuSCocrexa5AXhjjawNHrIlw== - -"@apollographql/graphql-playground-html@1.6.29": - version "1.6.29" - resolved "https://registry.yarnpkg.com/@apollographql/graphql-playground-html/-/graphql-playground-html-1.6.29.tgz#a7a646614a255f62e10dcf64a7f68ead41dec453" - integrity sha512-xCcXpoz52rI4ksJSdOCxeOCn2DLocxwHf9dVT/Q90Pte1LX+LY+91SFtJF3KXVHH8kEin+g1KKCQPKBjZJfWNA== - dependencies: - xss "^1.0.8" - -"@babel/code-frame@^7.22.13": - version "7.22.13" - resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.22.13.tgz#e3c1c099402598483b7a8c46a721d1038803755e" - integrity sha512-XktuhWlJ5g+3TJXc5upd9Ks1HutSArik6jf2eAjYFyIOf4ej3RN+184cZbzDvbPnuTJIUhPKKJE3cIsYTiAT3w== - dependencies: - "@babel/highlight" "^7.22.13" - chalk "^2.4.2" - -"@babel/generator@7.17.7": - version "7.17.7" - resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.17.7.tgz#8da2599beb4a86194a3b24df6c085931d9ee45ad" - integrity sha512-oLcVCTeIFadUoArDTwpluncplrYBmTCCZZgXCbgNGvOBBiSDDK3eWO4b/+eOTli5tKv1lg+a5/NAXg+nTcei1w== - dependencies: - "@babel/types" "^7.17.0" - jsesc "^2.5.1" - source-map "^0.5.0" - -"@babel/generator@^7.23.0": - version "7.23.3" - resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.23.3.tgz#86e6e83d95903fbe7613f448613b8b319f330a8e" - integrity sha512-keeZWAV4LU3tW0qRi19HRpabC/ilM0HRBBzf9/k8FFiG4KVpiv0FIy4hHfLfFQZNhziCTPTmd59zoyv6DNISzg== - dependencies: - "@babel/types" "^7.23.3" - "@jridgewell/gen-mapping" "^0.3.2" - "@jridgewell/trace-mapping" "^0.3.17" - jsesc "^2.5.1" - -"@babel/helper-environment-visitor@^7.22.20": - version "7.22.20" - resolved "https://registry.yarnpkg.com/@babel/helper-environment-visitor/-/helper-environment-visitor-7.22.20.tgz#96159db61d34a29dba454c959f5ae4a649ba9167" - integrity sha512-zfedSIzFhat/gFhWfHtgWvlec0nqB9YEIVrpuwjruLlXfUSnA8cJB0miHKwqDnQ7d32aKo2xt88/xZptwxbfhA== - -"@babel/helper-function-name@^7.23.0": - version "7.23.0" - resolved "https://registry.yarnpkg.com/@babel/helper-function-name/-/helper-function-name-7.23.0.tgz#1f9a3cdbd5b2698a670c30d2735f9af95ed52759" - integrity sha512-OErEqsrxjZTJciZ4Oo+eoZqeW9UIiOcuYKRJA4ZAgV9myA+pOXhhmpfNCKjEH/auVfEYVFJ6y1Tc4r0eIApqiw== - dependencies: - "@babel/template" "^7.22.15" - "@babel/types" "^7.23.0" - -"@babel/helper-hoist-variables@^7.22.5": - version "7.22.5" - resolved "https://registry.yarnpkg.com/@babel/helper-hoist-variables/-/helper-hoist-variables-7.22.5.tgz#c01a007dac05c085914e8fb652b339db50d823bb" - integrity sha512-wGjk9QZVzvknA6yKIUURb8zY3grXCcOZt+/7Wcy8O2uctxhplmUPkOdlgoNhmdVee2c92JXbf1xpMtVNbfoxRw== - dependencies: - "@babel/types" "^7.22.5" - -"@babel/helper-split-export-declaration@^7.22.6": - version "7.22.6" - resolved "https://registry.yarnpkg.com/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.22.6.tgz#322c61b7310c0997fe4c323955667f18fcefb91c" - integrity sha512-AsUnxuLhRYsisFiaJwvp1QF+I3KjD5FOxut14q/GzovUe6orHLesW2C7d754kRm53h5gqrz6sFl6sxc4BVtE/g== - dependencies: - "@babel/types" "^7.22.5" - -"@babel/helper-string-parser@^7.22.5": - version "7.22.5" - resolved "https://registry.yarnpkg.com/@babel/helper-string-parser/-/helper-string-parser-7.22.5.tgz#533f36457a25814cf1df6488523ad547d784a99f" - integrity sha512-mM4COjgZox8U+JcXQwPijIZLElkgEpO5rsERVDJTc2qfCDfERyob6k5WegS14SX18IIjv+XD+GrqNumY5JRCDw== - -"@babel/helper-validator-identifier@^7.16.7", "@babel/helper-validator-identifier@^7.22.20": - version "7.22.20" - resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.22.20.tgz#c4ae002c61d2879e724581d96665583dbc1dc0e0" - integrity sha512-Y4OZ+ytlatR8AI+8KZfKuL5urKp7qey08ha31L8b3BwewJAoJamTzyvxPR/5D+KkdJCGPq/+8TukHBlY10FX9A== - -"@babel/highlight@^7.22.13": - version "7.22.20" - resolved "https://registry.yarnpkg.com/@babel/highlight/-/highlight-7.22.20.tgz#4ca92b71d80554b01427815e06f2df965b9c1f54" - integrity sha512-dkdMCN3py0+ksCgYmGG8jKeGA/8Tk+gJwSYYlFGxG5lmhfKNoAy004YpLxpS1W2J8m/EK2Ew+yOs9pVRwO89mg== - dependencies: - "@babel/helper-validator-identifier" "^7.22.20" - chalk "^2.4.2" - js-tokens "^4.0.0" - -"@babel/parser@^7.20.5", "@babel/parser@^7.22.15", "@babel/parser@^7.23.0": - version "7.23.3" - resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.23.3.tgz#0ce0be31a4ca4f1884b5786057cadcb6c3be58f9" - integrity sha512-uVsWNvlVsIninV2prNz/3lHCb+5CJ+e+IUBfbjToAHODtfGYLfCFuY4AU7TskI+dAKk+njsPiBjq1gKTvZOBaw== - -"@babel/runtime@^7.21.0": - version "7.23.2" - resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.23.2.tgz#062b0ac103261d68a966c4c7baf2ae3e62ec3885" - integrity sha512-mM8eg4yl5D6i3lu2QKPuPH4FArvJ8KhTofbE7jwMUv9KX5mBvwPAqnV3MlyBNqdp9RyRKP6Yck8TrfYrPvX3bg== - dependencies: - regenerator-runtime "^0.14.0" - -"@babel/template@^7.22.15": - version "7.22.15" - resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.22.15.tgz#09576efc3830f0430f4548ef971dde1350ef2f38" - integrity sha512-QPErUVm4uyJa60rkI73qneDacvdvzxshT3kksGqlGWYdOTIUOwJ7RDUL8sGqslY1uXWSL6xMFKEXDS3ox2uF0w== - dependencies: - "@babel/code-frame" "^7.22.13" - "@babel/parser" "^7.22.15" - "@babel/types" "^7.22.15" - -"@babel/traverse@7.23.2": - version "7.23.2" - resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.23.2.tgz#329c7a06735e144a506bdb2cad0268b7f46f4ad8" - integrity sha512-azpe59SQ48qG6nu2CzcMLbxUudtN+dOM9kDbUqGq3HXUJRlo7i8fvPoxQUzYgLZ4cMVmuZgm8vvBpNeRhd6XSw== - dependencies: - "@babel/code-frame" "^7.22.13" - "@babel/generator" "^7.23.0" - "@babel/helper-environment-visitor" "^7.22.20" - "@babel/helper-function-name" "^7.23.0" - "@babel/helper-hoist-variables" "^7.22.5" - "@babel/helper-split-export-declaration" "^7.22.6" - "@babel/parser" "^7.23.0" - "@babel/types" "^7.23.0" - debug "^4.1.0" - globals "^11.1.0" - -"@babel/types@7.17.0": - version "7.17.0" - resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.17.0.tgz#a826e368bccb6b3d84acd76acad5c0d87342390b" - integrity sha512-TmKSNO4D5rzhL5bjWFcVHHLETzfQ/AmbKpKPOSjlP0WoHZ6L911fgoOKY4Alp/emzG4cHJdyN49zpgkbXFEHHw== - dependencies: - "@babel/helper-validator-identifier" "^7.16.7" - to-fast-properties "^2.0.0" - -"@babel/types@^7.17.0", "@babel/types@^7.22.15", "@babel/types@^7.22.5", "@babel/types@^7.23.0", "@babel/types@^7.23.3": - version "7.23.3" - resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.23.3.tgz#d5ea892c07f2ec371ac704420f4dcdb07b5f9598" - integrity sha512-OZnvoH2l8PK5eUvEcUyCt/sXgr/h+UWpVuBbOljwcrAgUl6lpchoQ++PHGyQy1AtYnVA6CEq3y5xeEI10brpXw== - dependencies: - "@babel/helper-string-parser" "^7.22.5" - "@babel/helper-validator-identifier" "^7.22.20" - to-fast-properties "^2.0.0" - -"@esbuild/android-arm64@0.19.5": - version "0.19.5" - resolved "https://registry.yarnpkg.com/@esbuild/android-arm64/-/android-arm64-0.19.5.tgz#276c5f99604054d3dbb733577e09adae944baa90" - integrity sha512-5d1OkoJxnYQfmC+Zd8NBFjkhyCNYwM4n9ODrycTFY6Jk1IGiZ+tjVJDDSwDt77nK+tfpGP4T50iMtVi4dEGzhQ== - -"@esbuild/android-arm@0.19.5": - version "0.19.5" - resolved "https://registry.yarnpkg.com/@esbuild/android-arm/-/android-arm-0.19.5.tgz#4a3cbf14758166abaae8ba9c01a80e68342a4eec" - integrity sha512-bhvbzWFF3CwMs5tbjf3ObfGqbl/17ict2/uwOSfr3wmxDE6VdS2GqY/FuzIPe0q0bdhj65zQsvqfArI9MY6+AA== - -"@esbuild/android-x64@0.19.5": - version "0.19.5" - resolved "https://registry.yarnpkg.com/@esbuild/android-x64/-/android-x64-0.19.5.tgz#21a3d11cd4613d2d3c5ccb9e746c254eb9265b0a" - integrity sha512-9t+28jHGL7uBdkBjL90QFxe7DVA+KGqWlHCF8ChTKyaKO//VLuoBricQCgwhOjA1/qOczsw843Fy4cbs4H3DVA== - -"@esbuild/darwin-arm64@0.19.5": - version "0.19.5" - resolved "https://registry.yarnpkg.com/@esbuild/darwin-arm64/-/darwin-arm64-0.19.5.tgz#714cb839f467d6a67b151ee8255886498e2b9bf6" - integrity sha512-mvXGcKqqIqyKoxq26qEDPHJuBYUA5KizJncKOAf9eJQez+L9O+KfvNFu6nl7SCZ/gFb2QPaRqqmG0doSWlgkqw== - -"@esbuild/darwin-x64@0.19.5": - version "0.19.5" - resolved "https://registry.yarnpkg.com/@esbuild/darwin-x64/-/darwin-x64-0.19.5.tgz#2c553e97a6d2b4ae76a884e35e6cbab85a990bbf" - integrity sha512-Ly8cn6fGLNet19s0X4unjcniX24I0RqjPv+kurpXabZYSXGM4Pwpmf85WHJN3lAgB8GSth7s5A0r856S+4DyiA== - -"@esbuild/freebsd-arm64@0.19.5": - version "0.19.5" - resolved "https://registry.yarnpkg.com/@esbuild/freebsd-arm64/-/freebsd-arm64-0.19.5.tgz#d554f556718adb31917a0da24277bf84b6ee87f3" - integrity sha512-GGDNnPWTmWE+DMchq1W8Sd0mUkL+APvJg3b11klSGUDvRXh70JqLAO56tubmq1s2cgpVCSKYywEiKBfju8JztQ== - -"@esbuild/freebsd-x64@0.19.5": - version "0.19.5" - resolved "https://registry.yarnpkg.com/@esbuild/freebsd-x64/-/freebsd-x64-0.19.5.tgz#288f7358a3bb15d99e73c65c9adaa3dabb497432" - integrity sha512-1CCwDHnSSoA0HNwdfoNY0jLfJpd7ygaLAp5EHFos3VWJCRX9DMwWODf96s9TSse39Br7oOTLryRVmBoFwXbuuQ== - -"@esbuild/linux-arm64@0.19.5": - version "0.19.5" - resolved "https://registry.yarnpkg.com/@esbuild/linux-arm64/-/linux-arm64-0.19.5.tgz#95933ae86325c93cb6b5e8333d22120ecfdc901b" - integrity sha512-o3vYippBmSrjjQUCEEiTZ2l+4yC0pVJD/Dl57WfPwwlvFkrxoSO7rmBZFii6kQB3Wrn/6GwJUPLU5t52eq2meA== - -"@esbuild/linux-arm@0.19.5": - version "0.19.5" - resolved "https://registry.yarnpkg.com/@esbuild/linux-arm/-/linux-arm-0.19.5.tgz#0acef93aa3e0579e46d33b666627bddb06636664" - integrity sha512-lrWXLY/vJBzCPC51QN0HM71uWgIEpGSjSZZADQhq7DKhPcI6NH1IdzjfHkDQws2oNpJKpR13kv7/pFHBbDQDwQ== - -"@esbuild/linux-ia32@0.19.5": - version "0.19.5" - resolved "https://registry.yarnpkg.com/@esbuild/linux-ia32/-/linux-ia32-0.19.5.tgz#b6e5c9e80b42131cbd6b1ddaa48c92835f1ed67f" - integrity sha512-MkjHXS03AXAkNp1KKkhSKPOCYztRtK+KXDNkBa6P78F8Bw0ynknCSClO/ztGszILZtyO/lVKpa7MolbBZ6oJtQ== - -"@esbuild/linux-loong64@0.19.5": - version "0.19.5" - resolved "https://registry.yarnpkg.com/@esbuild/linux-loong64/-/linux-loong64-0.19.5.tgz#e5f0cf95a180158b01ff5f417da796a1c09dfbea" - integrity sha512-42GwZMm5oYOD/JHqHska3Jg0r+XFb/fdZRX+WjADm3nLWLcIsN27YKtqxzQmGNJgu0AyXg4HtcSK9HuOk3v1Dw== - -"@esbuild/linux-mips64el@0.19.5": - version "0.19.5" - resolved "https://registry.yarnpkg.com/@esbuild/linux-mips64el/-/linux-mips64el-0.19.5.tgz#ae36fb86c7d5f641f3a0c8472e83dcb6ea36a408" - integrity sha512-kcjndCSMitUuPJobWCnwQ9lLjiLZUR3QLQmlgaBfMX23UEa7ZOrtufnRds+6WZtIS9HdTXqND4yH8NLoVVIkcg== - -"@esbuild/linux-ppc64@0.19.5": - version "0.19.5" - resolved "https://registry.yarnpkg.com/@esbuild/linux-ppc64/-/linux-ppc64-0.19.5.tgz#7960cb1666f0340ddd9eef7b26dcea3835d472d0" - integrity sha512-yJAxJfHVm0ZbsiljbtFFP1BQKLc8kUF6+17tjQ78QjqjAQDnhULWiTA6u0FCDmYT1oOKS9PzZ2z0aBI+Mcyj7Q== - -"@esbuild/linux-riscv64@0.19.5": - version "0.19.5" - resolved "https://registry.yarnpkg.com/@esbuild/linux-riscv64/-/linux-riscv64-0.19.5.tgz#32207df26af60a3a9feea1783fc21b9817bade19" - integrity sha512-5u8cIR/t3gaD6ad3wNt1MNRstAZO+aNyBxu2We8X31bA8XUNyamTVQwLDA1SLoPCUehNCymhBhK3Qim1433Zag== - -"@esbuild/linux-s390x@0.19.5": - version "0.19.5" - resolved "https://registry.yarnpkg.com/@esbuild/linux-s390x/-/linux-s390x-0.19.5.tgz#b38d5681db89a3723862dfa792812397b1510a7d" - integrity sha512-Z6JrMyEw/EmZBD/OFEFpb+gao9xJ59ATsoTNlj39jVBbXqoZm4Xntu6wVmGPB/OATi1uk/DB+yeDPv2E8PqZGw== - -"@esbuild/linux-x64@0.19.5": - version "0.19.5" - resolved "https://registry.yarnpkg.com/@esbuild/linux-x64/-/linux-x64-0.19.5.tgz#46feba2ad041a241379d150f415b472fe3885075" - integrity sha512-psagl+2RlK1z8zWZOmVdImisMtrUxvwereIdyJTmtmHahJTKb64pAcqoPlx6CewPdvGvUKe2Jw+0Z/0qhSbG1A== - -"@esbuild/netbsd-x64@0.19.5": - version "0.19.5" - resolved "https://registry.yarnpkg.com/@esbuild/netbsd-x64/-/netbsd-x64-0.19.5.tgz#3b5c1fb068f26bfc681d31f682adf1bea4ef0702" - integrity sha512-kL2l+xScnAy/E/3119OggX8SrWyBEcqAh8aOY1gr4gPvw76la2GlD4Ymf832UCVbmuWeTf2adkZDK+h0Z/fB4g== - -"@esbuild/openbsd-x64@0.19.5": - version "0.19.5" - resolved "https://registry.yarnpkg.com/@esbuild/openbsd-x64/-/openbsd-x64-0.19.5.tgz#ca6830316ca68056c5c88a875f103ad3235e00db" - integrity sha512-sPOfhtzFufQfTBgRnE1DIJjzsXukKSvZxloZbkJDG383q0awVAq600pc1nfqBcl0ice/WN9p4qLc39WhBShRTA== - -"@esbuild/sunos-x64@0.19.5": - version "0.19.5" - resolved "https://registry.yarnpkg.com/@esbuild/sunos-x64/-/sunos-x64-0.19.5.tgz#9efc4eb9539a7be7d5a05ada52ee43cda0d8e2dd" - integrity sha512-dGZkBXaafuKLpDSjKcB0ax0FL36YXCvJNnztjKV+6CO82tTYVDSH2lifitJ29jxRMoUhgkg9a+VA/B03WK5lcg== - -"@esbuild/win32-arm64@0.19.5": - version "0.19.5" - resolved "https://registry.yarnpkg.com/@esbuild/win32-arm64/-/win32-arm64-0.19.5.tgz#29f8184afa7a02a956ebda4ed638099f4b8ff198" - integrity sha512-dWVjD9y03ilhdRQ6Xig1NWNgfLtf2o/STKTS+eZuF90fI2BhbwD6WlaiCGKptlqXlURVB5AUOxUj09LuwKGDTg== - -"@esbuild/win32-ia32@0.19.5": - version "0.19.5" - resolved "https://registry.yarnpkg.com/@esbuild/win32-ia32/-/win32-ia32-0.19.5.tgz#f3de07afb292ecad651ae4bb8727789de2d95b05" - integrity sha512-4liggWIA4oDgUxqpZwrDhmEfAH4d0iljanDOK7AnVU89T6CzHon/ony8C5LeOdfgx60x5cnQJFZwEydVlYx4iw== - -"@esbuild/win32-x64@0.19.5": - version "0.19.5" - resolved "https://registry.yarnpkg.com/@esbuild/win32-x64/-/win32-x64-0.19.5.tgz#faad84c41ba12e3a0acb52571df9bff37bee75f6" - integrity sha512-czTrygUsB/jlM8qEW5MD8bgYU2Xg14lo6kBDXW6HdxKjh8M5PzETGiSHaz9MtbXBYDloHNUAUW2tMiKW4KM9Mw== - -"@graphql-tools/merge@8.3.1": - version "8.3.1" - resolved "https://registry.yarnpkg.com/@graphql-tools/merge/-/merge-8.3.1.tgz#06121942ad28982a14635dbc87b5d488a041d722" - integrity sha512-BMm99mqdNZbEYeTPK3it9r9S6rsZsQKtlqJsSBknAclXq2pGEfOxjcIZi+kBSkHZKPKCRrYDd5vY0+rUmIHVLg== - dependencies: - "@graphql-tools/utils" "8.9.0" - tslib "^2.4.0" - -"@graphql-tools/merge@^8.4.1": - version "8.4.2" - resolved "https://registry.yarnpkg.com/@graphql-tools/merge/-/merge-8.4.2.tgz#95778bbe26b635e8d2f60ce9856b388f11fe8288" - integrity sha512-XbrHAaj8yDuINph+sAfuq3QCZ/tKblrTLOpirK0+CAgNlZUCHs0Fa+xtMUURgwCVThLle1AF7svJCxFizygLsw== - dependencies: - "@graphql-tools/utils" "^9.2.1" - tslib "^2.4.0" - -"@graphql-tools/merge@^9.0.0": - version "9.0.0" - resolved "https://registry.yarnpkg.com/@graphql-tools/merge/-/merge-9.0.0.tgz#b0a3636c82716454bff88e9bb40108b0471db281" - integrity sha512-J7/xqjkGTTwOJmaJQJ2C+VDBDOWJL3lKrHJN4yMaRLAJH3PosB7GiPRaSDZdErs0+F77sH2MKs2haMMkywzx7Q== - dependencies: - "@graphql-tools/utils" "^10.0.0" - tslib "^2.4.0" - -"@graphql-tools/mock@^8.1.2": - version "8.7.20" - resolved "https://registry.yarnpkg.com/@graphql-tools/mock/-/mock-8.7.20.tgz#c83ae0f1940d194a3982120c9c85f3ac6b4f7f20" - integrity sha512-ljcHSJWjC/ZyzpXd5cfNhPI7YljRVvabKHPzKjEs5ElxWu2cdlLGvyNYepApXDsM/OJG/2xuhGM+9GWu5gEAPQ== - dependencies: - "@graphql-tools/schema" "^9.0.18" - "@graphql-tools/utils" "^9.2.1" - fast-json-stable-stringify "^2.1.0" - tslib "^2.4.0" - -"@graphql-tools/schema@^10.0.0": - version "10.0.0" - resolved "https://registry.yarnpkg.com/@graphql-tools/schema/-/schema-10.0.0.tgz#7b5f6b6a59f51c927de8c9069bde4ebbfefc64b3" - integrity sha512-kf3qOXMFcMs2f/S8Y3A8fm/2w+GaHAkfr3Gnhh2LOug/JgpY/ywgFVxO3jOeSpSEdoYcDKLcXVjMigNbY4AdQg== - dependencies: - "@graphql-tools/merge" "^9.0.0" - "@graphql-tools/utils" "^10.0.0" - tslib "^2.4.0" - value-or-promise "^1.0.12" - -"@graphql-tools/schema@^8.0.0": - version "8.5.1" - resolved "https://registry.yarnpkg.com/@graphql-tools/schema/-/schema-8.5.1.tgz#c2f2ff1448380919a330312399c9471db2580b58" - integrity sha512-0Esilsh0P/qYcB5DKQpiKeQs/jevzIadNTaT0jeWklPMwNbT7yMX4EqZany7mbeRRlSRwMzNzL5olyFdffHBZg== - dependencies: - "@graphql-tools/merge" "8.3.1" - "@graphql-tools/utils" "8.9.0" - tslib "^2.4.0" - value-or-promise "1.0.11" - -"@graphql-tools/schema@^9.0.18": - version "9.0.19" - resolved "https://registry.yarnpkg.com/@graphql-tools/schema/-/schema-9.0.19.tgz#c4ad373b5e1b8a0cf365163435b7d236ebdd06e7" - integrity sha512-oBRPoNBtCkk0zbUsyP4GaIzCt8C0aCI4ycIRUL67KK5pOHljKLBBtGT+Jr6hkzA74C8Gco8bpZPe7aWFjiaK2w== - dependencies: - "@graphql-tools/merge" "^8.4.1" - "@graphql-tools/utils" "^9.2.1" - tslib "^2.4.0" - value-or-promise "^1.0.12" - -"@graphql-tools/utils@8.9.0": - version "8.9.0" - resolved "https://registry.yarnpkg.com/@graphql-tools/utils/-/utils-8.9.0.tgz#c6aa5f651c9c99e1aca55510af21b56ec296cdb7" - integrity sha512-pjJIWH0XOVnYGXCqej8g/u/tsfV4LvLlj0eATKQu5zwnxd/TiTHq7Cg313qUPTFFHZ3PP5wJ15chYVtLDwaymg== - dependencies: - tslib "^2.4.0" - -"@graphql-tools/utils@^10.0.0", "@graphql-tools/utils@^10.0.6": - version "10.0.8" - resolved "https://registry.yarnpkg.com/@graphql-tools/utils/-/utils-10.0.8.tgz#c7b84275ec83dc42ad9f3d4ffc424ff682075759" - integrity sha512-yjyA8ycSa1WRlJqyX/aLqXeE5DvF/H02+zXMUFnCzIDrj0UvLMUrxhmVFnMK0Q2n3bh4uuTeY3621m5za9ovXw== - dependencies: - "@graphql-typed-document-node/core" "^3.1.1" - cross-inspect "1.0.0" - dset "^3.1.2" - tslib "^2.4.0" - -"@graphql-tools/utils@^9.2.1": - version "9.2.1" - resolved "https://registry.yarnpkg.com/@graphql-tools/utils/-/utils-9.2.1.tgz#1b3df0ef166cfa3eae706e3518b17d5922721c57" - integrity sha512-WUw506Ql6xzmOORlriNrD6Ugx+HjVgYxt9KCXD9mHAak+eaXSwuGGPyE60hy9xaDEoXKBsG7SkG69ybitaVl6A== - dependencies: - "@graphql-typed-document-node/core" "^3.1.1" - tslib "^2.4.0" - -"@graphql-typed-document-node/core@^3.1.1": - version "3.2.0" - resolved "https://registry.yarnpkg.com/@graphql-typed-document-node/core/-/core-3.2.0.tgz#5f3d96ec6b2354ad6d8a28bf216a1d97b5426861" - integrity sha512-mB9oAsNCm9aM3/SOv4YtBMqZbYj10R7dkq8byBqxGY/ncFwhf2oQzMV+LCRlWoDSEBJ3COiR1yeDvMtsoOsuFQ== - -"@ioredis/commands@^1.1.1": - version "1.2.0" - resolved "https://registry.yarnpkg.com/@ioredis/commands/-/commands-1.2.0.tgz#6d61b3097470af1fdbbe622795b8921d42018e11" - integrity sha512-Sx1pU8EM64o2BrqNpEO1CNLtKQwyhuXuqyfH7oGKCk+1a33d2r5saW8zNwm3j6BTExtjrv2BxTgzzkMwts6vGg== - -"@josephg/resolvable@^1.0.0": - version "1.0.1" - resolved "https://registry.yarnpkg.com/@josephg/resolvable/-/resolvable-1.0.1.tgz#69bc4db754d79e1a2f17a650d3466e038d94a5eb" - integrity sha512-CtzORUwWTTOTqfVtHaKRJ0I1kNQd1bpn3sUh8I3nJDVY+5/M/Oe1DnEWzPQvqq/xPIIkzzzIP7mfCoAjFRvDhg== - -"@jridgewell/gen-mapping@^0.3.2": - version "0.3.3" - resolved "https://registry.yarnpkg.com/@jridgewell/gen-mapping/-/gen-mapping-0.3.3.tgz#7e02e6eb5df901aaedb08514203b096614024098" - integrity sha512-HLhSWOLRi875zjjMG/r+Nv0oCW8umGb0BgEhyX3dDX3egwZtB8PqLnjz3yedt8R5StBrzcg4aBpnh8UA9D1BoQ== - dependencies: - "@jridgewell/set-array" "^1.0.1" - "@jridgewell/sourcemap-codec" "^1.4.10" - "@jridgewell/trace-mapping" "^0.3.9" - -"@jridgewell/resolve-uri@^3.1.0": - version "3.1.1" - resolved "https://registry.yarnpkg.com/@jridgewell/resolve-uri/-/resolve-uri-3.1.1.tgz#c08679063f279615a3326583ba3a90d1d82cc721" - integrity sha512-dSYZh7HhCDtCKm4QakX0xFpsRDqjjtZf/kjI/v3T3Nwt5r8/qz/M19F9ySyOqU94SXBmeG9ttTul+YnR4LOxFA== - -"@jridgewell/set-array@^1.0.1": - version "1.1.2" - resolved "https://registry.yarnpkg.com/@jridgewell/set-array/-/set-array-1.1.2.tgz#7c6cf998d6d20b914c0a55a91ae928ff25965e72" - integrity sha512-xnkseuNADM0gt2bs+BvhO0p78Mk762YnZdsuzFV018NoG1Sj1SCQvpSqa7XUaTam5vAGasABV9qXASMKnFMwMw== - -"@jridgewell/sourcemap-codec@^1.4.10", "@jridgewell/sourcemap-codec@^1.4.14": - version "1.4.15" - resolved "https://registry.yarnpkg.com/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.15.tgz#d7c6e6755c78567a951e04ab52ef0fd26de59f32" - integrity sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg== - -"@jridgewell/trace-mapping@^0.3.17", "@jridgewell/trace-mapping@^0.3.9": - version "0.3.20" - resolved "https://registry.yarnpkg.com/@jridgewell/trace-mapping/-/trace-mapping-0.3.20.tgz#72e45707cf240fa6b081d0366f8265b0cd10197f" - integrity sha512-R8LcPeWZol2zR8mmH3JeKQ6QRCFb7XgUhV9ZlGhHLGyg4wpPiPZNQOOWhFZhxKw8u//yTbNGI42Bx/3paXEQ+Q== - dependencies: - "@jridgewell/resolve-uri" "^3.1.0" - "@jridgewell/sourcemap-codec" "^1.4.14" - -"@keyv/redis@~2.5.8": - version "2.5.8" - resolved "https://registry.yarnpkg.com/@keyv/redis/-/redis-2.5.8.tgz#6ba503b215f8ea66d194aa99457161e18ec046ec" - integrity sha512-WweuUZqZN2ETcseV6r1AEum1qG6eR5poNhkZ4CIpWBOjMasT2ArTKWyIPxxYllKUS2A8wKv1l8+AqH6Jpzk7Ug== - dependencies: - ioredis "^5.3.2" - -"@noble/curves@1.2.0", "@noble/curves@~1.2.0": - version "1.2.0" - resolved "https://registry.yarnpkg.com/@noble/curves/-/curves-1.2.0.tgz#92d7e12e4e49b23105a2555c6984d41733d65c35" - integrity sha512-oYclrNgRaM9SsBUBVbb8M6DTV7ZHRTKugureoYEncY5c65HOmRzvSiTE3y5CYaPYJA/GVkrhXEoF0M3Ya9PMnw== - dependencies: - "@noble/hashes" "1.3.2" - -"@noble/hashes@1.3.2", "@noble/hashes@~1.3.0", "@noble/hashes@~1.3.2": - version "1.3.2" - resolved "https://registry.yarnpkg.com/@noble/hashes/-/hashes-1.3.2.tgz#6f26dbc8fbc7205873ce3cee2f690eba0d421b39" - integrity sha512-MVC8EAQp7MvEcm30KWENFjgR+Mkmf+D189XJTkFIlwohU5hcBbn1ZkKq7KVTi2Hme3PMGF390DaL52beVrIihQ== - -"@protobufjs/aspromise@^1.1.1", "@protobufjs/aspromise@^1.1.2": - version "1.1.2" - resolved "https://registry.yarnpkg.com/@protobufjs/aspromise/-/aspromise-1.1.2.tgz#9b8b0cc663d669a7d8f6f5d0893a14d348f30fbf" - integrity sha512-j+gKExEuLmKwvz3OgROXtrJ2UG2x8Ch2YZUxahh+s1F2HZ+wAceUNLkvy6zKCPVRkU++ZWQrdxsUeQXmcg4uoQ== - -"@protobufjs/base64@^1.1.2": - version "1.1.2" - resolved "https://registry.yarnpkg.com/@protobufjs/base64/-/base64-1.1.2.tgz#4c85730e59b9a1f1f349047dbf24296034bb2735" - integrity sha512-AZkcAA5vnN/v4PDqKyMR5lx7hZttPDgClv83E//FMNhR2TMcLUhfRUBHCmSl0oi9zMgDDqRUJkSxO3wm85+XLg== - -"@protobufjs/codegen@^2.0.4": - version "2.0.4" - resolved "https://registry.yarnpkg.com/@protobufjs/codegen/-/codegen-2.0.4.tgz#7ef37f0d010fb028ad1ad59722e506d9262815cb" - integrity sha512-YyFaikqM5sH0ziFZCN3xDC7zeGaB/d0IUb9CATugHWbd1FRFwWwt4ld4OYMPWu5a3Xe01mGAULCdqhMlPl29Jg== - -"@protobufjs/eventemitter@^1.1.0": - version "1.1.0" - resolved "https://registry.yarnpkg.com/@protobufjs/eventemitter/-/eventemitter-1.1.0.tgz#355cbc98bafad5978f9ed095f397621f1d066b70" - integrity sha512-j9ednRT81vYJ9OfVuXG6ERSTdEL1xVsNgqpkxMsbIabzSo3goCjDIveeGv5d03om39ML71RdmrGNjG5SReBP/Q== - -"@protobufjs/fetch@^1.1.0": - version "1.1.0" - resolved "https://registry.yarnpkg.com/@protobufjs/fetch/-/fetch-1.1.0.tgz#ba99fb598614af65700c1619ff06d454b0d84c45" - integrity sha512-lljVXpqXebpsijW71PZaCYeIcE5on1w5DlQy5WH6GLbFryLUrBD4932W/E2BSpfRJWseIL4v/KPgBFxDOIdKpQ== - dependencies: - "@protobufjs/aspromise" "^1.1.1" - "@protobufjs/inquire" "^1.1.0" - -"@protobufjs/float@^1.0.2": - version "1.0.2" - resolved "https://registry.yarnpkg.com/@protobufjs/float/-/float-1.0.2.tgz#5e9e1abdcb73fc0a7cb8b291df78c8cbd97b87d1" - integrity sha512-Ddb+kVXlXst9d+R9PfTIxh1EdNkgoRe5tOX6t01f1lYWOvJnSPDBlG241QLzcyPdoNTsblLUdujGSE4RzrTZGQ== - -"@protobufjs/inquire@^1.1.0": - version "1.1.0" - resolved "https://registry.yarnpkg.com/@protobufjs/inquire/-/inquire-1.1.0.tgz#ff200e3e7cf2429e2dcafc1140828e8cc638f089" - integrity sha512-kdSefcPdruJiFMVSbn801t4vFK7KB/5gd2fYvrxhuJYg8ILrmn9SKSX2tZdV6V+ksulWqS7aXjBcRXl3wHoD9Q== - -"@protobufjs/path@^1.1.2": - version "1.1.2" - resolved "https://registry.yarnpkg.com/@protobufjs/path/-/path-1.1.2.tgz#6cc2b20c5c9ad6ad0dccfd21ca7673d8d7fbf68d" - integrity sha512-6JOcJ5Tm08dOHAbdR3GrvP+yUUfkjG5ePsHYczMFLq3ZmMkAD98cDgcT2iA1lJ9NVwFd4tH/iSSoe44YWkltEA== - -"@protobufjs/pool@^1.1.0": - version "1.1.0" - resolved "https://registry.yarnpkg.com/@protobufjs/pool/-/pool-1.1.0.tgz#09fd15f2d6d3abfa9b65bc366506d6ad7846ff54" - integrity sha512-0kELaGSIDBKvcgS4zkjz1PeddatrjYcmMWOlAuAPwAeccUrPHdUqo/J6LiymHHEiJT5NrF1UVwxY14f+fy4WQw== - -"@protobufjs/utf8@^1.1.0": - version "1.1.0" - resolved "https://registry.yarnpkg.com/@protobufjs/utf8/-/utf8-1.1.0.tgz#a777360b5b39a1a2e5106f8e858f2fd2d060c570" - integrity sha512-Vvn3zZrhQZkkBE8LSuW3em98c0FwgO4nxzv6OdSxPKJIEKY2bGbHn+mhGIPerzI4twdxaP8/0+06HBpwf345Lw== - -"@scure/base@~1.1.0", "@scure/base@~1.1.2": - version "1.1.3" - resolved "https://registry.yarnpkg.com/@scure/base/-/base-1.1.3.tgz#8584115565228290a6c6c4961973e0903bb3df2f" - integrity sha512-/+SgoRjLq7Xlf0CWuLHq2LUZeL/w65kfzAPG5NH9pcmBhs+nunQTn4gvdwgMTIXnt9b2C/1SeL2XiysZEyIC9Q== - -"@scure/bip32@1.3.2": - version "1.3.2" - resolved "https://registry.yarnpkg.com/@scure/bip32/-/bip32-1.3.2.tgz#90e78c027d5e30f0b22c1f8d50ff12f3fb7559f8" - integrity sha512-N1ZhksgwD3OBlwTv3R6KFEcPojl/W4ElJOeCZdi+vuI5QmTFwLq3OFf2zd2ROpKvxFdgZ6hUpb0dx9bVNEwYCA== - dependencies: - "@noble/curves" "~1.2.0" - "@noble/hashes" "~1.3.2" - "@scure/base" "~1.1.2" - -"@scure/bip39@1.2.1": - version "1.2.1" - resolved "https://registry.yarnpkg.com/@scure/bip39/-/bip39-1.2.1.tgz#5cee8978656b272a917b7871c981e0541ad6ac2a" - integrity sha512-Z3/Fsz1yr904dduJD0NpiyRHhRYHdcnyh73FZWiV+/qhWi83wNJ3NWolYqCEN+ZWsUz2TWwajJggcRE9r1zUYg== - dependencies: - "@noble/hashes" "~1.3.0" - "@scure/base" "~1.1.0" - -"@sqltools/formatter@^1.2.5": - version "1.2.5" - resolved "https://registry.yarnpkg.com/@sqltools/formatter/-/formatter-1.2.5.tgz#3abc203c79b8c3e90fd6c156a0c62d5403520e12" - integrity sha512-Uy0+khmZqUrUGm5dmMqVlnvufZRSK0FbYzVgp0UMstm+F5+W2/jnEEQyc9vo1ZR/E5ZI/B1WjjoTqBqwJL6Krw== - -"@subsquid/archive-registry@^3.3.0": - version "3.3.0" - resolved "https://registry.yarnpkg.com/@subsquid/archive-registry/-/archive-registry-3.3.0.tgz#eb60927f6524262bdef23a5e84d7d253901a8a12" - integrity sha512-moXnGNOSmKMHyuDvUiOHbpL7IePSo4XZOW9OnzESIND64eGxlKusIsCi8Nth1DgzbE/UTTFeNJvYKu0v7SOIqw== - dependencies: - "@subsquid/util-internal" "^1.0.0" - commander "^10.0.0" - easy-table "^1.2.0" - sync-fetch "^0.5.2" - -"@subsquid/evm-processor@^1.8.5": - version "1.8.5" - resolved "https://registry.yarnpkg.com/@subsquid/evm-processor/-/evm-processor-1.8.5.tgz#02e03309bddb23de70be7fc5a9b7ab7681d88ef7" - integrity sha512-f4wmmFcl/5UT+z1O6SIv6SGkDB1TKCujsOTB/Kml+jTY0ofKUemwg+J4v662QPmxm0uIsjxxiW2tYpPKqg//Jg== - dependencies: - "@subsquid/http-client" "^1.3.1" - "@subsquid/logger" "^1.3.1" - "@subsquid/rpc-client" "^4.4.2" - "@subsquid/util-internal" "^2.5.2" - "@subsquid/util-internal-archive-client" "^0.0.1" - "@subsquid/util-internal-hex" "^1.2.1" - "@subsquid/util-internal-processor-tools" "^3.1.0" - -"@subsquid/evm-typegen@^3.2.3": - version "3.2.3" - resolved "https://registry.yarnpkg.com/@subsquid/evm-typegen/-/evm-typegen-3.2.3.tgz#4c3ff27a9c4d1588551c877c264d68b57f20ea22" - integrity sha512-9F0ZqkPEashuZoP8Phi03AP5viBKCgSurXtQscn+t4RZhBBcvcuEFdel5uNnusiH4KaMm7zsN3ypHj2E3QQyVA== - dependencies: - "@subsquid/http-client" "^1.3.1" - "@subsquid/logger" "^1.3.1" - "@subsquid/util-internal" "^2.5.2" - "@subsquid/util-internal-code-printer" "^1.2.1" - "@subsquid/util-internal-commander" "^1.3.1" - commander "^11.0.0" - -"@subsquid/graphiql-console@^0.3.0": - version "0.3.0" - resolved "https://registry.yarnpkg.com/@subsquid/graphiql-console/-/graphiql-console-0.3.0.tgz#415d305f1b7df7f737c788a3311cfa3179b6dbd1" - integrity sha512-C89mus6IXnNi0xMQrZqUFBZwLj8tbuq9lye8Gq/lHmmERAUpi6UsWEyLdJLx2mneZzF3JtY8eNiiZ16jmjtvfw== - -"@subsquid/graphql-server@^4.3.1": - version "4.3.1" - resolved "https://registry.yarnpkg.com/@subsquid/graphql-server/-/graphql-server-4.3.1.tgz#90c980035e4df9f3e9c3a968145f3fef5ab974d0" - integrity sha512-EEZXaZf3TSK0JD+kcBgr+ENf2WOAjb7EREQP28+9NRWQhtn1s1w3XQNMjjurfyeb5Us/pRODAmfl8jOcXj3CAQ== - dependencies: - "@apollo/utils.keyvadapter" "~1.1.2" - "@apollo/utils.keyvaluecache" "~1.0.2" - "@graphql-tools/merge" "^9.0.0" - "@graphql-tools/schema" "^10.0.0" - "@graphql-tools/utils" "^10.0.6" - "@keyv/redis" "~2.5.8" - "@subsquid/logger" "^1.3.1" - "@subsquid/openreader" "^4.4.1" - "@subsquid/typeorm-config" "^3.3.1" - "@subsquid/util-internal" "^2.5.2" - "@subsquid/util-internal-commander" "^1.3.1" - "@subsquid/util-internal-http-server" "^1.2.1" - apollo-server-core "^3.12.1" - apollo-server-express "^3.12.1" - apollo-server-plugin-response-cache "~3.7.1" - commander "^11.0.0" - dotenv "^16.3.1" - express "^4.18.2" - graphql "^15.8.0" - graphql-ws "^5.14.1" - keyv "~4.5.3" - pg "^8.11.3" - ws "^8.14.2" - -"@subsquid/http-client@^1.3.1": - version "1.3.1" - resolved "https://registry.yarnpkg.com/@subsquid/http-client/-/http-client-1.3.1.tgz#d0eb84e43bc9a8bd4d119e7f68f350bfbf49e5d3" - integrity sha512-ZBuYNW9IOvigvpntZvM0tzAY5Llr44NYswOzGwJpCjOnWF7EotzeJRMwDH0Zv5hXSMFvX3UBACP+PxmwDvma5A== - dependencies: - "@subsquid/logger" "^1.3.1" - "@subsquid/util-internal" "^2.5.2" - node-fetch "^3.3.2" - -"@subsquid/logger@^1.3.1": - version "1.3.1" - resolved "https://registry.yarnpkg.com/@subsquid/logger/-/logger-1.3.1.tgz#2595f28ac20ea13446b3ea56cc328d7419dc458e" - integrity sha512-OBhelb0HbhqSygq/IxEm9PPX8thQSDiCPV45UlCqWOoQ9UpiROiQLL+2nwt+HAHQq+LlHTzQmGXV43eabrTfwQ== - dependencies: - "@subsquid/util-internal-hex" "^1.2.1" - "@subsquid/util-internal-json" "^1.2.1" - supports-color "^8.1.1" - -"@subsquid/openreader@^4.4.1": - version "4.4.1" - resolved "https://registry.yarnpkg.com/@subsquid/openreader/-/openreader-4.4.1.tgz#3d22abd5f92bf9b8874db8f505f9d280670259c6" - integrity sha512-Z2M+scuoJx1H3U+KttIEjrSvZ+5K3ioNdWatUS42k9xgOIEMJzDCJM8ZxhqgP/fMTrR9RPjeFqjy6NBS0kgwtg== - dependencies: - "@graphql-tools/merge" "^9.0.0" - "@subsquid/graphiql-console" "^0.3.0" - "@subsquid/logger" "^1.3.1" - "@subsquid/util-internal" "^2.5.2" - "@subsquid/util-internal-commander" "^1.3.1" - "@subsquid/util-internal-hex" "^1.2.1" - "@subsquid/util-internal-http-server" "^1.2.1" - "@subsquid/util-naming" "^1.2.1" - apollo-server-core "^3.12.1" - apollo-server-express "^3.12.1" - commander "^11.0.0" - deep-equal "^2.2.2" - express "^4.18.2" - graphql "^15.8.0" - graphql-parse-resolve-info "^4.13.0" - graphql-ws "^5.14.1" - pg "^8.11.3" - ws "^8.14.2" - -"@subsquid/rpc-client@^4.4.2": - version "4.4.2" - resolved "https://registry.yarnpkg.com/@subsquid/rpc-client/-/rpc-client-4.4.2.tgz#762003c2cbdbc5f116da485a9d45b16ff322ba4a" - integrity sha512-Zo/KuFNiwKblKCUDpXUNbeshxEpCX44CtBKbzr4f5zFNdwxuH7FjwFnZk4X5YZUVnbcTF6cmqhH5RwRkKBgPfQ== - dependencies: - "@subsquid/http-client" "^1.3.1" - "@subsquid/logger" "^1.3.1" - "@subsquid/util-internal" "^2.5.2" - "@subsquid/util-internal-binary-heap" "^1.0.0" - "@subsquid/util-internal-counters" "^1.3.1" - websocket "^1.0.34" - -"@subsquid/typeorm-codegen@^1.3.2": - version "1.3.2" - resolved "https://registry.yarnpkg.com/@subsquid/typeorm-codegen/-/typeorm-codegen-1.3.2.tgz#25b1a3f875cd28f120576f3af9ca2b5f2264a1bb" - integrity sha512-jSDrMjcCa1NiEQICFXHyYENEnjJxmFd2vmyiSXm+CTyqQRMJutqLcZFHx38CHwz15kyCxKK8whDYQglmLvx0cQ== - dependencies: - "@subsquid/openreader" "^4.4.1" - "@subsquid/util-internal" "^2.5.2" - "@subsquid/util-internal-code-printer" "^1.2.1" - "@subsquid/util-naming" "^1.2.1" - commander "^11.0.0" - -"@subsquid/typeorm-config@^3.3.1": - version "3.3.1" - resolved "https://registry.yarnpkg.com/@subsquid/typeorm-config/-/typeorm-config-3.3.1.tgz#537edaa50a264972904e361095dc3718d73f9ecc" - integrity sha512-d8n+GHAr05A1cQXBr+kbaU0WeSD7oQk+t7KwkGbC9hh80tkYiweKzQwS4+fJcJCbrpZe+B6mV8WY5eVR9ebZMw== - dependencies: - "@subsquid/util-naming" "^1.2.1" - -"@subsquid/typeorm-migration@^1.2.2": - version "1.2.2" - resolved "https://registry.yarnpkg.com/@subsquid/typeorm-migration/-/typeorm-migration-1.2.2.tgz#a8f38bea441bdaa39ff58018e604858cb5b1b47f" - integrity sha512-G22Eh7AuPHjLB7C30XNT+fVe2bGYmYI2EB/8Sf5kYfS0yCKvev2YWJNcvkyD6eswv8HgrekwEoj3BKjR5wH6yg== - dependencies: - "@subsquid/typeorm-config" "^3.3.1" - "@subsquid/util-internal" "^2.5.2" - "@subsquid/util-internal-code-printer" "^1.2.1" - commander "^11.0.0" - dotenv "^16.3.1" - -"@subsquid/typeorm-store@^1.2.4": - version "1.2.4" - resolved "https://registry.yarnpkg.com/@subsquid/typeorm-store/-/typeorm-store-1.2.4.tgz#4b033309e9ce7de33c658e416389c7d312aa8cbd" - integrity sha512-fcHp9cHEe1T1tVjV125CLbNjs/NIQKFW8bdK/stDn9prxuuwfiAGKvpztU52dKVuyQCUFL+8YTtFt2y1i7ZEBA== - dependencies: - "@subsquid/typeorm-config" "^3.3.1" - "@subsquid/util-internal" "^2.5.2" - -"@subsquid/util-internal-archive-client@^0.0.1": - version "0.0.1" - resolved "https://registry.yarnpkg.com/@subsquid/util-internal-archive-client/-/util-internal-archive-client-0.0.1.tgz#12bdc7facd417a602d2f36e10743bb2ddbc674d9" - integrity sha512-Sr+m1vxAArPIdsjyKVOpjU57JlVujBpI8NEeHqeA6twSb40wasOLAeq775WyYFynucltNRSgIiwXBIo0t02D6g== - dependencies: - "@subsquid/http-client" "^1.3.1" - "@subsquid/util-internal" "^2.5.2" - "@subsquid/util-internal-range" "^0.0.1" - -"@subsquid/util-internal-binary-heap@^1.0.0": - version "1.0.0" - resolved "https://registry.yarnpkg.com/@subsquid/util-internal-binary-heap/-/util-internal-binary-heap-1.0.0.tgz#1f86f7677c2f773697ddc6b79a09cb5c55e6e4b0" - integrity sha512-88auuc8yNFmCZugmJSTYzS7WM/nN2obKGQCgrl8Jty5rJUFbqazGSi8icqftKhv6MPtUMJ3PSTRLiTFXAUGnAA== - -"@subsquid/util-internal-code-printer@^1.2.1": - version "1.2.1" - resolved "https://registry.yarnpkg.com/@subsquid/util-internal-code-printer/-/util-internal-code-printer-1.2.1.tgz#80be2f306ff030b94cfbc5b44dc8ca1c9520c99a" - integrity sha512-9l0kCm50hQfRjzplIZs9kHooqxczG82fzAexlD6x1SjdLDU1NfYA0uGxgE6pweKydgd7LCb9ICc5gfDvbWtdaw== - -"@subsquid/util-internal-commander@^1.3.1": - version "1.3.1" - resolved "https://registry.yarnpkg.com/@subsquid/util-internal-commander/-/util-internal-commander-1.3.1.tgz#4220b558cf3afaa18bb1e4bb3df88cee3053b1ee" - integrity sha512-KeGsOghBU20tM1BzqryOf3MKvrDFSfPuhnl9LhhEC00ysp8rRPyejlw6jIJhO2NRJ+oaUi5jHRdf64/o21N7Lw== - -"@subsquid/util-internal-counters@^1.3.1": - version "1.3.1" - resolved "https://registry.yarnpkg.com/@subsquid/util-internal-counters/-/util-internal-counters-1.3.1.tgz#731811212e68e1e7bd740279b4697fb764e8f69e" - integrity sha512-bc22t8lEvoCBn31F+B763E81+ZDaL7ufpwr0VLXZzcA5wZ6NEqqRfs4bJtPeBNGEjyeLLrItXWxfjSkR7sGKAg== - -"@subsquid/util-internal-hex@^1.2.1": - version "1.2.1" - resolved "https://registry.yarnpkg.com/@subsquid/util-internal-hex/-/util-internal-hex-1.2.1.tgz#596d703d97c1cf0247f4b51bb67a1e560c1128e3" - integrity sha512-R7TYDsftjguapzWia97WGvcF4s65VKArzSga5i1i4aZSq9Z330kPYpgAUkqDGsJqD/Ki3PTE4cXhuKLRyMHPvg== - -"@subsquid/util-internal-http-server@^1.2.1": - version "1.2.1" - resolved "https://registry.yarnpkg.com/@subsquid/util-internal-http-server/-/util-internal-http-server-1.2.1.tgz#09b432e9f35281c91b43c0ee22d3e8b819555781" - integrity sha512-aQIodM3xWDu8wxllOONU5Fy6hmYYAZzS2PglC2FfdUi6HUxaZ8aCUkjFisG56tglhsoAh/TQSQX1YhCX00MCcg== - dependencies: - stoppable "^1.1.0" - -"@subsquid/util-internal-json@^1.2.1": - version "1.2.1" - resolved "https://registry.yarnpkg.com/@subsquid/util-internal-json/-/util-internal-json-1.2.1.tgz#a5f2918fbdcd863f7b8184f05ec3a1b4c2366910" - integrity sha512-Jtbhur/QaRk727fiZ/w8so0M0o4BIkfvnT6zBnC3s1mQ9fKve0Q6aj22gbimpX7Whj6tAGF0Bz8LFhbAethbkA== - dependencies: - "@subsquid/util-internal-hex" "^1.2.1" - -"@subsquid/util-internal-processor-tools@^3.1.0": - version "3.1.0" - resolved "https://registry.yarnpkg.com/@subsquid/util-internal-processor-tools/-/util-internal-processor-tools-3.1.0.tgz#ba0637ac0a76cfc69ac46d7dd004a21b3100dbff" - integrity sha512-uEa8Bw/xvSfiagbK8IFt1OEgR7hacfblPZXH5EV4cAIKoIVOonhnkJEPRWqI3ZaDHl+8Z9p909tlsEd46sXenw== - dependencies: - "@subsquid/logger" "^1.3.1" - "@subsquid/util-internal" "^2.5.2" - "@subsquid/util-internal-counters" "^1.3.1" - "@subsquid/util-internal-prometheus-server" "^1.2.1" - "@subsquid/util-internal-range" "^0.0.1" - prom-client "^14.2.0" - -"@subsquid/util-internal-prometheus-server@^1.2.1": - version "1.2.1" - resolved "https://registry.yarnpkg.com/@subsquid/util-internal-prometheus-server/-/util-internal-prometheus-server-1.2.1.tgz#52d22e98cb6944c1ed3b8c7e06f5e58d85dd12d1" - integrity sha512-GhbsEmv0xAkaBaxwZGRavMIO0h68V6LctZIvxsrrPr695bI1mrXKSYDvVvUwLXQ3aDPy9PIQiKdbSjNa60JW6Q== - dependencies: - "@subsquid/util-internal-http-server" "^1.2.1" - -"@subsquid/util-internal-range@^0.0.1": - version "0.0.1" - resolved "https://registry.yarnpkg.com/@subsquid/util-internal-range/-/util-internal-range-0.0.1.tgz#8bc964333e15928c36426ba9bc392ce2675f7e0c" - integrity sha512-9hqlPdTJeR9j9+1L3ymOPC0/qJ2IemGkrHmkTq+gwkjtGKmiXuXw4WLgt0Ps5aeupWKfP7UFy1hDE9DZQFseog== - dependencies: - "@subsquid/util-internal" "^2.5.2" - "@subsquid/util-internal-binary-heap" "^1.0.0" - -"@subsquid/util-internal@^1.0.0": - version "1.1.0" - resolved "https://registry.yarnpkg.com/@subsquid/util-internal/-/util-internal-1.1.0.tgz#b40c013c439d421fe4a64fe426ba017e418042b5" - integrity sha512-O6m666RDcWEw4vb3bmeNZKlAa1rGOHQvS0nhZFTBXnxZpqK/pU5N0jrQ7X/3is0pY2RKxFoxTurZjhv4QdxtqA== - -"@subsquid/util-internal@^2.5.2": - version "2.5.2" - resolved "https://registry.yarnpkg.com/@subsquid/util-internal/-/util-internal-2.5.2.tgz#990f06beccdf9fc59e1b750cd64f9b719305f23f" - integrity sha512-N7lfZdWEkM35jG5wdGYx25TJKGGLMOx9VInSeRhW9T/3BEmHAuSWI2mIIYnZ8w5L041V8HGo61ijWF6qsXvZjg== - -"@subsquid/util-naming@^1.2.1": - version "1.2.1" - resolved "https://registry.yarnpkg.com/@subsquid/util-naming/-/util-naming-1.2.1.tgz#2cca91f5986c6e591d5899d7ade3c01ef42a458b" - integrity sha512-l5rvAXG7TxMPeB5kFTTZWisgN0DNe1mVBHT2V2/nxUx4sOfYfneWIN/+02YqJI/GHX9FoOTB6ru7WLfQEMhvhg== - dependencies: - camelcase "^6.3.0" - inflected "^2.1.0" - -"@trivago/prettier-plugin-sort-imports@^4.2.0": - version "4.3.0" - resolved "https://registry.yarnpkg.com/@trivago/prettier-plugin-sort-imports/-/prettier-plugin-sort-imports-4.3.0.tgz#725f411646b3942193a37041c84e0b2116339789" - integrity sha512-r3n0onD3BTOVUNPhR4lhVK4/pABGpbA7bW3eumZnYdKaHkf1qEC+Mag6DPbGNuuh0eG8AaYj+YqmVHSiGslaTQ== - dependencies: - "@babel/generator" "7.17.7" - "@babel/parser" "^7.20.5" - "@babel/traverse" "7.23.2" - "@babel/types" "7.17.0" - javascript-natural-sort "0.7.1" - lodash "^4.17.21" - -"@types/accepts@^1.3.5": - version "1.3.7" - resolved "https://registry.yarnpkg.com/@types/accepts/-/accepts-1.3.7.tgz#3b98b1889d2b2386604c2bbbe62e4fb51e95b265" - integrity sha512-Pay9fq2lM2wXPWbteBsRAGiWH2hig4ZE2asK+mm7kUzlxRTfL961rj89I6zV/E3PcIkDqyuBEcMxFT7rccugeQ== - dependencies: - "@types/node" "*" - -"@types/body-parser@*": - version "1.19.5" - resolved "https://registry.yarnpkg.com/@types/body-parser/-/body-parser-1.19.5.tgz#04ce9a3b677dc8bd681a17da1ab9835dc9d3ede4" - integrity sha512-fB3Zu92ucau0iQ0JMCFQE7b/dv8Ot07NI3KaZIkIUNXq82k4eBAqUaneXfleGY9JWskeS9y+u0nXMyspcuQrCg== - dependencies: - "@types/connect" "*" - "@types/node" "*" - -"@types/body-parser@1.19.2": - version "1.19.2" - resolved "https://registry.yarnpkg.com/@types/body-parser/-/body-parser-1.19.2.tgz#aea2059e28b7658639081347ac4fab3de166e6f0" - integrity sha512-ALYone6pm6QmwZoAgeyNksccT9Q4AWZQ6PvfwR37GT6r6FWUPguq6sUmNGSMV2Wr761oQoBxwGGa6DR5o1DC9g== - dependencies: - "@types/connect" "*" - "@types/node" "*" - -"@types/connect@*": - version "3.4.38" - resolved "https://registry.yarnpkg.com/@types/connect/-/connect-3.4.38.tgz#5ba7f3bc4fbbdeaff8dded952e5ff2cc53f8d858" - integrity sha512-K6uROf1LD88uDQqJCktA4yzL1YYAK6NgfsI0v/mTgyPKWsX1CnJ0XPSDhViejru1GcRkLWb8RlzFYJRqGUbaug== - dependencies: - "@types/node" "*" - -"@types/cors@2.8.12": - version "2.8.12" - resolved "https://registry.yarnpkg.com/@types/cors/-/cors-2.8.12.tgz#6b2c510a7ad7039e98e7b8d3d6598f4359e5c080" - integrity sha512-vt+kDhq/M2ayberEtJcIN/hxXy1Pk+59g2FV/ZQceeaTyCtCucjL2Q7FXlFjtWn4n15KCr1NE2lNNFhp0lEThw== - -"@types/express-serve-static-core@4.17.31": - version "4.17.31" - resolved "https://registry.yarnpkg.com/@types/express-serve-static-core/-/express-serve-static-core-4.17.31.tgz#a1139efeab4e7323834bb0226e62ac019f474b2f" - integrity sha512-DxMhY+NAsTwMMFHBTtJFNp5qiHKJ7TeqOo23zVEM9alT1Ml27Q3xcTH0xwxn7Q0BbMcVEJOs/7aQtUWupUQN3Q== - dependencies: - "@types/node" "*" - "@types/qs" "*" - "@types/range-parser" "*" - -"@types/express-serve-static-core@^4.17.18": - version "4.17.41" - resolved "https://registry.yarnpkg.com/@types/express-serve-static-core/-/express-serve-static-core-4.17.41.tgz#5077defa630c2e8d28aa9ffc2c01c157c305bef6" - integrity sha512-OaJ7XLaelTgrvlZD8/aa0vvvxZdUmlCn6MtWeB7TkiKW70BQLc9XEPpDLPdbo52ZhXUCrznlWdCHWxJWtdyajA== - dependencies: - "@types/node" "*" - "@types/qs" "*" - "@types/range-parser" "*" - "@types/send" "*" - -"@types/express@4.17.14": - version "4.17.14" - resolved "https://registry.yarnpkg.com/@types/express/-/express-4.17.14.tgz#143ea0557249bc1b3b54f15db4c81c3d4eb3569c" - integrity sha512-TEbt+vaPFQ+xpxFLFssxUDXj5cWCxZJjIcB7Yg0k0GMHGtgtQgpvx/MUQUeAkNbA9AAGrwkAsoeItdTgS7FMyg== - dependencies: - "@types/body-parser" "*" - "@types/express-serve-static-core" "^4.17.18" - "@types/qs" "*" - "@types/serve-static" "*" - -"@types/glob@^7.1.3": - version "7.2.0" - resolved "https://registry.yarnpkg.com/@types/glob/-/glob-7.2.0.tgz#bc1b5bf3aa92f25bd5dd39f35c57361bdce5b2eb" - integrity sha512-ZUxbzKl0IfJILTS6t7ip5fQQM/J3TJYubDm3nMbgubNNYS62eXeUpoLUC8/7fJNiFYHTrGPQn7hspDUzIHX3UA== - dependencies: - "@types/minimatch" "*" - "@types/node" "*" - -"@types/http-errors@*": - version "2.0.4" - resolved "https://registry.yarnpkg.com/@types/http-errors/-/http-errors-2.0.4.tgz#7eb47726c391b7345a6ec35ad7f4de469cf5ba4f" - integrity sha512-D0CFMMtydbJAegzOyHjtiKPLlvnm3iTZyZRSZoLq2mRhDdmLfIWOCYPfQJ4cu2erKghU++QvjcUjp/5h7hESpA== - -"@types/js-yaml@^4.0.8": - version "4.0.9" - resolved "https://registry.yarnpkg.com/@types/js-yaml/-/js-yaml-4.0.9.tgz#cd82382c4f902fed9691a2ed79ec68c5898af4c2" - integrity sha512-k4MGaQl5TGo/iipqb2UDG2UwjXziSWkh0uysQelTlJpX1qGlpUZYm8PnO4DxG1qBomtJUdYJ6qR6xdIah10JLg== - -"@types/lodash@^4.14.200": - version "4.14.201" - resolved "https://registry.yarnpkg.com/@types/lodash/-/lodash-4.14.201.tgz#76f47cb63124e806824b6c18463daf3e1d480239" - integrity sha512-y9euML0cim1JrykNxADLfaG0FgD1g/yTHwUs/Jg9ZIU7WKj2/4IW9Lbb1WZbvck78W/lfGXFfe+u2EGfIJXdLQ== - -"@types/long@^4.0.0": - version "4.0.2" - resolved "https://registry.yarnpkg.com/@types/long/-/long-4.0.2.tgz#b74129719fc8d11c01868010082d483b7545591a" - integrity sha512-MqTGEo5bj5t157U6fA/BiDynNkn0YknVdh48CMPkTSpFTVmvao5UQmm7uEF6xBEo7qIMAlY/JSleYaE6VOdpaA== - -"@types/mime@*": - version "3.0.4" - resolved "https://registry.yarnpkg.com/@types/mime/-/mime-3.0.4.tgz#2198ac274de6017b44d941e00261d5bc6a0e0a45" - integrity sha512-iJt33IQnVRkqeqC7PzBHPTC6fDlRNRW8vjrgqtScAhrmMwe8c4Eo7+fUGTa+XdWrpEgpyKWMYmi2dIwMAYRzPw== - -"@types/mime@^1": - version "1.3.5" - resolved "https://registry.yarnpkg.com/@types/mime/-/mime-1.3.5.tgz#1ef302e01cf7d2b5a0fa526790c9123bf1d06690" - integrity sha512-/pyBZWSLD2n0dcHE3hq8s8ZvcETHtEuF+3E7XVt0Ig2nvsVQXdghHVcEkIWjy9A0wKfTn97a/PSDYohKIlnP/w== - -"@types/minimatch@*": - version "5.1.2" - resolved "https://registry.yarnpkg.com/@types/minimatch/-/minimatch-5.1.2.tgz#07508b45797cb81ec3f273011b054cd0755eddca" - integrity sha512-K0VQKziLUWkVKiRVrx4a40iPaxTUefQmjtkQofBkYRcoaaL/8rhwDWww9qWbrgicNOgnpIsMxyNIUM4+n6dUIA== - -"@types/node@*": - version "20.9.0" - resolved "https://registry.yarnpkg.com/@types/node/-/node-20.9.0.tgz#bfcdc230583aeb891cf51e73cfdaacdd8deae298" - integrity sha512-nekiGu2NDb1BcVofVcEKMIwzlx4NjHlcjhoxxKBNLtz15Y1z7MYf549DFvkHSId02Ax6kGwWntIBPC3l/JZcmw== - dependencies: - undici-types "~5.26.4" - -"@types/node@18.15.13": - version "18.15.13" - resolved "https://registry.yarnpkg.com/@types/node/-/node-18.15.13.tgz#f64277c341150c979e42b00e4ac289290c9df469" - integrity sha512-N+0kuo9KgrUQ1Sn/ifDXsvg0TTleP7rIy4zOBGECxAljqvqfqpTfzx0Q1NUedOixRMBfe2Whhb056a42cWs26Q== - -"@types/node@^10.1.0": - version "10.17.60" - resolved "https://registry.yarnpkg.com/@types/node/-/node-10.17.60.tgz#35f3d6213daed95da7f0f73e75bcc6980e90597b" - integrity sha512-F0KIgDJfy2nA3zMLmWGKxcH2ZVEtCZXHHdOQs2gSaQ27+lNeEfGxzkIw90aXswATX7AZ33tahPbzy6KAfUreVw== - -"@types/node@^14.14.31": - version "14.18.63" - resolved "https://registry.yarnpkg.com/@types/node/-/node-14.18.63.tgz#1788fa8da838dbb5f9ea994b834278205db6ca2b" - integrity sha512-fAtCfv4jJg+ExtXhvCkCqUKZ+4ok/JQk01qDKhL5BDDoS3AxKXhV5/MAVUZyQnSEd2GT92fkgZl0pz0Q0AzcIQ== - -"@types/node@^18.16.17": - version "18.18.9" - resolved "https://registry.yarnpkg.com/@types/node/-/node-18.18.9.tgz#5527ea1832db3bba8eb8023ce8497b7d3f299592" - integrity sha512-0f5klcuImLnG4Qreu9hPj/rEfFq6YRc5n2mAjSsH+ec/mJL+3voBH0+8T7o8RpFjH7ovc+TRsL/c7OYIQsPTfQ== - dependencies: - undici-types "~5.26.4" - -"@types/qs@*": - version "6.9.10" - resolved "https://registry.yarnpkg.com/@types/qs/-/qs-6.9.10.tgz#0af26845b5067e1c9a622658a51f60a3934d51e8" - integrity sha512-3Gnx08Ns1sEoCrWssEgTSJs/rsT2vhGP+Ja9cnnk9k4ALxinORlQneLXFeFKOTJMOeZUFD1s7w+w2AphTpvzZw== - -"@types/range-parser@*": - version "1.2.7" - resolved "https://registry.yarnpkg.com/@types/range-parser/-/range-parser-1.2.7.tgz#50ae4353eaaddc04044279812f52c8c65857dbcb" - integrity sha512-hKormJbkJqzQGhziax5PItDUTMAM9uE2XXQmM37dyd4hVM+5aVl7oVxMVUiVQn2oCQFN/LKCZdvSM0pFRqbSmQ== - -"@types/semver@^7.3.4": - version "7.5.5" - resolved "https://registry.yarnpkg.com/@types/semver/-/semver-7.5.5.tgz#deed5ab7019756c9c90ea86139106b0346223f35" - integrity sha512-+d+WYC1BxJ6yVOgUgzK8gWvp5qF8ssV5r4nsDcZWKRWcDQLQ619tvWAxJQYGgBrO1MnLJC7a5GtiYsAoQ47dJg== - -"@types/send@*": - version "0.17.4" - resolved "https://registry.yarnpkg.com/@types/send/-/send-0.17.4.tgz#6619cd24e7270793702e4e6a4b958a9010cfc57a" - integrity sha512-x2EM6TJOybec7c52BX0ZspPodMsQUd5L6PRwOunVyVUhXiBSKf3AezDL8Dgvgt5o0UfKNfuA0eMLr2wLT4AiBA== - dependencies: - "@types/mime" "^1" - "@types/node" "*" - -"@types/serve-static@*": - version "1.15.5" - resolved "https://registry.yarnpkg.com/@types/serve-static/-/serve-static-1.15.5.tgz#15e67500ec40789a1e8c9defc2d32a896f05b033" - integrity sha512-PDRk21MnK70hja/YF8AHfC7yIsiQHn1rcXx7ijCFBX/k+XQJhQT/gw3xekXKJvx+5SXaMMS8oqQy09Mzvz2TuQ== - dependencies: - "@types/http-errors" "*" - "@types/mime" "*" - "@types/node" "*" - -"@types/uuid@^9.0.2": - version "9.0.7" - resolved "https://registry.yarnpkg.com/@types/uuid/-/uuid-9.0.7.tgz#b14cebc75455eeeb160d5fe23c2fcc0c64f724d8" - integrity sha512-WUtIVRUZ9i5dYXefDEAI7sh9/O7jGvHg7Df/5O/gtH3Yabe5odI3UWopVR1qbPXQtvOxWu3mM4XxlYeZtMWF4g== - -abitype@0.9.8: - version "0.9.8" - resolved "https://registry.yarnpkg.com/abitype/-/abitype-0.9.8.tgz#1f120b6b717459deafd213dfbf3a3dd1bf10ae8c" - integrity sha512-puLifILdm+8sjyss4S+fsUN09obiT1g2YW6CtcQF+QDzxR0euzgEB29MZujC6zMk2a6SVmtttq1fc6+YFA7WYQ== - -accepts@^1.3.5, accepts@~1.3.8: - version "1.3.8" - resolved "https://registry.yarnpkg.com/accepts/-/accepts-1.3.8.tgz#0bf0be125b67014adcb0b0921e62db7bffe16b2e" - integrity sha512-PYAthTa2m2VKxuvSD3DPC/Gy+U+sOA1LAuT8mkmRuvw+NACSaeXEQ+NHcVF7rONl6qcaxV3Uuemwawk+7+SJLw== - dependencies: - mime-types "~2.1.34" - negotiator "0.6.3" - -aes-js@4.0.0-beta.5: - version "4.0.0-beta.5" - resolved "https://registry.yarnpkg.com/aes-js/-/aes-js-4.0.0-beta.5.tgz#8d2452c52adedebc3a3e28465d858c11ca315873" - integrity sha512-G965FqalsNyrPqgEGON7nIx1e/OVENSgiEIzyC63haUMuvNnwIgIjMs52hlTCKhkBny7A2ORNlfY9Zu+jmGk1Q== - -ansi-regex@^5.0.1: - version "5.0.1" - resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-5.0.1.tgz#082cb2c89c9fe8659a311a53bd6a4dc5301db304" - integrity sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ== - -ansi-styles@^3.2.1: - version "3.2.1" - resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-3.2.1.tgz#41fbb20243e50b12be0f04b8dedbf07520ce841d" - integrity sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA== - dependencies: - color-convert "^1.9.0" - -ansi-styles@^4.0.0, ansi-styles@^4.1.0: - version "4.3.0" - resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-4.3.0.tgz#edd803628ae71c04c85ae7a0906edad34b648937" - integrity sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg== - dependencies: - color-convert "^2.0.1" - -any-promise@^1.0.0: - version "1.3.0" - resolved "https://registry.yarnpkg.com/any-promise/-/any-promise-1.3.0.tgz#abc6afeedcea52e809cdc0376aed3ce39635d17f" - integrity sha512-7UvmKalWRt1wgjL1RrGxoSJW/0QZFIegpeGvZG9kjp8vrRu55XTHbwnqq2GpXm9uLbcuhxm3IqX9OB4MZR1b2A== - -apollo-datasource@^3.3.2: - version "3.3.2" - resolved "https://registry.yarnpkg.com/apollo-datasource/-/apollo-datasource-3.3.2.tgz#5711f8b38d4b7b53fb788cb4dbd4a6a526ea74c8" - integrity sha512-L5TiS8E2Hn/Yz7SSnWIVbZw0ZfEIXZCa5VUiVxD9P53JvSrf4aStvsFDlGWPvpIdCR+aly2CfoB79B9/JjKFqg== - dependencies: - "@apollo/utils.keyvaluecache" "^1.0.1" - apollo-server-env "^4.2.1" - -apollo-reporting-protobuf@^3.4.0: - version "3.4.0" - resolved "https://registry.yarnpkg.com/apollo-reporting-protobuf/-/apollo-reporting-protobuf-3.4.0.tgz#6edd31f09d4a3704d9e808d1db30eca2229ded26" - integrity sha512-h0u3EbC/9RpihWOmcSsvTW2O6RXVaD/mPEjfrPkxRPTEPWqncsgOoRJw+wih4OqfH3PvTJvoEIf4LwKrUaqWog== - dependencies: - "@apollo/protobufjs" "1.2.6" - -apollo-server-core@^3.12.1, apollo-server-core@^3.13.0: - version "3.13.0" - resolved "https://registry.yarnpkg.com/apollo-server-core/-/apollo-server-core-3.13.0.tgz#ad6601fbb34cc97eedca27a9fb0b5738d11cd27d" - integrity sha512-v/g6DR6KuHn9DYSdtQijz8dLOkP78I5JSVJzPkARhDbhpH74QNwrQ2PP2URAPPEDJ2EeZNQDX8PvbYkAKqg+kg== - dependencies: - "@apollo/utils.keyvaluecache" "^1.0.1" - "@apollo/utils.logger" "^1.0.0" - "@apollo/utils.usagereporting" "^1.0.0" - "@apollographql/apollo-tools" "^0.5.3" - "@apollographql/graphql-playground-html" "1.6.29" - "@graphql-tools/mock" "^8.1.2" - "@graphql-tools/schema" "^8.0.0" - "@josephg/resolvable" "^1.0.0" - apollo-datasource "^3.3.2" - apollo-reporting-protobuf "^3.4.0" - apollo-server-env "^4.2.1" - apollo-server-errors "^3.3.1" - apollo-server-plugin-base "^3.7.2" - apollo-server-types "^3.8.0" - async-retry "^1.2.1" - fast-json-stable-stringify "^2.1.0" - graphql-tag "^2.11.0" - loglevel "^1.6.8" - lru-cache "^6.0.0" - node-abort-controller "^3.0.1" - sha.js "^2.4.11" - uuid "^9.0.0" - whatwg-mimetype "^3.0.0" - -apollo-server-env@^4.2.1: - version "4.2.1" - resolved "https://registry.yarnpkg.com/apollo-server-env/-/apollo-server-env-4.2.1.tgz#ea5b1944accdbdba311f179e4dfaeca482c20185" - integrity sha512-vm/7c7ld+zFMxibzqZ7SSa5tBENc4B0uye9LTfjJwGoQFY5xsUPH5FpO5j0bMUDZ8YYNbrF9SNtzc5Cngcr90g== - dependencies: - node-fetch "^2.6.7" - -apollo-server-errors@^3.3.1: - version "3.3.1" - resolved "https://registry.yarnpkg.com/apollo-server-errors/-/apollo-server-errors-3.3.1.tgz#ba5c00cdaa33d4cbd09779f8cb6f47475d1cd655" - integrity sha512-xnZJ5QWs6FixHICXHxUfm+ZWqqxrNuPlQ+kj5m6RtEgIpekOPssH/SD9gf2B4HuWV0QozorrygwZnux8POvyPA== - -apollo-server-express@^3.12.1: - version "3.13.0" - resolved "https://registry.yarnpkg.com/apollo-server-express/-/apollo-server-express-3.13.0.tgz#0d8d9bbba3b8b8264912d215f63fd44e74d5f42a" - integrity sha512-iSxICNbDUyebOuM8EKb3xOrpIwOQgKxGbR2diSr4HP3IW8T3njKFOoMce50vr+moOCe1ev8BnLcw9SNbuUtf7g== - dependencies: - "@types/accepts" "^1.3.5" - "@types/body-parser" "1.19.2" - "@types/cors" "2.8.12" - "@types/express" "4.17.14" - "@types/express-serve-static-core" "4.17.31" - accepts "^1.3.5" - apollo-server-core "^3.13.0" - apollo-server-types "^3.8.0" - body-parser "^1.19.0" - cors "^2.8.5" - parseurl "^1.3.3" - -apollo-server-plugin-base@^3.6.3, apollo-server-plugin-base@^3.7.2: - version "3.7.2" - resolved "https://registry.yarnpkg.com/apollo-server-plugin-base/-/apollo-server-plugin-base-3.7.2.tgz#c19cd137bc4c993ba2490ba2b571b0f3ce60a0cd" - integrity sha512-wE8dwGDvBOGehSsPTRZ8P/33Jan6/PmL0y0aN/1Z5a5GcbFhDaaJCjK5cav6npbbGL2DPKK0r6MPXi3k3N45aw== - dependencies: - apollo-server-types "^3.8.0" - -apollo-server-plugin-response-cache@~3.7.1: - version "3.7.1" - resolved "https://registry.yarnpkg.com/apollo-server-plugin-response-cache/-/apollo-server-plugin-response-cache-3.7.1.tgz#ee48637ff487880d97fb7311838e6e9eea01233e" - integrity sha512-3FHwwySf1kQl8dGC+2E08LtDeFGUOeqckLchAD1REYx1vwMZbGhmEIwaNezjXwxkTM5Y7l38n0vQTka6YoQN7w== - dependencies: - "@apollo/utils.keyvaluecache" "^1.0.1" - apollo-server-plugin-base "^3.6.3" - apollo-server-types "^3.6.3" - -apollo-server-types@^3.6.3, apollo-server-types@^3.8.0: - version "3.8.0" - resolved "https://registry.yarnpkg.com/apollo-server-types/-/apollo-server-types-3.8.0.tgz#d976b6967878681f715fe2b9e4dad9ba86b1346f" - integrity sha512-ZI/8rTE4ww8BHktsVpb91Sdq7Cb71rdSkXELSwdSR0eXu600/sY+1UXhTWdiJvk+Eq5ljqoHLwLbY2+Clq2b9A== - dependencies: - "@apollo/utils.keyvaluecache" "^1.0.1" - "@apollo/utils.logger" "^1.0.0" - apollo-reporting-protobuf "^3.4.0" - apollo-server-env "^4.2.1" - -app-root-path@^3.1.0: - version "3.1.0" - resolved "https://registry.yarnpkg.com/app-root-path/-/app-root-path-3.1.0.tgz#5971a2fc12ba170369a7a1ef018c71e6e47c2e86" - integrity sha512-biN3PwB2gUtjaYy/isrU3aNWI5w+fAfvHkSvCKeQGxhmYpwKFUxudR3Yya+KqVRHBmEDYh+/lTozYCFbmzX4nA== - -argparse@^2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/argparse/-/argparse-2.0.1.tgz#246f50f3ca78a3240f6c997e8a9bd1eac49e4b38" - integrity sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q== - -array-buffer-byte-length@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/array-buffer-byte-length/-/array-buffer-byte-length-1.0.0.tgz#fabe8bc193fea865f317fe7807085ee0dee5aead" - integrity sha512-LPuwb2P+NrQw3XhxGc36+XSvuBPopovXYTR9Ew++Du9Yb/bx5AzBfrIsBoj0EZUifjQU+sHL21sseZ3jerWO/A== - dependencies: - call-bind "^1.0.2" - is-array-buffer "^3.0.1" - -array-flatten@1.1.1: - version "1.1.1" - resolved "https://registry.yarnpkg.com/array-flatten/-/array-flatten-1.1.1.tgz#9a5f699051b1e7073328f2a008968b64ea2955d2" - integrity sha512-PCVAQswWemu6UdxsDFFX/+gVeYqKAod3D3UVm91jHwynguOwAvYPhx8nNlM++NqRcK6CxxpUafjmhIdKiHibqg== - -async-retry@^1.2.1: - version "1.3.3" - resolved "https://registry.yarnpkg.com/async-retry/-/async-retry-1.3.3.tgz#0e7f36c04d8478e7a58bdbed80cedf977785f280" - integrity sha512-wfr/jstw9xNi/0teMHrRW7dsz3Lt5ARhYNZ2ewpadnhaIp5mbALhOAP+EAdsC7t4Z6wqsDVv9+W6gm1Dk9mEyw== - dependencies: - retry "0.13.1" - -available-typed-arrays@^1.0.5: - version "1.0.5" - resolved "https://registry.yarnpkg.com/available-typed-arrays/-/available-typed-arrays-1.0.5.tgz#92f95616501069d07d10edb2fc37d3e1c65123b7" - integrity sha512-DMD0KiN46eipeziST1LPP/STfDU0sufISXmjSgvVsoU2tqxctQeASejWcfNtxYKqETM1UxQ8sp2OrSBWpHY6sw== - -balanced-match@^1.0.0: - version "1.0.2" - resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.2.tgz#e83e3a7e3f300b34cb9d87f615fa0cbf357690ee" - integrity sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw== - -base64-js@^1.3.1: - version "1.5.1" - resolved "https://registry.yarnpkg.com/base64-js/-/base64-js-1.5.1.tgz#1b1b440160a5bf7ad40b650f095963481903930a" - integrity sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA== - -bintrees@1.0.2: - version "1.0.2" - resolved "https://registry.yarnpkg.com/bintrees/-/bintrees-1.0.2.tgz#49f896d6e858a4a499df85c38fb399b9aff840f8" - integrity sha512-VOMgTMwjAaUG580SXn3LacVgjurrbMme7ZZNYGSSV7mmtY6QQRh0Eg3pwIcntQ77DErK1L0NxkbetjcoXzVwKw== - -body-parser@1.20.1: - version "1.20.1" - resolved "https://registry.yarnpkg.com/body-parser/-/body-parser-1.20.1.tgz#b1812a8912c195cd371a3ee5e66faa2338a5c668" - integrity sha512-jWi7abTbYwajOytWCQc37VulmWiRae5RyTpaCyDcS5/lMdtwSz5lOpDE67srw/HYe35f1z3fDQw+3txg7gNtWw== - dependencies: - bytes "3.1.2" - content-type "~1.0.4" - debug "2.6.9" - depd "2.0.0" - destroy "1.2.0" - http-errors "2.0.0" - iconv-lite "0.4.24" - on-finished "2.4.1" - qs "6.11.0" - raw-body "2.5.1" - type-is "~1.6.18" - unpipe "1.0.0" - -body-parser@^1.19.0: - version "1.20.2" - resolved "https://registry.yarnpkg.com/body-parser/-/body-parser-1.20.2.tgz#6feb0e21c4724d06de7ff38da36dad4f57a747fd" - integrity sha512-ml9pReCu3M61kGlqoTm2umSXTlRTuGTx0bfYj+uIUKKYycG5NtSbeetV3faSU6R7ajOPw0g/J1PvK4qNy7s5bA== - dependencies: - bytes "3.1.2" - content-type "~1.0.5" - debug "2.6.9" - depd "2.0.0" - destroy "1.2.0" - http-errors "2.0.0" - iconv-lite "0.4.24" - on-finished "2.4.1" - qs "6.11.0" - raw-body "2.5.2" - type-is "~1.6.18" - unpipe "1.0.0" - -brace-expansion@^1.1.7: - version "1.1.11" - resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.11.tgz#3c7fcbf529d87226f3d2f52b966ff5271eb441dd" - integrity sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA== - dependencies: - balanced-match "^1.0.0" - concat-map "0.0.1" - -brace-expansion@^2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-2.0.1.tgz#1edc459e0f0c548486ecf9fc99f2221364b9a0ae" - integrity sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA== - dependencies: - balanced-match "^1.0.0" - -buffer-writer@2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/buffer-writer/-/buffer-writer-2.0.0.tgz#ce7eb81a38f7829db09c873f2fbb792c0c98ec04" - integrity sha512-a7ZpuTZU1TRtnwyCNW3I5dc0wWNC3VR9S++Ewyk2HHZdrO3CQJqSpd+95Us590V6AL7JqUAH2IwZ/398PmNFgw== - -buffer@^6.0.3: - version "6.0.3" - resolved "https://registry.yarnpkg.com/buffer/-/buffer-6.0.3.tgz#2ace578459cc8fbe2a70aaa8f52ee63b6a74c6c6" - integrity sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA== - dependencies: - base64-js "^1.3.1" - ieee754 "^1.2.1" - -bufferutil@^4.0.1: - version "4.0.8" - resolved "https://registry.yarnpkg.com/bufferutil/-/bufferutil-4.0.8.tgz#1de6a71092d65d7766c4d8a522b261a6e787e8ea" - integrity sha512-4T53u4PdgsXqKaIctwF8ifXlRTTmEPJ8iEPWFdGZvcf7sbwYo6FKFEX9eNNAnzFZ7EzJAQ3CJeOtCRA4rDp7Pw== - dependencies: - node-gyp-build "^4.3.0" - -bytes@3.1.2: - version "3.1.2" - resolved "https://registry.yarnpkg.com/bytes/-/bytes-3.1.2.tgz#8b0beeb98605adf1b128fa4386403c009e0221a5" - integrity sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg== - -call-bind@^1.0.0, call-bind@^1.0.2, call-bind@^1.0.4, call-bind@^1.0.5: - version "1.0.5" - resolved "https://registry.yarnpkg.com/call-bind/-/call-bind-1.0.5.tgz#6fa2b7845ce0ea49bf4d8b9ef64727a2c2e2e513" - integrity sha512-C3nQxfFZxFRVoJoGKKI8y3MOEo129NQ+FgQ08iye+Mk4zNZZGdjfs06bVTr+DBSlA66Q2VEcMki/cUCP4SercQ== - dependencies: - function-bind "^1.1.2" - get-intrinsic "^1.2.1" - set-function-length "^1.1.1" - -camelcase@^6.3.0: - version "6.3.0" - resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-6.3.0.tgz#5685b95eb209ac9c0c177467778c9c84df58ba9a" - integrity sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA== - -chalk@^2.4.2: - version "2.4.2" - resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.4.2.tgz#cd42541677a54333cf541a49108c1432b44c9424" - integrity sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ== - dependencies: - ansi-styles "^3.2.1" - escape-string-regexp "^1.0.5" - supports-color "^5.3.0" - -chalk@^4.0.0, chalk@^4.1.2: - version "4.1.2" - resolved "https://registry.yarnpkg.com/chalk/-/chalk-4.1.2.tgz#aac4e2b7734a740867aeb16bf02aad556a1e7a01" - integrity sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA== - dependencies: - ansi-styles "^4.1.0" - supports-color "^7.1.0" - -cli-highlight@^2.1.11: - version "2.1.11" - resolved "https://registry.yarnpkg.com/cli-highlight/-/cli-highlight-2.1.11.tgz#49736fa452f0aaf4fae580e30acb26828d2dc1bf" - integrity sha512-9KDcoEVwyUXrjcJNvHD0NFc/hiwe/WPVYIleQh2O1N2Zro5gWJZ/K+3DGn8w8P/F6FxOgzyC5bxDyHIgCSPhGg== - dependencies: - chalk "^4.0.0" - highlight.js "^10.7.1" - mz "^2.4.0" - parse5 "^5.1.1" - parse5-htmlparser2-tree-adapter "^6.0.0" - yargs "^16.0.0" - -cliui@^7.0.2: - version "7.0.4" - resolved "https://registry.yarnpkg.com/cliui/-/cliui-7.0.4.tgz#a0265ee655476fc807aea9df3df8df7783808b4f" - integrity sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ== - dependencies: - string-width "^4.2.0" - strip-ansi "^6.0.0" - wrap-ansi "^7.0.0" - -cliui@^8.0.1: - version "8.0.1" - resolved "https://registry.yarnpkg.com/cliui/-/cliui-8.0.1.tgz#0c04b075db02cbfe60dc8e6cf2f5486b1a3608aa" - integrity sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ== - dependencies: - string-width "^4.2.0" - strip-ansi "^6.0.1" - wrap-ansi "^7.0.0" - -clone@^1.0.2: - version "1.0.4" - resolved "https://registry.yarnpkg.com/clone/-/clone-1.0.4.tgz#da309cc263df15994c688ca902179ca3c7cd7c7e" - integrity sha512-JQHZ2QMW6l3aH/j6xCqQThY/9OH4D/9ls34cgkUBiEeocRTU04tHfKPBsUK1PqZCUQM7GiA0IIXJSuXHI64Kbg== - -cluster-key-slot@^1.1.0: - version "1.1.2" - resolved "https://registry.yarnpkg.com/cluster-key-slot/-/cluster-key-slot-1.1.2.tgz#88ddaa46906e303b5de30d3153b7d9fe0a0c19ac" - integrity sha512-RMr0FhtfXemyinomL4hrWcYJxmX6deFdCxpJzhDttxgO1+bcCnkk+9drydLVDmAMG7NE6aN/fl4F7ucU/90gAA== - -color-convert@^1.9.0: - version "1.9.3" - resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-1.9.3.tgz#bb71850690e1f136567de629d2d5471deda4c1e8" - integrity sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg== - dependencies: - color-name "1.1.3" - -color-convert@^2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-2.0.1.tgz#72d3a68d598c9bdb3af2ad1e84f21d896abd4de3" - integrity sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ== - dependencies: - color-name "~1.1.4" - -color-name@1.1.3: - version "1.1.3" - resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.3.tgz#a7d0558bd89c42f795dd42328f740831ca53bc25" - integrity sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw== - -color-name@~1.1.4: - version "1.1.4" - resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.4.tgz#c2a09a87acbde69543de6f63fa3995c826c536a2" - integrity sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA== - -commander@^10.0.0: - version "10.0.1" - resolved "https://registry.yarnpkg.com/commander/-/commander-10.0.1.tgz#881ee46b4f77d1c1dccc5823433aa39b022cbe06" - integrity sha512-y4Mg2tXshplEbSGzx7amzPwKKOCGuoSRP/CjEdwwk0FOGlUbq6lKuoyDZTNZkmxHdJtp54hdfY/JUrdL7Xfdug== - -commander@^11.0.0: - version "11.1.0" - resolved "https://registry.yarnpkg.com/commander/-/commander-11.1.0.tgz#62fdce76006a68e5c1ab3314dc92e800eb83d906" - integrity sha512-yPVavfyCcRhmorC7rWlkHn15b4wDVgVmBA7kV4QVBsF7kv/9TKJAbAXVTxvTnwP8HHKjRCJDClKbciiYS7p0DQ== - -commander@^2.20.3: - version "2.20.3" - resolved "https://registry.yarnpkg.com/commander/-/commander-2.20.3.tgz#fd485e84c03eb4881c20722ba48035e8531aeb33" - integrity sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ== - -concat-map@0.0.1: - version "0.0.1" - resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b" - integrity sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg== - -content-disposition@0.5.4: - version "0.5.4" - resolved "https://registry.yarnpkg.com/content-disposition/-/content-disposition-0.5.4.tgz#8b82b4efac82512a02bb0b1dcec9d2c5e8eb5bfe" - integrity sha512-FveZTNuGw04cxlAiWbzi6zTAL/lhehaWbTtgluJh4/E95DqMwTmha3KZN1aAWA8cFIhHzMZUvLevkw5Rqk+tSQ== - dependencies: - safe-buffer "5.2.1" - -content-type@~1.0.4, content-type@~1.0.5: - version "1.0.5" - resolved "https://registry.yarnpkg.com/content-type/-/content-type-1.0.5.tgz#8b773162656d1d1086784c8f23a54ce6d73d7918" - integrity sha512-nTjqfcBFEipKdXCv4YDQWCfmcLZKm81ldF0pAopTvyrFGVbcR6P/VAAd5G7N+0tTr8QqiU0tFadD6FK4NtJwOA== - -cookie-signature@1.0.6: - version "1.0.6" - resolved "https://registry.yarnpkg.com/cookie-signature/-/cookie-signature-1.0.6.tgz#e303a882b342cc3ee8ca513a79999734dab3ae2c" - integrity sha512-QADzlaHc8icV8I7vbaJXJwod9HWYp8uCqf1xa4OfNu1T7JVxQIrUgOWtHdNDtPiywmFbiS12VjotIXLrKM3orQ== - -cookie@0.5.0: - version "0.5.0" - resolved "https://registry.yarnpkg.com/cookie/-/cookie-0.5.0.tgz#d1f5d71adec6558c58f389987c366aa47e994f8b" - integrity sha512-YZ3GUyn/o8gfKJlnlX7g7xq4gyO6OSuhGPKaaGssGB2qgDUS0gPgtTvoyZLTt9Ab6dC4hfc9dV5arkvc/OCmrw== - -cors@^2.8.5: - version "2.8.5" - resolved "https://registry.yarnpkg.com/cors/-/cors-2.8.5.tgz#eac11da51592dd86b9f06f6e7ac293b3df875d29" - integrity sha512-KIHbLJqu73RGr/hnbrO9uBeixNGuvSQjul/jdFvS/KFSIH1hWVd1ng7zOHx+YrEfInLG7q4n6GHQ9cDtxv/P6g== - dependencies: - object-assign "^4" - vary "^1" - -cross-inspect@1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/cross-inspect/-/cross-inspect-1.0.0.tgz#5fda1af759a148594d2d58394a9e21364f6849af" - integrity sha512-4PFfn4b5ZN6FMNGSZlyb7wUhuN8wvj8t/VQHZdM4JsDcruGJ8L2kf9zao98QIrBPFCpdk27qst/AGTl7pL3ypQ== - dependencies: - tslib "^2.4.0" - -cssfilter@0.0.10: - version "0.0.10" - resolved "https://registry.yarnpkg.com/cssfilter/-/cssfilter-0.0.10.tgz#c6d2672632a2e5c83e013e6864a42ce8defd20ae" - integrity sha512-FAaLDaplstoRsDR8XGYH51znUN0UY7nMc6Z9/fvE8EXGwvJE9hu7W2vHwx1+bd6gCYnln9nLbzxFTrcO9YQDZw== - -d@1, d@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/d/-/d-1.0.1.tgz#8698095372d58dbee346ffd0c7093f99f8f9eb5a" - integrity sha512-m62ShEObQ39CfralilEQRjH6oAMtNCV1xJyEx5LpRYUVN+EviphDgUc/F3hnYbADmkiNs67Y+3ylmlG7Lnu+FA== - dependencies: - es5-ext "^0.10.50" - type "^1.0.1" - -data-uri-to-buffer@^4.0.0: - version "4.0.1" - resolved "https://registry.yarnpkg.com/data-uri-to-buffer/-/data-uri-to-buffer-4.0.1.tgz#d8feb2b2881e6a4f58c2e08acfd0e2834e26222e" - integrity sha512-0R9ikRb668HB7QDxT1vkpuUBtqc53YyAwMwGeUFKRojY/NWKvdZ+9UYtRfGmhqNbRkTSVpMbmyhXipFFv2cb/A== - -dataloader@^2.1.0: - version "2.2.2" - resolved "https://registry.yarnpkg.com/dataloader/-/dataloader-2.2.2.tgz#216dc509b5abe39d43a9b9d97e6e5e473dfbe3e0" - integrity sha512-8YnDaaf7N3k/q5HnTJVuzSyLETjoZjVmHc4AeKAzOvKHEFQKcn64OKBfzHYtE9zGjctNM7V9I0MfnUVLpi7M5g== - -date-fns@^2.29.3: - version "2.30.0" - resolved "https://registry.yarnpkg.com/date-fns/-/date-fns-2.30.0.tgz#f367e644839ff57894ec6ac480de40cae4b0f4d0" - integrity sha512-fnULvOpxnC5/Vg3NCiWelDsLiUc9bRwAPs/+LfTLNvetFCtCTN+yQz15C/fs4AwX1R9K5GLtLfn8QW+dWisaAw== - dependencies: - "@babel/runtime" "^7.21.0" - -dayjs@^1.11.10: - version "1.11.10" - resolved "https://registry.yarnpkg.com/dayjs/-/dayjs-1.11.10.tgz#68acea85317a6e164457d6d6947564029a6a16a0" - integrity sha512-vjAczensTgRcqDERK0SR2XMwsF/tSvnvlv6VcF2GIhg6Sx4yOIt/irsr1RDJsKiIyBzJDpCoXiWWq28MqH2cnQ== - -debug@2.6.9, debug@^2.2.0: - version "2.6.9" - resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.9.tgz#5d128515df134ff327e90a4c93f4e077a536341f" - integrity sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA== - dependencies: - ms "2.0.0" - -debug@^4.1.0, debug@^4.1.1, debug@^4.3.4: - version "4.3.4" - resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.4.tgz#1319f6579357f2338d3337d2cdd4914bb5dcc865" - integrity sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ== - dependencies: - ms "2.1.2" - -deep-equal@^2.2.2: - version "2.2.3" - resolved "https://registry.yarnpkg.com/deep-equal/-/deep-equal-2.2.3.tgz#af89dafb23a396c7da3e862abc0be27cf51d56e1" - integrity sha512-ZIwpnevOurS8bpT4192sqAowWM76JDKSHYzMLty3BZGSswgq6pBaH3DhCSW5xVAZICZyKdOBPjwww5wfgT/6PA== - dependencies: - array-buffer-byte-length "^1.0.0" - call-bind "^1.0.5" - es-get-iterator "^1.1.3" - get-intrinsic "^1.2.2" - is-arguments "^1.1.1" - is-array-buffer "^3.0.2" - is-date-object "^1.0.5" - is-regex "^1.1.4" - is-shared-array-buffer "^1.0.2" - isarray "^2.0.5" - object-is "^1.1.5" - object-keys "^1.1.1" - object.assign "^4.1.4" - regexp.prototype.flags "^1.5.1" - side-channel "^1.0.4" - which-boxed-primitive "^1.0.2" - which-collection "^1.0.1" - which-typed-array "^1.1.13" - -defaults@^1.0.3: - version "1.0.4" - resolved "https://registry.yarnpkg.com/defaults/-/defaults-1.0.4.tgz#b0b02062c1e2aa62ff5d9528f0f98baa90978d7a" - integrity sha512-eFuaLoy/Rxalv2kr+lqMlUnrDWV+3j4pljOIJgLIhI058IQfWJ7vXhyEIHu+HtC738klGALYxOKDO0bQP3tg8A== - dependencies: - clone "^1.0.2" - -define-data-property@^1.0.1, define-data-property@^1.1.1: - version "1.1.1" - resolved "https://registry.yarnpkg.com/define-data-property/-/define-data-property-1.1.1.tgz#c35f7cd0ab09883480d12ac5cb213715587800b3" - integrity sha512-E7uGkTzkk1d0ByLeSc6ZsFS79Axg+m1P/VsgYsxHgiuc3tFSj+MjMIwe90FC4lOAZzNBdY7kkO2P2wKdsQ1vgQ== - dependencies: - get-intrinsic "^1.2.1" - gopd "^1.0.1" - has-property-descriptors "^1.0.0" - -define-properties@^1.1.3, define-properties@^1.1.4, define-properties@^1.2.0: - version "1.2.1" - resolved "https://registry.yarnpkg.com/define-properties/-/define-properties-1.2.1.tgz#10781cc616eb951a80a034bafcaa7377f6af2b6c" - integrity sha512-8QmQKqEASLd5nx0U1B1okLElbUuuttJ/AnYmRXbbbGDWh6uS208EjD4Xqq/I9wK7u0v6O08XhTWnt5XtEbR6Dg== - dependencies: - define-data-property "^1.0.1" - has-property-descriptors "^1.0.0" - object-keys "^1.1.1" - -denque@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/denque/-/denque-2.1.0.tgz#e93e1a6569fb5e66f16a3c2a2964617d349d6ab1" - integrity sha512-HVQE3AAb/pxF8fQAoiqpvg9i3evqug3hoiwakOyZAwJm+6vZehbkYXZ0l4JxS+I3QxM97v5aaRNhj8v5oBhekw== - -depd@2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/depd/-/depd-2.0.0.tgz#b696163cc757560d09cf22cc8fad1571b79e76df" - integrity sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw== - -destroy@1.2.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/destroy/-/destroy-1.2.0.tgz#4803735509ad8be552934c67df614f94e66fa015" - integrity sha512-2sJGJTaXIIaR1w4iJSNoN0hnMY7Gpc/n8D4qSCJw8QqFWXf7cuAgnEHxBpweaVcPevC2l3KpjYCx3NypQQgaJg== - -dotenv@^16.0.3, dotenv@^16.1.4, dotenv@^16.3.1: - version "16.3.1" - resolved "https://registry.yarnpkg.com/dotenv/-/dotenv-16.3.1.tgz#369034de7d7e5b120972693352a3bf112172cc3e" - integrity sha512-IPzF4w4/Rd94bA9imS68tZBaYyBWSCE47V1RGuMrB94iyTOIEwRmVL2x/4An+6mETpLrKJ5hQkB8W4kFAadeIQ== - -dset@^3.1.2: - version "3.1.3" - resolved "https://registry.yarnpkg.com/dset/-/dset-3.1.3.tgz#c194147f159841148e8e34ca41f638556d9542d2" - integrity sha512-20TuZZHCEZ2O71q9/+8BwKwZ0QtD9D8ObhrihJPr+vLLYlSuAU3/zL4cSlgbfeoGHTjCSJBa7NGcrF9/Bx/WJQ== - -easy-table@^1.2.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/easy-table/-/easy-table-1.2.0.tgz#ba9225d7138fee307bfd4f0b5bc3c04bdc7c54eb" - integrity sha512-OFzVOv03YpvtcWGe5AayU5G2hgybsg3iqA6drU8UaoZyB9jLGMTrz9+asnLp/E+6qPh88yEI1gvyZFZ41dmgww== - dependencies: - ansi-regex "^5.0.1" - optionalDependencies: - wcwidth "^1.0.1" - -ee-first@1.1.1: - version "1.1.1" - resolved "https://registry.yarnpkg.com/ee-first/-/ee-first-1.1.1.tgz#590c61156b0ae2f4f0255732a158b266bc56b21d" - integrity sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow== - -emoji-regex@^8.0.0: - version "8.0.0" - resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-8.0.0.tgz#e818fd69ce5ccfcb404594f842963bf53164cc37" - integrity sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A== - -encodeurl@~1.0.2: - version "1.0.2" - resolved "https://registry.yarnpkg.com/encodeurl/-/encodeurl-1.0.2.tgz#ad3ff4c86ec2d029322f5a02c3a9a606c95b3f59" - integrity sha512-TPJXq8JqFaVYm2CWmPvnP2Iyo4ZSM7/QKcSmuMLDObfpH5fi7RUGmd/rTDf+rut/saiDiQEeVTNgAmJEdAOx0w== - -es-get-iterator@^1.1.3: - version "1.1.3" - resolved "https://registry.yarnpkg.com/es-get-iterator/-/es-get-iterator-1.1.3.tgz#3ef87523c5d464d41084b2c3c9c214f1199763d6" - integrity sha512-sPZmqHBe6JIiTfN5q2pEi//TwxmAFHwj/XEuYjTuse78i8KxaqMTTzxPoFKuzRpDpTJ+0NAbpfenkmH2rePtuw== - dependencies: - call-bind "^1.0.2" - get-intrinsic "^1.1.3" - has-symbols "^1.0.3" - is-arguments "^1.1.1" - is-map "^2.0.2" - is-set "^2.0.2" - is-string "^1.0.7" - isarray "^2.0.5" - stop-iteration-iterator "^1.0.0" - -es5-ext@^0.10.35, es5-ext@^0.10.50: - version "0.10.62" - resolved "https://registry.yarnpkg.com/es5-ext/-/es5-ext-0.10.62.tgz#5e6adc19a6da524bf3d1e02bbc8960e5eb49a9a5" - integrity sha512-BHLqn0klhEpnOKSrzn/Xsz2UIW8j+cGmo9JLzr8BiUapV8hPL9+FliFqjwr9ngW7jWdnxv6eO+/LqyhJVqgrjA== - dependencies: - es6-iterator "^2.0.3" - es6-symbol "^3.1.3" - next-tick "^1.1.0" - -es6-iterator@^2.0.3: - version "2.0.3" - resolved "https://registry.yarnpkg.com/es6-iterator/-/es6-iterator-2.0.3.tgz#a7de889141a05a94b0854403b2d0a0fbfa98f3b7" - integrity sha512-zw4SRzoUkd+cl+ZoE15A9o1oQd920Bb0iOJMQkQhl3jNc03YqVjAhG7scf9C5KWRU/R13Orf588uCC6525o02g== - dependencies: - d "1" - es5-ext "^0.10.35" - es6-symbol "^3.1.1" - -es6-symbol@^3.1.1, es6-symbol@^3.1.3: - version "3.1.3" - resolved "https://registry.yarnpkg.com/es6-symbol/-/es6-symbol-3.1.3.tgz#bad5d3c1bcdac28269f4cb331e431c78ac705d18" - integrity sha512-NJ6Yn3FuDinBaBRWl/q5X/s4koRHBrgKAu+yGI6JCBeiu3qrcbJhwT2GeR/EXVfylRk8dpQVJoLEFhK+Mu31NA== - dependencies: - d "^1.0.1" - ext "^1.1.2" - -esbuild@^0.19.5: - version "0.19.5" - resolved "https://registry.yarnpkg.com/esbuild/-/esbuild-0.19.5.tgz#53a0e19dfbf61ba6c827d51a80813cf071239a8c" - integrity sha512-bUxalY7b1g8vNhQKdB24QDmHeY4V4tw/s6Ak5z+jJX9laP5MoQseTOMemAr0gxssjNcH0MCViG8ONI2kksvfFQ== - optionalDependencies: - "@esbuild/android-arm" "0.19.5" - "@esbuild/android-arm64" "0.19.5" - "@esbuild/android-x64" "0.19.5" - "@esbuild/darwin-arm64" "0.19.5" - "@esbuild/darwin-x64" "0.19.5" - "@esbuild/freebsd-arm64" "0.19.5" - "@esbuild/freebsd-x64" "0.19.5" - "@esbuild/linux-arm" "0.19.5" - "@esbuild/linux-arm64" "0.19.5" - "@esbuild/linux-ia32" "0.19.5" - "@esbuild/linux-loong64" "0.19.5" - "@esbuild/linux-mips64el" "0.19.5" - "@esbuild/linux-ppc64" "0.19.5" - "@esbuild/linux-riscv64" "0.19.5" - "@esbuild/linux-s390x" "0.19.5" - "@esbuild/linux-x64" "0.19.5" - "@esbuild/netbsd-x64" "0.19.5" - "@esbuild/openbsd-x64" "0.19.5" - "@esbuild/sunos-x64" "0.19.5" - "@esbuild/win32-arm64" "0.19.5" - "@esbuild/win32-ia32" "0.19.5" - "@esbuild/win32-x64" "0.19.5" - -escalade@^3.1.1: - version "3.1.1" - resolved "https://registry.yarnpkg.com/escalade/-/escalade-3.1.1.tgz#d8cfdc7000965c5a0174b4a82eaa5c0552742e40" - integrity sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw== - -escape-html@~1.0.3: - version "1.0.3" - resolved "https://registry.yarnpkg.com/escape-html/-/escape-html-1.0.3.tgz#0258eae4d3d0c0974de1c169188ef0051d1d1988" - integrity sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow== - -escape-string-regexp@^1.0.5: - version "1.0.5" - resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4" - integrity sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg== - -etag@~1.8.1: - version "1.8.1" - resolved "https://registry.yarnpkg.com/etag/-/etag-1.8.1.tgz#41ae2eeb65efa62268aebfea83ac7d79299b0887" - integrity sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg== - -ethers@^6.5.1: - version "6.8.1" - resolved "https://registry.yarnpkg.com/ethers/-/ethers-6.8.1.tgz#ee2a1a39b5f62a13678f90ccd879175391d0a2b4" - integrity sha512-iEKm6zox5h1lDn6scuRWdIdFJUCGg3+/aQWu0F4K0GVyEZiktFkqrJbRjTn1FlYEPz7RKA707D6g5Kdk6j7Ljg== - dependencies: - "@adraffy/ens-normalize" "1.10.0" - "@noble/curves" "1.2.0" - "@noble/hashes" "1.3.2" - "@types/node" "18.15.13" - aes-js "4.0.0-beta.5" - tslib "2.4.0" - ws "8.5.0" - -express@^4.18.2: - version "4.18.2" - resolved "https://registry.yarnpkg.com/express/-/express-4.18.2.tgz#3fabe08296e930c796c19e3c516979386ba9fd59" - integrity sha512-5/PsL6iGPdfQ/lKM1UuielYgv3BUoJfz1aUwU9vHZ+J7gyvwdQXFEBIEIaxeGf0GIcreATNyBExtalisDbuMqQ== - dependencies: - accepts "~1.3.8" - array-flatten "1.1.1" - body-parser "1.20.1" - content-disposition "0.5.4" - content-type "~1.0.4" - cookie "0.5.0" - cookie-signature "1.0.6" - debug "2.6.9" - depd "2.0.0" - encodeurl "~1.0.2" - escape-html "~1.0.3" - etag "~1.8.1" - finalhandler "1.2.0" - fresh "0.5.2" - http-errors "2.0.0" - merge-descriptors "1.0.1" - methods "~1.1.2" - on-finished "2.4.1" - parseurl "~1.3.3" - path-to-regexp "0.1.7" - proxy-addr "~2.0.7" - qs "6.11.0" - range-parser "~1.2.1" - safe-buffer "5.2.1" - send "0.18.0" - serve-static "1.15.0" - setprototypeof "1.2.0" - statuses "2.0.1" - type-is "~1.6.18" - utils-merge "1.0.1" - vary "~1.1.2" - -ext@^1.1.2: - version "1.7.0" - resolved "https://registry.yarnpkg.com/ext/-/ext-1.7.0.tgz#0ea4383c0103d60e70be99e9a7f11027a33c4f5f" - integrity sha512-6hxeJYaL110a9b5TEJSj0gojyHQAmA2ch5Os+ySCiA1QGdS697XWY1pzsrSjqA9LDEEgdB/KypIlR59RcLuHYw== - dependencies: - type "^2.7.2" - -fast-json-stable-stringify@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz#874bf69c6f404c2b5d99c481341399fd55892633" - integrity sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw== - -fetch-blob@^3.1.2, fetch-blob@^3.1.4: - version "3.2.0" - resolved "https://registry.yarnpkg.com/fetch-blob/-/fetch-blob-3.2.0.tgz#f09b8d4bbd45adc6f0c20b7e787e793e309dcce9" - integrity sha512-7yAQpD2UMJzLi1Dqv7qFYnPbaPx7ZfFK6PiIxQ4PfkGPyNyl2Ugx+a/umUonmKqjhM4DnfbMvdX6otXq83soQQ== - dependencies: - node-domexception "^1.0.0" - web-streams-polyfill "^3.0.3" - -finalhandler@1.2.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/finalhandler/-/finalhandler-1.2.0.tgz#7d23fe5731b207b4640e4fcd00aec1f9207a7b32" - integrity sha512-5uXcUVftlQMFnWC9qu/svkWv3GTd2PfUhK/3PLkYNAe7FbqJMt3515HaxE6eRL74GdsriiwujiawdaB1BpEISg== - dependencies: - debug "2.6.9" - encodeurl "~1.0.2" - escape-html "~1.0.3" - on-finished "2.4.1" - parseurl "~1.3.3" - statuses "2.0.1" - unpipe "~1.0.0" - -for-each@^0.3.3: - version "0.3.3" - resolved "https://registry.yarnpkg.com/for-each/-/for-each-0.3.3.tgz#69b447e88a0a5d32c3e7084f3f1710034b21376e" - integrity sha512-jqYfLp7mo9vIyQf8ykW2v7A+2N4QjeCeI5+Dz9XraiO1ign81wjiH7Fb9vSOWvQfNtmSa4H2RoQTrrXivdUZmw== - dependencies: - is-callable "^1.1.3" - -formdata-polyfill@^4.0.10: - version "4.0.10" - resolved "https://registry.yarnpkg.com/formdata-polyfill/-/formdata-polyfill-4.0.10.tgz#24807c31c9d402e002ab3d8c720144ceb8848423" - integrity sha512-buewHzMvYL29jdeQTVILecSaZKnt/RJWjoZCF5OW60Z67/GmSLBkOFM7qh1PI3zFNtJbaZL5eQu1vLfazOwj4g== - dependencies: - fetch-blob "^3.1.2" - -forwarded@0.2.0: - version "0.2.0" - resolved "https://registry.yarnpkg.com/forwarded/-/forwarded-0.2.0.tgz#2269936428aad4c15c7ebe9779a84bf0b2a81811" - integrity sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow== - -fresh@0.5.2: - version "0.5.2" - resolved "https://registry.yarnpkg.com/fresh/-/fresh-0.5.2.tgz#3d8cadd90d976569fa835ab1f8e4b23a105605a7" - integrity sha512-zJ2mQYM18rEFOudeV4GShTGIQ7RbzA7ozbU9I/XBpm7kqgMywgmylMwXHxZJmkVoYkna9d2pVXVXPdYTP9ej8Q== - -fs.realpath@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f" - integrity sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw== - -function-bind@^1.1.2: - version "1.1.2" - resolved "https://registry.yarnpkg.com/function-bind/-/function-bind-1.1.2.tgz#2c02d864d97f3ea6c8830c464cbd11ab6eab7a1c" - integrity sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA== - -functions-have-names@^1.2.3: - version "1.2.3" - resolved "https://registry.yarnpkg.com/functions-have-names/-/functions-have-names-1.2.3.tgz#0404fe4ee2ba2f607f0e0ec3c80bae994133b834" - integrity sha512-xckBUXyTIqT97tq2x2AMb+g163b5JFysYk0x4qxNFwbfQkmNZoiRHb6sPzI9/QV33WeuvVYBUIiD4NzNIyqaRQ== - -get-caller-file@^2.0.5: - version "2.0.5" - resolved "https://registry.yarnpkg.com/get-caller-file/-/get-caller-file-2.0.5.tgz#4f94412a82db32f36e3b0b9741f8a97feb031f7e" - integrity sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg== - -get-intrinsic@^1.0.2, get-intrinsic@^1.1.1, get-intrinsic@^1.1.3, get-intrinsic@^1.2.0, get-intrinsic@^1.2.1, get-intrinsic@^1.2.2: - version "1.2.2" - resolved "https://registry.yarnpkg.com/get-intrinsic/-/get-intrinsic-1.2.2.tgz#281b7622971123e1ef4b3c90fd7539306da93f3b" - integrity sha512-0gSo4ml/0j98Y3lngkFEot/zhiCeWsbYIlZ+uZOVgzLyLaUw7wxUL+nCTP0XJvJg1AXulJRI3UJi8GsbDuxdGA== - dependencies: - function-bind "^1.1.2" - has-proto "^1.0.1" - has-symbols "^1.0.3" - hasown "^2.0.0" - -glob@^7.1.6: - version "7.2.3" - resolved "https://registry.yarnpkg.com/glob/-/glob-7.2.3.tgz#b8df0fb802bbfa8e89bd1d938b4e16578ed44f2b" - integrity sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q== - dependencies: - fs.realpath "^1.0.0" - inflight "^1.0.4" - inherits "2" - minimatch "^3.1.1" - once "^1.3.0" - path-is-absolute "^1.0.0" - -glob@^8.1.0: - version "8.1.0" - resolved "https://registry.yarnpkg.com/glob/-/glob-8.1.0.tgz#d388f656593ef708ee3e34640fdfb99a9fd1c33e" - integrity sha512-r8hpEjiQEYlF2QU0df3dS+nxxSIreXQS1qRhMJM0Q5NDdR386C7jb7Hwwod8Fgiuex+k0GFjgft18yvxm5XoCQ== - dependencies: - fs.realpath "^1.0.0" - inflight "^1.0.4" - inherits "2" - minimatch "^5.0.1" - once "^1.3.0" - -globals@^11.1.0: - version "11.12.0" - resolved "https://registry.yarnpkg.com/globals/-/globals-11.12.0.tgz#ab8795338868a0babd8525758018c2a7eb95c42e" - integrity sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA== - -gopd@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/gopd/-/gopd-1.0.1.tgz#29ff76de69dac7489b7c0918a5788e56477c332c" - integrity sha512-d65bNlIadxvpb/A2abVdlqKqV563juRnZ1Wtk6s1sIR8uNsXR70xqIzVqxVf1eTqDunwT2MkczEeaezCKTZhwA== - dependencies: - get-intrinsic "^1.1.3" - -graphql-parse-resolve-info@^4.13.0: - version "4.13.0" - resolved "https://registry.yarnpkg.com/graphql-parse-resolve-info/-/graphql-parse-resolve-info-4.13.0.tgz#03627032e25917bd6f9ed89e768568c61200e6ff" - integrity sha512-VVJ1DdHYcR7hwOGQKNH+QTzuNgsLA8l/y436HtP9YHoX6nmwXRWq3xWthU3autMysXdm0fQUbhTZCx0W9ICozw== - dependencies: - debug "^4.1.1" - tslib "^2.0.1" - -graphql-query-complexity@^0.7.2: - version "0.7.2" - resolved "https://registry.yarnpkg.com/graphql-query-complexity/-/graphql-query-complexity-0.7.2.tgz#7fc6bb20930ab1b666ecf3bbfb24b65b6f08ecc4" - integrity sha512-+VgmrfxGEjHI3zuojWOR8bsz7Ycz/BZjNjxnlUieTz5DsB92WoIrYCSZdWG7UWZ3rfcA1Gb2Nf+wB80GsaZWuQ== - dependencies: - lodash.get "^4.4.2" - -graphql-subscriptions@^1.2.0: - version "1.2.1" - resolved "https://registry.yarnpkg.com/graphql-subscriptions/-/graphql-subscriptions-1.2.1.tgz#2142b2d729661ddf967b7388f7cf1dd4cf2e061d" - integrity sha512-95yD/tKi24q8xYa7Q9rhQN16AYj5wPbrb8tmHGM3WRc9EBmWrG/0kkMl+tQG8wcEuE9ibR4zyOM31p5Sdr2v4g== - dependencies: - iterall "^1.3.0" - -graphql-tag@^2.11.0: - version "2.12.6" - resolved "https://registry.yarnpkg.com/graphql-tag/-/graphql-tag-2.12.6.tgz#d441a569c1d2537ef10ca3d1633b48725329b5f1" - integrity sha512-FdSNcu2QQcWnM2VNvSCCDCVS5PpPqpzgFT8+GXzqJuoDd0CBncxCY278u4mhRO7tMgo2JjgJA5aZ+nWSQ/Z+xg== - dependencies: - tslib "^2.1.0" - -graphql-ws@^5.14.1: - version "5.14.2" - resolved "https://registry.yarnpkg.com/graphql-ws/-/graphql-ws-5.14.2.tgz#7db6f6138717a544d9480f0213f65f2841ed1c52" - integrity sha512-LycmCwhZ+Op2GlHz4BZDsUYHKRiiUz+3r9wbhBATMETNlORQJAaFlAgTFoeRh6xQoQegwYwIylVD1Qns9/DA3w== - -graphql@^15.8.0: - version "15.8.0" - resolved "https://registry.yarnpkg.com/graphql/-/graphql-15.8.0.tgz#33410e96b012fa3bdb1091cc99a94769db212b38" - integrity sha512-5gghUc24tP9HRznNpV2+FIoq3xKkj5dTQqf4v0CpdPbFVwFkWoxOM+o+2OC9ZSvjEMTjfmG9QT+gcvggTwW1zw== - -has-bigints@^1.0.1: - version "1.0.2" - resolved "https://registry.yarnpkg.com/has-bigints/-/has-bigints-1.0.2.tgz#0871bd3e3d51626f6ca0966668ba35d5602d6eaa" - integrity sha512-tSvCKtBr9lkF0Ex0aQiP9N+OpV4zi2r/Nee5VkRDbaqv35RLYMzbwQfFSZZH0kR+Rd6302UJZ2p/bJCEoR3VoQ== - -has-flag@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-3.0.0.tgz#b5d454dc2199ae225699f3467e5a07f3b955bafd" - integrity sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw== - -has-flag@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-4.0.0.tgz#944771fd9c81c81265c4d6941860da06bb59479b" - integrity sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ== - -has-property-descriptors@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/has-property-descriptors/-/has-property-descriptors-1.0.1.tgz#52ba30b6c5ec87fd89fa574bc1c39125c6f65340" - integrity sha512-VsX8eaIewvas0xnvinAe9bw4WfIeODpGYikiWYLH+dma0Jw6KHYqWiWfhQlgOVK8D6PvjubK5Uc4P0iIhIcNVg== - dependencies: - get-intrinsic "^1.2.2" - -has-proto@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/has-proto/-/has-proto-1.0.1.tgz#1885c1305538958aff469fef37937c22795408e0" - integrity sha512-7qE+iP+O+bgF9clE5+UoBFzE65mlBiVj3tKCrlNQ0Ogwm0BjpT/gK4SlLYDMybDh5I3TCTKnPPa0oMG7JDYrhg== - -has-symbols@^1.0.2, has-symbols@^1.0.3: - version "1.0.3" - resolved "https://registry.yarnpkg.com/has-symbols/-/has-symbols-1.0.3.tgz#bb7b2c4349251dce87b125f7bdf874aa7c8b39f8" - integrity sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A== - -has-tostringtag@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/has-tostringtag/-/has-tostringtag-1.0.0.tgz#7e133818a7d394734f941e73c3d3f9291e658b25" - integrity sha512-kFjcSNhnlGV1kyoGk7OXKSawH5JOb/LzUc5w9B02hOTO0dfFRjbHQKvg1d6cf3HbeUmtU9VbbV3qzZ2Teh97WQ== - dependencies: - has-symbols "^1.0.2" - -hasown@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/hasown/-/hasown-2.0.0.tgz#f4c513d454a57b7c7e1650778de226b11700546c" - integrity sha512-vUptKVTpIJhcczKBbgnS+RtcuYMB8+oNzPK2/Hp3hanz8JmpATdmmgLgSaadVREkDm+e2giHwY3ZRkyjSIDDFA== - dependencies: - function-bind "^1.1.2" - -highlight.js@^10.7.1: - version "10.7.3" - resolved "https://registry.yarnpkg.com/highlight.js/-/highlight.js-10.7.3.tgz#697272e3991356e40c3cac566a74eef681756531" - integrity sha512-tzcUFauisWKNHaRkN4Wjl/ZA07gENAjFl3J/c480dprkGTg5EQstgaNFqBfUqCq54kZRIEcreTsAgF/m2quD7A== - -http-errors@2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/http-errors/-/http-errors-2.0.0.tgz#b7774a1486ef73cf7667ac9ae0858c012c57b9d3" - integrity sha512-FtwrG/euBzaEjYeRqOgly7G0qviiXoJWnvEH2Z1plBdXgbyjv34pHTSb9zoeHMyDy33+DWy5Wt9Wo+TURtOYSQ== - dependencies: - depd "2.0.0" - inherits "2.0.4" - setprototypeof "1.2.0" - statuses "2.0.1" - toidentifier "1.0.1" - -iconv-lite@0.4.24: - version "0.4.24" - resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.24.tgz#2022b4b25fbddc21d2f524974a474aafe733908b" - integrity sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA== - dependencies: - safer-buffer ">= 2.1.2 < 3" - -ieee754@^1.2.1: - version "1.2.1" - resolved "https://registry.yarnpkg.com/ieee754/-/ieee754-1.2.1.tgz#8eb7a10a63fff25d15a57b001586d177d1b0d352" - integrity sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA== - -inflected@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/inflected/-/inflected-2.1.0.tgz#2816ac17a570bbbc8303ca05bca8bf9b3f959687" - integrity sha512-hAEKNxvHf2Iq3H60oMBHkB4wl5jn3TPF3+fXek/sRwAB5gP9xWs4r7aweSF95f99HFoz69pnZTcu8f0SIHV18w== - -inflight@^1.0.4: - version "1.0.6" - resolved "https://registry.yarnpkg.com/inflight/-/inflight-1.0.6.tgz#49bd6331d7d02d0c09bc910a1075ba8165b56df9" - integrity sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA== - dependencies: - once "^1.3.0" - wrappy "1" - -inherits@2, inherits@2.0.4, inherits@^2.0.1: - version "2.0.4" - resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.4.tgz#0fa2c64f932917c3433a0ded55363aae37416b7c" - integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ== - -internal-slot@^1.0.4: - version "1.0.6" - resolved "https://registry.yarnpkg.com/internal-slot/-/internal-slot-1.0.6.tgz#37e756098c4911c5e912b8edbf71ed3aa116f930" - integrity sha512-Xj6dv+PsbtwyPpEflsejS+oIZxmMlV44zAhG479uYu89MsjcYOhCFnNyKrkJrihbsiasQyY0afoCl/9BLR65bg== - dependencies: - get-intrinsic "^1.2.2" - hasown "^2.0.0" - side-channel "^1.0.4" - -ioredis@^5.3.2: - version "5.3.2" - resolved "https://registry.yarnpkg.com/ioredis/-/ioredis-5.3.2.tgz#9139f596f62fc9c72d873353ac5395bcf05709f7" - integrity sha512-1DKMMzlIHM02eBBVOFQ1+AolGjs6+xEcM4PDL7NqOS6szq7H9jSaEkIUH6/a5Hl241LzW6JLSiAbNvTQjUupUA== - dependencies: - "@ioredis/commands" "^1.1.1" - cluster-key-slot "^1.1.0" - debug "^4.3.4" - denque "^2.1.0" - lodash.defaults "^4.2.0" - lodash.isarguments "^3.1.0" - redis-errors "^1.2.0" - redis-parser "^3.0.0" - standard-as-callback "^2.1.0" - -ipaddr.js@1.9.1: - version "1.9.1" - resolved "https://registry.yarnpkg.com/ipaddr.js/-/ipaddr.js-1.9.1.tgz#bff38543eeb8984825079ff3a2a8e6cbd46781b3" - integrity sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g== - -is-arguments@^1.1.1: - version "1.1.1" - resolved "https://registry.yarnpkg.com/is-arguments/-/is-arguments-1.1.1.tgz#15b3f88fda01f2a97fec84ca761a560f123efa9b" - integrity sha512-8Q7EARjzEnKpt/PCD7e1cgUS0a6X8u5tdSiMqXhojOdoV9TsMsiO+9VLC5vAmO8N7/GmXn7yjR8qnA6bVAEzfA== - dependencies: - call-bind "^1.0.2" - has-tostringtag "^1.0.0" - -is-array-buffer@^3.0.1, is-array-buffer@^3.0.2: - version "3.0.2" - resolved "https://registry.yarnpkg.com/is-array-buffer/-/is-array-buffer-3.0.2.tgz#f2653ced8412081638ecb0ebbd0c41c6e0aecbbe" - integrity sha512-y+FyyR/w8vfIRq4eQcM1EYgSTnmHXPqaF+IgzgraytCFq5Xh8lllDVmAZolPJiZttZLeFSINPYMaEJ7/vWUa1w== - dependencies: - call-bind "^1.0.2" - get-intrinsic "^1.2.0" - is-typed-array "^1.1.10" - -is-bigint@^1.0.1: - version "1.0.4" - resolved "https://registry.yarnpkg.com/is-bigint/-/is-bigint-1.0.4.tgz#08147a1875bc2b32005d41ccd8291dffc6691df3" - integrity sha512-zB9CruMamjym81i2JZ3UMn54PKGsQzsJeo6xvN3HJJ4CAsQNB6iRutp2To77OfCNuoxspsIhzaPoO1zyCEhFOg== - dependencies: - has-bigints "^1.0.1" - -is-boolean-object@^1.1.0: - version "1.1.2" - resolved "https://registry.yarnpkg.com/is-boolean-object/-/is-boolean-object-1.1.2.tgz#5c6dc200246dd9321ae4b885a114bb1f75f63719" - integrity sha512-gDYaKHJmnj4aWxyj6YHyXVpdQawtVLHU5cb+eztPGczf6cjuTdwve5ZIEfgXqH4e57An1D1AKf8CZ3kYrQRqYA== - dependencies: - call-bind "^1.0.2" - has-tostringtag "^1.0.0" - -is-callable@^1.1.3: - version "1.2.7" - resolved "https://registry.yarnpkg.com/is-callable/-/is-callable-1.2.7.tgz#3bc2a85ea742d9e36205dcacdd72ca1fdc51b055" - integrity sha512-1BC0BVFhS/p0qtw6enp8e+8OD0UrK0oFLztSjNzhcKA3WDuJxxAPXzPuPtKkjEY9UUoEWlX/8fgKeu2S8i9JTA== - -is-date-object@^1.0.5: - version "1.0.5" - resolved "https://registry.yarnpkg.com/is-date-object/-/is-date-object-1.0.5.tgz#0841d5536e724c25597bf6ea62e1bd38298df31f" - integrity sha512-9YQaSxsAiSwcvS33MBk3wTCVnWK+HhF8VZR2jRxehM16QcVOdHqPn4VPHmRK4lSr38n9JriurInLcP90xsYNfQ== - dependencies: - has-tostringtag "^1.0.0" - -is-fullwidth-code-point@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz#f116f8064fe90b3f7844a38997c0b75051269f1d" - integrity sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg== - -is-map@^2.0.1, is-map@^2.0.2: - version "2.0.2" - resolved "https://registry.yarnpkg.com/is-map/-/is-map-2.0.2.tgz#00922db8c9bf73e81b7a335827bc2a43f2b91127" - integrity sha512-cOZFQQozTha1f4MxLFzlgKYPTyj26picdZTx82hbc/Xf4K/tZOOXSCkMvU4pKioRXGDLJRn0GM7Upe7kR721yg== - -is-number-object@^1.0.4: - version "1.0.7" - resolved "https://registry.yarnpkg.com/is-number-object/-/is-number-object-1.0.7.tgz#59d50ada4c45251784e9904f5246c742f07a42fc" - integrity sha512-k1U0IRzLMo7ZlYIfzRu23Oh6MiIFasgpb9X76eqfFZAqwH44UI4KTBvBYIZ1dSL9ZzChTB9ShHfLkR4pdW5krQ== - dependencies: - has-tostringtag "^1.0.0" - -is-regex@^1.1.4: - version "1.1.4" - resolved "https://registry.yarnpkg.com/is-regex/-/is-regex-1.1.4.tgz#eef5663cd59fa4c0ae339505323df6854bb15958" - integrity sha512-kvRdxDsxZjhzUX07ZnLydzS1TU/TJlTUHHY4YLL87e37oUA49DfkLqgy+VjFocowy29cKvcSiu+kIv728jTTVg== - dependencies: - call-bind "^1.0.2" - has-tostringtag "^1.0.0" - -is-set@^2.0.1, is-set@^2.0.2: - version "2.0.2" - resolved "https://registry.yarnpkg.com/is-set/-/is-set-2.0.2.tgz#90755fa4c2562dc1c5d4024760d6119b94ca18ec" - integrity sha512-+2cnTEZeY5z/iXGbLhPrOAaK/Mau5k5eXq9j14CpRTftq0pAJu2MwVRSZhyZWBzx3o6X795Lz6Bpb6R0GKf37g== - -is-shared-array-buffer@^1.0.2: - version "1.0.2" - resolved "https://registry.yarnpkg.com/is-shared-array-buffer/-/is-shared-array-buffer-1.0.2.tgz#8f259c573b60b6a32d4058a1a07430c0a7344c79" - integrity sha512-sqN2UDu1/0y6uvXyStCOzyhAjCSlHceFoMKJW8W9EU9cvic/QdsZ0kEU93HEy3IUEFZIiH/3w+AH/UQbPHNdhA== - dependencies: - call-bind "^1.0.2" - -is-string@^1.0.5, is-string@^1.0.7: - version "1.0.7" - resolved "https://registry.yarnpkg.com/is-string/-/is-string-1.0.7.tgz#0dd12bf2006f255bb58f695110eff7491eebc0fd" - integrity sha512-tE2UXzivje6ofPW7l23cjDOMa09gb7xlAqG6jG5ej6uPV32TlWP3NKPigtaGeHNu9fohccRYvIiZMfOOnOYUtg== - dependencies: - has-tostringtag "^1.0.0" - -is-symbol@^1.0.3: - version "1.0.4" - resolved "https://registry.yarnpkg.com/is-symbol/-/is-symbol-1.0.4.tgz#a6dac93b635b063ca6872236de88910a57af139c" - integrity sha512-C/CPBqKWnvdcxqIARxyOh4v1UUEOCHpgDa0WYgpKDFMszcrPcffg5uhwSgPCLD2WWxmq6isisz87tzT01tuGhg== - dependencies: - has-symbols "^1.0.2" - -is-typed-array@^1.1.10: - version "1.1.12" - resolved "https://registry.yarnpkg.com/is-typed-array/-/is-typed-array-1.1.12.tgz#d0bab5686ef4a76f7a73097b95470ab199c57d4a" - integrity sha512-Z14TF2JNG8Lss5/HMqt0//T9JeHXttXy5pH/DBU4vi98ozO2btxzq9MwYDZYnKwU8nRsz/+GVFVRDq3DkVuSPg== - dependencies: - which-typed-array "^1.1.11" - -is-typedarray@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/is-typedarray/-/is-typedarray-1.0.0.tgz#e479c80858df0c1b11ddda6940f96011fcda4a9a" - integrity sha512-cyA56iCMHAh5CdzjJIa4aohJyeO1YbwLi3Jc35MmRU6poroFjIGZzUzupGiRPOjgHg9TLu43xbpwXk523fMxKA== - -is-weakmap@^2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/is-weakmap/-/is-weakmap-2.0.1.tgz#5008b59bdc43b698201d18f62b37b2ca243e8cf2" - integrity sha512-NSBR4kH5oVj1Uwvv970ruUkCV7O1mzgVFO4/rev2cLRda9Tm9HrL70ZPut4rOHgY0FNrUu9BCbXA2sdQ+x0chA== - -is-weakset@^2.0.1: - version "2.0.2" - resolved "https://registry.yarnpkg.com/is-weakset/-/is-weakset-2.0.2.tgz#4569d67a747a1ce5a994dfd4ef6dcea76e7c0a1d" - integrity sha512-t2yVvttHkQktwnNNmBQ98AhENLdPUTDTE21uPqAQ0ARwQfGeQKRVS0NNurH7bTf7RrvcVn1OOge45CnBeHCSmg== - dependencies: - call-bind "^1.0.2" - get-intrinsic "^1.1.1" - -isarray@^2.0.5: - version "2.0.5" - resolved "https://registry.yarnpkg.com/isarray/-/isarray-2.0.5.tgz#8af1e4c1221244cc62459faf38940d4e644a5723" - integrity sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw== - -isows@1.0.3: - version "1.0.3" - resolved "https://registry.yarnpkg.com/isows/-/isows-1.0.3.tgz#93c1cf0575daf56e7120bab5c8c448b0809d0d74" - integrity sha512-2cKei4vlmg2cxEjm3wVSqn8pcoRF/LX/wpifuuNquFO4SQmPwarClT+SUCA2lt+l581tTeZIPIZuIDo2jWN1fg== - -iterall@^1.3.0: - version "1.3.0" - resolved "https://registry.yarnpkg.com/iterall/-/iterall-1.3.0.tgz#afcb08492e2915cbd8a0884eb93a8c94d0d72fea" - integrity sha512-QZ9qOMdF+QLHxy1QIpUHUU1D5pS2CG2P69LF6L6CPjPYA/XMOmKV3PZpawHoAjHNyB0swdVTRxdYT4tbBbxqwg== - -javascript-natural-sort@0.7.1: - version "0.7.1" - resolved "https://registry.yarnpkg.com/javascript-natural-sort/-/javascript-natural-sort-0.7.1.tgz#f9e2303d4507f6d74355a73664d1440fb5a0ef59" - integrity sha512-nO6jcEfZWQXDhOiBtG2KvKyEptz7RVbpGP4vTD2hLBdmNQSsCiicO2Ioinv6UI4y9ukqnBpy+XZ9H6uLNgJTlw== - -js-tokens@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-4.0.0.tgz#19203fb59991df98e3a287050d4647cdeaf32499" - integrity sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ== - -js-yaml@^4.1.0: - version "4.1.0" - resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-4.1.0.tgz#c1fb65f8f5017901cdd2c951864ba18458a10602" - integrity sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA== - dependencies: - argparse "^2.0.1" - -jsesc@^2.5.1: - version "2.5.2" - resolved "https://registry.yarnpkg.com/jsesc/-/jsesc-2.5.2.tgz#80564d2e483dacf6e8ef209650a67df3f0c283a4" - integrity sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA== - -json-buffer@3.0.1: - version "3.0.1" - resolved "https://registry.yarnpkg.com/json-buffer/-/json-buffer-3.0.1.tgz#9338802a30d3b6605fbe0613e094008ca8c05a13" - integrity sha512-4bV5BfR2mqfQTJm+V5tPPdf+ZpuhiIvTuAB5g8kcrXOZpTT/QwwVRWBywX1ozr6lEuPdbHxwaJlm9G6mI2sfSQ== - -keyv@^4.4.0, keyv@~4.5.3: - version "4.5.4" - resolved "https://registry.yarnpkg.com/keyv/-/keyv-4.5.4.tgz#a879a99e29452f942439f2a405e3af8b31d4de93" - integrity sha512-oxVHkHR/EJf2CNXnWxRLW6mg7JyCCUcG0DtEGmL2ctUo1PNTin1PUil+r/+4r5MpVgC/fn1kjsx7mjSujKqIpw== - dependencies: - json-buffer "3.0.1" - -lodash.defaults@^4.2.0: - version "4.2.0" - resolved "https://registry.yarnpkg.com/lodash.defaults/-/lodash.defaults-4.2.0.tgz#d09178716ffea4dde9e5fb7b37f6f0802274580c" - integrity sha512-qjxPLHd3r5DnsdGacqOMU6pb/avJzdh9tFX2ymgoZE27BmjXrNy/y4LoaiTeAb+O3gL8AfpJGtqfX/ae2leYYQ== - -lodash.get@^4.4.2: - version "4.4.2" - resolved "https://registry.yarnpkg.com/lodash.get/-/lodash.get-4.4.2.tgz#2d177f652fa31e939b4438d5341499dfa3825e99" - integrity sha512-z+Uw/vLuy6gQe8cfaFWD7p0wVv8fJl3mbzXh33RS+0oW2wvUqiRXiQ69gLWSLpgB5/6sU+r6BlQR0MBILadqTQ== - -lodash.isarguments@^3.1.0: - version "3.1.0" - resolved "https://registry.yarnpkg.com/lodash.isarguments/-/lodash.isarguments-3.1.0.tgz#2f573d85c6a24289ff00663b491c1d338ff3458a" - integrity sha512-chi4NHZlZqZD18a0imDHnZPrDeBbTtVN7GXMwuGdRH9qotxAjYs3aVLKc7zNOG9eddR5Ksd8rvFEBc9SsggPpg== - -lodash.sortby@^4.7.0: - version "4.7.0" - resolved "https://registry.yarnpkg.com/lodash.sortby/-/lodash.sortby-4.7.0.tgz#edd14c824e2cc9c1e0b0a1b42bb5210516a42438" - integrity sha512-HDWXG8isMntAyRF5vZ7xKuEvOhT4AhlRt/3czTSjvGUxjYCBVRQY48ViDHyfYz9VIoBkW4TMGQNapx+l3RUwdA== - -lodash@^4.17.21: - version "4.17.21" - resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c" - integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg== - -loglevel@^1.6.8: - version "1.8.1" - resolved "https://registry.yarnpkg.com/loglevel/-/loglevel-1.8.1.tgz#5c621f83d5b48c54ae93b6156353f555963377b4" - integrity sha512-tCRIJM51SHjAayKwC+QAg8hT8vg6z7GSgLJKGvzuPb1Wc+hLzqtuVLxp6/HzSPOozuK+8ErAhy7U/sVzw8Dgfg== - -long@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/long/-/long-4.0.0.tgz#9a7b71cfb7d361a194ea555241c92f7468d5bf28" - integrity sha512-XsP+KhQif4bjX1kbuSiySJFNAehNxgLb6hPRGJ9QsUr8ajHkuXGdrHmFUTUUXhDwVX2R5bY4JNZEwbUiMhV+MA== - -"lru-cache@7.10.1 - 7.13.1": - version "7.13.1" - resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-7.13.1.tgz#267a81fbd0881327c46a81c5922606a2cfe336c4" - integrity sha512-CHqbAq7NFlW3RSnoWXLJBxCWaZVBrfa9UEHId2M3AW8iEBurbqduNexEUCGc3SHc6iCYXNJCDi903LajSVAEPQ== - -lru-cache@^6.0.0: - version "6.0.0" - resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-6.0.0.tgz#6d6fe6570ebd96aaf90fcad1dafa3b2566db3a94" - integrity sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA== - dependencies: - yallist "^4.0.0" - -media-typer@0.3.0: - version "0.3.0" - resolved "https://registry.yarnpkg.com/media-typer/-/media-typer-0.3.0.tgz#8710d7af0aa626f8fffa1ce00168545263255748" - integrity sha512-dq+qelQ9akHpcOl/gUVRTxVIOkAJ1wR3QAvb4RsVjS8oVoFjDGTc679wJYmUmknUF5HwMLOgb5O+a3KxfWapPQ== - -merge-descriptors@1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/merge-descriptors/-/merge-descriptors-1.0.1.tgz#b00aaa556dd8b44568150ec9d1b953f3f90cbb61" - integrity sha512-cCi6g3/Zr1iqQi6ySbseM1Xvooa98N0w31jzUYrXPX2xqObmFGHJ0tQ5u74H3mVh7wLouTseZyYIq39g8cNp1w== - -methods@~1.1.2: - version "1.1.2" - resolved "https://registry.yarnpkg.com/methods/-/methods-1.1.2.tgz#5529a4d67654134edcc5266656835b0f851afcee" - integrity sha512-iclAHeNqNm68zFtnZ0e+1L2yUIdvzNoauKU4WBA3VvH/vPFieF7qfRlwUZU+DA9P9bPXIS90ulxoUoCH23sV2w== - -mime-db@1.52.0: - version "1.52.0" - resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.52.0.tgz#bbabcdc02859f4987301c856e3387ce5ec43bf70" - integrity sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg== - -mime-types@~2.1.24, mime-types@~2.1.34: - version "2.1.35" - resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-2.1.35.tgz#381a871b62a734450660ae3deee44813f70d959a" - integrity sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw== - dependencies: - mime-db "1.52.0" - -mime@1.6.0: - version "1.6.0" - resolved "https://registry.yarnpkg.com/mime/-/mime-1.6.0.tgz#32cd9e5c64553bd58d19a568af452acff04981b1" - integrity sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg== - -minimatch@^3.1.1: - version "3.1.2" - resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.1.2.tgz#19cd194bfd3e428f049a70817c038d89ab4be35b" - integrity sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw== - dependencies: - brace-expansion "^1.1.7" - -minimatch@^5.0.1: - version "5.1.6" - resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-5.1.6.tgz#1cfcb8cf5522ea69952cd2af95ae09477f122a96" - integrity sha512-lKwV/1brpG6mBUFHtb7NUmtABCb2WZZmm2wNiOA5hAb8VdCS4B3dtMWyvcoViccwAW/COERjXLt0zP1zXUN26g== - dependencies: - brace-expansion "^2.0.1" - -mkdirp@^2.1.3: - version "2.1.6" - resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-2.1.6.tgz#964fbcb12b2d8c5d6fbc62a963ac95a273e2cc19" - integrity sha512-+hEnITedc8LAtIP9u3HJDFIdcLV2vXP33sqLLIzkv1Db1zO/1OxbvYf0Y1OC/S/Qo5dxHXepofhmxL02PsKe+A== - -ms@2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/ms/-/ms-2.0.0.tgz#5608aeadfc00be6c2901df5f9861788de0d597c8" - integrity sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A== - -ms@2.1.2: - version "2.1.2" - resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.2.tgz#d09d1f357b443f493382a8eb3ccd183872ae6009" - integrity sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w== - -ms@2.1.3: - version "2.1.3" - resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.3.tgz#574c8138ce1d2b5861f0b44579dbadd60c6615b2" - integrity sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA== - -mz@^2.4.0: - version "2.7.0" - resolved "https://registry.yarnpkg.com/mz/-/mz-2.7.0.tgz#95008057a56cafadc2bc63dde7f9ff6955948e32" - integrity sha512-z81GNO7nnYMEhrGh9LeymoE4+Yr0Wn5McHIZMK5cfQCl+NDX08sCZgUc9/6MHni9IWuFLm1Z3HTCXu2z9fN62Q== - dependencies: - any-promise "^1.0.0" - object-assign "^4.0.1" - thenify-all "^1.0.0" - -negotiator@0.6.3: - version "0.6.3" - resolved "https://registry.yarnpkg.com/negotiator/-/negotiator-0.6.3.tgz#58e323a72fedc0d6f9cd4d31fe49f51479590ccd" - integrity sha512-+EUsqGPLsM+j/zdChZjsnX51g4XrHFOIXwfnCVPGlQk/k5giakcKsuxCObBRu6DSm9opw/O6slWbJdghQM4bBg== - -next-tick@^1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/next-tick/-/next-tick-1.1.0.tgz#1836ee30ad56d67ef281b22bd199f709449b35eb" - integrity sha512-CXdUiJembsNjuToQvxayPZF9Vqht7hewsvy2sOWafLvi2awflj9mOC6bHIg50orX8IJvWKY9wYQ/zB2kogPslQ== - -node-abort-controller@^3.0.1: - version "3.1.1" - resolved "https://registry.yarnpkg.com/node-abort-controller/-/node-abort-controller-3.1.1.tgz#a94377e964a9a37ac3976d848cb5c765833b8548" - integrity sha512-AGK2yQKIjRuqnc6VkX2Xj5d+QW8xZ87pa1UK6yA6ouUyuxfHuMP6umE5QK7UmTeOAymo+Zx1Fxiuw9rVx8taHQ== - -node-domexception@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/node-domexception/-/node-domexception-1.0.0.tgz#6888db46a1f71c0b76b3f7555016b63fe64766e5" - integrity sha512-/jKZoMpw0F8GRwl4/eLROPA3cfcXtLApP0QzLmUT/HuPCZWyB7IY9ZrMeKw2O/nFIqPQB3PVM9aYm0F312AXDQ== - -node-fetch@^2.6.1, node-fetch@^2.6.7: - version "2.7.0" - resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.7.0.tgz#d0f0fa6e3e2dc1d27efcd8ad99d550bda94d187d" - integrity sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A== - dependencies: - whatwg-url "^5.0.0" - -node-fetch@^3.3.2: - version "3.3.2" - resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-3.3.2.tgz#d1e889bacdf733b4ff3b2b243eb7a12866a0b78b" - integrity sha512-dRB78srN/l6gqWulah9SrxeYnxeddIG30+GOqK/9OlLVyLg3HPnr6SqOWTWOXKRwC2eGYCkZ59NNuSgvSrpgOA== - dependencies: - data-uri-to-buffer "^4.0.0" - fetch-blob "^3.1.4" - formdata-polyfill "^4.0.10" - -node-gyp-build@^4.3.0: - version "4.6.1" - resolved "https://registry.yarnpkg.com/node-gyp-build/-/node-gyp-build-4.6.1.tgz#24b6d075e5e391b8d5539d98c7fc5c210cac8a3e" - integrity sha512-24vnklJmyRS8ViBNI8KbtK/r/DmXQMRiOMXTNz2nrTnAYUwjmEEbnnpB/+kt+yWRv73bPsSPRFddrcIbAxSiMQ== - -object-assign@^4, object-assign@^4.0.1: - version "4.1.1" - resolved "https://registry.yarnpkg.com/object-assign/-/object-assign-4.1.1.tgz#2109adc7965887cfc05cbbd442cac8bfbb360863" - integrity sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg== - -object-inspect@^1.9.0: - version "1.13.1" - resolved "https://registry.yarnpkg.com/object-inspect/-/object-inspect-1.13.1.tgz#b96c6109324ccfef6b12216a956ca4dc2ff94bc2" - integrity sha512-5qoj1RUiKOMsCCNLV1CBiPYE10sziTsnmNxkAI/rZhiD63CF7IqdFGC/XzjWjpSgLf0LxXX3bDFIh0E18f6UhQ== - -object-is@^1.1.5: - version "1.1.5" - resolved "https://registry.yarnpkg.com/object-is/-/object-is-1.1.5.tgz#b9deeaa5fc7f1846a0faecdceec138e5778f53ac" - integrity sha512-3cyDsyHgtmi7I7DfSSI2LDp6SK2lwvtbg0p0R1e0RvTqF5ceGx+K2dfSjm1bKDMVCFEDAQvy+o8c6a7VujOddw== - dependencies: - call-bind "^1.0.2" - define-properties "^1.1.3" - -object-keys@^1.1.1: - version "1.1.1" - resolved "https://registry.yarnpkg.com/object-keys/-/object-keys-1.1.1.tgz#1c47f272df277f3b1daf061677d9c82e2322c60e" - integrity sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA== - -object.assign@^4.1.4: - version "4.1.4" - resolved "https://registry.yarnpkg.com/object.assign/-/object.assign-4.1.4.tgz#9673c7c7c351ab8c4d0b516f4343ebf4dfb7799f" - integrity sha512-1mxKf0e58bvyjSCtKYY4sRe9itRk3PJpquJOjeIkz885CczcI4IvJJDLPS72oowuSh+pBxUFROpX+TU++hxhZQ== - dependencies: - call-bind "^1.0.2" - define-properties "^1.1.4" - has-symbols "^1.0.3" - object-keys "^1.1.1" - -on-finished@2.4.1: - version "2.4.1" - resolved "https://registry.yarnpkg.com/on-finished/-/on-finished-2.4.1.tgz#58c8c44116e54845ad57f14ab10b03533184ac3f" - integrity sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg== - dependencies: - ee-first "1.1.1" - -once@^1.3.0: - version "1.4.0" - resolved "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1" - integrity sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w== - dependencies: - wrappy "1" - -packet-reader@1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/packet-reader/-/packet-reader-1.0.0.tgz#9238e5480dedabacfe1fe3f2771063f164157d74" - integrity sha512-HAKu/fG3HpHFO0AA8WE8q2g+gBJaZ9MG7fcKk+IJPLTGAD6Psw4443l+9DGRbOIh3/aXr7Phy0TjilYivJo5XQ== - -parse5-htmlparser2-tree-adapter@^6.0.0: - version "6.0.1" - resolved "https://registry.yarnpkg.com/parse5-htmlparser2-tree-adapter/-/parse5-htmlparser2-tree-adapter-6.0.1.tgz#2cdf9ad823321140370d4dbf5d3e92c7c8ddc6e6" - integrity sha512-qPuWvbLgvDGilKc5BoicRovlT4MtYT6JfJyBOMDsKoiT+GiuP5qyrPCnR9HcPECIJJmZh5jRndyNThnhhb/vlA== - dependencies: - parse5 "^6.0.1" - -parse5@^5.1.1: - version "5.1.1" - resolved "https://registry.yarnpkg.com/parse5/-/parse5-5.1.1.tgz#f68e4e5ba1852ac2cadc00f4555fff6c2abb6178" - integrity sha512-ugq4DFI0Ptb+WWjAdOK16+u/nHfiIrcE+sh8kZMaM0WllQKLI9rOUq6c2b7cwPkXdzfQESqvoqK6ug7U/Yyzug== - -parse5@^6.0.1: - version "6.0.1" - resolved "https://registry.yarnpkg.com/parse5/-/parse5-6.0.1.tgz#e1a1c085c569b3dc08321184f19a39cc27f7c30b" - integrity sha512-Ofn/CTFzRGTTxwpNEs9PP93gXShHcTq255nzRYSKe8AkVpZY7e1fpmTfOyoIvjP5HG7Z2ZM7VS9PPhQGW2pOpw== - -parseurl@^1.3.3, parseurl@~1.3.3: - version "1.3.3" - resolved "https://registry.yarnpkg.com/parseurl/-/parseurl-1.3.3.tgz#9da19e7bee8d12dff0513ed5b76957793bc2e8d4" - integrity sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ== - -path-is-absolute@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/path-is-absolute/-/path-is-absolute-1.0.1.tgz#174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f" - integrity sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg== - -path-to-regexp@0.1.7: - version "0.1.7" - resolved "https://registry.yarnpkg.com/path-to-regexp/-/path-to-regexp-0.1.7.tgz#df604178005f522f15eb4490e7247a1bfaa67f8c" - integrity sha512-5DFkuoqlv1uYQKxy8omFBeJPQcdoE07Kv2sferDCrAq1ohOU+MSDswDIbnx3YAM60qIOnYa53wBhXW0EbMonrQ== - -pg-cloudflare@^1.1.1: - version "1.1.1" - resolved "https://registry.yarnpkg.com/pg-cloudflare/-/pg-cloudflare-1.1.1.tgz#e6d5833015b170e23ae819e8c5d7eaedb472ca98" - integrity sha512-xWPagP/4B6BgFO+EKz3JONXv3YDgvkbVrGw2mTo3D6tVDQRh1e7cqVGvyR3BE+eQgAvx1XhW/iEASj4/jCWl3Q== - -pg-connection-string@^2.6.2: - version "2.6.2" - resolved "https://registry.yarnpkg.com/pg-connection-string/-/pg-connection-string-2.6.2.tgz#713d82053de4e2bd166fab70cd4f26ad36aab475" - integrity sha512-ch6OwaeaPYcova4kKZ15sbJ2hKb/VP48ZD2gE7i1J+L4MspCtBMAx8nMgz7bksc7IojCIIWuEhHibSMFH8m8oA== - -pg-int8@1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/pg-int8/-/pg-int8-1.0.1.tgz#943bd463bf5b71b4170115f80f8efc9a0c0eb78c" - integrity sha512-WCtabS6t3c8SkpDBUlb1kjOs7l66xsGdKpIPZsg4wR+B3+u9UAum2odSsF9tnvxg80h4ZxLWMy4pRjOsFIqQpw== - -pg-pool@^3.6.1: - version "3.6.1" - resolved "https://registry.yarnpkg.com/pg-pool/-/pg-pool-3.6.1.tgz#5a902eda79a8d7e3c928b77abf776b3cb7d351f7" - integrity sha512-jizsIzhkIitxCGfPRzJn1ZdcosIt3pz9Sh3V01fm1vZnbnCMgmGl5wvGGdNN2EL9Rmb0EcFoCkixH4Pu+sP9Og== - -pg-protocol@^1.6.0: - version "1.6.0" - resolved "https://registry.yarnpkg.com/pg-protocol/-/pg-protocol-1.6.0.tgz#4c91613c0315349363af2084608db843502f8833" - integrity sha512-M+PDm637OY5WM307051+bsDia5Xej6d9IR4GwJse1qA1DIhiKlksvrneZOYQq42OM+spubpcNYEo2FcKQrDk+Q== - -pg-types@^2.1.0: - version "2.2.0" - resolved "https://registry.yarnpkg.com/pg-types/-/pg-types-2.2.0.tgz#2d0250d636454f7cfa3b6ae0382fdfa8063254a3" - integrity sha512-qTAAlrEsl8s4OiEQY69wDvcMIdQN6wdz5ojQiOy6YRMuynxenON0O5oCpJI6lshc6scgAY8qvJ2On/p+CXY0GA== - dependencies: - pg-int8 "1.0.1" - postgres-array "~2.0.0" - postgres-bytea "~1.0.0" - postgres-date "~1.0.4" - postgres-interval "^1.1.0" - -pg@^8.11.0, pg@^8.11.3: - version "8.11.3" - resolved "https://registry.yarnpkg.com/pg/-/pg-8.11.3.tgz#d7db6e3fe268fcedd65b8e4599cda0b8b4bf76cb" - integrity sha512-+9iuvG8QfaaUrrph+kpF24cXkH1YOOUeArRNYIxq1viYHZagBxrTno7cecY1Fa44tJeZvaoG+Djpkc3JwehN5g== - dependencies: - buffer-writer "2.0.0" - packet-reader "1.0.0" - pg-connection-string "^2.6.2" - pg-pool "^3.6.1" - pg-protocol "^1.6.0" - pg-types "^2.1.0" - pgpass "1.x" - optionalDependencies: - pg-cloudflare "^1.1.1" - -pgpass@1.x: - version "1.0.5" - resolved "https://registry.yarnpkg.com/pgpass/-/pgpass-1.0.5.tgz#9b873e4a564bb10fa7a7dbd55312728d422a223d" - integrity sha512-FdW9r/jQZhSeohs1Z3sI1yxFQNFvMcnmfuj4WBMUTxOrAyLMaTcE1aAMBiTlbMNaXvBCQuVi0R7hd8udDSP7ug== - dependencies: - split2 "^4.1.0" - -postgres-array@~2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/postgres-array/-/postgres-array-2.0.0.tgz#48f8fce054fbc69671999329b8834b772652d82e" - integrity sha512-VpZrUqU5A69eQyW2c5CA1jtLecCsN2U/bD6VilrFDWq5+5UIEVO7nazS3TEcHf1zuPYO/sqGvUvW62g86RXZuA== - -postgres-bytea@~1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/postgres-bytea/-/postgres-bytea-1.0.0.tgz#027b533c0aa890e26d172d47cf9ccecc521acd35" - integrity sha512-xy3pmLuQqRBZBXDULy7KbaitYqLcmxigw14Q5sj8QBVLqEwXfeybIKVWiqAXTlcvdvb0+xkOtDbfQMOf4lST1w== - -postgres-date@~1.0.4: - version "1.0.7" - resolved "https://registry.yarnpkg.com/postgres-date/-/postgres-date-1.0.7.tgz#51bc086006005e5061c591cee727f2531bf641a8" - integrity sha512-suDmjLVQg78nMK2UZ454hAG+OAW+HQPZ6n++TNDUX+L0+uUlLywnoxJKDou51Zm+zTCjrCl0Nq6J9C5hP9vK/Q== - -postgres-interval@^1.1.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/postgres-interval/-/postgres-interval-1.2.0.tgz#b460c82cb1587507788819a06aa0fffdb3544695" - integrity sha512-9ZhXKM/rw350N1ovuWHbGxnGh/SNJ4cnxHiM0rxE4VN41wsg8P8zWn9hv/buK00RP4WvlOyr/RBDiptyxVbkZQ== - dependencies: - xtend "^4.0.0" - -prettier@^3.0.3: - version "3.1.0" - resolved "https://registry.yarnpkg.com/prettier/-/prettier-3.1.0.tgz#c6d16474a5f764ea1a4a373c593b779697744d5e" - integrity sha512-TQLvXjq5IAibjh8EpBIkNKxO749UEWABoiIZehEPiY4GNpVdhaFKqSTu+QrlU6D2dPAfubRmtJTi4K4YkQ5eXw== - -prom-client@^14.2.0: - version "14.2.0" - resolved "https://registry.yarnpkg.com/prom-client/-/prom-client-14.2.0.tgz#ca94504e64156f6506574c25fb1c34df7812cf11" - integrity sha512-sF308EhTenb/pDRPakm+WgiN+VdM/T1RaHj1x+MvAuT8UiQP8JmOEbxVqtkbfR4LrvOg5n7ic01kRBDGXjYikA== - dependencies: - tdigest "^0.1.1" - -proxy-addr@~2.0.7: - version "2.0.7" - resolved "https://registry.yarnpkg.com/proxy-addr/-/proxy-addr-2.0.7.tgz#f19fe69ceab311eeb94b42e70e8c2070f9ba1025" - integrity sha512-llQsMLSUDUPT44jdrU/O37qlnifitDP+ZwrmmZcoSKyLKvtZxpyV0n2/bD/N4tBAAZ/gJEdZU7KMraoK1+XYAg== - dependencies: - forwarded "0.2.0" - ipaddr.js "1.9.1" - -qs@6.11.0: - version "6.11.0" - resolved "https://registry.yarnpkg.com/qs/-/qs-6.11.0.tgz#fd0d963446f7a65e1367e01abd85429453f0c37a" - integrity sha512-MvjoMCJwEarSbUYk5O+nmoSzSutSsTwF85zcHPQ9OrlFoZOYIjaqBAJIqIXjptyD5vThxGq52Xu/MaJzRkIk4Q== - dependencies: - side-channel "^1.0.4" - -range-parser@~1.2.1: - version "1.2.1" - resolved "https://registry.yarnpkg.com/range-parser/-/range-parser-1.2.1.tgz#3cf37023d199e1c24d1a55b84800c2f3e6468031" - integrity sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg== - -raw-body@2.5.1: - version "2.5.1" - resolved "https://registry.yarnpkg.com/raw-body/-/raw-body-2.5.1.tgz#fe1b1628b181b700215e5fd42389f98b71392857" - integrity sha512-qqJBtEyVgS0ZmPGdCFPWJ3FreoqvG4MVQln/kCgF7Olq95IbOp0/BWyMwbdtn4VTvkM8Y7khCQ2Xgk/tcrCXig== - dependencies: - bytes "3.1.2" - http-errors "2.0.0" - iconv-lite "0.4.24" - unpipe "1.0.0" - -raw-body@2.5.2: - version "2.5.2" - resolved "https://registry.yarnpkg.com/raw-body/-/raw-body-2.5.2.tgz#99febd83b90e08975087e8f1f9419a149366b68a" - integrity sha512-8zGqypfENjCIqGhgXToC8aB2r7YrBX+AQAfIPs/Mlk+BtPTztOvTS01NRW/3Eh60J+a48lt8qsCzirQ6loCVfA== - dependencies: - bytes "3.1.2" - http-errors "2.0.0" - iconv-lite "0.4.24" - unpipe "1.0.0" - -redis-errors@^1.0.0, redis-errors@^1.2.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/redis-errors/-/redis-errors-1.2.0.tgz#eb62d2adb15e4eaf4610c04afe1529384250abad" - integrity sha512-1qny3OExCf0UvUV/5wpYKf2YwPcOqXzkwKKSmKHiE6ZMQs5heeE/c8eXK+PNllPvmjgAbfnsbpkGZWy8cBpn9w== - -redis-parser@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/redis-parser/-/redis-parser-3.0.0.tgz#b66d828cdcafe6b4b8a428a7def4c6bcac31c8b4" - integrity sha512-DJnGAeenTdpMEH6uAJRK/uiyEIH9WVsUmoLwzudwGJUwZPp80PDBWPHXSAGNPwNvIXAbe7MSUB1zQFugFml66A== - dependencies: - redis-errors "^1.0.0" - -reflect-metadata@^0.1.13: - version "0.1.13" - resolved "https://registry.yarnpkg.com/reflect-metadata/-/reflect-metadata-0.1.13.tgz#67ae3ca57c972a2aa1642b10fe363fe32d49dc08" - integrity sha512-Ts1Y/anZELhSsjMcU605fU9RE4Oi3p5ORujwbIKXfWa+0Zxs510Qrmrce5/Jowq3cHSZSJqBjypxmHarc+vEWg== - -regenerator-runtime@^0.14.0: - version "0.14.0" - resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.14.0.tgz#5e19d68eb12d486f797e15a3c6a918f7cec5eb45" - integrity sha512-srw17NI0TUWHuGa5CFGGmhfNIeja30WMBfbslPNhf6JrqQlLN5gcrvig1oqPxiVaXb0oW0XRKtH6Nngs5lKCIA== - -regexp.prototype.flags@^1.5.1: - version "1.5.1" - resolved "https://registry.yarnpkg.com/regexp.prototype.flags/-/regexp.prototype.flags-1.5.1.tgz#90ce989138db209f81492edd734183ce99f9677e" - integrity sha512-sy6TXMN+hnP/wMy+ISxg3krXx7BAtWVO4UouuCN/ziM9UEne0euamVNafDfvC83bRNr95y0V5iijeDQFUNpvrg== - dependencies: - call-bind "^1.0.2" - define-properties "^1.2.0" - set-function-name "^2.0.0" - -require-directory@^2.1.1: - version "2.1.1" - resolved "https://registry.yarnpkg.com/require-directory/-/require-directory-2.1.1.tgz#8c64ad5fd30dab1c976e2344ffe7f792a6a6df42" - integrity sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q== - -retry@0.13.1: - version "0.13.1" - resolved "https://registry.yarnpkg.com/retry/-/retry-0.13.1.tgz#185b1587acf67919d63b357349e03537b2484658" - integrity sha512-XQBQ3I8W1Cge0Seh+6gjj03LbmRFWuoszgK9ooCpwYIrhhoO80pfq4cUkU5DkknwfOfFteRwlZ56PYOGYyFWdg== - -safe-buffer@5.2.1, safe-buffer@^5.0.1: - version "5.2.1" - resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.2.1.tgz#1eaf9fa9bdb1fdd4ec75f58f9cdb4e6b7827eec6" - integrity sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ== - -"safer-buffer@>= 2.1.2 < 3": - version "2.1.2" - resolved "https://registry.yarnpkg.com/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a" - integrity sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg== - -semver@^7.3.4: - version "7.5.4" - resolved "https://registry.yarnpkg.com/semver/-/semver-7.5.4.tgz#483986ec4ed38e1c6c48c34894a9182dbff68a6e" - integrity sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA== - dependencies: - lru-cache "^6.0.0" - -send@0.18.0: - version "0.18.0" - resolved "https://registry.yarnpkg.com/send/-/send-0.18.0.tgz#670167cc654b05f5aa4a767f9113bb371bc706be" - integrity sha512-qqWzuOjSFOuqPjFe4NOsMLafToQQwBSOEpS+FwEt3A2V3vKubTquT3vmLTQpFgMXp8AlFWFuP1qKaJZOtPpVXg== - dependencies: - debug "2.6.9" - depd "2.0.0" - destroy "1.2.0" - encodeurl "~1.0.2" - escape-html "~1.0.3" - etag "~1.8.1" - fresh "0.5.2" - http-errors "2.0.0" - mime "1.6.0" - ms "2.1.3" - on-finished "2.4.1" - range-parser "~1.2.1" - statuses "2.0.1" - -serve-static@1.15.0: - version "1.15.0" - resolved "https://registry.yarnpkg.com/serve-static/-/serve-static-1.15.0.tgz#faaef08cffe0a1a62f60cad0c4e513cff0ac9540" - integrity sha512-XGuRDNjXUijsUL0vl6nSD7cwURuzEgglbOaFuZM9g3kwDXOWVTck0jLzjPzGD+TazWbboZYu52/9/XPdUgne9g== - dependencies: - encodeurl "~1.0.2" - escape-html "~1.0.3" - parseurl "~1.3.3" - send "0.18.0" - -set-function-length@^1.1.1: - version "1.1.1" - resolved "https://registry.yarnpkg.com/set-function-length/-/set-function-length-1.1.1.tgz#4bc39fafb0307224a33e106a7d35ca1218d659ed" - integrity sha512-VoaqjbBJKiWtg4yRcKBQ7g7wnGnLV3M8oLvVWwOk2PdYY6PEFegR1vezXR0tw6fZGF9csVakIRjrJiy2veSBFQ== - dependencies: - define-data-property "^1.1.1" - get-intrinsic "^1.2.1" - gopd "^1.0.1" - has-property-descriptors "^1.0.0" - -set-function-name@^2.0.0: - version "2.0.1" - resolved "https://registry.yarnpkg.com/set-function-name/-/set-function-name-2.0.1.tgz#12ce38b7954310b9f61faa12701620a0c882793a" - integrity sha512-tMNCiqYVkXIZgc2Hnoy2IvC/f8ezc5koaRFkCjrpWzGpCd3qbZXPzVy9MAZzK1ch/X0jvSkojys3oqJN0qCmdA== - dependencies: - define-data-property "^1.0.1" - functions-have-names "^1.2.3" - has-property-descriptors "^1.0.0" - -setprototypeof@1.2.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/setprototypeof/-/setprototypeof-1.2.0.tgz#66c9a24a73f9fc28cbe66b09fed3d33dcaf1b424" - integrity sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw== - -sha.js@^2.4.11: - version "2.4.11" - resolved "https://registry.yarnpkg.com/sha.js/-/sha.js-2.4.11.tgz#37a5cf0b81ecbc6943de109ba2960d1b26584ae7" - integrity sha512-QMEp5B7cftE7APOjk5Y6xgrbWu+WkLVQwk8JNjZ8nKRciZaByEW6MubieAiToS7+dwvrjGhH8jRXz3MVd0AYqQ== - dependencies: - inherits "^2.0.1" - safe-buffer "^5.0.1" - -side-channel@^1.0.4: - version "1.0.4" - resolved "https://registry.yarnpkg.com/side-channel/-/side-channel-1.0.4.tgz#efce5c8fdc104ee751b25c58d4290011fa5ea2cf" - integrity sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw== - dependencies: - call-bind "^1.0.0" - get-intrinsic "^1.0.2" - object-inspect "^1.9.0" - -source-map@^0.5.0: - version "0.5.7" - resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.5.7.tgz#8a039d2d1021d22d1ea14c80d8ea468ba2ef3fcc" - integrity sha512-LbrmJOMUSdEVxIKvdcJzQC+nQhe8FUZQTXQy6+I75skNgn3OoQ0DZA8YnFa7gp8tqtL3KPf1kmo0R5DoApeSGQ== - -split2@^4.1.0: - version "4.2.0" - resolved "https://registry.yarnpkg.com/split2/-/split2-4.2.0.tgz#c9c5920904d148bab0b9f67145f245a86aadbfa4" - integrity sha512-UcjcJOWknrNkF6PLX83qcHM6KHgVKNkV62Y8a5uYDVv9ydGQVwAHMKqHdJje1VTWpljG0WYpCDhrCdAOYH4TWg== - -standard-as-callback@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/standard-as-callback/-/standard-as-callback-2.1.0.tgz#8953fc05359868a77b5b9739a665c5977bb7df45" - integrity sha512-qoRRSyROncaz1z0mvYqIE4lCd9p2R90i6GxW3uZv5ucSu8tU7B5HXUP1gG8pVZsYNVaXjk8ClXHPttLyxAL48A== - -statuses@2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/statuses/-/statuses-2.0.1.tgz#55cb000ccf1d48728bd23c685a063998cf1a1b63" - integrity sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ== - -stop-iteration-iterator@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/stop-iteration-iterator/-/stop-iteration-iterator-1.0.0.tgz#6a60be0b4ee757d1ed5254858ec66b10c49285e4" - integrity sha512-iCGQj+0l0HOdZ2AEeBADlsRC+vsnDsZsbdSiH1yNSjcfKM7fdpCMfqAL/dwF5BLiw/XhRft/Wax6zQbhq2BcjQ== - dependencies: - internal-slot "^1.0.4" - -stoppable@^1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/stoppable/-/stoppable-1.1.0.tgz#32da568e83ea488b08e4d7ea2c3bcc9d75015d5b" - integrity sha512-KXDYZ9dszj6bzvnEMRYvxgeTHU74QBFL54XKtP3nyMuJ81CFYtABZ3bAzL2EdFUaEwJOBOgENyFj3R7oTzDyyw== - -string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3: - version "4.2.3" - resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" - integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== - dependencies: - emoji-regex "^8.0.0" - is-fullwidth-code-point "^3.0.0" - strip-ansi "^6.0.1" - -strip-ansi@^6.0.0, strip-ansi@^6.0.1: - version "6.0.1" - resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" - integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== - dependencies: - ansi-regex "^5.0.1" - -supports-color@^5.3.0: - version "5.5.0" - resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-5.5.0.tgz#e2e69a44ac8772f78a1ec0b35b689df6530efc8f" - integrity sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow== - dependencies: - has-flag "^3.0.0" - -supports-color@^7.1.0: - version "7.2.0" - resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-7.2.0.tgz#1b7dcdcb32b8138801b3e478ba6a51caa89648da" - integrity sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw== - dependencies: - has-flag "^4.0.0" - -supports-color@^8.1.1: - version "8.1.1" - resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-8.1.1.tgz#cd6fc17e28500cff56c1b86c0a7fd4a54a73005c" - integrity sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q== - dependencies: - has-flag "^4.0.0" - -sync-fetch@^0.5.2: - version "0.5.2" - resolved "https://registry.yarnpkg.com/sync-fetch/-/sync-fetch-0.5.2.tgz#65e7ae1133219938dc92eb19aa21d5eb79ebadec" - integrity sha512-6gBqqkHrYvkH65WI2bzrDwrIKmt3U10s4Exnz3dYuE5Ah62FIfNv/F63inrNhu2Nyh3GH5f42GKU3RrSJoaUyQ== - dependencies: - node-fetch "^2.6.1" - -tdigest@^0.1.1: - version "0.1.2" - resolved "https://registry.yarnpkg.com/tdigest/-/tdigest-0.1.2.tgz#96c64bac4ff10746b910b0e23b515794e12faced" - integrity sha512-+G0LLgjjo9BZX2MfdvPfH+MKLCrxlXSYec5DaPYP1fe6Iyhf0/fSmJ0bFiZ1F8BT6cGXl2LpltQptzjXKWEkKA== - dependencies: - bintrees "1.0.2" - -thenify-all@^1.0.0: - version "1.6.0" - resolved "https://registry.yarnpkg.com/thenify-all/-/thenify-all-1.6.0.tgz#1a1918d402d8fc3f98fbf234db0bcc8cc10e9726" - integrity sha512-RNxQH/qI8/t3thXJDwcstUO4zeqo64+Uy/+sNVRBx4Xn2OX+OZ9oP+iJnNFqplFra2ZUVeKCSa2oVWi3T4uVmA== - dependencies: - thenify ">= 3.1.0 < 4" - -"thenify@>= 3.1.0 < 4": - version "3.3.1" - resolved "https://registry.yarnpkg.com/thenify/-/thenify-3.3.1.tgz#8932e686a4066038a016dd9e2ca46add9838a95f" - integrity sha512-RVZSIV5IG10Hk3enotrhvz0T9em6cyHBLkH/YAZuKqd8hRkKhSfCGIcP2KUY0EPxndzANBmNllzWPwak+bheSw== - dependencies: - any-promise "^1.0.0" - -to-fast-properties@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/to-fast-properties/-/to-fast-properties-2.0.0.tgz#dc5e698cbd079265bc73e0377681a4e4e83f616e" - integrity sha512-/OaKK0xYrs3DmxRYqL/yDc+FxFUVYhDlXMhRmv3z915w2HF1tnN1omB354j8VUGO/hbRzyD6Y3sA7v7GS/ceog== - -toidentifier@1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/toidentifier/-/toidentifier-1.0.1.tgz#3be34321a88a820ed1bd80dfaa33e479fbb8dd35" - integrity sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA== - -tr46@~0.0.3: - version "0.0.3" - resolved "https://registry.yarnpkg.com/tr46/-/tr46-0.0.3.tgz#8184fd347dac9cdc185992f3a6622e14b9d9ab6a" - integrity sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw== - -tslib@2.4.0: - version "2.4.0" - resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.4.0.tgz#7cecaa7f073ce680a05847aa77be941098f36dc3" - integrity sha512-d6xOpEDfsi2CZVlPQzGeux8XMwLT9hssAsaPYExaQMuYskwb+x1x7J371tWlbBdWHroy99KnVB6qIkUbs5X3UQ== - -tslib@^2.0.1, tslib@^2.1.0, tslib@^2.4.0, tslib@^2.5.0: - version "2.6.2" - resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.6.2.tgz#703ac29425e7b37cd6fd456e92404d46d1f3e4ae" - integrity sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q== - -type-graphql@^1.2.0-rc.1: - version "1.2.0-rc.1" - resolved "https://registry.yarnpkg.com/type-graphql/-/type-graphql-1.2.0-rc.1.tgz#01f658063a07e4ed90191a8b8f71d824478dd532" - integrity sha512-W1p51DN+n/zX4ilunMC6/FcyGlx/ND3hreQ0ARDhfhyR9oGtfKzQNnkHhk8uXlYm2zzyTEd1LkRHJr8bbnRlIA== - dependencies: - "@types/glob" "^7.1.3" - "@types/node" "^14.14.31" - "@types/semver" "^7.3.4" - glob "^7.1.6" - graphql-query-complexity "^0.7.2" - graphql-subscriptions "^1.2.0" - semver "^7.3.4" - tslib "^2.1.0" - -type-is@~1.6.18: - version "1.6.18" - resolved "https://registry.yarnpkg.com/type-is/-/type-is-1.6.18.tgz#4e552cd05df09467dcbc4ef739de89f2cf37c131" - integrity sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g== - dependencies: - media-typer "0.3.0" - mime-types "~2.1.24" - -type@^1.0.1: - version "1.2.0" - resolved "https://registry.yarnpkg.com/type/-/type-1.2.0.tgz#848dd7698dafa3e54a6c479e759c4bc3f18847a0" - integrity sha512-+5nt5AAniqsCnu2cEQQdpzCAh33kVx8n0VoFidKpB1dVVLAN/F+bgVOqOJqOnEnrhp222clB5p3vUlD+1QAnfg== - -type@^2.7.2: - version "2.7.2" - resolved "https://registry.yarnpkg.com/type/-/type-2.7.2.tgz#2376a15a3a28b1efa0f5350dcf72d24df6ef98d0" - integrity sha512-dzlvlNlt6AXU7EBSfpAscydQ7gXB+pPGsPnfJnZpiNJBDj7IaJzQlBZYGdEi4R9HmPdBv2XmWJ6YUtoTa7lmCw== - -typedarray-to-buffer@^3.1.5: - version "3.1.5" - resolved "https://registry.yarnpkg.com/typedarray-to-buffer/-/typedarray-to-buffer-3.1.5.tgz#a97ee7a9ff42691b9f783ff1bc5112fe3fca9080" - integrity sha512-zdu8XMNEDepKKR+XYOXAVPtWui0ly0NtohUscw+UmaHiAWT8hrV1rr//H6V+0DvJ3OQ19S979M0laLfX8rm82Q== - dependencies: - is-typedarray "^1.0.0" - -typeorm@^0.3.16: - version "0.3.17" - resolved "https://registry.yarnpkg.com/typeorm/-/typeorm-0.3.17.tgz#a73c121a52e4fbe419b596b244777be4e4b57949" - integrity sha512-UDjUEwIQalO9tWw9O2A4GU+sT3oyoUXheHJy4ft+RFdnRdQctdQ34L9SqE2p7LdwzafHx1maxT+bqXON+Qnmig== - dependencies: - "@sqltools/formatter" "^1.2.5" - app-root-path "^3.1.0" - buffer "^6.0.3" - chalk "^4.1.2" - cli-highlight "^2.1.11" - date-fns "^2.29.3" - debug "^4.3.4" - dotenv "^16.0.3" - glob "^8.1.0" - mkdirp "^2.1.3" - reflect-metadata "^0.1.13" - sha.js "^2.4.11" - tslib "^2.5.0" - uuid "^9.0.0" - yargs "^17.6.2" - -typescript@~5.1.3: - version "5.1.6" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.1.6.tgz#02f8ac202b6dad2c0dd5e0913745b47a37998274" - integrity sha512-zaWCozRZ6DLEWAWFrVDz1H6FVXzUSfTy5FUMWsQlU8Ym5JP9eO4xkTIROFCQvhQf61z6O/G6ugw3SgAnvvm+HA== - -undici-types@~5.26.4: - version "5.26.5" - resolved "https://registry.yarnpkg.com/undici-types/-/undici-types-5.26.5.tgz#bcd539893d00b56e964fd2657a4866b221a65617" - integrity sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA== - -unpipe@1.0.0, unpipe@~1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/unpipe/-/unpipe-1.0.0.tgz#b2bf4ee8514aae6165b4817829d21b2ef49904ec" - integrity sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ== - -utf-8-validate@^5.0.2: - version "5.0.10" - resolved "https://registry.yarnpkg.com/utf-8-validate/-/utf-8-validate-5.0.10.tgz#d7d10ea39318171ca982718b6b96a8d2442571a2" - integrity sha512-Z6czzLq4u8fPOyx7TU6X3dvUZVvoJmxSQ+IcrlmagKhilxlhZgxPK6C5Jqbkw1IDUmFTM+cz9QDnnLTwDz/2gQ== - dependencies: - node-gyp-build "^4.3.0" - -utils-merge@1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/utils-merge/-/utils-merge-1.0.1.tgz#9f95710f50a267947b2ccc124741c1028427e713" - integrity sha512-pMZTvIkT1d+TFGvDOqodOclx0QWkkgi6Tdoa8gC8ffGAAqz9pzPTZWAybbsHHoED/ztMtkv/VoYTYyShUn81hA== - -uuid@^9.0.0: - version "9.0.1" - resolved "https://registry.yarnpkg.com/uuid/-/uuid-9.0.1.tgz#e188d4c8853cc722220392c424cd637f32293f30" - integrity sha512-b+1eJOlsR9K8HJpow9Ok3fiWOWSIcIzXodvv0rQjVoOVNpWMpxf1wZNpt4y9h10odCNrqnYp1OBzRktckBe3sA== - -value-or-promise@1.0.11: - version "1.0.11" - resolved "https://registry.yarnpkg.com/value-or-promise/-/value-or-promise-1.0.11.tgz#3e90299af31dd014fe843fe309cefa7c1d94b140" - integrity sha512-41BrgH+dIbCFXClcSapVs5M6GkENd3gQOJpEfPDNa71LsUGMXDL0jMWpI/Rh7WhX+Aalfz2TTS3Zt5pUsbnhLg== - -value-or-promise@^1.0.12: - version "1.0.12" - resolved "https://registry.yarnpkg.com/value-or-promise/-/value-or-promise-1.0.12.tgz#0e5abfeec70148c78460a849f6b003ea7986f15c" - integrity sha512-Z6Uz+TYwEqE7ZN50gwn+1LCVo9ZVrpxRPOhOLnncYkY1ZzOYtrX8Fwf/rFktZ8R5mJms6EZf5TqNOMeZmnPq9Q== - -vary@^1, vary@~1.1.2: - version "1.1.2" - resolved "https://registry.yarnpkg.com/vary/-/vary-1.1.2.tgz#2299f02c6ded30d4a5961b0b9f74524a18f634fc" - integrity sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg== - -viem@^1.10.13: - version "1.19.3" - resolved "https://registry.yarnpkg.com/viem/-/viem-1.19.3.tgz#896443d4f68005d68b9a1b5b61370ceb7bdf913b" - integrity sha512-SymIbCO0nIq2ucna8R3XV4f/lEshKGLuhYU2f6O+OAbmE2ugBxBKx2axMKQrQML87nE0jb2qqqtRJka5SO/7MA== - dependencies: - "@adraffy/ens-normalize" "1.10.0" - "@noble/curves" "1.2.0" - "@noble/hashes" "1.3.2" - "@scure/bip32" "1.3.2" - "@scure/bip39" "1.2.1" - abitype "0.9.8" - isows "1.0.3" - ws "8.13.0" - -wcwidth@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/wcwidth/-/wcwidth-1.0.1.tgz#f0b0dcf915bc5ff1528afadb2c0e17b532da2fe8" - integrity sha512-XHPEwS0q6TaxcvG85+8EYkbiCux2XtWG2mkc47Ng2A77BQu9+DqIOJldST4HgPkuea7dvKSj5VgX3P1d4rW8Tg== - dependencies: - defaults "^1.0.3" - -web-streams-polyfill@^3.0.3: - version "3.2.1" - resolved "https://registry.yarnpkg.com/web-streams-polyfill/-/web-streams-polyfill-3.2.1.tgz#71c2718c52b45fd49dbeee88634b3a60ceab42a6" - integrity sha512-e0MO3wdXWKrLbL0DgGnUV7WHVuw9OUvL4hjgnPkIeEvESk74gAITi5G606JtZPp39cd8HA9VQzCIvA49LpPN5Q== - -webidl-conversions@^3.0.0: - version "3.0.1" - resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-3.0.1.tgz#24534275e2a7bc6be7bc86611cc16ae0a5654871" - integrity sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ== - -websocket@^1.0.34: - version "1.0.34" - resolved "https://registry.yarnpkg.com/websocket/-/websocket-1.0.34.tgz#2bdc2602c08bf2c82253b730655c0ef7dcab3111" - integrity sha512-PRDso2sGwF6kM75QykIesBijKSVceR6jL2G8NGYyq2XrItNC2P5/qL5XeR056GhA+Ly7JMFvJb9I312mJfmqnQ== - dependencies: - bufferutil "^4.0.1" - debug "^2.2.0" - es5-ext "^0.10.50" - typedarray-to-buffer "^3.1.5" - utf-8-validate "^5.0.2" - yaeti "^0.0.6" - -whatwg-mimetype@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/whatwg-mimetype/-/whatwg-mimetype-3.0.0.tgz#5fa1a7623867ff1af6ca3dc72ad6b8a4208beba7" - integrity sha512-nt+N2dzIutVRxARx1nghPKGv1xHikU7HKdfafKkLNLindmPU/ch3U31NOCGGA/dmPcmb1VlofO0vnKAcsm0o/Q== - -whatwg-url@^5.0.0: - version "5.0.0" - resolved "https://registry.yarnpkg.com/whatwg-url/-/whatwg-url-5.0.0.tgz#966454e8765462e37644d3626f6742ce8b70965d" - integrity sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw== - dependencies: - tr46 "~0.0.3" - webidl-conversions "^3.0.0" - -which-boxed-primitive@^1.0.2: - version "1.0.2" - resolved "https://registry.yarnpkg.com/which-boxed-primitive/-/which-boxed-primitive-1.0.2.tgz#13757bc89b209b049fe5d86430e21cf40a89a8e6" - integrity sha512-bwZdv0AKLpplFY2KZRX6TvyuN7ojjr7lwkg6ml0roIy9YeuSr7JS372qlNW18UQYzgYK9ziGcerWqZOmEn9VNg== - dependencies: - is-bigint "^1.0.1" - is-boolean-object "^1.1.0" - is-number-object "^1.0.4" - is-string "^1.0.5" - is-symbol "^1.0.3" - -which-collection@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/which-collection/-/which-collection-1.0.1.tgz#70eab71ebbbd2aefaf32f917082fc62cdcb70906" - integrity sha512-W8xeTUwaln8i3K/cY1nGXzdnVZlidBcagyNFtBdD5kxnb4TvGKR7FfSIS3mYpwWS1QUCutfKz8IY8RjftB0+1A== - dependencies: - is-map "^2.0.1" - is-set "^2.0.1" - is-weakmap "^2.0.1" - is-weakset "^2.0.1" - -which-typed-array@^1.1.11, which-typed-array@^1.1.13: - version "1.1.13" - resolved "https://registry.yarnpkg.com/which-typed-array/-/which-typed-array-1.1.13.tgz#870cd5be06ddb616f504e7b039c4c24898184d36" - integrity sha512-P5Nra0qjSncduVPEAr7xhoF5guty49ArDTwzJ/yNuPIbZppyRxFQsRCWrocxIY+CnMVG+qfbU2FmDKyvSGClow== - dependencies: - available-typed-arrays "^1.0.5" - call-bind "^1.0.4" - for-each "^0.3.3" - gopd "^1.0.1" - has-tostringtag "^1.0.0" - -wrap-ansi@^7.0.0: - version "7.0.0" - resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43" - integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q== - dependencies: - ansi-styles "^4.0.0" - string-width "^4.1.0" - strip-ansi "^6.0.0" - -wrappy@1: - version "1.0.2" - resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f" - integrity sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ== - -ws@8.13.0: - version "8.13.0" - resolved "https://registry.yarnpkg.com/ws/-/ws-8.13.0.tgz#9a9fb92f93cf41512a0735c8f4dd09b8a1211cd0" - integrity sha512-x9vcZYTrFPC7aSIbj7sRCYo7L/Xb8Iy+pW0ng0wt2vCJv7M9HOMy0UoN3rr+IFC7hb7vXoqS+P9ktyLLLhO+LA== - -ws@8.5.0: - version "8.5.0" - resolved "https://registry.yarnpkg.com/ws/-/ws-8.5.0.tgz#bfb4be96600757fe5382de12c670dab984a1ed4f" - integrity sha512-BWX0SWVgLPzYwF8lTzEy1egjhS4S4OEAHfsO8o65WOVsrnSRGaSiUaa9e0ggGlkMTtBlmOpEXiie9RUcBO86qg== - -ws@^8.14.2: - version "8.14.2" - resolved "https://registry.yarnpkg.com/ws/-/ws-8.14.2.tgz#6c249a806eb2db7a20d26d51e7709eab7b2e6c7f" - integrity sha512-wEBG1ftX4jcglPxgFCMJmZ2PLtSbJ2Peg6TmpJFTbe9GZYOQCDPdMYu/Tm0/bGZkw8paZnJY45J4K2PZrLYq8g== - -xss@^1.0.8: - version "1.0.14" - resolved "https://registry.yarnpkg.com/xss/-/xss-1.0.14.tgz#4f3efbde75ad0d82e9921cc3c95e6590dd336694" - integrity sha512-og7TEJhXvn1a7kzZGQ7ETjdQVS2UfZyTlsEdDOqvQF7GoxNfY+0YLCzBy1kPdsDDx4QuNAonQPddpsn6Xl/7sw== - dependencies: - commander "^2.20.3" - cssfilter "0.0.10" - -xtend@^4.0.0: - version "4.0.2" - resolved "https://registry.yarnpkg.com/xtend/-/xtend-4.0.2.tgz#bb72779f5fa465186b1f438f674fa347fdb5db54" - integrity sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ== - -y18n@^5.0.5: - version "5.0.8" - resolved "https://registry.yarnpkg.com/y18n/-/y18n-5.0.8.tgz#7f4934d0f7ca8c56f95314939ddcd2dd91ce1d55" - integrity sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA== - -yaeti@^0.0.6: - version "0.0.6" - resolved "https://registry.yarnpkg.com/yaeti/-/yaeti-0.0.6.tgz#f26f484d72684cf42bedfb76970aa1608fbf9577" - integrity sha512-MvQa//+KcZCUkBTIC9blM+CU9J2GzuTytsOUwf2lidtvkx/6gnEp1QvJv34t9vdjhFmha/mUiNDbN0D0mJWdug== - -yallist@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/yallist/-/yallist-4.0.0.tgz#9bb92790d9c0effec63be73519e11a35019a3a72" - integrity sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A== - -yargs-parser@^20.2.2: - version "20.2.9" - resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-20.2.9.tgz#2eb7dc3b0289718fc295f362753845c41a0c94ee" - integrity sha512-y11nGElTIV+CT3Zv9t7VKl+Q3hTQoT9a1Qzezhhl6Rp21gJ/IVTW7Z3y9EWXhuUBC2Shnf+DX0antecpAwSP8w== - -yargs-parser@^21.1.1: - version "21.1.1" - resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-21.1.1.tgz#9096bceebf990d21bb31fa9516e0ede294a77d35" - integrity sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw== - -yargs@^16.0.0: - version "16.2.0" - resolved "https://registry.yarnpkg.com/yargs/-/yargs-16.2.0.tgz#1c82bf0f6b6a66eafce7ef30e376f49a12477f66" - integrity sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw== - dependencies: - cliui "^7.0.2" - escalade "^3.1.1" - get-caller-file "^2.0.5" - require-directory "^2.1.1" - string-width "^4.2.0" - y18n "^5.0.5" - yargs-parser "^20.2.2" - -yargs@^17.6.2: - version "17.7.2" - resolved "https://registry.yarnpkg.com/yargs/-/yargs-17.7.2.tgz#991df39aca675a192b816e1e0363f9d75d2aa269" - integrity sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w== - dependencies: - cliui "^8.0.1" - escalade "^3.1.1" - get-caller-file "^2.0.5" - require-directory "^2.1.1" - string-width "^4.2.3" - y18n "^5.0.5" - yargs-parser "^21.1.1" From 2e324e1d0089529a75b1ccf94d1e0ef44ba0261a Mon Sep 17 00:00:00 2001 From: Chris Jacobs Date: Tue, 21 Nov 2023 10:31:31 -0800 Subject: [PATCH 33/34] fix issues seen trying to deploy v11 --- commands.json | 11 +++++++++++ squid.yaml | 8 ++++---- src/utils/activityFromTx.ts | 22 ++++++---------------- 3 files changed, 21 insertions(+), 20 deletions(-) diff --git a/commands.json b/commands.json index a59465bc..cb3a6a93 100644 --- a/commands.json +++ b/commands.json @@ -170,6 +170,17 @@ ], "hidden": true }, + "process:ogv:prod": { + "description": "Start the squid processor", + "deps": [ + "migration:apply" + ], + "cmd": [ + "node", + "lib/main-ogv.js" + ], + "hidden": true + }, "process:other:prod": { "description": "Start the squid processor", "deps": [ diff --git a/squid.yaml b/squid.yaml index b276aa31..3b452f77 100644 --- a/squid.yaml +++ b/squid.yaml @@ -15,19 +15,19 @@ deploy: # RPC_ENV: RPC_ENDPOINT_999 ################################ - name: oeth-processor - cmd: [ "node", "lib/main-oeth" ] + cmd: [ "sqd", "process:oeth:prod" ] env: RPC_ENV: RPC_ENDPOINT_999 - name: ousd-processor - cmd: [ "node", "lib/main-ousd" ] + cmd: [ "sqd", "process:ousd:prod" ] env: RPC_ENV: RPC_ENDPOINT_999 - name: ogv-processor - cmd: [ "node", "lib/main-ogv" ] + cmd: [ "sqd", "process:ogv:prod" ] env: RPC_ENV: RPC_ENDPOINT_999 - name: other-processor - cmd: [ "node", "lib/main-other" ] + cmd: [ "sqd", "process:other:prod" ] env: RPC_ENV: RPC_ENDPOINT_999 api: diff --git a/src/utils/activityFromTx.ts b/src/utils/activityFromTx.ts index d42abcb2..ee63951a 100644 --- a/src/utils/activityFromTx.ts +++ b/src/utils/activityFromTx.ts @@ -276,22 +276,12 @@ export async function activityFromTx( } function decodeOethZapperTx(transaction: Transaction) { - try { - const data = decodeFunctionData({ - abi: oethZapperAbi.ABI_JSON, - data: transaction.input as '0x${string}', - }) - - return { - callDataLast4Bytes: transaction?.input.slice(-8), - exchange: 'OETHZapper', - action: 'Swap', - fromSymbol: 'ETH', - toSymbol: 'OETH', - } - } catch (e) { - console.log('Error decoding OETHZapper tx', e) - return + return { + callDataLast4Bytes: transaction?.input.slice(-8), + exchange: 'OETHZapper', + action: 'Swap', + fromSymbol: 'ETH', + toSymbol: 'OETH', } } From f2869e4880920e250b2badfdfc4f427fd1c007e1 Mon Sep 17 00:00:00 2001 From: Chris Jacobs Date: Tue, 21 Nov 2023 10:57:09 -0800 Subject: [PATCH 34/34] fix decode event log errors --- src/utils/activityFromTx.ts | 144 ++++++++++++++++++++---------------- 1 file changed, 80 insertions(+), 64 deletions(-) diff --git a/src/utils/activityFromTx.ts b/src/utils/activityFromTx.ts index ee63951a..e969ecc1 100644 --- a/src/utils/activityFromTx.ts +++ b/src/utils/activityFromTx.ts @@ -1,3 +1,4 @@ +import { compact } from 'lodash' import { GetTransactionReceiptReturnType, decodeEventLog, @@ -27,6 +28,14 @@ const WrappedOETHAbi = parseAbi([ 'event Withdraw(address indexed caller, address indexed receiver, address indexed owner, uint256 assets, uint256 shares)', ]) +const tryDecodeEventLog = (...params: Parameters) => { + try { + return decodeEventLog(...params) + } catch (err: unknown) { + return undefined + } +} + export interface Transaction { to: string from: string @@ -54,17 +63,19 @@ export async function activityFromTx( const activity = [] if (!transaction) return - const curveEvents = logs - .filter((l) => - addressEq(l.address, '0x94B17476A93b3262d87B9a326965D1E91f9c13E7'), - ) - .map((log) => { - return decodeEventLog({ - abi: curveLpAbi.ABI_JSON, - data: log.data, - topics: log.topics, - }) - }) + const curveEvents = compact( + logs + .filter((l) => + addressEq(l.address, '0x94B17476A93b3262d87B9a326965D1E91f9c13E7'), + ) + .map((log) => + tryDecodeEventLog({ + abi: curveLpAbi.ABI_JSON, + data: log.data, + topics: log.topics, + }), + ), + ) const sansGnosisSafeEvents = logs.filter(({ data, topics }) => { try { @@ -80,71 +91,76 @@ export async function activityFromTx( } }) - const oethEvents = logs - .filter((l) => l.address === OETH_ADDRESS) - .map((log) => { - return decodeEventLog({ - abi: oethAbi.ABI_JSON, - data: log.data, - topics: log.topics, - }) - }) + const oethEvents = compact( + logs + .filter((l) => l.address === OETH_ADDRESS) + .map((log) => { + return tryDecodeEventLog({ + abi: oethAbi.ABI_JSON, + data: log.data, + topics: log.topics, + }) + }), + ) - const balancerVaultEvents = logs - .filter((l) => - addressEq(l.address, '0xBA12222222228d8Ba445958a75a0704d566BF2C8'), - ) - .map((log) => { - return decodeEventLog({ - abi: balancerVaultAbi.ABI_JSON, - data: log.data, - topics: log.topics, - }) - }) + const balancerVaultEvents = compact( + logs + .filter((l) => + addressEq(l.address, '0xBA12222222228d8Ba445958a75a0704d566BF2C8'), + ) + .map((log) => { + return tryDecodeEventLog({ + abi: balancerVaultAbi.ABI_JSON, + data: log.data, + topics: log.topics, + }) + }), + ) - const oethVaultEvents = logs - .filter((l) => l.address === OETH_VAULT_ADDRESS) - .map((log) => { - return decodeEventLog({ - abi: oethVaultAbi.ABI_JSON, - data: log.data, - topics: log.topics, - }) - }) + const oethVaultEvents = compact( + logs + .filter((l) => l.address === OETH_VAULT_ADDRESS) + .map((log) => { + return tryDecodeEventLog({ + abi: oethVaultAbi.ABI_JSON, + data: log.data, + topics: log.topics, + }) + }), + ) - const woethEvents = logs - .filter((l) => - addressEq(l.address, '0xdcee70654261af21c44c093c300ed3bb97b78192'), - ) - .map(({ data, topics }) => { - try { - return decodeEventLog({ abi: WrappedOETHAbi, data, topics }) - } catch (e) { - /* Ignore */ - } - }) - .filter(Boolean) + const woethEvents = compact( + logs + .filter((l) => + addressEq(l.address, '0xdcee70654261af21c44c093c300ed3bb97b78192'), + ) + .map(({ data, topics }) => + tryDecodeEventLog({ abi: WrappedOETHAbi, data, topics }), + ), + ) const oneInchEvents = logs.filter((l) => addressEq(l.address, '0x1111111254eeb25477b68fb85ed929f73a960582'), ) - const uniswapWethEvents = logs - .filter((l) => - addressEq(l.address, '0x52299416c469843f4e0d54688099966a6c7d720f'), - ) - .map((log) => - decodeEventLog({ - abi: UniswapV3SwapAbi, - data: log.data, - topics: log.topics, - }), - ) + const uniswapWethEvents = compact( + logs + .filter((l) => + addressEq(l.address, '0x52299416c469843f4e0d54688099966a6c7d720f'), + ) + .map((log) => + tryDecodeEventLog({ + abi: UniswapV3SwapAbi, + data: log.data, + topics: log.topics, + }), + ), + ) const frxEthOETHCurvePoolEvents = logs.filter((l) => addressEq(l.address, '0xfa0bbb0a5815f6648241c9221027b70914dd8949'), ) - const oethTransfers = oethEvents.filter( + const oethTransfers = compact(oethEvents).filter( (log) => log.eventName === 'Transfer', ) as Transfer[]