Skip to content

Commit af64568

Browse files
authored
chore(constants): re-introduce pecorino (#96)
* chore(constants): re-introduce pecorino WIP * chore: updated addresses * chore: ordering * chore: add back shortcuts * chore: bump v
1 parent 0dd5b37 commit af64568

File tree

13 files changed

+165
-1
lines changed

13 files changed

+165
-1
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ members = ["crates/*"]
33
resolver = "2"
44

55
[workspace.package]
6-
version = "0.8.0"
6+
version = "0.8.1"
77
edition = "2021"
88
rust-version = "1.81"
99
authors = ["init4"]

crates/constants/src/chains/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11
#[cfg(any(test, feature = "test-utils"))]
22
pub mod test_utils;
3+
4+
pub mod pecorino;
Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
//! Constants for the Pecorino testnet.
2+
3+
use crate::{
4+
HostConstants, HostTokens, HostUsdRecord, RollupConstants, RollupTokens, SignetConstants,
5+
SignetEnvironmentConstants, SignetSystemConstants, UsdRecords,
6+
};
7+
use alloy::primitives::{address, Address};
8+
use std::borrow::Cow;
9+
10+
/// Name for the host chain.
11+
pub const HOST_NAME: &str = "Pecorino Host";
12+
/// Chain ID for the Pecorino testnet host chain.
13+
pub const HOST_CHAIN_ID: u64 = 3151908;
14+
/// Deployment height for the Pecorino testnet host chain.
15+
pub const DEPLOY_HEIGHT: u64 = 149984;
16+
/// `Zenith` contract address for the Pecorino testnet host chain.
17+
pub const HOST_ZENITH: Address = address!("0xbe45611502116387211D28cE493D6Fb3d192bc4E");
18+
/// `Orders` contract address for the Pecorino testnet host chain.
19+
pub const HOST_ORDERS: Address = address!("0x4E8cC181805aFC307C83298242271142b8e2f249");
20+
/// `Passage` contract address for the Pecorino testnet host chain.
21+
pub const HOST_PASSAGE: Address = address!("0xd553C4CA4792Af71F4B61231409eaB321c1Dd2Ce");
22+
/// `Transactor` contract address for the Pecorino testnet host chain.
23+
pub const HOST_TRANSACTOR: Address = address!("0x1af3A16857C28917Ab2C4c78Be099fF251669200");
24+
25+
/// USDC token for the Pecorino testnet host chain.
26+
pub const HOST_USDC: Address = address!("0x885F8DB528dC8a38aA3DDad9D3F619746B4a6A81");
27+
/// USDT token for the Pecorino testnet host chain.
28+
pub const HOST_USDT: Address = address!("0x7970D259D4a96764Fa9B23FF0715A35f06f52D1A");
29+
/// WBTC token for the Pecorino testnet host chain.
30+
pub const HOST_WBTC: Address = address!("0x9aeDED4224f3dD31aD8A0B1FcD05E2d7829283a7");
31+
/// WETH token for the Pecorino testnet host chain.
32+
pub const HOST_WETH: Address = address!("0x572C4d72080ed9E9997509b583a22B785B70cB3f");
33+
34+
/// USDC token record for the Pecorino testnet host chain.
35+
pub const HOST_USDC_RECORD: HostUsdRecord = HostUsdRecord::new(HOST_USDC, Cow::Borrowed("USDC"), 6);
36+
/// USDT token record for the Pecorino testnet host chain.
37+
pub const HOST_USDT_RECORD: HostUsdRecord = HostUsdRecord::new(HOST_USDT, Cow::Borrowed("USDT"), 6);
38+
/// Host USD records for the Pecorino testnet host chain.
39+
pub const HOST_USD_RECORDS: UsdRecords = {
40+
let mut records = UsdRecords::new();
41+
records.push(HOST_USDC_RECORD);
42+
records.push(HOST_USDT_RECORD);
43+
records
44+
};
45+
/// Host system tokens for Pecorino.
46+
pub const HOST_TOKENS: HostTokens = HostTokens::new(HOST_USD_RECORDS, HOST_WBTC, HOST_WETH);
47+
48+
/// Host system constants for Pecorino.
49+
pub const HOST: HostConstants = crate::HostConstants::new(
50+
HOST_CHAIN_ID,
51+
DEPLOY_HEIGHT,
52+
HOST_ZENITH,
53+
HOST_ORDERS,
54+
HOST_PASSAGE,
55+
HOST_TRANSACTOR,
56+
HOST_TOKENS,
57+
);
58+
59+
/// Name for the network.
60+
pub const RU_NAME: &str = "Pecorino";
61+
/// Chain ID for the Pecorino testnet RU chain.
62+
pub const RU_CHAIN_ID: u64 = 14174;
63+
64+
/// WETH token for the Pecorino testnet RU chain.
65+
pub const RU_WETH: Address = address!("0x0000000000000000007369676e65742d77657468");
66+
/// WBTC token for the Pecorino testnet RU chain.
67+
pub const RU_WBTC: Address = address!("0x0000000000000000007369676e65742D77627463");
68+
/// `Orders` contract address for the Pecorino testnet RU chain.
69+
pub const RU_ORDERS: Address = address!("0x000000000000007369676E65742D6f7264657273");
70+
/// `Passage` contract address for the Pecorino testnet RU chain.
71+
/// This is currently a dummy value and will be replaced with the actual Passage contract address in the future.
72+
pub const RU_PASSAGE: Address = address!("0x0000000000007369676E65742D70617373616765");
73+
/// The WETH9-based wrapped native USD token contract.
74+
/// This is signet's native token in wrapped form.
75+
pub const WRAPPED: Address = address!("0x0000000000000000007369676e65742D77757364");
76+
/// RU pre-approved system tokens for Pecorino.
77+
pub const RU_TOKENS: RollupTokens = RollupTokens::new(RU_WBTC, RU_WETH);
78+
79+
/// Base fee recipient address for the Pecorino testnet RU chain.
80+
pub const BASE_FEE_RECIPIENT: Address = address!("0xe0eDA3701D44511ce419344A4CeD30B52c9Ba231");
81+
82+
/// RU system constants for Pecorino.
83+
pub const ROLLUP: RollupConstants =
84+
crate::RollupConstants::new(RU_CHAIN_ID, RU_ORDERS, RU_PASSAGE, BASE_FEE_RECIPIENT, RU_TOKENS);
85+
86+
/// Signet system constants for Pecorino.
87+
pub const PECORINO_SYS: SignetSystemConstants = crate::SignetSystemConstants::new(HOST, ROLLUP);
88+
89+
/// Signet environment constants for Pecorino.
90+
pub const PECORINO_ENV: SignetEnvironmentConstants = SignetEnvironmentConstants::new(
91+
Cow::Borrowed(HOST_NAME),
92+
Cow::Borrowed(RU_NAME),
93+
Cow::Borrowed(TX_CACHE_URL),
94+
);
95+
96+
/// Signet constants for Pecorino.
97+
pub const PECORINO: SignetConstants = SignetConstants::new(PECORINO_SYS, PECORINO_ENV);
98+
99+
/// The URL of the Transaction Cache endpoint.
100+
pub const TX_CACHE_URL: &str = "https://transactions.pecorino.signet.sh";

crates/constants/src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ mod chains;
2020
#[cfg(any(test, feature = "test-utils"))]
2121
pub use chains::test_utils;
2222

23+
pub use chains::pecorino;
24+
2325
mod types;
2426
pub use types::{
2527
ConfigError, HostConstants, HostPermitted, HostTokens, HostUsdRecord, KnownChains,

crates/constants/src/types/chains.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ pub enum ParseChainError {
1414
/// Known chains for the Signet system.
1515
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
1616
pub enum KnownChains {
17+
/// Pecorino chain.
18+
Pecorino,
1719
/// Test chain.
1820
#[cfg(any(test, feature = "test-utils"))]
1921
Test,
@@ -27,6 +29,7 @@ impl FromStr for KnownChains {
2729
match s.as_str() {
2830
#[cfg(any(test, feature = "test-utils"))]
2931
"test" => Ok(Self::Test),
32+
"pecorino" => Ok(Self::Pecorino),
3033
_ => Err(ParseChainError::ChainNotSupported(s)),
3134
}
3235
}

crates/constants/src/types/environment.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,11 @@ impl SignetEnvironmentConstants {
2222
Self { host_name, rollup_name, transaction_cache }
2323
}
2424

25+
/// Get the hard-coded Pecorino environment constants.
26+
pub const fn pecorino() -> Self {
27+
crate::chains::pecorino::PECORINO_ENV
28+
}
29+
2530
/// Get the hard-coded local test rollup constants.
2631
#[cfg(any(test, feature = "test-utils"))]
2732
pub const fn test() -> Self {
@@ -49,6 +54,7 @@ impl TryFrom<KnownChains> for SignetEnvironmentConstants {
4954

5055
fn try_from(chain: KnownChains) -> Result<Self, Self::Error> {
5156
match chain {
57+
KnownChains::Pecorino => Ok(Self::pecorino()),
5258
#[cfg(any(test, feature = "test-utils"))]
5359
KnownChains::Test => Ok(Self::test()),
5460
}

crates/constants/src/types/host.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,11 @@ impl HostConstants {
5656
Self { chain_id, deploy_height, zenith, orders, passage, transactor, tokens }
5757
}
5858

59+
/// Get the hard-coded Pecorino host constants.
60+
pub const fn pecorino() -> Self {
61+
crate::chains::pecorino::HOST
62+
}
63+
5964
/// Get the hard-coded local test host constants.
6065
#[cfg(any(test, feature = "test-utils"))]
6166
pub const fn test() -> Self {
@@ -142,6 +147,7 @@ impl FromStr for HostConstants {
142147
fn from_str(s: &str) -> Result<Self, Self::Err> {
143148
let chain: KnownChains = s.parse()?;
144149
match chain {
150+
KnownChains::Pecorino => Ok(Self::pecorino()),
145151
#[cfg(any(test, feature = "test-utils"))]
146152
KnownChains::Test => Ok(Self::test()),
147153
}

crates/constants/src/types/mod.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,11 @@ impl SignetSystemConstants {
4747
Self { host, rollup }
4848
}
4949

50+
/// Get the hard-coded Pecorino constants.
51+
pub const fn pecorino() -> Self {
52+
crate::chains::pecorino::PECORINO_SYS
53+
}
54+
5055
/// Get the hard-coded local test constants.
5156
#[cfg(any(test, feature = "test-utils"))]
5257
pub const fn test() -> Self {
@@ -221,6 +226,7 @@ impl TryFrom<KnownChains> for SignetSystemConstants {
221226

222227
fn try_from(chain: KnownChains) -> Result<Self, Self::Error> {
223228
match chain {
229+
KnownChains::Pecorino => Ok(Self::pecorino()),
224230
#[cfg(any(test, feature = "test-utils"))]
225231
KnownChains::Test => Ok(Self::test()),
226232
}
@@ -253,6 +259,11 @@ impl SignetConstants {
253259
Self { system, environment }
254260
}
255261

262+
/// Get the hard-coded Pecorino rollup constants.
263+
pub const fn pecorino() -> Self {
264+
crate::chains::pecorino::PECORINO
265+
}
266+
256267
/// Get the hard-coded local test rollup constants.
257268
#[cfg(any(test, feature = "test-utils"))]
258269
pub const fn test() -> Self {
@@ -285,6 +296,7 @@ impl TryFrom<KnownChains> for SignetConstants {
285296

286297
fn try_from(chain: KnownChains) -> Result<Self, Self::Error> {
287298
match chain {
299+
KnownChains::Pecorino => Ok(Self::pecorino()),
288300
#[cfg(any(test, feature = "test-utils"))]
289301
KnownChains::Test => Ok(Self::test()),
290302
}

crates/constants/src/types/rollup.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,11 @@ impl RollupConstants {
4343
Self { chain_id, orders, passage, base_fee_recipient, tokens }
4444
}
4545

46+
/// Get the hard-coded Pecorino rollup constants.
47+
pub const fn pecorino() -> Self {
48+
crate::chains::pecorino::ROLLUP
49+
}
50+
4651
/// Get the hard-coded local test rollup constants.
4752
#[cfg(any(test, feature = "test-utils"))]
4853
pub const fn test() -> Self {
@@ -107,6 +112,7 @@ impl TryFrom<KnownChains> for RollupConstants {
107112

108113
fn try_from(chain: KnownChains) -> Result<Self, Self::Error> {
109114
match chain {
115+
KnownChains::Pecorino => Ok(Self::pecorino()),
110116
#[cfg(any(test, feature = "test-utils"))]
111117
KnownChains::Test => Ok(Self::test()),
112118
}

crates/test-utils/src/specs/host_spec.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,11 @@ impl HostBlockSpec {
9090
}
9191
}
9292

93+
/// Make a new block spec with Pecorino constants.
94+
pub const fn pecorino() -> Self {
95+
Self::new(SignetSystemConstants::pecorino())
96+
}
97+
9398
/// Make a new block spec with test constants.
9499
pub const fn test() -> Self {
95100
Self::new(SignetSystemConstants::test())
@@ -411,6 +416,7 @@ impl TryFrom<KnownChains> for HostBlockSpec {
411416

412417
fn try_from(chain: KnownChains) -> Result<Self, Self::Error> {
413418
match chain {
419+
KnownChains::Pecorino => Ok(Self::pecorino()),
414420
KnownChains::Test => Ok(Self::test()),
415421
}
416422
}

0 commit comments

Comments
 (0)