Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Common variables
NETWORK="base-sepolia"
RPC_URL=https://base-sepolia.alchemyapi.io/v2/your-api-key
NETWORK="base"
RPC_URL=https://base-mainnet.alchemyapi.io/v2/your-api-key
MAX_GAS_PRICE="20" # in GWei.
ENCRYPT="false" # true or false

Expand Down
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "mining-cli"
version = "1.3.1"
version = "1.3.2"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
Expand Down
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@ Before you begin, ensure your system meets the following minimum specifications:

- [Quick Start for Base Mainnet](docs/base_mainnet_quickstart.md) (Available since 19th Oct, 2024 00:00 UTC)

- [Quick Start for Base Testnet](docs/base_sepolia_quickstart.md)

3. Additional Resources:

- [How to Add ITX Token to Your Wallet](docs/add_token_to_wallet.md)
Expand Down
34 changes: 0 additions & 34 deletions config/config.base-sepolia.toml

This file was deleted.

4 changes: 0 additions & 4 deletions docs/add_token_to_wallet.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,6 @@ Decimals: `18`

- [Import ITX token to Intmax wallet](#import-itx-token-to-intmax-wallet)

- [Add Base Sepolia testnet to MetaMask](#add-base-sepolia-testnet-to-metaMask)

- [Add Base Sepolia testnet to Intmax wallet](#add-base-sepolia-testnet-to-intmax-wallet)

- [Add Base Mainnet to MetaMask](#add-base-mainnet-to-metaMask)

- [Add Base Mainnet to Intmax wallet](#add-base-mainnet-to-intmax-wallet)
Expand Down
2 changes: 1 addition & 1 deletion docs/base_sepolia_quickstart.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ When you double-click the CLI, you'll see a screen like this:
<img src="../assets/migrate/m1.png" width="600" alt="Mining CLI"></div>

You can move the cursor with the arrow keys and confirm with `Enter`.
For this time, select `base-sepolia (testnet)`.
For this time, select `base`.
<br>

3. **Select Config File**:
Expand Down
2 changes: 1 addition & 1 deletion docs/developer_docs.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ Users utilizing the interactive mode do not need to set these environment variab
| Name | Description | Example | Default Value |
| ---------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------- | ----------------------------------- |
| `RPC_URL` | Blockchain RPC URL. Alchemy's RPC is strongly recommended. Required. | `https://eth-mainnet.alchemyapi.io/v2/YOUR-API-KEY` | None |
| `NETWORK` | The network to connect to. Takes values "base" or "base-sepolia". | `"base"` | `"base-sepolia"` |
| `NETWORK` | The network to connect to. Takes values "base". | `"base"` | `"base"` |
| `MAX_GAS_PRICE` | Maximum gas price in GWei allowed when executing transactions. | `30` | `"30"` (mainnet), `"200"` (testnet) |
| `MINING_UNIT` | Amount of ETH per mining operation. | `"0.1"` or `"1"` | `"0.1"` |
| `MINING_TIMES` | Number of mining operations (sets of deposit and withdrawal). | `"10"` or `"100"` | `"10"` |
Expand Down
13 changes: 2 additions & 11 deletions src/cli/configure.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,15 @@ use crate::{
};

pub fn select_network() -> anyhow::Result<Network> {
let items = vec!["base", "base-sepolia (testnet)", "mainnet (legacy)"];
let items = vec!["base", "mainnet (legacy)"];
let selection = Select::new()
.with_prompt("Choose network")
.items(&items)
.default(0)
.interact()?;
let network = match selection {
0 => "base",
1 => "base-sepolia",
2 => "mainnet",
1 => "mainnet",
_ => unreachable!(),
};
Network::from_str(network).map_err(|_| anyhow::anyhow!("Invalid network"))
Expand Down Expand Up @@ -157,10 +156,6 @@ async fn input_alchemy_url() -> anyhow::Result<String> {
let alchemy_api_key: String = Password::new().with_prompt("Alchemy API Key").interact()?;
match get_network() {
Network::Localnet => bail!("Localnet is not supported"),
Network::BaseSepolia => {
let alchemy_url = format!("https://base-sepolia.g.alchemy.com/v2/{}", alchemy_api_key);
Ok(alchemy_url)
}
Network::Mainnet => {
let alchemy_url = format!("https://eth-mainnet.g.alchemy.com/v2/{}", alchemy_api_key);
Ok(alchemy_url)
Expand All @@ -178,10 +173,6 @@ async fn input_infura_url() -> anyhow::Result<String> {
.interact()?;
match get_network() {
Network::Localnet => bail!("Localnet is not supported"),
Network::BaseSepolia => {
let infura_url = format!("https://base-sepolia.infura.io/v3/{}", infura_project_id);
Ok(infura_url)
}
Network::Mainnet => {
let infura_url = format!("https://mainnet.infura.io/v3/{}", infura_project_id);
Ok(infura_url)
Expand Down
8 changes: 4 additions & 4 deletions src/cli/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -164,10 +164,10 @@ pub fn print_legacy_warning() {
)
} else {
format!(
"{} {}",
style("WARNING:").yellow().bold(),
style("Mining Testnet has transitioned from Holesky to Base-Sepolia. Currently, on Holesky, only asset withdrawals and token claims are possible.")
.yellow())
"{} {}",
style("WARNING:").yellow().bold(),
style("Mining Testnet has been deprecated.").yellow()
)
};
term.write_line(&colored_message).unwrap();
}
13 changes: 1 addition & 12 deletions src/services/mod.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
use crate::{
cli::{
availability::check_availability,
balance_validation::{
validate_deposit_address_balance, validate_withdrawal_address_balance,
},
balance_validation::validate_withdrawal_address_balance,
console::{print_assets_status, print_log, print_status, print_warning},
},
external_api::intmax::circulation::get_circulation,
Expand Down Expand Up @@ -37,15 +35,6 @@ pub async fn mining_loop(
"Processing mining for deposit address {:?}",
key.deposit_address
));
let assets_status = state.sync_and_fetch_assets(&key).await?;
validate_deposit_address_balance(
&state.provider,
&assets_status,
key.deposit_address,
mining_unit,
mining_times,
)
.await?;
loop {
check_availability().await?;
await_until_graph_syncs(&state.graph_client).await?;
Expand Down
2 changes: 0 additions & 2 deletions src/utils/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,10 @@ impl Settings {
}
}

const BASE_SEPOLIA_CONFIG: &[u8] = include_bytes!("../../config/config.base-sepolia.toml");
const BASE_CONFIG: &[u8] = include_bytes!("../../config/config.base.toml");
const MAINNET_CONFIG: &[u8] = include_bytes!("../../config/config.mainnet.toml");

pub fn create_config_files() -> anyhow::Result<()> {
create_file_with_content(&config_path(Network::BaseSepolia), BASE_SEPOLIA_CONFIG)?;
create_file_with_content(&config_path(Network::Base), BASE_CONFIG)?;
create_file_with_content(&config_path(Network::Mainnet), MAINNET_CONFIG)?;
Ok(())
Expand Down
4 changes: 2 additions & 2 deletions src/utils/env_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ mod tests {
let key = B256::random();
let address = get_address_from_private_key(key);
let env_config = super::EnvConfig {
network: Network::BaseSepolia,
network: Network::Localnet,
rpc_url: "http://localhost:8545".to_string(),
max_gas_price: U256::from(30_000_000_000u64),
encrypt: false,
Expand All @@ -280,7 +280,7 @@ mod tests {
let key = B256::random();
let address = get_address_from_private_key(key);
let env_config = super::EnvConfig {
network: Network::BaseSepolia,
network: Network::Localnet,
rpc_url: "http://localhost:8545".to_string(),
max_gas_price: U256::from(30_000_000_000u64),
withdrawal_address: address,
Expand Down
4 changes: 1 addition & 3 deletions src/utils/env_validation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@ use super::{

pub fn get_allowed_mining_times() -> Vec<u64> {
let network = get_network();
if network == Network::BaseSepolia {
vec![1, 5, 10]
} else if network == Network::Base {
if network == Network::Base {
vec![1, 10]
} else {
vec![10]
Expand Down
3 changes: 0 additions & 3 deletions src/utils/network.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ use strum_macros::EnumIter;
pub enum Network {
Localnet,
#[default]
BaseSepolia,
Base,
Mainnet,
}
Expand All @@ -15,7 +14,6 @@ impl Display for Network {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
Network::Localnet => write!(f, "localnet"),
Network::BaseSepolia => write!(f, "base-sepolia"),
Network::Base => write!(f, "base"),
Network::Mainnet => write!(f, "mainnet"),
}
Expand All @@ -30,7 +28,6 @@ impl FromStr for Network {
"localnet" => Ok(Network::Localnet),
"mainnet" => Ok(Network::Mainnet),
"base" => Ok(Network::Base),
"base-sepolia" => Ok(Network::BaseSepolia),
_ => Err(()),
}
}
Expand Down
Loading