Abbas_ra21Levana stats funding osmo
    Updated 2024-12-12
    -- forked from Levana stats funding @ https://flipsidecrypto.xyz/edit/queries/2f010cf8-0db0-4b29-9ee6-22e4d775fd5e
    select
    date_trunc('Hour', BLOCK_TIMESTAMP) AS Hour,
    CASE
    when ATTRIBUTE_VALUE = 'osmo164357hnc5jc0pw9lv958h6chrpjucr4sy47hwpm9k4av6zh74gnq7uvcpj' THEN 'BNB'
    when ATTRIBUTE_VALUE = 'osmo186nlf2fwfglq8u4nj3f7mwg8uc79j22qhaau4scdyur47e0fatas34vcn9' THEN 'SEI'
    when ATTRIBUTE_VALUE = 'osmo19uqdjvk6j9yjtev7j25sc0v0mszqy3jwwak8z4n0qf6l4wp9csvq0jn0qw' THEN 'LINK'
    when ATTRIBUTE_VALUE = 'osmo1d5zsvupzvq5ru6635a0agrcdrj0t8ycj8vpewm8z4y8xf85gvh3qk0ka33' THEN 'DOT'
    when ATTRIBUTE_VALUE = 'osmo19c7hdlfvu7cddr0smfz9luaj8375qhfr3s0gtsk087laqfzxlu3qsnk47e' THEN 'axlETH'
    when ATTRIBUTE_VALUE = 'osmo1hd7r733w49wrqnxx3daz4gy7kvdhgwsjwn28wj7msjfk4tde89aqjqhu8x' THEN 'ATOM'
    when ATTRIBUTE_VALUE = 'osmo1nzddhaf086r0rv0gmrepn3ryxsu9qqrh7zmvcexqtfmxqgj0hhps4hruzu' THEN 'BTC'
    when ATTRIBUTE_VALUE = 'osmo1rhgn3mp5q7vfr43xgzwtcrnklll6w7e0gv5jvmk9sz26qvcnf3tsw8axyn' THEN 'GBP'
    when ATTRIBUTE_VALUE = 'osmo1jprh8f4ytxar0q3z5n5p6swqnmunnsvuuhnhteskwxjzyc8jayms4r7e3e' THEN 'SOL'
    when ATTRIBUTE_VALUE = 'osmo1u7usfl8wxtzkwllagxxv9u0y5ulv4gyan47gmn76re0830ndk8hsnd05l9' THEN 'LUNA'
    when ATTRIBUTE_VALUE = 'osmo19ua8dlul0hq9jfwfq9d0eqcz0lvx5jd8segmn85rz2nv94jlhwcqnkypv3' THEN 'DOGE'
    when ATTRIBUTE_VALUE = 'osmo1kqzkupfec3zemmaj3kuhcf0h2wke02wa7sgp2a9vq5mugtgs5pzs8avjzt' THEN 'TIA'
    when ATTRIBUTE_VALUE = 'osmo1ufpu3nudumzh53sek246zrwvv2cc7leplaqruuggeny7wlcvfrzq4cqmwd' THEN 'stATOM'
    when ATTRIBUTE_VALUE = 'osmo127aqy4697zqn27z0vqr3x2n8lraf27t7udvl6ef5hcwmwhjadegq9vytdj' THEN 'OSMO'
    when ATTRIBUTE_VALUE = 'osmo16v36jtfjc933htukqfrk8lk8e2uj8xpp3zjdh0ll04qe9jevlnrsuwhhx8' THEN 'EUR'
    when ATTRIBUTE_VALUE = 'osmo1xmuwpu2v97cgk2lmevdylkfvtzrlznv826zht8mezh7979fh9y5sdck8ws' THEN 'AXL'
    end AS Pool,
    avg(Long_Rate) AS "Long Rate",
    avg(Short_Rate) AS "Short Rate"
    from
    osmosis.core.fact_msg_attributes m
    inner join (
    select
    TX_ID,
    ATTRIBUTE_VALUE AS Long_Rate
    from
    osmosis.core.fact_msg_attributes
    where
    TX_SUCCEEDED = TRUE
    and MSG_TYPE like 'wasm-funding-rate-change'
    and ATTRIBUTE_KEY = 'long-rate'
    ) l on l.TX_ID = m.TX_ID