Skip to content

Commit

Permalink
Merge branch 'main' into change_meme
Browse files Browse the repository at this point in the history
  • Loading branch information
delovoyhomie authored Sep 12, 2024
2 parents 9337baa + 4ee620d commit 750882e
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 15 deletions.
2 changes: 1 addition & 1 deletion backends/defillama/tvl.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ def get_tvl_before(history, timestamp):
'User-Agent': 'TheOpenLeague',
'Accept': '*/*'
}).json()
tvl_history = res['chainTvls']['TON']['tvl']
tvl_history = res['chainTvls'][project.chain]['tvl']
snapshot_tvl = get_tvl_before(tvl_history, config.start_time)
latest_tvl = get_tvl_before(tvl_history, config.end_time)
correction_latest = -1 * excluded_current.get(project.name, 0)
Expand Down
6 changes: 4 additions & 2 deletions backends/toncenter_cpp/apps_v2_projects.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,10 @@ def _do_calculate(self, config: SeasonConfig, dry_run: bool = False):
with project_names as (
{PROJECTS_NAMES}
)
select project, url, 0 as total_uaw, 0 as enrolled_wallets, 0.0 as average_score
from project_names order by md5(project)
select project, url, count(distinct address) as total_uaw, 0 as enrolled_wallets, 0.0 as average_score
from project_names
left join tol.apps_users_stats_{config.safe_season_name()} using(project)
group by 1, 2
"""
logger.info(f"Generated SQL: {SQL}")

Expand Down
1 change: 1 addition & 0 deletions models/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,4 @@ class DeFi(Project):
defillama_slug: str # Defillama slug
prizes: bool = True # flat to ignore project in reward calculation
category: str = "dexs" # category for the project (for the Volume Leaderboard)
chain: str = "TON" # Chain for TVL queries - allows to override default TON into TON-Staking
3 changes: 2 additions & 1 deletion projects/defi/JVault.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@
JVault = DeFi(
name='JVault',
defillama_slug='jvault',
url='https://jvault.xyz'
url='https://jvault.xyz',
chain='TON-staking'
)
2 changes: 1 addition & 1 deletion seasons/app_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,4 @@ def __init__(self):
super().__init__()

def calculate(self, metrics: List[ProjectStat]):
return metrics
return sorted(metrics, key=lambda m: m.metrics[ProjectStat.APP_ONCHAIN_UAW], reverse=True)
2 changes: 1 addition & 1 deletion seasons/s6.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@
MemeTv,
],
score_model=AppLeaderboardModelS6(),
enrollment_sbt="EQAab9xw8NOPvIIxv6wxiDNOGLCLGClA1I4vVUPLqceCh_Z7"
enrollment_sbt="EQDZ81ZvxRfutjkALcUK0q3Cuusm1XtmhEwUiGSeviLpPARH"
)

S6_nfts = SeasonConfig(
Expand Down
12 changes: 3 additions & 9 deletions test_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,25 +13,19 @@
from backends.sbt_enrollment import SBTEnrollmentSync
from backends.redoubt.apps import RedoubtAppBackend
from backends.redoubt.apps_v2 import RedoubtAppBackendV2
from backends.toncenter_cpp.apps_v2_users import ToncenterCppAppBackendV2Users
from backends.toncenter_cpp.nfts import ToncenterCppNFTsBackend
from backends.redoubt.tokens import RedoubtTokensBackend
from backends.tonapi import TonapiAdapter
from backends.toncenter_cpp.apps_v2_projects import ToncenterCppAppsScores2Projects
from models.render_method import JsonRenderMethod, HTMLRenderMethod
from models.season_config import SeasonConfig
from seasons.s5 import S5_apps, S5_tokens
from seasons.s6 import S6_apps, S6_nfts, S6_defi_tvl, S6_defi_volume

if __name__ == "__main__":
with psycopg2.connect() as conn:
if sys.argv[1] == 'tokens':
backend = RedoubtTokensBackend(conn)
season = S5_tokens
elif sys.argv[1] == 'apps':
backend = RedoubtAppBackend(conn)
season = S5_apps
elif sys.argv[1] == 'apps_v2':
backend = RedoubtAppBackendV2(conn)
if sys.argv[1] == 'apps_v2':
backend = ToncenterCppAppBackendV2Users(conn)
season = S6_apps
backend.calculate(season, dry_run=len(sys.argv) > 2 and sys.argv[2] == '--dryrun')
sys.exit(0)
Expand Down

0 comments on commit 750882e

Please sign in to comment.