Skip to content

Commit 7c22536

Browse files
authored
Merge pull request #98 from silo-finance/main
Feature: Silo Finance integration
2 parents 4d16247 + c2bb65a commit 7c22536

File tree

8 files changed

+3294
-6
lines changed

8 files changed

+3294
-6
lines changed

abi/ISilo.json

Lines changed: 2823 additions & 0 deletions
Large diffs are not rendered by default.

constants/silo_finance.py

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
from dataclasses import dataclass
2+
3+
from integrations.integration_ids import IntegrationID as IntID
4+
5+
6+
@dataclass
7+
class SiloFinanceMarket:
8+
address: str
9+
start_block: int
10+
non_borrowable_token_address: str
11+
shares_decimals: int
12+
assets_decimals: int
13+
14+
15+
PAGINATION_SIZE = 1000
16+
17+
18+
SILO_FINANCE_MARKETS = [
19+
# https://etherscan.io/address/0xB0291953571aF3D51EdfE9DAA94beDfa7C8aaf94
20+
SiloFinanceMarket(
21+
address="0xB0291953571aF3D51EdfE9DAA94beDfa7C8aaf94",
22+
start_block=22693183,
23+
non_borrowable_token_address="0x98732e72D33279488FebCCa58628C83574699160",
24+
shares_decimals=21,
25+
assets_decimals=18,
26+
),
27+
# https://etherscan.io/address/0x46d30718F0372713b989F91f9f0Be1Bf5Cf5F082
28+
SiloFinanceMarket(
29+
address="0x46d30718F0372713b989F91f9f0Be1Bf5Cf5F082",
30+
start_block=22694943,
31+
non_borrowable_token_address="0x7a3E2284DB8F2b9d6Bcc54faB182284FaC53f51b",
32+
shares_decimals=21,
33+
assets_decimals=18,
34+
),
35+
# https://etherscan.io/address/0x4902F25cf6486840F9dED17A6b3AF74fE107fffc
36+
SiloFinanceMarket(
37+
address="0x4902F25cf6486840F9dED17A6b3AF74fE107fffc",
38+
start_block=22694943,
39+
non_borrowable_token_address="0x35BA9aB715a8eC58e6C972Af9D57f2D7B710BDf8",
40+
shares_decimals=21,
41+
assets_decimals=18,
42+
),
43+
]
44+
45+
SILO_FINANCE_INTEGRATION_ID_TO_MARKET = {
46+
IntID.SILO_FINANCE_LP_SUSDE_SEP_25_EXPIRY: SILO_FINANCE_MARKETS[0],
47+
IntID.SILO_FINANCE_LP_SUSDE_JUL_31_EXPIRY: SILO_FINANCE_MARKETS[1],
48+
IntID.SILO_FINANCE_LP_EUSDE_AUG_14_EXPIRY: SILO_FINANCE_MARKETS[2],
49+
}
50+
51+
# NOTE: the first deployment block is the earliest block where any of the markets are deployed
52+
SILO_FINANCE_INTEGRATION_ID_TO_START_BLOCK = {
53+
IntID.SILO_FINANCE_LP_SUSDE_SEP_25_EXPIRY: SILO_FINANCE_MARKETS[0].start_block,
54+
IntID.SILO_FINANCE_LP_SUSDE_JUL_31_EXPIRY: SILO_FINANCE_MARKETS[1].start_block,
55+
IntID.SILO_FINANCE_LP_EUSDE_AUG_14_EXPIRY: SILO_FINANCE_MARKETS[2].start_block,
56+
}

constants/summary_columns.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,24 @@ class SummaryColumn(Enum):
7070

7171
MORPHO_SUSDE_SUSDS_PTS = ("morpho_susde_susds_pts", SummaryColumnType.ETHENA_PTS)
7272

73+
# Silo Finance LP-sUSDe (25 Sep 2025)
74+
SILO_FINANCE_LP_SUSDE_SEP_25_EXPIRY_PTS = (
75+
"silo_finance_lp_usde_sep_25_expiry_pts",
76+
SummaryColumnType.ETHENA_PTS,
77+
)
78+
79+
# Silo Finance LP-sUSDe (31 Jul 2025)
80+
SILO_FINANCE_LP_SUSDE_JUL_31_PTS = (
81+
"silo_finance_lp_susde_jul_25_pts",
82+
SummaryColumnType.ETHENA_PTS,
83+
)
84+
85+
# Silo Finance LP-eUSDe (14 Aug 2025)
86+
SILO_FINANCE_LP_EUSDE_AUG_14_PTS = (
87+
"silo_finance_lp_usde_aug_25_pts",
88+
SummaryColumnType.ETHENA_PTS,
89+
)
90+
7391
def __init__(self, column_name: str, col_type: SummaryColumnType):
7492
self.column_name = column_name
7593
self.col_type = col_type

integrations/integration_ids.py

Lines changed: 34 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ class IntegrationID(Enum):
7373
"Thala sUSDe/USDC LP",
7474
Token.SUSDE,
7575
)
76-
76+
7777
# Echelon
7878
ECHELON_SUSDE_COLLATERAL = (
7979
"echelon_susde_collateral",
@@ -398,8 +398,16 @@ class IntegrationID(Enum):
398398

399399
# Inverse Finance FiRM
400400
FIRM_SUSDE = ("firm_susde", "Inverse Finance FiRM sUSDe", Token.SUSDE)
401-
FIRM_SUSDE_DOLA_CLP = ("firm_susde_dola_clp", "Inverse Finance FiRM sUSDe/DOLA CLP", Token.SUSDE)
402-
FIRM_YV_SUSDE_DOLA_CLP = ("firm_yv_susde_dola_clp", "Inverse Finance FiRM YV sUSDe/DOLA CLP", Token.SUSDE)
401+
FIRM_SUSDE_DOLA_CLP = (
402+
"firm_susde_dola_clp",
403+
"Inverse Finance FiRM sUSDe/DOLA CLP",
404+
Token.SUSDE,
405+
)
406+
FIRM_YV_SUSDE_DOLA_CLP = (
407+
"firm_yv_susde_dola_clp",
408+
"Inverse Finance FiRM YV sUSDe/DOLA CLP",
409+
Token.SUSDE,
410+
)
403411

404412
# Hyperdrive
405413
HYPERDRIVE_SUSDE = (
@@ -427,7 +435,7 @@ class IntegrationID(Enum):
427435
)
428436

429437
# Zerolend
430-
ZEROLEND_SUSDE = ("zerolend_susde_deposit","Zerolend sUSDe",Token.SUSDE)
438+
ZEROLEND_SUSDE = ("zerolend_susde_deposit", "Zerolend sUSDe", Token.SUSDE)
431439
ZEROLEND_USDE = ("zerolend_usde_deposit", "Zerolend USDe", Token.USDE)
432440

433441
KAMINO_SUSDE_COLLATERAL_EXAMPLE = (
@@ -443,7 +451,6 @@ class IntegrationID(Enum):
443451
# STON.fi
444452
STONFI_USDE = ("stonfi_usde", "STON.fi USDe", Token.USDE)
445453

446-
447454
# Upshift sUSDe
448455
UPSHIFT_UPSUSDE = ("upshift_upsusde", "Upshift upsUSDe", Token.SUSDE)
449456

@@ -465,7 +472,7 @@ class IntegrationID(Enum):
465472
RUMPEL_SENA_LP = (
466473
"rumpel_kpsats3_sena_lp_held",
467474
"Rumpel kpSATS-3/sENA LP",
468-
Token.SENA
475+
Token.SENA,
469476
)
470477

471478
# InfinityPools
@@ -498,6 +505,27 @@ class IntegrationID(Enum):
498505
Token.SUSDE,
499506
)
500507

508+
# Silo Finance LP-sUSDe (25 Sep 2025)
509+
SILO_FINANCE_LP_SUSDE_SEP_25_EXPIRY = (
510+
"silo_finance_lp_susde_sep_25_expiry",
511+
"Silo Finance LP-sUSDe (Sep 25)",
512+
Token.SUSDE,
513+
)
514+
515+
# Silo Finance LP-sUSDe (31 Jul 2025)
516+
SILO_FINANCE_LP_SUSDE_JUL_31_EXPIRY = (
517+
"silo_finance_lp_susde_jul_31_expiry",
518+
"Silo Finance LP-sUSDe (Jul 31)",
519+
Token.SUSDE,
520+
)
521+
522+
# Silo Finance LP-eUSDe (14 Aug 2025)
523+
SILO_FINANCE_LP_EUSDE_AUG_14_EXPIRY = (
524+
"silo_finance_lp_eusde_aug_14_expiry",
525+
"Silo Finance LP-eUSDe (Aug 14)",
526+
Token.USDE,
527+
)
528+
501529
def __init__(self, column_name: str, description: str, token: Token = Token.USDE):
502530
self.column_name = column_name
503531
self.description = description
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
from rich.console import Console
2+
3+
from constants.silo_finance import SILO_FINANCE_INTEGRATION_ID_TO_START_BLOCK
4+
from constants.summary_columns import SummaryColumn
5+
from integrations.integration_ids import IntegrationID as IntID
6+
from constants.chains import Chain
7+
from utils.silo_finance import SiloFinance
8+
9+
if __name__ == "__main__":
10+
console = Console()
11+
integration_id = IntID.SILO_FINANCE_LP_EUSDE_AUG_14_EXPIRY
12+
integration = SiloFinance(
13+
integration_id=integration_id,
14+
start_block=SILO_FINANCE_INTEGRATION_ID_TO_START_BLOCK[integration_id],
15+
chain=Chain.ETHEREUM,
16+
summary_cols=[SummaryColumn.SILO_FINANCE_LP_EUSDE_AUG_14_PTS],
17+
reward_multiplier=30,
18+
balance_multiplier=1,
19+
)
20+
21+
# Without cached data
22+
without_cached_data_output = integration.get_block_balances(
23+
cached_data={}, blocks=[22726278]
24+
)
25+
console.print("Run without cached data", without_cached_data_output)
26+
# Check that the output is correct~ish
27+
assert without_cached_data_output[22726278] == {
28+
"0xdEDcF5806c4968C6397eeE97e68047bdA339d0c1": 4.0
29+
}
30+
31+
# Use cache data to get the next blocks
32+
with_cached_data_output = integration.get_block_balances(
33+
cached_data=without_cached_data_output,
34+
blocks=[22740147],
35+
)
36+
console.print("Run with cached data", with_cached_data_output)
37+
assert with_cached_data_output[22740147] == {
38+
"0xdEDcF5806c4968C6397eeE97e68047bdA339d0c1": 5.0,
39+
"0x62a4A8f9f5F3AaE9Ee9CEE780285A0D501C12d09": 25.447709,
40+
}
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
from rich.console import Console
2+
3+
from constants.silo_finance import SILO_FINANCE_INTEGRATION_ID_TO_START_BLOCK
4+
from constants.summary_columns import SummaryColumn
5+
from integrations.integration_ids import IntegrationID as IntID
6+
from constants.chains import Chain
7+
from utils.silo_finance import SiloFinance
8+
9+
if __name__ == "__main__":
10+
console = Console()
11+
integration_id = IntID.SILO_FINANCE_LP_SUSDE_JUL_31_EXPIRY
12+
integration = SiloFinance(
13+
integration_id=integration_id,
14+
start_block=SILO_FINANCE_INTEGRATION_ID_TO_START_BLOCK[integration_id],
15+
chain=Chain.ETHEREUM,
16+
summary_cols=[SummaryColumn.SILO_FINANCE_LP_SUSDE_JUL_31_PTS],
17+
reward_multiplier=30,
18+
balance_multiplier=1,
19+
)
20+
21+
# Without cached data
22+
without_cached_data_output = integration.get_block_balances(
23+
cached_data={}, blocks=[22726532]
24+
)
25+
console.print("Run without cached data", without_cached_data_output)
26+
# Check that the output is correct~ish
27+
assert without_cached_data_output[22726532] == {
28+
"0x791D1ec51D931186c1d4B80E753B7155DD98f741": 5.0
29+
}
30+
31+
# Use cache data to get the next blocks
32+
with_cached_data_output = integration.get_block_balances(
33+
cached_data=without_cached_data_output,
34+
blocks=[22767688],
35+
)
36+
console.print("Run with cached data", with_cached_data_output)
37+
assert with_cached_data_output[22767688] == {
38+
"0x791D1ec51D931186c1d4B80E753B7155DD98f741": 0.0,
39+
"0x62a4A8f9f5F3AaE9Ee9CEE780285A0D501C12d09": 17.71744,
40+
"0x7FDe637d685A5486CCb1B0a8eF658Ad1a08e8337": 234388.684906,
41+
}
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
import logging
2+
from rich.console import Console
3+
4+
from constants.silo_finance import SILO_FINANCE_INTEGRATION_ID_TO_START_BLOCK
5+
from constants.summary_columns import SummaryColumn
6+
from integrations.integration_ids import IntegrationID as IntID
7+
from constants.chains import Chain
8+
from utils.silo_finance import SiloFinance
9+
10+
logger = logging.getLogger("Silo Finance LP-eUSDe")
11+
logger.setLevel(logging.INFO)
12+
13+
if __name__ == "__main__":
14+
console = Console()
15+
16+
integration = SiloFinance(
17+
integration_id=IntID.SILO_FINANCE_LP_SUSDE_SEP_25_EXPIRY,
18+
start_block=SILO_FINANCE_INTEGRATION_ID_TO_START_BLOCK[
19+
IntID.SILO_FINANCE_LP_SUSDE_SEP_25_EXPIRY
20+
],
21+
chain=Chain.ETHEREUM,
22+
summary_cols=[SummaryColumn.SILO_FINANCE_LP_SUSDE_SEP_25_EXPIRY_PTS],
23+
reward_multiplier=30,
24+
balance_multiplier=1,
25+
)
26+
27+
# Without cached data
28+
without_cached_data_output = integration.get_block_balances(
29+
cached_data={}, blocks=[22693183, 22755000]
30+
)
31+
console.print("Run without cached data", without_cached_data_output)
32+
# Check that the output is correct~ish
33+
assert without_cached_data_output[22755000] == {
34+
"0x62a4A8f9f5F3AaE9Ee9CEE780285A0D501C12d09": 18.194513,
35+
"0xeb80e76443c1bFa85dF46075f52a43ae1572003a": 30578.64522,
36+
}
37+
38+
# Use cache data to get the next blocks
39+
with_cached_data_output = integration.get_block_balances(
40+
cached_data=without_cached_data_output,
41+
blocks=[22814115],
42+
)
43+
console.print("Run with cached data", with_cached_data_output)
44+
assert with_cached_data_output[22814115] == {
45+
"0x62a4A8f9f5F3AaE9Ee9CEE780285A0D501C12d09": 18.194513,
46+
"0xeb80e76443c1bFa85dF46075f52a43ae1572003a": 30578.64522,
47+
"0x432FD970d8867b56e7197290BCd03C92A325AB7b": 620.451445,
48+
"0xdD84Ce1aDcb3A4908Db61A1dFA3353C3974c5a2B": 145426.301041,
49+
"0x8467241838Bc761D9Ef4F8ae6790Ede292fbA2F9": 1e-6,
50+
"0x23ce39C9AB29D00fCa9B83a50F64A67837c757C5": 4759.421793,
51+
}

0 commit comments

Comments
 (0)