Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add currency abstraction #1815

Closed
xmonader opened this issue Dec 28, 2023 · 5 comments
Closed

Add currency abstraction #1815

xmonader opened this issue Dec 28, 2023 · 5 comments
Assignees
Labels
type_feature New feature or request
Milestone

Comments

@xmonader
Copy link
Contributor

We keep doing the conversions manually, and .toFixed calls way too often, let's introduce some sort of Tft class or Currency that can handle the logic of conversion, hourly, monthly, yearly calculations, and the string representation, .. etc

@ramezsaeed ramezsaeed added this to 3.14.x Jan 3, 2024
@ramezsaeed ramezsaeed added this to the 2.4.0 milestone Jan 3, 2024
@xmonader xmonader added the type_feature New feature or request label Jan 15, 2024
@MohamedElmdary MohamedElmdary moved this to Accepted in 3.14.x Feb 14, 2024
@AhmedHanafy725 AhmedHanafy725 modified the milestones: 2.4.0, 2.5.0 Mar 25, 2024
@zaelgohary zaelgohary self-assigned this Apr 21, 2024
@zaelgohary zaelgohary moved this from Accepted to In Progress in 3.14.x Apr 21, 2024
@zaelgohary zaelgohary moved this from In Progress to Accepted in 3.14.x Apr 21, 2024
@zaelgohary zaelgohary moved this from Accepted to In Progress in 3.14.x Apr 29, 2024
@zaelgohary zaelgohary moved this from In Progress to Accepted in 3.14.x Apr 29, 2024
@zaelgohary zaelgohary moved this from Accepted to In Progress in 3.14.x May 15, 2024
@zaelgohary
Copy link
Contributor

zaelgohary commented May 15, 2024

WIP:

Added the TFT class which contains conversions to/from USD alongside monthly and yearly conversions. Currently working on implementing the script to use the mentioned functions. I didn't add hourly as it's the default value.

@zaelgohary
Copy link
Contributor

WIP:

Used decimal in the abstraction and updated the script. Currently working on adding unit tests.

@zaelgohary
Copy link
Contributor

WIP:

Edited the TFT module and updated its script and added some tests. However, some of the tests are not working and I'm working on fixing them.

@zaelgohary zaelgohary moved this from In Progress to Pending Review in 3.14.x May 20, 2024
@zaelgohary
Copy link
Contributor

zaelgohary commented May 20, 2024

Work completed:

Changed the class name and removed the calculator and the substrate_url completely and got TFT price directly from TFChain instead. Applied changes in the script and its tests. Also, added more tests.

@zaelgohary zaelgohary moved this from Pending Review to In Verification in 3.14.x May 25, 2024
@zaelgohary
Copy link
Contributor

Changed the previous flow so the user would need to get the rate himself before creating a currency instance (Now the Grid Client is not needed to create the instance). Also added the possibility for the user to change the decimal value for all the method results.

@github-project-automation github-project-automation bot moved this from In Verification to Done in 3.14.x Jun 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type_feature New feature or request
Projects
Status: Done
Development

No branches or pull requests

4 participants