Skip to content

Commit 740e18a

Browse files
echonet: add constants file
1 parent 739b502 commit 740e18a

File tree

2 files changed

+13
-8
lines changed

2 files changed

+13
-8
lines changed

echonet/l1_client.py

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,14 @@
66
import inspect
77
import logging
88
import requests
9+
from l1_constants import LOG_MESSAGE_TO_L2_EVENT_SIGNATURE, STARKNET_L1_CONTRACT_ADDRESS
910

1011

1112
class L1Client:
1213
L1_MAINNET_URL = "https://eth-mainnet.g.alchemy.com/v2/{api_key}"
1314
DATA_BLOCKS_BY_TIMESTAMP_URL_FMT = (
1415
"https://api.g.alchemy.com/data/v1/{api_key}/utility/blocks/by-timestamp"
1516
)
16-
# Taken from apollo_l1_provider/src/lib.rs
17-
LOG_MESSAGE_TO_L2_EVENT_SIGNATURE = (
18-
"0xdb80dd488acf86d17c747445b0eabb5d57c541d3bd7b6b87af987858e5066b2b"
19-
)
20-
# Taken from ethereum_base_layer_contracts.rs
21-
STARKNET_L1_CONTRACT_ADDRESS = "0xc662c410C0ECf747543f5bA90660f6ABeBD9C8c4"
2217

2318
@dataclass(frozen=True)
2419
class Log:
@@ -96,8 +91,8 @@ def get_logs(self, from_block: int, to_block: int) -> List["L1Client.Log"]:
9691
{
9792
"fromBlock": hex(from_block),
9893
"toBlock": hex(to_block),
99-
"address": self.STARKNET_L1_CONTRACT_ADDRESS,
100-
"topics": [self.LOG_MESSAGE_TO_L2_EVENT_SIGNATURE],
94+
"address": STARKNET_L1_CONTRACT_ADDRESS,
95+
"topics": [LOG_MESSAGE_TO_L2_EVENT_SIGNATURE],
10196
}
10297
],
10398
"id": 1,

echonet/l1_constants.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Starknet L1 Core Contract address on Ethereum mainnet
2+
# Source: crates/papyrus_base_layer/src/ethereum_base_layer_contract.rs
3+
STARKNET_L1_CONTRACT_ADDRESS = "0xc662c410C0ECf747543f5bA90660f6ABeBD9C8c4"
4+
5+
# Event signatures (auto-generated by Rust sol! macro from ABI)
6+
# Source: crates/papyrus_base_layer/src/constants.rs
7+
# ABI: crates/papyrus_base_layer/resources/Starknet-0.10.3.4.json
8+
LOG_MESSAGE_TO_L2_EVENT_SIGNATURE = (
9+
"0xdb80dd488acf86d17c747445b0eabb5d57c541d3bd7b6b87af987858e5066b2b"
10+
)

0 commit comments

Comments
 (0)