Kruys-Collinscivil-turquoise
    Updated 2024-10-15

    WITH APTIN AS (
    SELECT
    date_trunc('day',t1.block_timestamp) as block_timestamp, t1.event_address, t1.event_data, t1.account_address,
    t1.payload_function, t1.success, t1.tx_hash, t1.event_data:amount::float AS amount_unadjusted,
    t2.address,
    t2.address_name,
    t2.label,
    t3.token_address,
    t3.decimals,
    t3.symbol
    FROM
    aptos.core.fact_events t1
    LEFT JOIN aptos.core.dim_labels t2 ON t1.event_address = t2.address
    LEFT JOIN aptos.core.dim_tokens t3 ON t1.event_data:coin_name = t3.token_address
    WHERE t1.block_timestamp >= '2024-01-01'
    AND initcap(t2.label) = 'Aptin Finance'
    AND t1.payload_function IN (
    '0x3c1d4a86594d681ff7e5d5a233965daeabdc6a15fe5672ceeda5260038857183::lend::borrow',
    '0x3c1d4a86594d681ff7e5d5a233965daeabdc6a15fe5672ceeda5260038857183::lend::supply',
    '0x3c1d4a86594d681ff7e5d5a233965daeabdc6a15fe5672ceeda5260038857183::lend::repay',
    '0x3c1d4a86594d681ff7e5d5a233965daeabdc6a15fe5672ceeda5260038857183::lend::withdraw'
    )
    AND SUCCESS = 'TRUE'
    ),
    PRICE AS (
    SELECT DATE_TRUNC('DAY',HOUR) AS DATE,
    AVG(PRICE) AS PRICE,
    TOKEN_ADDRESS
    FROM
    aptos.price.ez_prices_hourly
    GROUP BY 1,3
    ),
    APTIN_WITH_PRICE AS (
    SELECT
    a.*,
    Last run: 3 months ago
    DATE
    SYMBOL
    $ Amount Supplied
    $ Amount Borrowed
    $ Amount Repaid
    $ Amount Withdrawn
    1
    2024-03-02 00:00:00.000USDT617.0414447422528.3976352342775.52623021230.028899377
    2
    2024-03-24 00:00:00.000stAPT65917.2739212013150.66738417904.18514731527138.880624644
    3
    2024-04-03 00:00:00.000USDC51694.60957209745985.61362663613594.49279124460332.784088551
    4
    2024-04-22 00:00:00.000USDT209558.37825682453626.3511522946879.055358858148114.583452789
    5
    2024-05-05 00:00:00.000USDT25914.98258193215106.14157760621459.39981058138904.862503214
    6
    2024-05-12 00:00:00.000USDC16381.78786795452749.12780508813806.02830975423311.254889785
    7
    2024-05-13 00:00:00.000USDT67851.6583837982790.7408090237044.16043476651369.082179472
    8
    2024-06-13 00:00:00.000stAPT4668.1056268477580.4838666357759.3560848073243.471050641
    9
    2024-09-04 00:00:00.000APT20665.7627238762609.021501337221.0017912413832.860229607
    10
    2024-10-11 00:00:00.000WETH37054.4331895250239.459323169126489.349615778
    11
    2024-02-03 00:00:00.000stAPT6540.53380090174.85102520870.0243626274064.230079175
    12
    2024-02-18 00:00:00.000USDT2703.36661931124358.98784690817405.5355688553360.643734454
    13
    2024-06-23 00:00:00.000APT15116.6579546063530.7445202651935.63609276713916.797540208
    14
    2024-07-06 00:00:00.000USDC109859.27752652788737.297304394830.95430535551670.709646026
    15
    2024-07-11 00:00:00.000USDC351126.1343870714213.946712583260493.117691151496229.532618925
    16
    2024-08-07 00:00:00.000USDT3015.3355878821390.7771258332992.6687753263926.439415219
    17
    2024-08-21 00:00:00.000APT8939.5529928471656.6490335365108.7248443159083.934913253
    18
    2024-09-27 00:00:00.000APT20918.463243318895.393134591751.0253441419437.711475177
    19
    2024-01-16 00:00:00.000APT2652.5139539831397.402450641828.826973959594.676046267
    20
    2024-03-16 00:00:00.000USDT860676.73465227244842.92450572712239.643412447447588.077852444
    ...
    1892
    161KB
    38s