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

Use single balances in the Stellar Asset Contract #615

Merged
merged 13 commits into from
Dec 19, 2022

Conversation

sisuresh
Copy link
Contributor

Changes

This PR updates how balances are stored for Stellar accounts. Stellar account balances must be stored in classic trustlines, and classic trustlines semantics are followed. For example-

  1. Transfers involving a Stellar account will only succeed if the trustline has the authorized flag set.
  2. Burn (will be changed to clawback in my next PR) can only be called if the clawback flag is set on the trustline.
  3. The admin can only call freeze (will be changed to deauthorize in my next PR) on a Stellar account if the issuer has auth_revocable set.
  4. Issuers don't have trustlines, so if the issuer sends a balance, that balance will be minted. If the issuer receives a balance, that balance will burned. We should consider how downstream system will handle this case, and maybe emit mint/burn events instead.

This PR also makes a minor improvement related to burn(clawback) - it can be called by the admin even if the balance/trustline is frozen/deauthorized.

Improvements I'll work on while this PR is being reviewed

  1. Consider improving error reporting when trustlines are missing, as I expect this case will be hit much more often now.
  2. Continue writing tests.
  3. Consider keying non-account balances with an Identifier-like struct that doesn't include Account for safety.

Next PR will update the interface

The follow up to this will be a changes that updates to interface to make the terminology match more closely with classic, and will resolve some inconsistencies in this PR like -

  1. burn/clawback
  2. freeze/deauthorize
  3. read_state/write_state (these are internal methods)

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.

5 participants