Skip to content

Commit

Permalink
lending.supply - add repay with atokens evt (#6447)
Browse files Browse the repository at this point in the history
* add repay with atokens evt

* adding test changes to trigger re-run

* another attempt with dummy spell

* remove dummy spell..

* update borrow to excl recs flagged as useATokens

* reverse borrow updates

---------

Co-authored-by: jeff-dude <[email protected]>
  • Loading branch information
tomfutago and jeff-dude authored Aug 8, 2024
1 parent 1ccbaae commit 7cfc9d4
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,15 @@ src_LendingPool_evt_Withdraw as (
{% endif %}
),

src_LendingPool_evt_Repay as (
select *
from {{ source(project_decoded_as ~ '_' ~ blockchain, decoded_contract_name ~ '_evt_Repay') }}
where useATokens -- ref: https://github.com/duneanalytics/spellbook/issues/6417
{% if is_incremental() %}
and {{ incremental_predicate('evt_block_time') }}
{% endif %}
),

src_LendingPool_evt_LiquidationCall as (
select *
from {{ source(project_decoded_as ~ '_' ~ blockchain, decoded_contract_name ~ '_evt_LiquidationCall') }}
Expand Down Expand Up @@ -286,6 +295,21 @@ base_supply as (
evt_block_number
from src_LendingPool_evt_Withdraw
union all
select
'repay_with_atokens' as transaction_type,
reserve as token_address,
user as depositor,
cast(null as varbinary) as on_behalf_of,
repayer as withdrawn_to,
cast(null as varbinary) as liquidator,
-1 * cast(amount as double) as amount,
contract_address,
evt_tx_hash,
evt_index,
evt_block_time,
evt_block_number
from src_LendingPool_evt_Repay
union all
select
'deposit_liquidation' as transaction_type,
collateralAsset as token_address,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,4 @@ from {{ model }}
union all
{% endif %}
{% endfor %}

Original file line number Diff line number Diff line change
Expand Up @@ -54,3 +54,4 @@ where {{ incremental_predicate('block_time') }}
union all
{% endif %}
{% endfor %}

Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,4 @@
model = ref('lending_base_supply')
)
}}

0 comments on commit 7cfc9d4

Please sign in to comment.