Skip to content

Commit

Permalink
Add UTONIC
Browse files Browse the repository at this point in the history
  • Loading branch information
shuva10v committed Nov 30, 2024
1 parent af5edff commit 829a7a6
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 2 deletions.
7 changes: 7 additions & 0 deletions projects/defi/UTONIC.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
from models.project import DeFi

UTONIC = DeFi(
name='utonic',
defillama_slug='utonic',
url='https://utonic.org/home'
)
9 changes: 8 additions & 1 deletion seasons/S7_defi_scores.md
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,12 @@ Users hold LP tokens [Crouton LP](https://tonviewer.com/EQB7Orui1z_dKONoHuglvi2b
- User impact is equal to `Crouton LP balance increase` / `Total supply of Crouton LP` * `Total TVL`


### UTONIC

[UTONIC](https://utonic.finance/) allows to deposit TON/stTON/tsTON to the pool and receive uTON as a reward.
User impact is calculated as mints minus burns for each user.


Full list of participants and their impact on TVL could be obtained by [this query](sql/s7_defi_tvl.sql).


Expand Down Expand Up @@ -184,4 +190,5 @@ Full list of participants and their impact on TVL could be obtained by [this que
|Coffin|TVL|5|
|TONCO|TVL|10|
|Farmix|TVL|10|
|Crouton|TVL|10|
|Crouton|TVL|10|
|UTONIC|TVL|10|
3 changes: 2 additions & 1 deletion seasons/s7.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
S7 season config
"""
from models.season_config import SeasonConfig
from projects.defi.UTONIC import UTONIC
from projects.defi.Farmix import Farmix
from projects.defi.Coffin import Coffin
from projects.defi.SwapCoffee import SwapCoffeeVolume, SwapCoffeeTVL
Expand Down Expand Up @@ -35,7 +36,7 @@
DAOLama, SettleTON, JVault,
TONHedge, TonStable, Parraton, TonPools,
AquaProtocol, SwapCoffeeTVL, Coffin, TONCO, Farmix,
Crouton
Crouton, UTONIC
],
score_model=DeFiTVLContribution(squads=[
(lambda tvl: tvl >= 5e6, "Over 5M$"),
Expand Down
25 changes: 25 additions & 0 deletions seasons/sql/s7_defi_tvl.sql
Original file line number Diff line number Diff line change
Expand Up @@ -473,6 +473,29 @@ tonco_collections as (
cross join crouton_total_supply
cross join crouton_total_tvl
group by 1
), utonic_flow as (
-- get all mints and burns during the period
select "owner" as address, amount,
utime as event_time from parsed.jetton_mint jm
where jetton_master_address = upper('0:1f1798f724c2296652e6002bfb51bed11fb5a689532e5788af7203581ef367a8')
and utime >= 1732705200 and utime < 1734433200 and successful

union all

-- burns come with negative amount
select "owner" as address, -1 * amount as amount,
tx_now as event_time from public.jetton_burns
where jetton_master_address = upper('0:1f1798f724c2296652e6002bfb51bed11fb5a689532e5788af7203581ef367a8')
and tx_now >= 1732705200 and tx_now < 1734433200 and not tx_aborted
), uton_price as (
-- uTON is traded on DEXs so will get price from the agg_prices just before the period end
select coalesce((select price_usd from prices.agg_prices ap where ap.base = upper('0:1f1798f724c2296652e6002bfb51bed11fb5a689532e5788af7203581ef367a8')
and price_time < 1734433200 order by price_time desc limit 1), 0) as price
), utonic_impact as (
-- final user impact - sum of all mints and burns (with negative value of the amount) converted to USD using DEX price
select address, sum(amount) * (select price from uton_price) / 1e6 as tvl_impact, count(1), min(event_time) as min_utime, max(event_time) as max_utime
from utonic_flow
group by 1
), all_projects_impact as (
select 'jVault' as project, *, floor(tvl_impact / 20.) * 5 as points from jvault_impact
union all
Expand All @@ -499,6 +522,8 @@ tonco_collections as (
select 'Farmix' as project, *, floor(tvl_impact / 20.) * 10 as points from farmix_impact
union all
select 'Crouton' as project, *, floor(tvl_impact / 20.) * 10 as points from crouton_impact
union all
select 'UTONIC' as project, *, floor(tvl_impact / 20.) * 10 as points from utonic_impact
)
select extract(epoch from now())::integer as score_time, p.address, project, points, tvl_impact as "value", "count", min_utime, max_utime
from all_projects_impact p
Expand Down

0 comments on commit 829a7a6

Please sign in to comment.