Skip to content
This repository was archived by the owner on May 29, 2025. It is now read-only.

Conversation

@jmoreira-valory
Copy link
Collaborator

@jmoreira-valory jmoreira-valory commented Sep 4, 2023

A few updates related to checking balance:

  • Refactored to a method at the top of the script.
  • Checked agent address also on re-runs.
  • Displayed always in DAI units.
  • Rearranged displayed text for better display.
  • Added spinner.

Additionally:

  • Added copyright information
  • Minor cosmetic changes in the messages displayed

This is how it should look like:

Your agent instance's address: 0x456170dd7ab80901957283776629b8c6B2542E78
Your service's Safe address: 0xb9d8fDF0e1a5bC188fE314a9CbaB2BAb71C5F33e

Please, fund your agent instance's address with at least 0.0500 DAI.
    - Address: 0x3AF1698a2661C57967475F6E9B6f0DC6593284Fa
    - Balance: 0.0504 DAI
      OK.

Please, fund your service Safe's address with at least 0.500 DAI.
    - Address: 0xea6C5047D44388964124C69A8a9926FFfDEe6AF7
    - Balance: 0.4700 DAI
      Waiting... / 
    - Updated balance: 0.5000 DAI
      OK.

Setting up the service...

Base automatically changed from chore/windows-script to main September 4, 2023 21:15

echo "Minting your service on Gnosis chain..."
ensure_minimum_balance $operator_address $suggested_amount "Please, fund the operator's address with at least $(wei_to_dai $suggested_amount) DAI."

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Adamantios Here I removed the check for the minimum balance of the agent instance address.

run_service.sh Outdated
local decimal_precision=4 # Change this to your desired precision
local dai=$($PYTHON_CMD -c "print('%.${decimal_precision}f' % ($wei / 1000000000000000000.0))")
echo "$dai DAI"
echo "$dai"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why?

Copy link
Collaborator Author

@jmoreira-valory jmoreira-valory Sep 5, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Functions should do only one thing":

The method was doing 2 things: conversion and formatting.

Now formatting is done in the strings using this function (I added DAI to these strings).

This allows using the output of this function as a number directly, in case it is ever required.

@DavidMinarsch DavidMinarsch merged commit 700b983 into main Sep 5, 2023
@DavidMinarsch DavidMinarsch deleted the chore/check_funds branch September 5, 2023 13:01
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants