feat: native multi-asset accounts (CreateAsset + multi-asset Transfer) - #156
SIDDHANTCOOKIE wants to merge 1 commit into
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. 🗂️ Base branches to auto review (2)
Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository: StabilityNexus/MiniChain/.coderabbit.yaml Review profile: ASSERTIVE Plan: Advanced Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
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. Comment |
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.
46e7e72 to
8907e44
Compare
Summary
{"": amount, "<addr>.<ticker>": amount, ...}), with a per-account ticker registry (not global) to avoid namespace bloat/squatting.CreateAsset(ticker, amount, recipient)transaction, inferred from a new optionaltickerfield (matching the existing implicit deploy/call inference style — no newtx_typefield). Mints"<creator_address>.<ticker>"torecipient; the mint amount is not debited from the creator, only gas is.Transfergains an optionalassetsdict to move several assets atomically alongside the nativeamount.msg.value,transfer_out) is intentionally left native-only in this PR — multi-asset support for contracts is scoped separately.mc_getBalanceRPC, and the CLI (balance, newcreate-assetcommand) 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
balances/registryaccount shape.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.test_contract_calls.py, confirmed present on unmodifiedmaintoo).main.pyimports cleanly.