Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft: Subledgers implementation #285

Draft
wants to merge 12 commits into
base: main
Choose a base branch
from

Conversation

kprimice
Copy link
Contributor

@kprimice kprimice commented Jul 6, 2024

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 in subledger_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.

@femaury
Copy link

femaury commented Jul 6, 2024

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).

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.

2 participants