Skip to content

Commit

Permalink
remove is_onboarded flag
Browse files Browse the repository at this point in the history
  • Loading branch information
miralandlabs committed Jul 31, 2024
1 parent e269158 commit c281da9
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 19 deletions.
Binary file modified public/blink-upgrade.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 8 additions & 8 deletions src/components/landing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use web_time::{Duration, Instant};
use crate::{
components::{DiscordIcon, Footer, GithubIcon, OreIcon, OreLogoIcon, XIcon},
hooks::{
use_is_onboarded, use_ore_supply, use_screen_size, use_treasury_ore_balance, ScreenSize,
use_ore_supply, use_screen_size, use_treasury_ore_balance, ScreenSize,
UiTokenAmountBalance,
},
miner::WEB_WORKERS,
Expand All @@ -33,9 +33,9 @@ fn gen_asset_path(filename: &str, screen_size: Signal<ScreenSize>) -> String {
}

pub fn Landing() -> Element {
let nav = navigator();
// let nav = navigator();
let screen_size = use_screen_size();
let is_onboarded = use_is_onboarded();
// let is_onboarded = use_is_onboarded();
let mut i = use_signal(|| 0usize);
let bg_imgs = [
(gen_asset_path("rock-1", screen_size), TextColor::White),
Expand All @@ -54,10 +54,10 @@ pub fn Landing() -> Element {
}
});

// If the user is already onboarded, redirect to home.
if is_onboarded.read().0 {
nav.replace(Route::Home {});
}
// // If the user is already onboarded, redirect to home.
// if is_onboarded.read().0 {
// nav.replace(Route::Home {});
// }

rsx! {
for (index, bg_img) in bg_imgs.iter().enumerate() {
Expand All @@ -71,7 +71,7 @@ pub fn Landing() -> Element {
class: "absolute top-0 flex flex-col w-full h-full overflow-y-scroll z-50 snap-y snap-mandatory",
Hero {
text_color,
title: "The classic way to mine ORE",
title: "Classic, Efficient ORE Mining",
subtitle: &"No relayer, No escrow. Not your keypair, Not your ore."
}
Block {
Expand Down
24 changes: 15 additions & 9 deletions src/gateway/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ pub const RPC_URL: &str = "https://rpc.ironforge.network/mainnet?apiKey=01J3ZM0E
pub const CU_LIMIT_CLAIM: u32 = 12_000;
pub const CU_LIMIT_STAKE: u32 = 12_000; // MI added
pub const CU_LIMIT_MINE: u32 = 500_000;
// pub const CU_LIMIT_UPGRADE: u32 = 20_000;

const RPC_RETRIES: usize = 0;
const GATEWAY_RETRIES: usize = 4;
Expand Down Expand Up @@ -77,6 +78,15 @@ impl Gateway {
bincode::deserialize::<Clock>(&data).or(Err(GatewayError::FailedDeserialization))
}

pub async fn get_config(&self) -> GatewayResult<Config> {
let data = self
.rpc
.get_account_data(&CONFIG_ADDRESS)
.await
.map_err(GatewayError::from)?;
Ok(*Config::try_from_bytes(&data).expect("Failed to parse config account"))
}

pub async fn get_proof(&self, authority: Pubkey) -> GatewayResult<Proof> {
let data = self
.rpc
Expand Down Expand Up @@ -105,15 +115,6 @@ impl Gateway {
// Ok(*Treasury::try_from_bytes(&data).expect("Failed to parse treasury account"))
// }

pub async fn get_config(&self) -> GatewayResult<Config> {
let data = self
.rpc
.get_account_data(&CONFIG_ADDRESS)
.await
.map_err(GatewayError::from)?;
Ok(*Config::try_from_bytes(&data).expect("Failed to parse config account"))
}

pub async fn _get_token_account(
&self,
pubkey: &Pubkey,
Expand Down Expand Up @@ -465,3 +466,8 @@ pub fn signer() -> Keypair {
pub fn ore_token_account_address(pubkey: Pubkey) -> Pubkey {
get_associated_token_address(&pubkey, &ore_api::consts::MINT_ADDRESS)
}

#[cached]
pub fn ore_token_account_address_v1(pubkey: Pubkey) -> Pubkey {
get_associated_token_address(&pubkey, &ore_api::consts::MINT_V1_ADDRESS)
}
5 changes: 3 additions & 2 deletions src/miner/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ impl Miner {
match submit_solution(&gateway, best_solution, priority_fee).await {
// Start mining again
Ok(_sig) => {
// log::info!("Success: {}", sig); // MI
// log::info!("Sig: {}", sig); // MI
proof.restart();
if let MinerStatus::Active = toolbar_state.status() {
if let Ok(proof) = gateway.get_proof(pubkey).await {
Expand All @@ -144,7 +144,8 @@ impl Miner {
.last_hash_at
.saturating_add(60)
.saturating_sub(clock.unix_timestamp)
.max(0) as u64;
.max(0)
as u64;
self.start_mining(proof.challenge.into(), 0, cutoff_time)
.await;
} else {
Expand Down

0 comments on commit c281da9

Please sign in to comment.