[435] [High] Token Registry Admin API with On-Chain Metadata Verification - #549
Merged
Conversation
Admin create and update check ERC-20 and Stellar metadata and soft-delist tokens so existing intents keep resolving. Co-authored-by: Cursor <cursoragent@cursor.com>
|
@Goodnessukaigwe Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
…registry-admin-api-with-on-chain-metadata-verification # Conflicts: # .env.example # .env.mainnet.example # .env.staging.example # .env.testnet.example # CHANGELOG.md # docs/runbooks/on-call.md # jest.config.js # package-lock.json # package.json # src/app.module.ts # src/common/stellar-signature.ts # src/config/configuration.ts # src/config/env.validation.ts # src/governance/governance.module.ts # src/intents/intents.gateway.spec.ts # src/intents/intents.gateway.ts # src/intents/intents.module.ts # src/intents/intents.service.shadow.spec.ts # src/intents/intents.service.spec.ts # src/intents/solver-intent-matcher.ts # src/intents/ws/connection-state.ts # src/solvers/solvers.controller.ts # src/soroban/event-ingestion.service.ts # src/soroban/signer.service.spec.ts # src/soroban/solver-registry.service.spec.ts # src/soroban/soroban.controller.spec.ts # src/soroban/soroban.module.ts # src/soroban/soroban.service.ts # src/soroban/stellar-tx.service.spec.ts # src/soroban/stellar-tx.service.ts # src/soroban/tx-confirmation.service.ts # src/tokens/in-memory-tokens.repository.ts # src/tokens/tokens.service.ts # src/treasury/treasury.service.spec.ts # src/treasury/treasury.service.ts # test/jest-e2e.json
| const existing = this.require(chain, dto.address); | ||
| const metadataChange = dto.symbol !== undefined || dto.decimals !== undefined || dto.name !== undefined; | ||
| let next: TokenRecord = { ...existing, status: dto.status ?? existing.status ?? "active" }; | ||
| if (metadataChange) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
POST,PATCH, andDELETE /api/v1/admin/tokensbehind the existing admin key and audit log.eth_getCode,decimals,symbol,name, includingbytes32symbols) and Stellar classic assets / SAC metadata before any write. A mismatch or missing contract persists nothing.active/paused/delisted) so existing intents still resolve, hides delisted tokens from discovery, and emitstoken_list_updated.Closes #435
Problem
Token registry changes were not an admin API and were not checked against on-chain metadata, so a bad symbol or decimals could be stored and used for new intents.
Solution
Identity is
chain+addressin the body. Status-only updates and delist do not call RPC, so an operator can pause a token during an outage. Cache invalidation is the in-memory snapshot reload (cacheGeneration). No automated token-list ingestion.Config:
EVM_RPC_URLS(JSON map of chain to JSON-RPC URL),SOROBAN_RPC_URL, andSHADOW_SOURCE_ACCOUNTfor read-only SAC simulation.Migration
20260929000000_token_registry_statusaddsstatusandasset_kind. Rollback drops those columns and thetoken_statusenum. Intents do not foreign-key the token table.Test plan
POST /api/v1/admin/tokenswith a matching symbol and decimals returns 201 and lists the tokenMETADATA_MISMATCHand does not persistTOKEN_NOT_FOUNDand does not persistPATCHstatus topausedkeeps the token listed but rejects new intent creates;DELETEhides it from discovery whileresolvestill returns itx-admin-keyreturns 401token_list_updatedMade with Cursor