Add zero const to monero::Amount

This commit is contained in:
Franck Royer 2020-12-07 15:32:40 +11:00
parent 64b021daf4
commit 71a0832ef4
No known key found for this signature in database
GPG Key ID: A82ED75A8DFC50A4
2 changed files with 3 additions and 2 deletions

View File

@ -37,7 +37,7 @@ async fn happy_path() {
// 10_000 * 100 // 10_000 * 100
let xmr_to_swap = xmr_btc::monero::Amount::from_piconero(1_000_000_000_000); let xmr_to_swap = xmr_btc::monero::Amount::from_piconero(1_000_000_000_000);
let xmr_alice = xmr_to_swap * 10; let xmr_alice = xmr_to_swap * 10;
let xmr_bob = xmr_btc::monero::Amount::from_piconero(0); let xmr_bob = xmr_btc::monero::Amount::ZERO;
// todo: This should not be hardcoded // todo: This should not be hardcoded
let alice_multiaddr: Multiaddr = "/ip4/127.0.0.1/tcp/9876" let alice_multiaddr: Multiaddr = "/ip4/127.0.0.1/tcp/9876"
@ -142,7 +142,7 @@ async fn alice_punishes_if_bob_never_acts_after_fund() {
let xmr_to_swap = xmr_btc::monero::Amount::from_piconero(1_000_000_000_000); let xmr_to_swap = xmr_btc::monero::Amount::from_piconero(1_000_000_000_000);
let bob_btc_starting_balance = btc_to_swap * 10; let bob_btc_starting_balance = btc_to_swap * 10;
let bob_xmr_starting_balance = xmr_btc::monero::Amount::from_piconero(0); let bob_xmr_starting_balance = xmr_btc::monero::Amount::ZERO;
let alice_btc_starting_balance = bitcoin::Amount::ZERO; let alice_btc_starting_balance = bitcoin::Amount::ZERO;
let alice_xmr_starting_balance = xmr_to_swap * 10; let alice_xmr_starting_balance = xmr_to_swap * 10;

View File

@ -76,6 +76,7 @@ pub struct PublicViewKey(PublicKey);
pub struct Amount(u64); pub struct Amount(u64);
impl Amount { impl Amount {
pub const ZERO: Self = Self(0);
/// Create an [Amount] with piconero precision and the given number of /// Create an [Amount] with piconero precision and the given number of
/// piconeros. /// piconeros.
/// ///