feat(denario): onboard Denario — partner wallet, Gold/Silver Polygon assets, and permanent referral alias#4209
Open
joshuakrueger-dfx wants to merge 2 commits into
Conversation
Collaborator
Author
|
Completed a full-diff conformance and logic review (1 round, 0 findings) before marking ready. Verified:
|
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.
Overview
Bundles the full Denario onboarding into one PR:
Denarioto thewallettable (analogous to existing partner wallets, e.g. Cake Wallet).DGC,DSC) as inert, list-only assets.denarioalias on theref-keyssetting (original scope of this PR).All of it ships via a single reversible, idempotent migration each, plus the seed mirror for local dev.
1. Partner wallet
New migration
1784038000000-AddDenarioWalletAndAssets.jsinserts aDenariorow intowallet. Onlyname/displayNameare set; every compliance/behaviour column takes its conservative DB default (isKycClient=false,autoTradeApproval=false,usesDummyAddresses=false,displayFraudWarning=false,amlRules='0',buySpecificIbanEnabled=false) — kept conservative on purpose so the partner cannot bypass any check by default. Idempotent onname(not a unique column), reversible.2. Assets (Polygon ERC-20)
Added in the same migration and mirrored into
migration/seed/asset.csv(ids 411/412), values verified on-chain (decimals()/symbol()/name()):0xf7e2…042f0x5d4e…c7e7Contract addresses independently verified against Denario's official token pages (DGC
0xf7E2…042f, DSC0x5D4E…c7E7). Backing: 1 DGC = 1 oz gold, 1 DSC = 1 oz silver (999.9), vaulted in Switzerland.Both are inert, list-only (same pattern as
OlkyFrozen/EUR):type=Token,blockchain=Polygon,category=Public, nopriceRuleId, and every trade/payment flagfalse→isActive=false. Consequences:priceRuleId).financialTypeis intentionally leftnull(no precious-metal type exists yet) — set it when trading is enabled.Deliberately left empty (correct for an inert asset — not guessed)
financialType: no precious-metal type exists in the repo (values in use:Other/USD/EUR/BTC/CHF/DEPS/FPS, plus 2 empty). It drives fee-matching (fee.entity) and balance grouping (log-job) — introducing a new bucket is a tax/reporting classification decision for DFX/DAS, so leftnull.approxPriceUsd/Chf/Eur: would hard-code a decaying gold/silver snapshot; these fields are only read for active/custody/traded assets, so an inert asset never uses them.sortOrder: display-order only (e.g.dEURO/SANDalso leave it empty).Follow-ups when trading is enabled (verified inputs, need DFX/DAS decision)
DSC/USDCpool on Polygon (0x6722e2405a3b6ee5bf862112a143cf7228ee6c18, live ≈ $36.55 ≈ 1 oz silver). Denario also publishes Proof-of-Reserve oracles (DSC PoR0xb507a787cda02d6086f101d6067e9c35d58f1fc5). Attach aPriceRule(DEX/oracle source) then flip the buy/sell flags.financialTypeper token once the metal asset class is decided.isKycClient/amlRules).3. Referral alias (original scope)
denarioalias to the existingref-keyssetting/v1/app?code=<alias>to persist the resolved referral code instead of the unresolved alias, matching/v1/app/:appStable links after deployment
https://api.dfx.swiss/v1/app/services?code=denariohttps://dev.api.dfx.swiss/v1/app/services?code=denario/v1/app?code=denarioDeployment precondition
Each environment must contain exactly one active organization account whose trimmed, case-insensitive organization name is
DenarioorDenario AG, with exactly one active user that already has a valid referral code. The migration intentionally aborts if this invariant is not met. It also refuses to overwrite an existingdenarioalias that points elsewhere.Tests & checks
Wallet + assets migration
NOT EXISTSguards onuniqueName/name) and reversible (down()removes both assets + the wallet)Referral alias
pg-memto validate PostgreSQL semantics and reversible state changesnpm run type-check,npm run lint,npm run format:check,npm run build