From 73bef775ab2f12afd4f3c3529a33690c6943e102 Mon Sep 17 00:00:00 2001 From: Chris Jacobs Date: Mon, 22 Apr 2024 21:01:55 -0700 Subject: [PATCH 01/12] common otoken schema - first pass, functional --- ...70460723-Data.js => 1713829315031-Data.js} | 234 ++++++++---------- schema-oeth.graphql | 112 +-------- schema-otoken.graphql | 113 ++++++++- schema-ousd.graphql | 110 -------- schema.graphql | 224 +++++------------ src/main-oeth.ts | 2 +- src/main-ousd.ts | 2 +- src/main.ts | 9 +- src/model/generated/index.ts | 28 +-- .../{oeth.model.ts => oToken.model.ts} | 15 +- ...ivity.model.ts => oTokenActivity.model.ts} | 12 +- ...ddress.model.ts => oTokenAddress.model.ts} | 27 +- .../{oethapy.model.ts => oTokenApy.model.ts} | 19 +- ...ethAsset.model.ts => oTokenAsset.model.ts} | 12 +- ...istory.model.ts => oTokenHistory.model.ts} | 23 +- ...dRebase.model.ts => oTokenRebase.model.ts} | 21 +- ...n.model.ts => oTokenRebaseOption.model.ts} | 21 +- src/model/generated/oTokenVault.model.ts | 12 +- src/model/generated/oethAddress.model.ts | 38 --- src/model/generated/oethRebase.model.ts | 53 ---- src/model/generated/oethRebaseOption.model.ts | 35 --- src/model/generated/ousd.model.ts | 32 --- src/model/generated/ousdActivity.model.ts | 51 ---- src/model/generated/ousdAsset.model.ts | 18 -- src/model/generated/ousdHistory.model.ts | 41 --- src/model/generated/ousdapy.model.ts | 45 ---- .../daily-stats/daily-stats.ts | 47 ++-- src/oeth/processors/oeth.ts | 24 +- .../validators/validate-oeth/validate-oeth.ts | 142 ++++++++--- .../daily-stats/daily-stats.ts | 45 ++-- src/ousd/processors/ousd/ousd.ts | 22 +- src/templates/otoken/otoken.ts | 189 +++++++------- src/templates/otoken/utils.ts | 72 +++--- src/utils/utils.ts | 27 +- 34 files changed, 712 insertions(+), 1165 deletions(-) rename db/migrations/{1713570460723-Data.js => 1713829315031-Data.js} (74%) rename src/model/generated/{oeth.model.ts => oToken.model.ts} (77%) rename src/model/generated/{oethActivity.model.ts => oTokenActivity.model.ts} (84%) rename src/model/generated/{ousdAddress.model.ts => oTokenAddress.model.ts} (60%) rename src/model/generated/{oethapy.model.ts => oTokenApy.model.ts} (79%) rename src/model/generated/{oethAsset.model.ts => oTokenAsset.model.ts} (60%) rename src/model/generated/{oethHistory.model.ts => oTokenHistory.model.ts} (64%) rename src/model/generated/{ousdRebase.model.ts => oTokenRebase.model.ts} (79%) rename src/model/generated/{ousdRebaseOption.model.ts => oTokenRebaseOption.model.ts} (62%) delete mode 100644 src/model/generated/oethAddress.model.ts delete mode 100644 src/model/generated/oethRebase.model.ts delete mode 100644 src/model/generated/oethRebaseOption.model.ts delete mode 100644 src/model/generated/ousd.model.ts delete mode 100644 src/model/generated/ousdActivity.model.ts delete mode 100644 src/model/generated/ousdAsset.model.ts delete mode 100644 src/model/generated/ousdHistory.model.ts delete mode 100644 src/model/generated/ousdapy.model.ts diff --git a/db/migrations/1713570460723-Data.js b/db/migrations/1713829315031-Data.js similarity index 74% rename from db/migrations/1713570460723-Data.js rename to db/migrations/1713829315031-Data.js index 09c25ae7..24132692 100644 --- a/db/migrations/1713570460723-Data.js +++ b/db/migrations/1713829315031-Data.js @@ -1,5 +1,5 @@ -module.exports = class Data1713570460723 { - name = 'Data1713570460723' +module.exports = class Data1713829315031 { + name = 'Data1713829315031' async up(db) { await db.query(`CREATE TABLE "processing_status" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, CONSTRAINT "PK_85f5e2467b74fb70fac1a053021" PRIMARY KEY ("id"))`) @@ -73,30 +73,6 @@ module.exports = class Data1713570460723 { await db.query(`CREATE INDEX "IDX_374659ae3bd149042388e132be" ON "bridge_transfer_state" ("timestamp") `) await db.query(`CREATE INDEX "IDX_74f93b10ec560e63792dcc877e" ON "bridge_transfer_state" ("block_number") `) await db.query(`CREATE INDEX "IDX_df99bdbf11d4ed57bec0e6c511" ON "bridge_transfer_state" ("tx_hash") `) - 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_asset" ("id" character varying NOT NULL, "address" text NOT NULL, "symbol" text NOT NULL, CONSTRAINT "PK_f0ebfe57d2f74a0fca11e941a66" PRIMARY KEY ("id"))`) - await db.query(`CREATE INDEX "IDX_40f03cb689691cad447873174e" ON "oeth_asset" ("address") `) - 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_eth" numeric NOT NULL, "fee_usd" numeric NOT NULL, "yield_eth" numeric NOT NULL, "yield_usd" 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") `) @@ -127,10 +103,6 @@ module.exports = class Data1713570460723 { 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 "oeth_activity" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "tx_hash" text NOT NULL, "call_data_last4_bytes" text NOT NULL, "address" text, "sighash" text, "action" text, "exchange" text, "interface" text, "from_symbol" text, "to_symbol" text, "amount" numeric, CONSTRAINT "PK_8938e7a05e2377cb6dc46e6980c" PRIMARY KEY ("id"))`) - await db.query(`CREATE INDEX "IDX_701369d638018e8f191b7c048d" ON "oeth_activity" ("timestamp") `) - await db.query(`CREATE INDEX "IDX_e3037b99481023edd17b98cd78" ON "oeth_activity" ("block_number") `) - await db.query(`CREATE INDEX "IDX_6537c67233447c5152bc7318f8" ON "oeth_activity" ("tx_hash") `) 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") `) @@ -151,35 +123,58 @@ module.exports = class Data1713570460723 { await db.query(`CREATE TABLE "ogv_daily_stat" ("id" character varying NOT NULL, "block_number" integer NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "total_supply" numeric NOT NULL, "total_supply_usd" numeric NOT NULL, "total_staked" numeric NOT NULL, "trading_volume_usd" numeric NOT NULL, "market_cap_usd" numeric NOT NULL, "price_usd" numeric NOT NULL, "holders_over_threshold" integer NOT NULL, CONSTRAINT "PK_69bc6d866711151e2712481794c" PRIMARY KEY ("id"))`) await db.query(`CREATE INDEX "IDX_c974bde87107cacae6d3654972" ON "ogv_daily_stat" ("block_number") `) await db.query(`CREATE INDEX "IDX_b62fa80951183bb0acf8a5e8b9" ON "ogv_daily_stat" ("timestamp") `) - await db.query(`CREATE TABLE "o_token_vault" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "chain_id" integer NOT NULL, "address" text NOT NULL, "total_value" numeric NOT NULL, CONSTRAINT "PK_90bb3a4df699017439cd6a44a0c" PRIMARY KEY ("id"))`) + await db.query(`CREATE TABLE "o_token" ("id" character varying NOT NULL, "chain_id" integer NOT NULL, "otoken" text 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_4450ef96d5e51ef55bc8ea0b53e" PRIMARY KEY ("id"))`) + await db.query(`CREATE INDEX "IDX_1da06ba7d2c0a02d01d1b7a6c0" ON "o_token" ("chain_id") `) + await db.query(`CREATE INDEX "IDX_0851d95d178f682d279a04ebf9" ON "o_token" ("otoken") `) + await db.query(`CREATE INDEX "IDX_7889d6ce061da066df89309e51" ON "o_token" ("timestamp") `) + await db.query(`CREATE INDEX "IDX_4633929013f5ba465cb00e5a95" ON "o_token" ("block_number") `) + await db.query(`CREATE TABLE "o_token_asset" ("id" character varying NOT NULL, "chain_id" integer NOT NULL, "otoken" text NOT NULL, "address" text NOT NULL, "symbol" text NOT NULL, CONSTRAINT "PK_eb502dc2745e676b217ea3e0323" PRIMARY KEY ("id"))`) + await db.query(`CREATE INDEX "IDX_2eb2f24563a058f9d6e746ed47" ON "o_token_asset" ("chain_id") `) + await db.query(`CREATE INDEX "IDX_7a26c80564bf5fe4e414125e99" ON "o_token_asset" ("otoken") `) + await db.query(`CREATE INDEX "IDX_53e8f932900b50984e1c30e7c0" ON "o_token_asset" ("address") `) + await db.query(`CREATE TABLE "o_token_history" ("id" character varying NOT NULL, "chain_id" integer NOT NULL, "otoken" text 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_adba161a29081a0a47532807da8" PRIMARY KEY ("id"))`) + await db.query(`CREATE INDEX "IDX_3200b91c04a72dda2312eb518c" ON "o_token_history" ("chain_id") `) + await db.query(`CREATE INDEX "IDX_b4b39e42a6d2604b34082c4c80" ON "o_token_history" ("otoken") `) + await db.query(`CREATE INDEX "IDX_2f1457755464ec5951d1e96542" ON "o_token_history" ("address_id") `) + await db.query(`CREATE INDEX "IDX_42142d191ea0408fb511f9f576" ON "o_token_history" ("block_number") `) + await db.query(`CREATE INDEX "IDX_f87d86cfca9ef211ba1b18d2bc" ON "o_token_history" ("tx_hash") `) + await db.query(`CREATE TABLE "o_token_address" ("id" character varying NOT NULL, "chain_id" integer NOT NULL, "otoken" text NOT NULL, "address" text 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_5d5d2b6f8a94da6ed63aac85194" PRIMARY KEY ("id"))`) + await db.query(`CREATE INDEX "IDX_7cbc465ce1e9ae06dfe3a8c625" ON "o_token_address" ("chain_id") `) + await db.query(`CREATE INDEX "IDX_5342c499e930e396bade7faeb6" ON "o_token_address" ("otoken") `) + await db.query(`CREATE INDEX "IDX_75c7d29bf71b393e99c4407885" ON "o_token_address" ("address") `) + await db.query(`CREATE TABLE "o_token_apy" ("id" character varying NOT NULL, "chain_id" integer NOT NULL, "otoken" text NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "tx_hash" text NOT NULL, "date" 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_132f1c9570d48b38184ca5ac4cc" PRIMARY KEY ("id"))`) + await db.query(`CREATE INDEX "IDX_5d9294486b1c57df8c3aad5145" ON "o_token_apy" ("chain_id") `) + await db.query(`CREATE INDEX "IDX_4d4f1b0d9e7f6903a2038c6c38" ON "o_token_apy" ("otoken") `) + await db.query(`CREATE INDEX "IDX_5b81f5a25e913cc7bf1d4c145a" ON "o_token_apy" ("timestamp") `) + await db.query(`CREATE INDEX "IDX_79f0934481fe045319c864cd84" ON "o_token_apy" ("block_number") `) + await db.query(`CREATE INDEX "IDX_f5f416a1490ee2007a9c7593d0" ON "o_token_apy" ("tx_hash") `) + await db.query(`CREATE INDEX "IDX_a98d74fc6af6f3a599fe1ba7fb" ON "o_token_apy" ("date") `) + await db.query(`CREATE TABLE "o_token_rebase" ("id" character varying NOT NULL, "chain_id" integer NOT NULL, "otoken" text 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_eth" numeric NOT NULL, "fee_usd" numeric NOT NULL, "yield_eth" numeric NOT NULL, "yield_usd" numeric NOT NULL, "apy_id" character varying, CONSTRAINT "PK_f8e636dc692c399dd1ead98c720" PRIMARY KEY ("id"))`) + await db.query(`CREATE INDEX "IDX_83666ab47ff5ef0c56bf40d122" ON "o_token_rebase" ("chain_id") `) + await db.query(`CREATE INDEX "IDX_3fb75a6c8b831ca4d201d60e01" ON "o_token_rebase" ("otoken") `) + await db.query(`CREATE INDEX "IDX_15ef53e2bdcc3034ab8adea1f1" ON "o_token_rebase" ("timestamp") `) + await db.query(`CREATE INDEX "IDX_b0c6feb890a83dcca572302371" ON "o_token_rebase" ("block_number") `) + await db.query(`CREATE INDEX "IDX_7170f89052507f34d8563f7016" ON "o_token_rebase" ("tx_hash") `) + await db.query(`CREATE INDEX "IDX_b8653270b96fc932f077b26441" ON "o_token_rebase" ("apy_id") `) + await db.query(`CREATE TABLE "o_token_rebase_option" ("id" character varying NOT NULL, "chain_id" integer NOT NULL, "otoken" text 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_8b52df258c40e8347a66922f63e" PRIMARY KEY ("id"))`) + await db.query(`CREATE INDEX "IDX_5dfc53108b110d42994d02a832" ON "o_token_rebase_option" ("chain_id") `) + await db.query(`CREATE INDEX "IDX_5936af713ee8131983812703b2" ON "o_token_rebase_option" ("otoken") `) + await db.query(`CREATE INDEX "IDX_cb07bc901206c5da63eacff7df" ON "o_token_rebase_option" ("timestamp") `) + await db.query(`CREATE INDEX "IDX_95bab764e1a63ea0778dca4038" ON "o_token_rebase_option" ("block_number") `) + await db.query(`CREATE INDEX "IDX_00fff31b07544c1739afce542c" ON "o_token_rebase_option" ("tx_hash") `) + await db.query(`CREATE INDEX "IDX_da7296f8011232dc8675477b84" ON "o_token_rebase_option" ("address_id") `) + await db.query(`CREATE TABLE "o_token_vault" ("id" character varying NOT NULL, "chain_id" integer NOT NULL, "otoken" text NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "address" text NOT NULL, "total_value" numeric NOT NULL, CONSTRAINT "PK_90bb3a4df699017439cd6a44a0c" PRIMARY KEY ("id"))`) + await db.query(`CREATE INDEX "IDX_6990f4cd71ea8db6d9d27a0db5" ON "o_token_vault" ("chain_id") `) + await db.query(`CREATE INDEX "IDX_2c88ea3e889e76b037d8f59c96" ON "o_token_vault" ("otoken") `) await db.query(`CREATE INDEX "IDX_091cfbe0d977006e05144bd1fe" ON "o_token_vault" ("timestamp") `) await db.query(`CREATE INDEX "IDX_fa92b36d011441a02d9a231860" ON "o_token_vault" ("block_number") `) - await db.query(`CREATE INDEX "IDX_6990f4cd71ea8db6d9d27a0db5" ON "o_token_vault" ("chain_id") `) await db.query(`CREATE INDEX "IDX_3a2bfb2808c1d7cbb0a568910c" ON "o_token_vault" ("address") `) - 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_asset" ("id" character varying NOT NULL, "address" text NOT NULL, "symbol" text NOT NULL, CONSTRAINT "PK_ba5542cbe95b6da5d24ed98761e" PRIMARY KEY ("id"))`) - await db.query(`CREATE INDEX "IDX_4fd23c8c3da5139ff1ed8dc11b" ON "ousd_asset" ("address") `) - 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_eth" numeric NOT NULL, "fee_usd" numeric NOT NULL, "yield_eth" numeric NOT NULL, "yield_usd" 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 "o_token_activity" ("id" character varying NOT NULL, "chain_id" integer NOT NULL, "otoken" text NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "tx_hash" text NOT NULL, "call_data_last4_bytes" text NOT NULL, "address" text, "sighash" text, "action" text, "exchange" text, "interface" text, "from_symbol" text, "to_symbol" text, "amount" numeric, CONSTRAINT "PK_a6e9207d04e252b4de591283276" PRIMARY KEY ("id"))`) + await db.query(`CREATE INDEX "IDX_9c617918c3dc521bed5220a185" ON "o_token_activity" ("chain_id") `) + await db.query(`CREATE INDEX "IDX_62bfeb1dee3bcefffdbd10172a" ON "o_token_activity" ("otoken") `) + await db.query(`CREATE INDEX "IDX_57bb1f7d2fd6fe063b9cd434b2" ON "o_token_activity" ("timestamp") `) + await db.query(`CREATE INDEX "IDX_d6cba0877ee9f5332e6d97e758" ON "o_token_activity" ("block_number") `) + await db.query(`CREATE INDEX "IDX_b5826e68934ff671bbe28836ec" ON "o_token_activity" ("tx_hash") `) 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") `) @@ -210,10 +205,6 @@ module.exports = class Data1713570460723 { 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(`CREATE TABLE "ousd_activity" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "tx_hash" text NOT NULL, "call_data_last4_bytes" text NOT NULL, "address" text, "sighash" text, "action" text, "exchange" text, "interface" text, "from_symbol" text, "to_symbol" text, "amount" numeric, CONSTRAINT "PK_0f830a098aea9c70d8e8a626933" PRIMARY KEY ("id"))`) - await db.query(`CREATE INDEX "IDX_87dcf07f9e54c132535acf47a4" ON "ousd_activity" ("timestamp") `) - await db.query(`CREATE INDEX "IDX_e80a0f99e9f31fe69ac50b5a4c" ON "ousd_activity" ("block_number") `) - await db.query(`CREATE INDEX "IDX_2af2ad9975c024d1aa3535928f" ON "ousd_activity" ("tx_hash") `) await db.query(`CREATE TABLE "ousd_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_ef2f51867e1d465c554262efd1b" PRIMARY KEY ("id"))`) await db.query(`CREATE INDEX "IDX_e1a93bab3d12271dc114234d3a" ON "ousd_strategy_holding_daily_stat" ("strategy_daily_stat_id_id") `) await db.query(`CREATE TABLE "ousd_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_ac65d3f28f290211ddeb950e157" PRIMARY KEY ("id"))`) @@ -223,9 +214,6 @@ module.exports = class Data1713570460723 { await db.query(`CREATE TABLE "ousd_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, "wrapped_supply" numeric NOT NULL, "trading_volume_usd" numeric NOT NULL, "yield_eth" numeric NOT NULL, "yield_eth7_day" numeric NOT NULL, "yield_eth_all_time" numeric NOT NULL, "yield_usd" numeric NOT NULL, "yield_usd7_day" numeric NOT NULL, "yield_usd_all_time" numeric NOT NULL, "fees_eth" numeric NOT NULL, "fees_eth7_day" numeric NOT NULL, "fees_eth_all_time" numeric NOT NULL, "fees_usd" numeric NOT NULL, "fees_usd7_day" numeric NOT NULL, "fees_usd_all_time" numeric NOT NULL, "peg_price" numeric NOT NULL, "market_cap_usd" numeric NOT NULL, "holders_over_threshold" integer NOT NULL, CONSTRAINT "PK_f8adaf321a99f2b4b877c262880" PRIMARY KEY ("id"))`) await db.query(`CREATE INDEX "IDX_f9020d89932aad2d0de8923490" ON "ousd_daily_stat" ("block_number") `) await db.query(`CREATE INDEX "IDX_0bb5f72bf5fa59ce8c232caa4c" ON "ousd_daily_stat" ("timestamp") `) - 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`) @@ -236,9 +224,9 @@ module.exports = class Data1713570460723 { 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`) + await db.query(`ALTER TABLE "o_token_history" ADD CONSTRAINT "FK_2f1457755464ec5951d1e96542a" FOREIGN KEY ("address_id") REFERENCES "o_token_address"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`) + await db.query(`ALTER TABLE "o_token_rebase" ADD CONSTRAINT "FK_b8653270b96fc932f077b26441d" FOREIGN KEY ("apy_id") REFERENCES "o_token_apy"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`) + await db.query(`ALTER TABLE "o_token_rebase_option" ADD CONSTRAINT "FK_da7296f8011232dc8675477b841" FOREIGN KEY ("address_id") REFERENCES "o_token_address"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`) await db.query(`ALTER TABLE "ousd_strategy_holding_daily_stat" ADD CONSTRAINT "FK_e1a93bab3d12271dc114234d3ae" FOREIGN KEY ("strategy_daily_stat_id_id") REFERENCES "ousd_strategy_daily_stat"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`) await db.query(`ALTER TABLE "ousd_strategy_daily_stat" ADD CONSTRAINT "FK_3edda581683682257159cb08638" FOREIGN KEY ("daily_stat_id_id") REFERENCES "ousd_daily_stat"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`) await db.query(`ALTER TABLE "ousd_collateral_daily_stat" ADD CONSTRAINT "FK_78be9d3f3dc1f31cf17ae810fee" FOREIGN KEY ("daily_stat_id_id") REFERENCES "ousd_daily_stat"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`) @@ -316,30 +304,6 @@ module.exports = class Data1713570460723 { await db.query(`DROP INDEX "public"."IDX_374659ae3bd149042388e132be"`) await db.query(`DROP INDEX "public"."IDX_74f93b10ec560e63792dcc877e"`) await db.query(`DROP INDEX "public"."IDX_df99bdbf11d4ed57bec0e6c511"`) - 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_asset"`) - await db.query(`DROP INDEX "public"."IDX_40f03cb689691cad447873174e"`) - 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"`) @@ -370,10 +334,6 @@ module.exports = class Data1713570460723 { 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 "oeth_activity"`) - await db.query(`DROP INDEX "public"."IDX_701369d638018e8f191b7c048d"`) - await db.query(`DROP INDEX "public"."IDX_e3037b99481023edd17b98cd78"`) - await db.query(`DROP INDEX "public"."IDX_6537c67233447c5152bc7318f8"`) await db.query(`DROP TABLE "ogv"`) await db.query(`DROP INDEX "public"."IDX_2418a8b8b92b2f5977be761cf9"`) await db.query(`DROP INDEX "public"."IDX_b8f20bcf48e4aa77e0f48d77db"`) @@ -394,35 +354,58 @@ module.exports = class Data1713570460723 { await db.query(`DROP TABLE "ogv_daily_stat"`) await db.query(`DROP INDEX "public"."IDX_c974bde87107cacae6d3654972"`) await db.query(`DROP INDEX "public"."IDX_b62fa80951183bb0acf8a5e8b9"`) + await db.query(`DROP TABLE "o_token"`) + await db.query(`DROP INDEX "public"."IDX_1da06ba7d2c0a02d01d1b7a6c0"`) + await db.query(`DROP INDEX "public"."IDX_0851d95d178f682d279a04ebf9"`) + await db.query(`DROP INDEX "public"."IDX_7889d6ce061da066df89309e51"`) + await db.query(`DROP INDEX "public"."IDX_4633929013f5ba465cb00e5a95"`) + await db.query(`DROP TABLE "o_token_asset"`) + await db.query(`DROP INDEX "public"."IDX_2eb2f24563a058f9d6e746ed47"`) + await db.query(`DROP INDEX "public"."IDX_7a26c80564bf5fe4e414125e99"`) + await db.query(`DROP INDEX "public"."IDX_53e8f932900b50984e1c30e7c0"`) + await db.query(`DROP TABLE "o_token_history"`) + await db.query(`DROP INDEX "public"."IDX_3200b91c04a72dda2312eb518c"`) + await db.query(`DROP INDEX "public"."IDX_b4b39e42a6d2604b34082c4c80"`) + await db.query(`DROP INDEX "public"."IDX_2f1457755464ec5951d1e96542"`) + await db.query(`DROP INDEX "public"."IDX_42142d191ea0408fb511f9f576"`) + await db.query(`DROP INDEX "public"."IDX_f87d86cfca9ef211ba1b18d2bc"`) + await db.query(`DROP TABLE "o_token_address"`) + await db.query(`DROP INDEX "public"."IDX_7cbc465ce1e9ae06dfe3a8c625"`) + await db.query(`DROP INDEX "public"."IDX_5342c499e930e396bade7faeb6"`) + await db.query(`DROP INDEX "public"."IDX_75c7d29bf71b393e99c4407885"`) + await db.query(`DROP TABLE "o_token_apy"`) + await db.query(`DROP INDEX "public"."IDX_5d9294486b1c57df8c3aad5145"`) + await db.query(`DROP INDEX "public"."IDX_4d4f1b0d9e7f6903a2038c6c38"`) + await db.query(`DROP INDEX "public"."IDX_5b81f5a25e913cc7bf1d4c145a"`) + await db.query(`DROP INDEX "public"."IDX_79f0934481fe045319c864cd84"`) + await db.query(`DROP INDEX "public"."IDX_f5f416a1490ee2007a9c7593d0"`) + await db.query(`DROP INDEX "public"."IDX_a98d74fc6af6f3a599fe1ba7fb"`) + await db.query(`DROP TABLE "o_token_rebase"`) + await db.query(`DROP INDEX "public"."IDX_83666ab47ff5ef0c56bf40d122"`) + await db.query(`DROP INDEX "public"."IDX_3fb75a6c8b831ca4d201d60e01"`) + await db.query(`DROP INDEX "public"."IDX_15ef53e2bdcc3034ab8adea1f1"`) + await db.query(`DROP INDEX "public"."IDX_b0c6feb890a83dcca572302371"`) + await db.query(`DROP INDEX "public"."IDX_7170f89052507f34d8563f7016"`) + await db.query(`DROP INDEX "public"."IDX_b8653270b96fc932f077b26441"`) + await db.query(`DROP TABLE "o_token_rebase_option"`) + await db.query(`DROP INDEX "public"."IDX_5dfc53108b110d42994d02a832"`) + await db.query(`DROP INDEX "public"."IDX_5936af713ee8131983812703b2"`) + await db.query(`DROP INDEX "public"."IDX_cb07bc901206c5da63eacff7df"`) + await db.query(`DROP INDEX "public"."IDX_95bab764e1a63ea0778dca4038"`) + await db.query(`DROP INDEX "public"."IDX_00fff31b07544c1739afce542c"`) + await db.query(`DROP INDEX "public"."IDX_da7296f8011232dc8675477b84"`) await db.query(`DROP TABLE "o_token_vault"`) + await db.query(`DROP INDEX "public"."IDX_6990f4cd71ea8db6d9d27a0db5"`) + await db.query(`DROP INDEX "public"."IDX_2c88ea3e889e76b037d8f59c96"`) await db.query(`DROP INDEX "public"."IDX_091cfbe0d977006e05144bd1fe"`) await db.query(`DROP INDEX "public"."IDX_fa92b36d011441a02d9a231860"`) - await db.query(`DROP INDEX "public"."IDX_6990f4cd71ea8db6d9d27a0db5"`) await db.query(`DROP INDEX "public"."IDX_3a2bfb2808c1d7cbb0a568910c"`) - 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_asset"`) - await db.query(`DROP INDEX "public"."IDX_4fd23c8c3da5139ff1ed8dc11b"`) - 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 "o_token_activity"`) + await db.query(`DROP INDEX "public"."IDX_9c617918c3dc521bed5220a185"`) + await db.query(`DROP INDEX "public"."IDX_62bfeb1dee3bcefffdbd10172a"`) + await db.query(`DROP INDEX "public"."IDX_57bb1f7d2fd6fe063b9cd434b2"`) + await db.query(`DROP INDEX "public"."IDX_d6cba0877ee9f5332e6d97e758"`) + await db.query(`DROP INDEX "public"."IDX_b5826e68934ff671bbe28836ec"`) await db.query(`DROP TABLE "ousd_vault"`) await db.query(`DROP INDEX "public"."IDX_6860186ea2f56e2c7d54c22107"`) await db.query(`DROP INDEX "public"."IDX_0d0a7113a505cf7f7adea9ca81"`) @@ -453,10 +436,6 @@ module.exports = class Data1713570460723 { 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(`DROP TABLE "ousd_activity"`) - await db.query(`DROP INDEX "public"."IDX_87dcf07f9e54c132535acf47a4"`) - await db.query(`DROP INDEX "public"."IDX_e80a0f99e9f31fe69ac50b5a4c"`) - await db.query(`DROP INDEX "public"."IDX_2af2ad9975c024d1aa3535928f"`) await db.query(`DROP TABLE "ousd_strategy_holding_daily_stat"`) await db.query(`DROP INDEX "public"."IDX_e1a93bab3d12271dc114234d3a"`) await db.query(`DROP TABLE "ousd_strategy_daily_stat"`) @@ -466,9 +445,6 @@ module.exports = class Data1713570460723 { await db.query(`DROP TABLE "ousd_daily_stat"`) await db.query(`DROP INDEX "public"."IDX_f9020d89932aad2d0de8923490"`) await db.query(`DROP INDEX "public"."IDX_0bb5f72bf5fa59ce8c232caa4c"`) - 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"`) @@ -479,9 +455,9 @@ module.exports = class Data1713570460723 { 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"`) + await db.query(`ALTER TABLE "o_token_history" DROP CONSTRAINT "FK_2f1457755464ec5951d1e96542a"`) + await db.query(`ALTER TABLE "o_token_rebase" DROP CONSTRAINT "FK_b8653270b96fc932f077b26441d"`) + await db.query(`ALTER TABLE "o_token_rebase_option" DROP CONSTRAINT "FK_da7296f8011232dc8675477b841"`) await db.query(`ALTER TABLE "ousd_strategy_holding_daily_stat" DROP CONSTRAINT "FK_e1a93bab3d12271dc114234d3ae"`) await db.query(`ALTER TABLE "ousd_strategy_daily_stat" DROP CONSTRAINT "FK_3edda581683682257159cb08638"`) await db.query(`ALTER TABLE "ousd_collateral_daily_stat" DROP CONSTRAINT "FK_78be9d3f3dc1f31cf17ae810fee"`) diff --git a/schema-oeth.graphql b/schema-oeth.graphql index 344d01fb..501a9916 100644 --- a/schema-oeth.graphql +++ b/schema-oeth.graphql @@ -1,95 +1,3 @@ -""" -The OETH entity tracks the change in total supply of OETH over time. -""" -type OETH @entity { - id: ID! @index - timestamp: DateTime! @index - blockNumber: Int! @index - totalSupply: BigInt! - rebasingSupply: BigInt! - nonRebasingSupply: BigInt! -} - -type OETHAsset @entity { - id: ID! @index - address: String! @index - symbol: String! -} - -""" -The OETH balance, history and other information for a given address. -""" -type OETHAddress @entity { - id: ID! @index - isContract: Boolean! - rebasingOption: RebasingOption! - balance: BigInt! - earned: BigInt! - credits: BigInt! - lastUpdated: DateTime! - history: [OETHHistory!]! @derivedFrom(field: "address") -} - -""" -The History entity tracks events that change the balance of OETH for an address. -""" -type OETHHistory @entity { - id: ID! - address: OETHAddress! @index - value: BigInt! - balance: BigInt! - timestamp: DateTime! - blockNumber: Int! @index - txHash: String! @index - type: HistoryType! -} - -""" -The Rebase entity tracks historical rebase events on the OETH contract. -""" -type OETHRebase @entity { - id: ID! - timestamp: DateTime! @index - blockNumber: Int! @index - txHash: String! @index - totalSupply: BigInt! - rebasingCredits: BigInt! - rebasingCreditsPerToken: BigInt! - apy: OETHAPY! - feeETH: BigInt! - feeUSD: BigInt! - yieldETH: BigInt! - yieldUSD: BigInt! -} - -""" -The RebaseOption entity tracks historical rebase option changes by address. -""" -type OETHRebaseOption @entity { - id: ID! - timestamp: DateTime! @index - blockNumber: Int! @index - txHash: String! @index - address: OETHAddress! - status: RebasingOption! -} - -""" -The APY entity tracks historical APY values by day. -""" -type OETHAPY @entity { - id: ID! - timestamp: DateTime! @index - blockNumber: Int! @index - txHash: String! @index - apr: Float! - apy: Float! - apy7DayAvg: Float! - apy14DayAvg: Float! - apy30DayAvg: Float! - rebasingCreditsPerToken: BigInt! -} - # OETH Vault: 0x39254033945AA2E4809Cc2977E7087BEE48bd7Ab """ The Vault entity tracks the OETH vault balance over time. @@ -277,22 +185,4 @@ type OETHRewardTokenCollected @entity { recipient: String! rewardToken: String! amount: BigInt! -} - -type OETHActivity @entity { - id: ID! - timestamp: DateTime! @index - blockNumber: Int! @index - txHash: String! @index - callDataLast4Bytes: String! - address: String - sighash: String - - action: String - exchange: String - interface: String - - fromSymbol: String - toSymbol: String - amount: BigInt -} +} \ No newline at end of file diff --git a/schema-otoken.graphql b/schema-otoken.graphql index 74d6f95d..16202b71 100644 --- a/schema-otoken.graphql +++ b/schema-otoken.graphql @@ -1,8 +1,119 @@ -type OTokenVault @entity { +type OToken @entity { + id: ID! @index + chainId: Int! @index + otoken: String! @index + timestamp: DateTime! @index + blockNumber: Int! @index + totalSupply: BigInt! + rebasingSupply: BigInt! + nonRebasingSupply: BigInt! +} + +type OTokenAsset @entity { + id: ID! @index + chainId: Int! @index + otoken: String! @index + address: String! @index + symbol: String! +} + +type OTokenAddress @entity { + id: ID! @index + chainId: Int! @index + otoken: String! @index + address: String! @index + isContract: Boolean! + rebasingOption: RebasingOption! + balance: BigInt! + earned: BigInt! + credits: BigInt! + lastUpdated: DateTime! + history: [OTokenHistory!]! @derivedFrom(field: "address") +} + +type OTokenHistory @entity { + id: ID! + chainId: Int! @index + otoken: String! @index + address: OTokenAddress! @index + value: BigInt! + balance: BigInt! + timestamp: DateTime! + blockNumber: Int! @index + txHash: String! @index + type: HistoryType! +} + +type OTokenRebase @entity { + id: ID! + chainId: Int! @index + otoken: String! @index + timestamp: DateTime! @index + blockNumber: Int! @index + txHash: String! @index + totalSupply: BigInt! + rebasingCredits: BigInt! + rebasingCreditsPerToken: BigInt! + apy: OTokenAPY! + feeETH: BigInt! + feeUSD: BigInt! + yieldETH: BigInt! + yieldUSD: BigInt! +} + +type OTokenRebaseOption @entity { id: ID! + chainId: Int! @index + otoken: String! @index timestamp: DateTime! @index blockNumber: Int! @index + txHash: String! @index + address: OTokenAddress! + status: RebasingOption! +} + +type OTokenAPY @entity { + id: ID! + chainId: Int! @index + otoken: String! @index + timestamp: DateTime! @index + blockNumber: Int! @index + txHash: String! @index + date: String! @index + apr: Float! + apy: Float! + apy7DayAvg: Float! + apy14DayAvg: Float! + apy30DayAvg: Float! + rebasingCreditsPerToken: BigInt! +} + +type OTokenVault @entity { + id: ID! chainId: Int! @index + otoken: String! @index + timestamp: DateTime! @index + blockNumber: Int! @index address: String! @index totalValue: BigInt! } + +type OTokenActivity @entity { + id: ID! + chainId: Int! @index + otoken: String! @index + timestamp: DateTime! @index + blockNumber: Int! @index + txHash: String! @index + callDataLast4Bytes: String! + address: String + sighash: String + + action: String + exchange: String + interface: String + + fromSymbol: String + toSymbol: String + amount: BigInt +} diff --git a/schema-ousd.graphql b/schema-ousd.graphql index c1a0e221..c8fc8dd7 100644 --- a/schema-ousd.graphql +++ b/schema-ousd.graphql @@ -1,95 +1,3 @@ -""" -The OUSD entity tracks the change in total supply of OUSD over time. -""" -type OUSD @entity { - id: ID! @index - timestamp: DateTime! @index - blockNumber: Int! @index - totalSupply: BigInt! - rebasingSupply: BigInt! - nonRebasingSupply: BigInt! -} - -type OUSDAsset @entity { - id: ID! @index - address: String! @index - symbol: String! -} - -""" -The OUSD balance, history and other information for a given address. -""" -type OUSDAddress @entity { - id: ID! @index - isContract: Boolean! - rebasingOption: RebasingOption! - balance: BigInt! - earned: BigInt! - credits: BigInt! - lastUpdated: DateTime! - history: [OUSDHistory!]! @derivedFrom(field: "address") -} - -""" -The History entity tracks events that change the balance of OUSD for an address. -""" -type OUSDHistory @entity { - id: ID! - address: OUSDAddress! @index - value: BigInt! - balance: BigInt! - timestamp: DateTime! - blockNumber: Int! @index - txHash: String! @index - type: HistoryType! -} - -""" -The Rebase entity tracks historical rebase events on the OUSD contract. -""" -type OUSDRebase @entity { - id: ID! - timestamp: DateTime! @index - blockNumber: Int! @index - txHash: String! @index - totalSupply: BigInt! - rebasingCredits: BigInt! - rebasingCreditsPerToken: BigInt! - apy: OUSDAPY! - feeETH: BigInt! - feeUSD: BigInt! - yieldETH: BigInt! - yieldUSD: BigInt! -} - -""" -The RebaseOption entity tracks historical rebase option changes by address. -""" -type OUSDRebaseOption @entity { - id: ID! - timestamp: DateTime! @index - blockNumber: Int! @index - txHash: String! @index - address: OUSDAddress! - status: RebasingOption! -} - -""" -The APY entity tracks historical APY values by day. -""" -type OUSDAPY @entity { - id: ID! - timestamp: DateTime! @index - blockNumber: Int! @index - txHash: String! @index - apr: Float! - apy: Float! - apy7DayAvg: Float! - apy14DayAvg: Float! - apy30DayAvg: Float! - rebasingCreditsPerToken: BigInt! -} - """ The Vault entity tracks the OUSD vault balance over time. """ @@ -183,24 +91,6 @@ type OUSDConvexLUSDPlus3Crv @entity { usdc: BigInt! } -type OUSDActivity @entity { - id: ID! - timestamp: DateTime! @index - blockNumber: Int! @index - txHash: String! @index - callDataLast4Bytes: String! - address: String - sighash: String - - action: String - exchange: String - interface: String - - fromSymbol: String - toSymbol: String - amount: BigInt -} - type OUSDDailyStat @entity { id: ID! blockNumber: Int! @index diff --git a/schema.graphql b/schema.graphql index 330fcd34..57cab18b 100644 --- a/schema.graphql +++ b/schema.graphql @@ -280,98 +280,6 @@ type BridgeTransferState @entity { txHash: String! @index state: Int! } -""" -The OETH entity tracks the change in total supply of OETH over time. -""" -type OETH @entity { - id: ID! @index - timestamp: DateTime! @index - blockNumber: Int! @index - totalSupply: BigInt! - rebasingSupply: BigInt! - nonRebasingSupply: BigInt! -} - -type OETHAsset @entity { - id: ID! @index - address: String! @index - symbol: String! -} - -""" -The OETH balance, history and other information for a given address. -""" -type OETHAddress @entity { - id: ID! @index - isContract: Boolean! - rebasingOption: RebasingOption! - balance: BigInt! - earned: BigInt! - credits: BigInt! - lastUpdated: DateTime! - history: [OETHHistory!]! @derivedFrom(field: "address") -} - -""" -The History entity tracks events that change the balance of OETH for an address. -""" -type OETHHistory @entity { - id: ID! - address: OETHAddress! @index - value: BigInt! - balance: BigInt! - timestamp: DateTime! - blockNumber: Int! @index - txHash: String! @index - type: HistoryType! -} - -""" -The Rebase entity tracks historical rebase events on the OETH contract. -""" -type OETHRebase @entity { - id: ID! - timestamp: DateTime! @index - blockNumber: Int! @index - txHash: String! @index - totalSupply: BigInt! - rebasingCredits: BigInt! - rebasingCreditsPerToken: BigInt! - apy: OETHAPY! - feeETH: BigInt! - feeUSD: BigInt! - yieldETH: BigInt! - yieldUSD: BigInt! -} - -""" -The RebaseOption entity tracks historical rebase option changes by address. -""" -type OETHRebaseOption @entity { - id: ID! - timestamp: DateTime! @index - blockNumber: Int! @index - txHash: String! @index - address: OETHAddress! - status: RebasingOption! -} - -""" -The APY entity tracks historical APY values by day. -""" -type OETHAPY @entity { - id: ID! - timestamp: DateTime! @index - blockNumber: Int! @index - txHash: String! @index - apr: Float! - apy: Float! - apy7DayAvg: Float! - apy14DayAvg: Float! - apy30DayAvg: Float! - rebasingCreditsPerToken: BigInt! -} - # OETH Vault: 0x39254033945AA2E4809Cc2977E7087BEE48bd7Ab """ The Vault entity tracks the OETH vault balance over time. @@ -559,26 +467,7 @@ type OETHRewardTokenCollected @entity { recipient: String! rewardToken: String! amount: BigInt! -} - -type OETHActivity @entity { - id: ID! - timestamp: DateTime! @index - blockNumber: Int! @index - txHash: String! @index - callDataLast4Bytes: String! - address: String - sighash: String - - action: String - exchange: String - interface: String - - fromSymbol: String - toSymbol: String - amount: BigInt -} -type OGV @entity { +}type OGV @entity { id: ID! timestamp: DateTime! @index blockNumber: Int! @index @@ -696,19 +585,10 @@ type OGVDailyStat @entity { priceUSD: Float! holdersOverThreshold: Int! } -type OTokenVault @entity { - id: ID! - timestamp: DateTime! @index - blockNumber: Int! @index - chainId: Int! @index - address: String! @index - totalValue: BigInt! -} -""" -The OUSD entity tracks the change in total supply of OUSD over time. -""" -type OUSD @entity { +type OToken @entity { id: ID! @index + chainId: Int! @index + otoken: String! @index timestamp: DateTime! @index blockNumber: Int! @index totalSupply: BigInt! @@ -716,32 +596,33 @@ type OUSD @entity { nonRebasingSupply: BigInt! } -type OUSDAsset @entity { +type OTokenAsset @entity { id: ID! @index + chainId: Int! @index + otoken: String! @index address: String! @index symbol: String! } -""" -The OUSD balance, history and other information for a given address. -""" -type OUSDAddress @entity { +type OTokenAddress @entity { id: ID! @index + chainId: Int! @index + otoken: String! @index + address: String! @index isContract: Boolean! rebasingOption: RebasingOption! balance: BigInt! earned: BigInt! credits: BigInt! lastUpdated: DateTime! - history: [OUSDHistory!]! @derivedFrom(field: "address") + history: [OTokenHistory!]! @derivedFrom(field: "address") } -""" -The History entity tracks events that change the balance of OUSD for an address. -""" -type OUSDHistory @entity { +type OTokenHistory @entity { id: ID! - address: OUSDAddress! @index + chainId: Int! @index + otoken: String! @index + address: OTokenAddress! @index value: BigInt! balance: BigInt! timestamp: DateTime! @@ -750,44 +631,42 @@ type OUSDHistory @entity { type: HistoryType! } -""" -The Rebase entity tracks historical rebase events on the OUSD contract. -""" -type OUSDRebase @entity { +type OTokenRebase @entity { id: ID! + chainId: Int! @index + otoken: String! @index timestamp: DateTime! @index blockNumber: Int! @index txHash: String! @index totalSupply: BigInt! rebasingCredits: BigInt! rebasingCreditsPerToken: BigInt! - apy: OUSDAPY! + apy: OTokenAPY! feeETH: BigInt! feeUSD: BigInt! yieldETH: BigInt! yieldUSD: BigInt! } -""" -The RebaseOption entity tracks historical rebase option changes by address. -""" -type OUSDRebaseOption @entity { +type OTokenRebaseOption @entity { id: ID! + chainId: Int! @index + otoken: String! @index timestamp: DateTime! @index blockNumber: Int! @index txHash: String! @index - address: OUSDAddress! + address: OTokenAddress! status: RebasingOption! } -""" -The APY entity tracks historical APY values by day. -""" -type OUSDAPY @entity { +type OTokenAPY @entity { id: ID! + chainId: Int! @index + otoken: String! @index timestamp: DateTime! @index blockNumber: Int! @index txHash: String! @index + date: String! @index apr: Float! apy: Float! apy7DayAvg: Float! @@ -796,6 +675,35 @@ type OUSDAPY @entity { rebasingCreditsPerToken: BigInt! } +type OTokenVault @entity { + id: ID! + chainId: Int! @index + otoken: String! @index + timestamp: DateTime! @index + blockNumber: Int! @index + address: String! @index + totalValue: BigInt! +} + +type OTokenActivity @entity { + id: ID! + chainId: Int! @index + otoken: String! @index + timestamp: DateTime! @index + blockNumber: Int! @index + txHash: String! @index + callDataLast4Bytes: String! + address: String + sighash: String + + action: String + exchange: String + interface: String + + fromSymbol: String + toSymbol: String + amount: BigInt +} """ The Vault entity tracks the OUSD vault balance over time. """ @@ -889,24 +797,6 @@ type OUSDConvexLUSDPlus3Crv @entity { usdc: BigInt! } -type OUSDActivity @entity { - id: ID! - timestamp: DateTime! @index - blockNumber: Int! @index - txHash: String! @index - callDataLast4Bytes: String! - address: String - sighash: String - - action: String - exchange: String - interface: String - - fromSymbol: String - toSymbol: String - amount: BigInt -} - type OUSDDailyStat @entity { id: ID! blockNumber: Int! @index diff --git a/src/main-oeth.ts b/src/main-oeth.ts index 5aebb80d..3c00d3f0 100644 --- a/src/main-oeth.ts +++ b/src/main-oeth.ts @@ -36,7 +36,7 @@ export const processor = { dailyStats, processStatus('oeth'), ], - validators: [validateOeth], + validators: [], } export default processor diff --git a/src/main-ousd.ts b/src/main-ousd.ts index d2a1ca32..fc072991 100644 --- a/src/main-ousd.ts +++ b/src/main-ousd.ts @@ -15,7 +15,7 @@ export const processor = { stateSchema: 'ousd-processor', processors: [ousd, strategies, curve, ...erc20s], postProcessors: [exchangeRates, dailyStats, processStatus('ousd')], - validators: [validateOusd], + validators: [], } export default processor diff --git a/src/main.ts b/src/main.ts index 6a10002e..769ff41b 100644 --- a/src/main.ts +++ b/src/main.ts @@ -6,11 +6,10 @@ import arbitrum from './main-arbitrum' import mainnet from './main-mainnet' import oeth from './main-oeth' import ogv from './main-ogv' +import ousd from './main-ousd' -// import ousd from './main-ousd' - -run(mainnet) -run(arbitrum) +// run(mainnet) +// run(arbitrum) run(oeth) // run(ogv) -// run(ousd) +run(ousd) diff --git a/src/model/generated/index.ts b/src/model/generated/index.ts index a52ee4c9..7bb851fd 100644 --- a/src/model/generated/index.ts +++ b/src/model/generated/index.ts @@ -22,15 +22,6 @@ export * from "./_liquiditySourceType" export * from "./liquidityDailyBalance.model" export * from "./bridgeTransfer.model" export * from "./bridgeTransferState.model" -export * from "./oeth.model" -export * from "./oethAsset.model" -export * from "./oethAddress.model" -export * from "./_rebasingOption" -export * from "./oethHistory.model" -export * from "./_historyType" -export * from "./oethRebase.model" -export * from "./oethRebaseOption.model" -export * from "./oethapy.model" export * from "./oethVault.model" export * from "./oethCurveLp.model" export * from "./oethFraxStaking.model" @@ -42,7 +33,6 @@ export * from "./oethStrategyDailyStat.model" export * from "./oethStrategyHoldingDailyStat.model" export * from "./oethCollateralDailyStat.model" export * from "./oethRewardTokenCollected.model" -export * from "./oethActivity.model" export * from "./ogv.model" export * from "./ogvAddress.model" export * from "./ogvLockupTxLog.model" @@ -55,14 +45,17 @@ export * from "./_ogvProposalState" export * from "./ogvProposalVote.model" export * from "./_ogvVoteType" export * from "./ogvDailyStat.model" +export * from "./oToken.model" +export * from "./oTokenAsset.model" +export * from "./oTokenAddress.model" +export * from "./_rebasingOption" +export * from "./oTokenHistory.model" +export * from "./_historyType" +export * from "./oTokenRebase.model" +export * from "./oTokenRebaseOption.model" +export * from "./oTokenApy.model" export * from "./oTokenVault.model" -export * from "./ousd.model" -export * from "./ousdAsset.model" -export * from "./ousdAddress.model" -export * from "./ousdHistory.model" -export * from "./ousdRebase.model" -export * from "./ousdRebaseOption.model" -export * from "./ousdapy.model" +export * from "./oTokenActivity.model" export * from "./ousdVault.model" export * from "./ousdMorphoAave.model" export * from "./ousdMorphoCompound.model" @@ -73,7 +66,6 @@ export * from "./ousdConvexStrategy.model" export * from "./ousdAaveStrategy.model" export * from "./ousdMetaStrategy.model" export * from "./ousdConvexLusdPlus3Crv.model" -export * from "./ousdActivity.model" export * from "./ousdDailyStat.model" export * from "./ousdStrategyDailyStat.model" export * from "./ousdStrategyHoldingDailyStat.model" diff --git a/src/model/generated/oeth.model.ts b/src/model/generated/oToken.model.ts similarity index 77% rename from src/model/generated/oeth.model.ts rename to src/model/generated/oToken.model.ts index a9976c0c..bd2d9c94 100644 --- a/src/model/generated/oeth.model.ts +++ b/src/model/generated/oToken.model.ts @@ -1,18 +1,23 @@ import {Entity as Entity_, Column as Column_, PrimaryColumn as PrimaryColumn_, Index as Index_} from "typeorm" import * as marshal from "./marshal" -/** - * The OETH entity tracks the change in total supply of OETH over time. - */ @Entity_() -export class OETH { - constructor(props?: Partial) { +export class OToken { + constructor(props?: Partial) { Object.assign(this, props) } @PrimaryColumn_() id!: string + @Index_() + @Column_("int4", {nullable: false}) + chainId!: number + + @Index_() + @Column_("text", {nullable: false}) + otoken!: string + @Index_() @Column_("timestamp with time zone", {nullable: false}) timestamp!: Date diff --git a/src/model/generated/oethActivity.model.ts b/src/model/generated/oTokenActivity.model.ts similarity index 84% rename from src/model/generated/oethActivity.model.ts rename to src/model/generated/oTokenActivity.model.ts index d25c3d9d..c1eb131f 100644 --- a/src/model/generated/oethActivity.model.ts +++ b/src/model/generated/oTokenActivity.model.ts @@ -2,14 +2,22 @@ import {Entity as Entity_, Column as Column_, PrimaryColumn as PrimaryColumn_, I import * as marshal from "./marshal" @Entity_() -export class OETHActivity { - constructor(props?: Partial) { +export class OTokenActivity { + constructor(props?: Partial) { Object.assign(this, props) } @PrimaryColumn_() id!: string + @Index_() + @Column_("int4", {nullable: false}) + chainId!: number + + @Index_() + @Column_("text", {nullable: false}) + otoken!: string + @Index_() @Column_("timestamp with time zone", {nullable: false}) timestamp!: Date diff --git a/src/model/generated/ousdAddress.model.ts b/src/model/generated/oTokenAddress.model.ts similarity index 60% rename from src/model/generated/ousdAddress.model.ts rename to src/model/generated/oTokenAddress.model.ts index 685a5903..f43261f6 100644 --- a/src/model/generated/ousdAddress.model.ts +++ b/src/model/generated/oTokenAddress.model.ts @@ -1,20 +1,29 @@ -import {Entity as Entity_, Column as Column_, PrimaryColumn as PrimaryColumn_, OneToMany as OneToMany_} from "typeorm" +import {Entity as Entity_, Column as Column_, PrimaryColumn as PrimaryColumn_, Index as Index_, OneToMany as OneToMany_} from "typeorm" import * as marshal from "./marshal" import {RebasingOption} from "./_rebasingOption" -import {OUSDHistory} from "./ousdHistory.model" +import {OTokenHistory} from "./oTokenHistory.model" -/** - * The OUSD balance, history and other information for a given address. - */ @Entity_() -export class OUSDAddress { - constructor(props?: Partial) { +export class OTokenAddress { + constructor(props?: Partial) { Object.assign(this, props) } @PrimaryColumn_() id!: string + @Index_() + @Column_("int4", {nullable: false}) + chainId!: number + + @Index_() + @Column_("text", {nullable: false}) + otoken!: string + + @Index_() + @Column_("text", {nullable: false}) + address!: string + @Column_("bool", {nullable: false}) isContract!: boolean @@ -33,6 +42,6 @@ export class OUSDAddress { @Column_("timestamp with time zone", {nullable: false}) lastUpdated!: Date - @OneToMany_(() => OUSDHistory, e => e.address) - history!: OUSDHistory[] + @OneToMany_(() => OTokenHistory, e => e.address) + history!: OTokenHistory[] } diff --git a/src/model/generated/oethapy.model.ts b/src/model/generated/oTokenApy.model.ts similarity index 79% rename from src/model/generated/oethapy.model.ts rename to src/model/generated/oTokenApy.model.ts index 0bc0e4ae..d3676b85 100644 --- a/src/model/generated/oethapy.model.ts +++ b/src/model/generated/oTokenApy.model.ts @@ -1,18 +1,23 @@ import {Entity as Entity_, Column as Column_, PrimaryColumn as PrimaryColumn_, Index as Index_} from "typeorm" import * as marshal from "./marshal" -/** - * The APY entity tracks historical APY values by day. - */ @Entity_() -export class OETHAPY { - constructor(props?: Partial) { +export class OTokenAPY { + constructor(props?: Partial) { Object.assign(this, props) } @PrimaryColumn_() id!: string + @Index_() + @Column_("int4", {nullable: false}) + chainId!: number + + @Index_() + @Column_("text", {nullable: false}) + otoken!: string + @Index_() @Column_("timestamp with time zone", {nullable: false}) timestamp!: Date @@ -25,6 +30,10 @@ export class OETHAPY { @Column_("text", {nullable: false}) txHash!: string + @Index_() + @Column_("text", {nullable: false}) + date!: string + @Column_("numeric", {transformer: marshal.floatTransformer, nullable: false}) apr!: number diff --git a/src/model/generated/oethAsset.model.ts b/src/model/generated/oTokenAsset.model.ts similarity index 60% rename from src/model/generated/oethAsset.model.ts rename to src/model/generated/oTokenAsset.model.ts index d3319d1d..ba0a9ab0 100644 --- a/src/model/generated/oethAsset.model.ts +++ b/src/model/generated/oTokenAsset.model.ts @@ -1,14 +1,22 @@ import {Entity as Entity_, Column as Column_, PrimaryColumn as PrimaryColumn_, Index as Index_} from "typeorm" @Entity_() -export class OETHAsset { - constructor(props?: Partial) { +export class OTokenAsset { + constructor(props?: Partial) { Object.assign(this, props) } @PrimaryColumn_() id!: string + @Index_() + @Column_("int4", {nullable: false}) + chainId!: number + + @Index_() + @Column_("text", {nullable: false}) + otoken!: string + @Index_() @Column_("text", {nullable: false}) address!: string diff --git a/src/model/generated/oethHistory.model.ts b/src/model/generated/oTokenHistory.model.ts similarity index 64% rename from src/model/generated/oethHistory.model.ts rename to src/model/generated/oTokenHistory.model.ts index 2f3eaa27..7c4d9828 100644 --- a/src/model/generated/oethHistory.model.ts +++ b/src/model/generated/oTokenHistory.model.ts @@ -1,14 +1,11 @@ -import {Entity as Entity_, Column as Column_, PrimaryColumn as PrimaryColumn_, ManyToOne as ManyToOne_, Index as Index_} from "typeorm" +import {Entity as Entity_, Column as Column_, PrimaryColumn as PrimaryColumn_, Index as Index_, ManyToOne as ManyToOne_} from "typeorm" import * as marshal from "./marshal" -import {OETHAddress} from "./oethAddress.model" +import {OTokenAddress} from "./oTokenAddress.model" import {HistoryType} from "./_historyType" -/** - * The History entity tracks events that change the balance of OETH for an address. - */ @Entity_() -export class OETHHistory { - constructor(props?: Partial) { +export class OTokenHistory { + constructor(props?: Partial) { Object.assign(this, props) } @@ -16,8 +13,16 @@ export class OETHHistory { id!: string @Index_() - @ManyToOne_(() => OETHAddress, {nullable: true}) - address!: OETHAddress + @Column_("int4", {nullable: false}) + chainId!: number + + @Index_() + @Column_("text", {nullable: false}) + otoken!: string + + @Index_() + @ManyToOne_(() => OTokenAddress, {nullable: true}) + address!: OTokenAddress @Column_("numeric", {transformer: marshal.bigintTransformer, nullable: false}) value!: bigint diff --git a/src/model/generated/ousdRebase.model.ts b/src/model/generated/oTokenRebase.model.ts similarity index 79% rename from src/model/generated/ousdRebase.model.ts rename to src/model/generated/oTokenRebase.model.ts index de18b747..543e59ce 100644 --- a/src/model/generated/ousdRebase.model.ts +++ b/src/model/generated/oTokenRebase.model.ts @@ -1,19 +1,24 @@ import {Entity as Entity_, Column as Column_, PrimaryColumn as PrimaryColumn_, Index as Index_, ManyToOne as ManyToOne_} from "typeorm" import * as marshal from "./marshal" -import {OUSDAPY} from "./ousdapy.model" +import {OTokenAPY} from "./oTokenApy.model" -/** - * The Rebase entity tracks historical rebase events on the OUSD contract. - */ @Entity_() -export class OUSDRebase { - constructor(props?: Partial) { +export class OTokenRebase { + constructor(props?: Partial) { Object.assign(this, props) } @PrimaryColumn_() id!: string + @Index_() + @Column_("int4", {nullable: false}) + chainId!: number + + @Index_() + @Column_("text", {nullable: false}) + otoken!: string + @Index_() @Column_("timestamp with time zone", {nullable: false}) timestamp!: Date @@ -36,8 +41,8 @@ export class OUSDRebase { rebasingCreditsPerToken!: bigint @Index_() - @ManyToOne_(() => OUSDAPY, {nullable: true}) - apy!: OUSDAPY + @ManyToOne_(() => OTokenAPY, {nullable: true}) + apy!: OTokenAPY @Column_("numeric", {transformer: marshal.bigintTransformer, nullable: false}) feeETH!: bigint diff --git a/src/model/generated/ousdRebaseOption.model.ts b/src/model/generated/oTokenRebaseOption.model.ts similarity index 62% rename from src/model/generated/ousdRebaseOption.model.ts rename to src/model/generated/oTokenRebaseOption.model.ts index 7f8c4fca..501a0f5b 100644 --- a/src/model/generated/ousdRebaseOption.model.ts +++ b/src/model/generated/oTokenRebaseOption.model.ts @@ -1,19 +1,24 @@ import {Entity as Entity_, Column as Column_, PrimaryColumn as PrimaryColumn_, Index as Index_, ManyToOne as ManyToOne_} from "typeorm" -import {OUSDAddress} from "./ousdAddress.model" +import {OTokenAddress} from "./oTokenAddress.model" import {RebasingOption} from "./_rebasingOption" -/** - * The RebaseOption entity tracks historical rebase option changes by address. - */ @Entity_() -export class OUSDRebaseOption { - constructor(props?: Partial) { +export class OTokenRebaseOption { + constructor(props?: Partial) { Object.assign(this, props) } @PrimaryColumn_() id!: string + @Index_() + @Column_("int4", {nullable: false}) + chainId!: number + + @Index_() + @Column_("text", {nullable: false}) + otoken!: string + @Index_() @Column_("timestamp with time zone", {nullable: false}) timestamp!: Date @@ -27,8 +32,8 @@ export class OUSDRebaseOption { txHash!: string @Index_() - @ManyToOne_(() => OUSDAddress, {nullable: true}) - address!: OUSDAddress + @ManyToOne_(() => OTokenAddress, {nullable: true}) + address!: OTokenAddress @Column_("varchar", {length: 6, nullable: false}) status!: RebasingOption diff --git a/src/model/generated/oTokenVault.model.ts b/src/model/generated/oTokenVault.model.ts index 9f45ec80..3565a09e 100644 --- a/src/model/generated/oTokenVault.model.ts +++ b/src/model/generated/oTokenVault.model.ts @@ -10,6 +10,14 @@ export class OTokenVault { @PrimaryColumn_() id!: string + @Index_() + @Column_("int4", {nullable: false}) + chainId!: number + + @Index_() + @Column_("text", {nullable: false}) + otoken!: string + @Index_() @Column_("timestamp with time zone", {nullable: false}) timestamp!: Date @@ -18,10 +26,6 @@ export class OTokenVault { @Column_("int4", {nullable: false}) blockNumber!: number - @Index_() - @Column_("int4", {nullable: false}) - chainId!: number - @Index_() @Column_("text", {nullable: false}) address!: string diff --git a/src/model/generated/oethAddress.model.ts b/src/model/generated/oethAddress.model.ts deleted file mode 100644 index 5b7bc2f4..00000000 --- a/src/model/generated/oethAddress.model.ts +++ /dev/null @@ -1,38 +0,0 @@ -import {Entity as Entity_, Column as Column_, PrimaryColumn as PrimaryColumn_, OneToMany as OneToMany_} from "typeorm" -import * as marshal from "./marshal" -import {RebasingOption} from "./_rebasingOption" -import {OETHHistory} from "./oethHistory.model" - -/** - * The OETH balance, history and other information for a given address. - */ -@Entity_() -export class OETHAddress { - constructor(props?: Partial) { - Object.assign(this, props) - } - - @PrimaryColumn_() - id!: string - - @Column_("bool", {nullable: false}) - isContract!: boolean - - @Column_("varchar", {length: 6, nullable: false}) - rebasingOption!: RebasingOption - - @Column_("numeric", {transformer: marshal.bigintTransformer, nullable: false}) - balance!: bigint - - @Column_("numeric", {transformer: marshal.bigintTransformer, nullable: false}) - earned!: bigint - - @Column_("numeric", {transformer: marshal.bigintTransformer, nullable: false}) - credits!: bigint - - @Column_("timestamp with time zone", {nullable: false}) - lastUpdated!: Date - - @OneToMany_(() => OETHHistory, e => e.address) - history!: OETHHistory[] -} diff --git a/src/model/generated/oethRebase.model.ts b/src/model/generated/oethRebase.model.ts deleted file mode 100644 index 68aa87b5..00000000 --- a/src/model/generated/oethRebase.model.ts +++ /dev/null @@ -1,53 +0,0 @@ -import {Entity as Entity_, Column as Column_, PrimaryColumn as PrimaryColumn_, Index as Index_, ManyToOne as ManyToOne_} from "typeorm" -import * as marshal from "./marshal" -import {OETHAPY} from "./oethapy.model" - -/** - * The Rebase entity tracks historical rebase events on the OETH contract. - */ -@Entity_() -export class OETHRebase { - constructor(props?: Partial) { - Object.assign(this, props) - } - - @PrimaryColumn_() - id!: string - - @Index_() - @Column_("timestamp with time zone", {nullable: false}) - timestamp!: Date - - @Index_() - @Column_("int4", {nullable: false}) - blockNumber!: number - - @Index_() - @Column_("text", {nullable: false}) - txHash!: string - - @Column_("numeric", {transformer: marshal.bigintTransformer, nullable: false}) - totalSupply!: bigint - - @Column_("numeric", {transformer: marshal.bigintTransformer, nullable: false}) - rebasingCredits!: bigint - - @Column_("numeric", {transformer: marshal.bigintTransformer, nullable: false}) - rebasingCreditsPerToken!: bigint - - @Index_() - @ManyToOne_(() => OETHAPY, {nullable: true}) - apy!: OETHAPY - - @Column_("numeric", {transformer: marshal.bigintTransformer, nullable: false}) - feeETH!: bigint - - @Column_("numeric", {transformer: marshal.bigintTransformer, nullable: false}) - feeUSD!: bigint - - @Column_("numeric", {transformer: marshal.bigintTransformer, nullable: false}) - yieldETH!: bigint - - @Column_("numeric", {transformer: marshal.bigintTransformer, nullable: false}) - yieldUSD!: bigint -} diff --git a/src/model/generated/oethRebaseOption.model.ts b/src/model/generated/oethRebaseOption.model.ts deleted file mode 100644 index fa6dde00..00000000 --- a/src/model/generated/oethRebaseOption.model.ts +++ /dev/null @@ -1,35 +0,0 @@ -import {Entity as Entity_, Column as Column_, PrimaryColumn as PrimaryColumn_, Index as Index_, ManyToOne as ManyToOne_} from "typeorm" -import {OETHAddress} from "./oethAddress.model" -import {RebasingOption} from "./_rebasingOption" - -/** - * The RebaseOption entity tracks historical rebase option changes by address. - */ -@Entity_() -export class OETHRebaseOption { - constructor(props?: Partial) { - Object.assign(this, props) - } - - @PrimaryColumn_() - id!: string - - @Index_() - @Column_("timestamp with time zone", {nullable: false}) - timestamp!: Date - - @Index_() - @Column_("int4", {nullable: false}) - blockNumber!: number - - @Index_() - @Column_("text", {nullable: false}) - txHash!: string - - @Index_() - @ManyToOne_(() => OETHAddress, {nullable: true}) - address!: OETHAddress - - @Column_("varchar", {length: 6, nullable: false}) - status!: RebasingOption -} diff --git a/src/model/generated/ousd.model.ts b/src/model/generated/ousd.model.ts deleted file mode 100644 index a9a3cd10..00000000 --- a/src/model/generated/ousd.model.ts +++ /dev/null @@ -1,32 +0,0 @@ -import {Entity as Entity_, Column as Column_, PrimaryColumn as PrimaryColumn_, Index as Index_} from "typeorm" -import * as marshal from "./marshal" - -/** - * The OUSD entity tracks the change in total supply of OUSD over time. - */ -@Entity_() -export class OUSD { - constructor(props?: Partial) { - Object.assign(this, props) - } - - @PrimaryColumn_() - id!: string - - @Index_() - @Column_("timestamp with time zone", {nullable: false}) - timestamp!: Date - - @Index_() - @Column_("int4", {nullable: false}) - blockNumber!: number - - @Column_("numeric", {transformer: marshal.bigintTransformer, nullable: false}) - totalSupply!: bigint - - @Column_("numeric", {transformer: marshal.bigintTransformer, nullable: false}) - rebasingSupply!: bigint - - @Column_("numeric", {transformer: marshal.bigintTransformer, nullable: false}) - nonRebasingSupply!: bigint -} diff --git a/src/model/generated/ousdActivity.model.ts b/src/model/generated/ousdActivity.model.ts deleted file mode 100644 index 20c1590b..00000000 --- a/src/model/generated/ousdActivity.model.ts +++ /dev/null @@ -1,51 +0,0 @@ -import {Entity as Entity_, Column as Column_, PrimaryColumn as PrimaryColumn_, Index as Index_} from "typeorm" -import * as marshal from "./marshal" - -@Entity_() -export class OUSDActivity { - constructor(props?: Partial) { - Object.assign(this, props) - } - - @PrimaryColumn_() - id!: string - - @Index_() - @Column_("timestamp with time zone", {nullable: false}) - timestamp!: Date - - @Index_() - @Column_("int4", {nullable: false}) - blockNumber!: number - - @Index_() - @Column_("text", {nullable: false}) - txHash!: string - - @Column_("text", {nullable: false}) - callDataLast4Bytes!: string - - @Column_("text", {nullable: true}) - address!: string | undefined | null - - @Column_("text", {nullable: true}) - sighash!: string | undefined | null - - @Column_("text", {nullable: true}) - action!: string | undefined | null - - @Column_("text", {nullable: true}) - exchange!: string | undefined | null - - @Column_("text", {nullable: true}) - interface!: string | undefined | null - - @Column_("text", {nullable: true}) - fromSymbol!: string | undefined | null - - @Column_("text", {nullable: true}) - toSymbol!: string | undefined | null - - @Column_("numeric", {transformer: marshal.bigintTransformer, nullable: true}) - amount!: bigint | undefined | null -} diff --git a/src/model/generated/ousdAsset.model.ts b/src/model/generated/ousdAsset.model.ts deleted file mode 100644 index 4fcdec11..00000000 --- a/src/model/generated/ousdAsset.model.ts +++ /dev/null @@ -1,18 +0,0 @@ -import {Entity as Entity_, Column as Column_, PrimaryColumn as PrimaryColumn_, Index as Index_} from "typeorm" - -@Entity_() -export class OUSDAsset { - constructor(props?: Partial) { - Object.assign(this, props) - } - - @PrimaryColumn_() - id!: string - - @Index_() - @Column_("text", {nullable: false}) - address!: string - - @Column_("text", {nullable: false}) - symbol!: string -} diff --git a/src/model/generated/ousdHistory.model.ts b/src/model/generated/ousdHistory.model.ts deleted file mode 100644 index b68dadb6..00000000 --- a/src/model/generated/ousdHistory.model.ts +++ /dev/null @@ -1,41 +0,0 @@ -import {Entity as Entity_, Column as Column_, PrimaryColumn as PrimaryColumn_, ManyToOne as ManyToOne_, Index as Index_} from "typeorm" -import * as marshal from "./marshal" -import {OUSDAddress} from "./ousdAddress.model" -import {HistoryType} from "./_historyType" - -/** - * The History entity tracks events that change the balance of OUSD for an address. - */ -@Entity_() -export class OUSDHistory { - constructor(props?: Partial) { - Object.assign(this, props) - } - - @PrimaryColumn_() - id!: string - - @Index_() - @ManyToOne_(() => OUSDAddress, {nullable: true}) - address!: OUSDAddress - - @Column_("numeric", {transformer: marshal.bigintTransformer, nullable: false}) - value!: bigint - - @Column_("numeric", {transformer: marshal.bigintTransformer, nullable: false}) - balance!: bigint - - @Column_("timestamp with time zone", {nullable: false}) - timestamp!: Date - - @Index_() - @Column_("int4", {nullable: false}) - blockNumber!: number - - @Index_() - @Column_("text", {nullable: false}) - txHash!: string - - @Column_("varchar", {length: 8, nullable: false}) - type!: HistoryType -} diff --git a/src/model/generated/ousdapy.model.ts b/src/model/generated/ousdapy.model.ts deleted file mode 100644 index 807b63a6..00000000 --- a/src/model/generated/ousdapy.model.ts +++ /dev/null @@ -1,45 +0,0 @@ -import {Entity as Entity_, Column as Column_, PrimaryColumn as PrimaryColumn_, Index as Index_} from "typeorm" -import * as marshal from "./marshal" - -/** - * The APY entity tracks historical APY values by day. - */ -@Entity_() -export class OUSDAPY { - constructor(props?: Partial) { - Object.assign(this, props) - } - - @PrimaryColumn_() - id!: string - - @Index_() - @Column_("timestamp with time zone", {nullable: false}) - timestamp!: Date - - @Index_() - @Column_("int4", {nullable: false}) - blockNumber!: number - - @Index_() - @Column_("text", {nullable: false}) - txHash!: string - - @Column_("numeric", {transformer: marshal.floatTransformer, nullable: false}) - apr!: number - - @Column_("numeric", {transformer: marshal.floatTransformer, nullable: false}) - apy!: number - - @Column_("numeric", {transformer: marshal.floatTransformer, nullable: false}) - apy7DayAvg!: number - - @Column_("numeric", {transformer: marshal.floatTransformer, nullable: false}) - apy14DayAvg!: number - - @Column_("numeric", {transformer: marshal.floatTransformer, nullable: false}) - apy30DayAvg!: number - - @Column_("numeric", {transformer: marshal.bigintTransformer, nullable: false}) - rebasingCreditsPerToken!: bigint -} diff --git a/src/oeth/post-processors/daily-stats/daily-stats.ts b/src/oeth/post-processors/daily-stats/daily-stats.ts index 2e406f29..39a54ad1 100644 --- a/src/oeth/post-processors/daily-stats/daily-stats.ts +++ b/src/oeth/post-processors/daily-stats/daily-stats.ts @@ -9,23 +9,24 @@ import { import { ExchangeRate, - OETH, - OETHAPY, - OETHAddress, OETHBalancerMetaPoolStrategy, OETHCollateralDailyStat, OETHCurveLP, OETHDailyStat, OETHDripper, OETHFraxStaking, - OETHHistory, OETHMorphoAave, OETHStrategyDailyStat, OETHStrategyHoldingDailyStat, OETHVault, + OToken, + OTokenAPY, + OTokenAddress, + OTokenHistory, } from '@model' import { Context } from '@processor' import { EvmBatchProcessor } from '@subsquid/evm-processor' +import { OETH_ADDRESS } from '@utils/addresses' import { applyCoingeckoData } from '@utils/coingecko' dayjs.extend(utc) @@ -76,7 +77,7 @@ export const process = async (ctx: Context) => { Entity: OETHDailyStat, coinId: 'origin-ether', startTimestamp: Date.UTC(2023, 4, 17), - vsCurrency: 'eth' + vsCurrency: 'eth', })) as OETHDailyStat[] const existingIds = dailyStats.map((stat) => stat.id) dailyStats.push( @@ -97,6 +98,14 @@ async function updateDailyStats(ctx: Context, date: Date) { where: { timestamp: LessThanOrEqual(date) }, order: { timestamp: 'desc' as FindOptionsOrderValue }, } + const otokenQueryParams = { + ...queryParams, + where: { + chainId: ctx.chain.id, + otoken: OETH_ADDRESS, + ...queryParams.where, + }, + } const [ lastApy, @@ -112,8 +121,8 @@ async function updateDailyStats(ctx: Context, date: Date) { lastWrappedOETHHistory, holdersOverThreshold, ] = await Promise.all([ - ctx.store.findOne(OETHAPY, queryParams), - ctx.store.findOne(OETH, queryParams), + ctx.store.findOne(OTokenAPY, otokenQueryParams), + ctx.store.findOne(OToken, otokenQueryParams), ctx.store.findOne(OETHCurveLP, queryParams), ctx.store.findOne(OETHVault, queryParams), ctx.store.findOne(OETHBalancerMetaPoolStrategy, queryParams), @@ -128,14 +137,20 @@ async function updateDailyStats(ctx: Context, date: Date) { where: { timestamp: LessThanOrEqual(date), pair: 'ETH_sfrxETH' }, order: { timestamp: 'desc' as FindOptionsOrderValue }, }), - ctx.store.findOne(OETHHistory, { + ctx.store.findOne(OTokenHistory, { where: { + chainId: ctx.chain.id, + otoken: OETH_ADDRESS, timestamp: LessThanOrEqual(date), - address: { id: '0xdcee70654261af21c44c093c300ed3bb97b78192' }, + address: { address: '0xdcee70654261af21c44c093c300ed3bb97b78192' }, }, order: { timestamp: 'desc' as FindOptionsOrderValue }, }), - ctx.store.countBy(OETHAddress, { balance: MoreThanOrEqual(10n ** 17n) }), + ctx.store.countBy(OTokenAddress, { + chainId: ctx.chain.id, + otoken: OETH_ADDRESS, + balance: MoreThanOrEqual(10n ** 17n), + }), ]) // Do we have any useful data yet? @@ -417,8 +432,8 @@ SELECT '1 day' as period, SUM(fee_eth) as total_fees_eth, SUM(yield_eth - fee_eth) as total_yield_eth -FROM oeth_rebase -WHERE timestamp BETWEEN ($1::timestamp - interval '1 day') AND $1::timestamp +FROM o_token_rebase +WHERE chain_id = 1 AND otoken = '0x856c4efb76c1d1ae02e20ceb03a2a6a08b0b8dc3' AND timestamp BETWEEN ($1::timestamp - interval '1 day') AND $1::timestamp UNION ALL @@ -429,8 +444,8 @@ SELECT '7 days' as period, SUM(fee_eth) as total_fees_eth, SUM(yield_eth - fee_eth) as total_yield_eth -FROM oeth_rebase -WHERE timestamp BETWEEN ($1::timestamp - interval '7 days') AND $1::timestamp +FROM o_token_rebase +WHERE chain_id = 1 AND otoken = '0x856c4efb76c1d1ae02e20ceb03a2a6a08b0b8dc3' AND timestamp BETWEEN ($1::timestamp - interval '7 days') AND $1::timestamp UNION ALL @@ -441,6 +456,6 @@ SELECT 'all time' as period, SUM(fee_eth) as total_fees_eth, SUM(yield_eth - fee_eth) as total_yield_eth -FROM oeth_rebase -WHERE timestamp <= $1::timestamp +FROM o_token_rebase +WHERE chain_id = 1 AND otoken = '0x856c4efb76c1d1ae02e20ceb03a2a6a08b0b8dc3' AND timestamp <= $1::timestamp ` diff --git a/src/oeth/processors/oeth.ts b/src/oeth/processors/oeth.ts index f42e2218..61a99ac7 100644 --- a/src/oeth/processors/oeth.ts +++ b/src/oeth/processors/oeth.ts @@ -1,13 +1,3 @@ -import { - OETH, - OETHAPY, - OETHActivity, - OETHAddress, - OETHAsset, - OETHHistory, - OETHRebase, - OETHRebaseOption, -} from '@model' import { createOTokenProcessor, createOTokenSetup } from '@templates/otoken' import { ETH_ADDRESS, @@ -37,9 +27,9 @@ export const setup = createOTokenSetup({ export const process = createOTokenProcessor({ from, vaultFrom: 17084107, - OTOKEN_ADDRESS: OETH_ADDRESS, - WOTOKEN_ADDRESS: WOETH_ADDRESS, - OTOKEN_VAULT_ADDRESS: OETH_VAULT_ADDRESS, + otokenAddress: OETH_ADDRESS, + wotokenAddress: WOETH_ADDRESS, + otokenVaultAddress: OETH_VAULT_ADDRESS, oTokenAssets: [ { asset: ETH_ADDRESS, symbol: 'ETH' }, { asset: WETH_ADDRESS, symbol: 'WETH' }, @@ -50,12 +40,4 @@ export const process = createOTokenProcessor({ { asset: WSTETH_ADDRESS, symbol: 'wstETH' }, { asset: OETH_ADDRESS, symbol: 'OETH' }, ], - OToken: OETH, - OTokenAsset: OETHAsset, - OTokenAddress: OETHAddress, - OTokenHistory: OETHHistory, - OTokenAPY: OETHAPY, - OTokenRebase: OETHRebase, - OTokenRebaseOption: OETHRebaseOption, - OTokenActivity: OETHActivity, }) diff --git a/src/oeth/validators/validate-oeth/validate-oeth.ts b/src/oeth/validators/validate-oeth/validate-oeth.ts index 1f647350..b4fcad10 100644 --- a/src/oeth/validators/validate-oeth/validate-oeth.ts +++ b/src/oeth/validators/validate-oeth/validate-oeth.ts @@ -2,11 +2,11 @@ import assert from 'assert' import { sortBy } from 'lodash' import { - OETHAPY, - OETHHistory, OETHMorphoAave, - OETHRebase, OETHVault, + OTokenAPY, + OTokenHistory, + OTokenRebase, StrategyBalance, } from '@model' import { Block, Context } from '@processor' @@ -21,14 +21,19 @@ let firstBlock = true export const process = async (ctx: Context) => { if (env.BLOCK_FROM) return for (const block of ctx.blocks) { - await validateExpectations(ctx, block, OETHAPY, expectations.oethApies) + await validateExpectations(ctx, block, OTokenAPY, expectations.oethApies) await validateExpectations( ctx, block, - OETHHistory, + OTokenHistory, expectations.oethHistories, ) - await validateExpectations(ctx, block, OETHRebase, expectations.oethRebases) + await validateExpectations( + ctx, + block, + OTokenRebase, + expectations.oethRebases, + ) await validateExpectations(ctx, block, OETHVault, expectations.oethVaults) await validateExpectations( ctx, @@ -115,7 +120,10 @@ const e = (arr: any[]) => { const expectations = { oethApies: e([ { - id: '2023-05-21', + id: '1-0x856c4efb76c1d1ae02e20ceb03a2a6a08b0b8dc3-2023-05-21', + chainId: 1, + otoken: '0x856c4efb76c1d1ae02e20ceb03a2a6a08b0b8dc3', + date: '2023-05-21', blockNumber: 17308770, timestamp: '2023-05-21T15:56:35.000000Z', apr: 0.1176475, @@ -128,7 +136,10 @@ const expectations = { '0x51f29d85120bcfd778966df4e48b76a3c71c9c234cf7b25686e4ac91db412d8c', }, { - id: '2023-07-10', + id: '1-0x856c4efb76c1d1ae02e20ceb03a2a6a08b0b8dc3-2023-07-10', + chainId: 1, + otoken: '0x856c4efb76c1d1ae02e20ceb03a2a6a08b0b8dc3', + date: '2023-07-10', blockNumber: 17665600, timestamp: '2023-07-10T20:21:35.000000Z', apr: 0.09370518, @@ -141,7 +152,10 @@ const expectations = { '0x6f4bdbbe1ae933cd140a0d438c7e5f4c68b9deead2768263d7641e90d4a0a097', }, { - id: '2023-07-11', + id: '1-0x856c4efb76c1d1ae02e20ceb03a2a6a08b0b8dc3-2023-07-11', + chainId: 1, + otoken: '0x856c4efb76c1d1ae02e20ceb03a2a6a08b0b8dc3', + date: '2023-07-11', blockNumber: 17670987, timestamp: '2023-07-11T14:32:35.000000Z', apr: 0.08226324, @@ -154,7 +168,10 @@ const expectations = { '0x8f7bf364b8f76174643efc8b32f301d1e2face0f076f1b01f65b8c9f01d408c5', }, { - id: '2023-09-17', + id: '1-0x856c4efb76c1d1ae02e20ceb03a2a6a08b0b8dc3-2023-09-17', + chainId: 1, + otoken: '0x856c4efb76c1d1ae02e20ceb03a2a6a08b0b8dc3', + date: '2023-09-17', blockNumber: 18154149, timestamp: '2023-09-17T06:59:47.000000Z', apr: 0.07639744, @@ -167,7 +184,10 @@ const expectations = { '0xa4533cc844d8e5a52f444bc32dba546b404860cafa642c210973be6a12242aeb', }, { - id: '2023-10-25', + id: '1-0x856c4efb76c1d1ae02e20ceb03a2a6a08b0b8dc3-2023-10-25', + chainId: 1, + otoken: '0x856c4efb76c1d1ae02e20ceb03a2a6a08b0b8dc3', + date: '2023-10-25', blockNumber: 18425626, timestamp: '2023-10-25T07:00:11.000000Z', apr: 0.03307518, @@ -182,9 +202,11 @@ const expectations = { ]), oethHistories: e([ { + id: '1-0x856c4efb76c1d1ae02e20ceb03a2a6a08b0b8dc3-0017684499-32534-000297-0x0ad9ea110bdd131683c0d36df8ba80cd3ed1a5fb-1', + chainId: 1, + otoken: '0x856c4efb76c1d1ae02e20ceb03a2a6a08b0b8dc3', balance: '4994819891394470874', blockNumber: 17684499, - id: '0017684499-32534-000297-0x0ad9ea110bdd131683c0d36df8ba80cd3ed1a5fb-1', timestamp: '2023-07-13T12:12:23.000000Z', txHash: '0x51dc5890e7057aa049a8ee3675e9f5a2d1df8afae3ccf1aae7991d2141b082bb', @@ -192,9 +214,11 @@ const expectations = { value: '4994819891394470874', }, { + id: '1-0x856c4efb76c1d1ae02e20ceb03a2a6a08b0b8dc3-0017780803-d030b-000424-0x24902aa0cf0000a08c0ea0b003b0c0bf600000e0-1', + chainId: 1, + otoken: '0x856c4efb76c1d1ae02e20ceb03a2a6a08b0b8dc3', balance: '989', blockNumber: 17780803, - id: '0017780803-d030b-000424-0x24902aa0cf0000a08c0ea0b003b0c0bf600000e0-1', timestamp: '2023-07-27T00:22:23.000000Z', txHash: '0x723583207fa4221d4ad6d606b43927019e088c93c0edcbcd89a62c6327e1925f', @@ -202,9 +226,11 @@ const expectations = { value: '81', }, { + id: '1-0x856c4efb76c1d1ae02e20ceb03a2a6a08b0b8dc3-0018161346-142ff-000161-0xdcee70654261af21c44c093c300ed3bb97b78192-1', + chainId: 1, + otoken: '0x856c4efb76c1d1ae02e20ceb03a2a6a08b0b8dc3', balance: '3620809167086458796690', blockNumber: 18161346, - id: '0018161346-142ff-000161-0xdcee70654261af21c44c093c300ed3bb97b78192-1', timestamp: '2023-09-18T07:27:11.000000Z', txHash: '0xa66fbf3fb92fc8d44e2790a1692ce5e9f10139f0bf728da2533c8d5e7b4a1a70', @@ -212,9 +238,11 @@ const expectations = { value: '316259151664720778', }, { + id: '1-0x856c4efb76c1d1ae02e20ceb03a2a6a08b0b8dc3-0018412140-00f48-000178-0xc69bfa6ab78853a4addb9b6c553102c7e62ada15-1', + chainId: 1, + otoken: '0x856c4efb76c1d1ae02e20ceb03a2a6a08b0b8dc3', balance: '30999999999999', blockNumber: 18412140, - id: '0018412140-00f48-000178-0xc69bfa6ab78853a4addb9b6c553102c7e62ada15-1', timestamp: '2023-10-23T09:41:23.000000Z', txHash: '0xc1cdeca03c9214546cf820a725ed6c730860479197c19c6fa1836f1d92a9eb09', @@ -222,9 +250,11 @@ const expectations = { value: '10000000000000', }, { + id: '1-0x856c4efb76c1d1ae02e20ceb03a2a6a08b0b8dc3-0018229171-264de-000263-0x018abc2b6bc71013efd9f98f2104ca53132db615-1', + chainId: 1, + otoken: '0x856c4efb76c1d1ae02e20ceb03a2a6a08b0b8dc3', balance: '199908452113059508', blockNumber: 18229171, - id: '0018229171-264de-000263-0x018abc2b6bc71013efd9f98f2104ca53132db615-1', timestamp: '2023-09-27T19:26:47.000000Z', txHash: '0x4dfaca9c52226b02c6ebd16f97bab0159370bf3e9f252a48ff965700e27f4653', @@ -232,9 +262,11 @@ const expectations = { value: '108554825178258', }, { + id: '1-0x856c4efb76c1d1ae02e20ceb03a2a6a08b0b8dc3-0017130412-770f2-000118-0x94b17476a93b3262d87b9a326965d1e91f9c13e7-1', + chainId: 1, + otoken: '0x856c4efb76c1d1ae02e20ceb03a2a6a08b0b8dc3', balance: '70007164149821693', blockNumber: 17130412, - id: '0017130412-770f2-000118-0x94b17476a93b3262d87b9a326965d1e91f9c13e7-1', timestamp: '2023-04-26T12:30:59.000000Z', txHash: '0xf9498f5b8d65e7f7252a515edcc3af4cd3b0e96ee841ef82f11de349ded5f330', @@ -242,9 +274,11 @@ const expectations = { value: '-9992835850178307', }, { + id: '1-0x856c4efb76c1d1ae02e20ceb03a2a6a08b0b8dc3-0017542358-8207a-000170-0x9ffd0a5b5438b95861167422e745d34d151bcc3b-1', + chainId: 1, + otoken: '0x856c4efb76c1d1ae02e20ceb03a2a6a08b0b8dc3', balance: '0', blockNumber: 17542358, - id: '0017542358-8207a-000170-0x9ffd0a5b5438b95861167422e745d34d151bcc3b-1', timestamp: '2023-06-23T12:46:47.000000Z', txHash: '0x02d96712bdceff945b568905980bc747e920b58cab2191b6ac04a6f0223efd6d', @@ -252,9 +286,11 @@ const expectations = { value: '-753495508936036139', }, { + id: '1-0x856c4efb76c1d1ae02e20ceb03a2a6a08b0b8dc3-0018202824-52e26-000167-0x9c51ff53e842eeec93f9d5efbf52f6a02591755c-1', + chainId: 1, + otoken: '0x856c4efb76c1d1ae02e20ceb03a2a6a08b0b8dc3', balance: '0', blockNumber: 18202824, - id: '0018202824-52e26-000167-0x9c51ff53e842eeec93f9d5efbf52f6a02591755c-1', timestamp: '2023-09-24T02:55:59.000000Z', txHash: '0x427dd09882a59b6906d40b5031029fbd34e4ebc747b4429cc8cad1aefb9e62c5', @@ -262,9 +298,11 @@ const expectations = { value: '-33861098543774741169', }, { + id: '1-0x856c4efb76c1d1ae02e20ceb03a2a6a08b0b8dc3-0018260101-20cba-000216-0xe4bac3e44e8080e1491c11119197d33e396ea82b-1', + chainId: 1, + otoken: '0x856c4efb76c1d1ae02e20ceb03a2a6a08b0b8dc3', balance: '0', blockNumber: 18260101, - id: '0018260101-20cba-000216-0xe4bac3e44e8080e1491c11119197d33e396ea82b-1', timestamp: '2023-10-02T03:16:23.000000Z', txHash: '0xb8b8a275a004ccfbc4159989cec584b266c148153dd37658b8a26966d39d18de', @@ -272,9 +310,11 @@ const expectations = { value: '-20491766350512037673', }, { + id: '1-0x856c4efb76c1d1ae02e20ceb03a2a6a08b0b8dc3-0018154738-13b93-000203-0x9c51ff53e842eeec93f9d5efbf52f6a02591755c-1', + chainId: 1, + otoken: '0x856c4efb76c1d1ae02e20ceb03a2a6a08b0b8dc3', balance: '35811706077256008074', blockNumber: 18154738, - id: '0018154738-13b93-000203-0x9c51ff53e842eeec93f9d5efbf52f6a02591755c-1', timestamp: '2023-09-17T09:00:35.000000Z', txHash: '0x931e5cea2e7d4551691988867947489594d30cdef7acd0906fd7607e887e5aae', @@ -282,9 +322,11 @@ const expectations = { value: '-1200000000000000000', }, { + id: '1-0x856c4efb76c1d1ae02e20ceb03a2a6a08b0b8dc3-0017150073-0f425-000306-0x58890a9cb27586e83cb51d2d26bbe18a1a647245-1', + chainId: 1, + otoken: '0x856c4efb76c1d1ae02e20ceb03a2a6a08b0b8dc3', balance: '49999999999999999', blockNumber: 17150073, - id: '0017150073-0f425-000306-0x58890a9cb27586e83cb51d2d26bbe18a1a647245-1', timestamp: '2023-04-29T06:48:11.000000Z', txHash: '0x4af5c7b310ae8c814ae6e5415da99f9c9f414e6b4ca8257cd1dea1a6d9067b36', @@ -292,9 +334,11 @@ const expectations = { value: '49999999999999999', }, { + id: '1-0x856c4efb76c1d1ae02e20ceb03a2a6a08b0b8dc3-0017278567-1f61f-000195-0x79b664dba8015e3aa505fa4507f0d64df7e451e2-1', + chainId: 1, + otoken: '0x856c4efb76c1d1ae02e20ceb03a2a6a08b0b8dc3', balance: '375433998881638354', blockNumber: 17278567, - id: '0017278567-1f61f-000195-0x79b664dba8015e3aa505fa4507f0d64df7e451e2-1', timestamp: '2023-05-17T09:47:23.000000Z', txHash: '0xd9a0e30f23956cb91293cb44a6e54b6d6bbe772e3d70b5e68a1760b28c8f78ef', @@ -302,9 +346,11 @@ const expectations = { value: '375433998881638354', }, { + id: '1-0x856c4efb76c1d1ae02e20ceb03a2a6a08b0b8dc3-0017286539-4976c-000156-0x938500c0df0fdc138c28ddf4bc4289107c7354ce-1', + chainId: 1, + otoken: '0x856c4efb76c1d1ae02e20ceb03a2a6a08b0b8dc3', balance: '1499066120128420574', blockNumber: 17286539, - id: '0017286539-4976c-000156-0x938500c0df0fdc138c28ddf4bc4289107c7354ce-1', timestamp: '2023-05-18T12:49:35.000000Z', txHash: '0xcd68e7d50fcb683add60e71253673af2ff2547e6375d40ffc4639a1410bc3104', @@ -312,9 +358,11 @@ const expectations = { value: '1499066120128420574', }, { + id: '1-0x856c4efb76c1d1ae02e20ceb03a2a6a08b0b8dc3-0017633180-d89c5-000408-0xf14bbdf064e3f67f51cd9bd646ae3716ad938fdc-1', + chainId: 1, + otoken: '0x856c4efb76c1d1ae02e20ceb03a2a6a08b0b8dc3', balance: '5384270268711162736', blockNumber: 17633180, - id: '0017633180-d89c5-000408-0xf14bbdf064e3f67f51cd9bd646ae3716ad938fdc-1', timestamp: '2023-07-06T07:00:11.000000Z', txHash: '0x97db34103137321f032b4a54ccaed3112d054bc1204125ac862a0b81fb3f3279', @@ -322,9 +370,11 @@ const expectations = { value: '1273337667112407520', }, { + id: '1-0x856c4efb76c1d1ae02e20ceb03a2a6a08b0b8dc3-0017299409-9ce80-000434-0xf14bbdf064e3f67f51cd9bd646ae3716ad938fdc-1', + chainId: 1, + otoken: '0x856c4efb76c1d1ae02e20ceb03a2a6a08b0b8dc3', balance: '674774321229336771', blockNumber: 17299409, - id: '0017299409-9ce80-000434-0xf14bbdf064e3f67f51cd9bd646ae3716ad938fdc-1', timestamp: '2023-05-20T08:19:59.000000Z', txHash: '0x787fbdec5e65927b0e1b48601d891f48d7671db88fc4c11ac74f8e874e667936', @@ -332,9 +382,11 @@ const expectations = { value: '1049118249013688', }, { + id: '1-0x856c4efb76c1d1ae02e20ceb03a2a6a08b0b8dc3-0017275137-66451-000516-0xdcee70654261af21c44c093c300ed3bb97b78192-1', + chainId: 1, + otoken: '0x856c4efb76c1d1ae02e20ceb03a2a6a08b0b8dc3', balance: '32292882396504207', blockNumber: 17275137, - id: '0017275137-66451-000516-0xdcee70654261af21c44c093c300ed3bb97b78192-1', timestamp: '2023-05-16T22:12:35.000000Z', txHash: '0x24d1f4ff2ad45826b91206594d706af0866bca1f5d20377d070679599a2dbe55', @@ -342,9 +394,11 @@ const expectations = { value: '218258202002', }, { + id: '1-0x856c4efb76c1d1ae02e20ceb03a2a6a08b0b8dc3-0017276891-12fd3-000052-0x57b0dd7967955c92b6e34a038b47fee63e1efd1a-1', + chainId: 1, + otoken: '0x856c4efb76c1d1ae02e20ceb03a2a6a08b0b8dc3', balance: '10070499668604762317', blockNumber: 17276891, - id: '0017276891-12fd3-000052-0x57b0dd7967955c92b6e34a038b47fee63e1efd1a-1', timestamp: '2023-05-17T04:08:11.000000Z', txHash: '0x76fe3dc19782ba2e1274f81dd4347dcacc151960918b1b52bb91582a9d49ab50', @@ -352,9 +406,11 @@ const expectations = { value: '16150488605744', }, { + id: '1-0x856c4efb76c1d1ae02e20ceb03a2a6a08b0b8dc3-0017277099-05d64-000273-0xd6415162f48140d6090959cb8068174c68e81705-1', + chainId: 1, + otoken: '0x856c4efb76c1d1ae02e20ceb03a2a6a08b0b8dc3', balance: '100429877759821', blockNumber: 17277099, - id: '0017277099-05d64-000273-0xd6415162f48140d6090959cb8068174c68e81705-1', timestamp: '2023-05-17T04:49:59.000000Z', txHash: '0xeec79549578a28e024ce86def3784830d28c26b8fe1bfe4bde093f4854b32cde', @@ -362,9 +418,11 @@ const expectations = { value: '87786385', }, { + id: '1-0x856c4efb76c1d1ae02e20ceb03a2a6a08b0b8dc3-0017283304-32e6f-000280-0xfd9e6005187f448957a0972a7d0c0a6da2911236-1', + chainId: 1, + otoken: '0x856c4efb76c1d1ae02e20ceb03a2a6a08b0b8dc3', balance: '1025746659014252', blockNumber: 17283304, - id: '0017283304-32e6f-000280-0xfd9e6005187f448957a0972a7d0c0a6da2911236-1', timestamp: '2023-05-18T01:54:23.000000Z', txHash: '0xaa9c72db7346ea7de332196f6df85d4f47c6fe42e3b7f7fcdc0965933486b128', @@ -372,9 +430,11 @@ const expectations = { value: '1492199898', }, { + id: '1-0x856c4efb76c1d1ae02e20ceb03a2a6a08b0b8dc3-0017283378-fde11-000634-0x2f19980c3acd87f6d9468663c9a9839c12456a14-1', + chainId: 1, + otoken: '0x856c4efb76c1d1ae02e20ceb03a2a6a08b0b8dc3', balance: '261226340935297362', blockNumber: 17283378, - id: '0017283378-fde11-000634-0x2f19980c3acd87f6d9468663c9a9839c12456a14-1', timestamp: '2023-05-18T02:09:23.000000Z', txHash: '0xda99a68fd12da72f11d68e5997fa1cccea120a4e5a5b71d2e660785ddf5251ab', @@ -384,7 +444,9 @@ const expectations = { ]), oethRebases: e([ { - id: '0017305345-5f62d-000456', + id: '1-0x856c4efb76c1d1ae02e20ceb03a2a6a08b0b8dc3-0017305345-5f62d-000456', + chainId: 1, + otoken: '0x856c4efb76c1d1ae02e20ceb03a2a6a08b0b8dc3', blockNumber: 17305345, timestamp: '2023-05-21T04:22:11.000000Z', feeETH: '6000055597516131', @@ -398,7 +460,9 @@ const expectations = { yieldUSD: '54581905765044493913', }, { - id: '0017331591-f9f77-000369', + id: '1-0x856c4efb76c1d1ae02e20ceb03a2a6a08b0b8dc3-0017331591-f9f77-000369', + chainId: 1, + otoken: '0x856c4efb76c1d1ae02e20ceb03a2a6a08b0b8dc3', blockNumber: 17331591, timestamp: '2023-05-24T21:02:59.000000Z', feeETH: '6492737577781034', @@ -412,7 +476,9 @@ const expectations = { yieldUSD: '58635661471359380845', }, { - id: '0017583331-dccba-000121', + id: '1-0x856c4efb76c1d1ae02e20ceb03a2a6a08b0b8dc3-0017583331-dccba-000121', + chainId: 1, + otoken: '0x856c4efb76c1d1ae02e20ceb03a2a6a08b0b8dc3', blockNumber: 17583331, timestamp: '2023-06-29T07:00:23.000000Z', feeETH: '577769460917579313', @@ -426,7 +492,9 @@ const expectations = { yieldUSD: '5312387973825820632114', }, { - id: '0018139997-52abd-000303', + id: '1-0x856c4efb76c1d1ae02e20ceb03a2a6a08b0b8dc3-0018139997-52abd-000303', + chainId: 1, + otoken: '0x856c4efb76c1d1ae02e20ceb03a2a6a08b0b8dc3', blockNumber: 18139997, timestamp: '2023-09-15T06:59:59.000000Z', feeETH: '1190995054063049444', @@ -440,7 +508,9 @@ const expectations = { yieldUSD: '9709765827507120051257', }, { - id: '0018404209-b6b49-000053', + id: '1-0x856c4efb76c1d1ae02e20ceb03a2a6a08b0b8dc3-0018404209-b6b49-000053', + chainId: 1, + otoken: '0x856c4efb76c1d1ae02e20ceb03a2a6a08b0b8dc3', blockNumber: 18404209, timestamp: '2023-10-22T06:59:47.000000Z', feeETH: '885619331985372380', diff --git a/src/ousd/post-processors/daily-stats/daily-stats.ts b/src/ousd/post-processors/daily-stats/daily-stats.ts index d2c689b2..00a02aac 100644 --- a/src/ousd/post-processors/daily-stats/daily-stats.ts +++ b/src/ousd/post-processors/daily-stats/daily-stats.ts @@ -8,12 +8,12 @@ import { } from 'typeorm' import { - OUSD, - OUSDAPY, - OUSDAddress, + OToken, + OTokenAPY, + OTokenAddress, + OTokenHistory, OUSDCollateralDailyStat, OUSDDailyStat, - OUSDHistory, OUSDMorphoAave, OUSDStrategyDailyStat, OUSDStrategyHoldingDailyStat, @@ -21,6 +21,7 @@ import { } from '@model' import { Context } from '@processor' import { EvmBatchProcessor } from '@subsquid/evm-processor' +import { OUSD_ADDRESS } from '@utils/addresses' import { applyCoingeckoData } from '@utils/coingecko' dayjs.extend(utc) @@ -90,6 +91,14 @@ async function updateDailyStats(ctx: Context, date: Date) { where: { timestamp: LessThanOrEqual(date) }, order: { timestamp: 'desc' as FindOptionsOrderValue }, } + const otokenQueryParams = { + ...queryParams, + where: { + chainId: ctx.chain.id, + otoken: OUSD_ADDRESS, + ...queryParams.where, + }, + } const [ lastApy, @@ -99,18 +108,24 @@ async function updateDailyStats(ctx: Context, date: Date) { lastWrappedOUSDHistory, holdersOverThreshold, ] = await Promise.all([ - ctx.store.findOne(OUSDAPY, queryParams), - ctx.store.findOne(OUSD, queryParams), + ctx.store.findOne(OTokenAPY, otokenQueryParams), + ctx.store.findOne(OToken, otokenQueryParams), ctx.store.findOne(OUSDVault, queryParams), ctx.store.findOne(OUSDMorphoAave, queryParams), - ctx.store.findOne(OUSDHistory, { + ctx.store.findOne(OTokenHistory, { where: { + chainId: ctx.chain.id, + otoken: OUSD_ADDRESS, timestamp: LessThanOrEqual(date), - address: { id: '0xd2af830e8cbdfed6cc11bab697bb25496ed6fa62' }, + address: { address: '0xd2af830e8cbdfed6cc11bab697bb25496ed6fa62' }, }, order: { timestamp: 'desc' as FindOptionsOrderValue }, }), - ctx.store.countBy(OUSDAddress, { balance: MoreThanOrEqual(10n ** 20n) }), // $100 + ctx.store.countBy(OTokenAddress, { + chainId: ctx.chain.id, + otoken: OUSD_ADDRESS, + balance: MoreThanOrEqual(10n ** 20n), // $100 + }), ]) // Do we have any useful data yet? @@ -235,8 +250,8 @@ SELECT '1 day' as period, SUM(fee_eth) as total_fees_eth, SUM(yield_eth - fee_eth) as total_yield_eth -FROM ousd_rebase -WHERE timestamp BETWEEN ($1::timestamp - interval '1 day') AND $1::timestamp +FROM o_token_rebase +WHERE chain_id = 1 AND otoken = '0x2a8e1e676ec238d8a992307b495b45b3feaa5e86' AND timestamp BETWEEN ($1::timestamp - interval '1 day') AND $1::timestamp UNION ALL @@ -247,8 +262,8 @@ SELECT '7 days' as period, SUM(fee_eth) as total_fees_eth, SUM(yield_eth - fee_eth) as total_yield_eth -FROM ousd_rebase -WHERE timestamp BETWEEN ($1::timestamp - interval '7 days') AND $1::timestamp +FROM o_token_rebase +WHERE chain_id = 1 AND otoken = '0x2a8e1e676ec238d8a992307b495b45b3feaa5e86' AND timestamp BETWEEN ($1::timestamp - interval '7 days') AND $1::timestamp UNION ALL @@ -259,6 +274,6 @@ SELECT 'all time' as period, SUM(fee_eth) as total_fees_eth, SUM(yield_eth - fee_eth) as total_yield_eth -FROM ousd_rebase -WHERE timestamp <= $1::timestamp +FROM o_token_rebase +WHERE chain_id = 1 AND otoken = '0x2a8e1e676ec238d8a992307b495b45b3feaa5e86' AND timestamp <= $1::timestamp ` diff --git a/src/ousd/processors/ousd/ousd.ts b/src/ousd/processors/ousd/ousd.ts index 0c852798..3aed8c93 100644 --- a/src/ousd/processors/ousd/ousd.ts +++ b/src/ousd/processors/ousd/ousd.ts @@ -1,13 +1,3 @@ -import { - OUSD, - OUSDAPY, - OUSDActivity, - OUSDAddress, - OUSDAsset, - OUSDHistory, - OUSDRebase, - OUSDRebaseOption, -} from '@model' import { createOTokenProcessor, createOTokenSetup } from '@templates/otoken' import { DAI_ADDRESS, @@ -31,19 +21,11 @@ export const process = createOTokenProcessor({ from, vaultFrom: 11596942, Upgrade_CreditsBalanceOfHighRes: 13533937, // https://etherscan.io/tx/0xc9b6fc6a4fad18dad197ff7d0636f74bf066671d75656849a1c45122e00d54cf - OTOKEN_ADDRESS: OUSD_ADDRESS, - OTOKEN_VAULT_ADDRESS: OUSD_VAULT_ADDRESS, + otokenAddress: OUSD_ADDRESS, + otokenVaultAddress: OUSD_VAULT_ADDRESS, oTokenAssets: [ { asset: USDC_ADDRESS, symbol: 'USDC' }, { asset: USDT_ADDRESS, symbol: 'USDT' }, { asset: DAI_ADDRESS, symbol: 'DAI' }, ], - OToken: OUSD, - OTokenAsset: OUSDAsset, - OTokenAddress: OUSDAddress, - OTokenHistory: OUSDHistory, - OTokenAPY: OUSDAPY, - OTokenRebase: OUSDRebase, - OTokenRebaseOption: OUSDRebaseOption, - OTokenActivity: OUSDActivity, }) diff --git a/src/templates/otoken/otoken.ts b/src/templates/otoken/otoken.ts index 0a60a6c3..e04c133d 100644 --- a/src/templates/otoken/otoken.ts +++ b/src/templates/otoken/otoken.ts @@ -6,23 +6,15 @@ import * as otoken from '@abi/otoken' import * as otokenVault from '@abi/otoken-vault' import { HistoryType, - OETH, - OETHAPY, - OETHActivity, - OETHAddress, - OETHAsset, - OETHHistory, - OETHRebase, - OETHRebaseOption, + OToken, + OTokenAPY, + OTokenActivity, + OTokenAddress, + OTokenAsset, + OTokenHistory, + OTokenRebase, + OTokenRebaseOption, OTokenVault, - OUSD, - OUSDAPY, - OUSDActivity, - OUSDAddress, - OUSDAsset, - OUSDHistory, - OUSDRebase, - OUSDRebaseOption, RebasingOption, } from '@model' import { Context } from '@processor' @@ -37,22 +29,10 @@ import { ADDRESS_ZERO } from '@utils/addresses' import { blockFrequencyUpdater } from '@utils/blockFrequencyUpdater' import { DECIMALS_18 } from '@utils/constants' import { multicall } from '@utils/multicall' -import { EntityClassT, InstanceTypeOfConstructor } from '@utils/type' import { getLatestEntity } from '@utils/utils' import { createAddress, createRebaseAPY } from './utils' -type OToken = EntityClassT | EntityClassT -type OTokenAsset = EntityClassT | EntityClassT -type OTokenAPY = EntityClassT | EntityClassT -type OTokenActivity = EntityClassT | EntityClassT -type OTokenAddress = EntityClassT | EntityClassT -type OTokenHistory = EntityClassT | EntityClassT -type OTokenRebase = EntityClassT | EntityClassT -type OTokenRebaseOption = - | EntityClassT - | EntityClassT - export const createOTokenSetup = ({ address, @@ -109,29 +89,21 @@ export const createOTokenProcessor = (params: { from: number vaultFrom: number Upgrade_CreditsBalanceOfHighRes?: number - OTOKEN_ADDRESS: string - WOTOKEN_ADDRESS?: string - OTOKEN_VAULT_ADDRESS: string + otokenAddress: string + wotokenAddress?: string + otokenVaultAddress: string oTokenAssets: { asset: CurrencyAddress; symbol: CurrencySymbol }[] - OToken: OToken - OTokenAsset: OTokenAsset - OTokenAPY: OTokenAPY - OTokenAddress: OTokenAddress - OTokenHistory: OTokenHistory - OTokenActivity: OTokenActivity - OTokenRebase: OTokenRebase - OTokenRebaseOption: OTokenRebaseOption }) => { interface ProcessResult { initialized: boolean initialize: () => Promise - otokens: InstanceTypeOfConstructor[] - assets: InstanceTypeOfConstructor[] - history: InstanceTypeOfConstructor[] - rebases: InstanceTypeOfConstructor[] - rebaseOptions: InstanceTypeOfConstructor[] - apies: InstanceTypeOfConstructor[] - activity: InstanceTypeOfConstructor[] + otokens: OToken[] + assets: OTokenAsset[] + history: OTokenHistory[] + rebases: OTokenRebase[] + rebaseOptions: OTokenRebaseOption[] + apies: OTokenAPY[] + activity: OTokenActivity[] vaults: OTokenVault[] lastYieldDistributionEvent?: { fee: bigint @@ -139,9 +111,7 @@ export const createOTokenProcessor = (params: { } } - let owners: - | Map> - | undefined = undefined + let owners: Map | undefined = undefined let idMap: Map const getUniqueId = (partialId: string) => { @@ -163,20 +133,22 @@ export const createOTokenProcessor = (params: { // get all addresses from the database. // we need this because we increase their balance based on rebase events owners = await ctx.store - .find>( - params.OTokenAddress as any, - ) - .then((q) => new Map(q.map((i) => [i.id, i]))) - - const assetsCount = await ctx.store.count< - InstanceTypeOfConstructor - >(params.OTokenAsset as any) + .find(OTokenAddress, { + where: { chainId: ctx.chain.id, otoken: params.otokenAddress }, + }) + .then((q) => new Map(q.map((i) => [i.address, i]))) + + const assetsCount = await ctx.store.count(OTokenAsset, { + where: { chainId: ctx.chain.id, otoken: params.otokenAddress }, + }) if (assetsCount === 0) { result.assets.push( ...params.oTokenAssets.map( ({ asset, symbol }) => - new params.OTokenAsset({ - id: asset, + new OTokenAsset({ + id: `${ctx.chain.id}-${params.otokenAddress}-${asset}`, + chainId: ctx.chain.id, + otoken: params.otokenAddress, address: asset, symbol: symbol, }), @@ -211,15 +183,16 @@ export const createOTokenProcessor = (params: { const vaultContract = new otokenVault.Contract( ctx, block.header, - params.OTOKEN_VAULT_ADDRESS, + params.otokenVaultAddress, ) result.vaults.push( new OTokenVault({ - id: `${ctx.chain.id}-${block.header.height}-${params.OTOKEN_VAULT_ADDRESS}`, + id: `${ctx.chain.id}-${params.otokenAddress}-${block.header.height}-${params.otokenVaultAddress}`, + chainId: ctx.chain.id, + otoken: params.otokenAddress, blockNumber: block.header.height, timestamp: new Date(block.header.timestamp), - chainId: ctx.chain.id, - address: params.OTOKEN_VAULT_ADDRESS, + address: params.otokenVaultAddress, totalValue: await vaultContract.totalValue(), }), ) @@ -246,7 +219,7 @@ export const createOTokenProcessor = (params: { block: Context['blocks']['0'], log: Context['blocks']['0']['logs']['0'], ) => { - if (log.address !== params.OTOKEN_ADDRESS) return + if (log.address !== params.otokenAddress) return if (log.topics[0] === otoken.events.Transfer.topic) { await result.initialize() const dataRaw = otoken.events.Transfer.decode(log) @@ -267,8 +240,8 @@ export const createOTokenProcessor = (params: { const ensureAddress = async (address: string) => { let entity = owners!.get(address) if (!entity) { - entity = await createAddress(params.OTokenAddress, ctx, address) - owners!.set(entity.id, entity) + entity = await createAddress(ctx, params.otokenAddress, address) + owners!.set(entity.address, entity) } entity.lastUpdated = new Date(block.header.timestamp) return entity @@ -290,7 +263,7 @@ export const createOTokenProcessor = (params: { ? otoken.functions.creditsBalanceOfHighres : (otoken.functions .creditsBalanceOf as unknown as typeof otoken.functions.creditsBalanceOfHighres), - params.OTOKEN_ADDRESS, + params.otokenAddress, [[data.from], [data.to]], ).then((results) => { if (afterHighResUpgrade) { @@ -310,7 +283,7 @@ export const createOTokenProcessor = (params: { address, credits, }: { - address: InstanceTypeOfConstructor + address: OTokenAddress credits: [bigint, bigint] }) => { const newBalance = (credits[0] * DECIMALS_18) / credits[1] @@ -319,9 +292,13 @@ export const createOTokenProcessor = (params: { const type = addressSub === address ? HistoryType.Sent : HistoryType.Received result.history.push( - new params.OTokenHistory({ + new OTokenHistory({ // we can't use {t.id} because it's not unique - id: getUniqueId(`${log.id}-${address.id}`), + id: getUniqueId( + `${ctx.chain.id}-${params.otokenAddress}-${log.id}-${address.id}`, + ), + chainId: ctx.chain.id, + otoken: params.otokenAddress, address: address, value: change, balance: newBalance, @@ -389,7 +366,7 @@ export const createOTokenProcessor = (params: { const logs = block.logs const groupedLogs = groupBy(logs, (log) => log.transactionHash) for (const [txHash, logs] of Object.entries(groupedLogs)) { - const log = logs.find((l) => l.address === params.OTOKEN_ADDRESS) + const log = logs.find((l) => l.address === params.otokenAddress) const transaction = log?.transaction as unknown as Transaction if (log && transaction) { // We need to get the whole transaction receipt for all related logs. @@ -407,8 +384,12 @@ export const createOTokenProcessor = (params: { if (activity) { for (const item of activity) { result.activity.push( - new params.OTokenActivity({ - id: getUniqueId(log.id), + new OTokenActivity({ + id: getUniqueId( + `${ctx.chain.id}-${params.otokenAddress}-${log.id}`, + ), + chainId: ctx.chain.id, + otoken: params.otokenAddress, timestamp: new Date(block.header.timestamp), blockNumber: block.header.height, txHash: log.transactionHash, @@ -429,7 +410,7 @@ export const createOTokenProcessor = (params: { block: Context['blocks']['0'], log: Context['blocks']['0']['logs']['0'], ) => { - if (log.address !== params.OTOKEN_ADDRESS) return + if (log.address !== params.otokenAddress) return if (log.topics[0] !== otoken.events.TotalSupplyUpdatedHighres.topic) return await result.initialize() @@ -452,9 +433,8 @@ export const createOTokenProcessor = (params: { // Rebase events const rebase = createRebaseAPY( - params.OTokenAPY, - params.OTokenRebase, ctx, + params.otokenAddress, result.apies, block, log, @@ -476,9 +456,13 @@ export const createOTokenProcessor = (params: { if (earned === 0n) continue result.history.push( - new params.OTokenHistory({ - id: getUniqueId(`${log.id}-${address.id}`), + new OTokenHistory({ + id: getUniqueId( + `${ctx.chain.id}-${params.otokenAddress}-${log.id}-${address.id}`, + ), // we can't use {t.id} because it's not unique + chainId: ctx.chain.id, + otoken: params.otokenAddress, address: address, value: earned, balance: newBalance, @@ -502,7 +486,7 @@ export const createOTokenProcessor = (params: { block: Context['blocks']['0'], log: Context['blocks']['0']['logs']['0'], ) => { - if (log.address !== params.OTOKEN_VAULT_ADDRESS) return + if (log.address !== params.otokenVaultAddress) return if (log.topics[0] !== otokenVault.events.YieldDistribution.topic) return await result.initialize() @@ -518,7 +502,7 @@ export const createOTokenProcessor = (params: { ) => { if ( trace.type === 'call' && - params.OTOKEN_ADDRESS === trace.action.to && + params.otokenAddress === trace.action.to && (trace.action.sighash === otoken.functions.governanceRebaseOptIn.sighash || trace.action.sighash === otoken.functions.rebaseOptIn.sighash || @@ -536,16 +520,21 @@ export const createOTokenProcessor = (params: { let owner = owners!.get(address) if (!owner) { owner = await createAddress( - params.OTokenAddress, ctx, + params.otokenAddress, address, timestamp, ) owners!.set(address, owner) } - const rebaseOption = new params.OTokenRebaseOption({ - id: getUniqueId(`${trace.transaction?.hash!}-${owner.id}`), + const rebaseOption = new OTokenRebaseOption({ + id: getUniqueId( + `${ctx.chain.id}-${params.otokenAddress}-${trace.transaction + ?.hash!}-${owner.address}`, + ), + chainId: ctx.chain.id, + otoken: params.otokenAddress, timestamp, blockNumber, txHash: trace.transaction?.hash, @@ -559,14 +548,14 @@ export const createOTokenProcessor = (params: { const otokenContract = new otoken.Contract( ctx, block.header, - params.OTOKEN_ADDRESS, + params.otokenAddress, ) owner.credits = afterHighResUpgrade ? await otokenContract - .creditsBalanceOfHighres(owner.id) + .creditsBalanceOfHighres(owner.address) .then((c) => c[0]) : await otokenContract - .creditsBalanceOf(owner.id) + .creditsBalanceOf(owner.address) .then((c) => c[0] * 1000000000n) owner.rebasingOption = RebasingOption.OptIn rebaseOption.status = RebasingOption.OptIn @@ -596,7 +585,7 @@ export const createOTokenProcessor = (params: { block: Context['blocks']['0'], log: Context['blocks']['0']['logs']['0'], ) => { - if (log.address !== params.OTOKEN_ADDRESS) return + if (log.address !== params.otokenAddress) return if (rebaseEventTopics[log.topics[0]]) { await result.initialize() const timestamp = new Date(block.header.timestamp) @@ -607,16 +596,22 @@ export const createOTokenProcessor = (params: { let owner = owners!.get(address) if (!owner) { owner = await createAddress( - params.OTokenAddress, ctx, + params.otokenAddress, address, timestamp, ) owners!.set(address, owner) } - const rebaseOption = new params.OTokenRebaseOption({ - id: getUniqueId(`${log.transactionHash!}-${owner.id}`), + const rebaseOption = new OTokenRebaseOption({ + id: getUniqueId( + `${ctx.chain.id}-${params.otokenAddress}-${log.transactionHash!}-${ + owner.address + }`, + ), + chainId: ctx.chain.id, + otoken: params.otokenAddress, timestamp, blockNumber, txHash: log.transactionHash, @@ -646,18 +641,22 @@ export const createOTokenProcessor = (params: { result: ProcessResult, block: Context['blocks']['0'], ) => { - const timestampId = new Date(block.header.timestamp).toISOString() + const timestamp = new Date(block.header.timestamp).toISOString() + const otokenId = `${ctx.chain.id}-${params.otokenAddress}-${timestamp}` const { latest, current } = await getLatestEntity( ctx, - params.OToken as any, + OToken, result.otokens, - timestampId, + otokenId, + { chainId: ctx.chain.id, otoken: params.otokenAddress }, ) let otokenObject = current if (!otokenObject) { - otokenObject = new params.OToken({ - id: timestampId, + otokenObject = new OToken({ + id: otokenId, + chainId: ctx.chain.id, + otoken: params.otokenAddress, timestamp: new Date(block.header.timestamp), blockNumber: block.header.height, totalSupply: latest?.totalSupply ?? 0n, diff --git a/src/templates/otoken/utils.ts b/src/templates/otoken/utils.ts index 5ae18578..60ad4248 100644 --- a/src/templates/otoken/utils.ts +++ b/src/templates/otoken/utils.ts @@ -5,12 +5,9 @@ import { LessThan, MoreThanOrEqual } from 'typeorm' import * as otoken from '@abi/otoken' import { ExchangeRate, - OETHAPY, - OETHAddress, - OETHRebase, - OUSDAPY, - OUSDAddress, - OUSDRebase, + OTokenAPY, + OTokenAddress, + OTokenRebase, RebasingOption, } from '@model' import { Context } from '@processor' @@ -21,9 +18,12 @@ dayjs.extend(utc) /** * Create a new Address entity */ -export async function createAddress< - T extends typeof OETHAddress | typeof OUSDAddress, ->(entity: T, ctx: Context, addr: string, lastUpdated?: Date) { +export async function createAddress( + ctx: Context, + otoken: string, + addr: string, + lastUpdated?: Date, +) { let isContract: boolean = false if (addr !== '0x0000000000000000000000000000000000000000') { isContract = @@ -31,8 +31,11 @@ export async function createAddress< } // ctx.log.info(`New address ${rawAddress}`); - return new entity({ - id: addr, + return new OTokenAddress({ + id: `${ctx.chain.id}-${otoken}-${addr}`, // TODO: this change likely affects other behavior + chainId: ctx.chain.id, + otoken, + address: addr, balance: 0n, earned: 0n, credits: 0n, @@ -45,14 +48,10 @@ export async function createAddress< /** * Create Rebase entity and set APY */ -export async function createRebaseAPY< - TOTokenAPY extends typeof OETHAPY | typeof OUSDAPY, - TOTokenRebase extends typeof OETHRebase | typeof OUSDRebase, ->( - OTokenAPY: TOTokenAPY, - OTokenRebase: TOTokenRebase, +export async function createRebaseAPY( ctx: Context, - apies: InstanceType[], + otokenAddress: string, + apies: OTokenAPY[], block: Context['blocks']['0'], log: Context['blocks']['0']['logs']['0'], rebaseEvent: ReturnType< @@ -85,7 +84,9 @@ export async function createRebaseAPY< } const rebase = new OTokenRebase({ - id: log.id, + id: `${ctx.chain.id}-${otokenAddress}-${log.id}`, + chainId: ctx.chain.id, + otoken: otokenAddress, blockNumber: block.header.height, timestamp: new Date(block.header.timestamp), txHash: log.transactionHash, @@ -104,20 +105,26 @@ export async function createRebaseAPY< // get last APY to compare with current one let lastApy = - apies.find((apy) => apy.id < dateId) ?? + apies.find((apy) => apy.date < dateId) ?? (await ctx.store.findOne(OTokenAPY, { - where: { id: LessThan(dateId) }, + where: { + chainId: ctx.chain.id, + otoken: otokenAddress, + date: LessThan(dateId), + }, order: { id: 'DESC' }, })) // check if there is already an APY for the current date - let apy: InstanceType | undefined = apies.find( - (apy) => apy.id === dateId, - ) + let apy: OTokenAPY | undefined = apies.find((apy) => apy.date === dateId) if (!apy) { - apy = (await ctx.store.findOne(OTokenAPY, { - where: { id: dateId }, - })) as InstanceType + apy = await ctx.store.findOne(OTokenAPY, { + where: { + chainId: ctx.chain.id, + otoken: otokenAddress, + date: dateId, + }, + }) if (apy) { apies.push(apy) } @@ -126,12 +133,15 @@ export async function createRebaseAPY< // create a new APY if it doesn't exist if (!apy) { apy = new OTokenAPY({ - id: dateId, + id: `${ctx.chain.id}-${otokenAddress}-${dateId}`, + chainId: ctx.chain.id, + otoken: otokenAddress, blockNumber: block.header.height, timestamp: new Date(block.header.timestamp), + date: dateId, txHash: log.transactionHash, rebasingCreditsPerToken: rebaseEvent.rebasingCreditsPerToken, - }) as InstanceType + }) apies.push(apy) } @@ -181,7 +191,9 @@ export async function createRebaseAPY< const last30daysAPYs = await ctx.store.find(OTokenAPY, { where: { - id: MoreThanOrEqual(last30daysDateId.value), + chainId: ctx.chain.id, + otoken: otokenAddress, + date: MoreThanOrEqual(last30daysDateId.value), }, order: { id: 'asc' }, }) diff --git a/src/utils/utils.ts b/src/utils/utils.ts index 6103fd1b..eb0f31db 100644 --- a/src/utils/utils.ts +++ b/src/utils/utils.ts @@ -1,4 +1,4 @@ -import { LessThanOrEqual } from 'typeorm' +import { FindOptionsWhere, LessThanOrEqual } from 'typeorm' import { pad } from 'viem' import * as erc20 from '@abi/erc20' @@ -60,39 +60,18 @@ export const getLatestEntity = async ( entity: EntityClass, memory: T[], id: string, + where?: FindOptionsWhere, ) => { const current = memory.slice(memory.length - 1).find((v) => v.id === id) const latest = memory[memory.length - 1] ?? (await ctx.store.findOne(entity as EntityClass, { - where: { id: LessThanOrEqual(id) }, + where: { id: LessThanOrEqual(id), ...where }, order: { id: 'desc' }, })) return { current, latest } } -export const getOrCreate = async ( - ctx: Context, - entity: EntityClass, - memory: T[], - id: string, - createNew: (latest: T | undefined) => T, -) => { - const current = memory.slice(memory.length - 1).find((v) => v.id === id) - if (current) return current - const latest = - memory[memory.length - 1] ?? - (await ctx.store.findOne(entity as EntityClass, { - where: { id: LessThanOrEqual(id) }, - order: { id: 'desc' }, - })) - - const value = createNew(latest) - memory.push(value) - - return value -} - export const convertDecimals = (from: number, to: number, value: bigint) => { const fromFactor = 10n ** BigInt(from) const toFactor = 10n ** BigInt(to) From cae2b723ac7e5e16979cf82ef21d6be0b56b73cd Mon Sep 17 00:00:00 2001 From: Chris Jacobs Date: Wed, 24 Apr 2024 13:44:08 -0700 Subject: [PATCH 02/12] fixes, data validation, improve coingecko processing --- package-lock.json | 10 + package.json | 1 + schema-oeth.graphql | 15 -- src/main-oeth.ts | 2 +- src/main-ousd.ts | 10 +- src/main.ts | 4 +- .../validators/validate-oeth/validate-oeth.ts | 137 +++++----- .../validators/validate-ousd/validate-ousd.ts | 233 +++++++++++++++--- src/templates/otoken/otoken.ts | 4 +- src/templates/otoken/utils.ts | 3 +- src/utils/addresses.ts | 2 + src/utils/coingecko.ts | 65 ++--- src/utils/queryClient.ts | 3 + 13 files changed, 315 insertions(+), 174 deletions(-) create mode 100644 src/utils/queryClient.ts diff --git a/package-lock.json b/package-lock.json index 840c5b7b..13c98719 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11,6 +11,7 @@ "@subsquid/graphql-server": "^4.5.1", "@subsquid/typeorm-migration": "^1.3.0", "@subsquid/typeorm-store": "^1.3.0", + "@tanstack/query-core": "^5.32.0", "@types/lodash": "^4.14.200", "dayjs": "^1.11.10", "dotenv": "^16.1.4", @@ -1592,6 +1593,15 @@ "resolved": "https://registry.npmjs.org/@subsquid/util-timeout/-/util-timeout-2.3.2.tgz", "integrity": "sha512-DVUnuiWAX7/4ZvbzuHENUShEEV4G0M38mQ/+R8DpHxwpCSrtEaSRaUMwdyUSn/WVqR7wo9+jkLCxFjE5feCURQ==" }, + "node_modules/@tanstack/query-core": { + "version": "5.32.0", + "resolved": "https://registry.npmjs.org/@tanstack/query-core/-/query-core-5.32.0.tgz", + "integrity": "sha512-Z3flEgCat55DRXU5UMwYU1U+DgFZKA3iufyOKs+II7iRAo0uXkeU7PH5e6sOH1CGEag0IpKmZxlUFpCg6roSKw==", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/tannerlinsley" + } + }, "node_modules/@trivago/prettier-plugin-sort-imports": { "version": "4.3.0", "resolved": "https://registry.npmjs.org/@trivago/prettier-plugin-sort-imports/-/prettier-plugin-sort-imports-4.3.0.tgz", diff --git a/package.json b/package.json index ea4dee0e..9bf1b0e5 100644 --- a/package.json +++ b/package.json @@ -23,6 +23,7 @@ "@subsquid/graphql-server": "^4.5.1", "@subsquid/typeorm-migration": "^1.3.0", "@subsquid/typeorm-store": "^1.3.0", + "@tanstack/query-core": "^5.32.0", "@types/lodash": "^4.14.200", "dayjs": "^1.11.10", "dotenv": "^16.1.4", diff --git a/schema-oeth.graphql b/schema-oeth.graphql index 501a9916..4e254184 100644 --- a/schema-oeth.graphql +++ b/schema-oeth.graphql @@ -156,24 +156,9 @@ type OETHStrategyHoldingDailyStat @entity { type OETHCollateralDailyStat @entity { id: ID! dailyStatId: OETHDailyStat! @index - """ - Token symbol - """ symbol: String! - - """ - Amount held - """ amount: BigInt! - - """ - Price in ETH - """ price: BigInt! - - """ - Total ETH value - """ value: BigInt! } diff --git a/src/main-oeth.ts b/src/main-oeth.ts index 3c00d3f0..5aebb80d 100644 --- a/src/main-oeth.ts +++ b/src/main-oeth.ts @@ -36,7 +36,7 @@ export const processor = { dailyStats, processStatus('oeth'), ], - validators: [], + validators: [validateOeth], } export default processor diff --git a/src/main-ousd.ts b/src/main-ousd.ts index fc072991..ad173e93 100644 --- a/src/main-ousd.ts +++ b/src/main-ousd.ts @@ -1,7 +1,7 @@ import 'tsconfig-paths/register' import { run } from '@processor' -import * as exchangeRates from '@shared/post-processors/exchange-rates' +import * as exchangeRatesPostProcessor from '@shared/post-processors/exchange-rates' import { processStatus } from '@templates/processor-status' import * as dailyStats from './ousd/post-processors/daily-stats' @@ -14,8 +14,12 @@ import * as validateOusd from './ousd/validators/validate-ousd' export const processor = { stateSchema: 'ousd-processor', processors: [ousd, strategies, curve, ...erc20s], - postProcessors: [exchangeRates, dailyStats, processStatus('ousd')], - validators: [], + postProcessors: [ + exchangeRatesPostProcessor, + dailyStats, + processStatus('ousd'), + ], + validators: [validateOusd], } export default processor diff --git a/src/main.ts b/src/main.ts index 769ff41b..460180b7 100644 --- a/src/main.ts +++ b/src/main.ts @@ -8,8 +8,8 @@ import oeth from './main-oeth' import ogv from './main-ogv' import ousd from './main-ousd' -// run(mainnet) -// run(arbitrum) +run(mainnet) +run(arbitrum) run(oeth) // run(ogv) run(ousd) diff --git a/src/oeth/validators/validate-oeth/validate-oeth.ts b/src/oeth/validators/validate-oeth/validate-oeth.ts index b4fcad10..c1582f98 100644 --- a/src/oeth/validators/validate-oeth/validate-oeth.ts +++ b/src/oeth/validators/validate-oeth/validate-oeth.ts @@ -1,7 +1,8 @@ import assert from 'assert' -import { sortBy } from 'lodash' +import { pick, sortBy } from 'lodash' import { + OETHDailyStat, OETHMorphoAave, OETHVault, OTokenAPY, @@ -26,13 +27,13 @@ export const process = async (ctx: Context) => { ctx, block, OTokenHistory, - expectations.oethHistories, + expectations.oTokenHistories, ) await validateExpectations( ctx, block, OTokenRebase, - expectations.oethRebases, + expectations.oTokenRebases, ) await validateExpectations(ctx, block, OETHVault, expectations.oethVaults) await validateExpectations( @@ -47,6 +48,12 @@ export const process = async (ctx: Context) => { StrategyBalance, expectations.strategyBalances, ) + await validateExpectations( + ctx, + block, + OETHDailyStat, + expectations.oethDailyStats, + ) firstBlock = false } } @@ -100,7 +107,7 @@ const validateExpectation = async < // We decide to only care about float decimal accuracy to the 8th. assert.deepEqual( JSON.parse( - jsonify(actual, (_key, value) => + jsonify(pick(actual, Object.keys(expectation)), (_key, value) => typeof value === 'number' ? Number(value.toFixed(8)) : value, ), ), @@ -200,7 +207,7 @@ const expectations = { '0x67ef6bda379e51a3983f7c2822b39538a40fb93b1d26f66b687da41657f17239', }, ]), - oethHistories: e([ + oTokenHistories: e([ { id: '1-0x856c4efb76c1d1ae02e20ceb03a2a6a08b0b8dc3-0017684499-32534-000297-0x0ad9ea110bdd131683c0d36df8ba80cd3ed1a5fb-1', chainId: 1, @@ -442,86 +449,22 @@ const expectations = { value: '13753918397190', }, ]), - oethRebases: e([ - { - id: '1-0x856c4efb76c1d1ae02e20ceb03a2a6a08b0b8dc3-0017305345-5f62d-000456', - chainId: 1, - otoken: '0x856c4efb76c1d1ae02e20ceb03a2a6a08b0b8dc3', - blockNumber: 17305345, - timestamp: '2023-05-21T04:22:11.000000Z', - feeETH: '6000055597516131', - feeUSD: '10916381153008898418', - rebasingCredits: '2787113542887662778878885791818', - rebasingCreditsPerToken: '973864011520629021168619646', - totalSupply: '4100236147122104146565', - txHash: - '0x7de27a14c9f139d9019e6f067dc926de5a1318d1c8703696d1f87c7e11b405eb', - yieldETH: '30000277987580656', - yieldUSD: '54581905765044493913', - }, - { - id: '1-0x856c4efb76c1d1ae02e20ceb03a2a6a08b0b8dc3-0017331591-f9f77-000369', - chainId: 1, - otoken: '0x856c4efb76c1d1ae02e20ceb03a2a6a08b0b8dc3', - blockNumber: 17331591, - timestamp: '2023-05-24T21:02:59.000000Z', - feeETH: '6492737577781034', - feeUSD: '11727132294271875807', - rebasingCredits: '3677621799805326022027580379682', - rebasingCreditsPerToken: '972810711211478539104302424', - totalSupply: '5393628338867046745384', - txHash: - '0x651848930f76eb8677a2d90067841ae1d5419276dafb7828d145eeb482b362cc', - yieldETH: '32463687888905171', - yieldUSD: '58635661471359380845', - }, + oTokenRebases: e([ { - id: '1-0x856c4efb76c1d1ae02e20ceb03a2a6a08b0b8dc3-0017583331-dccba-000121', + id: '1-0x856c4efb76c1d1ae02e20ceb03a2a6a08b0b8dc3-0018839758-1fe83-000178', chainId: 1, otoken: '0x856c4efb76c1d1ae02e20ceb03a2a6a08b0b8dc3', - blockNumber: 17583331, - timestamp: '2023-06-29T07:00:23.000000Z', - feeETH: '577769460917579313', - feeUSD: '1062477594765164126055', - rebasingCredits: '11978493735413759353827056755312', - rebasingCreditsPerToken: '963907687618519656276956464', - totalSupply: '21187279626610714331049', + blockNumber: 18839758, + feeETH: '612691541583690021', + feeUSD: '1395031244116487971914', + rebasingCredits: '20200262904648402920454474975673', + rebasingCreditsPerToken: '933172493517843356160213805', + timestamp: '2023-12-22T06:59:47.000000Z', txHash: - '0xe9261579ff7ccbbbe0cc5895a376c8177409a8a0503acf3bf04ee106ccb9c540', - yieldETH: '2888847304587896566', - yieldUSD: '5312387973825820632114', - }, - { - id: '1-0x856c4efb76c1d1ae02e20ceb03a2a6a08b0b8dc3-0018139997-52abd-000303', - chainId: 1, - otoken: '0x856c4efb76c1d1ae02e20ceb03a2a6a08b0b8dc3', - blockNumber: 18139997, - timestamp: '2023-09-15T06:59:59.000000Z', - feeETH: '1190995054063049444', - feeUSD: '1941953165501424009925', - rebasingCredits: '22395831398283302999639860139823', - rebasingCreditsPerToken: '948155891702979766036181091', - totalSupply: '44971365122525849270172', - txHash: - '0xb3441c6184326378fe98af3cb3e425c015a5a2cce4d0055f2e8c3b0dc1bcdd98', - yieldETH: '5954975270315247221', - yieldUSD: '9709765827507120051257', - }, - { - id: '1-0x856c4efb76c1d1ae02e20ceb03a2a6a08b0b8dc3-0018404209-b6b49-000053', - chainId: 1, - otoken: '0x856c4efb76c1d1ae02e20ceb03a2a6a08b0b8dc3', - blockNumber: 18404209, - timestamp: '2023-10-22T06:59:47.000000Z', - feeETH: '885619331985372380', - feeUSD: '1455772085654965614517', - rebasingCredits: '29496888949221038689228739185366', - rebasingCreditsPerToken: '941672759591769536254510513', - totalSupply: '41530447614871349372266', - txHash: - '0x1eab96d75579c8050869ffadec5d38bccf8a9714f49d6e27ce67088f15be0535', - yieldETH: '4428096659926861900', - yieldUSD: '7278860428274828072586', + '0xbb8b4049faf16ffab0534820531bd8a4f28ab5249cf9f918469df86cec141362', + totalSupply: '37874235864992721244103', + yieldETH: '3063457707918450106', + yieldUSD: '6975156220582439861850', }, ]), oethVaults: e([ @@ -585,4 +528,36 @@ const expectations = { strategyBalances: e([ // Place verified strategy balances in here. ]), + oethDailyStats: e([ + { + amoSupply: '1722869226314461370269', + apr: 0.03984340561303246, + apy14DayAvg: 0.04809284054588773, + apy: 0.040645540495481525, + apy30DayAvg: 0.05619014587400031, + apy7DayAvg: 0.04625612224632996, + blockNumber: 19008501, + dripperWETH: '29850741093608056030', + feesETH: '878804180645600601', + feesETH7Day: '6700325402009187818', + feesETHAllTime: '230978291319157636904', + feesUSD: '2243350542568443313402', + feesUSD7Day: '16449862756198776028058', + feesUSDAllTime: '436111742452357635874322', + holdersOverThreshold: 275, + id: '2024-01-14', + nonRebasingSupply: '3679373640235293829673', + rebasingSupply: '32229193002740154821849', + timestamp: '2024-01-14T23:47:23.000000Z', + totalSupply: '35908566642975448651522', + totalSupplyUSD: 0, + wrappedSupply: '1879893054273530385147', + yieldETH: '3515216722582402407', + yieldETH7Day: '26801301608036751292', + yieldETHAllTime: '923913165276630548993', + yieldUSD: '8973402170273773261269', + yieldUSD7Day: '65799451024795104161690', + yieldUSDAllTime: '1744446969809430546091488', + }, + ]), } as const diff --git a/src/ousd/validators/validate-ousd/validate-ousd.ts b/src/ousd/validators/validate-ousd/validate-ousd.ts index 9377e7c7..46472251 100644 --- a/src/ousd/validators/validate-ousd/validate-ousd.ts +++ b/src/ousd/validators/validate-ousd/validate-ousd.ts @@ -1,7 +1,12 @@ import assert from 'assert' -import { sortBy } from 'lodash' +import { pick, sortBy } from 'lodash' -import { StrategyYield } from '@model' +import { + OTokenHistory, + OTokenRebase, + OUSDDailyStat, + StrategyYield, +} from '@model' import { Block, Context } from '@processor' import { Entity, EntityClass } from '@subsquid/typeorm-store' import { env } from '@utils/env' @@ -20,6 +25,24 @@ export const process = async (ctx: Context) => { StrategyYield, expectations.strategyYields, ) + await validateExpectations( + ctx, + block, + OTokenHistory, + expectations.oTokenHistories, + ) + await validateExpectations( + ctx, + block, + OTokenRebase, + expectations.oTokenRebases, + ) + await validateExpectations( + ctx, + block, + OUSDDailyStat, + expectations.ousdDailyStats, + ) firstBlock = false } } @@ -73,7 +96,7 @@ const validateExpectation = async < // We decide to only care about float decimal accuracy to the 8th. assert.deepEqual( JSON.parse( - jsonify(actual, (_key, value) => + jsonify(pick(actual, Object.keys(expectation)), (_key, value) => typeof value === 'number' ? Number(value.toFixed(8)) : value, ), ), @@ -91,39 +114,175 @@ 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([]), + oTokenApies: e([ + { + id: '1-0x2a8e1e676ec238d8a992307b495b45b3feaa5e86-2021-11-09', + chainId: 1, + otoken: '0x2a8e1e676ec238d8a992307b495b45b3feaa5e86', + date: '2021-11-09', + blockNumber: 13580743, + apy7DayAvg: 0.13083488137587887, + apy30DayAvg: 0.11214418403646761, + apy14DayAvg: 0.11214418403646761, + apy: 0.09583265106767636, + apr: 0.09152595180820716, + rebasingCreditsPerToken: '852686447110306439510756300', + timestamp: '2021-11-09T06:59:40.000000Z', + txHash: + '0x8100a86ef0b23789be3ca200886e4b9cb4209e5c97e59eaf744b9181267ae4b3', + }, + { + id: '1-0x2a8e1e676ec238d8a992307b495b45b3feaa5e86-2021-12-06', + chainId: 1, + otoken: '0x2a8e1e676ec238d8a992307b495b45b3feaa5e86', + date: '2021-12-06', + blockNumber: 13750845, + apy7DayAvg: 0.3063852155268674, + apy30DayAvg: 0.3021672341297935, + apy14DayAvg: 0.38192706131093695, + apy: 0.37250920744724025, + apr: 0.31677789277204865, + rebasingCreditsPerToken: '836987556812892596511761169', + timestamp: '2021-12-06T06:59:47.000000Z', + txHash: + '0x2d403152b1758105818fd597e03a9993c0c6308326f511d40ef856dc899bbba2', + }, + ]), + oTokenHistories: e([ + { + id: '1-0x2a8e1e676ec238d8a992307b495b45b3feaa5e86-0011786453-b501f-000267-0x9315cdb9dc37550f42b12a183de7b5a7876dc9f8-1', + chainId: 1, + blockNumber: 11786453, + balance: '5000000000000000000000', + otoken: '0x2a8e1e676ec238d8a992307b495b45b3feaa5e86', + timestamp: '2021-02-04T00:08:32.000000Z', + txHash: + '0x951a57d616a98aeaeeb1df722d6c1565da20ad74fa410db95a80c28da3c88175', + type: 'Received', + value: '5000000000000000000000', + }, + { + id: '1-0x2a8e1e676ec238d8a992307b495b45b3feaa5e86-0012348966-f91a7-000067-0x9315cdb9dc37550f42b12a183de7b5a7876dc9f8-1', + chainId: 1, + blockNumber: 12348966, + balance: '1', + otoken: '0x2a8e1e676ec238d8a992307b495b45b3feaa5e86', + timestamp: '2021-05-01T14:59:47.000000Z', + txHash: + '0x5643e6f85bab24cf1057a09d20c7fa353d895d96d0c114141b6792c76c93dfc2', + type: 'Sent', + value: '-4999999999999999999999', + }, + ]), + oTokenRebases: e([ + { + id: '1-0x2a8e1e676ec238d8a992307b495b45b3feaa5e86-0014883457-a66bb-000005', + chainId: 1, + otoken: '0x2a8e1e676ec238d8a992307b495b45b3feaa5e86', + blockNumber: 14883457, + feeETH: '346263724854739034559', + feeUSD: '670496543700164855741218', + rebasingCredits: '28313629639061008328884206782869381', + rebasingCreditsPerToken: '793786451700174206240401619', + timestamp: '2022-06-01T06:59:39.000000Z', + txHash: + '0xca8bb9f49e9135e81cb7f8c0876bfdce54352bbf45ceeda567144ca488ec1df5', + totalSupply: '63608906999875802980711462', + yieldETH: '3462637248547390345598', + yieldUSD: '6704965437001648557427672', + }, + ]), + ousdDailyStats: e([ + { + id: '2023-06-19', + holdersOverThreshold: 555, + feesUSDAllTime: '518443780713833984166537', + feesUSD7Day: '2795514743154392531029', + feesUSD: '516254133283871531214', + feesETHAllTime: '210278929630796719347', + feesETH7Day: '1645271818769497295', + feesETH: '299347387486610177', + dripperWETH: '0', + blockNumber: 17515264, + apy7DayAvg: 0.04004694410575804, + apy30DayAvg: 0.0507262369607351, + apy14DayAvg: 0.04238561434050587, + apy: 0.05247056754803858, + apr: 0.05114390222068438, + amoSupply: '0', + nonRebasingSupply: '9117247109542906814603812', + rebasingSupply: '14754699093487549370944968', + timestamp: '2023-06-19T17:25:59.000000Z', + totalSupply: '23871946203030456185548780', + totalSupplyUSD: 0, + wrappedSupply: '1070892535136679523311083', + yieldETH: '1197389549946440721', + yieldETH7Day: '6581087275077989208', + yieldETHAllTime: '1827815866678964531379', + yieldUSD: '2065016533135486124859', + yieldUSD7Day: '11182058972617570124126', + yieldUSDAllTime: '4547849622244762681832073', + }, + { + id: '2023-09-25', + holdersOverThreshold: 527, + feesUSDAllTime: '557455670955180080472479', + feesUSD7Day: '2408539505622701328488', + feesUSD: '327704746233735207946', + feesETHAllTime: '232250310113095634904', + feesETH7Day: '1497963059707839608', + feesETH: '207514451227360360', + dripperWETH: '0', + blockNumber: 18212428, + apy7DayAvg: 0.05434693946070146, + apy30DayAvg: 0.05267689946449996, + apy14DayAvg: 0.05496003977745272, + apy: 0.052211543561102136, + apr: 0.050897727114944225, + amoSupply: '0', + nonRebasingSupply: '6772299022398961480910233', + rebasingSupply: '9198342543657099205207141', + timestamp: '2023-09-25T11:13:23.000000Z', + totalSupply: '15970641566056060686117374', + totalSupplyUSD: 0, + wrappedSupply: '79695352346338177503254', + yieldETH: '830057804909441443', + yieldETH7Day: '5991852238831358449', + yieldETHAllTime: '1915701388608160193826', + yieldUSD: '1310818984934940831786', + yieldUSD7Day: '9634158022490805313962', + yieldUSDAllTime: '4703897183210147067056057', + }, + { + id: '2024-03-02', + holdersOverThreshold: 480, + feesUSDAllTime: '640842823767036278915355', + feesUSD7Day: '3365292401878836638613', + feesUSD: '579150934767120286041', + feesETHAllTime: '270919962292839152887', + feesETH7Day: '1023766060336515495', + feesETH: '168279071355301816', + dripperWETH: '0', + blockNumber: 19348264, + apy7DayAvg: 0.0607815460682393, + apy30DayAvg: 0.06418055003707576, + apy14DayAvg: 0.06908341133353671, + apy: 0.074705394129575, + apr: 0.0720536782079989, + amoSupply: '0', + nonRebasingSupply: '937326268136034563062459', + rebasingSupply: '11735579881028694809662571', + timestamp: '2024-03-02T15:05:35.000000Z', + totalSupply: '12672906149164729372725030', + totalSupplyUSD: 0, + wrappedSupply: '81907611918642936108297', + yieldETH: '673116285421207268', + yieldETH7Day: '4095064241346062000', + yieldETHAllTime: '2070379997327134266107', + yieldUSD: '2316603739068481144165', + yieldUSD7Day: '13461169607515346554469', + yieldUSDAllTime: '5037445794457571860827906', + }, ]), } as const diff --git a/src/templates/otoken/otoken.ts b/src/templates/otoken/otoken.ts index e04c133d..a4245cda 100644 --- a/src/templates/otoken/otoken.ts +++ b/src/templates/otoken/otoken.ts @@ -295,7 +295,7 @@ export const createOTokenProcessor = (params: { new OTokenHistory({ // we can't use {t.id} because it's not unique id: getUniqueId( - `${ctx.chain.id}-${params.otokenAddress}-${log.id}-${address.id}`, + `${ctx.chain.id}-${params.otokenAddress}-${log.id}-${address.address}`, ), chainId: ctx.chain.id, otoken: params.otokenAddress, @@ -458,7 +458,7 @@ export const createOTokenProcessor = (params: { result.history.push( new OTokenHistory({ id: getUniqueId( - `${ctx.chain.id}-${params.otokenAddress}-${log.id}-${address.id}`, + `${ctx.chain.id}-${params.otokenAddress}-${log.id}-${address.address}`, ), // we can't use {t.id} because it's not unique chainId: ctx.chain.id, diff --git a/src/templates/otoken/utils.ts b/src/templates/otoken/utils.ts index 60ad4248..5e31750c 100644 --- a/src/templates/otoken/utils.ts +++ b/src/templates/otoken/utils.ts @@ -11,6 +11,7 @@ import { RebasingOption, } from '@model' import { Context } from '@processor' +import { OUSD_STABLE_OTOKENS } from '@utils/addresses' import { calculateAPY } from '@utils/calculateAPY' dayjs.extend(utc) @@ -71,7 +72,7 @@ export async function createRebaseAPY( const generateId = (date: dayjs.Dayjs | string | Date | number) => dayjs.utc(date).toISOString().substring(0, 10) - if (OTokenAPY.name === 'OUSDAPY') { + if (OUSD_STABLE_OTOKENS.includes(otokenAddress)) { feeUSD = lastYieldDistributionEvent.fee yieldUSD = lastYieldDistributionEvent.yield feeETH = (feeUSD * 1000000000000000000n) / rate / 10000000000n diff --git a/src/utils/addresses.ts b/src/utils/addresses.ts index 5a752de5..5b51a1cc 100644 --- a/src/utils/addresses.ts +++ b/src/utils/addresses.ts @@ -15,6 +15,8 @@ export const OUSD_HARVESTER_ADDRESS = '0x21fb5812d70b3396880d30e90d9e5c1202266c89' export const OUSD_DRIPPER_ADDRESS = '0x80c898ae5e56f888365e235ceb8cea3eb726cb58' +export const OUSD_STABLE_OTOKENS = [OUSD_ADDRESS] + export const OETH_ADDRESS = '0x856c4efb76c1d1ae02e20ceb03a2a6a08b0b8dc3' export const OETH_VAULT_ADDRESS = '0x39254033945aa2e4809cc2977e7087bee48bd7ab' export const OETH_HARVESTER_ADDRESS = `0x0d017afa83eace9f10a8ec5b6e13941664a6785c` diff --git a/src/utils/coingecko.ts b/src/utils/coingecko.ts index 332bf4c1..78f1f8bd 100644 --- a/src/utils/coingecko.ts +++ b/src/utils/coingecko.ts @@ -3,6 +3,7 @@ import { parseEther } from 'viem' import { OETHDailyStat, OGVDailyStat, OUSDDailyStat } from '@model' import { Context } from '@processor' +import { queryClient } from '@utils/queryClient' import { EntityClassT } from '@utils/type' type DailyStat = @@ -79,13 +80,6 @@ export async function applyCoingeckoData( startTimestamp?: number }, ) { - // Avoid rate limit issues in Coingecko by only running once every 20 blocks. - if ( - ctx.blocks.length < 20 && - !ctx.blocks.find((b) => b.header.height % 20 === 0) - ) { - return [] - } const { Entity } = props const updatedStats = [] @@ -110,33 +104,40 @@ export async function applyCoingeckoData( console.log(`Found ${statsWithNoPrice.length} stats with no price`) // console.log(JSON.stringify(statsWithNoPrice.map((s) => s.id))) const coingeckoURL = `https://api.coingecko.com/api/v3/coins/${props.coinId}/market_chart?vs_currency=${vsCurrency}&days=365&interval=daily&precision=18` - const coingeckoResponse = await fetch(coingeckoURL) - if (coingeckoResponse.status === 429) { - console.log('Coingecko rate limited') + const coingeckoJson = await queryClient.fetchQuery({ + queryKey: [coingeckoURL], + queryFn: async () => { + const response = await fetch(coingeckoURL) + if (response.status === 429) { + throw new Error('Coingecko rate limited') + } + return await response.json() + }, + + staleTime: 600_000, // 10 minutes + }) + + if (!coingeckoJson) { + console.log('Could not fetch coingecko data') } else { - const coingeckoJson = await coingeckoResponse.json() - if (!coingeckoJson) { - console.log('Could not fetch coingecko data') - } else { - console.log('Coingecko rates received OK') - const coingeckData = processCoingeckoData(coingeckoJson) - for (const dayId in coingeckData) { - const stat = statsWithNoPrice.find((s) => s.id === dayId) as - | OETHDailyStat - | OUSDDailyStat - | OGVDailyStat - const day = coingeckData[dayId] - - if (stat && day.prices) { - stat.tradingVolumeUSD = day.total_volumes || 0 - stat.marketCapUSD = day.market_caps || 0 - if (stat instanceof OGVDailyStat) { - stat.priceUSD = day.prices - } else { - stat.pegPrice = parseEther(String(day.prices)) - } - updatedStats.push(stat) + console.log('Coingecko rates received OK') + const coingeckData = processCoingeckoData(coingeckoJson) + for (const dayId in coingeckData) { + const stat = statsWithNoPrice.find((s) => s.id === dayId) as + | OETHDailyStat + | OUSDDailyStat + | OGVDailyStat + const day = coingeckData[dayId] + + if (stat && day.prices) { + stat.tradingVolumeUSD = day.total_volumes || 0 + stat.marketCapUSD = day.market_caps || 0 + if (stat instanceof OGVDailyStat) { + stat.priceUSD = day.prices + } else { + stat.pegPrice = parseEther(String(day.prices)) } + updatedStats.push(stat) } } } diff --git a/src/utils/queryClient.ts b/src/utils/queryClient.ts new file mode 100644 index 00000000..ed58b9b0 --- /dev/null +++ b/src/utils/queryClient.ts @@ -0,0 +1,3 @@ +import { QueryClient } from '@tanstack/query-core' + +export const queryClient = new QueryClient() From e968e85e1607e9c0d199398bddb8d065a86b5e63 Mon Sep 17 00:00:00 2001 From: Chris Jacobs Date: Wed, 24 Apr 2024 15:26:53 -0700 Subject: [PATCH 03/12] fix validation data --- src/ousd/validators/validate-ousd/validate-ousd.ts | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/ousd/validators/validate-ousd/validate-ousd.ts b/src/ousd/validators/validate-ousd/validate-ousd.ts index 46472251..fea1a883 100644 --- a/src/ousd/validators/validate-ousd/validate-ousd.ts +++ b/src/ousd/validators/validate-ousd/validate-ousd.ts @@ -178,19 +178,17 @@ const expectations = { oTokenRebases: e([ { id: '1-0x2a8e1e676ec238d8a992307b495b45b3feaa5e86-0014883457-a66bb-000005', - chainId: 1, - otoken: '0x2a8e1e676ec238d8a992307b495b45b3feaa5e86', blockNumber: 14883457, - feeETH: '346263724854739034559', - feeUSD: '670496543700164855741218', + feeETH: '178820559593958335', + feeUSD: '346263724854739034559', rebasingCredits: '28313629639061008328884206782869381', rebasingCreditsPerToken: '793786451700174206240401619', timestamp: '2022-06-01T06:59:39.000000Z', txHash: '0xca8bb9f49e9135e81cb7f8c0876bfdce54352bbf45ceeda567144ca488ec1df5', totalSupply: '63608906999875802980711462', - yieldETH: '3462637248547390345598', - yieldUSD: '6704965437001648557427672', + yieldETH: '1788205595939583356', + yieldUSD: '3462637248547390345598', }, ]), ousdDailyStats: e([ From b1cc1770df6680b023b3da185eb8912be2d8e9e0 Mon Sep 17 00:00:00 2001 From: Chris Jacobs Date: Wed, 24 Apr 2024 15:47:55 -0700 Subject: [PATCH 04/12] v29 --- squid.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/squid.yaml b/squid.yaml index e92b9221..188d965e 100644 --- a/squid.yaml +++ b/squid.yaml @@ -1,6 +1,6 @@ manifestVersion: subsquid.io/v0.1 name: origin-squid -version: 999 +version: 29 description: 'Origin Protocol 🦑' build: deploy: From 8942145a7d499ce6663bb40b95735b4ee953aa1a Mon Sep 17 00:00:00 2001 From: Chris Jacobs Date: Wed, 24 Apr 2024 16:36:15 -0700 Subject: [PATCH 05/12] validation data --- src/ousd/validators/validate-ousd/validate-ousd.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/ousd/validators/validate-ousd/validate-ousd.ts b/src/ousd/validators/validate-ousd/validate-ousd.ts index fea1a883..0040bd44 100644 --- a/src/ousd/validators/validate-ousd/validate-ousd.ts +++ b/src/ousd/validators/validate-ousd/validate-ousd.ts @@ -224,7 +224,6 @@ const expectations = { }, { id: '2023-09-25', - holdersOverThreshold: 527, feesUSDAllTime: '557455670955180080472479', feesUSD7Day: '2408539505622701328488', feesUSD: '327704746233735207946', @@ -254,7 +253,6 @@ const expectations = { }, { id: '2024-03-02', - holdersOverThreshold: 480, feesUSDAllTime: '640842823767036278915355', feesUSD7Day: '3365292401878836638613', feesUSD: '579150934767120286041', From 08a7cc925f60d352742bce6a369e1c731d5d7387 Mon Sep 17 00:00:00 2001 From: Chris Jacobs Date: Thu, 25 Apr 2024 09:31:40 -0700 Subject: [PATCH 06/12] coingecko log improvement --- src/utils/coingecko.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/utils/coingecko.ts b/src/utils/coingecko.ts index 78f1f8bd..018df3fe 100644 --- a/src/utils/coingecko.ts +++ b/src/utils/coingecko.ts @@ -107,6 +107,7 @@ export async function applyCoingeckoData( const coingeckoJson = await queryClient.fetchQuery({ queryKey: [coingeckoURL], queryFn: async () => { + console.log('Fetching Coingecko market data') const response = await fetch(coingeckoURL) if (response.status === 429) { throw new Error('Coingecko rate limited') @@ -118,9 +119,8 @@ export async function applyCoingeckoData( }) if (!coingeckoJson) { - console.log('Could not fetch coingecko data') + console.log('No coingeckoJson :(') } else { - console.log('Coingecko rates received OK') const coingeckData = processCoingeckoData(coingeckoJson) for (const dayId in coingeckData) { const stat = statsWithNoPrice.find((s) => s.id === dayId) as From 7e2dac417aba90c736c6af4cdfa7abfaa04d3a31 Mon Sep 17 00:00:00 2001 From: Chris Jacobs Date: Thu, 25 Apr 2024 09:31:46 -0700 Subject: [PATCH 07/12] grafana update - oeth-dashboard --- grafana/oeth-dashboard.json | 714 ++++++++++++++++++++++++++---------- 1 file changed, 512 insertions(+), 202 deletions(-) diff --git a/grafana/oeth-dashboard.json b/grafana/oeth-dashboard.json index 1ca39fa5..74727f5b 100644 --- a/grafana/oeth-dashboard.json +++ b/grafana/oeth-dashboard.json @@ -28,17 +28,427 @@ "links": [], "liveNow": false, "panels": [ + { + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 0 + }, + "id": 47, + "title": "Holder Info", + "type": "row" + }, + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "cdjqw6cqd1gqob" + }, + "fieldConfig": { + "defaults": { + "color": { + "fixedColor": "green", + "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", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 9, + "w": 18, + "x": 0, + "y": 1 + }, + "id": 45, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "multi", + "sort": "none" + } + }, + "targets": [ + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "cdjqw6cqd1gqob" + }, + "editorMode": "code", + "format": "time_series", + "rawQuery": true, + "rawSql": "WITH date_series AS (\n SELECT generate_series(MIN(DATE(timestamp)), MAX(DATE(timestamp)), '1 day')::date AS date\n FROM erc20_balance\n),\ngrouped_data AS (\n SELECT \n address,\n account,\n DATE(timestamp) as entry_date,\n balance,\n ROW_NUMBER() OVER (PARTITION BY address, account, DATE(timestamp) ORDER BY timestamp DESC) as rn\n FROM \n erc20_balance \n WHERE address = '0x856c4efb76c1d1ae02e20ceb03a2a6a08b0b8dc3'\n)\nSELECT \n ds.date as time,\n COUNT(*) FILTER (WHERE balance >= 1e6 AND balance < 1e12) AS \">= .000000000001\",\n COUNT(*) FILTER (WHERE balance >= 1e12 AND balance < 1e13) AS \">= .000001\",\n COUNT(*) FILTER (WHERE balance >= 1e13 AND balance < 1e14) AS \">= .00001\",\n COUNT(*) FILTER (WHERE balance >= 1e14 AND balance < 1e15) AS \">= .0001\",\n COUNT(*) FILTER (WHERE balance >= 1e15 AND balance < 1e16) AS \">= .001\",\n COUNT(*) FILTER (WHERE balance >= 1e16 AND balance < 1e17) AS \">= .01\",\n COUNT(*) FILTER (WHERE balance >= 1e17 AND balance < 1e18) AS \">= .1\",\n COUNT(*) FILTER (WHERE balance >= 1e18 AND balance < 1e19) AS \">= 1\",\n COUNT(*) FILTER (WHERE balance >= 1e19 AND balance < 1e20) AS \">= 10\",\n COUNT(*) FILTER (WHERE balance >= 1e20 AND balance < 1e21) AS \">= 100\",\n COUNT(*) FILTER (WHERE balance >= 1e21) AS \">= 1000\"\nFROM \n date_series ds\nLEFT JOIN \n grouped_data gd ON ds.date = gd.entry_date AND gd.rn = 1\nWHERE address = '0x856c4efb76c1d1ae02e20ceb03a2a6a08b0b8dc3'\n and $__timeFilter(ds.date) \nGROUP BY ds.date\nORDER BY ds.date asc;", + "refId": "A", + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, + "table": "erc20_balance" + } + ], + "title": "Holder Counts", + "type": "timeseries" + }, + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "cdjqw6cqd1gqob" + }, + "description": "Origin held OETH not yet excluded.", + "fieldConfig": { + "defaults": { + "color": { + "fixedColor": "light-blue", + "mode": "palette-classic" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "text", + "value": null + } + ] + }, + "unit": "none" + }, + "overrides": [] + }, + "gridPos": { + "h": 9, + "w": 6, + "x": 18, + "y": 1 + }, + "id": 46, + "options": { + "displayMode": "basic", + "maxVizHeight": 300, + "minVizHeight": 15, + "minVizWidth": 30, + "namePlacement": "left", + "orientation": "horizontal", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "showUnfilled": true, + "sizing": "manual", + "valueMode": "color" + }, + "pluginVersion": "11.1.0-69622", + "targets": [ + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "cdjqw6cqd1gqob" + }, + "editorMode": "code", + "format": "time_series", + "rawQuery": true, + "rawSql": "WITH date_series AS (\n SELECT generate_series(MIN(DATE(timestamp)), MAX(DATE(timestamp)), '1 day')::date AS date\n FROM erc20_balance\n),\ngrouped_data AS (\n SELECT \n address,\n account,\n DATE(timestamp) as entry_date,\n balance,\n ROW_NUMBER() OVER (PARTITION BY address, account, DATE(timestamp) ORDER BY timestamp DESC) as rn\n FROM \n erc20_balance \n WHERE address = '0x856c4efb76c1d1ae02e20ceb03a2a6a08b0b8dc3'\n)\nSELECT \n ds.date as time,\n COUNT(*) FILTER (WHERE balance >= 1e6 AND balance < 1e12) AS \">= .000000000001\",\n COUNT(*) FILTER (WHERE balance >= 1e12 AND balance < 1e13) AS \">= .000001\",\n COUNT(*) FILTER (WHERE balance >= 1e13 AND balance < 1e14) AS \">= .00001\",\n COUNT(*) FILTER (WHERE balance >= 1e14 AND balance < 1e15) AS \">= .0001\",\n COUNT(*) FILTER (WHERE balance >= 1e15 AND balance < 1e16) AS \">= .001\",\n COUNT(*) FILTER (WHERE balance >= 1e16 AND balance < 1e17) AS \">= .01\",\n COUNT(*) FILTER (WHERE balance >= 1e17 AND balance < 1e18) AS \">= .1\",\n COUNT(*) FILTER (WHERE balance >= 1e18 AND balance < 1e19) AS \">= 1\",\n COUNT(*) FILTER (WHERE balance >= 1e19 AND balance < 1e20) AS \">= 10\",\n COUNT(*) FILTER (WHERE balance >= 1e20 AND balance < 1e21) AS \">= 100\",\n COUNT(*) FILTER (WHERE balance >= 1e21) AS \">= 1000\"\nFROM \n date_series ds\nLEFT JOIN \n grouped_data gd ON ds.date = gd.entry_date AND gd.rn = 1\nWHERE address = '0x856c4efb76c1d1ae02e20ceb03a2a6a08b0b8dc3'\n and $__timeFilter(ds.date) \nGROUP BY ds.date\nORDER BY ds.date desc\nLIMIT 1;", + "refId": "A", + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, + "table": "erc20_balance" + } + ], + "title": "Holder Counts", + "type": "bargauge" + }, + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "cdjqw6cqd1gqob" + }, + "fieldConfig": { + "defaults": { + "color": { + "fixedColor": "green", + "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", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "percentunit" + }, + "overrides": [] + }, + "gridPos": { + "h": 9, + "w": 18, + "x": 0, + "y": 10 + }, + "id": 49, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "multi", + "sort": "none" + } + }, + "targets": [ + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "cdjqw6cqd1gqob" + }, + "editorMode": "code", + "format": "time_series", + "rawQuery": true, + "rawSql": "WITH date_series AS (\n SELECT generate_series(MIN(DATE(timestamp)), MAX(DATE(timestamp)), '1 day')::date AS date\n FROM erc20_balance\n),\ngrouped_data AS (\n SELECT \n address,\n account,\n DATE(timestamp) as entry_date,\n balance,\n ROW_NUMBER() OVER (PARTITION BY address, account, DATE(timestamp) ORDER BY timestamp DESC) as rn\n FROM \n erc20_balance \n WHERE address = '0x856c4efb76c1d1ae02e20ceb03a2a6a08b0b8dc3'\n)\nSELECT \n ds.date as time,\n SUM(balance / 1e18) FILTER (WHERE balance >= 1e6 AND balance < 1e12) / SUM(balance / 1e18) AS \">= .000000000001\",\n SUM(balance / 1e18) FILTER (WHERE balance >= 1e12 AND balance < 1e13) / SUM(balance / 1e18) AS \">= .000001\",\n SUM(balance / 1e18) FILTER (WHERE balance >= 1e13 AND balance < 1e14) / SUM(balance / 1e18) AS \">= .00001\",\n SUM(balance / 1e18) FILTER (WHERE balance >= 1e14 AND balance < 1e15) / SUM(balance / 1e18) AS \">= .0001\",\n SUM(balance / 1e18) FILTER (WHERE balance >= 1e15 AND balance < 1e16) / SUM(balance / 1e18) AS \">= .001\",\n SUM(balance / 1e18) FILTER (WHERE balance >= 1e16 AND balance < 1e17) / SUM(balance / 1e18) AS \">= .01\",\n SUM(balance / 1e18) FILTER (WHERE balance >= 1e17 AND balance < 1e18) / SUM(balance / 1e18) AS \">= .1\",\n SUM(balance / 1e18) FILTER (WHERE balance >= 1e18 AND balance < 1e19) / SUM(balance / 1e18) AS \">= 1\",\n SUM(balance / 1e18) FILTER (WHERE balance >= 1e19 AND balance < 1e20) / SUM(balance / 1e18) AS \">= 10\",\n SUM(balance / 1e18) FILTER (WHERE balance >= 1e20 AND balance < 1e21) / SUM(balance / 1e18) AS \">= 100\",\n SUM(balance / 1e18) FILTER (WHERE balance >= 1e21) / SUM(balance / 1e18) AS \">= 1000\"\nFROM \n date_series ds\nLEFT JOIN \n grouped_data gd ON ds.date = gd.entry_date AND gd.rn = 1\nWHERE address = '0x856c4efb76c1d1ae02e20ceb03a2a6a08b0b8dc3'\n and $__timeFilter(ds.date) \nGROUP BY ds.date\nORDER BY ds.date asc;", + "refId": "A", + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, + "table": "erc20_balance" + } + ], + "title": "Holder TVL %", + "type": "timeseries" + }, + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "cdjqw6cqd1gqob" + }, + "description": "Origin held OETH not yet excluded.", + "fieldConfig": { + "defaults": { + "color": { + "fixedColor": "light-blue", + "mode": "palette-classic" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "text", + "value": null + } + ] + }, + "unit": "percentunit" + }, + "overrides": [] + }, + "gridPos": { + "h": 9, + "w": 6, + "x": 18, + "y": 10 + }, + "id": 48, + "options": { + "displayMode": "basic", + "maxVizHeight": 300, + "minVizHeight": 15, + "minVizWidth": 30, + "namePlacement": "left", + "orientation": "horizontal", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "showUnfilled": true, + "sizing": "manual", + "valueMode": "color" + }, + "pluginVersion": "11.1.0-69622", + "targets": [ + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "cdjqw6cqd1gqob" + }, + "editorMode": "code", + "format": "time_series", + "rawQuery": true, + "rawSql": "WITH date_series AS (\n SELECT generate_series(MIN(DATE(timestamp)), MAX(DATE(timestamp)), '1 day')::date AS date\n FROM erc20_balance\n),\ngrouped_data AS (\n SELECT \n address,\n account,\n DATE(timestamp) as entry_date,\n balance,\n ROW_NUMBER() OVER (PARTITION BY address, account, DATE(timestamp) ORDER BY timestamp DESC) as rn\n FROM \n erc20_balance \n WHERE address = '0x856c4efb76c1d1ae02e20ceb03a2a6a08b0b8dc3'\n)\nSELECT \n ds.date as time,\n SUM(balance / 1e18) FILTER (WHERE balance >= 1e6 AND balance < 1e12) / SUM(balance / 1e18) AS \">= .000000000001\",\n SUM(balance / 1e18) FILTER (WHERE balance >= 1e12 AND balance < 1e13) / SUM(balance / 1e18) AS \">= .000001\",\n SUM(balance / 1e18) FILTER (WHERE balance >= 1e13 AND balance < 1e14) / SUM(balance / 1e18) AS \">= .00001\",\n SUM(balance / 1e18) FILTER (WHERE balance >= 1e14 AND balance < 1e15) / SUM(balance / 1e18) AS \">= .0001\",\n SUM(balance / 1e18) FILTER (WHERE balance >= 1e15 AND balance < 1e16) / SUM(balance / 1e18) AS \">= .001\",\n SUM(balance / 1e18) FILTER (WHERE balance >= 1e16 AND balance < 1e17) / SUM(balance / 1e18) AS \">= .01\",\n SUM(balance / 1e18) FILTER (WHERE balance >= 1e17 AND balance < 1e18) / SUM(balance / 1e18) AS \">= .1\",\n SUM(balance / 1e18) FILTER (WHERE balance >= 1e18 AND balance < 1e19) / SUM(balance / 1e18) AS \">= 1\",\n SUM(balance / 1e18) FILTER (WHERE balance >= 1e19 AND balance < 1e20) / SUM(balance / 1e18) AS \">= 10\",\n SUM(balance / 1e18) FILTER (WHERE balance >= 1e20 AND balance < 1e21) / SUM(balance / 1e18) AS \">= 100\",\n SUM(balance / 1e18) FILTER (WHERE balance >= 1e21) / SUM(balance / 1e18) AS \">= 1000\"\nFROM \n date_series ds\nLEFT JOIN \n grouped_data gd ON ds.date = gd.entry_date AND gd.rn = 1\nWHERE address = '0x856c4efb76c1d1ae02e20ceb03a2a6a08b0b8dc3'\n and $__timeFilter(ds.date)\nGROUP BY ds.date\nORDER BY ds.date desc\nLIMIT 1;", + "refId": "A", + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, + "table": "erc20_balance" + } + ], + "title": "Holder TVL %", + "type": "bargauge" + }, { "collapsed": false, "datasource": { "type": "grafana-postgresql-datasource", - "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + "uid": "cdjqw6cqd1gqob" }, "gridPos": { "h": 1, "w": 24, "x": 0, - "y": 0 + "y": 19 }, "id": 8, "panels": [], @@ -46,7 +456,7 @@ { "datasource": { "type": "grafana-postgresql-datasource", - "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + "uid": "cdjqw6cqd1gqob" }, "refId": "A" } @@ -57,7 +467,7 @@ { "datasource": { "type": "postgres", - "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + "uid": "cdjqw6cqd1gqob" }, "fieldConfig": { "defaults": { @@ -117,7 +527,7 @@ "h": 9, "w": 12, "x": 0, - "y": 1 + "y": 20 }, "id": 2, "options": { @@ -136,7 +546,7 @@ { "datasource": { "type": "postgres", - "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + "uid": "cdjqw6cqd1gqob" }, "editorMode": "code", "format": "time_series", @@ -214,7 +624,7 @@ { "datasource": { "type": "postgres", - "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + "uid": "cdjqw6cqd1gqob" }, "fieldConfig": { "defaults": { @@ -279,7 +689,7 @@ "h": 9, "w": 12, "x": 12, - "y": 1 + "y": 20 }, "id": 4, "options": { @@ -298,7 +708,7 @@ { "datasource": { "type": "postgres", - "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + "uid": "cdjqw6cqd1gqob" }, "editorMode": "code", "format": "time_series", @@ -368,7 +778,7 @@ { "datasource": { "type": "postgres", - "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + "uid": "cdjqw6cqd1gqob" }, "fieldConfig": { "defaults": { @@ -455,7 +865,7 @@ "h": 12, "w": 24, "x": 0, - "y": 10 + "y": 29 }, "id": 6, "options": { @@ -476,7 +886,7 @@ { "datasource": { "type": "postgres", - "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + "uid": "cdjqw6cqd1gqob" }, "format": "time_series", "group": [], @@ -535,8 +945,8 @@ }, { "datasource": { - "type": "postgres", - "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + "type": "grafana-postgresql-datasource", + "uid": "cdjqw6cqd1gqob" }, "fieldConfig": { "defaults": { @@ -584,8 +994,7 @@ "mode": "absolute", "steps": [ { - "color": "green", - "value": null + "color": "green" }, { "color": "red", @@ -594,38 +1003,13 @@ ] } }, - "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 - } - } - ] - } - ] + "overrides": [] }, "gridPos": { "h": 11, "w": 12, "x": 0, - "y": 22 + "y": 41 }, "id": 38, "options": { @@ -644,14 +1028,14 @@ { "datasource": { "type": "postgres", - "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + "uid": "cdjqw6cqd1gqob" }, "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", + "rawSql": "SELECT\n \"timestamp\" AS \"time\",\n yield_eth / 1e18 as yield\nFROM o_token_rebase\nWHERE\n $__timeFilter(\"timestamp\") AND chain_id = 1 AND otoken = '0x856c4efb76c1d1ae02e20ceb03a2a6a08b0b8dc3'\nORDER BY 1", "refId": "A", "select": [ [ @@ -704,38 +1088,13 @@ ] } ], - "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" - } - } - } - ], + "title": "Yield", "type": "timeseries" }, { "datasource": { - "type": "postgres", - "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + "type": "grafana-postgresql-datasource", + "uid": "cdjqw6cqd1gqob" }, "fieldConfig": { "defaults": { @@ -783,8 +1142,7 @@ "mode": "absolute", "steps": [ { - "color": "green", - "value": null + "color": "green" }, { "color": "red", @@ -793,38 +1151,13 @@ ] } }, - "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 - } - } - ] - } - ] + "overrides": [] }, "gridPos": { "h": 11, "w": 12, "x": 12, - "y": 22 + "y": 41 }, "id": 37, "options": { @@ -843,14 +1176,14 @@ { "datasource": { "type": "postgres", - "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + "uid": "cdjqw6cqd1gqob" }, "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", + "rawSql": "SELECT\n \"timestamp\" AS \"time\",\n fee_eth / 1e18 as fee\nFROM o_token_rebase\nWHERE\n $__timeFilter(\"timestamp\") AND chain_id = 1 AND otoken = '0x856c4efb76c1d1ae02e20ceb03a2a6a08b0b8dc3'\nORDER BY 1", "refId": "A", "select": [ [ @@ -903,41 +1236,20 @@ ] } ], - "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" - } - } - } - ], + "title": "Fees", "type": "timeseries" }, { "collapsed": false, "datasource": { "type": "grafana-postgresql-datasource", - "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + "uid": "cdjqw6cqd1gqob" }, "gridPos": { "h": 1, "w": 24, "x": 0, - "y": 33 + "y": 52 }, "id": 40, "panels": [], @@ -945,7 +1257,7 @@ { "datasource": { "type": "grafana-postgresql-datasource", - "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + "uid": "cdjqw6cqd1gqob" }, "refId": "A" } @@ -956,7 +1268,7 @@ { "datasource": { "type": "postgres", - "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + "uid": "cdjqw6cqd1gqob" }, "description": "", "fieldConfig": { @@ -1016,7 +1328,7 @@ "h": 8, "w": 12, "x": 0, - "y": 34 + "y": 53 }, "id": 44, "options": { @@ -1035,7 +1347,7 @@ { "datasource": { "type": "postgres", - "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + "uid": "cdjqw6cqd1gqob" }, "editorMode": "code", "format": "time_series", @@ -1094,13 +1406,12 @@ } ], "title": "Convex ETH+OETH (AMO)", - "transformations": [], "type": "timeseries" }, { "datasource": { "type": "postgres", - "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + "uid": "cdjqw6cqd1gqob" }, "description": "", "fieldConfig": { @@ -1160,7 +1471,7 @@ "h": 8, "w": 12, "x": 12, - "y": 34 + "y": 53 }, "id": 43, "options": { @@ -1179,7 +1490,7 @@ { "datasource": { "type": "postgres", - "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + "uid": "cdjqw6cqd1gqob" }, "editorMode": "code", "format": "time_series", @@ -1238,13 +1549,12 @@ } ], "title": "Frax Staking", - "transformations": [], "type": "timeseries" }, { "datasource": { "type": "postgres", - "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + "uid": "cdjqw6cqd1gqob" }, "description": "", "fieldConfig": { @@ -1304,7 +1614,7 @@ "h": 8, "w": 12, "x": 0, - "y": 42 + "y": 61 }, "id": 42, "options": { @@ -1323,7 +1633,7 @@ { "datasource": { "type": "postgres", - "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + "uid": "cdjqw6cqd1gqob" }, "editorMode": "code", "format": "time_series", @@ -1382,13 +1692,12 @@ } ], "title": "Morpho Aave", - "transformations": [], "type": "timeseries" }, { "datasource": { "type": "postgres", - "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + "uid": "cdjqw6cqd1gqob" }, "description": "", "fieldConfig": { @@ -1475,7 +1784,7 @@ "h": 8, "w": 12, "x": 12, - "y": 42 + "y": 61 }, "id": 41, "options": { @@ -1494,7 +1803,7 @@ { "datasource": { "type": "postgres", - "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + "uid": "cdjqw6cqd1gqob" }, "editorMode": "code", "format": "time_series", @@ -1593,13 +1902,13 @@ "collapsed": false, "datasource": { "type": "grafana-postgresql-datasource", - "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + "uid": "cdjqw6cqd1gqob" }, "gridPos": { "h": 1, "w": 24, "x": 0, - "y": 50 + "y": 69 }, "id": 10, "panels": [], @@ -1607,7 +1916,7 @@ { "datasource": { "type": "grafana-postgresql-datasource", - "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + "uid": "cdjqw6cqd1gqob" }, "refId": "A" } @@ -1618,7 +1927,7 @@ { "datasource": { "type": "postgres", - "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + "uid": "cdjqw6cqd1gqob" }, "fieldConfig": { "defaults": { @@ -1677,7 +1986,7 @@ "h": 8, "w": 12, "x": 0, - "y": 51 + "y": 70 }, "id": 12, "options": { @@ -1696,7 +2005,7 @@ { "datasource": { "type": "postgres", - "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + "uid": "cdjqw6cqd1gqob" }, "editorMode": "code", "format": "time_series", @@ -1768,7 +2077,7 @@ { "datasource": { "type": "postgres", - "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + "uid": "cdjqw6cqd1gqob" }, "fieldConfig": { "defaults": { @@ -1853,7 +2162,7 @@ "h": 8, "w": 12, "x": 12, - "y": 51 + "y": 70 }, "id": 13, "options": { @@ -1872,7 +2181,7 @@ { "datasource": { "type": "postgres", - "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + "uid": "cdjqw6cqd1gqob" }, "format": "time_series", "group": [], @@ -1977,13 +2286,13 @@ "collapsed": false, "datasource": { "type": "grafana-postgresql-datasource", - "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + "uid": "cdjqw6cqd1gqob" }, "gridPos": { "h": 1, "w": 24, "x": 0, - "y": 59 + "y": 78 }, "id": 15, "panels": [], @@ -1991,7 +2300,7 @@ { "datasource": { "type": "grafana-postgresql-datasource", - "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + "uid": "cdjqw6cqd1gqob" }, "refId": "A" } @@ -2002,7 +2311,7 @@ { "datasource": { "type": "postgres", - "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + "uid": "cdjqw6cqd1gqob" }, "fieldConfig": { "defaults": { @@ -2061,7 +2370,7 @@ "h": 8, "w": 12, "x": 0, - "y": 60 + "y": 79 }, "id": 16, "options": { @@ -2080,7 +2389,7 @@ { "datasource": { "type": "postgres", - "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + "uid": "cdjqw6cqd1gqob" }, "editorMode": "code", "format": "time_series", @@ -2152,7 +2461,7 @@ { "datasource": { "type": "postgres", - "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + "uid": "cdjqw6cqd1gqob" }, "fieldConfig": { "defaults": { @@ -2237,7 +2546,7 @@ "h": 8, "w": 12, "x": 12, - "y": 60 + "y": 79 }, "id": 17, "options": { @@ -2256,7 +2565,7 @@ { "datasource": { "type": "postgres", - "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + "uid": "cdjqw6cqd1gqob" }, "format": "time_series", "group": [], @@ -2361,13 +2670,13 @@ "collapsed": false, "datasource": { "type": "grafana-postgresql-datasource", - "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + "uid": "cdjqw6cqd1gqob" }, "gridPos": { "h": 1, "w": 24, "x": 0, - "y": 68 + "y": 87 }, "id": 19, "panels": [], @@ -2375,7 +2684,7 @@ { "datasource": { "type": "grafana-postgresql-datasource", - "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + "uid": "cdjqw6cqd1gqob" }, "refId": "A" } @@ -2386,7 +2695,7 @@ { "datasource": { "type": "postgres", - "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + "uid": "cdjqw6cqd1gqob" }, "fieldConfig": { "defaults": { @@ -2445,7 +2754,7 @@ "h": 8, "w": 12, "x": 0, - "y": 69 + "y": 88 }, "id": 20, "options": { @@ -2464,7 +2773,7 @@ { "datasource": { "type": "postgres", - "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + "uid": "cdjqw6cqd1gqob" }, "editorMode": "code", "format": "time_series", @@ -2536,7 +2845,7 @@ { "datasource": { "type": "postgres", - "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + "uid": "cdjqw6cqd1gqob" }, "fieldConfig": { "defaults": { @@ -2621,7 +2930,7 @@ "h": 8, "w": 12, "x": 12, - "y": 69 + "y": 88 }, "id": 21, "options": { @@ -2640,7 +2949,7 @@ { "datasource": { "type": "postgres", - "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + "uid": "cdjqw6cqd1gqob" }, "format": "time_series", "group": [], @@ -2745,13 +3054,13 @@ "collapsed": false, "datasource": { "type": "grafana-postgresql-datasource", - "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + "uid": "cdjqw6cqd1gqob" }, "gridPos": { "h": 1, "w": 24, "x": 0, - "y": 77 + "y": 96 }, "id": 23, "panels": [], @@ -2759,7 +3068,7 @@ { "datasource": { "type": "grafana-postgresql-datasource", - "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + "uid": "cdjqw6cqd1gqob" }, "refId": "A" } @@ -2770,7 +3079,7 @@ { "datasource": { "type": "postgres", - "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + "uid": "cdjqw6cqd1gqob" }, "fieldConfig": { "defaults": { @@ -2829,7 +3138,7 @@ "h": 8, "w": 12, "x": 0, - "y": 78 + "y": 97 }, "id": 24, "options": { @@ -2848,7 +3157,7 @@ { "datasource": { "type": "postgres", - "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + "uid": "cdjqw6cqd1gqob" }, "editorMode": "code", "format": "time_series", @@ -2920,7 +3229,7 @@ { "datasource": { "type": "postgres", - "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + "uid": "cdjqw6cqd1gqob" }, "fieldConfig": { "defaults": { @@ -3005,7 +3314,7 @@ "h": 8, "w": 12, "x": 12, - "y": 78 + "y": 97 }, "id": 25, "options": { @@ -3024,7 +3333,7 @@ { "datasource": { "type": "postgres", - "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + "uid": "cdjqw6cqd1gqob" }, "format": "time_series", "group": [], @@ -3129,13 +3438,13 @@ "collapsed": false, "datasource": { "type": "grafana-postgresql-datasource", - "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + "uid": "cdjqw6cqd1gqob" }, "gridPos": { "h": 1, "w": 24, "x": 0, - "y": 86 + "y": 105 }, "id": 27, "panels": [], @@ -3143,7 +3452,7 @@ { "datasource": { "type": "grafana-postgresql-datasource", - "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + "uid": "cdjqw6cqd1gqob" }, "refId": "A" } @@ -3154,7 +3463,7 @@ { "datasource": { "type": "postgres", - "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + "uid": "cdjqw6cqd1gqob" }, "fieldConfig": { "defaults": { @@ -3213,7 +3522,7 @@ "h": 8, "w": 12, "x": 0, - "y": 87 + "y": 106 }, "id": 28, "options": { @@ -3232,7 +3541,7 @@ { "datasource": { "type": "postgres", - "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + "uid": "cdjqw6cqd1gqob" }, "editorMode": "code", "format": "time_series", @@ -3304,7 +3613,7 @@ { "datasource": { "type": "postgres", - "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + "uid": "cdjqw6cqd1gqob" }, "fieldConfig": { "defaults": { @@ -3389,7 +3698,7 @@ "h": 8, "w": 12, "x": 12, - "y": 87 + "y": 106 }, "id": 29, "options": { @@ -3408,7 +3717,7 @@ { "datasource": { "type": "postgres", - "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + "uid": "cdjqw6cqd1gqob" }, "format": "time_series", "group": [], @@ -3513,20 +3822,20 @@ "collapsed": true, "datasource": { "type": "grafana-postgresql-datasource", - "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + "uid": "cdjqw6cqd1gqob" }, "gridPos": { "h": 1, "w": 24, "x": 0, - "y": 95 + "y": 114 }, "id": 31, "panels": [ { "datasource": { "type": "postgres", - "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + "uid": "cdjqw6cqd1gqob" }, "description": "", "fieldConfig": { @@ -3586,7 +3895,7 @@ "h": 8, "w": 12, "x": 0, - "y": 96 + "y": 104 }, "id": 34, "options": { @@ -3605,7 +3914,7 @@ { "datasource": { "type": "postgres", - "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + "uid": "cdjqw6cqd1gqob" }, "editorMode": "code", "format": "time_series", @@ -3668,7 +3977,7 @@ { "datasource": { "type": "postgres", - "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + "uid": "cdjqw6cqd1gqob" }, "description": "", "fieldConfig": { @@ -3728,7 +4037,7 @@ "h": 8, "w": 12, "x": 12, - "y": 96 + "y": 104 }, "id": 33, "options": { @@ -3747,7 +4056,7 @@ { "datasource": { "type": "postgres", - "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + "uid": "cdjqw6cqd1gqob" }, "editorMode": "code", "format": "time_series", @@ -3802,7 +4111,7 @@ { "datasource": { "type": "postgres", - "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + "uid": "cdjqw6cqd1gqob" }, "description": "", "fieldConfig": { @@ -3862,7 +4171,7 @@ "h": 8, "w": 12, "x": 12, - "y": 104 + "y": 112 }, "id": 35, "options": { @@ -3881,7 +4190,7 @@ { "datasource": { "type": "postgres", - "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + "uid": "cdjqw6cqd1gqob" }, "editorMode": "code", "format": "time_series", @@ -3946,7 +4255,7 @@ { "datasource": { "type": "grafana-postgresql-datasource", - "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + "uid": "cdjqw6cqd1gqob" }, "refId": "A" } @@ -3967,10 +4276,11 @@ "from": "now-30d", "to": "now" }, + "timeRangeUpdatedDuringEditOrView": false, "timepicker": {}, "timezone": "", "title": "OETH Dashboard", "uid": "5RW4zO7Sk", - "version": 11, + "version": 28, "weekStart": "" } \ No newline at end of file From 913c3f99f9552ab735d0a69634787bc7b2deda45 Mon Sep 17 00:00:00 2001 From: Chris Jacobs Date: Thu, 25 Apr 2024 09:38:35 -0700 Subject: [PATCH 08/12] grafana update - oeth-strategy-earnings --- grafana/oeth-strategy-earnings.json | 2135 +++++++++++++++++++++++---- 1 file changed, 1882 insertions(+), 253 deletions(-) diff --git a/grafana/oeth-strategy-earnings.json b/grafana/oeth-strategy-earnings.json index 32f45d2f..fd929a2b 100644 --- a/grafana/oeth-strategy-earnings.json +++ b/grafana/oeth-strategy-earnings.json @@ -30,15 +30,1384 @@ "x": 0, "y": 0 }, - "id": 9, + "id": 43, "panels": [], - "title": "OETH Convex ETH+OETH", + "title": "Aggregate APY", "type": "row" }, + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "cdjqw6cqd1gqob" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic", + "seriesBy": "last" + }, + "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": "stepBefore", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "decimals": 2, + "fieldMinMax": false, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "percentunit" + }, + "overrides": [ + { + "matcher": { + "id": "byName", + "options": "apy" + }, + "properties": [ + { + "id": "color", + "value": { + "fixedColor": "green", + "mode": "fixed" + } + }, + { + "id": "custom.fillOpacity", + "value": 10 + } + ] + } + ] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 1 + }, + "id": 44, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "multi", + "sort": "none" + } + }, + "targets": [ + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "cdjqw6cqd1gqob" + }, + "editorMode": "code", + "format": "time_series", + "rawQuery": true, + "rawSql": "SELECT\n \"timestamp\" AS \"time\",\n apy\nFROM\n oeth_daily_stat\nWHERE\n $__timeFilter(\"timestamp\")\n and timestamp > '2023-05-29' -- Because prior APY values mess up the chart and are *** nonsense *** to look at. \nORDER BY\n \"timestamp\" ASC", + "refId": "A", + "sql": { + "columns": [ + { + "alias": "\"time\"", + "parameters": [ + { + "name": "\"timestamp\"", + "type": "functionParameter" + } + ], + "type": "function" + }, + { + "parameters": [ + { + "name": "apy7_day_avg", + "type": "functionParameter" + } + ], + "type": "function" + }, + { + "parameters": [ + { + "name": "apy14_day_avg", + "type": "functionParameter" + } + ], + "type": "function" + }, + { + "parameters": [ + { + "name": "apy30_day_avg", + "type": "functionParameter" + } + ], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "orderBy": { + "property": { + "name": [ + "\"timestamp\"" + ], + "type": "string" + }, + "type": "property" + }, + "orderByDirection": "ASC", + "whereJsonTree": { + "children1": [ + { + "id": "aa98bb98-4567-489a-bcde-f18c4a965f07", + "properties": { + "field": "\"timestamp\"", + "fieldSrc": "field", + "operator": "macros", + "value": [ + "timeFilter" + ], + "valueSrc": [ + "value" + ], + "valueType": [ + "datetime" + ] + }, + "type": "rule" + } + ], + "id": "ab89ab9b-0123-4456-b89a-b18c46223bed", + "type": "group" + }, + "whereString": "$__timeFilter(\"timestamp\")" + }, + "table": "oeth_daily_stat" + } + ], + "title": "APY", + "type": "timeseries" + }, + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "cdjqw6cqd1gqob" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic", + "seriesBy": "last" + }, + "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": "stepBefore", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "decimals": 2, + "fieldMinMax": false, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "percentunit" + }, + "overrides": [ + { + "matcher": { + "id": "byName", + "options": "apy7_day_avg" + }, + "properties": [ + { + "id": "color", + "value": { + "fixedColor": "super-light-green", + "mode": "fixed" + } + }, + { + "id": "custom.fillOpacity", + "value": 10 + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "apy14_day_avg" + }, + "properties": [ + { + "id": "color", + "value": { + "fixedColor": "green", + "mode": "fixed" + } + }, + { + "id": "custom.fillOpacity", + "value": 10 + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "apy30_day_avg" + }, + "properties": [ + { + "id": "color", + "value": { + "fixedColor": "dark-green", + "mode": "fixed" + } + }, + { + "id": "custom.fillOpacity", + "value": 10 + } + ] + } + ] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 12, + "y": 1 + }, + "id": 45, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "multi", + "sort": "none" + } + }, + "targets": [ + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "cdjqw6cqd1gqob" + }, + "editorMode": "code", + "format": "time_series", + "rawQuery": true, + "rawSql": "SELECT\n \"timestamp\" AS \"time\",\n apy7_day_avg,\n apy14_day_avg,\n apy30_day_avg\nFROM\n oeth_daily_stat\nWHERE\n $__timeFilter(\"timestamp\")\n and timestamp > '2023-05-29' -- Because prior APY values mess up the chart and are *** nonsense *** to look at. \nORDER BY\n \"timestamp\" ASC", + "refId": "A", + "sql": { + "columns": [ + { + "alias": "\"time\"", + "parameters": [ + { + "name": "\"timestamp\"", + "type": "functionParameter" + } + ], + "type": "function" + }, + { + "parameters": [ + { + "name": "apy7_day_avg", + "type": "functionParameter" + } + ], + "type": "function" + }, + { + "parameters": [ + { + "name": "apy14_day_avg", + "type": "functionParameter" + } + ], + "type": "function" + }, + { + "parameters": [ + { + "name": "apy30_day_avg", + "type": "functionParameter" + } + ], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "orderBy": { + "property": { + "name": [ + "\"timestamp\"" + ], + "type": "string" + }, + "type": "property" + }, + "orderByDirection": "ASC", + "whereJsonTree": { + "children1": [ + { + "id": "aa98bb98-4567-489a-bcde-f18c4a965f07", + "properties": { + "field": "\"timestamp\"", + "fieldSrc": "field", + "operator": "macros", + "value": [ + "timeFilter" + ], + "valueSrc": [ + "value" + ], + "valueType": [ + "datetime" + ] + }, + "type": "rule" + } + ], + "id": "ab89ab9b-0123-4456-b89a-b18c46223bed", + "type": "group" + }, + "whereString": "$__timeFilter(\"timestamp\")" + }, + "table": "oeth_daily_stat" + } + ], + "title": "APY Moving Averages", + "type": "timeseries" + }, + { + "collapsed": false, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 9 + }, + "id": 53, + "panels": [], + "title": "Distribution (wip)", + "type": "row" + }, + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "cdjqw6cqd1gqob" + }, + "description": "WETH includes ETH", + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 20, + "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": "normal" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "fieldMinMax": false, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "percentunit" + }, + "overrides": [] + }, + "gridPos": { + "h": 9, + "w": 12, + "x": 0, + "y": 10 + }, + "id": 51, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "multi", + "sort": "none" + } + }, + "targets": [ + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "cdjqw6cqd1gqob" + }, + "editorMode": "code", + "format": "time_series", + "rawQuery": true, + "rawSql": "WITH _daily_strategy_balance as (\n select\n DATE(timestamp) as date,\n strategy,\n case\n when asset = '0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee' then '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2'\n else asset end as asset,\n balance,\n ROW_NUMBER()\n OVER (PARTITION BY strategy, asset, DATE(timestamp) ORDER BY timestamp DESC) as rn\n from strategy_balance\n where asset in (\n select\n address\n from o_token_asset\n where symbol != 'OETH' AND chain_id = 1 AND otoken = '0x856c4efb76c1d1ae02e20ceb03a2a6a08b0b8dc3'\n )\n),\n _daily_exchange_rate as (\n select\n DATE(timestamp) as date,\n base,\n quote,\n rate,\n ROW_NUMBER()\n OVER (PARTITION BY base, quote, DATE(timestamp) ORDER BY timestamp DESC) as rn\n from exchange_rate\n),\n daily_strategy_balance as (\n select\n b.date,\n strategy,\n symbol,\n balance * (r.rate / 1e18) as balance,\n (r.rate / 1e18) as rate\n from _daily_strategy_balance b\n inner join o_token_asset oa\n on b.asset = oa.address AND chain_id = 1 AND otoken = '0x856c4efb76c1d1ae02e20ceb03a2a6a08b0b8dc3'\n left join _daily_exchange_rate r\n on r.date = b.date and r.base = 'ETH' and r.quote = oa.symbol and r.rn = 1\n where b.rn = 1\n),\n daily_total as (\n select\n date,\n sum(balance) as total_balance\n from daily_strategy_balance\n group by date\n),\n daily_strategy_asset_total as (\n select\n date,\n symbol,\n rate,\n sum(balance) as asset_balance\n from daily_strategy_balance\n group by date, symbol, rate\n)\n\nselect\n t.date as time,\n -- t.total_balance,\n case when a.symbol = 'WETH' then 'ETH / WETH' else a.symbol end as symbol,\n -- a.asset_balance,\n a.asset_balance / nullif(t.total_balance, 0) as \"%\"\n -- a.rate\nfrom daily_total t\ninner join daily_strategy_asset_total a\n on t.date = a.date\nwhere $__timeFilter(t.date) \norder by t.date asc", + "refId": "A", + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + } + } + ], + "title": "Asset Distribution", + "type": "timeseries" + }, + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "cdjqw6cqd1gqob" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 20, + "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": "normal" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "percentunit" + }, + "overrides": [] + }, + "gridPos": { + "h": 9, + "w": 12, + "x": 12, + "y": 10 + }, + "id": 54, + "options": { + "legend": { + "calcs": [ + "lastNotNull" + ], + "displayMode": "table", + "placement": "right", + "showLegend": true + }, + "tooltip": { + "mode": "multi", + "sort": "none" + } + }, + "targets": [ + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "cdjqw6cqd1gqob" + }, + "editorMode": "code", + "format": "time_series", + "rawQuery": true, + "rawSql": "WITH _daily_strategy_balance as (\n select\n DATE(timestamp) as date,\n case\n when strategy = '0x1827f9ea98e0bf96550b2fc20f7233277fcd7e63' then 'AMO'\n when strategy = '0x3ff8654d633d4ea0fae24c52aec73b4a20d0d0e5' then 'Frax'\n when strategy = '0x49109629ac1deb03f2e9b2fe2ac4a623e0e7dfdc' then 'Aura'\n when strategy = '0xc1fc9e5ec3058921ea5025d703cbe31764756319' then 'Morpho Aave'\n when strategy = '0x39254033945aa2e4809cc2977e7087bee48bd7ab'\n and asset = '0xae78736cd615f374d3085123a210448e74fc6393' then 'Vault rETH'\n when strategy = '0x39254033945aa2e4809cc2977e7087bee48bd7ab'\n and asset = '0xae7ab96520de3a18e5e111b5eaab095312d7fe84' then 'Vault stETH'\n when strategy = '0x39254033945aa2e4809cc2977e7087bee48bd7ab'\n and asset = '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2' then 'Vault WETH'\n else strategy\n end as strategy,\n asset,\n balance,\n ROW_NUMBER() OVER (\n PARTITION BY strategy,\n asset,\n DATE(timestamp)\n ORDER BY\n timestamp DESC\n ) as rn\n from strategy_balance\n where asset in (\n select\n address\n from o_token_asset\n where symbol != 'OETH' AND chain_id = 1 AND otoken = '0x856c4efb76c1d1ae02e20ceb03a2a6a08b0b8dc3'\n )\n),\n _daily_exchange_rate as (\n select\n DATE(timestamp) as date,\n base,\n quote,\n rate,\n ROW_NUMBER() OVER (\n PARTITION BY base,\n quote,\n DATE(timestamp)\n ORDER BY\n timestamp DESC\n ) as rn\n from exchange_rate\n),\n daily_strategy_balance as (\n select\n b.date,\n strategy,\n balance * coalesce(rate, 1e18) / 1e18 as balance\n from _daily_strategy_balance b\n inner join o_token_asset oa\n on b.asset = oa.address AND chain_id = 1 AND otoken = '0x856c4efb76c1d1ae02e20ceb03a2a6a08b0b8dc3'\n left join _daily_exchange_rate r\n on r.date = b.date and r.base = 'ETH' and r.quote = oa.symbol and r.rn = 1\n where b.rn = 1\n),\n daily_total as (\n select\n date,\n sum(balance) as balance\n from daily_strategy_balance\n group by date\n),\n daily_per_strategy_total as (\n select\n date,\n strategy,\n sum(balance) as strategy_balance\n from daily_strategy_balance\n group by date,\n strategy\n)\nselect\n t.date as time,\n a.strategy,\n a.strategy_balance / nullif(t.balance, 0) as \"%\"\nfrom daily_total t\ninner join daily_per_strategy_total a\n on t.date = a.date\nwhere $__timeFilter(t.date)\norder by t.date asc", + "refId": "A", + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + } + } + ], + "title": "Strategy Distribution", + "type": "timeseries" + }, + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "cdjqw6cqd1gqob" + }, + "description": "WETH includes ETH", + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "axisSoftMax": 0.7, + "axisSoftMin": 5, + "fillOpacity": 80, + "gradientMode": "scheme", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineWidth": 1, + "scaleDistribution": { + "type": "linear" + }, + "thresholdsStyle": { + "mode": "area" + } + }, + "fieldMinMax": false, + "mappings": [], + "min": 0, + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "red", + "value": null + }, + { + "color": "green", + "value": 0.05 + }, + { + "color": "red", + "value": 0.66 + } + ] + }, + "unit": "percentunit" + }, + "overrides": [] + }, + "gridPos": { + "h": 9, + "w": 12, + "x": 0, + "y": 19 + }, + "id": 56, + "options": { + "barRadius": 0, + "barWidth": 0.7, + "colorByField": "%", + "fullHighlight": false, + "groupWidth": 1, + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "orientation": "horizontal", + "showValue": "auto", + "stacking": "none", + "text": {}, + "tooltip": { + "mode": "none", + "sort": "none" + }, + "xTickLabelRotation": 0, + "xTickLabelSpacing": 0 + }, + "pluginVersion": "10.3.0-64399", + "targets": [ + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "cdjqw6cqd1gqob" + }, + "editorMode": "code", + "format": "table", + "rawQuery": true, + "rawSql": "WITH _daily_strategy_balance as (\n select\n DATE(timestamp) as date,\n strategy,\n case\n when asset = '0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee' then '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2'\n else asset end as asset,\n balance,\n ROW_NUMBER()\n OVER (PARTITION BY strategy, asset, DATE(timestamp) ORDER BY timestamp DESC) as rn\n from strategy_balance\n where asset in (\n select\n address\n from o_token_asset\n where symbol != 'OETH' AND chain_id = 1 AND otoken = '0x856c4efb76c1d1ae02e20ceb03a2a6a08b0b8dc3'\n )\n),\n _daily_exchange_rate as (\n select\n DATE(timestamp) as date,\n base,\n quote,\n rate,\n ROW_NUMBER()\n OVER (PARTITION BY base, quote, DATE(timestamp) ORDER BY timestamp DESC) as rn\n from exchange_rate\n),\n daily_strategy_balance as (\n select\n b.date,\n strategy,\n symbol,\n balance * (r.rate / 1e18) as balance,\n (r.rate / 1e18) as rate\n from _daily_strategy_balance b\n inner join o_token_asset oa\n on b.asset = oa.address AND chain_id = 1 AND otoken = '0x856c4efb76c1d1ae02e20ceb03a2a6a08b0b8dc3'\n left join _daily_exchange_rate r\n on r.date = b.date and r.base = 'ETH' and r.quote = oa.symbol and r.rn = 1\n where b.rn = 1\n),\n daily_total as (\n select\n date,\n sum(balance) as total_balance\n from daily_strategy_balance\n group by date\n),\n daily_strategy_asset_total as (\n select\n date,\n symbol,\n rate,\n sum(balance) as asset_balance\n from daily_strategy_balance\n group by date, symbol, rate\n)\n\nselect\n t.date as time,\n -- t.total_balance,\n case when a.symbol = 'WETH' then 'ETH / WETH' else a.symbol end as symbol,\n -- a.asset_balance,\n a.asset_balance / nullif(t.total_balance, 0) as \"%\"\n -- a.rate\nfrom daily_total t\ninner join daily_strategy_asset_total a\n on t.date = a.date\nwhere t.date = current_date\norder by t.date asc", + "refId": "A", + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + } + } + ], + "title": "Current Asset Distribution %", + "type": "barchart" + }, + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "cdjqw6cqd1gqob" + }, + "description": "WETH includes ETH", + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "custom": { + "align": "auto", + "cellOptions": { + "type": "auto" + }, + "inspect": false + }, + "decimals": 3, + "fieldMinMax": false, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "none" + }, + "overrides": [ + { + "matcher": { + "id": "byName", + "options": "balance_usd" + }, + "properties": [ + { + "id": "unit", + "value": "currencyUSD" + }, + { + "id": "decimals", + "value": 2 + } + ] + } + ] + }, + "gridPos": { + "h": 9, + "w": 12, + "x": 12, + "y": 19 + }, + "id": 57, + "options": { + "cellHeight": "sm", + "footer": { + "countRows": false, + "fields": [ + "balance_eth", + "balance_usd" + ], + "reducer": [ + "sum" + ], + "show": true + }, + "showHeader": true, + "sortBy": [] + }, + "pluginVersion": "11.1.0-69622", + "targets": [ + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "cdjqw6cqd1gqob" + }, + "editorMode": "code", + "format": "table", + "rawQuery": true, + "rawSql": "WITH _daily_strategy_balance as (\n select\n DATE(timestamp) as date,\n strategy,\n case\n when asset = '0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee' then '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2'\n else asset end as asset,\n balance,\n ROW_NUMBER()\n OVER (PARTITION BY strategy, asset, DATE(timestamp) ORDER BY timestamp DESC) as rn\n from strategy_balance\n where asset in (\n select\n address\n from o_token_asset\n where symbol != 'OETH' AND chain_id = 1 AND otoken = '0x856c4efb76c1d1ae02e20ceb03a2a6a08b0b8dc3'\n )\n),\n _daily_exchange_rate as (\n select\n DATE(timestamp) as date,\n base,\n quote,\n rate,\n ROW_NUMBER()\n OVER (PARTITION BY base, quote, DATE(timestamp) ORDER BY timestamp DESC) as rn\n from exchange_rate\n),\n daily_strategy_balance as (\n select\n b.date,\n strategy,\n symbol,\n balance,\n balance * coalesce(r.rate / 1e18, 1) as balance_eth,\n balance * coalesce(r.rate / 1e18, 1) * coalesce(r_usd.rate / 1e8, 1) as balance_usd,\n coalesce(r.rate / 1e18, 1) as rate,\n coalesce(r_usd.rate / 1e18, 1) as rate_usd\n from _daily_strategy_balance b\n inner join o_token_asset oa\n on b.asset = oa.address AND chain_id = 1 AND otoken = '0x856c4efb76c1d1ae02e20ceb03a2a6a08b0b8dc3'\n left join _daily_exchange_rate r\n on r.date = b.date and r.base = 'ETH' and r.quote = oa.symbol and r.rn = 1\n left join _daily_exchange_rate r_usd\n on r_usd.date = b.date and r_usd.base = 'ETH' and r_usd.quote = 'USD' and r_usd.rn = 1\n where b.rn = 1\n),\n daily_strategy_asset_total as (\n select\n date,\n symbol,\n rate,\n sum(balance) as balance,\n sum(balance_eth) as balance_eth,\n sum(balance_usd) as balance_usd\n from daily_strategy_balance\n group by date, symbol, rate\n)\n\nselect\n symbol,\n balance / 1e18 as balance,\n balance_eth / 1e18 as balance_eth,\n balance_usd / 1e18 as balance_usd\nfrom daily_strategy_asset_total\nwhere date = current_date\norder by date ", + "refId": "A", + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + } + } + ], + "title": "Current Asset Distribution", + "type": "table" + }, + { + "collapsed": false, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 28 + }, + "id": 9, + "panels": [], + "title": "OETH Convex ETH+OETH", + "type": "row" + }, + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "cdjqw6cqd1gqob" + }, + "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": 29 + }, + "id": 17, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "multi", + "sort": "none" + } + }, + "targets": [ + { + "datasource": { + "type": "postgres", + "uid": "cdjqw6cqd1gqob" + }, + "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'\n and $__timeFilter(timestamp)\n", + "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": "grafana-postgresql-datasource", + "uid": "cdjqw6cqd1gqob" + }, + "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": 13, + "w": 11, + "x": 11, + "y": 29 + }, + "id": 13, + "options": { + "legend": { + "calcs": [ + "lastNotNull" + ], + "displayMode": "table", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "multi", + "sort": "none" + } + }, + "targets": [ + { + "datasource": { + "type": "postgres", + "uid": "cdjqw6cqd1gqob" + }, + "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'\n and $__timeFilter(timestamp)\n\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", + "type": "timeseries" + }, { "datasource": { "type": "postgres", - "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + "uid": "cdjqw6cqd1gqob" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "percentunit" + }, + "overrides": [] + }, + "gridPos": { + "h": 13, + "w": 2, + "x": 22, + "y": 29 + }, + "id": 36, + "options": { + "colorMode": "value", + "graphMode": "area", + "justifyMode": "auto", + "orientation": "auto", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "showPercentChange": false, + "textMode": "auto", + "wideLayout": true + }, + "pluginVersion": "11.1.0-69622", + "targets": [ + { + "datasource": { + "type": "postgres", + "uid": "cdjqw6cqd1gqob" + }, + "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" + }, + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "cdjqw6cqd1gqob" }, "fieldConfig": { "defaults": { @@ -90,26 +1459,176 @@ "value": 80 } ] + }, + "unit": "percentunit" + }, + "overrides": [] + }, + "gridPos": { + "h": 4, + "w": 11, + "x": 0, + "y": 38 + }, + "id": 42, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": false + }, + "tooltip": { + "mode": "multi", + "sort": "none" + } + }, + "targets": [ + { + "datasource": { + "type": "postgres", + "uid": "cdjqw6cqd1gqob" + }, + "editorMode": "code", + "format": "table", + "rawQuery": true, + "rawSql": "SELECT timestamp as time, 1-balance_weight as percentage_oeth\nFROM strategy_daily_yield\nWHERE strategy = '0x1827f9ea98e0bf96550b2fc20f7233277fcd7e63'\n and $__timeFilter(timestamp)\n", + "refId": "A", + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + } + } + ], + "title": "Percent of OETH in Pool", + "type": "timeseries" + }, + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "cdjqw6cqd1gqob" + }, + "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", + "value": null + } + ] } }, "overrides": [ { "matcher": { - "id": "byName", - "options": "earnings_change" + "id": "byRegexp", + "options": "/.*_p/" }, "properties": [ { "id": "custom.axisPlacement", "value": "right" }, + { + "id": "custom.stacking", + "value": { + "group": "A", + "mode": "percent" + } + }, { "id": "custom.fillOpacity", - "value": 25 + "value": 35 + }, + { + "id": "custom.lineWidth", + "value": 0 }, { - "id": "custom.lineWidth", - "value": 0 + "id": "unit", + "value": "percentunit" + } + ] + }, + { + "matcher": { + "id": "byRegexp", + "options": "/balance0.*/" + }, + "properties": [ + { + "id": "color", + "value": { + "fixedColor": "green", + "mode": "fixed" + } + } + ] + }, + { + "matcher": { + "id": "byRegexp", + "options": "/balance1.*/" + }, + "properties": [ + { + "id": "color", + "value": { + "fixedColor": "blue", + "mode": "fixed" + } } ] } @@ -119,9 +1638,9 @@ "h": 9, "w": 11, "x": 0, - "y": 1 + "y": 42 }, - "id": 17, + "id": 49, "options": { "legend": { "calcs": [], @@ -137,20 +1656,20 @@ "targets": [ { "datasource": { - "type": "postgres", - "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + "type": "grafana-postgresql-datasource", + "uid": "cdjqw6cqd1gqob" }, "editorMode": "code", - "format": "table", + "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 = '0x1827f9ea98e0bf96550b2fc20f7233277fcd7e63'", + "rawSql": "WITH base as (\nSELECT \n timestamp as time, \n balance0 / 1e18 as balance0, \n balance1 / 1e18 as balance1, \n ((balance0 / 1e18) + (balance1 / 1e18)) as total\nFROM curve_pool_balance\nwhere address = '0x94b17476a93b3262d87b9a326965d1e91f9c13e7'\norder by time\n)\n\nselect \n time,\n balance0,\n balance1,\n balance0 / nullif(total, 0) as balance0_p,\n balance1 / nullif(total, 0) as balance1_p\nfrom base\n", "refId": "A", "sql": { "columns": [ { "parameters": [ { - "name": "strategy", + "name": "address", "type": "functionParameter" } ], @@ -159,7 +1678,7 @@ { "parameters": [ { - "name": "asset", + "name": "balance0", "type": "functionParameter" } ], @@ -168,7 +1687,16 @@ { "parameters": [ { - "name": "earnings", + "name": "balance1", + "type": "functionParameter" + } + ], + "type": "function" + }, + { + "parameters": [ + { + "name": "balance2", "type": "functionParameter" } ], @@ -185,18 +1713,18 @@ ], "limit": 50 }, - "table": "strategy_daily_yield" + "table": "curve_pool_balance" } ], - "title": "OETH Convex ETH+OETH (AMO) - Earnings", + "title": "Pool Balance", "type": "timeseries" }, { "datasource": { - "type": "postgres", - "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + "type": "grafana-postgresql-datasource", + "uid": "cdjqw6cqd1gqob" }, - "description": "", + "description": "Retrieved using `get_dy(1, 0, 1000000000000000000)`", "fieldConfig": { "defaults": { "color": { @@ -208,11 +1736,10 @@ "axisColorMode": "text", "axisLabel": "", "axisPlacement": "auto", - "axisSoftMax": -4, "barAlignment": 0, "drawStyle": "line", "fillOpacity": 0, - "gradientMode": "hue", + "gradientMode": "none", "hideFrom": { "legend": false, "tooltip": false, @@ -220,100 +1747,54 @@ }, "insertNulls": false, "lineInterpolation": "stepAfter", - "lineStyle": { - "fill": "solid" - }, "lineWidth": 1, "pointSize": 5, "scaleDistribution": { "type": "linear" }, "showPoints": "auto", - "spanNulls": true, + "spanNulls": false, "stacking": { "group": "A", "mode": "none" }, "thresholdsStyle": { - "mode": "off" + "mode": "line+area" } }, + "decimals": 5, "mappings": [], - "max": 0.75, "thresholds": { "mode": "absolute", "steps": [ { - "color": "green", + "color": "dark-red", "value": null }, { - "color": "red", - "value": 80 - } - ] - } - }, - "overrides": [ - { - "matcher": { - "id": "byRegexp", - "options": "/apy.*/" - }, - "properties": [ - { - "id": "custom.axisPlacement", - "value": "auto" - }, - { - "id": "custom.showPoints", - "value": "never" + "color": "transparent", + "value": 0.996 }, { - "id": "custom.lineWidth", + "color": "dark-red", "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 } ] } - ] + }, + "overrides": [] }, "gridPos": { "h": 9, "w": 11, "x": 11, - "y": 1 + "y": 42 }, - "id": 13, + "id": 52, "options": { "legend": { - "calcs": [ - "lastNotNull" - ], - "displayMode": "table", + "calcs": [], + "displayMode": "list", "placement": "bottom", "showLegend": true }, @@ -325,43 +1806,18 @@ "targets": [ { "datasource": { - "type": "postgres", - "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + "type": "grafana-postgresql-datasource", + "uid": "cdjqw6cqd1gqob" }, "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", + "rawSql": "select\n timestamp as time,\n rate / 1e18 as rate\nfrom\n curve_pool_rate\nwhere\n address = '0x94b17476a93b3262d87b9a326965d1e91f9c13e7'\n and name = '1-0-1000000000000000000'\n and $__timeFilter(timestamp)\n and timestamp > '2023-05-01' -- omit some initial funky values\norder by\n time asc", "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" - } - ], + "parameters": [], "type": "function" } ], @@ -374,39 +1830,42 @@ } ], "limit": 50 - }, - "table": "strategy_yield" + } } ], - "title": "OETH Convex ETH+OETH (AMO) - APY by Day", - "transformations": [], + "title": "OETH / ETH Rate - get_dy(1, 0, 1e18)", "type": "timeseries" }, { "datasource": { - "type": "postgres", - "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + "type": "grafana-postgresql-datasource", + "uid": "cdjqw6cqd1gqob" }, + "description": "", "fieldConfig": { "defaults": { "color": { "mode": "thresholds" }, + "decimals": 5, "mappings": [], "thresholds": { "mode": "absolute", "steps": [ { - "color": "green", + "color": "red", "value": null }, + { + "color": "green", + "value": 0.996 + }, { "color": "red", - "value": 80 + "value": 1 } ] - }, - "unit": "percentunit" + } }, "overrides": [] }, @@ -414,12 +1873,12 @@ "h": 9, "w": 2, "x": 22, - "y": 1 + "y": 42 }, - "id": 36, + "id": 50, "options": { "colorMode": "value", - "graphMode": "area", + "graphMode": "none", "justifyMode": "auto", "orientation": "auto", "reduceOptions": { @@ -429,26 +1888,55 @@ "fields": "", "values": false }, - "textMode": "auto" + "showPercentChange": false, + "textMode": "auto", + "wideLayout": true }, - "pluginVersion": "10.3.0-63137", + "pluginVersion": "11.1.0-69622", "targets": [ { "datasource": { - "type": "postgres", - "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + "type": "grafana-postgresql-datasource", + "uid": "cdjqw6cqd1gqob" }, "editorMode": "code", - "format": "table", + "format": "time_series", "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 ", + "rawSql": "select\n timestamp as time,\n rate / 1e18 as rate\nfrom\n curve_pool_rate\nwhere\n address = '0x94b17476a93b3262d87b9a326965d1e91f9c13e7'\n and name = '1-0-1000000000000000000'\n and $__timeFilter(timestamp)\n and timestamp > '2023-05-01' -- omit some initial funky values\norder by\n time asc", "refId": "A", "sql": { "columns": [ { "parameters": [ { - "name": "apy", + "name": "address", + "type": "functionParameter" + } + ], + "type": "function" + }, + { + "parameters": [ + { + "name": "balance0", + "type": "functionParameter" + } + ], + "type": "function" + }, + { + "parameters": [ + { + "name": "balance1", + "type": "functionParameter" + } + ], + "type": "function" + }, + { + "parameters": [ + { + "name": "balance2", "type": "functionParameter" } ], @@ -465,10 +1953,10 @@ ], "limit": 50 }, - "table": "strategy_daily_yield" + "table": "curve_pool_balance" } ], - "title": "Latest APY", + "title": "Current Rate", "type": "stat" }, { @@ -477,7 +1965,7 @@ "h": 1, "w": 24, "x": 0, - "y": 10 + "y": 51 }, "id": 10, "panels": [], @@ -486,8 +1974,8 @@ }, { "datasource": { - "type": "postgres", - "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + "type": "grafana-postgresql-datasource", + "uid": "cdjqw6cqd1gqob" }, "fieldConfig": { "defaults": { @@ -565,10 +2053,10 @@ ] }, "gridPos": { - "h": 9, + "h": 10, "w": 11, "x": 0, - "y": 11 + "y": 52 }, "id": 2, "options": { @@ -579,7 +2067,7 @@ "showLegend": true }, "tooltip": { - "mode": "single", + "mode": "multi", "sort": "none" } }, @@ -587,12 +2075,12 @@ { "datasource": { "type": "postgres", - "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + "uid": "cdjqw6cqd1gqob" }, "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", + "rawSql": "SELECT timestamp as time, earnings_change / 1000000000000000000 as earnings_change, balance / 1000000000000000000 as balance\nFROM strategy_daily_yield\nwhere strategy = '0x3ff8654d633d4ea0fae24c52aec73b4a20d0d0e5'\n and $__timeFilter(timestamp)\norder by time", "refId": "A", "sql": { "columns": [ @@ -639,13 +2127,12 @@ } ], "title": "OETH Frax Staking - Earnings", - "transformations": [], "type": "timeseries" }, { "datasource": { - "type": "postgres", - "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + "type": "grafana-postgresql-datasource", + "uid": "cdjqw6cqd1gqob" }, "description": "", "fieldConfig": { @@ -752,10 +2239,10 @@ ] }, "gridPos": { - "h": 9, + "h": 10, "w": 11, "x": 11, - "y": 11 + "y": 52 }, "id": 6, "options": { @@ -776,13 +2263,13 @@ { "datasource": { "type": "postgres", - "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + "uid": "cdjqw6cqd1gqob" }, "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", + "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'\n and $__timeFilter(timestamp)\n\nORDER BY timestamp", "refId": "A", "sql": { "columns": [ @@ -829,13 +2316,12 @@ } ], "title": "OETH Frax Staking - APY by Day", - "transformations": [], "type": "timeseries" }, { "datasource": { "type": "postgres", - "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + "uid": "cdjqw6cqd1gqob" }, "fieldConfig": { "defaults": { @@ -861,10 +2347,10 @@ "overrides": [] }, "gridPos": { - "h": 9, + "h": 10, "w": 2, "x": 22, - "y": 11 + "y": 52 }, "id": 38, "options": { @@ -879,14 +2365,16 @@ "fields": "", "values": false }, - "textMode": "auto" + "showPercentChange": false, + "textMode": "auto", + "wideLayout": true }, - "pluginVersion": "10.3.0-63137", + "pluginVersion": "11.1.0-69622", "targets": [ { "datasource": { "type": "postgres", - "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + "uid": "cdjqw6cqd1gqob" }, "editorMode": "code", "format": "table", @@ -927,7 +2415,7 @@ "h": 1, "w": 24, "x": 0, - "y": 20 + "y": 62 }, "id": 11, "panels": [], @@ -936,8 +2424,8 @@ }, { "datasource": { - "type": "postgres", - "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + "type": "grafana-postgresql-datasource", + "uid": "cdjqw6cqd1gqob" }, "fieldConfig": { "defaults": { @@ -1015,10 +2503,10 @@ ] }, "gridPos": { - "h": 9, + "h": 10, "w": 11, "x": 0, - "y": 21 + "y": 63 }, "id": 4, "options": { @@ -1037,12 +2525,12 @@ { "datasource": { "type": "postgres", - "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + "uid": "cdjqw6cqd1gqob" }, "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'", + "rawSql": "SELECT timestamp as time, earnings_change / 1000000000000000000 as earnings_change, balance / 1000000000000000000 as balance\nFROM strategy_daily_yield\nwhere strategy = '0xc1fc9e5ec3058921ea5025d703cbe31764756319'\n and $__timeFilter(timestamp)\norder by time", "refId": "A", "sql": { "columns": [ @@ -1089,13 +2577,12 @@ } ], "title": "OETH Morpho Aave V2 - Earnings", - "transformations": [], "type": "timeseries" }, { "datasource": { - "type": "postgres", - "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + "type": "grafana-postgresql-datasource", + "uid": "cdjqw6cqd1gqob" }, "description": "", "fieldConfig": { @@ -1206,10 +2693,10 @@ ] }, "gridPos": { - "h": 9, + "h": 10, "w": 11, "x": 11, - "y": 21 + "y": 63 }, "id": 14, "options": { @@ -1230,13 +2717,13 @@ { "datasource": { "type": "postgres", - "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + "uid": "cdjqw6cqd1gqob" }, "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", + "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'\n and $__timeFilter(timestamp)\nORDER BY timestamp", "refId": "A", "sql": { "columns": [ @@ -1283,13 +2770,12 @@ } ], "title": "OETH Morpho Aave V2 - APY by Day", - "transformations": [], "type": "timeseries" }, { "datasource": { "type": "postgres", - "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + "uid": "cdjqw6cqd1gqob" }, "fieldConfig": { "defaults": { @@ -1315,10 +2801,10 @@ "overrides": [] }, "gridPos": { - "h": 9, + "h": 10, "w": 2, "x": 22, - "y": 21 + "y": 63 }, "id": 37, "options": { @@ -1333,14 +2819,16 @@ "fields": "", "values": false }, - "textMode": "auto" + "showPercentChange": false, + "textMode": "auto", + "wideLayout": true }, - "pluginVersion": "10.3.0-63137", + "pluginVersion": "11.1.0-69622", "targets": [ { "datasource": { "type": "postgres", - "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + "uid": "cdjqw6cqd1gqob" }, "editorMode": "code", "format": "table", @@ -1381,7 +2869,7 @@ "h": 1, "w": 24, "x": 0, - "y": 30 + "y": 73 }, "id": 31, "panels": [], @@ -1390,8 +2878,8 @@ }, { "datasource": { - "type": "postgres", - "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + "type": "grafana-postgresql-datasource", + "uid": "cdjqw6cqd1gqob" }, "fieldConfig": { "defaults": { @@ -1435,7 +2923,8 @@ "mode": "absolute", "steps": [ { - "color": "green" + "color": "green", + "value": null }, { "color": "red", @@ -1468,10 +2957,10 @@ ] }, "gridPos": { - "h": 9, + "h": 10, "w": 11, "x": 0, - "y": 31 + "y": 74 }, "id": 32, "options": { @@ -1482,7 +2971,7 @@ "showLegend": true }, "tooltip": { - "mode": "single", + "mode": "multi", "sort": "none" } }, @@ -1490,12 +2979,12 @@ { "datasource": { "type": "postgres", - "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + "uid": "cdjqw6cqd1gqob" }, "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", + "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'\n and $__timeFilter(timestamp)\n\nORDER BY timestamp", "refId": "A", "sql": { "columns": [ @@ -1545,8 +3034,8 @@ }, { "datasource": { - "type": "postgres", - "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + "type": "grafana-postgresql-datasource", + "uid": "cdjqw6cqd1gqob" }, "description": "These values are based on the ETH/rETH exchange rate which is why we see APY values that are quite variable.", "fieldConfig": { @@ -1595,7 +3084,8 @@ "mode": "absolute", "steps": [ { - "color": "green" + "color": "green", + "value": null }, { "color": "red", @@ -1652,10 +3142,10 @@ ] }, "gridPos": { - "h": 9, + "h": 10, "w": 11, "x": 11, - "y": 31 + "y": 74 }, "id": 33, "options": { @@ -1676,13 +3166,13 @@ { "datasource": { "type": "postgres", - "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + "uid": "cdjqw6cqd1gqob" }, "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", + "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'\n and $__timeFilter(timestamp)\nORDER BY timestamp", "refId": "A", "sql": { "columns": [ @@ -1729,13 +3219,12 @@ } ], "title": "OETH Vault (rETH) - APY", - "transformations": [], "type": "timeseries" }, { "datasource": { "type": "postgres", - "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + "uid": "cdjqw6cqd1gqob" }, "fieldConfig": { "defaults": { @@ -1747,7 +3236,8 @@ "mode": "absolute", "steps": [ { - "color": "green" + "color": "green", + "value": null }, { "color": "red", @@ -1760,10 +3250,10 @@ "overrides": [] }, "gridPos": { - "h": 9, + "h": 10, "w": 2, "x": 22, - "y": 31 + "y": 74 }, "id": 39, "options": { @@ -1778,14 +3268,16 @@ "fields": "", "values": false }, - "textMode": "auto" + "showPercentChange": false, + "textMode": "auto", + "wideLayout": true }, - "pluginVersion": "10.3.0-63137", + "pluginVersion": "11.1.0-69622", "targets": [ { "datasource": { "type": "postgres", - "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + "uid": "cdjqw6cqd1gqob" }, "editorMode": "code", "format": "table", @@ -1822,8 +3314,8 @@ }, { "datasource": { - "type": "postgres", - "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + "type": "grafana-postgresql-datasource", + "uid": "cdjqw6cqd1gqob" }, "fieldConfig": { "defaults": { @@ -1867,7 +3359,8 @@ "mode": "absolute", "steps": [ { - "color": "green" + "color": "green", + "value": null }, { "color": "red", @@ -1900,10 +3393,10 @@ ] }, "gridPos": { - "h": 9, + "h": 10, "w": 11, "x": 0, - "y": 40 + "y": 84 }, "id": 34, "options": { @@ -1914,7 +3407,7 @@ "showLegend": true }, "tooltip": { - "mode": "single", + "mode": "multi", "sort": "none" } }, @@ -1922,12 +3415,12 @@ { "datasource": { "type": "postgres", - "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + "uid": "cdjqw6cqd1gqob" }, "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", + "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'\n and $__timeFilter(timestamp)\n\nORDER BY timestamp", "refId": "A", "sql": { "columns": [ @@ -1977,8 +3470,8 @@ }, { "datasource": { - "type": "postgres", - "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + "type": "grafana-postgresql-datasource", + "uid": "cdjqw6cqd1gqob" }, "description": "", "fieldConfig": { @@ -2027,7 +3520,8 @@ "mode": "absolute", "steps": [ { - "color": "green" + "color": "green", + "value": null }, { "color": "red", @@ -2084,10 +3578,10 @@ ] }, "gridPos": { - "h": 9, + "h": 10, "w": 11, "x": 11, - "y": 40 + "y": 84 }, "id": 35, "options": { @@ -2108,13 +3602,13 @@ { "datasource": { "type": "postgres", - "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + "uid": "cdjqw6cqd1gqob" }, "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", + "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 \nwhere strategy = '0x39254033945aa2e4809cc2977e7087bee48bd7ab' and asset = '0xae7ab96520de3a18e5e111b5eaab095312d7fe84'\n and $__timeFilter(timestamp)\n\nORDER BY timestamp", "refId": "A", "sql": { "columns": [ @@ -2161,13 +3655,12 @@ } ], "title": "OETH Vault (stETH) - APY", - "transformations": [], "type": "timeseries" }, { "datasource": { "type": "postgres", - "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + "uid": "cdjqw6cqd1gqob" }, "fieldConfig": { "defaults": { @@ -2179,7 +3672,8 @@ "mode": "absolute", "steps": [ { - "color": "green" + "color": "green", + "value": null }, { "color": "red", @@ -2192,10 +3686,10 @@ "overrides": [] }, "gridPos": { - "h": 9, + "h": 10, "w": 2, "x": 22, - "y": 40 + "y": 84 }, "id": 41, "options": { @@ -2210,14 +3704,16 @@ "fields": "", "values": false }, - "textMode": "auto" + "showPercentChange": false, + "textMode": "auto", + "wideLayout": true }, - "pluginVersion": "10.3.0-63137", + "pluginVersion": "11.1.0-69622", "targets": [ { "datasource": { "type": "postgres", - "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + "uid": "cdjqw6cqd1gqob" }, "editorMode": "code", "format": "table", @@ -2258,7 +3754,7 @@ "h": 1, "w": 24, "x": 0, - "y": 49 + "y": 94 }, "id": 12, "panels": [], @@ -2267,8 +3763,8 @@ }, { "datasource": { - "type": "postgres", - "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + "type": "grafana-postgresql-datasource", + "uid": "cdjqw6cqd1gqob" }, "fieldConfig": { "defaults": { @@ -2312,7 +3808,8 @@ "mode": "absolute", "steps": [ { - "color": "green" + "color": "green", + "value": null }, { "color": "red", @@ -2345,10 +3842,10 @@ ] }, "gridPos": { - "h": 9, + "h": 10, "w": 11, "x": 0, - "y": 50 + "y": 95 }, "id": 3, "options": { @@ -2359,7 +3856,7 @@ "showLegend": true }, "tooltip": { - "mode": "single", + "mode": "multi", "sort": "none" } }, @@ -2367,12 +3864,12 @@ { "datasource": { "type": "postgres", - "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + "uid": "cdjqw6cqd1gqob" }, "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", + "rawSql": "SELECT\n \"timestamp\" AS \"time\",\n earnings_change / 1000000000000000000 as earnings_change,\n balance / 1000000000000000000 as balance\nFROM\n strategy_daily_yield\nwhere strategy = '0x49109629ac1deb03f2e9b2fe2ac4a623e0e7dfdc'\n and $__timeFilter(timestamp)\nORDER BY timestamp", "refId": "A", "sql": { "columns": [ @@ -2419,13 +3916,12 @@ } ], "title": "OETH Aura rETH/WETH - Earnings", - "transformations": [], "type": "timeseries" }, { "datasource": { - "type": "postgres", - "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + "type": "grafana-postgresql-datasource", + "uid": "cdjqw6cqd1gqob" }, "description": "", "fieldConfig": { @@ -2439,7 +3935,7 @@ "axisColorMode": "text", "axisLabel": "", "axisPlacement": "auto", - "axisSoftMax": -3, + "axisSoftMax": -2, "barAlignment": 0, "drawStyle": "line", "fillOpacity": 0, @@ -2470,13 +3966,12 @@ } }, "mappings": [], - "max": 2, - "min": -0.5, "thresholds": { "mode": "absolute", "steps": [ { - "color": "green" + "color": "green", + "value": null }, { "color": "red", @@ -2529,10 +4024,10 @@ ] }, "gridPos": { - "h": 9, + "h": 10, "w": 11, "x": 11, - "y": 50 + "y": 95 }, "id": 15, "options": { @@ -2553,13 +4048,13 @@ { "datasource": { "type": "postgres", - "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + "uid": "cdjqw6cqd1gqob" }, "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", + "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 \nwhere strategy = '0x49109629ac1deb03f2e9b2fe2ac4a623e0e7dfdc'\n and $__timeFilter(timestamp)\nORDER BY timestamp", "refId": "A", "sql": { "columns": [ @@ -2606,13 +4101,12 @@ } ], "title": "OETH Aura rETH/WETH - APY by Day", - "transformations": [], "type": "timeseries" }, { "datasource": { "type": "postgres", - "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + "uid": "cdjqw6cqd1gqob" }, "fieldConfig": { "defaults": { @@ -2624,7 +4118,8 @@ "mode": "absolute", "steps": [ { - "color": "green" + "color": "green", + "value": null }, { "color": "red", @@ -2637,10 +4132,10 @@ "overrides": [] }, "gridPos": { - "h": 9, + "h": 10, "w": 2, "x": 22, - "y": 50 + "y": 95 }, "id": 40, "options": { @@ -2655,14 +4150,16 @@ "fields": "", "values": false }, - "textMode": "auto" + "showPercentChange": false, + "textMode": "auto", + "wideLayout": true }, - "pluginVersion": "10.3.0-63137", + "pluginVersion": "11.1.0-69622", "targets": [ { "datasource": { "type": "postgres", - "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + "uid": "cdjqw6cqd1gqob" }, "editorMode": "code", "format": "table", @@ -2696,6 +4193,137 @@ ], "title": "Latest APY", "type": "stat" + }, + { + "collapsed": true, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 105 + }, + "id": 55, + "panels": [ + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "cdjqw6cqd1gqob" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 25, + "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": "normal" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "decimals": 2, + "fieldMinMax": false, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "percentunit" + }, + "overrides": [] + }, + "gridPos": { + "h": 10, + "w": 24, + "x": 0, + "y": 17 + }, + "id": 46, + "options": { + "legend": { + "calcs": [ + "lastNotNull" + ], + "displayMode": "table", + "placement": "right", + "showLegend": true + }, + "tooltip": { + "mode": "multi", + "sort": "none" + } + }, + "pluginVersion": "10.3.0-64082", + "targets": [ + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "cdjqw6cqd1gqob" + }, + "editorMode": "code", + "format": "time_series", + "rawQuery": true, + "rawSql": "WITH totals as (\n select\n DATE(daily_stat_id_id) as time,\n sum(tvl / 1e18) as tvl\n from\n oeth_strategy_daily_stat\n group by\n DATE(daily_stat_id_id)\n order by\n DATE(daily_stat_id_id) asc\n),\nmix as (\n select\n DATE(daily_stat_id_id) as time,\n name,\n tvl / 1e18 as tvl,\n (\n select\n tvl\n from\n totals\n where\n time = DATE(daily_stat_id_id)\n ) as total\n from\n oeth_strategy_daily_stat sds\n order by\n DATE(daily_stat_id_id) asc\n)\nselect\n time,\n lower(name) as name,\n -- tvl,\n -- total,\n tvl / total as \"%\"\nfrom\n mix\nwhere $__timeFilter(time) \norder by\n time", + "refId": "A", + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, + "table": "oeth_strategy_daily_stat" + } + ], + "title": "Allocation", + "type": "timeseries" + } + ], + "title": "Discard", + "type": "row" } ], "refresh": "30s", @@ -2710,10 +4338,11 @@ "from": "now-6M", "to": "now" }, + "timeRangeUpdatedDuringEditOrView": false, "timepicker": {}, "timezone": "", "title": "OETH Strategy Earnings", "uid": "c178206e-0cd7-4b2c-98c3-8f16e0d3b58b", - "version": 41, + "version": 112, "weekStart": "" } \ No newline at end of file From 1ab3e23ea17ec369f449937d9827e2ebfe658ac4 Mon Sep 17 00:00:00 2001 From: Chris Jacobs Date: Thu, 25 Apr 2024 09:53:21 -0700 Subject: [PATCH 09/12] grafana update - aave-compound-balances, curve-pools, exchange-rates, origin-overview --- grafana/aave-compound-balances.json | 755 ++++++++ grafana/curve-pools.json | 2543 +++++++++++++++++++++++++++ grafana/exchange-rates.json | 1045 +++++++++++ grafana/origin-overview.json | 201 +++ 4 files changed, 4544 insertions(+) create mode 100644 grafana/aave-compound-balances.json create mode 100644 grafana/curve-pools.json create mode 100644 grafana/exchange-rates.json create mode 100644 grafana/origin-overview.json diff --git a/grafana/aave-compound-balances.json b/grafana/aave-compound-balances.json new file mode 100644 index 00000000..87b8395f --- /dev/null +++ b/grafana/aave-compound-balances.json @@ -0,0 +1,755 @@ +{ + "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": 0, + "id": 26, + "links": [], + "liveNow": false, + "panels": [ + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "cdjqw6cqd1gqob" + }, + "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", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "currencyUSD" + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 8, + "x": 0, + "y": 0 + }, + "id": 1, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "cdjqw6cqd1gqob" + }, + "editorMode": "code", + "format": "table", + "rawQuery": true, + "rawSql": "SELECT\n timestamp as time,\n balance / 1e6 as balance\nFROM\n erc20_balance\nwhere\n $__timeFilter(timestamp) and address = '0xdac17f958d2ee523a2206206994597c13d831ec7' and account = '0x3ed3b47dd13ec9a98b44e6204a523e766b225811'\norder by\n timestamp asc", + "refId": "A", + "sql": { + "columns": [ + { + "parameters": [ + { + "name": "\"timestamp\"", + "type": "functionParameter" + } + ], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, + "table": "erc20_balance" + } + ], + "title": "Aave - USDT", + "type": "timeseries" + }, + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "cdjqw6cqd1gqob" + }, + "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", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "currencyUSD" + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 8, + "x": 8, + "y": 0 + }, + "id": 2, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "cdjqw6cqd1gqob" + }, + "editorMode": "code", + "format": "table", + "rawQuery": true, + "rawSql": "SELECT\n timestamp as time,\n balance / 1e6 as balance\nFROM\n erc20_balance\nwhere\n $__timeFilter(timestamp) and address = '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48' and account = '0xbcca60bb61934080951369a648fb03df4f96263c'\norder by\n timestamp asc", + "refId": "A", + "sql": { + "columns": [ + { + "parameters": [ + { + "name": "\"timestamp\"", + "type": "functionParameter" + } + ], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, + "table": "erc20_balance" + } + ], + "title": "Aave - USDC", + "type": "timeseries" + }, + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "cdjqw6cqd1gqob" + }, + "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", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "currencyUSD" + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 8, + "x": 16, + "y": 0 + }, + "id": 3, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "cdjqw6cqd1gqob" + }, + "editorMode": "code", + "format": "table", + "rawQuery": true, + "rawSql": "SELECT\n timestamp as time,\n balance / 1e18 as balance\nFROM\n erc20_balance\nwhere\n $__timeFilter(timestamp) and address = '0x6b175474e89094c44da98b954eedeac495271d0f' and account = '0x028171bca77440897b824ca71d1c56cac55b68a3'\norder by\n timestamp asc", + "refId": "A", + "sql": { + "columns": [ + { + "parameters": [ + { + "name": "\"timestamp\"", + "type": "functionParameter" + } + ], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, + "table": "erc20_balance" + } + ], + "title": "Aave - DAI", + "type": "timeseries" + }, + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "cdjqw6cqd1gqob" + }, + "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", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "currencyUSD" + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 8, + "x": 0, + "y": 8 + }, + "id": 4, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "cdjqw6cqd1gqob" + }, + "editorMode": "code", + "format": "table", + "rawQuery": true, + "rawSql": "SELECT\n timestamp as time,\n balance / 1e6 as balance\nFROM\n erc20_balance\nwhere\n $__timeFilter(timestamp) and address = '0xdac17f958d2ee523a2206206994597c13d831ec7' and account = '0xf650c3d88d12db855b8bf7d11be6c55a4e07dcc9'\norder by\n timestamp asc", + "refId": "A", + "sql": { + "columns": [ + { + "parameters": [ + { + "name": "\"timestamp\"", + "type": "functionParameter" + } + ], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, + "table": "erc20_balance" + } + ], + "title": "Compound - USDT", + "type": "timeseries" + }, + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "cdjqw6cqd1gqob" + }, + "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", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "currencyUSD" + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 8, + "x": 8, + "y": 8 + }, + "id": 5, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "cdjqw6cqd1gqob" + }, + "editorMode": "code", + "format": "table", + "rawQuery": true, + "rawSql": "SELECT\n timestamp as time,\n balance / 1e6 as balance\nFROM\n erc20_balance\nwhere\n $__timeFilter(timestamp) and address = '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48' and account = '0x39aa39c021dfbae8fac545936693ac917d5e7563'\norder by\n timestamp asc", + "refId": "A", + "sql": { + "columns": [ + { + "parameters": [ + { + "name": "\"timestamp\"", + "type": "functionParameter" + } + ], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, + "table": "erc20_balance" + } + ], + "title": "Compound - USDC", + "type": "timeseries" + }, + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "cdjqw6cqd1gqob" + }, + "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", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "currencyUSD" + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 8, + "x": 16, + "y": 8 + }, + "id": 6, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "cdjqw6cqd1gqob" + }, + "editorMode": "code", + "format": "table", + "rawQuery": true, + "rawSql": "SELECT\n timestamp as time,\n balance / 1e18 as balance\nFROM\n erc20_balance\nwhere\n $__timeFilter(timestamp) and address = '0x6b175474e89094c44da98b954eedeac495271d0f' and account = '0x5d3a536e4d6dbd6114cc1ead35777bab948e3643'\norder by\n timestamp asc", + "refId": "A", + "sql": { + "columns": [ + { + "parameters": [ + { + "name": "\"timestamp\"", + "type": "functionParameter" + } + ], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, + "table": "erc20_balance" + } + ], + "title": "Compound - DAI", + "type": "timeseries" + } + ], + "refresh": "", + "schemaVersion": 39, + "tags": [ + "ousd", + "aave", + "compound" + ], + "templating": { + "list": [] + }, + "time": { + "from": "now-6h", + "to": "now" + }, + "timeRangeUpdatedDuringEditOrView": false, + "timepicker": {}, + "timezone": "", + "title": "Aave & Compound Balances", + "uid": "c747b6d7-c0f3-4317-8bd5-5b434f88a86e", + "version": 5, + "weekStart": "" +} \ No newline at end of file diff --git a/grafana/curve-pools.json b/grafana/curve-pools.json new file mode 100644 index 00000000..da778e75 --- /dev/null +++ b/grafana/curve-pools.json @@ -0,0 +1,2543 @@ +{ + "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": 0, + "id": 19, + "links": [], + "liveNow": false, + "panels": [ + { + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 0 + }, + "id": 6, + "title": "ETH Curve Pools", + "type": "row" + }, + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "cdjqw6cqd1gqob" + }, + "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", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [ + { + "matcher": { + "id": "byRegexp", + "options": "/.*_p/" + }, + "properties": [ + { + "id": "custom.axisPlacement", + "value": "right" + }, + { + "id": "custom.stacking", + "value": { + "group": "A", + "mode": "percent" + } + }, + { + "id": "custom.fillOpacity", + "value": 40 + }, + { + "id": "custom.lineWidth", + "value": 0 + }, + { + "id": "unit", + "value": "percentunit" + } + ] + } + ] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 1 + }, + "id": 10, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "multi", + "sort": "none" + } + }, + "targets": [ + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "cdjqw6cqd1gqob" + }, + "editorMode": "code", + "format": "time_series", + "rawQuery": true, + "rawSql": "WITH base as (\nSELECT \n timestamp as time, \n balance0 / 1e18 as balance0, \n balance1 / 1e18 as balance1, \n ((balance0 / 1e18) + (balance1 / 1e18)) as total\nFROM curve_pool_balance\nwhere address = '0x94b17476a93b3262d87b9a326965d1e91f9c13e7'\norder by time\n)\n\nselect \n time,\n balance0,\n balance1,\n balance0 / nullif(total, 0) as balance0_p,\n balance1 / nullif(total, 0) as balance1_p\nfrom base\n", + "refId": "A", + "sql": { + "columns": [ + { + "parameters": [ + { + "name": "address", + "type": "functionParameter" + } + ], + "type": "function" + }, + { + "parameters": [ + { + "name": "balance0", + "type": "functionParameter" + } + ], + "type": "function" + }, + { + "parameters": [ + { + "name": "balance1", + "type": "functionParameter" + } + ], + "type": "function" + }, + { + "parameters": [ + { + "name": "balance2", + "type": "functionParameter" + } + ], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, + "table": "curve_pool_balance" + } + ], + "title": "factory-v2-298: ETH/OETH - 0x94b17476a93b3262d87b9a326965d1e91f9c13e7", + "type": "timeseries" + }, + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "cdjqw6cqd1gqob" + }, + "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", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [ + { + "matcher": { + "id": "byRegexp", + "options": "/.*_p/" + }, + "properties": [ + { + "id": "custom.axisPlacement", + "value": "right" + }, + { + "id": "custom.stacking", + "value": { + "group": "A", + "mode": "percent" + } + }, + { + "id": "custom.fillOpacity", + "value": 40 + }, + { + "id": "custom.lineWidth", + "value": 0 + }, + { + "id": "unit", + "value": "percentunit" + } + ] + } + ] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 12, + "y": 1 + }, + "id": 7, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "multi", + "sort": "none" + } + }, + "targets": [ + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "cdjqw6cqd1gqob" + }, + "editorMode": "code", + "format": "time_series", + "rawQuery": true, + "rawSql": "WITH base as (\nSELECT \n timestamp as time, \n balance0 / 1e18 as balance0, \n balance1 / 1e18 as balance1, \n ((balance0 / 1e18) + (balance1 / 1e18)) as total\nFROM curve_pool_balance\nwhere address = '0x0f3159811670c117c372428d4e69ac32325e4d0f'\norder by time\n)\n\nselect \n time,\n balance0,\n balance1,\n balance0 / nullif(total, 0) as balance0_p,\n balance1 / nullif(total, 0) as balance1_p\nfrom base\n", + "refId": "A", + "sql": { + "columns": [ + { + "parameters": [ + { + "name": "address", + "type": "functionParameter" + } + ], + "type": "function" + }, + { + "parameters": [ + { + "name": "balance0", + "type": "functionParameter" + } + ], + "type": "function" + }, + { + "parameters": [ + { + "name": "balance1", + "type": "functionParameter" + } + ], + "type": "function" + }, + { + "parameters": [ + { + "name": "balance2", + "type": "functionParameter" + } + ], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, + "table": "curve_pool_balance" + } + ], + "title": "factory-crypto-210: ETH/rETH - 0x0f3159811670c117c372428d4e69ac32325e4d0f", + "type": "timeseries" + }, + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "cdjqw6cqd1gqob" + }, + "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", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [ + { + "matcher": { + "id": "byRegexp", + "options": "/.*_p/" + }, + "properties": [ + { + "id": "custom.axisPlacement", + "value": "right" + }, + { + "id": "custom.stacking", + "value": { + "group": "A", + "mode": "percent" + } + }, + { + "id": "custom.fillOpacity", + "value": 40 + }, + { + "id": "custom.lineWidth", + "value": 0 + }, + { + "id": "unit", + "value": "percentunit" + } + ] + } + ] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 9 + }, + "id": 4, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "multi", + "sort": "none" + } + }, + "targets": [ + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "cdjqw6cqd1gqob" + }, + "editorMode": "code", + "format": "time_series", + "rawQuery": true, + "rawSql": "WITH base as (\nSELECT \n timestamp as time, \n balance0 / 1e18 as balance0, \n balance1 / 1e18 as balance1, \n ((balance0 / 1e18) + (balance1 / 1e18)) as total\nFROM curve_pool_balance\nwhere address = '0xa1f8a6807c402e4a15ef4eba36528a3fed24e577'\norder by time\n)\n\nselect \n time,\n balance0,\n balance1,\n balance0 / nullif(total, 0) as balance0_p,\n balance1 / nullif(total, 0) as balance1_p\nfrom base\n", + "refId": "A", + "sql": { + "columns": [ + { + "parameters": [ + { + "name": "address", + "type": "functionParameter" + } + ], + "type": "function" + }, + { + "parameters": [ + { + "name": "balance0", + "type": "functionParameter" + } + ], + "type": "function" + }, + { + "parameters": [ + { + "name": "balance1", + "type": "functionParameter" + } + ], + "type": "function" + }, + { + "parameters": [ + { + "name": "balance2", + "type": "functionParameter" + } + ], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, + "table": "curve_pool_balance" + } + ], + "title": "frxeth: ETH/frxETH - 0xa1f8a6807c402e4a15ef4eba36528a3fed24e577", + "type": "timeseries" + }, + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "cdjqw6cqd1gqob" + }, + "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", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [ + { + "matcher": { + "id": "byRegexp", + "options": "/.*_p/" + }, + "properties": [ + { + "id": "custom.axisPlacement", + "value": "right" + }, + { + "id": "custom.stacking", + "value": { + "group": "A", + "mode": "percent" + } + }, + { + "id": "custom.fillOpacity", + "value": 40 + }, + { + "id": "custom.lineWidth", + "value": 0 + }, + { + "id": "unit", + "value": "percentunit" + } + ] + } + ] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 12, + "y": 9 + }, + "id": 14, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "multi", + "sort": "none" + } + }, + "targets": [ + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "cdjqw6cqd1gqob" + }, + "editorMode": "code", + "format": "time_series", + "rawQuery": true, + "rawSql": "WITH base as (\nSELECT \n timestamp as time, \n balance0 / 1e18 as balance0, \n balance1 / 1e18 as balance1, \n ((balance0 / 1e18) + (balance1 / 1e18)) as total\nFROM curve_pool_balance\nwhere address = '0x828b154032950c8ff7cf8085d841723db2696056'\norder by time\n)\n\nselect \n time,\n balance0,\n balance1,\n balance0 / nullif(total, 0) as balance0_p,\n balance1 / nullif(total, 0) as balance1_p\nfrom base\n", + "refId": "A", + "sql": { + "columns": [ + { + "parameters": [ + { + "name": "address", + "type": "functionParameter" + } + ], + "type": "function" + }, + { + "parameters": [ + { + "name": "balance0", + "type": "functionParameter" + } + ], + "type": "function" + }, + { + "parameters": [ + { + "name": "balance1", + "type": "functionParameter" + } + ], + "type": "function" + }, + { + "parameters": [ + { + "name": "balance2", + "type": "functionParameter" + } + ], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, + "table": "curve_pool_balance" + } + ], + "title": "factory-v2-117: WETH/stETH - 0x828b154032950c8ff7cf8085d841723db2696056", + "type": "timeseries" + }, + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "cdjqw6cqd1gqob" + }, + "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", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [ + { + "matcher": { + "id": "byRegexp", + "options": "/.*_p/" + }, + "properties": [ + { + "id": "custom.axisPlacement", + "value": "right" + }, + { + "id": "custom.stacking", + "value": { + "group": "A", + "mode": "percent" + } + }, + { + "id": "custom.fillOpacity", + "value": 40 + }, + { + "id": "custom.lineWidth", + "value": 0 + }, + { + "id": "unit", + "value": "percentunit" + } + ] + } + ] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 17 + }, + "id": 8, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "multi", + "sort": "none" + } + }, + "targets": [ + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "cdjqw6cqd1gqob" + }, + "editorMode": "code", + "format": "time_series", + "rawQuery": true, + "rawSql": "WITH base as (\nSELECT \n timestamp as time, \n balance0 / 1e18 as balance0, \n balance1 / 1e18 as balance1, \n ((balance0 / 1e18) + (balance1 / 1e18)) as total\nFROM curve_pool_balance\nwhere address = '0xdc24316b9ae028f1497c275eb9192a3ea0f67022'\norder by time\n)\n\nselect \n time,\n balance0,\n balance1,\n balance0 / nullif(total, 0) as balance0_p,\n balance1 / nullif(total, 0) as balance1_p\nfrom base\n", + "refId": "A", + "sql": { + "columns": [ + { + "parameters": [ + { + "name": "address", + "type": "functionParameter" + } + ], + "type": "function" + }, + { + "parameters": [ + { + "name": "balance0", + "type": "functionParameter" + } + ], + "type": "function" + }, + { + "parameters": [ + { + "name": "balance1", + "type": "functionParameter" + } + ], + "type": "function" + }, + { + "parameters": [ + { + "name": "balance2", + "type": "functionParameter" + } + ], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, + "table": "curve_pool_balance" + } + ], + "title": "steth: ETH/stETH - 0xdc24316b9ae028f1497c275eb9192a3ea0f67022", + "type": "timeseries" + }, + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "cdjqw6cqd1gqob" + }, + "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", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [ + { + "matcher": { + "id": "byRegexp", + "options": "/.*_p/" + }, + "properties": [ + { + "id": "custom.axisPlacement", + "value": "right" + }, + { + "id": "custom.stacking", + "value": { + "group": "A", + "mode": "percent" + } + }, + { + "id": "custom.fillOpacity", + "value": 40 + }, + { + "id": "custom.lineWidth", + "value": 0 + }, + { + "id": "unit", + "value": "percentunit" + } + ] + } + ] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 12, + "y": 17 + }, + "id": 11, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "multi", + "sort": "none" + } + }, + "targets": [ + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "cdjqw6cqd1gqob" + }, + "editorMode": "code", + "format": "time_series", + "rawQuery": true, + "rawSql": "WITH base as (\nSELECT \n timestamp as time, \n balance0 / 1e18 as balance0, \n balance1 / 1e18 as balance1, \n ((balance0 / 1e18) + (balance1 / 1e18)) as total\nFROM curve_pool_balance\nwhere address = '0x9c3b46c0ceb5b9e304fcd6d88fc50f7dd24b31bc'\norder by time\n)\n\nselect \n time,\n balance0,\n balance1,\n balance0 / nullif(total, 0) as balance0_p,\n balance1 / nullif(total, 0) as balance1_p\nfrom base\n", + "refId": "A", + "sql": { + "columns": [ + { + "parameters": [ + { + "name": "address", + "type": "functionParameter" + } + ], + "type": "function" + }, + { + "parameters": [ + { + "name": "balance0", + "type": "functionParameter" + } + ], + "type": "function" + }, + { + "parameters": [ + { + "name": "balance1", + "type": "functionParameter" + } + ], + "type": "function" + }, + { + "parameters": [ + { + "name": "balance2", + "type": "functionParameter" + } + ], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, + "table": "curve_pool_balance" + } + ], + "title": "factory-crvusd-15: WETH/frxETH - 0x9c3b46c0ceb5b9e304fcd6d88fc50f7dd24b31bc", + "type": "timeseries" + }, + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "cdjqw6cqd1gqob" + }, + "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", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [ + { + "matcher": { + "id": "byRegexp", + "options": "/.*_p/" + }, + "properties": [ + { + "id": "custom.axisPlacement", + "value": "right" + }, + { + "id": "custom.stacking", + "value": { + "group": "A", + "mode": "percent" + } + }, + { + "id": "custom.fillOpacity", + "value": 40 + }, + { + "id": "custom.lineWidth", + "value": 0 + }, + { + "id": "unit", + "value": "percentunit" + } + ] + } + ] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 25 + }, + "id": 12, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "multi", + "sort": "none" + } + }, + "targets": [ + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "cdjqw6cqd1gqob" + }, + "editorMode": "code", + "format": "time_series", + "rawQuery": true, + "rawSql": "WITH base as (\nSELECT \n timestamp as time, \n balance0 / 1e18 as balance0, \n balance1 / 1e18 as balance1, \n ((balance0 / 1e18) + (balance1 / 1e18)) as total\nFROM curve_pool_balance\nwhere address = '0x21e27a5e5513d6e65c4f830167390997aa84843a'\norder by time\n)\n\nselect \n time,\n balance0,\n balance1,\n balance0 / nullif(total, 0) as balance0_p,\n balance1 / nullif(total, 0) as balance1_p\nfrom base\n", + "refId": "A", + "sql": { + "columns": [ + { + "parameters": [ + { + "name": "address", + "type": "functionParameter" + } + ], + "type": "function" + }, + { + "parameters": [ + { + "name": "balance0", + "type": "functionParameter" + } + ], + "type": "function" + }, + { + "parameters": [ + { + "name": "balance1", + "type": "functionParameter" + } + ], + "type": "function" + }, + { + "parameters": [ + { + "name": "balance2", + "type": "functionParameter" + } + ], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, + "table": "curve_pool_balance" + } + ], + "title": "stETH-ng: ETH/stETH - 0x21e27a5e5513d6e65c4f830167390997aa84843a", + "type": "timeseries" + }, + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "cdjqw6cqd1gqob" + }, + "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", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [ + { + "matcher": { + "id": "byRegexp", + "options": "/.*_p/" + }, + "properties": [ + { + "id": "custom.axisPlacement", + "value": "right" + }, + { + "id": "custom.stacking", + "value": { + "group": "A", + "mode": "percent" + } + }, + { + "id": "custom.fillOpacity", + "value": 40 + }, + { + "id": "custom.lineWidth", + "value": 0 + }, + { + "id": "unit", + "value": "percentunit" + } + ] + } + ] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 12, + "y": 25 + }, + "id": 13, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "multi", + "sort": "none" + } + }, + "targets": [ + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "cdjqw6cqd1gqob" + }, + "editorMode": "code", + "format": "time_series", + "rawQuery": true, + "rawSql": "WITH base as (\nSELECT \n timestamp as time, \n balance0 / 1e18 as balance0, \n balance1 / 1e18 as balance1, \n ((balance0 / 1e18) + (balance1 / 1e18)) as total\nFROM curve_pool_balance\nwhere address = '0x4d9f9d15101eec665f77210cb999639f760f831e'\norder by time\n)\n\nselect \n time,\n balance0,\n balance1,\n balance0 / nullif(total, 0) as balance0_p,\n balance1 / nullif(total, 0) as balance1_p\nfrom base\n", + "refId": "A", + "sql": { + "columns": [ + { + "parameters": [ + { + "name": "address", + "type": "functionParameter" + } + ], + "type": "function" + }, + { + "parameters": [ + { + "name": "balance0", + "type": "functionParameter" + } + ], + "type": "function" + }, + { + "parameters": [ + { + "name": "balance1", + "type": "functionParameter" + } + ], + "type": "function" + }, + { + "parameters": [ + { + "name": "balance2", + "type": "functionParameter" + } + ], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, + "table": "curve_pool_balance" + } + ], + "title": "factory-v2-274: stETH/frxETH - 0x4d9f9d15101eec665f77210cb999639f760f831e", + "type": "timeseries" + }, + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "cdjqw6cqd1gqob" + }, + "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": [ + { + "matcher": { + "id": "byRegexp", + "options": "/.*_p/" + }, + "properties": [ + { + "id": "custom.axisPlacement", + "value": "right" + }, + { + "id": "custom.stacking", + "value": { + "group": "A", + "mode": "percent" + } + }, + { + "id": "custom.fillOpacity", + "value": 40 + }, + { + "id": "custom.lineWidth", + "value": 0 + }, + { + "id": "unit", + "value": "percentunit" + } + ] + } + ] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 33 + }, + "id": 16, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "multi", + "sort": "none" + } + }, + "targets": [ + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "cdjqw6cqd1gqob" + }, + "editorMode": "code", + "format": "time_series", + "rawQuery": true, + "rawSql": "WITH base as (\nSELECT \n timestamp as time, \n balance0 / 1e18 as balance0, \n balance1 / 1e18 as balance1, \n ((balance0 / 1e18) + (balance1 / 1e18)) as total\nFROM curve_pool_balance\nwhere address = '0xe7c6e0a739021cdba7aac21b4b728779eef974d9'\norder by time\n)\n\nselect \n time,\n balance0,\n balance1,\n balance0 / nullif(total, 0) as balance0_p,\n balance1 / nullif(total, 0) as balance1_p\nfrom base\n", + "refId": "A", + "sql": { + "columns": [ + { + "parameters": [ + { + "name": "address", + "type": "functionParameter" + } + ], + "type": "function" + }, + { + "parameters": [ + { + "name": "balance0", + "type": "functionParameter" + } + ], + "type": "function" + }, + { + "parameters": [ + { + "name": "balance1", + "type": "functionParameter" + } + ], + "type": "function" + }, + { + "parameters": [ + { + "name": "balance2", + "type": "functionParameter" + } + ], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, + "table": "curve_pool_balance" + } + ], + "title": "factory-crypto-218: rETH/frxETH - 0xe7c6e0a739021cdba7aac21b4b728779eef974d9", + "type": "timeseries" + }, + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "cdjqw6cqd1gqob" + }, + "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": [ + { + "matcher": { + "id": "byRegexp", + "options": "/.*_p/" + }, + "properties": [ + { + "id": "custom.axisPlacement", + "value": "right" + }, + { + "id": "custom.stacking", + "value": { + "group": "A", + "mode": "percent" + } + }, + { + "id": "custom.fillOpacity", + "value": 40 + }, + { + "id": "custom.lineWidth", + "value": 0 + }, + { + "id": "unit", + "value": "percentunit" + } + ] + } + ] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 12, + "y": 33 + }, + "id": 15, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "multi", + "sort": "none" + } + }, + "targets": [ + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "cdjqw6cqd1gqob" + }, + "editorMode": "code", + "format": "time_series", + "rawQuery": true, + "rawSql": "WITH base as (\nSELECT \n timestamp as time, \n balance0 / 1e18 as balance0, \n balance1 / 1e18 as balance1, \n ((balance0 / 1e18) + (balance1 / 1e18)) as total\nFROM curve_pool_balance\nwhere address = '0x447ddd4960d9fdbf6af9a790560d0af76795cb08'\norder by time\n)\n\nselect \n time,\n balance0,\n balance1,\n balance0 / nullif(total, 0) as balance0_p,\n balance1 / nullif(total, 0) as balance1_p\nfrom base\n", + "refId": "A", + "sql": { + "columns": [ + { + "parameters": [ + { + "name": "address", + "type": "functionParameter" + } + ], + "type": "function" + }, + { + "parameters": [ + { + "name": "balance0", + "type": "functionParameter" + } + ], + "type": "function" + }, + { + "parameters": [ + { + "name": "balance1", + "type": "functionParameter" + } + ], + "type": "function" + }, + { + "parameters": [ + { + "name": "balance2", + "type": "functionParameter" + } + ], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, + "table": "curve_pool_balance" + } + ], + "title": "factory-v2-89: rETH/wstETH - 0x447ddd4960d9fdbf6af9a790560d0af76795cb08", + "type": "timeseries" + }, + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "cdjqw6cqd1gqob" + }, + "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": [ + { + "matcher": { + "id": "byRegexp", + "options": "/.*_p/" + }, + "properties": [ + { + "id": "custom.axisPlacement", + "value": "right" + }, + { + "id": "custom.stacking", + "value": { + "group": "A", + "mode": "percent" + } + }, + { + "id": "custom.fillOpacity", + "value": 40 + }, + { + "id": "custom.lineWidth", + "value": 0 + }, + { + "id": "unit", + "value": "percentunit" + } + ] + } + ] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 41 + }, + "id": 17, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "multi", + "sort": "none" + } + }, + "targets": [ + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "cdjqw6cqd1gqob" + }, + "editorMode": "code", + "format": "time_series", + "rawQuery": true, + "rawSql": "WITH base as (\nSELECT \n timestamp as time, \n balance0 / 1e18 as balance0, \n balance1 / 1e18 as balance1, \n balance2 / 1e18 as balance2, \n ((balance0 / 1e18) + (balance1 / 1e18) + (balance2 / 1e18)) as total\nFROM curve_pool_balance\nwhere address = '0x2570f1bd5d2735314fc102eb12fc1afe9e6e7193'\norder by time\n)\n\nselect \n time,\n balance0,\n balance1,\n balance2,\n balance0 / nullif(total, 0) as balance0_p,\n balance1 / nullif(total, 0) as balance1_p,\n balance2 / nullif(total, 0) as balance2_p\nfrom base\n", + "refId": "A", + "sql": { + "columns": [ + { + "parameters": [ + { + "name": "address", + "type": "functionParameter" + } + ], + "type": "function" + }, + { + "parameters": [ + { + "name": "balance0", + "type": "functionParameter" + } + ], + "type": "function" + }, + { + "parameters": [ + { + "name": "balance1", + "type": "functionParameter" + } + ], + "type": "function" + }, + { + "parameters": [ + { + "name": "balance2", + "type": "functionParameter" + } + ], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, + "table": "curve_pool_balance" + } + ], + "title": "factory-tricrypto-14: wstETH/rETH/sfrxETH - 0x2570f1bd5d2735314fc102eb12fc1afe9e6e7193", + "type": "timeseries" + }, + { + "collapsed": false, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 49 + }, + "id": 5, + "panels": [], + "title": "USD Curve Pools", + "type": "row" + }, + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "cdjqw6cqd1gqob" + }, + "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": [ + { + "matcher": { + "id": "byRegexp", + "options": "/.*_p/" + }, + "properties": [ + { + "id": "custom.axisPlacement", + "value": "right" + }, + { + "id": "custom.stacking", + "value": { + "group": "A", + "mode": "percent" + } + }, + { + "id": "custom.fillOpacity", + "value": 40 + }, + { + "id": "custom.lineWidth", + "value": 0 + }, + { + "id": "unit", + "value": "percentunit" + } + ] + } + ] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 50 + }, + "id": 1, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "multi", + "sort": "none" + } + }, + "targets": [ + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "cdjqw6cqd1gqob" + }, + "editorMode": "code", + "format": "time_series", + "rawQuery": true, + "rawSql": "WITH base as (\nSELECT \n timestamp as time, \n balance0 / 1e18 as balance0, \n balance1 / 1e6 as balance1, \n balance2 / 1e6 as balance2, \n ((balance0 / 1e18) + (balance1 / 1e6) + (balance2 / 1e6)) as total\nFROM curve_pool_balance\nwhere address = '0xbebc44782c7db0a1a60cb6fe97d0b483032ff1c7'\norder by time\n)\n\nselect \n time,\n balance0,\n balance1,\n balance2,\n balance0 / nullif(total, 0) as balance0_p,\n balance1 / nullif(total, 0) as balance1_p,\n balance2 / nullif(total, 0) as balance2_p\nfrom base\n", + "refId": "A", + "sql": { + "columns": [ + { + "parameters": [ + { + "name": "address", + "type": "functionParameter" + } + ], + "type": "function" + }, + { + "parameters": [ + { + "name": "balance0", + "type": "functionParameter" + } + ], + "type": "function" + }, + { + "parameters": [ + { + "name": "balance1", + "type": "functionParameter" + } + ], + "type": "function" + }, + { + "parameters": [ + { + "name": "balance2", + "type": "functionParameter" + } + ], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, + "table": "curve_pool_balance" + } + ], + "title": "3pool - 0xbebc44782c7db0a1a60cb6fe97d0b483032ff1c7 (DAI, USDC, USDT)", + "type": "timeseries" + }, + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "cdjqw6cqd1gqob" + }, + "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": [ + { + "matcher": { + "id": "byRegexp", + "options": "/.*_p/" + }, + "properties": [ + { + "id": "custom.axisPlacement", + "value": "right" + }, + { + "id": "custom.stacking", + "value": { + "group": "A", + "mode": "percent" + } + }, + { + "id": "custom.fillOpacity", + "value": 40 + }, + { + "id": "custom.lineWidth", + "value": 0 + }, + { + "id": "unit", + "value": "percentunit" + } + ] + } + ] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 12, + "y": 50 + }, + "id": 2, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "multi", + "sort": "none" + } + }, + "targets": [ + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "cdjqw6cqd1gqob" + }, + "editorMode": "code", + "format": "time_series", + "rawQuery": true, + "rawSql": "WITH base as (\nSELECT \n timestamp as time, \n balance0 / 1e18 as balance0, \n balance1 / 1e18 as balance1, \n ((balance0 / 1e18) + (balance1 / 1e18)) as total\nFROM curve_pool_balance\nwhere address = '0x87650d7bbfc3a9f10587d7778206671719d9910d'\norder by time\n)\n\nselect \n time,\n balance0,\n balance1,\n balance0 / nullif(total, 0) as balance0_p,\n balance1 / nullif(total, 0) as balance1_p\nfrom base\n", + "refId": "A", + "sql": { + "columns": [ + { + "parameters": [ + { + "name": "address", + "type": "functionParameter" + } + ], + "type": "function" + }, + { + "parameters": [ + { + "name": "balance0", + "type": "functionParameter" + } + ], + "type": "function" + }, + { + "parameters": [ + { + "name": "balance1", + "type": "functionParameter" + } + ], + "type": "function" + }, + { + "parameters": [ + { + "name": "balance2", + "type": "functionParameter" + } + ], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, + "table": "curve_pool_balance" + } + ], + "title": "OUSDMetapool - 0x87650d7bbfc3a9f10587d7778206671719d9910d", + "type": "timeseries" + }, + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "cdjqw6cqd1gqob" + }, + "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": [ + { + "matcher": { + "id": "byRegexp", + "options": "/.*_p/" + }, + "properties": [ + { + "id": "custom.axisPlacement", + "value": "right" + }, + { + "id": "custom.stacking", + "value": { + "group": "A", + "mode": "percent" + } + }, + { + "id": "custom.fillOpacity", + "value": 40 + }, + { + "id": "custom.lineWidth", + "value": 0 + }, + { + "id": "unit", + "value": "percentunit" + } + ] + } + ] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 12, + "y": 58 + }, + "id": 3, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "multi", + "sort": "none" + } + }, + "targets": [ + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "cdjqw6cqd1gqob" + }, + "editorMode": "code", + "format": "time_series", + "rawQuery": true, + "rawSql": "WITH base as (\nSELECT \n timestamp as time, \n balance0 / 1e18 as balance0, \n balance1 / 1e18 as balance1, \n ((balance0 / 1e18) + (balance1 / 1e18)) as total\nFROM curve_pool_balance\nwhere address = '0xed279fdd11ca84beef15af5d39bb4d4bee23f0ca'\norder by time\n)\n\nselect \n time,\n balance0,\n balance1,\n balance0 / nullif(total, 0) as balance0_p,\n balance1 / nullif(total, 0) as balance1_p\nfrom base\n", + "refId": "A", + "sql": { + "columns": [ + { + "parameters": [ + { + "name": "address", + "type": "functionParameter" + } + ], + "type": "function" + }, + { + "parameters": [ + { + "name": "balance0", + "type": "functionParameter" + } + ], + "type": "function" + }, + { + "parameters": [ + { + "name": "balance1", + "type": "functionParameter" + } + ], + "type": "function" + }, + { + "parameters": [ + { + "name": "balance2", + "type": "functionParameter" + } + ], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, + "table": "curve_pool_balance" + } + ], + "title": "LUSDMetapool - 0xed279fdd11ca84beef15af5d39bb4d4bee23f0ca", + "type": "timeseries" + } + ], + "refresh": "", + "schemaVersion": 39, + "tags": [ + "oeth", + "ousd", + "curve" + ], + "templating": { + "list": [] + }, + "time": { + "from": "now-90d", + "to": "now" + }, + "timeRangeUpdatedDuringEditOrView": false, + "timepicker": {}, + "timezone": "", + "title": "Curve Pools", + "uid": "a79db0c4-3bdc-4f7c-9e65-32fa76d6ff30", + "version": 22, + "weekStart": "" +} \ No newline at end of file diff --git a/grafana/exchange-rates.json b/grafana/exchange-rates.json new file mode 100644 index 00000000..57c0be99 --- /dev/null +++ b/grafana/exchange-rates.json @@ -0,0 +1,1045 @@ +{ + "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": 0, + "id": 25, + "links": [], + "liveNow": false, + "panels": [ + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "cdjqw6cqd1gqob" + }, + "gridPos": { + "h": 2, + "w": 24, + "x": 0, + "y": 0 + }, + "id": 11, + "options": { + "code": { + "language": "plaintext", + "showLineNumbers": false, + "showMiniMap": false + }, + "content": "
\n\n Note: Some of the data seen here in Grafana \n and used in alerting uses these rates.\n It is important to understand the rates we use and validate them.\n
", + "mode": "html" + }, + "pluginVersion": "11.1.0-69622", + "type": "text" + }, + { + "collapsed": false, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 2 + }, + "id": 8, + "panels": [], + "title": "ETH", + "type": "row" + }, + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "cdjqw6cqd1gqob" + }, + "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" + } + }, + "decimals": 4, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 3 + }, + "id": 1, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "multi", + "sort": "none" + } + }, + "targets": [ + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "cdjqw6cqd1gqob" + }, + "editorMode": "code", + "format": "time_series", + "rawQuery": true, + "rawSql": "SELECT\n timestamp as time,\n pair,\n rate / case when quote = 'USD' then 1e8 else 1e18 end as rate\nFROM exchange_rate \nWHERE $__timeFilter(timestamp) AND base = 'ETH' and quote = 'USD'\norder by timestamp asc", + "refId": "A", + "sql": { + "columns": [ + { + "parameters": [ + { + "name": "\"timestamp\"", + "type": "functionParameter" + } + ], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, + "table": "exchange_rate" + } + ], + "title": "Rate - ETH_USD", + "type": "timeseries" + }, + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "cdjqw6cqd1gqob" + }, + "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" + } + }, + "decimals": 4, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 12, + "y": 3 + }, + "id": 2, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "multi", + "sort": "none" + } + }, + "targets": [ + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "cdjqw6cqd1gqob" + }, + "editorMode": "code", + "format": "time_series", + "rawQuery": true, + "rawSql": "SELECT\n timestamp as time,\n pair,\n rate / case when quote = 'USD' then 1e8 else 1e18 end as rate\nFROM exchange_rate \nWHERE $__timeFilter(timestamp) AND base = 'ETH' and quote = 'sfrxETH'\norder by timestamp asc", + "refId": "A", + "sql": { + "columns": [ + { + "parameters": [ + { + "name": "\"timestamp\"", + "type": "functionParameter" + } + ], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, + "table": "exchange_rate" + } + ], + "title": "Rate - ETH_sfrxETH", + "type": "timeseries" + }, + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "cdjqw6cqd1gqob" + }, + "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" + } + }, + "decimals": 4, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 11 + }, + "id": 4, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "multi", + "sort": "none" + } + }, + "targets": [ + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "cdjqw6cqd1gqob" + }, + "editorMode": "code", + "format": "time_series", + "rawQuery": true, + "rawSql": "SELECT\n timestamp as time,\n pair,\n rate / case when quote = 'USD' then 1e8 else 1e18 end as rate\nFROM exchange_rate \nWHERE $__timeFilter(timestamp) AND base = 'ETH' and quote = 'frxETH'\norder by timestamp asc", + "refId": "A", + "sql": { + "columns": [ + { + "parameters": [ + { + "name": "\"timestamp\"", + "type": "functionParameter" + } + ], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, + "table": "exchange_rate" + } + ], + "title": "Rate - ETH_frxETH", + "type": "timeseries" + }, + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "cdjqw6cqd1gqob" + }, + "description": "This rate is derived from the rETH balancer pool.\nhttps://app.balancer.fi/#/ethereum/pool/0x1e19cf2d73a72ef1332c882f20534b6519be0276000200000000000000000112", + "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" + } + }, + "decimals": 4, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 12, + "y": 11 + }, + "id": 3, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "multi", + "sort": "none" + } + }, + "targets": [ + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "cdjqw6cqd1gqob" + }, + "editorMode": "code", + "format": "time_series", + "rawQuery": true, + "rawSql": "SELECT\n timestamp as time,\n pair,\n rate / case when quote = 'USD' then 1e8 else 1e18 end as rate\nFROM exchange_rate \nWHERE $__timeFilter(timestamp) AND base = 'ETH' and quote = 'rETH'\norder by timestamp asc", + "refId": "A", + "sql": { + "columns": [ + { + "parameters": [ + { + "name": "\"timestamp\"", + "type": "functionParameter" + } + ], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, + "table": "exchange_rate" + } + ], + "title": "Rate - ETH_rETH", + "type": "timeseries" + }, + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "cdjqw6cqd1gqob" + }, + "description": "We currently assume 1:1 between ETH and WETH.", + "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" + } + }, + "decimals": 4, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 19 + }, + "id": 5, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "multi", + "sort": "none" + } + }, + "targets": [ + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "cdjqw6cqd1gqob" + }, + "editorMode": "code", + "format": "time_series", + "rawQuery": true, + "rawSql": "SELECT\n timestamp as time,\n pair,\n rate / case when quote = 'USD' then 1e8 else 1e18 end as rate\nFROM exchange_rate \nWHERE $__timeFilter(timestamp) AND base = 'ETH' and quote = 'WETH'\norder by timestamp asc", + "refId": "A", + "sql": { + "columns": [ + { + "parameters": [ + { + "name": "\"timestamp\"", + "type": "functionParameter" + } + ], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, + "table": "exchange_rate" + } + ], + "title": "Rate - ETH_WETH", + "type": "timeseries" + }, + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "cdjqw6cqd1gqob" + }, + "description": "This rate is derived from the stETH balancer pool.", + "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" + } + }, + "decimals": 4, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 12, + "y": 19 + }, + "id": 7, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "multi", + "sort": "none" + } + }, + "targets": [ + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "cdjqw6cqd1gqob" + }, + "editorMode": "code", + "format": "time_series", + "rawQuery": true, + "rawSql": "SELECT\n timestamp as time,\n pair,\n rate / case when quote = 'USD' then 1e8 else 1e18 end as rate\nFROM exchange_rate \nWHERE $__timeFilter(timestamp) AND base = 'ETH' and quote = 'stETH'\norder by timestamp asc", + "refId": "A", + "sql": { + "columns": [ + { + "parameters": [ + { + "name": "\"timestamp\"", + "type": "functionParameter" + } + ], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, + "table": "exchange_rate" + } + ], + "title": "Rate - ETH_stETH", + "type": "timeseries" + }, + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "cdjqw6cqd1gqob" + }, + "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" + } + }, + "decimals": 4, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 16, + "w": 24, + "x": 0, + "y": 27 + }, + "id": 6, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "multi", + "sort": "none" + } + }, + "targets": [ + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "cdjqw6cqd1gqob" + }, + "editorMode": "code", + "format": "time_series", + "rawQuery": true, + "rawSql": "SELECT\n timestamp as time,\n pair,\n rate / case when quote = 'USD' then 1e8 else 1e18 end as rate\nFROM exchange_rate \nWHERE $__timeFilter(timestamp) AND base = 'ETH'\norder by timestamp asc", + "refId": "A", + "sql": { + "columns": [ + { + "parameters": [ + { + "name": "\"timestamp\"", + "type": "functionParameter" + } + ], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, + "table": "exchange_rate" + } + ], + "title": "Rate - All (ETH)", + "type": "timeseries" + }, + { + "collapsed": true, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 43 + }, + "id": 9, + "panels": [ + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "cdjqw6cqd1gqob" + }, + "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": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": true, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "decimals": 4, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 10 + }, + "id": 10, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "multi", + "sort": "none" + } + }, + "targets": [ + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "cdjqw6cqd1gqob" + }, + "editorMode": "code", + "format": "time_series", + "rawQuery": true, + "rawSql": "SELECT\n timestamp as time,\n pair,\n rate\nFROM exchange_rate \nWHERE $__timeFilter(timestamp) AND base = 'USD'\norder by timestamp asc", + "refId": "A", + "sql": { + "columns": [ + { + "parameters": [ + { + "name": "\"timestamp\"", + "type": "functionParameter" + } + ], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, + "table": "exchange_rate" + } + ], + "title": "Rate - All (USD) - Currently None", + "type": "timeseries" + } + ], + "title": "USD (None)", + "type": "row" + } + ], + "refresh": "", + "schemaVersion": 39, + "tags": [ + "oeth", + "ousd", + "rates" + ], + "templating": { + "list": [] + }, + "time": { + "from": "now-1y", + "to": "now" + }, + "timeRangeUpdatedDuringEditOrView": false, + "timepicker": {}, + "timezone": "", + "title": "Exchange Rates", + "uid": "b9b1f9e2-a3b3-45da-9b5a-61edc5c2aee9", + "version": 15, + "weekStart": "" +} \ No newline at end of file diff --git a/grafana/origin-overview.json b/grafana/origin-overview.json new file mode 100644 index 00000000..0acad40a --- /dev/null +++ b/grafana/origin-overview.json @@ -0,0 +1,201 @@ +{ + "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": 0, + "id": 38, + "links": [], + "panels": [ + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "cdjqw6cqd1gqob" + }, + "description": "", + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisGridShow": true, + "axisLabel": "", + "axisPlacement": "left", + "fillOpacity": 30, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineWidth": 1, + "scaleDistribution": { + "type": "linear" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "decimals": 2, + "fieldMinMax": false, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + }, + "unit": "currencyUSD" + }, + "overrides": [ + { + "matcher": { + "id": "byName", + "options": "oeth" + }, + "properties": [ + { + "id": "color", + "value": { + "fixedColor": "blue", + "mode": "fixed" + } + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "ousd" + }, + "properties": [ + { + "id": "color", + "value": { + "mode": "fixed" + } + } + ] + } + ] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 0 + }, + "id": 1, + "options": { + "barRadius": 0, + "barWidth": 0.97, + "fullHighlight": true, + "groupWidth": 0.66, + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "orientation": "vertical", + "showValue": "always", + "stacking": "normal", + "text": {}, + "tooltip": { + "maxHeight": 600, + "mode": "multi", + "sort": "desc" + }, + "xField": "date", + "xTickLabelRotation": 0, + "xTickLabelSpacing": 100 + }, + "targets": [ + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "cdjqw6cqd1gqob" + }, + "editorMode": "code", + "format": "table", + "rawQuery": true, + "rawSql": "SELECT\n oeth_daily_stat.fees_usd / 1e18 as OETH,\n ousd_daily_stat.fees_usd / 1e18 as OUSD,\n oeth_daily_stat.id as date\nFROM\n oeth_daily_stat\nFULL JOIN\n ousd_daily_stat ON oeth_daily_stat.id = ousd_daily_stat.id\n\nWHERE\n $__timeFilter(oeth_daily_stat.id) AND $__timeFilter(ousd_daily_stat.id) \n", + "refId": "A", + "sql": { + "columns": [ + { + "parameters": [ + { + "name": "fees_usd", + "type": "functionParameter" + } + ], + "type": "function" + }, + { + "parameters": [ + { + "name": "\"timestamp\"", + "type": "functionParameter" + } + ], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, + "table": "oeth_daily_stat" + } + ], + "title": "Origin Revenue", + "transparent": true, + "type": "barchart" + } + ], + "refresh": "", + "schemaVersion": 39, + "tags": [], + "templating": { + "list": [] + }, + "time": { + "from": "now-30d", + "to": "now" + }, + "timeRangeUpdatedDuringEditOrView": false, + "timepicker": {}, + "timezone": "browser", + "title": "Origin Overview", + "uid": "ddibja6u9hn28e", + "version": 4, + "weekStart": "" +} \ No newline at end of file From 5c0e0cb65392e556a2c15c2a5528012e53b7e880 Mon Sep 17 00:00:00 2001 From: Chris Jacobs Date: Thu, 25 Apr 2024 10:29:22 -0700 Subject: [PATCH 10/12] grafana update - balancer-pools, maverick-pools, oeth-liquidity, ogn-distribution, ousd-dashboard, ousd-strategy-earnings --- grafana/balancer-pools.json | 1014 +++++++++++++++++++++++++++ grafana/maverick-pools.json | 400 +++++++++++ grafana/oeth-liquidity.json | 537 ++++++++++++++ grafana/ogn-distribution.json | 521 ++++++++++++++ grafana/ousd-dashboard.json | 302 +++++--- grafana/ousd-strategy-earnings.json | 177 +++-- 6 files changed, 2782 insertions(+), 169 deletions(-) create mode 100644 grafana/balancer-pools.json create mode 100644 grafana/maverick-pools.json create mode 100644 grafana/oeth-liquidity.json create mode 100644 grafana/ogn-distribution.json diff --git a/grafana/balancer-pools.json b/grafana/balancer-pools.json new file mode 100644 index 00000000..b3367295 --- /dev/null +++ b/grafana/balancer-pools.json @@ -0,0 +1,1014 @@ +{ + "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": 0, + "id": 21, + "links": [], + "liveNow": false, + "panels": [ + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "cdjqw6cqd1gqob" + }, + "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": 2, + "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": "byRegexp", + "options": "/.*_p/" + }, + "properties": [ + { + "id": "custom.axisPlacement", + "value": "right" + }, + { + "id": "custom.stacking", + "value": { + "group": "A", + "mode": "percent" + } + }, + { + "id": "custom.fillOpacity", + "value": 30 + }, + { + "id": "custom.lineWidth", + "value": 0 + } + ] + }, + { + "matcher": { + "id": "byRegexp", + "options": "/balance0.*/" + }, + "properties": [ + { + "id": "color", + "value": { + "fixedColor": "green", + "mode": "fixed" + } + } + ] + }, + { + "matcher": { + "id": "byRegexp", + "options": "/balance1.*/" + }, + "properties": [ + { + "id": "color", + "value": { + "fixedColor": "blue", + "mode": "fixed" + } + } + ] + }, + { + "matcher": { + "id": "byRegexp", + "options": "/balance2.*/" + }, + "properties": [ + { + "id": "color", + "value": { + "fixedColor": "red", + "mode": "fixed" + } + } + ] + } + ] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 0 + }, + "id": 39, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "cdjqw6cqd1gqob" + }, + "editorMode": "code", + "format": "table", + "rawQuery": true, + "rawSql": "WITH base as (\n SELECT \n timestamp as time, \n address,\n balance0 / 1e18 as balance0, \n balance1 / 1e18 as balance1,\n (balance0 + balance1) / 1e18 as total\n FROM balancer_pool_balance\n)\n\nselect\n time,\n balance0,\n balance1,\n balance0 / nullif(total, 0) as balance0_p,\n balance1 / nullif(total, 0) as balance1_p\nfrom base\nwhere address = '0x1e19cf2d73a72ef1332c882f20534b6519be0276'\nand $__timeFilter(time) \norder by time", + "refId": "A", + "sql": { + "columns": [ + { + "parameters": [ + { + "name": "address", + "type": "functionParameter" + } + ], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, + "table": "balancer_pool_balance" + } + ], + "title": "B-rETH-STABLE - 0x1e19cf2d73a72ef1332c882f20534b6519be0276", + "type": "timeseries" + }, + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "cdjqw6cqd1gqob" + }, + "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": 2, + "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": "byRegexp", + "options": "/.*_p/" + }, + "properties": [ + { + "id": "custom.axisPlacement", + "value": "right" + }, + { + "id": "custom.stacking", + "value": { + "group": "A", + "mode": "percent" + } + }, + { + "id": "custom.fillOpacity", + "value": 30 + }, + { + "id": "custom.lineWidth", + "value": 0 + } + ] + }, + { + "matcher": { + "id": "byRegexp", + "options": "/balance0.*/" + }, + "properties": [ + { + "id": "color", + "value": { + "fixedColor": "green", + "mode": "fixed" + } + } + ] + }, + { + "matcher": { + "id": "byRegexp", + "options": "/balance1.*/" + }, + "properties": [ + { + "id": "color", + "value": { + "fixedColor": "blue", + "mode": "fixed" + } + } + ] + }, + { + "matcher": { + "id": "byRegexp", + "options": "/balance2.*/" + }, + "properties": [ + { + "id": "color", + "value": { + "fixedColor": "red", + "mode": "fixed" + } + } + ] + }, + { + "matcher": { + "id": "byRegexp", + "options": "/balance3.*/" + }, + "properties": [ + { + "id": "color", + "value": { + "fixedColor": "orange", + "mode": "fixed" + } + } + ] + } + ] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 12, + "y": 0 + }, + "id": 42, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "multi", + "sort": "none" + } + }, + "targets": [ + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "cdjqw6cqd1gqob" + }, + "editorMode": "code", + "format": "table", + "rawQuery": true, + "rawSql": "WITH base as (\n SELECT \n timestamp as time, \n address,\n balance0 / 1e18 as balance0, \n balance1 / 1e18 as balance1,\n balance2 / 1e18 as balance2,\n balance3 / 1e18 as balance3,\n (balance1 + balance2 + balance3) / 1e18 as total\n FROM balancer_pool_balance\n)\n\nselect\n time,\n balance1,\n balance2,\n balance3,\n balance1 / nullif(total, 0) as balance1_p,\n balance2 / nullif(total, 0) as balance2_p,\n balance3 / nullif(total, 0) as balance3_p\nfrom base\nwhere address = '0x42ed016f826165c2e5976fe5bc3df540c5ad0af7'\nand $__timeFilter(time) \norder by time", + "refId": "A", + "sql": { + "columns": [ + { + "parameters": [ + { + "name": "address", + "type": "functionParameter" + } + ], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, + "table": "balancer_pool_balance" + } + ], + "title": "wstETH-rETH-sfrxETH-BPT - 0x42ed016f826165c2e5976fe5bc3df540c5ad0af7", + "type": "timeseries" + }, + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "cdjqw6cqd1gqob" + }, + "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": 2, + "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": "byRegexp", + "options": "/.*_p/" + }, + "properties": [ + { + "id": "custom.axisPlacement", + "value": "right" + }, + { + "id": "custom.stacking", + "value": { + "group": "A", + "mode": "percent" + } + }, + { + "id": "custom.fillOpacity", + "value": 30 + }, + { + "id": "custom.lineWidth", + "value": 0 + } + ] + }, + { + "matcher": { + "id": "byRegexp", + "options": "/balance0.*/" + }, + "properties": [ + { + "id": "color", + "value": { + "fixedColor": "green", + "mode": "fixed" + } + } + ] + }, + { + "matcher": { + "id": "byRegexp", + "options": "/balance1.*/" + }, + "properties": [ + { + "id": "color", + "value": { + "fixedColor": "blue", + "mode": "fixed" + } + } + ] + }, + { + "matcher": { + "id": "byRegexp", + "options": "/balance2.*/" + }, + "properties": [ + { + "id": "color", + "value": { + "fixedColor": "red", + "mode": "fixed" + } + } + ] + } + ] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 8 + }, + "id": 41, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "multi", + "sort": "none" + } + }, + "targets": [ + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "cdjqw6cqd1gqob" + }, + "editorMode": "code", + "format": "table", + "rawQuery": true, + "rawSql": "WITH base as (\n SELECT \n timestamp as time, \n address,\n balance0 / 1e18 as balance0, \n balance1 / 1e18 as balance1,\n balance2 / 1e18 as balance2,\n (balance0 + balance2) / 1e18 as total\n FROM balancer_pool_balance\n)\n\nselect\n time,\n balance0,\n -- balance1,\n balance2,\n balance0 / nullif(total, 0) as balance0_p,\n -- balance1 / nullif(total, 0) as balance1_p,\n balance2 / nullif(total, 0) as balance2_p\nfrom base\nwhere address = '0x93d199263632a4ef4bb438f1feb99e57b4b5f0bd'\nand $__timeFilter(time) \norder by time", + "refId": "A", + "sql": { + "columns": [ + { + "parameters": [ + { + "name": "address", + "type": "functionParameter" + } + ], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, + "table": "balancer_pool_balance" + } + ], + "title": "wstETH-WETH-BPT - 0x93d199263632a4ef4bb438f1feb99e57b4b5f0bd", + "type": "timeseries" + }, + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "cdjqw6cqd1gqob" + }, + "description": "We're using exchange rates from Chainlink to convert the value of BAL into ETH. Values are shown in ETH.", + "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": 2, + "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": "byRegexp", + "options": "/.*_p/" + }, + "properties": [ + { + "id": "custom.axisPlacement", + "value": "right" + }, + { + "id": "custom.stacking", + "value": { + "group": "A", + "mode": "percent" + } + }, + { + "id": "custom.fillOpacity", + "value": 30 + }, + { + "id": "custom.lineWidth", + "value": 0 + } + ] + }, + { + "matcher": { + "id": "byRegexp", + "options": "/balance0.*/" + }, + "properties": [ + { + "id": "color", + "value": { + "fixedColor": "green", + "mode": "fixed" + } + } + ] + }, + { + "matcher": { + "id": "byRegexp", + "options": "/balance1.*/" + }, + "properties": [ + { + "id": "color", + "value": { + "fixedColor": "blue", + "mode": "fixed" + } + } + ] + }, + { + "matcher": { + "id": "byRegexp", + "options": "/balance2.*/" + }, + "properties": [ + { + "id": "color", + "value": { + "fixedColor": "red", + "mode": "fixed" + } + } + ] + } + ] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 12, + "y": 8 + }, + "id": 40, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "multi", + "sort": "none" + } + }, + "targets": [ + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "cdjqw6cqd1gqob" + }, + "editorMode": "code", + "format": "table", + "rawQuery": true, + "rawSql": "WITH base as (\n SELECT \n balancer_pool_balance.timestamp as time, \n balancer_pool_balance.address,\n balance0 / 1e18 * exchange_rate.rate / 1e18 as balance0, \n balance1 / 1e18 as balance1,\n (balance0 / 1e18 * exchange_rate.rate / 1e18 + balance1 / 1e18) as total\n FROM balancer_pool_balance\n INNER JOIN balancer_pool_rate\n ON balancer_pool_rate.timestamp = balancer_pool_balance.timestamp and balancer_pool_rate.address = balancer_pool_balance.address\n INNER JOIN exchange_rate\n ON exchange_rate.timestamp = balancer_pool_balance.timestamp and exchange_rate.pair = 'BAL_ETH'\n)\n\nselect\n time,\n balance0,\n balance1,\n balance0 / nullif(total, 0) as balance0_p,\n balance1 / nullif(total, 0) as balance1_p\nfrom base\nwhere address = '0x5c6ee304399dbdb9c8ef030ab642b10820db8f56'\nand $__timeFilter(time) \norder by time", + "refId": "A", + "sql": { + "columns": [ + { + "parameters": [ + { + "name": "address", + "type": "functionParameter" + } + ], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, + "table": "balancer_pool_balance" + } + ], + "title": "B-80BAL-20WETH - 0x5c6ee304399dbdb9c8ef030ab642b10820db8f56", + "type": "timeseries" + }, + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "cdjqw6cqd1gqob" + }, + "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": 2, + "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": [ + { + "matcher": { + "id": "byRegexp", + "options": "/.*_p/" + }, + "properties": [ + { + "id": "custom.axisPlacement", + "value": "right" + }, + { + "id": "custom.stacking", + "value": { + "group": "A", + "mode": "percent" + } + }, + { + "id": "custom.fillOpacity", + "value": 30 + }, + { + "id": "custom.lineWidth", + "value": 0 + } + ] + }, + { + "matcher": { + "id": "byRegexp", + "options": "/balance0.*/" + }, + "properties": [ + { + "id": "color", + "value": { + "fixedColor": "green", + "mode": "fixed" + } + } + ] + }, + { + "matcher": { + "id": "byRegexp", + "options": "/balance1.*/" + }, + "properties": [ + { + "id": "color", + "value": { + "fixedColor": "blue", + "mode": "fixed" + } + } + ] + }, + { + "matcher": { + "id": "byRegexp", + "options": "/balance2.*/" + }, + "properties": [ + { + "id": "color", + "value": { + "fixedColor": "red", + "mode": "fixed" + } + } + ] + } + ] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 16 + }, + "id": 43, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "multi", + "sort": "none" + } + }, + "targets": [ + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "cdjqw6cqd1gqob" + }, + "editorMode": "code", + "format": "table", + "rawQuery": true, + "rawSql": "WITH base as (\n SELECT \n timestamp as time, \n address,\n balance0 / 1e18 as balance0, \n balance1 / 1e18 as balance1,\n (balance0 + balance1) / 1e18 as total\n FROM balancer_pool_balance\n)\n\nselect\n time,\n balance0,\n balance1,\n balance0 / nullif(total, 0) as balance0_p,\n balance1 / nullif(total, 0) as balance1_p\nfrom base\nwhere address = '0xf01b0684c98cd7ada480bfdf6e43876422fa1fc1'\nand $__timeFilter(time) \norder by time", + "refId": "A", + "sql": { + "columns": [ + { + "parameters": [ + { + "name": "address", + "type": "functionParameter" + } + ], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, + "table": "balancer_pool_balance" + } + ], + "title": "Gyroscope ECLP wstETH/wETH - 0xf01b0684c98cd7ada480bfdf6e43876422fa1fc1", + "type": "timeseries" + } + ], + "refresh": "", + "schemaVersion": 39, + "tags": [ + "oeth", + "balancer" + ], + "templating": { + "list": [] + }, + "time": { + "from": "now-6h", + "to": "now" + }, + "timeRangeUpdatedDuringEditOrView": false, + "timepicker": {}, + "timezone": "", + "title": "Balancer Pools", + "uid": "c9a4fb60-6982-4d06-a9a6-c5d4d43bcc84", + "version": 16, + "weekStart": "" +} \ No newline at end of file diff --git a/grafana/maverick-pools.json b/grafana/maverick-pools.json new file mode 100644 index 00000000..6fcf281f --- /dev/null +++ b/grafana/maverick-pools.json @@ -0,0 +1,400 @@ +{ + "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": 0, + "id": 30, + "links": [], + "liveNow": false, + "panels": [ + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "cdjqw6cqd1gqob" + }, + "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", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [ + { + "matcher": { + "id": "byRegexp", + "options": "/.*_p/" + }, + "properties": [ + { + "id": "custom.axisPlacement", + "value": "right" + }, + { + "id": "custom.stacking", + "value": { + "group": "A", + "mode": "percent" + } + }, + { + "id": "custom.fillOpacity", + "value": 40 + }, + { + "id": "custom.lineWidth", + "value": 0 + }, + { + "id": "unit", + "value": "percentunit" + } + ] + } + ] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 0 + }, + "id": 1, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "multi", + "sort": "none" + } + }, + "targets": [ + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "cdjqw6cqd1gqob" + }, + "editorMode": "code", + "format": "time_series", + "rawQuery": true, + "rawSql": "WITH base as (\nSELECT \n timestamp as time, \n bin_balance_a / 1e18 as bin_balance_a, \n bin_balance_b / 1e18 as bin_balance_b, \n ((bin_balance_a / 1e18) + (bin_balance_b / 1e18)) as total\nFROM maverick_pool_balance \nwhere address = '0x0eb1c92f9f5ec9d817968afddb4b46c564cdedbe'\norder by time\n)\n\nselect \n time,\n bin_balance_a,\n bin_balance_b,\n bin_balance_a / nullif(total, 0) as bin_balance_a_p,\n bin_balance_b / nullif(total, 0) as bin_balance_b_p\nfrom base\n", + "refId": "A", + "sql": { + "columns": [ + { + "parameters": [ + { + "name": "address", + "type": "functionParameter" + } + ], + "type": "function" + }, + { + "parameters": [ + { + "name": "balance0", + "type": "functionParameter" + } + ], + "type": "function" + }, + { + "parameters": [ + { + "name": "balance1", + "type": "functionParameter" + } + ], + "type": "function" + }, + { + "parameters": [ + { + "name": "balance2", + "type": "functionParameter" + } + ], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, + "table": "curve_pool_balance" + } + ], + "title": "wstETH-ETH - 0x0eb1c92f9f5ec9d817968afddb4b46c564cdedbe", + "type": "timeseries" + }, + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "cdjqw6cqd1gqob" + }, + "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", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [ + { + "matcher": { + "id": "byRegexp", + "options": "/.*_p/" + }, + "properties": [ + { + "id": "custom.axisPlacement", + "value": "right" + }, + { + "id": "custom.stacking", + "value": { + "group": "A", + "mode": "percent" + } + }, + { + "id": "custom.fillOpacity", + "value": 40 + }, + { + "id": "custom.lineWidth", + "value": 0 + }, + { + "id": "unit", + "value": "percentunit" + } + ] + } + ] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 12, + "y": 0 + }, + "id": 2, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "multi", + "sort": "none" + } + }, + "targets": [ + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "cdjqw6cqd1gqob" + }, + "editorMode": "code", + "format": "time_series", + "rawQuery": true, + "rawSql": "WITH base as (\nSELECT \n timestamp as time, \n bin_balance_a / 1e18 as bin_balance_a, \n bin_balance_b / 1e18 as bin_balance_b, \n ((bin_balance_a / 1e18) + (bin_balance_b / 1e18)) as total\nFROM maverick_pool_balance \nwhere address = '0xeb061a4e1ad3f1983655281cb8019ebbf8b30b29'\norder by time\n)\n\nselect \n time,\n bin_balance_a,\n bin_balance_b,\n bin_balance_a / nullif(total, 0) as bin_balance_a_p,\n bin_balance_b / nullif(total, 0) as bin_balance_b_p\nfrom base\n", + "refId": "A", + "sql": { + "columns": [ + { + "parameters": [ + { + "name": "address", + "type": "functionParameter" + } + ], + "type": "function" + }, + { + "parameters": [ + { + "name": "balance0", + "type": "functionParameter" + } + ], + "type": "function" + }, + { + "parameters": [ + { + "name": "balance1", + "type": "functionParameter" + } + ], + "type": "function" + }, + { + "parameters": [ + { + "name": "balance2", + "type": "functionParameter" + } + ], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, + "table": "curve_pool_balance" + } + ], + "title": "rETH-ETH - 0xeb061a4e1ad3f1983655281cb8019ebbf8b30b29", + "type": "timeseries" + } + ], + "refresh": "", + "schemaVersion": 39, + "tags": [ + "maverick", + "oeth" + ], + "templating": { + "list": [] + }, + "time": { + "from": "now-6h", + "to": "now" + }, + "timeRangeUpdatedDuringEditOrView": false, + "timepicker": {}, + "timezone": "", + "title": "Maverick Pools", + "uid": "d4fc9b05-54b6-45b8-93b2-aaf9e7706da7", + "version": 5, + "weekStart": "" +} \ No newline at end of file diff --git a/grafana/oeth-liquidity.json b/grafana/oeth-liquidity.json new file mode 100644 index 00000000..6c85f0ee --- /dev/null +++ b/grafana/oeth-liquidity.json @@ -0,0 +1,537 @@ +{ + "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": 0, + "id": 32, + "links": [], + "liveNow": false, + "panels": [ + { + "collapsed": false, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 0 + }, + "id": 6, + "panels": [], + "title": "LST Details", + "type": "row" + }, + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "cdjqw6cqd1gqob" + }, + "description": "For details on what this is comprised of, see below.", + "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": "desc" + } + }, + "pluginVersion": "10.3.0-64399", + "targets": [ + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "cdjqw6cqd1gqob" + }, + "editorMode": "code", + "format": "time_series", + "rawQuery": true, + "rawSql": "with balances as (\n select\n pb.timestamp as time,\n pb.address,\n p.name,\n p.token0 as token,\n pb.balance0 / 1e18 as balance\n from curve_pool p\n inner join curve_pool_balance pb\n on p.address = pb.address\n union all\n select\n pb.timestamp as time,\n pb.address,\n p.name,\n p.token1 as token,\n pb.balance1 / 1e18 as balance\n from curve_pool p\n inner join curve_pool_balance pb\n on p.address = pb.address\n union all\n select\n pb.timestamp as time,\n pb.address,\n p.name,\n p.token2 as token,\n pb.balance2 / 1e18 as balance\n from curve_pool p\n inner join curve_pool_balance pb\n on p.address = pb.address\n union all\n select\n pb.timestamp as time,\n pb.address,\n p.name,\n p.token0 as token,\n pb.balance0 / 1e18 as balance\n from balancer_pool p\n inner join balancer_pool_balance pb\n on p.address = pb.address\n union all\n select\n pb.timestamp as time,\n pb.address,\n p.name,\n p.token1 as token,\n pb.balance1 / 1e18 as balance\n from balancer_pool p\n inner join balancer_pool_balance pb\n on p.address = pb.address\n union all\n select\n pb.timestamp as time,\n pb.address,\n p.name,\n p.token2 as token,\n pb.balance2 / 1e18 as balance\n from balancer_pool p\n inner join balancer_pool_balance pb\n on p.address = pb.address\n union all\n select\n pb.timestamp as time,\n pb.address,\n p.name,\n p.token3 as token,\n pb.balance3 / 1e18 as balance\n from balancer_pool p\n inner join balancer_pool_balance pb\n on p.address = pb.address\n union all\n select\n pb.timestamp as time,\n pb.address,\n p.name,\n p.token_a as token,\n pb.bin_balance_a / 1e18 as balance\n from maverick_pool p\n inner join maverick_pool_balance pb\n on p.address = pb.address\n union all\n select\n pb.timestamp as time,\n pb.address,\n p.name,\n p.token_b as token,\n pb.bin_balance_b / 1e18 as balance\n from maverick_pool p\n inner join maverick_pool_balance pb\n on p.address = pb.address\n),\n pathways as (\n select\n b_entry.time,\n b_entry.address,\n b_entry.name,\n b_entry.token as entry_token,\n b_entry.balance as entry_balance,\n b_exit.token as exit_token,\n b_exit.balance as exit_balance\n from balances b_entry\n inner join balances b_exit\n on b_entry.time = b_exit.time and b_entry.address = b_exit.address and b_entry.token != b_exit.token\n),\n result as (\n select\n date(p.time) as time,\n ls.type,\n ls.address,\n p.name,\n p.entry_token,\n entry_a.symbol as entry_symbol,\n p.entry_balance,\n p.exit_token,\n exit_a.symbol as exit_symbol,\n p.exit_balance,\n ROW_NUMBER()\n OVER (PARTITION BY ls.type, ls.address, p.name, entry_a.symbol, exit_a.symbol, DATE(p.time) ORDER BY p.time DESC) as rn\n from liquidity_source ls\n inner join pathways p\n on (ls.token = p.entry_token or ls.token = p.exit_token) and p.address = ls.address\n inner join oeth_asset entry_a\n on entry_a.address = p.entry_token\n inner join oeth_asset exit_a\n on exit_a.address = p.exit_token\n)\n\nselect\n time,\n case\n when exit_symbol = 'WETH' then 'ETH/WETH'\n when exit_symbol = 'ETH' then 'ETH/WETH'\n else exit_symbol end as symbol,\n sum(exit_balance) as balance\nfrom result\nwhere rn = 1 and $__timeFilter(time) \ngroup by time, symbol\norder by time", + "refId": "A", + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + } + } + ], + "title": "LST Liquidity", + "type": "timeseries" + }, + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "cdjqw6cqd1gqob" + }, + "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", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 9, + "w": 12, + "x": 12, + "y": 1 + }, + "id": 3, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "multi", + "sort": "desc" + } + }, + "pluginVersion": "10.3.0-64399", + "targets": [ + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "cdjqw6cqd1gqob" + }, + "editorMode": "code", + "format": "time_series", + "rawQuery": true, + "rawSql": "with balances as (\n select\n pb.timestamp as time,\n pb.address,\n p.name,\n p.token0 as token,\n pb.balance0 / 1e18 as balance\n from curve_pool p\n inner join curve_pool_balance pb\n on p.address = pb.address\n union all\n select\n pb.timestamp as time,\n pb.address,\n p.name,\n p.token1 as token,\n pb.balance1 / 1e18 as balance\n from curve_pool p\n inner join curve_pool_balance pb\n on p.address = pb.address\n union all\n select\n pb.timestamp as time,\n pb.address,\n p.name,\n p.token2 as token,\n pb.balance2 / 1e18 as balance\n from curve_pool p\n inner join curve_pool_balance pb\n on p.address = pb.address\n union all\n select\n pb.timestamp as time,\n pb.address,\n p.name,\n p.token0 as token,\n pb.balance0 / 1e18 as balance\n from balancer_pool p\n inner join balancer_pool_balance pb\n on p.address = pb.address\n union all\n select\n pb.timestamp as time,\n pb.address,\n p.name,\n p.token1 as token,\n pb.balance1 / 1e18 as balance\n from balancer_pool p\n inner join balancer_pool_balance pb\n on p.address = pb.address\n union all\n select\n pb.timestamp as time,\n pb.address,\n p.name,\n p.token2 as token,\n pb.balance2 / 1e18 as balance\n from balancer_pool p\n inner join balancer_pool_balance pb\n on p.address = pb.address\n union all\n select\n pb.timestamp as time,\n pb.address,\n p.name,\n p.token3 as token,\n pb.balance3 / 1e18 as balance\n from balancer_pool p\n inner join balancer_pool_balance pb\n on p.address = pb.address\n union all\n select\n pb.timestamp as time,\n pb.address,\n p.name,\n p.token_a as token,\n pb.bin_balance_a / 1e18 as balance\n from maverick_pool p\n inner join maverick_pool_balance pb\n on p.address = pb.address\n union all\n select\n pb.timestamp as time,\n pb.address,\n p.name,\n p.token_b as token,\n pb.bin_balance_b / 1e18 as balance\n from maverick_pool p\n inner join maverick_pool_balance pb\n on p.address = pb.address\n),\n pathways as (\n select\n b_entry.time,\n b_entry.address,\n b_entry.name,\n b_entry.token as entry_token,\n b_entry.balance as entry_balance,\n b_exit.token as exit_token,\n b_exit.balance as exit_balance\n from balances b_entry\n inner join balances b_exit\n on b_entry.time = b_exit.time and b_entry.address = b_exit.address and b_entry.token != b_exit.token\n),\n result as (\n select\n date(p.time) as time,\n ls.type,\n ls.address,\n p.name,\n p.entry_token,\n entry_a.symbol as entry_symbol,\n p.entry_balance,\n p.exit_token,\n exit_a.symbol as exit_symbol,\n p.exit_balance,\n ROW_NUMBER()\n OVER (PARTITION BY ls.type, ls.address, p.name, entry_a.symbol, exit_a.symbol, DATE(p.time) ORDER BY p.time DESC) as rn\n from liquidity_source ls\n inner join pathways p\n on (ls.token = p.entry_token or ls.token = p.exit_token) and p.address = ls.address\n inner join oeth_asset entry_a\n on entry_a.address = p.entry_token\n inner join oeth_asset exit_a\n on exit_a.address = p.exit_token\n),\n totals as (\n select\n date(time) as time,\n sum(exit_balance) as total\n from result\n where rn = 1\n group by date(time)\n)\n\n\nselect\n result.time,\n case\n when exit_symbol = 'WETH' then 'ETH/WETH'\n when exit_symbol = 'ETH' then 'ETH/WETH'\n else exit_symbol end as symbol,\n sum(exit_balance) / total as \"%\"\nfrom result\ninner join totals\n on result.time = totals.time\nwhere rn = 1 and $__timeFilter(result.time) \ngroup by result.time,\n symbol,\n totals.total\norder by time", + "refId": "A", + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + } + } + ], + "title": "LST Liquidity %", + "type": "timeseries" + }, + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "cdjqw6cqd1gqob" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "custom": { + "align": "center", + "cellOptions": { + "type": "auto" + }, + "inspect": false + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [ + { + "matcher": { + "id": "byName", + "options": "address" + }, + "properties": [ + { + "id": "custom.width", + "value": 300 + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "name" + }, + "properties": [ + { + "id": "custom.width", + "value": 300 + } + ] + }, + { + "matcher": { + "id": "byRegexp", + "options": "/.*_balance/" + }, + "properties": [ + { + "id": "custom.align", + "value": "right" + } + ] + } + ] + }, + "gridPos": { + "h": 16, + "w": 18, + "x": 0, + "y": 10 + }, + "id": 1, + "options": { + "cellHeight": "sm", + "footer": { + "countRows": false, + "fields": "", + "reducer": [ + "sum" + ], + "show": false + }, + "showHeader": true, + "sortBy": [] + }, + "pluginVersion": "11.1.0-69622", + "targets": [ + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "cdjqw6cqd1gqob" + }, + "editorMode": "code", + "format": "table", + "rawQuery": true, + "rawSql": "with balances as (\n select\n pb.timestamp as time,\n pb.address,\n p.name,\n p.token0 as token,\n pb.balance0 / 1e18 as balance\n from curve_pool p\n inner join curve_pool_balance pb\n on p.address = pb.address\n union all\n select\n pb.timestamp as time,\n pb.address,\n p.name,\n p.token1 as token,\n pb.balance1 / 1e18 as balance\n from curve_pool p\n inner join curve_pool_balance pb\n on p.address = pb.address\n union all\n select\n pb.timestamp as time,\n pb.address,\n p.name,\n p.token2 as token,\n pb.balance2 / 1e18 as balance\n from curve_pool p\n inner join curve_pool_balance pb\n on p.address = pb.address\n union all\n select\n pb.timestamp as time,\n pb.address,\n p.name,\n p.token0 as token,\n pb.balance0 / 1e18 as balance\n from balancer_pool p\n inner join balancer_pool_balance pb\n on p.address = pb.address\n union all\n select\n pb.timestamp as time,\n pb.address,\n p.name,\n p.token1 as token,\n pb.balance1 / 1e18 as balance\n from balancer_pool p\n inner join balancer_pool_balance pb\n on p.address = pb.address\n union all\n select\n pb.timestamp as time,\n pb.address,\n p.name,\n p.token2 as token,\n pb.balance2 / 1e18 as balance\n from balancer_pool p\n inner join balancer_pool_balance pb\n on p.address = pb.address\n union all\n select\n pb.timestamp as time,\n pb.address,\n p.name,\n p.token3 as token,\n pb.balance3 / 1e18 as balance\n from balancer_pool p\n inner join balancer_pool_balance pb\n on p.address = pb.address\n union all\n select\n pb.timestamp as time,\n pb.address,\n p.name,\n p.token_a as token,\n pb.bin_balance_a / 1e18 as balance\n from maverick_pool p\n inner join maverick_pool_balance pb\n on p.address = pb.address\n union all\n select\n pb.timestamp as time,\n pb.address,\n p.name,\n p.token_b as token,\n pb.bin_balance_b / 1e18 as balance\n from maverick_pool p\n inner join maverick_pool_balance pb\n on p.address = pb.address\n),\n pathways as (\n select\n b_entry.time,\n b_entry.address,\n b_entry.name,\n b_entry.token as left_token,\n b_entry.balance as left_balance,\n b_exit.token as right_token,\n b_exit.balance as right_balance\n from balances b_entry\n inner join balances b_exit\n on b_entry.time = b_exit.time and b_entry.address = b_exit.address and b_entry.token != b_exit.token\n),\n result as (\n select\n p.time,\n ls.type,\n ls.address,\n p.name,\n p.left_token,\n left_a.symbol as left_symbol,\n p.left_balance,\n p.right_token,\n right_a.symbol as right_symbol,\n p.right_balance,\n ROW_NUMBER()\n OVER (PARTITION BY ls.type, ls.address, p.name, left_a.symbol, right_a.symbol, DATE(p.time) ORDER BY p.time DESC) as rn\n from liquidity_source ls\n inner join pathways p\n on (ls.token = p.left_token or ls.token = p.right_token) and p.address = ls.address\n inner join oeth_asset left_a\n on left_a.address = p.left_token\n inner join oeth_asset right_a\n on right_a.address = p.right_token\n)\n\nselect\n left_symbol,\n left_balance,\n right_symbol,\n right_balance,\n type,\n name,\n address\nfrom result\nwhere rn = 1\n and date(time) = current_date\n and left_symbol not in ('WETH', 'ETH', 'OETH')\norder by left_symbol, right_symbol, address", + "refId": "A", + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + } + } + ], + "title": "Liquidity By Pool", + "type": "table" + }, + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "cdjqw6cqd1gqob" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "custom": { + "align": "auto", + "cellOptions": { + "type": "auto" + }, + "inspect": false + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 16, + "w": 6, + "x": 18, + "y": 10 + }, + "id": 4, + "options": { + "cellHeight": "sm", + "footer": { + "countRows": false, + "fields": "", + "reducer": [ + "sum" + ], + "show": false + }, + "showHeader": true + }, + "pluginVersion": "11.1.0-69622", + "targets": [ + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "cdjqw6cqd1gqob" + }, + "editorMode": "code", + "format": "table", + "rawQuery": true, + "rawSql": "select\n ls.address,\n type,\n symbol\nfrom\n liquidity_source ls\n inner join oeth_asset oa on ls.token = oa.address\norder by ls.type, ls.address, symbol", + "refId": "A", + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + } + } + ], + "title": "Liquidity Sources", + "type": "table" + }, + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "ac0aaf4a-7c06-46fe-a735-3cd43be451a8" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 2, + "w": 24, + "x": 0, + "y": 26 + }, + "id": 5, + "options": { + "infinitePan": false, + "inlineEditing": true, + "panZoom": false, + "showAdvancedTypes": true + }, + "pluginVersion": "11.1.0-69622", + "type": "canvas" + } + ], + "refresh": "", + "schemaVersion": 39, + "tags": [], + "templating": { + "list": [] + }, + "time": { + "from": "now-6h", + "to": "now" + }, + "timeRangeUpdatedDuringEditOrView": false, + "timepicker": {}, + "timezone": "", + "title": "OETH Liquidity", + "uid": "e45f1fdb-43f2-43b5-b6ce-2a41fda42796", + "version": 14, + "weekStart": "" +} \ No newline at end of file diff --git a/grafana/ogn-distribution.json b/grafana/ogn-distribution.json new file mode 100644 index 00000000..6adf6308 --- /dev/null +++ b/grafana/ogn-distribution.json @@ -0,0 +1,521 @@ +{ + "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": 0, + "id": 28, + "links": [], + "liveNow": false, + "panels": [ + { + "collapsed": false, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 0 + }, + "id": 3, + "panels": [], + "title": "Team Wallet", + "type": "row" + }, + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "cdjqw6cqd1gqob" + }, + "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": "line" + } + }, + "fieldMinMax": false, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 500000 + } + ] + }, + "unit": "none" + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 1 + }, + "id": 1, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "cdjqw6cqd1gqob" + }, + "editorMode": "code", + "format": "time_series", + "rawQuery": true, + "rawSql": "select\n timestamp as time,\n case address\n when '0x8207c1ffc5b6804f6024322ccf34f29c3541ae26' then 'OGN'\n when '0x9c354503c38481a7a7a51629142963f98ecc12d0' then 'OGV'\n else address end,\n balance / 1e18 as balance\nfrom erc20_balance\nwhere account = '0x2eae0cae2323167abf78462e0c0686865c67a655'\n and address in ('0x8207c1ffc5b6804f6024322ccf34f29c3541ae26')\n and $__timeFilter(timestamp) \norder by time", + "refId": "A", + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + } + } + ], + "title": "OGN Balance (Team)", + "type": "timeseries" + }, + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "cdjqw6cqd1gqob" + }, + "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": "line" + } + }, + "fieldMinMax": false, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 5000000 + } + ] + }, + "unit": "none" + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 12, + "y": 1 + }, + "id": 2, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "cdjqw6cqd1gqob" + }, + "editorMode": "code", + "format": "time_series", + "rawQuery": true, + "rawSql": "select\n timestamp as time,\n case address\n when '0x8207c1ffc5b6804f6024322ccf34f29c3541ae26' then 'OGN'\n when '0x9c354503c38481a7a7a51629142963f98ecc12d0' then 'OGV'\n else address end,\n balance / 1e18 as balance\nfrom erc20_balance\nwhere account = '0x2eae0cae2323167abf78462e0c0686865c67a655'\n and address in ('0x9c354503c38481a7a7a51629142963f98ecc12d0')\n and $__timeFilter(timestamp) \norder by time", + "refId": "A", + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + } + } + ], + "title": "OGV Balance (Team)", + "type": "timeseries" + }, + { + "collapsed": false, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 9 + }, + "id": 4, + "panels": [], + "title": "Investor Wallet", + "type": "row" + }, + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "cdjqw6cqd1gqob" + }, + "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": "line" + } + }, + "fieldMinMax": false, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 500000 + } + ] + }, + "unit": "none" + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 10 + }, + "id": 5, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "cdjqw6cqd1gqob" + }, + "editorMode": "code", + "format": "time_series", + "rawQuery": true, + "rawSql": "select\n timestamp as time,\n case address\n when '0x8207c1ffc5b6804f6024322ccf34f29c3541ae26' then 'OGN'\n when '0x9c354503c38481a7a7a51629142963f98ecc12d0' then 'OGV'\n else address end,\n balance / 1e18 as balance\nfrom erc20_balance\nwhere account = '0xfe730b3cf80ca7b31905f70241f7c786baf443e3'\n and address in ('0x8207c1ffc5b6804f6024322ccf34f29c3541ae26')\n and $__timeFilter(timestamp) \norder by time", + "refId": "A", + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + } + } + ], + "title": "OGN Balance (Investor)", + "type": "timeseries" + }, + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "cdjqw6cqd1gqob" + }, + "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": "line" + } + }, + "fieldMinMax": false, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 5000000 + } + ] + }, + "unit": "none" + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 12, + "y": 10 + }, + "id": 6, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "cdjqw6cqd1gqob" + }, + "editorMode": "code", + "format": "time_series", + "rawQuery": true, + "rawSql": "select\n timestamp as time,\n case address\n when '0x8207c1ffc5b6804f6024322ccf34f29c3541ae26' then 'OGN'\n when '0x9c354503c38481a7a7a51629142963f98ecc12d0' then 'OGV'\n else address end,\n balance / 1e18 as balance\nfrom erc20_balance\nwhere account = '0xfe730b3cf80ca7b31905f70241f7c786baf443e3'\n and address in ('0x9c354503c38481a7a7a51629142963f98ecc12d0')\n and $__timeFilter(timestamp) \norder by time", + "refId": "A", + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + } + } + ], + "title": "OGV Balance (Investor)", + "type": "timeseries" + } + ], + "refresh": "", + "schemaVersion": 39, + "tags": [], + "templating": { + "list": [] + }, + "time": { + "from": "now-1y", + "to": "now" + }, + "timeRangeUpdatedDuringEditOrView": false, + "timepicker": {}, + "timezone": "", + "title": "OGN / OGV Distribution", + "uid": "cf5ee9c7-1110-4b83-9f74-a57dfc07cf27", + "version": 16, + "weekStart": "" +} \ No newline at end of file diff --git a/grafana/ousd-dashboard.json b/grafana/ousd-dashboard.json index 3be27456..535ffef9 100644 --- a/grafana/ousd-dashboard.json +++ b/grafana/ousd-dashboard.json @@ -24,21 +24,151 @@ "editable": true, "fiscalYearStartMonth": 0, "graphTooltip": 0, - "id": 6, + "id": 18, "links": [], "liveNow": false, "panels": [ + { + "collapsed": false, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 0 + }, + "id": 47, + "panels": [], + "title": "OUSD Health", + "type": "row" + }, + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "cdjqw6cqd1gqob" + }, + "description": "Retrieved using `get_dy(a, b, decimals)`", + "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": "line+area" + } + }, + "decimals": 5, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "dark-red", + "value": null + }, + { + "color": "transparent", + "value": 0.996 + }, + { + "color": "dark-red", + "value": 1.004 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 9, + "w": 11, + "x": 0, + "y": 1 + }, + "id": 48, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "multi", + "sort": "none" + } + }, + "targets": [ + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "cdjqw6cqd1gqob" + }, + "editorMode": "code", + "format": "time_series", + "rawQuery": true, + "rawSql": "select\n timestamp as time,\n name,\n rate / 1e18\nfrom\n curve_pool_rate\nwhere\n address = '0xbebc44782c7db0a1a60cb6fe97d0b483032ff1c7'\n and $__timeFilter(timestamp)\n and timestamp > '2021-02-01'\norder by\n time asc", + "refId": "A", + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + } + } + ], + "title": "ThreePool Rates - get_dy(a, b, decimals)", + "type": "timeseries" + }, { "collapsed": false, "datasource": { "type": "grafana-postgresql-datasource", - "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + "uid": "cdjqw6cqd1gqob" }, "gridPos": { "h": 1, "w": 24, "x": 0, - "y": 0 + "y": 10 }, "id": 8, "panels": [], @@ -46,7 +176,7 @@ { "datasource": { "type": "grafana-postgresql-datasource", - "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + "uid": "cdjqw6cqd1gqob" }, "refId": "A" } @@ -56,8 +186,8 @@ }, { "datasource": { - "type": "postgres", - "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + "type": "grafana-postgresql-datasource", + "uid": "cdjqw6cqd1gqob" }, "fieldConfig": { "defaults": { @@ -65,6 +195,7 @@ "mode": "palette-classic" }, "custom": { + "axisBorderShow": false, "axisCenteredZero": false, "axisColorMode": "text", "axisLabel": "", @@ -116,7 +247,7 @@ "h": 9, "w": 12, "x": 0, - "y": 1 + "y": 11 }, "id": 2, "options": { @@ -135,14 +266,14 @@ { "datasource": { "type": "postgres", - "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + "uid": "cdjqw6cqd1gqob" }, "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\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\n where $__timeFilter(timestamp)\nORDER BY 1", "refId": "A", "select": [ [ @@ -212,8 +343,8 @@ }, { "datasource": { - "type": "postgres", - "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + "type": "grafana-postgresql-datasource", + "uid": "cdjqw6cqd1gqob" }, "fieldConfig": { "defaults": { @@ -221,6 +352,7 @@ "mode": "palette-classic" }, "custom": { + "axisBorderShow": false, "axisCenteredZero": false, "axisColorMode": "text", "axisGridShow": true, @@ -277,7 +409,7 @@ "h": 9, "w": 12, "x": 12, - "y": 1 + "y": 11 }, "id": 4, "options": { @@ -296,14 +428,14 @@ { "datasource": { "type": "postgres", - "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + "uid": "cdjqw6cqd1gqob" }, "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\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 o_token\nWHERE\n $__timeFilter(\"timestamp\") and chain_id = 1 and otoken = '0x2a8e1e676ec238d8a992307b495b45b3feaa5e86'\nORDER BY 1", "refId": "A", "select": [ [ @@ -365,8 +497,8 @@ }, { "datasource": { - "type": "postgres", - "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + "type": "grafana-postgresql-datasource", + "uid": "cdjqw6cqd1gqob" }, "fieldConfig": { "defaults": { @@ -374,6 +506,7 @@ "mode": "palette-classic" }, "custom": { + "axisBorderShow": false, "axisCenteredZero": false, "axisColorMode": "text", "axisLabel": "", @@ -452,7 +585,7 @@ "h": 12, "w": 22, "x": 0, - "y": 10 + "y": 20 }, "id": 6, "options": { @@ -473,14 +606,14 @@ { "datasource": { "type": "postgres", - "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + "uid": "cdjqw6cqd1gqob" }, "editorMode": "code", "format": "time_series", "group": [], "metricColumn": "none", "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", + "rawSql": "SELECT\n \"timestamp\" AS \"time\",\n apy7_day_avg,\n apy14_day_avg,\n apy30_day_avg,\n apy\nFROM o_token_apy\nWHERE\n $__timeFilter(\"timestamp\") and chain_id = 1 and otoken = '0x2a8e1e676ec238d8a992307b495b45b3feaa5e86'\nORDER BY 1", "refId": "A", "select": [ [ @@ -550,8 +683,8 @@ }, { "datasource": { - "type": "postgres", - "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + "type": "grafana-postgresql-datasource", + "uid": "cdjqw6cqd1gqob" }, "fieldConfig": { "defaults": { @@ -580,7 +713,7 @@ "h": 12, "w": 2, "x": 22, - "y": 10 + "y": 20 }, "id": 39, "options": { @@ -595,19 +728,21 @@ "fields": "", "values": false }, - "textMode": "auto" + "showPercentChange": false, + "textMode": "auto", + "wideLayout": true }, - "pluginVersion": "10.1.1", + "pluginVersion": "11.1.0-69622", "targets": [ { "datasource": { "type": "postgres", - "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + "uid": "cdjqw6cqd1gqob" }, "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", + "rawSql": "select timestamp as time, apy, apy7_day_avg, apy14_day_avg, apy30_day_avg from o_token_apy where chain_id = 1 and otoken = '0x2a8e1e676ec238d8a992307b495b45b3feaa5e86' order by id desc limit 1", "refId": "A", "sql": { "columns": [ @@ -633,8 +768,8 @@ }, { "datasource": { - "type": "postgres", - "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + "type": "grafana-postgresql-datasource", + "uid": "cdjqw6cqd1gqob" }, "fieldConfig": { "defaults": { @@ -642,6 +777,7 @@ "mode": "palette-classic" }, "custom": { + "axisBorderShow": false, "axisCenteredZero": false, "axisColorMode": "text", "axisLabel": "", @@ -697,7 +833,7 @@ "h": 11, "w": 12, "x": 0, - "y": 22 + "y": 32 }, "id": 38, "options": { @@ -716,14 +852,14 @@ { "datasource": { "type": "postgres", - "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + "uid": "cdjqw6cqd1gqob" }, "editorMode": "code", "format": "time_series", "group": [], "metricColumn": "none", "rawQuery": true, - "rawSql": "SELECT\n \"timestamp\" AS \"time\",\n yield / 1e18 as yield\nFROM ousd_rebase\nORDER BY 1", + "rawSql": "SELECT\n \"timestamp\" AS \"time\",\n yield_usd / 1e18 as yield\nFROM o_token_rebase\nWHERE\n $__timeFilter(\"timestamp\") and chain_id = 1 and otoken = '0x2a8e1e676ec238d8a992307b495b45b3feaa5e86'\nORDER BY 1", "refId": "A", "select": [ [ @@ -777,13 +913,12 @@ } ], "title": "Yield Accrual", - "transformations": [], "type": "timeseries" }, { "datasource": { - "type": "postgres", - "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + "type": "grafana-postgresql-datasource", + "uid": "cdjqw6cqd1gqob" }, "fieldConfig": { "defaults": { @@ -791,6 +926,7 @@ "mode": "palette-classic" }, "custom": { + "axisBorderShow": false, "axisCenteredZero": false, "axisColorMode": "text", "axisLabel": "", @@ -846,7 +982,7 @@ "h": 11, "w": 12, "x": 12, - "y": 22 + "y": 32 }, "id": 37, "options": { @@ -865,14 +1001,14 @@ { "datasource": { "type": "postgres", - "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + "uid": "cdjqw6cqd1gqob" }, "editorMode": "code", "format": "time_series", "group": [], "metricColumn": "none", "rawQuery": true, - "rawSql": "SELECT\n \"timestamp\" AS \"time\",\n fee / 1e18 as fee\nFROM ousd_rebase\nORDER BY 1", + "rawSql": "SELECT\n \"timestamp\" AS \"time\",\n fee_usd / 1e18 as fee\nFROM o_token_rebase\nWHERE\n $__timeFilter(\"timestamp\") and chain_id = 1 and otoken = '0x2a8e1e676ec238d8a992307b495b45b3feaa5e86'\nORDER BY 1", "refId": "A", "select": [ [ @@ -926,7 +1062,6 @@ } ], "title": "Fee Accrual", - "transformations": [], "type": "timeseries" }, { @@ -935,7 +1070,7 @@ "h": 1, "w": 24, "x": 0, - "y": 33 + "y": 43 }, "id": 46, "panels": [], @@ -944,8 +1079,8 @@ }, { "datasource": { - "type": "postgres", - "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + "type": "grafana-postgresql-datasource", + "uid": "cdjqw6cqd1gqob" }, "fieldConfig": { "defaults": { @@ -953,6 +1088,7 @@ "mode": "palette-classic" }, "custom": { + "axisBorderShow": false, "axisCenteredZero": false, "axisColorMode": "text", "axisLabel": "", @@ -1004,7 +1140,7 @@ "h": 8, "w": 12, "x": 0, - "y": 34 + "y": 44 }, "id": 41, "options": { @@ -1015,7 +1151,7 @@ "showLegend": true }, "tooltip": { - "mode": "single", + "mode": "multi", "sort": "none" } }, @@ -1023,12 +1159,12 @@ { "datasource": { "type": "postgres", - "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + "uid": "cdjqw6cqd1gqob" }, "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 = '0x89eb88fedc50fc77ae8a18aad1ca0ac27f777a90'\norder by time, asset", + "rawSql": "SELECT \ntimestamp as time, \ncase asset \n when '0x6b175474e89094c44da98b954eedeac495271d0f' then 'DAI' \n when '0xdac17f958d2ee523a2206206994597c13d831ec7' then 'USDT' \n when '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48' then 'USDC' \nend as asset, \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'\n and $__timeFilter(timestamp)\norder by time", "refId": "A", "sql": { "columns": [ @@ -1069,8 +1205,8 @@ }, { "datasource": { - "type": "postgres", - "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + "type": "grafana-postgresql-datasource", + "uid": "cdjqw6cqd1gqob" }, "fieldConfig": { "defaults": { @@ -1078,6 +1214,7 @@ "mode": "palette-classic" }, "custom": { + "axisBorderShow": false, "axisCenteredZero": false, "axisColorMode": "text", "axisLabel": "", @@ -1108,6 +1245,7 @@ "mode": "off" } }, + "decimals": 2, "mappings": [], "thresholds": { "mode": "absolute", @@ -1129,7 +1267,7 @@ "h": 8, "w": 12, "x": 12, - "y": 34 + "y": 44 }, "id": 45, "options": { @@ -1140,7 +1278,7 @@ "showLegend": true }, "tooltip": { - "mode": "single", + "mode": "multi", "sort": "none" } }, @@ -1148,12 +1286,12 @@ { "datasource": { "type": "postgres", - "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + "uid": "cdjqw6cqd1gqob" }, "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", + "rawSql": "SELECT \ntimestamp as time, \ncase asset \n when '0x6b175474e89094c44da98b954eedeac495271d0f' then 'DAI' \n when '0xdac17f958d2ee523a2206206994597c13d831ec7' then 'USDT' \n when '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48' then 'USDC' \nend as asset, \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'\n and $__timeFilter(timestamp)\norder by timestamp, asset desc", "refId": "A", "sql": { "columns": [ @@ -1203,8 +1341,8 @@ }, { "datasource": { - "type": "postgres", - "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + "type": "grafana-postgresql-datasource", + "uid": "cdjqw6cqd1gqob" }, "fieldConfig": { "defaults": { @@ -1212,6 +1350,7 @@ "mode": "palette-classic" }, "custom": { + "axisBorderShow": false, "axisCenteredZero": false, "axisColorMode": "text", "axisLabel": "", @@ -1263,7 +1402,7 @@ "h": 8, "w": 12, "x": 0, - "y": 42 + "y": 52 }, "id": 40, "options": { @@ -1274,7 +1413,7 @@ "showLegend": true }, "tooltip": { - "mode": "single", + "mode": "multi", "sort": "none" } }, @@ -1282,12 +1421,12 @@ { "datasource": { "type": "postgres", - "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + "uid": "cdjqw6cqd1gqob" }, "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", + "rawSql": "SELECT \ntimestamp as time, \ncase asset \n when '0x6b175474e89094c44da98b954eedeac495271d0f' then 'DAI' \n when '0xdac17f958d2ee523a2206206994597c13d831ec7' then 'USDT' \n when '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48' then 'USDC' \nend as asset, \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'\n and $__timeFilter(timestamp)\norder by timestamp, asset desc", "refId": "A", "sql": { "columns": [ @@ -1337,8 +1476,8 @@ }, { "datasource": { - "type": "postgres", - "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + "type": "grafana-postgresql-datasource", + "uid": "cdjqw6cqd1gqob" }, "fieldConfig": { "defaults": { @@ -1346,6 +1485,7 @@ "mode": "palette-classic" }, "custom": { + "axisBorderShow": false, "axisCenteredZero": false, "axisColorMode": "text", "axisLabel": "", @@ -1397,7 +1537,7 @@ "h": 8, "w": 12, "x": 12, - "y": 42 + "y": 52 }, "id": 43, "options": { @@ -1408,7 +1548,7 @@ "showLegend": true }, "tooltip": { - "mode": "single", + "mode": "multi", "sort": "none" } }, @@ -1416,12 +1556,12 @@ { "datasource": { "type": "postgres", - "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + "uid": "cdjqw6cqd1gqob" }, "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", + "rawSql": "SELECT \ntimestamp as time, \ncase asset \n when '0x6b175474e89094c44da98b954eedeac495271d0f' then 'DAI' \n when '0xdac17f958d2ee523a2206206994597c13d831ec7' then 'USDT' \n when '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48' then 'USDC' \nend as asset, \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'\n and $__timeFilter(timestamp)\norder by timestamp, asset desc", "refId": "A", "sql": { "columns": [ @@ -1471,8 +1611,8 @@ }, { "datasource": { - "type": "postgres", - "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + "type": "grafana-postgresql-datasource", + "uid": "cdjqw6cqd1gqob" }, "fieldConfig": { "defaults": { @@ -1480,6 +1620,7 @@ "mode": "palette-classic" }, "custom": { + "axisBorderShow": false, "axisCenteredZero": false, "axisColorMode": "text", "axisLabel": "", @@ -1531,7 +1672,7 @@ "h": 8, "w": 12, "x": 0, - "y": 50 + "y": 60 }, "id": 44, "options": { @@ -1542,7 +1683,7 @@ "showLegend": true }, "tooltip": { - "mode": "single", + "mode": "multi", "sort": "none" } }, @@ -1550,12 +1691,12 @@ { "datasource": { "type": "postgres", - "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + "uid": "cdjqw6cqd1gqob" }, "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", + "rawSql": "SELECT \ntimestamp as time, \ncase asset \n when '0x6b175474e89094c44da98b954eedeac495271d0f' then 'DAI' \n when '0xdac17f958d2ee523a2206206994597c13d831ec7' then 'USDT' \n when '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48' then 'USDC' \nend as asset, \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'\n and $__timeFilter(timestamp)\norder by timestamp, asset desc", "refId": "A", "sql": { "columns": [ @@ -1605,8 +1746,8 @@ }, { "datasource": { - "type": "postgres", - "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + "type": "grafana-postgresql-datasource", + "uid": "cdjqw6cqd1gqob" }, "fieldConfig": { "defaults": { @@ -1614,6 +1755,7 @@ "mode": "palette-classic" }, "custom": { + "axisBorderShow": false, "axisCenteredZero": false, "axisColorMode": "text", "axisLabel": "", @@ -1665,7 +1807,7 @@ "h": 8, "w": 12, "x": 12, - "y": 50 + "y": 60 }, "id": 42, "options": { @@ -1676,7 +1818,7 @@ "showLegend": true }, "tooltip": { - "mode": "single", + "mode": "multi", "sort": "none" } }, @@ -1684,12 +1826,12 @@ { "datasource": { "type": "postgres", - "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + "uid": "cdjqw6cqd1gqob" }, "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 = '0x5e3646a1db86993f73e6b74a57d8640b69f7e259'\norder by time, asset", + "rawSql": "SELECT \ntimestamp as time, \ncase asset \n when '0x6b175474e89094c44da98b954eedeac495271d0f' then 'DAI' \n when '0xdac17f958d2ee523a2206206994597c13d831ec7' then 'USDT' \n when '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48' then 'USDC' \nend as asset, \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'\n and $__timeFilter(timestamp)\norder by time", "refId": "A", "sql": { "columns": [ @@ -1729,9 +1871,8 @@ "type": "timeseries" } ], - "refresh": false, - "schemaVersion": 38, - "style": "dark", + "refresh": "", + "schemaVersion": 39, "tags": [ "ousd" ], @@ -1739,13 +1880,14 @@ "list": [] }, "time": { - "from": "now-2y", + "from": "now-6M", "to": "now" }, + "timeRangeUpdatedDuringEditOrView": false, "timepicker": {}, "timezone": "", "title": "OUSD Dashboard", "uid": "5RW4zO7Sj", - "version": 4, + "version": 33, "weekStart": "" } \ No newline at end of file diff --git a/grafana/ousd-strategy-earnings.json b/grafana/ousd-strategy-earnings.json index bee8832b..844d965d 100644 --- a/grafana/ousd-strategy-earnings.json +++ b/grafana/ousd-strategy-earnings.json @@ -37,8 +37,8 @@ }, { "datasource": { - "type": "postgres", - "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + "type": "grafana-postgresql-datasource", + "uid": "cdjqw6cqd1gqob" }, "fieldConfig": { "defaults": { @@ -138,12 +138,12 @@ { "datasource": { "type": "postgres", - "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + "uid": "cdjqw6cqd1gqob" }, "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", + "rawSql": "SELECT timestamp as time, earnings_change / 1000000000000000000 as earnings_change, balance / 1000000000000000000 as balance\nFROM strategy_daily_yield\nWHERE strategy = '0x6b69b755c629590ed59618a2712d8a2957ca98fc'\n and $__timeFilter(timestamp)\nORDER BY timestamp", "refId": "A", "sql": { "columns": [ @@ -193,8 +193,8 @@ }, { "datasource": { - "type": "postgres", - "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + "type": "grafana-postgresql-datasource", + "uid": "cdjqw6cqd1gqob" }, "description": "", "fieldConfig": { @@ -337,13 +337,13 @@ { "datasource": { "type": "postgres", - "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + "uid": "cdjqw6cqd1gqob" }, "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", + "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'\n and $__timeFilter(timestamp)\nORDER BY timestamp", "refId": "A", "sql": { "columns": [ @@ -390,13 +390,12 @@ } ], "title": "OUSD Maker DSR - APY", - "transformations": [], "type": "timeseries" }, { "datasource": { "type": "postgres", - "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + "uid": "cdjqw6cqd1gqob" }, "fieldConfig": { "defaults": { @@ -440,14 +439,16 @@ "fields": "", "values": false }, - "textMode": "auto" + "showPercentChange": false, + "textMode": "auto", + "wideLayout": true }, - "pluginVersion": "10.3.0-63137", + "pluginVersion": "11.1.0-69622", "targets": [ { "datasource": { "type": "postgres", - "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + "uid": "cdjqw6cqd1gqob" }, "editorMode": "code", "format": "table", @@ -478,8 +479,8 @@ }, { "datasource": { - "type": "postgres", - "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + "type": "grafana-postgresql-datasource", + "uid": "cdjqw6cqd1gqob" }, "fieldConfig": { "defaults": { @@ -579,12 +580,12 @@ { "datasource": { "type": "postgres", - "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + "uid": "cdjqw6cqd1gqob" }, "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", + "rawSql": "SELECT timestamp as time, earnings_change / 1000000000000000000 as earnings_change, balance / 1000000000000000000 as balance\nFROM strategy_daily_yield\nWHERE strategy = '0x76bf500b6305dc4ea851384d3d5502f1c7a0ed44'\n and $__timeFilter(timestamp)\nORDER BY timestamp", "refId": "A", "sql": { "columns": [ @@ -634,8 +635,8 @@ }, { "datasource": { - "type": "postgres", - "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + "type": "grafana-postgresql-datasource", + "uid": "cdjqw6cqd1gqob" }, "description": "", "fieldConfig": { @@ -778,13 +779,13 @@ { "datasource": { "type": "postgres", - "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + "uid": "cdjqw6cqd1gqob" }, "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", + "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'\n and $__timeFilter(timestamp)\nORDER BY timestamp", "refId": "A", "sql": { "columns": [ @@ -831,13 +832,12 @@ } ], "title": "OUSD Flux - APY", - "transformations": [], "type": "timeseries" }, { "datasource": { "type": "postgres", - "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + "uid": "cdjqw6cqd1gqob" }, "fieldConfig": { "defaults": { @@ -881,14 +881,16 @@ "fields": "", "values": false }, - "textMode": "auto" + "showPercentChange": false, + "textMode": "auto", + "wideLayout": true }, - "pluginVersion": "10.3.0-63137", + "pluginVersion": "11.1.0-69622", "targets": [ { "datasource": { "type": "postgres", - "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + "uid": "cdjqw6cqd1gqob" }, "editorMode": "code", "format": "table", @@ -919,8 +921,8 @@ }, { "datasource": { - "type": "postgres", - "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + "type": "grafana-postgresql-datasource", + "uid": "cdjqw6cqd1gqob" }, "fieldConfig": { "defaults": { @@ -1020,12 +1022,12 @@ { "datasource": { "type": "postgres", - "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + "uid": "cdjqw6cqd1gqob" }, "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", + "rawSql": "SELECT timestamp as time, earnings_change / 1000000000000000000 as earnings_change, balance / 1000000000000000000 as balance\nFROM strategy_daily_yield\nWHERE strategy = '0x79f2188ef9350a1dc11a062cca0abe90684b0197'\n and $__timeFilter(timestamp)\nORDER BY timestamp", "refId": "A", "sql": { "columns": [ @@ -1075,8 +1077,8 @@ }, { "datasource": { - "type": "postgres", - "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + "type": "grafana-postgresql-datasource", + "uid": "cdjqw6cqd1gqob" }, "description": "", "fieldConfig": { @@ -1207,13 +1209,13 @@ { "datasource": { "type": "postgres", - "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + "uid": "cdjqw6cqd1gqob" }, "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", + "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'\n and $__timeFilter(timestamp)\nORDER BY timestamp", "refId": "A", "sql": { "columns": [ @@ -1260,13 +1262,12 @@ } ], "title": "OUSD Morpho Aave - APY", - "transformations": [], "type": "timeseries" }, { "datasource": { "type": "postgres", - "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + "uid": "cdjqw6cqd1gqob" }, "fieldConfig": { "defaults": { @@ -1310,14 +1311,16 @@ "fields": "", "values": false }, - "textMode": "auto" + "showPercentChange": false, + "textMode": "auto", + "wideLayout": true }, - "pluginVersion": "10.3.0-63137", + "pluginVersion": "11.1.0-69622", "targets": [ { "datasource": { "type": "postgres", - "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + "uid": "cdjqw6cqd1gqob" }, "editorMode": "code", "format": "table", @@ -1348,8 +1351,8 @@ }, { "datasource": { - "type": "postgres", - "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + "type": "grafana-postgresql-datasource", + "uid": "cdjqw6cqd1gqob" }, "fieldConfig": { "defaults": { @@ -1449,12 +1452,12 @@ { "datasource": { "type": "postgres", - "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + "uid": "cdjqw6cqd1gqob" }, "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", + "rawSql": "SELECT timestamp as time, earnings_change / 1000000000000000000 as earnings_change, balance / 1000000000000000000 as balance\nFROM strategy_daily_yield\nWHERE strategy = '0x5a4eee58744d1430876d5ca93cab5ccb763c037d'\n and $__timeFilter(timestamp)\nORDER BY timestamp", "refId": "A", "sql": { "columns": [ @@ -1504,8 +1507,8 @@ }, { "datasource": { - "type": "postgres", - "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + "type": "grafana-postgresql-datasource", + "uid": "cdjqw6cqd1gqob" }, "description": "", "fieldConfig": { @@ -1636,13 +1639,13 @@ { "datasource": { "type": "postgres", - "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + "uid": "cdjqw6cqd1gqob" }, "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", + "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'\n and $__timeFilter(timestamp)\nORDER BY timestamp", "refId": "A", "sql": { "columns": [ @@ -1689,13 +1692,12 @@ } ], "title": "OUSD Morpho Compound - APY by Day", - "transformations": [], "type": "timeseries" }, { "datasource": { "type": "postgres", - "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + "uid": "cdjqw6cqd1gqob" }, "fieldConfig": { "defaults": { @@ -1739,14 +1741,16 @@ "fields": "", "values": false }, - "textMode": "auto" + "showPercentChange": false, + "textMode": "auto", + "wideLayout": true }, - "pluginVersion": "10.3.0-63137", + "pluginVersion": "11.1.0-69622", "targets": [ { "datasource": { "type": "postgres", - "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + "uid": "cdjqw6cqd1gqob" }, "editorMode": "code", "format": "table", @@ -1778,7 +1782,7 @@ { "datasource": { "type": "grafana-postgresql-datasource", - "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + "uid": "cdjqw6cqd1gqob" }, "fieldConfig": { "defaults": { @@ -1822,8 +1826,7 @@ "mode": "absolute", "steps": [ { - "color": "green", - "value": null + "color": "green" }, { "color": "red", @@ -1878,12 +1881,12 @@ { "datasource": { "type": "postgres", - "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + "uid": "cdjqw6cqd1gqob" }, "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", + "rawSql": "SELECT timestamp as time, earnings_change / 1000000000000000000 as earnings_change, balance / 1000000000000000000 as balance\nFROM strategy_daily_yield\nWHERE strategy = '0x89eb88fedc50fc77ae8a18aad1ca0ac27f777a90'\n and $__timeFilter(timestamp)\nORDER BY timestamp", "refId": "A", "sql": { "columns": [ @@ -1933,8 +1936,8 @@ }, { "datasource": { - "type": "postgres", - "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + "type": "grafana-postgresql-datasource", + "uid": "cdjqw6cqd1gqob" }, "description": "", "fieldConfig": { @@ -1984,8 +1987,7 @@ "mode": "absolute", "steps": [ { - "color": "green", - "value": null + "color": "green" }, { "color": "red", @@ -2066,13 +2068,13 @@ { "datasource": { "type": "postgres", - "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + "uid": "cdjqw6cqd1gqob" }, "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", + "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'\n and $__timeFilter(timestamp)\nORDER BY timestamp", "refId": "A", "sql": { "columns": [ @@ -2119,13 +2121,12 @@ } ], "title": "OUSD Convex OUSD+3Crv (AMO) - APY by Day", - "transformations": [], "type": "timeseries" }, { "datasource": { "type": "postgres", - "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + "uid": "cdjqw6cqd1gqob" }, "fieldConfig": { "defaults": { @@ -2137,8 +2138,7 @@ "mode": "absolute", "steps": [ { - "color": "green", - "value": null + "color": "green" }, { "color": "red", @@ -2169,14 +2169,15 @@ "fields": "", "values": false }, - "textMode": "auto" + "textMode": "auto", + "wideLayout": true }, - "pluginVersion": "10.3.0-63137", + "pluginVersion": "10.3.0-63985", "targets": [ { "datasource": { "type": "postgres", - "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + "uid": "cdjqw6cqd1gqob" }, "editorMode": "code", "format": "table", @@ -2208,7 +2209,7 @@ { "datasource": { "type": "grafana-postgresql-datasource", - "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + "uid": "cdjqw6cqd1gqob" }, "fieldConfig": { "defaults": { @@ -2252,8 +2253,7 @@ "mode": "absolute", "steps": [ { - "color": "green", - "value": null + "color": "green" }, { "color": "red", @@ -2308,12 +2308,12 @@ { "datasource": { "type": "postgres", - "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + "uid": "cdjqw6cqd1gqob" }, "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", + "rawSql": "SELECT timestamp as time, earnings_change / 1000000000000000000 as earnings_change, balance / 1000000000000000000 as balance\nFROM strategy_daily_yield\nWHERE strategy = '0x5e3646a1db86993f73e6b74a57d8640b69f7e259'\n and $__timeFilter(timestamp)\norder by timestamp", "refId": "A", "sql": { "columns": [ @@ -2363,8 +2363,8 @@ }, { "datasource": { - "type": "postgres", - "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + "type": "grafana-postgresql-datasource", + "uid": "cdjqw6cqd1gqob" }, "description": "", "fieldConfig": { @@ -2413,8 +2413,7 @@ "mode": "absolute", "steps": [ { - "color": "green", - "value": null + "color": "green" }, { "color": "red", @@ -2495,13 +2494,13 @@ { "datasource": { "type": "postgres", - "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + "uid": "cdjqw6cqd1gqob" }, "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", + "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'\n and $__timeFilter(timestamp)\nORDER BY timestamp", "refId": "A", "sql": { "columns": [ @@ -2548,13 +2547,12 @@ } ], "title": "OUSD Aave - APY by Day", - "transformations": [], "type": "timeseries" }, { "datasource": { "type": "postgres", - "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + "uid": "cdjqw6cqd1gqob" }, "fieldConfig": { "defaults": { @@ -2566,8 +2564,7 @@ "mode": "absolute", "steps": [ { - "color": "green", - "value": null + "color": "green" }, { "color": "red", @@ -2598,14 +2595,15 @@ "fields": "", "values": false }, - "textMode": "auto" + "textMode": "auto", + "wideLayout": true }, - "pluginVersion": "10.3.0-63137", + "pluginVersion": "10.3.0-63985", "targets": [ { "datasource": { "type": "postgres", - "uid": "bc59d069-00cc-43d4-b0cf-06dadb84daef" + "uid": "cdjqw6cqd1gqob" }, "editorMode": "code", "format": "table", @@ -2647,10 +2645,11 @@ "from": "now-6M", "to": "now" }, + "timeRangeUpdatedDuringEditOrView": false, "timepicker": {}, "timezone": "", "title": "OUSD Strategy Earnings", "uid": "f40d88db-86e6-43c6-933d-e7bc1ad5ced0", - "version": 25, + "version": 28, "weekStart": "" } \ No newline at end of file From ffb5ec63ee98a1b99c428062f2cb5c1b3368ad57 Mon Sep 17 00:00:00 2001 From: Chris Jacobs Date: Thu, 25 Apr 2024 12:54:21 -0700 Subject: [PATCH 11/12] enable arbitrum rpc data ingestion --- src/processor.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/processor.ts b/src/processor.ts index 09898261..93a979a5 100644 --- a/src/processor.ts +++ b/src/processor.ts @@ -31,7 +31,7 @@ export const createSquidProcessor = ( maxBatchCallSize: url.includes('alchemy.com') ? 1 : 10, }) .setRpcDataIngestionSettings({ - disabled: archive === 'arbitrum', + // disabled: archive === 'arbitrum', headPollInterval: 30000, }) .setFinalityConfirmation(10) From a04b36cd51eec414c8ab16455048d8ffece99967 Mon Sep 17 00:00:00 2001 From: Chris Jacobs Date: Thu, 25 Apr 2024 14:01:15 -0700 Subject: [PATCH 12/12] squid version back to 999 --- squid.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/squid.yaml b/squid.yaml index 188d965e..e92b9221 100644 --- a/squid.yaml +++ b/squid.yaml @@ -1,6 +1,6 @@ manifestVersion: subsquid.io/v0.1 name: origin-squid -version: 29 +version: 999 description: 'Origin Protocol 🦑' build: deploy: