MoeCopy of *1 maker
    Updated 2023-03-12
    with
    weth_dep as (select
    date_trunc({{scale}},BLOCK_TIMESTAMP)::date as date,
    case when tx_hash in (select tx_hash from ethereum.maker.ez_vault_creation) then 'Vault creation'
    else 'Re-deposit' end as type,
    TOKEN_DEPOSITED,
    TX_HASH,
    DEPOSITOR,
    AMOUNT_DEPOSITED
    from
    ethereum.maker.ez_deposits
    where TOKEN_DEPOSITED = '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2'
    ),

    borrow as (
    select
    date_trunc({{scale}},BLOCK_TIMESTAMP)::date as date,
    TX_HASH,
    ORIGIN_TO_ADDRESS,symbol,
    AMOUNT
    from ethereum.core.ez_token_transfers
    where tx_hash in (select tx_hash from weth_dep)
    and symbol in (
    'USDC','USDT','DAI','FEI','BUSD','TUSD'
    ))
    ,joined as (
    select
    w.date,
    w.tx_hash,type,
    symbol,
    ORIGIN_TO_ADDRESS,
    AMOUNT as tot_borrowed,
    AMOUNT_DEPOSITED as weth_deposited
    from borrow d join weth_dep w on d.tx_hash = w.tx_hash
    )
    ,price as (
    Run a query to Download Data