Open kprimice opened 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 :)
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).
This draft implements subledgers as specified in the specification by @samcamwilliams and @twilson63.
Added Handlers for Spawning Processes:
Spawn-Subledger
: Handles the spawning of subledger processes with appropriate tags.NotifySpawn
: Collects and prepares subledger initialization data.Init-Subledgers
: Initializes subledgers and notifies the deployer.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:
Credit-Notice
: Handles crediting tokens to subledgers.Withdraw
: Manages the withdrawal of tokens from subledgers.Improvements Needed:
Code Duplication in
subledger_code.lua
: Currently, the code insubledger_code.lua
is duplicated to assign it to the spawned process. Does anyone know a better way to handle this to avoid redundancy?Stack Issues with Init-Subledgers: Due to code duplication, adding the Init-Subledgers code in subledger_code.lua results in a recursive loading problem. This prevents the creation of sub-subledgers and needs to be addressed.