From 8cbe93412922b8bfbc77de189dd0d3783a3b7fef Mon Sep 17 00:00:00 2001 From: sergeysamonte Date: Thu, 3 May 2018 00:52:44 +0800 Subject: [PATCH] Update decimal places from 12 to 4. --- m0rkcoin_tip_bot/bot.py | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/m0rkcoin_tip_bot/bot.py b/m0rkcoin_tip_bot/bot.py index 03df3fc..2815ee4 100644 --- a/m0rkcoin_tip_bot/bot.py +++ b/m0rkcoin_tip_bot/bot.py @@ -42,9 +42,9 @@ async def balance(context: commands.Context): wallet = store.get_user_wallet(user.user_id) await bot.send_message( context.message.author, '**Your balance**\n\n' - f'Available: {wallet.actual_balance / M0RKCOIN_DIGITS:.12f} ' + f'Available: {wallet.actual_balance / M0RKCOIN_DIGITS:.4f} ' f'{M0RKCOIN_REPR}\n' - f'Pending: {wallet.locked_balance / M0RKCOIN_DIGITS:.12f} ' + f'Pending: {wallet.locked_balance / M0RKCOIN_DIGITS:.4f} ' f'{M0RKCOIN_REPR}\n') @@ -94,25 +94,25 @@ async def withdraw(context: commands.Context, amount: float): if real_amount + config.tx_fee >= user_balance_wallet.actual_balance: await bot.send_message(context.message.author, f'Insufficient balance to withdraw ' - f'{real_amount / M0RKCOIN_DIGITS:.12f} ' + f'{real_amount / M0RKCOIN_DIGITS:.4f} ' f'{M0RKCOIN_REPR}.') return if real_amount > config.max_tx_amount: await bot.reply(f'Transactions cannot be bigger than ' - f'{config.max_tx_amount / M0RKCOIN_DIGITS:.12f} ' + f'{config.max_tx_amount / M0RKCOIN_DIGITS:.4f} ' f'{M0RKCOIN_REPR}') return elif real_amount < config.min_tx_amount: await bot.reply(f'Transactions cannot be lower than ' - f'{config.min_tx_amount / M0RKCOIN_DIGITS:.12f} ' + f'{config.min_tx_amount / M0RKCOIN_DIGITS:.4f} ' f'{M0RKCOIN_REPR}') return withdrawal = store.withdraw(user, real_amount) await bot.send_message( context.message.author, - f'You have withdrawn {real_amount / M0RKCOIN_DIGITS:.12f} ' + f'You have withdrawn {real_amount / M0RKCOIN_DIGITS:.4f} ' f'{M0RKCOIN_REPR}.\n' f'Transaction hash: `{withdrawal.tx_hash}`') @@ -130,24 +130,24 @@ async def tip(context: commands.Context, member: discord.Member, if real_amount + config.tx_fee >= user_from_wallet.actual_balance: await bot.reply(f'Insufficient balance to send tip of ' - f'{real_amount / M0RKCOIN_DIGITS:.12f} ' + f'{real_amount / M0RKCOIN_DIGITS:.4f} ' f'{M0RKCOIN_REPR} to {member.mention}.') return if real_amount > config.max_tx_amount: await bot.reply(f'Transactions cannot be bigger than ' - f'{config.max_tx_amount / M0RKCOIN_DIGITS:.12f} ' + f'{config.max_tx_amount / M0RKCOIN_DIGITS:.4f} ' f'{M0RKCOIN_REPR}.') return elif real_amount < config.min_tx_amount: await bot.reply(f'Transactions cannot be smaller than ' - f'{config.min_tx_amount / M0RKCOIN_DIGITS:.12f} ' + f'{config.min_tx_amount / M0RKCOIN_DIGITS:.4f} ' f'{M0RKCOIN_REPR}.') return tip = store.send_tip(user_from, user_to, real_amount) - await bot.reply(f'Tip of {real_amount / M0RKCOIN_DIGITS:.12f} ' + await bot.reply(f'Tip of {real_amount / M0RKCOIN_DIGITS:.4f} ' f'{M0RKCOIN_REPR} ' f'was sent to {member.mention}\n' f'Transaction hash: `{tip.tx_hash}`')