Skip to content

Commit ed9ee31

Browse files
committed
wip
1 parent 9eb0bb1 commit ed9ee31

File tree

7 files changed

+17
-36
lines changed

7 files changed

+17
-36
lines changed

Cargo.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/cartridge/src/lib.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@ pub mod vrf;
55

66
pub use client::Client;
77
pub use vrf::{
8-
bootstrap_vrf, derive_vrf_accounts, resolve_executable, vrf_account_class_hash,
9-
vrf_consumer_class_hash, vrf_secret_key_from_account_key, wait_for_http_ok, InfoResponse,
10-
RequestContext, SignedOutsideExecution, VrfBootstrap, VrfBootstrapConfig, VrfBootstrapResult,
11-
VrfClient, VrfClientError, VrfDerivedAccounts, VrfOutsideExecution, VrfService,
12-
VrfServiceConfig, VrfServiceProcess, VrfSidecarError, VrfSidecarResult, BOOTSTRAP_TIMEOUT,
13-
SIDECAR_TIMEOUT, VRF_ACCOUNT_SALT, VRF_CONSUMER_SALT, VRF_SERVER_PORT,
8+
bootstrap_vrf, derive_vrf_accounts, resolve_executable, vrf_secret_key_from_account_key,
9+
wait_for_http_ok, InfoResponse, RequestContext, SignedOutsideExecution, VrfBootstrap,
10+
VrfBootstrapConfig, VrfBootstrapResult, VrfClient, VrfClientError, VrfDerivedAccounts,
11+
VrfOutsideExecution, VrfService, VrfServiceConfig, VrfServiceProcess, VrfSidecarError,
12+
VrfSidecarResult, BOOTSTRAP_TIMEOUT, SIDECAR_TIMEOUT, VRF_ACCOUNT_SALT, VRF_CONSUMER_SALT,
13+
VRF_SERVER_PORT,
1414
};
1515

1616
#[rustfmt::skip]

crates/cartridge/src/vrf/bootstrap.rs

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ pub fn derive_vrf_accounts(
9999

100100
let account_public_key =
101101
SigningKey::from_secret_scalar(source_private_key).verifying_key().scalar();
102-
let vrf_account_class_hash = vrf_account_class_hash()?;
102+
let vrf_account_class_hash = katana_contracts::vrf::CartridgeVrfAccount::HASH;
103103
// When using UDC with unique=0 (non-unique deployment), the deployer_address
104104
// used in address computation is 0, not the actual deployer or UDC address.
105105
let vrf_account_address = get_contract_address(
@@ -136,7 +136,7 @@ pub async fn bootstrap_vrf(
136136
let vrf_account_address = derived.vrf_account_address;
137137
let account_public_key =
138138
SigningKey::from_secret_scalar(bootstrapper_account_private_key).verifying_key().scalar();
139-
let vrf_account_class_hash = vrf_account_class_hash()?;
139+
let vrf_account_class_hash = katana_contracts::vrf::CartridgeVrfAccount::HASH;
140140

141141
// Create the source account for transactions
142142
let signer =
@@ -204,7 +204,7 @@ pub async fn bootstrap_vrf(
204204
.map_err(|e| anyhow!("failed to set VRF public key: {e}"))?;
205205

206206
// Deploy VRF consumer
207-
let vrf_consumer_class_hash = vrf_consumer_class_hash()?;
207+
let vrf_consumer_class_hash = katana_contracts::vrf::CartridgeVrfConsumer::HASH;
208208
// When using UDC with unique=0 (non-unique deployment), the deployer_address
209209
// used in address computation is 0, not the actual deployer or UDC address.
210210
let vrf_consumer_address = get_contract_address(
@@ -237,16 +237,6 @@ pub async fn bootstrap_vrf(
237237
})
238238
}
239239

240-
/// Get the class hash of the VRF account contract.
241-
pub fn vrf_account_class_hash() -> Result<Felt> {
242-
Ok(katana_contracts::vrf::CartridgeVrfAccount::HASH)
243-
}
244-
245-
/// Get the class hash of the VRF consumer contract.
246-
pub fn vrf_consumer_class_hash() -> Result<Felt> {
247-
Ok(katana_contracts::vrf::CartridgeVrfConsumer::HASH)
248-
}
249-
250240
// ============================================================================
251241
// Internal helpers
252242
// ============================================================================

crates/cartridge/src/vrf/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ pub mod bootstrap;
1111
pub mod sidecar;
1212

1313
pub use bootstrap::{
14-
bootstrap_vrf, derive_vrf_accounts, vrf_account_class_hash, vrf_consumer_class_hash,
15-
vrf_secret_key_from_account_key, VrfBootstrap, VrfBootstrapConfig, VrfBootstrapResult,
16-
VrfDerivedAccounts, BOOTSTRAP_TIMEOUT, VRF_ACCOUNT_SALT, VRF_CONSUMER_SALT,
14+
bootstrap_vrf, derive_vrf_accounts, vrf_secret_key_from_account_key, VrfBootstrap,
15+
VrfBootstrapConfig, VrfBootstrapResult, VrfDerivedAccounts, BOOTSTRAP_TIMEOUT,
16+
VRF_ACCOUNT_SALT, VRF_CONSUMER_SALT,
1717
};
1818
pub use client::*;
1919
pub use sidecar::{

crates/contracts/src/lib.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,5 @@ pub mod vrf {
2929
pub mod avnu {
3030
use katana_contracts_macro::contract;
3131

32-
contract!(
33-
AvnuForwarder,
34-
"{CARGO_MANIFEST_DIR}/build/avnu_Forwarder.contract_class.json"
35-
);
32+
contract!(AvnuForwarder, "{CARGO_MANIFEST_DIR}/build/avnu_Forwarder.contract_class.json");
3633
}

crates/paymaster/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ version.workspace = true
77

88
[dependencies]
99
katana-primitives.workspace = true
10+
katana-contracts.workspace = true
1011

1112
http.workspace = true
1213
jsonrpsee = { workspace = true, features = ["macros", "server", "client", "http-client"] }

crates/paymaster/src/lib.rs

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -496,7 +496,8 @@ impl PaymasterService {
496496
chain_id_felt
497497
};
498498

499-
let forwarder_class_hash = avnu_forwarder_class_hash()?;
499+
let forwarder_class_hash = katana_contracts::avnu::AvnuForwarder::HASH;
500+
500501
// When using UDC with unique=0 (non-unique deployment), the deployer_address
501502
// used in address computation is 0, not the actual deployer or UDC address.
502503
let forwarder_address = get_contract_address(
@@ -670,15 +671,6 @@ async fn wait_for_contract(
670671
}
671672
}
672673

673-
fn avnu_forwarder_class_hash() -> Result<Felt> {
674-
let class = katana_primitives::utils::class::parse_sierra_class(include_str!(concat!(
675-
env!("CARGO_MANIFEST_DIR"),
676-
"/../controller/classes/avnu_Forwarder.contract_class.json"
677-
)))
678-
.map_err(Error::ClassParse)?;
679-
class.class_hash().map_err(Error::ClassHash)
680-
}
681-
682674
fn resolve_executable(path: &Path) -> Result<PathBuf> {
683675
if path.components().count() > 1 {
684676
return if path.is_file() {

0 commit comments

Comments
 (0)