Skip to content

Commit

Permalink
📚 new sepolia deployment
Browse files Browse the repository at this point in the history
  • Loading branch information
EvolveArt committed Jan 7, 2024
1 parent d71e9ad commit ddb5aad
Show file tree
Hide file tree
Showing 6 changed files with 87 additions and 82 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,10 @@ Deployment addresses
This repo will gradually replace the previous Pragma implementation in Cairo 0 which you can find [here](https://github.com/Astraly-Labs/pragma-contracts).

**Starknet Sepolia**
- Oracle : [0x5acaa0ef3a6837c98ddeae516fa3f6022018cf646914d921842e46fc00c35d3](https://sepolia.voyager.online/contract/0x5acaa0ef3a6837c98ddeae516fa3f6022018cf646914d921842e46fc00c35d3)
- Publisher Registry : [0x732b618bc92e3919e28dd3b3aff21079b2507c1f51b8a194ce90300e995cb](https://sepolia.voyager.online/contract/0x732b618bc92e3919e28dd3b3aff21079b2507c1f51b8a194ce90300e995cb)
- Summary Stats : [0x185b147a3e03043e0232ec6fcf17143614481cc29a505c7d9c4b29e98c1f14e](https://sepolia.voyager.online/contract/0x185b147a3e03043e0232ec6fcf17143614481cc29a505c7d9c4b29e98c1f14e)
- VRF : [0x556bd6988d786777bb5b1ee337c63f60f30d8200818b59b29e54afc27266a46](https://sepolia.voyager.online/contract/0x556bd6988d786777bb5b1ee337c63f60f30d8200818b59b29e54afc27266a46)
- Oracle : [0x36031daa264c24520b11d93af622c848b2499b66b41d611bac95e13cfca131a](https://sepolia.voyager.online/contract/0x36031daa264c24520b11d93af622c848b2499b66b41d611bac95e13cfca131a)
- Publisher Registry : [0x1b08e27ab436cd491631156da5f3aa7ff04aee1e6ca925eb2ca84397c22b74d](https://sepolia.voyager.online/contract/0x1b08e27ab436cd491631156da5f3aa7ff04aee1e6ca925eb2ca84397c22b74d)
- Summary Stats : [0x54563a0537b3ae0ba91032d674a6d468f30a59dc4deb8f0dce4e642b94be15c](https://sepolia.voyager.online/contract/0x54563a0537b3ae0ba91032d674a6d468f30a59dc4deb8f0dce4e642b94be15c)
- VRF : [0x60c69136b39319547a4df303b6b3a26fab8b2d78de90b6bd215ce82e9cb515c](https://sepolia.voyager.online/contract/0x60c69136b39319547a4df303b6b3a26fab8b2d78de90b6bd215ce82e9cb515c)

**Starknet Mainnet**
- Oracle : [0x2a85bd616f912537c50a49a4076db02c00b29b2cdc8a197ce92ed1837fa875b](https://voyager.online/contract/0x2a85bd616f912537c50a49a4076db02c00b29b2cdc8a197ce92ed1837fa875b)
Expand Down
4 changes: 2 additions & 2 deletions deployments/sepolia/declarations.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"pragma_Ownable": "0x7b50a7a9bbb75d08248135003f1c87f0d44ba23018dc0ca480ac37a901531f3",
"pragma_PublisherRegistry": "0x306288971002bd7906e3a607d504dfb28dcbdc7655a115984e567dce3b67e8f",
"pragma_SummaryStats": "0x3b5bf1c2f918de14620b3c63e2c6543cf0a138df258bce3d03e3fb0b7d2183a",
"pragma_Randomness": "0x1a4de6fd18f5358f9c815ca98b08c707c77e6583f10e5ebf83daa6541217e2a",
"pragma_ExampleRandomness": "0x521a9f8d2db3faf168854902adb6bda2648d1de695c3cfa88946080ec567cbb",
"pragma_Randomness": "0x2e167703c1deef69c6c5076133d3491fc75d1d1f486e6a8375712d28ff10fa4",
"pragma_ExampleRandomness": "0x2f8197e47fa9776db20a22e009fdeee079f0387cbc823fad5bf0d8e285e81a7",
"pragma_YieldCurve": "0x55a7af6d2df5730c784ec31ca9f71e66f19e8cb78359d23f51aececcc1c04eb"
}
20 changes: 8 additions & 12 deletions deployments/sepolia/deployments.json
Original file line number Diff line number Diff line change
@@ -1,22 +1,18 @@
{
"pragma_PublisherRegistry": {
"address": "0x732b618bc92e3919e28dd3b3aff21079b2507c1f51b8a194ce90300e995cb",
"tx": "0x696821818ebcaf3052d9af16b2e3250dfea98fb4ab8d9caccd1f7e8ffced82f"
"address": "0x1b08e27ab436cd491631156da5f3aa7ff04aee1e6ca925eb2ca84397c22b74d",
"tx": "0x2f1d2a0070a008fd312a2368776aca5b57c4a3cd734efdb619c616af7ab64f5"
},
"pragma_Oracle": {
"address": "0x5acaa0ef3a6837c98ddeae516fa3f6022018cf646914d921842e46fc00c35d3",
"tx": "0x6700eac1d61330b9831384e358985681ccaf90eea540f299f9fc58550372e17"
"address": "0x36031daa264c24520b11d93af622c848b2499b66b41d611bac95e13cfca131a",
"tx": "0x64f5b3cd696f93beb8f834b9fdc5b660fac342655708b75ae353eb7b956ca04"
},
"pragma_SummaryStats": {
"address": "0x185b147a3e03043e0232ec6fcf17143614481cc29a505c7d9c4b29e98c1f14e",
"tx": "0x5586671f1d7d1e7744ca88b19927ab12ef9ac233d70f2f9bbed650c32bcd38f"
"address": "0x54563a0537b3ae0ba91032d674a6d468f30a59dc4deb8f0dce4e642b94be15c",
"tx": "0x1c753020f5b99852025defa05313b4b82c5cbeb989bb9f700b7a63453f21781"
},
"pragma_Randomness": {
"address": "0x556bd6988d786777bb5b1ee337c63f60f30d8200818b59b29e54afc27266a46",
"tx": "0x201c3bfe0ea8d3476f97d7430d947e804e58c9184ee80ffab2a2d0582a7aaf2"
},
"pragma_ExampleRandomness": {
"address": "0x6b95c03d088974e17cc87a3b9b2650d7b0c7098e2ec968f6d852249e808f5dc",
"tx": "0x226ec4801c9b3e7428ffcbec16c75bb3cf7c90ed2c9e189ac8d310e41157665"
"address": "0x60c69136b39319547a4df303b6b3a26fab8b2d78de90b6bd215ce82e9cb515c",
"tx": "0x59493788ed2789da7be4fa48fc5fa92cc3e60d5040761d4142fdbe59c15cf0e"
}
}
22 changes: 11 additions & 11 deletions scripts/add_pairs.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,10 @@
call,
)
from pragma.core.types import Currency, Pair
import argparse
import os
import argparse
import os
from dotenv import load_dotenv

logging.basicConfig()
logger = logging.getLogger(__name__)
logger.setLevel(logging.INFO)
Expand All @@ -39,27 +40,26 @@

async def main():
parser = argparse.ArgumentParser(description="Deploy contracts to Katana")
parser.add_argument('--port', type=int, help='Port number(not required)', required=False)
parser.add_argument(
"--port", type=int, help="Port number(not required)", required=False
)
args = parser.parse_args()
if os.getenv("STARKNET_NETWORK") == "katana" and args.port is None:
logger.warning(
f"⚠️ --port not set, defaulting to 5050"
)
logger.warning(f"⚠️ --port not set, defaulting to 5050")
args.port = 5050
# Add Currencies
for currency in currencies_to_add:
print(currency.to_dict())
tx_hash = await invoke(
"pragma_Oracle",
"add_currency",
currency.serialize(),
port = args.port
"pragma_Oracle", "add_currency", currency.serialize(), port=args.port
)
logger.info(f"Added currency {currency} with tx hash {hex(tx_hash)}")

# Add Pairs
for pair in pairs_to_add:
tx_hash = await invoke("pragma_Oracle", "add_pair", pair.serialize(), port= args.port)
tx_hash = await invoke(
"pragma_Oracle", "add_pair", pair.serialize(), port=args.port
)
logger.info(f"Added pair {pair} with tx hash {hex(tx_hash)}")


Expand Down
48 changes: 24 additions & 24 deletions scripts/deploy_randomness.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@
currencies,
NETWORK,
pairs,
ETH_TOKEN_ADDRESS
ETH_TOKEN_ADDRESS,
)
from scripts.utils.starknet import (
dump_deployments,
get_deployments,
get_starknet_account,
deploy_v2,
declare_v2,
dump_declarations
dump_declarations,
)

load_dotenv()
Expand All @@ -31,45 +31,45 @@
# %% Main
async def main():
parser = argparse.ArgumentParser(description="Deploy contracts to Katana")
parser.add_argument('--port', type=int, help='Port number(not required)', required=False)
parser.add_argument(
"--port", type=int, help="Port number(not required)", required=False
)
args = parser.parse_args()
if os.getenv("STARKNET_NETWORK") == "katana" and args.port is None:
logger.warning(
f"⚠️ --port not set, defaulting to 5050"
)
logger.warning(f"⚠️ --port not set, defaulting to 5050")
args.port = 5050
# %% Declarations
chain_id = NETWORK["chain_id"]
logger.info(
f"ℹ️ Connected to CHAIN_ID { chain_id }"
)
account = await get_starknet_account(port= args.port)
logger.info(f"ℹ️ Connected to CHAIN_ID { chain_id }")
account = await get_starknet_account(port=args.port)
logger.info(f"ℹ️ Using account {hex(account.address)} as deployer")

if args.port is not None:
class_hash = {
contract["contract_name"]: await declare_v2(contract["contract_name"], port=args.port)
contract["contract_name"]: await declare_v2(
contract["contract_name"], port=args.port
)
for contract in COMPILED_CONTRACTS
}
dump_declarations(class_hash)

# %% Deployment

# deployments = get_deployments()
# deployments["pragma_Randomness"] = await deploy_v2(
# "pragma_Randomness",
# int(os.getenv("TESTNET_ACCOUNT_ADDRESS"), 16),
# 2061139992776959994838533810929826594222370735645675137341826408353556487187,
# ETH_TOKEN_ADDRESS,
# int(deployments["pragma_Oracle"]["address"], 16),
# port=args.port
# )
deployments = get_deployments()
deployments["pragma_ExampleRandomness"] = await deploy_v2(
"pragma_ExampleRandomness",
int("0x5faa12cb652c1ec3cf667e651d001d8155653d8d8ad2d1ab92bd965e081a605", 16),
port = args.port
deployments["pragma_Randomness"] = await deploy_v2(
"pragma_Randomness",
int(os.getenv("TESTNET_ACCOUNT_ADDRESS"), 16),
2061139992776959994838533810929826594222370735645675137341826408353556487187,
int(ETH_TOKEN_ADDRESS, 16),
int(deployments["pragma_Oracle"]["address"], 16),
port=args.port,
)
# deployments = get_deployments()
# deployments["pragma_ExampleRandomness"] = await deploy_v2(
# "pragma_ExampleRandomness",
# int("0x5faa12cb652c1ec3cf667e651d001d8155653d8d8ad2d1ab92bd965e081a605", 16),
# port=args.port,
# )

dump_deployments(deployments)

Expand Down
67 changes: 38 additions & 29 deletions scripts/register_publishers.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
NETWORK,
pairs,
)
import os
import os
from dotenv import load_dotenv
import argparse
from scripts.utils.starknet import (
Expand Down Expand Up @@ -54,7 +54,7 @@
"10KSWAP",
]

network = "mainnet"
network = "sepolia"

# TODO: load data from JSON/YAML
"""
Expand All @@ -72,7 +72,7 @@
"FLOWDESK",
"CRYPTOMENTUM",
"AVNU",
"SPACESHARD"
"SPACESHARD",
]
publishers_sources = [
THIRD_PARTY_SOURCES,
Expand All @@ -85,67 +85,73 @@
["FLOWDESK"],
["CRYPTOMENTUM"],
["AVNU"] + DEX_SOURCES,
THIRD_PARTY_SOURCES
THIRD_PARTY_SOURCES,
]
publisher_address = [
0x0624EBFB99865079BD58CFCFB925B6F5CE940D6F6E41E118B8A72B7163FB435C,
0xCF357FA043A29F7EA06736CC253D8D6D8A208C03B92FFB4B50074F8470818B,
0x01daa5cb5f56d96832990ddf4eb9d4f09ba72aff39af13028af67dce9934a74c,
0x01DAA5CB5F56D96832990DDF4EB9D4F09BA72AFF39AF13028AF67DCE9934A74C,
0x17A6F7E8196C9A7AFF90B7CC4BF98842894ECC2B9CC1A3703A1AAB948FCE208,
0x1D8E01188C4C8984FB19F00156491787E64FD2DE1C3CE4EB9571924C540CF3B,
0x4E2863FD0FF85803EEF98CE5DD8272AB21C6595537269A2CD855A10EBCC18CC,
0x022641362f12d72103f3badfbdc8e1a77fca91eb1f3835638eec55ebcaeaaffd,
0x0264CD871a4B5a6B441eB2862b3785e01C4cB82A133E3a65A01827BB8df4B871,
0x5b1400d876caaa7ba7858df28faa73a16318ab8551397d83016fb33cb590b28,
0x052D8E9778d026588A51595E30B0f45609B4F771eEcF0E335CdeFeD1D84A9d89,
0x0271e25bf6ef39b48ab319456c7db88767f0b38d53e1285c5b3e901c60cd878c
0x022641362F12D72103F3BADFBDC8E1A77FCA91EB1F3835638EEC55EBCAEAAFFD,
0x0264CD871A4B5A6B441EB2862B3785E01C4CB82A133E3A65A01827BB8DF4B871,
0x5B1400D876CAAA7BA7858DF28FAA73A16318AB8551397D83016FB33CB590B28,
0x052D8E9778D026588A51595E30B0F45609B4F771EECF0E335CDEFED1D84A9D89,
0x0271E25BF6EF39B48AB319456C7DB88767F0B38D53E1285C5B3E901C60CD878C,
]
admin_address = 0x02356B628D108863BAF8644C945D97BAD70190AF5957031F4852D00D0F690A77

"""
MAINNET
"""
if network == "mainnet":
publishers = [
"PRAGMA",
"FOURLEAF",
"SPACESHARD",
"SKYNET_TRADING"
]
publishers = ["PRAGMA", "FOURLEAF", "SPACESHARD", "SKYNET_TRADING"]
publishers_sources = [
THIRD_PARTY_SOURCES,
["FOURLEAF"],
THIRD_PARTY_SOURCES,
["SKYNET_TRADING"]
["SKYNET_TRADING"],
]
publisher_address = [
0x06707675cd7dD9256667eCa8284e46F4546711ee0054Bc2dd02f0Ce572056CF4,
0x073335cc71c93fe46c04c14e09e7cde7ca7f6147bb36c72dee7968ec3abaf70d,
0x035dd30e84f7d61586c6b152524f3f2519dfc11b4dcb9998176b1de9cff9a6ea,
0x0155e28e1947350dac90112f3129b74e3a58d38132c8c26f8552002d78c3656e
0x06707675CD7DD9256667ECA8284E46F4546711EE0054BC2DD02F0CE572056CF4,
0x073335CC71C93FE46C04C14E09E7CDE7CA7F6147BB36C72DEE7968EC3ABAF70D,
0x035DD30E84F7D61586C6B152524F3F2519DFC11B4DCB9998176B1DE9CFF9A6EA,
0x0155E28E1947350DAC90112F3129B74E3A58D38132C8C26F8552002D78C3656E,
]
admin_address = 0x02356B628D108863BAF8644C945D97BAD70190AF5957031F4852D00D0F690A77

if network == "sepolia":
publishers = ["PRAGMA"]
publishers_sources = [THIRD_PARTY_SOURCES]
publisher_address = [
0x04C1D9DA136846AB084AE18CF6CE7A652DF7793B666A16CE46B1BF5850CC739D
]


# %% Main
async def main():
parser = argparse.ArgumentParser(description="Deploy contracts to Katana")
parser.add_argument('--port', type=int, help='Port number', required=False)
parser.add_argument("--port", type=int, help="Port number", required=False)
args = parser.parse_args()
if os.getenv("STARKNET_NETWORK") == "katana" and args.port is None:
logger.warning(
f"⚠️ --port not set, defaulting to 5050"
)
logger.warning(f"⚠️ --port not set, defaulting to 5050")
args.port = 5050
for publisher, sources, address in zip(
publishers, publishers_sources, publisher_address
):
(existing_address,) = await call(
"pragma_PublisherRegistry", "get_publisher_address", publisher, port = args.port
"pragma_PublisherRegistry",
"get_publisher_address",
publisher,
port=args.port,
)
if existing_address == 0:
tx_hash = await invoke(
"pragma_PublisherRegistry", "add_publisher", [publisher, address],port = args.port
"pragma_PublisherRegistry",
"add_publisher",
[publisher, address],
port=args.port,
)
logger.info(f"Registered new publisher {publisher} with tx {hex(tx_hash)}")
elif existing_address != address:
Expand All @@ -155,15 +161,18 @@ async def main():
return

(existing_sources,) = await call(
"pragma_PublisherRegistry", "get_publisher_sources", publisher,port = args.port
"pragma_PublisherRegistry",
"get_publisher_sources",
publisher,
port=args.port,
)
new_sources = [x for x in sources if str_to_felt(x) not in existing_sources]
if len(new_sources) > 0:
tx_hash = await invoke(
"pragma_PublisherRegistry",
"add_sources_for_publisher",
[publisher, len(new_sources), *new_sources],
port = args.port
port=args.port,
)
logger.info(
f"Registered sources {new_sources} for publisher {publisher} with tx {hex(tx_hash)}"
Expand Down

0 comments on commit ddb5aad

Please sign in to comment.