mirror of
https://github.com/uqbar-dao/nectar.git
synced 2024-12-23 08:32:23 +03:00
app_store: simulation mode constants
This commit is contained in:
parent
3dd7ea8a81
commit
7a60ad6e68
@ -40,8 +40,16 @@ use ft_worker_lib::{
|
||||
const ICON: &str = include_str!("icon");
|
||||
|
||||
const CHAIN_ID: u64 = 10; // optimism
|
||||
#[cfg(feature = "simulation-mode")]
|
||||
const CHAIN_ID: u64 = 31337; // local
|
||||
|
||||
const CONTRACT_ADDRESS: &str = "0x52185B6a6017E6f079B994452F234f7C2533787B"; // optimism
|
||||
#[cfg(feature = "simulation-mode")]
|
||||
const CONTRACT_ADDRESS: &str = "0x2279B7A0a67DB372996a5FaB50D91eAA73d2eBe6"; // local
|
||||
|
||||
const CONTRACT_FIRST_BLOCK: u64 = 118_590_088;
|
||||
#[cfg(feature = "simulation-mode")]
|
||||
const CONTRACT_FIRST_BLOCK: u64 = 1;
|
||||
|
||||
const EVENTS: [&str; 3] = [
|
||||
"AppRegistered(uint256,string,bytes,string,bytes32)",
|
||||
@ -71,7 +79,6 @@ pub enum Resp {
|
||||
}
|
||||
|
||||
fn fetch_logs(eth_provider: ð::Provider, filter: ð::Filter) -> Vec<eth::Log> {
|
||||
#[cfg(not(feature = "simulation-mode"))]
|
||||
loop {
|
||||
match eth_provider.get_logs(filter) {
|
||||
Ok(res) => return res,
|
||||
@ -82,13 +89,10 @@ fn fetch_logs(eth_provider: ð::Provider, filter: ð::Filter) -> Vec<eth::Lo
|
||||
}
|
||||
}
|
||||
}
|
||||
#[cfg(feature = "simulation-mode")] // TODO use local testnet, provider_chainId: 31337
|
||||
vec![]
|
||||
}
|
||||
|
||||
#[allow(unused_variables)]
|
||||
fn subscribe_to_logs(eth_provider: ð::Provider, filter: eth::Filter) {
|
||||
#[cfg(not(feature = "simulation-mode"))]
|
||||
loop {
|
||||
match eth_provider.subscribe(1, filter.clone()) {
|
||||
Ok(()) => break,
|
||||
@ -99,7 +103,6 @@ fn subscribe_to_logs(eth_provider: ð::Provider, filter: eth::Filter) {
|
||||
}
|
||||
}
|
||||
}
|
||||
#[cfg(not(feature = "simulation-mode"))]
|
||||
println!("subscribed to logs successfully");
|
||||
}
|
||||
|
||||
@ -156,10 +159,7 @@ fn init(our: Address) {
|
||||
state = State::new(CONTRACT_ADDRESS.to_string()).unwrap();
|
||||
}
|
||||
|
||||
#[cfg(not(feature = "simulation-mode"))]
|
||||
println!("indexing on contract address {}", state.contract_address);
|
||||
#[cfg(feature = "simulation-mode")]
|
||||
println!("simulation mode: not indexing packages");
|
||||
|
||||
// create new provider for sepolia with request-timeout of 60s
|
||||
// can change, log requests can take quite a long time.
|
||||
|
Loading…
Reference in New Issue
Block a user