Skip to content

Commit

Permalink
Merge pull request #5246 from connext/testnet-prod
Browse files Browse the repository at this point in the history
Prod Sync
  • Loading branch information
wanglonghong authored Nov 30, 2023
2 parents 81a6de8 + a34d7fa commit bffe1d2
Show file tree
Hide file tree
Showing 61 changed files with 112,433 additions and 87,748 deletions.
20 changes: 10 additions & 10 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# global owner
@rhlsthrm
/ops/ @carlomazzaferro @preethamr @rhlsthrm
/docker/ @carlomazzaferro @preethamr @rhlsthrm
/packages/adapters/ @preethamr @liu-zhipeng @wanglonghong @sanchaymittal @rhlsthrm
/packages/agents/ @preethamr @liu-zhipeng @wanglonghong @sanchaymittal @rhlsthrm
/packages/agents/sdk/ @just-a-node @sanchaymittal @rhlsthrm
/packages/deployments/ @LayneHaber @rhlsthrm @liu-zhipeng
/packages/examples/ @just-a-node @rhlsthrm @sanchaymittal @preethamr
/packages/integration/ @LayneHaber @preethamr @rhlsthrm
/packages/utils/ @preethamr @liu-zhipeng @wanglonghong @rhlsthrm
@preethamr
/ops/ @carlomazzaferro @preethamr
/docker/ @carlomazzaferro @preethamr
/packages/adapters/ @preethamr @liu-zhipeng @wanglonghong
/packages/agents/ @preethamr @liu-zhipeng @wanglonghong
/packages/agents/sdk/ @just-a-node @prathmeshkhandelwal1
/packages/deployments/ @LayneHaber @liu-zhipeng @preethamr
/packages/examples/ @just-a-node @prathmeshkhandelwal1 @preethamr
/packages/integration/ @LayneHaber @preethamr @just-a-node
/packages/utils/ @preethamr @liu-zhipeng @wanglonghong @just-a-node
5 changes: 3 additions & 2 deletions ops/env/testnet/core/secrets.prod.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"mumbai_alchemy_key_0": "ENC[AES256_GCM,data:VolMxEjn8+QnY13VzDpEWenyv1CBjvyjcLMb1l/xlrw=,iv:BWvw9p/3JYsLpqdszm5JIasoxjypghjaff/BJ2QIOtM=,tag:M/AN6XyOJoAL7/RNWy7SuQ==,type:str]",
"blast_key": "ENC[AES256_GCM,data:aOV48KWCE0L4tjHc+Tdt4oQBFGbTRKeb+2DMFI4Y7LGjYNke,iv:wv3W/M2ZKTFpj28WAUZIvPKOc4kvsWqabDd+qoVTdg4=,tag:gWHQBWTVIjT0PymIHOROnQ==,type:str]",
"infura_key": "ENC[AES256_GCM,data:xLJ5hNQ15pRWC7HwEX478tkJBv1czUM7LGufL+wIgsI=,iv:ZWrq2/0iXMTe+V6+0owJ4A3WczTMUYANEM6mUV/b8II=,tag:Uw8BBlJg6LkaVPMya9fMrA==,type:str]",
"drpc_key": "ENC[AES256_GCM,data:5X4cfa5Hk5EDfAI+SqUS2A/NYFJpjOhPJFMpy53jKCzFS/trmsI4p+OkZu0=,iv:p14iXH2KYyZyvO3WsmK893pNaLu+ppLhkyx4XaF6Z7I=,tag:QKIA3neU5lyHiQO4p/cqLg==,type:str]",
"admin_token_router": "ENC[AES256_GCM,data:V0FuvFfMBS0=,iv:MW6eOYjcM8xgMGpr3204tYvFsm3IVXNTAUjBmcs2YRc=,tag:lLfG206oCZvEUn7jeWTEyw==,type:str]",
"admin_token_relayer": "ENC[AES256_GCM,data:d3anfiUkOvO0EHrG,iv:p3xt2RNbgA4hPp2o83XCZV4dQMZIiDe0OP9A/a5ReqY=,tag:qst1HQAhnFFs3JQRklAZGQ==,type:str]",
"router_web3_signer_private_key": "ENC[AES256_GCM,data:PgiC1qjoz/dQLowI2qU/8lbZ8tOUnU+qREbNbg20yghWW8hqOzs1DWf8+on059dpQ8k1qD02vBHUn9kUI1cehPpV,iv:X6OmwFeDEiy4QMoWgcPJckvYk57tsHyoYnAiZ7xY0eE=,tag:NXcEZTv3XYg9M5XPSVr3SQ==,type:str]",
Expand Down Expand Up @@ -35,8 +36,8 @@
"azure_kv": null,
"hc_vault": null,
"age": null,
"lastmodified": "2023-11-06T20:10:08Z",
"mac": "ENC[AES256_GCM,data:s0lLBTKko7PKpjyod+kRXXqIONSnPWV8E9BInDnbY79Pf/1qfcBvSkzEKVqFgZAHYjdIcwJ774kswF5znzhaeV5mjRCKEL71P5QSVXW/7woYaU3wkD1sY3nJ2Tndjy8dxv/2GDOU1cUBRZ8Ymc+jjbsvATzf70hqqlyiYRk5LFw=,iv:ze4EbVbgpEgULeb8+mN8zWYtsqulbUoi95uEALCgigo=,tag:Z4neh43QIwek0hPGlQtIRQ==,type:str]",
"lastmodified": "2023-11-28T19:12:23Z",
"mac": "ENC[AES256_GCM,data:ZPM35Ra99qeQ1ESFWL0oAF+A0gAmmCJU9xlc27PcUph5kL8WgZ3C3Lr1lRwYKCmdYMzGWHU0SlhjnlFNC/QVLFMNrSQ/RHCKHJBswK0KE9JIfrfsJWLo5lQ8IRxZWsypLxX71Vxtypa1MSzftILcmVBGxUc2I1KC7nYPMnkIRmQ=,iv:hvXeVE7ygZcla/6a39AL03tXaX6ACF0/Xi3qiuPACN4=,tag:23BXuHW5VgiBenW1qKlSjA==,type:str]",
"pgp": null,
"unencrypted_suffix": "_unencrypted",
"version": "3.7.3"
Expand Down
32 changes: 16 additions & 16 deletions ops/testnet/prod/core/config.tf
Original file line number Diff line number Diff line change
Expand Up @@ -85,18 +85,18 @@ locals {
logLevel = "debug"
chains = {
"1735356532" = {
providers = ["https://optimism-goerli.blastapi.io/${var.blast_key}", "https://goerli.optimism.io"]
providers = ["https://lb.drpc.org/ogrpc?network=optimism-testnet&dkey=${var.drpc_key}", "https://optimism-goerli.blastapi.io/${var.blast_key}", "https://goerli.optimism.io"]
}
"1735353714" = {
providers = ["https://eth-goerli.blastapi.io/${var.blast_key}", "https://rpc.ankr.com/eth_goerli"]
providers = ["https://lb.drpc.org/ogrpc?network=goerli&dkey=${var.drpc_key}", "https://eth-goerli.blastapi.io/${var.blast_key}", "https://rpc.ankr.com/eth_goerli"]
excludeListFromRelayerFee = ["0x79D5007F9782eE0407DB4C7a9fC6AE030586afac", "0xc8D125853346a389A8a68390dd23D719c08BF8F8"]
}
"9991" = {
providers = ["https://rpc.ankr.com/polygon_mumbai", "https://polygon-testnet.blastapi.io/${var.blast_key}"]
providers = ["https://lb.drpc.org/ogrpc?network=polygon-mumbai&dkey=${var.drpc_key}", "https://rpc.ankr.com/polygon_mumbai", "https://polygon-testnet.blastapi.io/${var.blast_key}"]
excludeListFromRelayerFee = ["0x6c461C0296eBE3715820F1Cbde856219e06ac3B8", "0x5Ee7Acd9E57f81a08d361b3Dc516f30964601068", "0xcD7dE973264D5967D930Ef5144C59E9811ce5787"]
}
"1668247156" = {
providers = ["https://linea-goerli.infura.io/v3/${var.infura_key}", "https://rpc.goerli.linea.build"]
providers = ["https://lb.drpc.org/ogrpc?network=linea-goerli&dkey=${var.drpc_key}", "https://linea-goerli.infura.io/v3/${var.infura_key}", "https://rpc.goerli.linea.build"]
}
# "2053862260" = {
# providers = ["https://zksync-era-testnet.blockpi.network/v1/rpc/public", "https://testnet.era.zksync.dev"]
Expand Down Expand Up @@ -229,16 +229,16 @@ locals {
}
chains = {
"1735356532" = {
providers = ["https://optimism-goerli.blastapi.io/${var.blast_key}", "https://goerli.optimism.io"]
providers = ["https://lb.drpc.org/ogrpc?network=optimism-testnet&dkey=${var.drpc_key}", "https://optimism-goerli.blastapi.io/${var.blast_key}", "https://goerli.optimism.io"]
}
"1735353714" = {
providers = ["https://eth-goerli.blastapi.io/${var.blast_key}", "https://rpc.ankr.com/eth_goerli"]
providers = ["https://lb.drpc.org/ogrpc?network=goerli&dkey=${var.drpc_key}", "https://eth-goerli.blastapi.io/${var.blast_key}", "https://rpc.ankr.com/eth_goerli"]
}
"9991" = {
providers = ["https://rpc.ankr.com/polygon_mumbai", "https://polygon-testnet.blastapi.io/${var.blast_key}"]
providers = ["https://lb.drpc.org/ogrpc?network=polygon-mumbai&dkey=${var.drpc_key}", "https://rpc.ankr.com/polygon_mumbai", "https://polygon-testnet.blastapi.io/${var.blast_key}"]
}
"1668247156" = {
providers = ["https://linea-goerli.infura.io/v3/${var.infura_key}", "https://rpc.goerli.linea.build"]
providers = ["https://lb.drpc.org/ogrpc?network=linea-goerli&dkey=${var.drpc_key}", "https://linea-goerli.infura.io/v3/${var.infura_key}", "https://rpc.goerli.linea.build"]
}
}
cartographerUrl = "https://postgrest.testnet.connext.ninja"
Expand All @@ -257,16 +257,16 @@ locals {
logLevel = "debug"
chains = {
"1735356532" = {
providers = ["https://opt-goerli.g.alchemy.com/v2/${var.optgoerli_alchemy_key_for_lh}"]
providers = ["https://lb.drpc.org/ogrpc?network=optimism-testnet&dkey=${var.drpc_key}", "https://opt-goerli.g.alchemy.com/v2/${var.optgoerli_alchemy_key_for_lh}"]
}
"1735353714" = {
providers = ["https://eth-goerli.g.alchemy.com/v2/${var.goerli_alchemy_key_0}"]
providers = ["https://lb.drpc.org/ogrpc?network=goerli&dkey=${var.drpc_key}", "https://eth-goerli.g.alchemy.com/v2/${var.goerli_alchemy_key_0}"]
}
"9991" = {
providers = ["https://polygon-mumbai.g.alchemy.com/v2/${var.mumbai_alchemy_key_0}"]
providers = ["https://lb.drpc.org/ogrpc?network=polygon-mumbai&dkey=${var.drpc_key}", "https://polygon-mumbai.g.alchemy.com/v2/${var.mumbai_alchemy_key_0}"]
}
"1668247156" = {
providers = ["https://linea-goerli.infura.io/v3/${var.infura_key}", "https://rpc.goerli.linea.build"]
providers = ["https://lb.drpc.org/ogrpc?network=linea-goerli&dkey=${var.drpc_key}", "https://linea-goerli.infura.io/v3/${var.infura_key}", "https://rpc.goerli.linea.build"]
}
"2053862260" = {
providers = ["https://zksync-era-testnet.blockpi.network/v1/rpc/public", "https://testnet.era.zksync.dev"]
Expand Down Expand Up @@ -332,16 +332,16 @@ locals {
logLevel = "debug"
chains = {
"1735356532" = {
providers = ["https://optimism-goerli.blastapi.io/${var.blast_key}", "https://goerli.optimism.io"]
providers = ["https://lb.drpc.org/ogrpc?network=optimism-testnet&dkey=${var.drpc_key}", "https://optimism-goerli.blastapi.io/${var.blast_key}", "https://goerli.optimism.io"]
}
"1735353714" = {
providers = ["https://eth-goerli.blastapi.io/${var.blast_key}", "https://rpc.ankr.com/eth_goerli"]
providers = ["https://lb.drpc.org/ogrpc?network=goerli&dkey=${var.drpc_key}", "https://eth-goerli.blastapi.io/${var.blast_key}", "https://rpc.ankr.com/eth_goerli"]
}
"9991" = {
providers = ["https://rpc.ankr.com/polygon_mumbai", "https://polygon-testnet.blastapi.io/${var.blast_key}"]
providers = ["https://lb.drpc.org/ogrpc?network=polygon-mumbai&dkey=${var.drpc_key}", "https://rpc.ankr.com/polygon_mumbai", "https://polygon-testnet.blastapi.io/${var.blast_key}"]
}
"1668247156" = {
providers = ["https://linea-goerli.infura.io/v3/${var.infura_key}", "https://rpc.goerli.linea.build"]
providers = ["https://lb.drpc.org/ogrpc?network=linea-goerli&dkey=${var.drpc_key}", "https://linea-goerli.infura.io/v3/${var.infura_key}", "https://rpc.goerli.linea.build"]
}
# "2053862260" = {
# providers = ["https://zksync-era-testnet.blockpi.network/v1/rpc/public", "https://testnet.era.zksync.dev"]
Expand Down
4 changes: 4 additions & 0 deletions ops/testnet/prod/core/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -184,4 +184,8 @@ variable "relayer_web3_signer_private_key" {
variable "admin_token_relayer" {
type = string
default = "blahblah"
}

variable "drpc_key" {
type = string
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
-- migrate:up
ALTER TABLE public.assets
ADD COLUMN IF NOT EXISTS adopted_decimal numeric DEFAULT 0;


-- migrate:down
ALTER TABLE assets
DROP COLUMN adopted_decimal;
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
-- migrate:up
CREATE TYPE event_type AS ENUM (
'Add',
'Remove'
);

CREATE TABLE IF NOT EXISTS public.router_liquidity_events (
id character varying(255) NOT NULL UNIQUE,
domain character varying (255) NOT NULL,
router character (42) NOT NULL,
event event_type DEFAULT 'Add'::event_type NOT NULL,
asset character (42) NOT NULL,
amount numeric DEFAULT 0,
balance numeric DEFAULT 0,
block_number integer NOT NULL,
transaction_hash character(66) NOT NULL,
timestamp integer NOT NULL,
nonce numeric DEFAULT 0 NOT NULL,
PRIMARY KEY(id)
);

GRANT SELECT ON public.router_liquidity_events to query;
GRANT SELECT ON public.router_liquidity_events to reader;


-- migrate:down
DROP TABLE IF EXISTS public.router_liquidity_events;
DROP TYPE event_type;

Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
-- migrate:up
DROP VIEW IF EXISTS public.router_tvl;
DROP VIEW IF EXISTS public.router_liquidity;
DROP VIEW IF EXISTS public.routers_with_balances;

CREATE OR REPLACE VIEW public.routers_with_balances AS
SELECT routers.address,
asset_balances.asset_canonical_id,
asset_balances.asset_domain,
asset_balances.router_address,
asset_balances.balance,
assets.local,
assets.adopted,
assets.canonical_id,
assets.canonical_domain,
assets.domain,
assets.key,
assets.id,
asset_balances.fees_earned,
asset_balances.locked,
asset_balances.supplied,
asset_balances.removed,
assets.decimal,
assets.adopted_decimal,
COALESCE (asset_prices.price,0) AS asset_usd_price,
(asset_prices.price * (asset_balances.balance::numeric / 10 ^ assets.decimal)) AS balance_usd,
(asset_prices.price * (asset_balances.fees_earned::numeric / 10 ^ assets.decimal)) AS fee_earned_usd,
(asset_prices.price * (asset_balances.locked::numeric / 10 ^ assets.decimal)) AS locked_usd,
(asset_prices.price * (asset_balances.supplied::numeric / 10 ^ assets.decimal)) AS supplied_usd,
(asset_prices.price * (asset_balances.removed::numeric / 10 ^ assets.decimal)) AS removed_usd
FROM (
routers
LEFT JOIN asset_balances ON routers.address = asset_balances.router_address
LEFT JOIN assets ON asset_balances.asset_canonical_id = assets.canonical_id AND asset_balances.asset_domain::text = assets.domain::text
LEFT JOIN asset_prices ON assets.canonical_id = asset_prices.canonical_id AND asset_prices.timestamp = (SELECT MAX(timestamp) FROM public.asset_prices)
);

CREATE OR REPLACE VIEW public.router_liquidity AS (
SELECT r.domain,
r.local,
r.adopted,
SUM(r.balance) As total_balance,
SUM(r.locked) As total_locked,
SUM(r.supplied) As total_supplied,
SUM(r.removed) As total_removed,
AVG(r.asset_usd_price) As avg_usd_price,
SUM((r.asset_usd_price * (r.balance::numeric / 10 ^ r.decimal))) As total_balance_usd,
SUM((r.asset_usd_price * (r.locked::numeric / 10 ^ r.decimal))) As total_locked_usd,
SUM((r.asset_usd_price * (r.supplied::numeric / 10 ^ r.decimal))) As total_supplied_usd,
SUM((r.asset_usd_price * (r.removed::numeric / 10 ^ r.decimal))) As total_removed_usd
FROM public.routers_with_balances r
GROUP BY 1,
2,
3
ORDER BY 1
);

CREATE OR REPLACE VIEW public.router_tvl AS
SELECT latest_transfer.latest_transfer_day,
router_tvl.asset,
router_tvl.tvl,
router_tvl.price,
router_tvl.tvl_usd
FROM (( SELECT rb.local AS asset,
sum(rb.balance) AS tvl,
avg(rb.asset_usd_price) AS price,
sum(rb.asset_usd_price * (rb.balance::numeric / 10 ^ rb.decimal)) AS tvl_usd
FROM public.routers_with_balances rb
GROUP BY rb.local) router_tvl
CROSS JOIN ( SELECT max((date_trunc('day'::text, to_timestamp((tf.xcall_timestamp)::double precision)))::date) AS latest_transfer_day
FROM public.transfers tf) latest_transfer);


-- migrate:down

Loading

0 comments on commit bffe1d2

Please sign in to comment.