-
Notifications
You must be signed in to change notification settings - Fork 81
Token interface and single balance update #257
Conversation
Preview is available here: |
Preview is available here: |
classic account identifier vs a non-account identifier like a contract. | ||
|
||
- Using `Identifier::Account` | ||
- The balance must exist in a trustline or an account. This means the contract |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you mean trustline of an account?
Or do you mean trustline or an account (in the case of Lumen)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Account in the case of lumens. I'll update this to make it clear.
- Using `Identifier::Ed25519` or `Identifier::Contract` | ||
- The balance and authorization state will be stored in ContractData, as | ||
opposed to a trustline. | ||
- These balances are stored in a 128-bit signed integer. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It might be worth mentioning how the 128-bit balance interops with the classic 64-bit balance?
/// unless this is called on the Stellar Asset Contract, in which case this can | ||
/// be less due to reserves/liabilities. | ||
fn spendable(env: soroban_sdk::Env, id: soroban_auth::Identifier) -> i128; | ||
|
||
/// Transfer "amount" from "from" to "to. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe mention in the comment of this function "Transfers to the issuer account will burn the token, while transfers from the issuer account will mint." (what you had in the explanation)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The issuer is an implementation detail of the SAC, and will not apply to any other token contracts, so I don't think that belongs here.
fn burn( | ||
/// If "admin" is the administrator, clawback "amount" from "from". "amount" is burned. | ||
/// Emit event with topics = ["clawback", from: Identifier, to: Identifier], data = [amount: i128] | ||
fn clawback( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's probably good to specify some minimal set of failure conditions. E.g. if the "admin" is not the administrator, and its expected behavior (returning error code or trapping).
This applies to most of the interface functions below.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Created an issue for this
Documentation updates for -