-
Notifications
You must be signed in to change notification settings - Fork 172
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5246 from connext/testnet-prod
Prod Sync
- Loading branch information
Showing
61 changed files
with
112,433 additions
and
87,748 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
packages/adapters/database/db/migrations/20231127165037_add_adopted_decimal_to_assets.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
29 changes: 29 additions & 0 deletions
29
packages/adapters/database/db/migrations/20231127165223_add_router_liquidity_events.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
|
75 changes: 75 additions & 0 deletions
75
...s/database/db/migrations/20231128023332_refactor_router_with_balances_adopted_decimal.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
|
Oops, something went wrong.