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

Balance refactor #3069

Open
wants to merge 18 commits into
base: develop
Choose a base branch
from
Open

Balance refactor #3069

wants to merge 18 commits into from

Conversation

portuu3
Copy link
Collaborator

@portuu3 portuu3 commented Feb 4, 2025

Issue tracking

Closes #2982

Context behind the change

  • Fixes possible negative balances
  • Allows to choose the token for funding the escrow.
  • Use utils for handling operations like mul, div, etc

How has this been tested?

  • Created a job paid with fiat USD and funded with HMT
  • Created a job paid with HMT and funded with HMT
  • Funded the account with crypto
  • Funded the account with fiat
  • Refund after cancellation
  • Created a job using balance

Unit tests partially updated. Job service needs a refactor so tests for this service will be implemented from scratch.

Release plan

Includes a migration to add token to jobs table

Potential risks; What to monitor; Rollback plan

Monitor payments table
Rollback: undo last migration

@portuu3 portuu3 self-assigned this Feb 4, 2025
Copy link

vercel bot commented Feb 4, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
human-app ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 10, 2025 5:11pm
human-dashboard-frontend ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 10, 2025 5:11pm
staking-dashboard ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 10, 2025 5:11pm
2 Skipped Deployments
Name Status Preview Comments Updated (UTC)
faucet-frontend ⬜️ Ignored (Inspect) Visit Preview Feb 10, 2025 5:11pm
faucet-server ⬜️ Ignored (Inspect) Visit Preview Feb 10, 2025 5:11pm

@portuu3 portuu3 added the do-not-merge PR shouldn't be merged until this label is removed label Feb 4, 2025
}
paymentEntity.amount = -totalPaymentAmount; // In the currency used for the payment.
paymentEntity.currency = dto.paymentCurrency;
paymentEntity.rate = paymentCurrencyRate;
Copy link
Contributor

@Dzeranov Dzeranov Feb 7, 2025

Choose a reason for hiding this comment

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

I believe it makes more sense to store an actual rate conversion (for example usd -> hmt (escrow fund token))

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It can be obtained anyway, using payments and job info

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
do-not-merge PR shouldn't be merged until this label is removed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Job Launcher] Payments refactor
3 participants