Skip to content

feat: native multi-asset accounts (CreateAsset + multi-asset Transfer) - #156

Open
SIDDHANTCOOKIE wants to merge 1 commit into
ychainfrom
feature/native-multi-asset
Open

SIDDHANTCOOKIE wants to merge 1 commit into
ychainfrom
feature/native-multi-asset

Conversation

@SIDDHANTCOOKIE

@SIDDHANTCOOKIE SIDDHANTCOOKIE commented Sep 29, 2026 •

Copy link
Copy Markdown
Member

Summary

  • Account balances move from a single native int to a per-asset dict ({"": amount, "<addr>.<ticker>": amount, ...}), with a per-account ticker registry (not global) to avoid namespace bloat/squatting.
  • New CreateAsset(ticker, amount, recipient) transaction, inferred from a new optional ticker field (matching the existing implicit deploy/call inference style — no new tx_type field). Mints "<creator_address>.<ticker>" to recipient; the mint amount is not debited from the creator, only gas is.
  • Plain Transfer gains an optional assets dict to move several assets atomically alongside the native amount.
  • Gas/fees remain native-only, unchanged.
  • Contract execution (msg.value, transfer_out) is intentionally left native-only in this PR — multi-asset support for contracts is scoped separately.
  • Genesis loading, mc_getBalance RPC, and the CLI (balance, new create-asset command) updated for the new dict shape.

This is feature 1 of the "ychain" rework (per the linked Discord discussion with Bruno) and a prerequisite for the planned native DEX and UTXO/account hybrid work.

Test plan

  • Updated all existing tests for the new balances/registry account shape.
  • Added tests/test_multi_asset.py: CreateAsset mint/registry update, gas-only debit, duplicate-ticker rejection, malformed ticker (. in ticker), CreateAsset requires receiver/no data, multi-asset Transfer atomicity, insufficient-asset-balance rejection, state_root() determinism regardless of dict insertion order.
  • Full suite: 238 passed, 2 deselected (pre-existing multiprocessing-timeout flakiness in test_contract_calls.py, confirmed present on unmodified main too).
  • Manual smoke test: CreateAsset + multi-asset Transfer end-to-end via a script, main.py imports cleanly.

@coderabbitai

coderabbitai Bot commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

🗂️ Base branches to auto review (2)
  • main
  • develop

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository: StabilityNexus/MiniChain/.coderabbit.yaml

Review profile: ASSERTIVE

Plan: Advanced

Run ID: ecc62cd4-7d72-4817-825f-9229619d8b02

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Account balances move from a single native int to a per-asset dict
({"": amount, ...}), with a per-account ticker registry to avoid
global namespace bloat/squatting. Adds an implicit CreateAsset(ticker,
amount, recipient) transaction (inferred from a new optional `ticker`
field, matching the existing implicit deploy/call inference style)
that mints "<creator>.<ticker>" to the recipient, and extends plain
Transfer with an optional `assets` dict for moving several assets
atomically alongside the native amount. Gas/fees stay native-only.
Contract execution (msg.value/transfer_out) is intentionally left
native-only in this PR; multi-asset contract support is scoped for a
later, separate change.
@SIDDHANTCOOKIE
SIDDHANTCOOKIE force-pushed the feature/native-multi-asset branch from 46e7e72 to 8907e44 Compare September 29, 2026 02:54
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.

1 participant