@@ -72,12 +72,12 @@ impl Denomination {
7272 /// Returns stringly representation of this
7373 fn as_str ( self ) -> & ' static str {
7474 match self {
75- Denomination :: Dash => "BTC " ,
76- Denomination :: CentiDash => "cBTC " ,
77- Denomination :: MilliDash => "mBTC " ,
78- Denomination :: MicroDash => "uBTC " ,
79- Denomination :: NanoDash => "nBTC " ,
80- Denomination :: PicoDash => "pBTC " ,
75+ Denomination :: Dash => "DASH " ,
76+ Denomination :: CentiDash => "cDASH " ,
77+ Denomination :: MilliDash => "mDASH " ,
78+ Denomination :: MicroDash => "uDASH " ,
79+ Denomination :: NanoDash => "nDASH " ,
80+ Denomination :: PicoDash => "pDASH " ,
8181 Denomination :: Bit => "bits" ,
8282 Denomination :: Satoshi => "satoshi" ,
8383 Denomination :: MilliSatoshi => "msat" ,
@@ -87,12 +87,12 @@ impl Denomination {
8787 /// The different str forms of denominations that are recognized.
8888 fn forms ( s : & str ) -> Option < Self > {
8989 match s {
90- "BTC " | "btc " => Some ( Denomination :: Dash ) ,
91- "cBTC " | "cbtc " => Some ( Denomination :: CentiDash ) ,
92- "mBTC " | "mbtc " => Some ( Denomination :: MilliDash ) ,
93- "uBTC " | "ubtc " => Some ( Denomination :: MicroDash ) ,
94- "nBTC " | "nbtc " => Some ( Denomination :: NanoDash ) ,
95- "pBTC " | "pbtc " => Some ( Denomination :: PicoDash ) ,
90+ "DASH " | "dash " => Some ( Denomination :: Dash ) ,
91+ "cDASH " | "cdash " => Some ( Denomination :: CentiDash ) ,
92+ "mDASH " | "mdash " => Some ( Denomination :: MilliDash ) ,
93+ "uDASH " | "udash " => Some ( Denomination :: MicroDash ) ,
94+ "nDASH " | "ndash " => Some ( Denomination :: NanoDash ) ,
95+ "pDASH " | "pdash " => Some ( Denomination :: PicoDash ) ,
9696 "bit" | "bits" | "BIT" | "BITS" => Some ( Denomination :: Bit ) ,
9797 "SATOSHI" | "satoshi" | "SATOSHIS" | "satoshis" | "SAT" | "sat" | "SATS" | "sats" => {
9898 Some ( Denomination :: Satoshi )
@@ -106,7 +106,7 @@ impl Denomination {
106106/// These form are ambiguous and could have many meanings. For example, M could denote Mega or Milli.
107107/// If any of these forms are used, an error type PossiblyConfusingDenomination is returned.
108108const CONFUSING_FORMS : [ & str ; 9 ] =
109- [ "Msat" , "Msats" , "MSAT" , "MSATS" , "MSat" , "MSats" , "MBTC " , "Mbtc " , "PBTC " ] ;
109+ [ "Msat" , "Msats" , "MSAT" , "MSATS" , "MSat" , "MSats" , "MDASH " , "Mdash " , "PDASH " ] ;
110110
111111impl fmt:: Display for Denomination {
112112 fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
@@ -692,7 +692,7 @@ impl default::Default for Amount {
692692
693693impl fmt:: Debug for Amount {
694694 fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
695- write ! ( f, "Amount({:.8} BTC )" , self . to_dash( ) )
695+ write ! ( f, "Amount({:.8} DASH )" , self . to_dash( ) )
696696 }
697697}
698698
@@ -1112,7 +1112,7 @@ impl default::Default for SignedAmount {
11121112
11131113impl fmt:: Debug for SignedAmount {
11141114 fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
1115- write ! ( f, "SignedAmount({:.8} BTC )" , self . to_btc( ) )
1115+ write ! ( f, "SignedAmount({:.8} DASH )" , self . to_btc( ) )
11161116 }
11171117}
11181118
@@ -1625,7 +1625,7 @@ mod tests {
16251625
16261626 #[ test]
16271627 fn from_str_zero ( ) {
1628- let denoms = vec ! [ "BTC " , "mBTC " , "uBTC " , "nBTC " , "pBTC " , "bits" , "sats" , "msats" ] ;
1628+ let denoms = vec ! [ "DASH " , "mDASH " , "uDASH " , "nDASH " , "pDASH " , "bits" , "sats" , "msats" ] ;
16291629 for denom in denoms {
16301630 for v in & [ "0" , "000" ] {
16311631 let s = format ! ( "{} {}" , v, denom) ;
@@ -1794,16 +1794,16 @@ mod tests {
17941794 assert_eq ! ( Amount :: ONE_SAT . to_string_in( D :: Dash ) , "0.00000001" ) ;
17951795 assert_eq ! ( SignedAmount :: from_sat( -42 ) . to_string_in( D :: Dash ) , "-0.00000042" ) ;
17961796
1797- assert_eq ! ( Amount :: ONE_BTC . to_string_with_denomination( D :: Dash ) , "1 BTC " ) ;
1797+ assert_eq ! ( Amount :: ONE_BTC . to_string_with_denomination( D :: Dash ) , "1 DASH " ) ;
17981798 assert_eq ! ( Amount :: ONE_SAT . to_string_with_denomination( D :: MilliSatoshi ) , "1000 msat" ) ;
17991799 assert_eq ! (
18001800 SignedAmount :: ONE_BTC . to_string_with_denomination( D :: Satoshi ) ,
18011801 "100000000 satoshi"
18021802 ) ;
1803- assert_eq ! ( Amount :: ONE_SAT . to_string_with_denomination( D :: Dash ) , "0.00000001 BTC " ) ;
1803+ assert_eq ! ( Amount :: ONE_SAT . to_string_with_denomination( D :: Dash ) , "0.00000001 DASH " ) ;
18041804 assert_eq ! (
18051805 SignedAmount :: from_sat( -42 ) . to_string_with_denomination( D :: Dash ) ,
1806- "-0.00000042 BTC "
1806+ "-0.00000042 DASH "
18071807 ) ;
18081808 }
18091809
@@ -2009,11 +2009,11 @@ mod tests {
20092009 fn from_str ( ) {
20102010 use super :: ParseAmountError as E ;
20112011
2012- assert_eq ! ( Amount :: from_str( "x BTC " ) , Err ( E :: InvalidCharacter ( 'x' ) ) ) ;
2013- assert_eq ! ( Amount :: from_str( "xBTC " ) , Err ( E :: UnknownDenomination ( "xBTC " . into( ) ) ) ) ;
2014- assert_eq ! ( Amount :: from_str( "5 BTC BTC " ) , Err ( E :: UnknownDenomination ( "BTC BTC " . into( ) ) ) ) ;
2015- assert_eq ! ( Amount :: from_str( "5BTC BTC " ) , Err ( E :: InvalidCharacter ( 'B ' ) ) ) ;
2016- assert_eq ! ( Amount :: from_str( "5 5 BTC " ) , Err ( E :: UnknownDenomination ( "5 BTC " . into( ) ) ) ) ;
2012+ assert_eq ! ( Amount :: from_str( "x DASH " ) , Err ( E :: InvalidCharacter ( 'x' ) ) ) ;
2013+ assert_eq ! ( Amount :: from_str( "xDASH " ) , Err ( E :: UnknownDenomination ( "xDASH " . into( ) ) ) ) ;
2014+ assert_eq ! ( Amount :: from_str( "5 DASH DASH " ) , Err ( E :: UnknownDenomination ( "DASH DASH " . into( ) ) ) ) ;
2015+ assert_eq ! ( Amount :: from_str( "5DASH DASH " ) , Err ( E :: InvalidCharacter ( 'D ' ) ) ) ;
2016+ assert_eq ! ( Amount :: from_str( "5 5 DASH " ) , Err ( E :: UnknownDenomination ( "5 DASH " . into( ) ) ) ) ;
20172017
20182018 #[ track_caller]
20192019 fn case ( s : & str , expected : Result < Amount , ParseAmountError > ) {
@@ -2029,20 +2029,20 @@ mod tests {
20292029
20302030 case ( "5 BCH" , Err ( E :: UnknownDenomination ( "BCH" . to_owned ( ) ) ) ) ;
20312031
2032- case ( "-1 BTC " , Err ( E :: Negative ) ) ;
2033- case ( "-0.0 BTC " , Err ( E :: Negative ) ) ;
2034- case ( "0.123456789 BTC " , Err ( E :: TooPrecise ) ) ;
2032+ case ( "-1 DASH " , Err ( E :: Negative ) ) ;
2033+ case ( "-0.0 DASH " , Err ( E :: Negative ) ) ;
2034+ case ( "0.123456789 DASH " , Err ( E :: TooPrecise ) ) ;
20352035 scase ( "-0.1 satoshi" , Err ( E :: TooPrecise ) ) ;
2036- case ( "0.123456 mBTC " , Err ( E :: TooPrecise ) ) ;
2036+ case ( "0.123456 mDASH " , Err ( E :: TooPrecise ) ) ;
20372037 scase ( "-1.001 bits" , Err ( E :: TooPrecise ) ) ;
2038- scase ( "-200000000000 BTC " , Err ( E :: TooBig ) ) ;
2038+ scase ( "-200000000000 DASH " , Err ( E :: TooBig ) ) ;
20392039 case ( "18446744073709551616 sat" , Err ( E :: TooBig ) ) ;
20402040
20412041 case ( ".5 bits" , Ok ( Amount :: from_sat ( 50 ) ) ) ;
20422042 scase ( "-.5 bits" , Ok ( SignedAmount :: from_sat ( -50 ) ) ) ;
2043- case ( "0.00253583 BTC " , Ok ( Amount :: from_sat ( 253583 ) ) ) ;
2043+ case ( "0.00253583 DASH " , Ok ( Amount :: from_sat ( 253583 ) ) ) ;
20442044 scase ( "-5 satoshi" , Ok ( SignedAmount :: from_sat ( -5 ) ) ) ;
2045- case ( "0.10000000 BTC " , Ok ( Amount :: from_sat ( 100_000_00 ) ) ) ;
2045+ case ( "0.10000000 DASH " , Ok ( Amount :: from_sat ( 100_000_00 ) ) ) ;
20462046 scase ( "-100 bits" , Ok ( SignedAmount :: from_sat ( -10_000 ) ) ) ;
20472047 }
20482048
@@ -2138,12 +2138,12 @@ mod tests {
21382138 assert_eq ! ( Amount :: from_str( & denom( amt, D :: PicoDash ) ) , Ok ( amt) ) ;
21392139
21402140 assert_eq ! (
2141- Amount :: from_str( "42 satoshi BTC " ) ,
2142- Err ( ParseAmountError :: UnknownDenomination ( "satoshi BTC " . into( ) ) ) ,
2141+ Amount :: from_str( "42 satoshi DASH " ) ,
2142+ Err ( ParseAmountError :: UnknownDenomination ( "satoshi DASH " . into( ) ) ) ,
21432143 ) ;
21442144 assert_eq ! (
21452145 SignedAmount :: from_str( "-42 satoshi BTC" ) ,
2146- Err ( ParseAmountError :: UnknownDenomination ( "satoshi BTC " . into( ) ) ) ,
2146+ Err ( ParseAmountError :: UnknownDenomination ( "satoshi DASH " . into( ) ) ) ,
21472147 ) ;
21482148 }
21492149
@@ -2364,8 +2364,8 @@ mod tests {
23642364 fn denomination_string_acceptable_forms ( ) {
23652365 // Non-exhaustive list of valid forms.
23662366 let valid = vec ! [
2367- "BTC " , "btc " , "mBTC " , "mbtc " , "uBTC " , "ubtc " , "SATOSHI" , "satoshi" , "SATOSHIS" ,
2368- "satoshis" , "SAT" , "sat" , "SATS" , "sats" , "bit" , "bits" , "nBTC " , "pBTC " ,
2367+ "DASH " , "dash " , "mDASH " , "mdash " , "uDASH " , "udash " , "SATOSHI" , "satoshi" , "SATOSHIS" ,
2368+ "satoshis" , "SAT" , "sat" , "SATS" , "sats" , "bit" , "bits" , "nDASH " , "pDASH " ,
23692369 ] ;
23702370 for denom in valid. iter ( ) {
23712371 assert ! ( Denomination :: from_str( denom) . is_ok( ) ) ;
@@ -2374,7 +2374,7 @@ mod tests {
23742374
23752375 #[ test]
23762376 fn disallow_confusing_forms ( ) {
2377- let confusing = [ "Msat" , "Msats" , "MSAT" , "MSATS" , "MSat" , "MSats" , "MBTC " , "Mbtc " , "PBTC " ] ;
2377+ let confusing = [ "Msat" , "Msats" , "MSAT" , "MSATS" , "MSat" , "MSats" , "MDASH " , "MDash " , "PDASH " ] ;
23782378 for denom in confusing. iter ( ) {
23792379 match Denomination :: from_str ( denom) {
23802380 Ok ( _) => panic ! ( "from_str should error for {}" , denom) ,
@@ -2387,7 +2387,7 @@ mod tests {
23872387 #[ test]
23882388 fn disallow_unknown_denomination ( ) {
23892389 // Non-exhaustive list of unknown forms.
2390- let unknown = [ "NBTC " , "UBTC " , "ABC" , "abc" , "cBtC" , "Sat" , "Sats" ] ;
2390+ let unknown = [ "NDASH " , "UDASH " , "ABC" , "abc" , "cBtC" , "Sat" , "Sats" ] ;
23912391 for denom in unknown. iter ( ) {
23922392 match Denomination :: from_str ( denom) {
23932393 Ok ( _) => panic ! ( "from_str should error for {}" , denom) ,
0 commit comments