permaweb / aos

An operating system for AO: The hyper parallel computer
https://ao.g8way.io
Other
74 stars 52 forks source link

Draft: Subledgers implementation #285

Open kprimice opened 3 months ago

kprimice commented 3 months ago

This draft implements subledgers as specified in the specification by @samcamwilliams and @twilson63.

Added Handlers for Spawning Processes:

Note: These handlers could potentially be merged into a single handler when fix on spawn and #840 are in production.

Added Handlers for Subledger-Specific Operations:

Improvements Needed:

femaury commented 3 months ago

Also wanted to mention some changes we did to the token initialisation, open to discussing this of course, particularly the spawn tag names :)

Changes to the token state initialisation

We have also updated the way to initialise tokens to more closely follow the specification which states

Every compliant token process must carry the following immutable parameters upon its spawning message: [Name, Ticker, Logo, Denomination]

Name, Ticker, Denomination and Logo are now initialised from spawn tags Token-Name, Token-Ticker, Token-Denomination and Token-Logo respectively.

This change also removes the default values of "Points Coin" and "PNTS" which are most likely not what you want, forcing users to choose, either with spawn tags or by manually updating after loading the blueprint, the token info. This has the advantage or re-using the same initialisation code for every subsequent subledger.

We've also added an extra spawn tag Token-Supply which is used to determine the initial amount of tokens (using denomination). This defaults to 10,000 with a default denomination of 12 (which was already the case).