mirror of
https://github.com/uqbar-dao/nectar.git
synced 2024-11-26 23:27:14 +03:00
fakechain: update local address
This commit is contained in:
parent
7a60ad6e68
commit
0831932abe
@ -39,14 +39,17 @@ use ft_worker_lib::{
|
|||||||
|
|
||||||
const ICON: &str = include_str!("icon");
|
const ICON: &str = include_str!("icon");
|
||||||
|
|
||||||
|
#[cfg(not(feature = "simulation-mode"))]
|
||||||
const CHAIN_ID: u64 = 10; // optimism
|
const CHAIN_ID: u64 = 10; // optimism
|
||||||
#[cfg(feature = "simulation-mode")]
|
#[cfg(feature = "simulation-mode")]
|
||||||
const CHAIN_ID: u64 = 31337; // local
|
const CHAIN_ID: u64 = 31337; // local
|
||||||
|
|
||||||
|
#[cfg(not(feature = "simulation-mode"))]
|
||||||
const CONTRACT_ADDRESS: &str = "0x52185B6a6017E6f079B994452F234f7C2533787B"; // optimism
|
const CONTRACT_ADDRESS: &str = "0x52185B6a6017E6f079B994452F234f7C2533787B"; // optimism
|
||||||
#[cfg(feature = "simulation-mode")]
|
#[cfg(feature = "simulation-mode")]
|
||||||
const CONTRACT_ADDRESS: &str = "0x2279B7A0a67DB372996a5FaB50D91eAA73d2eBe6"; // local
|
const CONTRACT_ADDRESS: &str = "0x8A791620dd6260079BF849Dc5567aDC3F2FdC318"; // local
|
||||||
|
|
||||||
|
#[cfg(not(feature = "simulation-mode"))]
|
||||||
const CONTRACT_FIRST_BLOCK: u64 = 118_590_088;
|
const CONTRACT_FIRST_BLOCK: u64 = 118_590_088;
|
||||||
#[cfg(feature = "simulation-mode")]
|
#[cfg(feature = "simulation-mode")]
|
||||||
const CONTRACT_FIRST_BLOCK: u64 = 1;
|
const CONTRACT_FIRST_BLOCK: u64 = 1;
|
||||||
|
@ -14,17 +14,20 @@ wit_bindgen::generate!({
|
|||||||
world: "process",
|
world: "process",
|
||||||
});
|
});
|
||||||
|
|
||||||
const KNS_ADDRESS: &'static str = "0xca5b5811c0c40aab3295f932b1b5112eb7bb4bd6";
|
#[cfg(not(feature = "simulation-mode"))]
|
||||||
|
const KNS_ADDRESS: &'static str = "0xca5b5811c0c40aab3295f932b1b5112eb7bb4bd6"; // optimism
|
||||||
#[cfg(feature = "simulation-mode")]
|
#[cfg(feature = "simulation-mode")]
|
||||||
const KNS_ADDRESS: &'static str = "0x5FbDB2315678afecb367f032d93F642f64180aa3";
|
const KNS_ADDRESS: &'static str = "0x5FbDB2315678afecb367f032d93F642f64180aa3"; // local
|
||||||
|
|
||||||
const CHAIN_ID: u64 = 10;
|
#[cfg(not(feature = "simulation-mode"))]
|
||||||
|
const CHAIN_ID: u64 = 10; // optimism
|
||||||
#[cfg(feature = "simulation-mode")]
|
#[cfg(feature = "simulation-mode")]
|
||||||
const CHAIN_ID: u64 = 31337;
|
const CHAIN_ID: u64 = 31337; // local
|
||||||
|
|
||||||
const KNS_FIRST_BLOCK: u64 = 114_923_786;
|
#[cfg(not(feature = "simulation-mode"))]
|
||||||
|
const KNS_FIRST_BLOCK: u64 = 114_923_786; // optimism
|
||||||
#[cfg(feature = "simulation-mode")]
|
#[cfg(feature = "simulation-mode")]
|
||||||
const KNS_FIRST_BLOCK: u64 = 1;
|
const KNS_FIRST_BLOCK: u64 = 1; // local
|
||||||
|
|
||||||
#[derive(Clone, Debug, Serialize, Deserialize)]
|
#[derive(Clone, Debug, Serialize, Deserialize)]
|
||||||
struct State {
|
struct State {
|
||||||
@ -123,17 +126,17 @@ fn subscribe_to_logs(eth_provider: ð::Provider, from_block: u64, filter: eth:
|
|||||||
|
|
||||||
call_init!(init);
|
call_init!(init);
|
||||||
fn init(our: Address) {
|
fn init(our: Address) {
|
||||||
println!("indexing on contract address {}", KNS_CONTRACT_ADDRESS);
|
println!("indexing on contract address {}", KNS_ADDRESS);
|
||||||
|
|
||||||
// if we have state, load it in
|
// if we have state, load it in
|
||||||
let state: State = match get_typed_state(|bytes| Ok(bincode::deserialize::<State>(bytes)?)) {
|
let state: State = match get_typed_state(|bytes| Ok(bincode::deserialize::<State>(bytes)?)) {
|
||||||
Some(s) => {
|
Some(s) => {
|
||||||
// if chain id or contract address changed from a previous run, reset state
|
// if chain id or contract address changed from a previous run, reset state
|
||||||
if s.chain_id != CHAIN_ID || s.contract_address != KNS_CONTRACT_ADDRESS {
|
if s.chain_id != CHAIN_ID || s.contract_address != KNS_ADDRESS {
|
||||||
println!("resetting state because runtime contract address or chain ID changed");
|
println!("resetting state because runtime contract address or chain ID changed");
|
||||||
State {
|
State {
|
||||||
chain_id: CHAIN_ID,
|
chain_id: CHAIN_ID,
|
||||||
contract_address: KNS_CONTRACT_ADDRESS,
|
contract_address: KNS_ADDRESS.to_string(),
|
||||||
names: HashMap::new(),
|
names: HashMap::new(),
|
||||||
nodes: HashMap::new(),
|
nodes: HashMap::new(),
|
||||||
block: KNS_FIRST_BLOCK,
|
block: KNS_FIRST_BLOCK,
|
||||||
@ -145,7 +148,7 @@ fn init(our: Address) {
|
|||||||
}
|
}
|
||||||
None => State {
|
None => State {
|
||||||
chain_id: CHAIN_ID,
|
chain_id: CHAIN_ID,
|
||||||
contract_address: KNS_CONTRACT_ADDRESS,
|
contract_address: KNS_ADDRESS.to_string(),
|
||||||
names: HashMap::new(),
|
names: HashMap::new(),
|
||||||
nodes: HashMap::new(),
|
nodes: HashMap::new(),
|
||||||
block: KNS_FIRST_BLOCK,
|
block: KNS_FIRST_BLOCK,
|
||||||
|
Loading…
Reference in New Issue
Block a user