Skip to content

Commit d6f20e8

Browse files
committed
feat: upgrade contract
1 parent 4493e36 commit d6f20e8

File tree

11 files changed

+120
-54
lines changed

11 files changed

+120
-54
lines changed

deployments/mainnet/declarations.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"pragma_Oracle": "0x1cc1ca67aba8b62b6b310fa2c8a18773b1787465712eaa87c6db0b4c297278e",
2+
"pragma_Oracle": "0x51301fec671d8f523d0afd030164c74660db428de8136873b1de9583c3f5412",
33
"pragma_Ownable": "0x7b50a7a9bbb75d08248135003f1c87f0d44ba23018dc0ca480ac37a901531f3",
44
"pragma_PublisherRegistry": "0x306288971002bd7906e3a607d504dfb28dcbdc7655a115984e567dce3b67e8f",
55
"pragma_SummaryStats": "0x3b5bf1c2f918de14620b3c63e2c6543cf0a138df258bce3d03e3fb0b7d2183a",

pragma-deployer/pragma_deployer/add_pairs.py

Lines changed: 88 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -62,49 +62,98 @@
6262
0x0000000000000000000000000000000000000000,
6363
)
6464
XWBTC = Currency(
65-
"CONVERSION_xWBTC",
65+
"CONVERSION_XWBTC",
6666
8,
6767
0,
6868
0x6a567e68c805323525fe1649adb80b03cddf92c23d2629a6779f54192dffc13,
6969
0x0000000000000000000000000000000000000000,
7070
)
7171
XTBTC = Currency(
72-
"CONVERSION_xtBTC",
72+
"CONVERSION_XTBTC",
7373
18,
7474
0,
7575
0x43a35c1425a0125ef8c171f1a75c6f31ef8648edcc8324b55ce1917db3f9b91,
7676
0x0000000000000000000000000000000000000000,
7777
)
7878
XLBTC = Currency(
79-
"CONVERSION_xLBTC",
79+
"CONVERSION_XLBTC",
8080
8,
8181
0,
8282
0x7dd3c80de9fcc5545f0cb83678826819c79619ed7992cc06ff81fc67cd2efe0,
8383
0x0000000000000000000000000000000000000000,
8484
)
8585
XSBTC = Currency(
86-
"CONVERSION_xsBTC",
86+
"CONVERSION_XSBTC",
8787
18,
8888
0,
8989
0x580f3dc564a7b82f21d40d404b3842d490ae7205e6ac07b1b7af2b4a5183dc9,
9090
0x0000000000000000000000000000000000000000,
9191
)
9292

93+
# New currencies
94+
MRE7BTC = Currency(
95+
"MRE7BTC",
96+
18,
97+
0,
98+
0x0, # Replace with actual starknet_address if available
99+
0x0000000000000000000000000000000000000000,
100+
)
101+
MRE7YIELD = Currency(
102+
"MRE7YIELD",
103+
18,
104+
0,
105+
0x0, # Replace with actual starknet_address if available
106+
0x0000000000000000000000000000000000000000,
107+
)
108+
LBTC = Currency(
109+
"LBTC",
110+
8,
111+
0,
112+
0x0, # Replace with actual starknet_address if available
113+
0x0000000000000000000000000000000000000000,
114+
)
115+
UNIBTC = Currency(
116+
"UNIBTC",
117+
8,
118+
0,
119+
0x0, # Replace with actual starknet_address if available
120+
0x0000000000000000000000000000000000000000,
121+
)
122+
93123
# BTC LST pairs
94124
xwbtc_usd_pair = Pair(XWBTC, USD)
95125
xtbtc_usd_pair = Pair(XTBTC, USD)
96126
xlbtc_usd_pair = Pair(XLBTC, USD)
97127
xsbtc_usd_pair = Pair(XSBTC, USD)
98128

129+
# New pairs
130+
mre7btc_usd_pair = Pair(MRE7BTC, USD)
131+
mre7yield_usd_pair = Pair(MRE7YIELD, USD)
132+
lbtc_usd_pair = Pair(LBTC, USD)
133+
unibtc_usd_pair = Pair(UNIBTC, USD)
134+
99135
CURRENCIES_TO_ADD = [XWBTC, XTBTC, XLBTC, XSBTC]
100136

101-
PAIRS_TO_ADD = [xwbtc_usd_pair, xtbtc_usd_pair, xlbtc_usd_pair, xsbtc_usd_pair]
137+
PAIRS_TO_ADD = [
138+
xwbtc_usd_pair,
139+
xtbtc_usd_pair,
140+
xlbtc_usd_pair,
141+
xsbtc_usd_pair,
142+
]
102143

103144
PAIRS_TO_UPDATE = [
104-
# {
105-
# "pair_id": "1629317993172502401860",
106-
# "pair": ["1629317993172502401860", USD.id, XSTRK.id]
107-
# }
145+
{
146+
"pair_id": 384270964630611589151504336040458606883082949444,
147+
"pair": [384270964630611589151504336040458606883082949444, XWBTC.id, USD.id],
148+
},
149+
{
150+
"pair_id": 384270964630611589151504336040242434100969165636,
151+
"pair": [384270964630611589151504336040242434100969165636, XTBTC.id, USD.id],
152+
},
153+
{
154+
"pair_id": 384270964630611589151504336039665973348665742148,
155+
"pair": [384270964630611589151504336039665973348665742148, XLBTC.id, USD.id],
156+
},
108157
# Pair(XSTRK, USD),
109158
# Pair("SSTRK/USD", "SSTRK", "USD"),
110159
# Pair("WSTETH/USD", "WSTETH", "USD"),
@@ -116,16 +165,17 @@ async def main(port: Optional[int]) -> None:
116165
Main function to add currencies and pairs, and update pairs.
117166
"""
118167
# Add Currencies
119-
for currency in CURRENCIES_TO_ADD:
120-
tx_hash = await invoke(
121-
"pragma_Oracle",
122-
"add_currency",
123-
currency.serialize(),
124-
port=port,
125-
)
126-
logger.info(f"Added currency {currency} with tx hash {hex(tx_hash)}")
127-
128-
# Update Pairs
168+
# for currency in CURRENCIES_TO_ADD:
169+
# tx_hash = await invoke(
170+
# "pragma_Oracle",
171+
# "add_currency",
172+
# currency.serialize(),
173+
# port=port,
174+
# )
175+
# await asyncio.sleep(1)
176+
# logger.info(f"Added currency {currency} with tx hash {hex(tx_hash)}")
177+
178+
# # Update Pairs
129179
for pair in PAIRS_TO_UPDATE:
130180
tx_hash = await invoke(
131181
"pragma_Oracle",
@@ -135,15 +185,25 @@ async def main(port: Optional[int]) -> None:
135185
)
136186
logger.info(f"Updated pair {pair} with tx hash {hex(tx_hash)}")
137187

138-
# Add Pairs
139-
for pair in PAIRS_TO_ADD:
140-
tx_hash = await invoke(
141-
"pragma_Oracle",
142-
"add_pair",
143-
pair.serialize(),
144-
port=port,
145-
)
146-
logger.info(f"Added pair {pair} with tx hash {hex(tx_hash)}")
188+
# # Add Pairs
189+
# for pair in PAIRS_TO_ADD[2:]:
190+
# tx_hash = await invoke(
191+
# "pragma_Oracle",
192+
# "add_pair",
193+
# (pair.id, pair.quote_currency.id, pair.base_currency.id),
194+
# port=port,
195+
# )
196+
# await asyncio.sleep(1)
197+
# logger.info(f"Added pair {pair} with tx hash {hex(tx_hash)}")
198+
199+
# for pair in PAIRS_TO_ADD:
200+
# tx_hash = await invoke(
201+
# "pragma_Oracle",
202+
# "add_registered_conversion_rate_pair",
203+
# [pair.id],
204+
# port=port,
205+
# )
206+
# logger.info(f"Added conversion rate pair {pair} with tx hash {hex(tx_hash)}")
147207

148208

149209
@click.command()

pragma-deployer/pragma_deployer/deploy_mock_pool.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
NETWORK,
1414
)
1515
from pragma_deployer.utils.starknet import (
16-
declare_v2,
16+
declare_v3,
1717
dump_declarations,
1818
dump_deployments,
1919
get_deployments,
@@ -38,7 +38,7 @@ async def main(port: Optional[int]) -> None:
3838

3939
# Declaration
4040
class_hash = {
41-
contract["contract_name"]: await declare_v2(contract["contract_name"], port)
41+
contract["contract_name"]: await declare_v3(contract["contract_name"], port)
4242
for contract in COMPILED_CONTRACTS
4343
}
4444
dump_declarations(class_hash)

pragma-deployer/pragma_deployer/deploy_pragma.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
dump_declarations,
1818
dump_deployments,
1919
get_starknet_account,
20-
declare_v2,
20+
declare_v3,
2121
deploy_v2,
2222
)
2323

@@ -36,7 +36,7 @@ async def main(port: Optional[int]) -> None:
3636
logger.info(f"ℹ️ Using account {hex(account.address)} as deployer")
3737

3838
class_hash = {
39-
contract["contract_name"]: await declare_v2(contract["contract_name"], port)
39+
contract["contract_name"]: await declare_v3(contract["contract_name"], port)
4040
for contract in COMPILED_CONTRACTS
4141
}
4242
dump_declarations(class_hash)

pragma-deployer/pragma_deployer/deploy_randomness.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
get_deployments,
1919
get_starknet_account,
2020
deploy_v2,
21-
declare_v2,
21+
declare_v3,
2222
dump_declarations,
2323
)
2424

@@ -39,7 +39,7 @@ async def main(port: Optional[int]) -> None:
3939

4040
if port is not None:
4141
class_hash = {
42-
contract["contract_name"]: await declare_v2(
42+
contract["contract_name"]: await declare_v3(
4343
contract["contract_name"], port=port
4444
)
4545
for contract in COMPILED_CONTRACTS

pragma-deployer/pragma_deployer/deploy_randomness_example.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
get_deployments,
1818
get_starknet_account,
1919
deploy_v2,
20-
declare_v2,
20+
declare_v3,
2121
dump_declarations,
2222
)
2323

@@ -37,7 +37,7 @@ async def main(port: Optional[int]) -> None:
3737

3838
if port is not None:
3939
class_hash = {
40-
contract["contract_name"]: await declare_v2(
40+
contract["contract_name"]: await declare_v3(
4141
contract["contract_name"], port=port
4242
)
4343
for contract in COMPILED_CONTRACTS

pragma-deployer/pragma_deployer/deploy_summary_stats.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
NETWORK,
1414
)
1515
from pragma_deployer.utils.starknet import (
16-
declare_v2,
16+
declare_v3,
1717
dump_declarations,
1818
dump_deployments,
1919
get_deployments,
@@ -38,7 +38,7 @@ async def main(port: Optional[int]) -> None:
3838

3939
# Declaration
4040
class_hash = {
41-
contract["contract_name"]: await declare_v2(contract["contract_name"], port)
41+
contract["contract_name"]: await declare_v3(contract["contract_name"], port)
4242
for contract in COMPILED_CONTRACTS
4343
}
4444
dump_declarations(class_hash)

pragma-deployer/pragma_deployer/register_publishers.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,9 @@
4848
"UPBIT",
4949
"LBANK",
5050
"BITGET",
51+
"RE7_ONCHAIN",
52+
"CHAINLINK",
53+
"REDSTONE"
5154
]
5255

5356
DEX_SOURCES = ["MYSWAP", "MYSWAPV2", "EKUBO", "SITHSWAP", "JEDISWAP", "10KSWAP"]

pragma-deployer/pragma_deployer/register_tokenized_vault.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,19 +29,23 @@
2929
# },
3030
# BTC LST tokens
3131
{
32-
"name": "xWBTC",
32+
"name": "CONVERSION_XWBTC",
33+
"underlying_token": "BTC",
3334
"address": 0x6a567e68c805323525fe1649adb80b03cddf92c23d2629a6779f54192dffc13,
3435
},
3536
{
36-
"name": "xtBTC",
37+
"name": "CONVERSION_XTBTC",
38+
"underlying_token": "BTC",
3739
"address": 0x43a35c1425a0125ef8c171f1a75c6f31ef8648edcc8324b55ce1917db3f9b91,
3840
},
3941
{
40-
"name": "xLBTC",
42+
"name": "CONVERSION_XLBTC",
43+
"underlying_token": "BTC",
4144
"address": 0x7dd3c80de9fcc5545f0cb83678826819c79619ed7992cc06ff81fc67cd2efe0,
4245
},
4346
{
44-
"name": "xsBTC",
47+
"name": "CONVERSION_XSBTC",
48+
"underlying_token": "BTC",
4549
"address": 0x580f3dc564a7b82f21d40d404b3842d490ae7205e6ac07b1b7af2b4a5183dc9,
4650
},
4751
# {
@@ -64,7 +68,7 @@ async def main(port: Optional[int]) -> None:
6468
tx_hash = await invoke(
6569
"pragma_Oracle",
6670
"register_tokenized_vault",
67-
[token["name"], token["address"]],
71+
[token["name"], token["underlying_token"], token["address"]],
6872
port=port,
6973
)
7074
logger.info(f"Registered tokenized vault {token['name']} with tx {hex(tx_hash)}")

pragma-deployer/pragma_deployer/upgrade_pragma.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
get_declarations,
1717
get_starknet_account,
1818
invoke,
19-
declare_v2,
19+
declare_v3,
2020
)
2121

2222
load_dotenv()
@@ -38,7 +38,7 @@ async def main(port: Optional[int]) -> None:
3838
cur_class_hash = declarations["pragma_Oracle"]
3939
logger.info(f"ℹ️ Current implementation hash: {hex(cur_class_hash)}")
4040

41-
new_implementation_hash = await declare_v2("pragma_Oracle", port=port)
41+
new_implementation_hash = await declare_v3("pragma_Oracle", port=port)
4242
logger.info(f"ℹ️ New implementation hash: {hex(new_implementation_hash)}")
4343

4444
tx_hash = await invoke(

0 commit comments

Comments
 (0)