Skip to content
This repository has been archived by the owner on Nov 21, 2024. It is now read-only.

[ECO-1903] add mypools endpoint #40

Merged
merged 1 commit into from
Jul 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions cfg/cspell-dictionary.txt
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ mdformat
mosquitto
mqtt
mqttoptions
mypools
noqa
notif
pgrep
Expand Down
16 changes: 16 additions & 0 deletions sql_extensions/migrations/00005_my_pools.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
CREATE INDEX inbox_events_mypools ON inbox_events (
(data ->> 'provider')
) WHERE event_name = 'emojicoin_dot_fun::Liquidity' AND (data ->> 'liquidity_provided')::BOOLEAN = true;

-- noqa: disable=PRS
CREATE FUNCTION mypools (address text) RETURNS TABLE (LIKE market_data) AS
$$
WITH mypools AS (
SELECT DISTINCT (data ->> 'market_id')::NUMERIC AS market_id
FROM inbox_events
WHERE event_name = 'emojicoin_dot_fun::Liquidity'
AND (data ->> 'liquidity_provided')::BOOLEAN = true
AND (data ->> 'provider') = $1
)
SELECT m.* FROM market_data m INNER JOIN mypools p ON m.market_id = p.market_id;
$$ LANGUAGE SQL;
Loading