Skip to content

Integrate staking amount requirement - #3632

Merged
flopez7 merged 29 commits into
developfrom
feat/staking-requirement
Jan 5, 2026
Merged

Integrate staking amount requirement#3632
flopez7 merged 29 commits into
developfrom
feat/staking-requirement

Conversation

@flopez7

@flopez7 flopez7 commented Oct 24, 2025

Copy link
Copy Markdown
Contributor

Issue tracking

Close #3618, #3560, #3619, #3633

Context behind the change

Reputation Oracle:

  • Added ExchangeApiKeysModule for managing exchange API keys.
  • Added validation for exchange names using ExchangeNameValidator.
  • Integrated AES encryption for storing API keys securely.
  • Implemented exchange-specific clients (GateExchangeClient, MexcExchangeClient) for interacting with respective APIs.
  • Enhanced AuthService to check staking eligibility based on exchange balances.
  • Added configuration services for encryption and staking parameters.
  • Created migration for the exchange_api_keys table in the database.

Human App:

  • Added new stake_allowed property to JWT
  • Check in all the necessary controllers if we're allowed to interact based on this stake property.

How has this been tested?

In progress

Release plan

Add new AES_ENCRYPTION_KEY and STAKING_ELIGIBILITY_ENABLED in Reputation Oracle
Add VITE_STAKING_DASHBOARD_URL in Human App FE

Potential risks; What to monitor; Rollback plan

Not yet defined

- Added ExchangeApiKeysModule for managing exchange API keys.
- Added validation for exchange names using ExchangeNameValidator.
- Integrated AES encryption for storing API keys securely.
- Implemented exchange-specific services (GateExchangeService, MexcExchangeService) for interacting with respective APIs.
- Enhanced AuthService to check staking eligibility based on exchange balances.
- Added configuration services for encryption and staking parameters.
- Created migration for the exchange_api_keys table in the database.
@flopez7
flopez7 requested review from Dzeranov and dnechay October 24, 2025 14:40
@flopez7 flopez7 self-assigned this Oct 24, 2025
@vercel

vercel Bot commented Oct 24, 2025

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
human-app Ready Ready Preview, Comment Jan 5, 2026 0:16am
4 Skipped Deployments
Project Deployment Review Updated (UTC)
faucet-frontend Ignored Ignored Preview Jan 5, 2026 0:16am
faucet-server Ignored Ignored Preview Jan 5, 2026 0:16am
human-dashboard-frontend Skipped Skipped Jan 5, 2026 0:16am
staking-dashboard Skipped Skipped Jan 5, 2026 0:16am

@vercel
vercel Bot temporarily deployed to Preview – human-app October 24, 2025 16:52 Inactive
@vercel
vercel Bot temporarily deployed to Preview – staking-dashboard October 24, 2025 16:52 Inactive
@vercel
vercel Bot temporarily deployed to Preview – human-dashboard-frontend October 24, 2025 16:52 Inactive
@flopez7
flopez7 marked this pull request as draft October 27, 2025 09:48

@dnechay dnechay left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Just a though: it can probably make sense to have just exchanges module where you have all the logic of working with api keys and exchange APIs to avoid circular dependencies and simplify how you instantiate exchange client with api keys of specific user

Review summary
Implementation-wise (i.e. not taking into account code-style/refactoring comments) I have a question regarding of UX of this feature.

Right now in case of errors from exchange (no matter what error: access error or network error) we always fallback to 0 balance. It can lead to situations when some request had a short "hiccup" (dumb network error) and as a result user has "not eligible stake" for the whole JWT lifetime, and for the user it will look like they just don't have any oracles/jobs even if they have necessary staked amount, so that would be very confusing and only thing on how they can understand that is to reach our support, we go to logs, see error and etc. Another case is that they staked after the sing in: they will have to wait until token refresh.

Would be nice to discuss some options of how we can improve this (if we need to, because maybe it's fine to just let them know about "delays"). Maybe instead of having stake_eligible: boolean we can have some sort of stake_status: 'eligible' | 'error' | 'not_eligible' that will help UI to distinguish between different states and to show some hints + ability to trigger refresh. That might be an overhead though, so let's discuss it internally

Comment thread docker-setup/docker-compose.yml Outdated
Comment thread docker-setup/docker-compose.dev.yml Outdated
Comment thread packages/apps/reputation-oracle/server/src/modules/web3/web3.service.ts Outdated
Comment thread packages/apps/reputation-oracle/server/src/common/constants/index.ts Outdated
Comment thread packages/apps/reputation-oracle/server/src/config/env-schema.ts
Comment thread packages/apps/reputation-oracle/server/src/modules/auth/auth.service.ts Outdated
Comment thread packages/apps/reputation-oracle/server/src/modules/auth/auth.service.ts Outdated
Comment thread packages/apps/reputation-oracle/server/src/modules/auth/auth.service.ts Outdated
- Introduced ExchangeClientFactory to handle exchange client creation for different exchanges.
- Implemented GateExchangeClient and MexcExchangeClient for API interactions.
- Removed deprecated ExchangeRouterService and related services.
- Updated error handling to include ExchangeApiClientError for better clarity.
@vercel
vercel Bot temporarily deployed to Preview – human-app October 28, 2025 14:58 Inactive
@vercel
vercel Bot temporarily deployed to Preview – staking-dashboard October 28, 2025 14:58 Inactive
@vercel
vercel Bot temporarily deployed to Preview – human-dashboard-frontend October 28, 2025 14:58 Inactive
@vercel
vercel Bot temporarily deployed to Preview – human-dashboard-frontend October 28, 2025 15:19 Inactive
@vercel
vercel Bot temporarily deployed to Preview – staking-dashboard October 28, 2025 15:19 Inactive
@vercel
vercel Bot temporarily deployed to Preview – human-app October 28, 2025 15:19 Inactive

@dnechay dnechay left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM overall

  1. Please change back volume for services as mentioned in the earlier comment
  2. Let's wait for UI/UX to make sure they are aligned
  3. Can add unit tests where necessary (e.g. for auth.service)
  4. Let's try to DRY send request logic in each of exchange clients (i.e. separately for each exchange, not one logic shared across all of them)

Comment thread packages/apps/reputation-oracle/server/src/modules/web3/web3.service.ts Outdated
Comment thread packages/apps/reputation-oracle/server/scripts/setup-staking.ts
…geClient, MexcExchangeClient and exchangeApiKeyService
@flopez7 flopez7 added the do-not-merge PR shouldn't be merged until this label is removed label Oct 29, 2025
@vercel
vercel Bot temporarily deployed to Preview – staking-dashboard December 17, 2025 10:20 Inactive
@vercel
vercel Bot temporarily deployed to Preview – human-dashboard-frontend December 17, 2025 10:20 Inactive
@vercel
vercel Bot temporarily deployed to Preview – human-app December 17, 2025 10:20 Inactive
@vercel
vercel Bot temporarily deployed to Preview – staking-dashboard December 17, 2025 10:54 Inactive
@vercel
vercel Bot temporarily deployed to Preview – human-app December 17, 2025 10:54 Inactive
@vercel
vercel Bot temporarily deployed to Preview – human-dashboard-frontend December 17, 2025 10:54 Inactive
@vercel
vercel Bot temporarily deployed to Preview – human-dashboard-frontend December 17, 2025 11:48 Inactive
dnechay
dnechay previously approved these changes Dec 18, 2025

@dnechay dnechay left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM

Comment thread packages/apps/reputation-oracle/server/src/utils/stake.ts Outdated
Comment thread docker-setup/docker-compose.dev.yml Outdated
dnechay
dnechay previously approved these changes Jan 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Human App] Require staking for accessing jobs on Human App

4 participants