Skip to content

Commit

Permalink
fix: cancel max coin of 21000000 for dogecoin
Browse files Browse the repository at this point in the history
  • Loading branch information
aya015757881 committed Dec 26, 2024
1 parent 46db076 commit df4ec7d
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 14 deletions.
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 crates/anychain-bitcoin/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "anychain-bitcoin"
description = "A Rust library for Bitcoin-focused cryptocurrency wallets, enabling seamless transactions on the Bitcoin blockchain"
version = "0.1.11"
version = "0.1.12"
keywords = ["bitcoin", "blockchain", "wallet", "transactions"]
categories = ["cryptography::cryptocurrencies"]

Expand Down
13 changes: 1 addition & 12 deletions crates/anychain-bitcoin/src/amount.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
use anychain_core::no_std::*;
use anychain_core::{Amount, AmountError};

use core::fmt;
Expand All @@ -8,9 +7,6 @@ use std::ops::{Add, Sub};
// Number of satoshis (base unit) per BTC
const COIN: i64 = 1_0000_0000;

// Maximum number of satoshis
const MAX_COINS: i64 = 21_000_000 * COIN;

/// Represents the amount of Bitcoin in satoshis
#[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize)]
pub struct BitcoinAmount(pub i64);
Expand Down Expand Up @@ -72,14 +68,7 @@ impl BitcoinAmount {
pub const ONE_BTC: BitcoinAmount = BitcoinAmount(COIN);

pub fn from_satoshi(satoshis: i64) -> Result<Self, AmountError> {
if (-MAX_COINS..=MAX_COINS).contains(&satoshis) {
Ok(Self(satoshis))
} else {
Err(AmountError::AmountOutOfBounds(
satoshis.to_string(),
MAX_COINS.to_string(),
))
}
Ok(Self(satoshis))
}

pub fn from_ubtc(ubtc_value: i64) -> Result<Self, AmountError> {
Expand Down

0 comments on commit df4ec7d

Please sign in to comment.