Skip to content

Commit a4b8101

Browse files
committed
feat: add chain names & tx cache URL
1 parent 7266f5d commit a4b8101

File tree

4 files changed

+50
-6
lines changed

4 files changed

+50
-6
lines changed

crates/constants/src/chains/pecorino.rs

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
use crate::{HostConstants, PredeployTokens, RollupConstants, SignetSystemConstants};
44
use alloy::primitives::{address, Address};
55

6+
/// Name for the host chain.
7+
pub const HOST_NAME: &str = "Pecorino Host";
68
/// Chain ID for the Pecorino testnet host chain.
79
pub const HOST_CHAIN_ID: u64 = 3151908;
810
/// Deployment height for the Pecorino testnet host chain.
@@ -30,6 +32,8 @@ pub const RU_USDT: Address = address!("0xF34326d3521F1b07d1aa63729cB14A372f8A737
3032
/// WBTC token for the Pecorino testnet RU chain.
3133
pub const RU_WBTC: Address = address!("0xE3d7066115f7d6b65F88Dff86288dB4756a7D733");
3234

35+
/// Name for the network.
36+
pub const RU_NAME: &str = "Pecorino";
3337
/// Chain ID for the Pecorino testnet RU chain.
3438
pub const RU_CHAIN_ID: u64 = 14174;
3539
/// `Orders` contract address for the Pecorino testnet RU chain.
@@ -46,8 +50,12 @@ pub const HOST_TOKENS: PredeployTokens =
4650
/// RU system tokens for Pecorino.
4751
pub const RU_TOKENS: PredeployTokens = crate::PredeployTokens::new(RU_USDC, RU_USDT, RU_WBTC);
4852

53+
/// The URL of the Transaction Cache endpoint.
54+
pub const TX_CACHE_URL: &str = "https://transactions.pecorino.signet.sh";
55+
4956
/// Host system constants for Pecorino.
5057
pub const HOST: HostConstants = crate::HostConstants::new(
58+
HOST_NAME,
5159
HOST_CHAIN_ID,
5260
DEPLOY_HEIGHT,
5361
HOST_ZENITH,
@@ -58,8 +66,14 @@ pub const HOST: HostConstants = crate::HostConstants::new(
5866
);
5967

6068
/// RU system constants for Pecorino.
61-
pub const ROLLUP: RollupConstants =
62-
crate::RollupConstants::new(RU_CHAIN_ID, RU_ORDERS, RU_PASSAGE, BASE_FEE_RECIPIENT, RU_TOKENS);
69+
pub const ROLLUP: RollupConstants = crate::RollupConstants::new(
70+
RU_NAME,
71+
RU_CHAIN_ID,
72+
RU_ORDERS,
73+
RU_PASSAGE,
74+
BASE_FEE_RECIPIENT,
75+
RU_TOKENS,
76+
);
6377

6478
/// Signet system constants for Pecorino.
6579
pub const PECORINO: SignetSystemConstants = crate::SignetSystemConstants::new(HOST, ROLLUP);

crates/constants/src/chains/test_utils.rs

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ use alloy::primitives::{address, Address};
66
/// Default reward address used in tests when no other is specified.
77
pub const DEFAULT_REWARD_ADDRESS: Address = Address::repeat_byte(0x81);
88

9+
/// Name for the host chain.
10+
pub const HOST_NAME: &str = "Test Host";
911
/// Test chain id for the host chain.
1012
pub const HOST_CHAIN_ID: u64 = 1;
1113
/// Test deployment height.
@@ -33,6 +35,8 @@ pub const RU_USDT: Address = address!("0xF34326d3521F1b07d1aa63729cB14A372f8A737
3335
/// Test address for predeployed WBTC
3436
pub const RU_WBTC: Address = address!("0xE3d7066115f7d6b65F88Dff86288dB4756a7D733");
3537

38+
/// Name for the network.
39+
pub const RU_NAME: &str = "Test Rollup";
3640
/// Test chain id for the RU chain.
3741
pub const RU_CHAIN_ID: u64 = 15;
3842
/// Test address for the RU zenith.
@@ -48,8 +52,12 @@ pub const HOST_TOKENS: PredeployTokens = PredeployTokens::new(HOST_USDC, HOST_US
4852
/// RU system tokens.
4953
pub const RU_TOKENS: PredeployTokens = PredeployTokens::new(RU_USDC, RU_USDT, RU_WBTC);
5054

55+
/// The URL of the Transaction Cache endpoint.
56+
pub const TX_CACHE_URL: &str = "localhost:8080/txcache";
57+
5158
/// Host config
5259
pub const HOST: HostConstants = HostConstants::new(
60+
HOST_NAME,
5361
HOST_CHAIN_ID,
5462
0,
5563
HOST_ZENITH,
@@ -60,8 +68,14 @@ pub const HOST: HostConstants = HostConstants::new(
6068
);
6169

6270
/// Rollup config
63-
pub const ROLLUP: RollupConstants =
64-
RollupConstants::new(RU_CHAIN_ID, RU_ORDERS, RU_PASSAGE, BASE_FEE_RECIPIENT, RU_TOKENS);
71+
pub const ROLLUP: RollupConstants = RollupConstants::new(
72+
RU_NAME,
73+
RU_CHAIN_ID,
74+
RU_ORDERS,
75+
RU_PASSAGE,
76+
BASE_FEE_RECIPIENT,
77+
RU_TOKENS,
78+
);
6579

6680
/// Test constants for unit tests.
6781
pub const TEST_CONSTANTS: SignetSystemConstants = SignetSystemConstants::new(HOST, ROLLUP);

crates/constants/src/types/host.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ use serde_json::Value;
1010
#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Deserialize, serde::Serialize)]
1111
#[serde(rename_all = "camelCase")]
1212
pub struct HostConstants {
13+
/// Name of the host chain.
14+
name: &'static str,
1315
/// Host chain ID.
1416
chain_id: u64,
1517
/// Height at which the host chain deployed the rollup contracts.
@@ -39,6 +41,7 @@ impl std::fmt::Display for HostConstants {
3941
impl HostConstants {
4042
/// Create a new host configuration.
4143
pub const fn new(
44+
name: &'static str,
4245
chain_id: u64,
4346
deploy_height: u64,
4447
zenith: Address,
@@ -47,7 +50,7 @@ impl HostConstants {
4750
transactor: Address,
4851
tokens: PredeployTokens,
4952
) -> Self {
50-
Self { chain_id, deploy_height, zenith, orders, passage, transactor, tokens }
53+
Self { name, chain_id, deploy_height, zenith, orders, passage, transactor, tokens }
5154
}
5255

5356
/// Get the hard-coded pecorino host constants.
@@ -89,6 +92,11 @@ impl HostConstants {
8992
|| address == self.transactor
9093
}
9194

95+
/// Get the host chain name.
96+
pub const fn name(&self) -> &'static str {
97+
self.name
98+
}
99+
92100
/// Get the host chain ID.
93101
pub const fn chain_id(&self) -> u64 {
94102
self.chain_id

crates/constants/src/types/rollup.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ pub const MINTER_ADDRESS: Address = address!("00000000000000000000746f6b656e6164
1818
#[derive(Debug, Copy, Clone, PartialEq, Eq, serde::Deserialize, serde::Serialize)]
1919
#[serde(rename_all = "camelCase")]
2020
pub struct RollupConstants {
21+
/// The name of the network.
22+
name: &'static str,
2123
/// Rollup chain ID.
2224
chain_id: u64,
2325
/// Address of the orders contract.
@@ -33,13 +35,14 @@ pub struct RollupConstants {
3335
impl RollupConstants {
3436
/// Create a new rollup configuration.
3537
pub const fn new(
38+
name: &'static str,
3639
chain_id: u64,
3740
orders: Address,
3841
passage: Address,
3942
base_fee_recipient: Address,
4043
tokens: PredeployTokens,
4144
) -> Self {
42-
Self { chain_id, orders, passage, base_fee_recipient, tokens }
45+
Self { name, chain_id, orders, passage, base_fee_recipient, tokens }
4346
}
4447

4548
/// Get the hard-coded pecorino rollup constants.
@@ -65,6 +68,11 @@ impl RollupConstants {
6568
serde_json::from_value(constants.clone()).map_err(Into::into)
6669
}
6770

71+
/// Get the rollup chain name.
72+
pub const fn name(&self) -> &'static str {
73+
self.name
74+
}
75+
6876
/// Get the address of the orders contract.
6977
pub const fn orders(&self) -> Address {
7078
self.orders

0 commit comments

Comments
 (0)