From 7133b6835c6027e57ac261c100c544ae2144b9f8 Mon Sep 17 00:00:00 2001 From: Siddharth Suresh Date: Mon, 13 Feb 2023 09:19:32 -0800 Subject: [PATCH 1/2] Add AUTH_REQUIRED section --- docs/how-to-guides/stellar-asset-contract.mdx | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/docs/how-to-guides/stellar-asset-contract.mdx b/docs/how-to-guides/stellar-asset-contract.mdx index 2634b96f..16fc792f 100644 --- a/docs/how-to-guides/stellar-asset-contract.mdx +++ b/docs/how-to-guides/stellar-asset-contract.mdx @@ -83,7 +83,7 @@ contract). the issuer account will mint. - Trustline balances are stored in a 64-bit signed integer even though the interface accepts 128-bit signed integers. Any operation that attempts to - send or recieve an amount more than the maximum amount that can be + send or receive an amount more than the maximum amount that can be represented by a 64-bit signed integer will fail. - Using `Address::Contract` - The balance and authorization state will be stored in contract storage, as @@ -92,6 +92,13 @@ contract). balance. - Balances are stored in a 128-bit signed integer. +### Authorization Required +In the `Address::Contract` case, if the issuer has `AUTH_REQUIRED` set, then the +specified `Address::Contract` will need to be explicitly authorized before it +can receive a balance. This logic lines up with how trustlines interact with the +`AUTH_REQUIRED` issuer flag, allowing asset issuers to have the same control in +Soroban as they do in Stellar classic. + ## Authorization semantics See the [authorization overview](../learn/authorization.mdx) and From 90309df5f70d21272c1ad36020eea99b44f1eefe Mon Sep 17 00:00:00 2001 From: Siddharth Suresh Date: Mon, 13 Feb 2023 10:43:11 -0800 Subject: [PATCH 2/2] Mention set_auth and link to classic docs --- docs/how-to-guides/stellar-asset-contract.mdx | 26 ++++++++++++------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/docs/how-to-guides/stellar-asset-contract.mdx b/docs/how-to-guides/stellar-asset-contract.mdx index 16fc792f..87e7ac8f 100644 --- a/docs/how-to-guides/stellar-asset-contract.mdx +++ b/docs/how-to-guides/stellar-asset-contract.mdx @@ -59,9 +59,12 @@ issuer, it will not have an administrator either. It also cannot be burned. After the contract has been deployed, users can use their classic account (for lumens) or trustline (for other assets) balance. There are some differences -depending on if you are using a classic account `Address` vs a contract +depending on if you are using a classic account `Address` vs a contract `Address` (corresponding either to a regular contract or to a custom account -contract). +contract). The following section references some issuer and trustline flags from +Stellar classic, which you can learn more about [here]. + +[here]:https://developers.stellar.org/docs/issuing-assets/control-asset-access#controlling-access-to-an-asset-with-flags - Using `Address::Account` - The balance must exist in a trustline (or an account for the native @@ -74,7 +77,7 @@ contract). - A trustline balance can only be clawed back using the `clawback` contract function if the trustline has `TRUSTLINE_CLAWBACK_ENABLED_FLAG` set. - The admin can only deauthorize a trustline if the issuer of the asset has - `AUTH_REVOCABLE` set. The deauthorization will fail if the issuer is + `AUTH_REVOCABLE_FLAG` set. The deauthorization will fail if the issuer is missing. Note that when a trustline is deauthorized from Soroban, `AUTHORIZED_FLAG` is cleared and `AUTHORIZED_TO_MAINTAIN_LIABILITIES_FLAG` is set to avoid having to pull @@ -88,16 +91,19 @@ contract). - Using `Address::Contract` - The balance and authorization state will be stored in contract storage, as opposed to a trustline. - - `AUTH_REVOCABLE` is not required to be set on the issuer to deauthorize a + - `AUTH_REVOCABLE_FLAG` is not required to be set on the issuer to deauthorize a balance. - Balances are stored in a 128-bit signed integer. -### Authorization Required -In the `Address::Contract` case, if the issuer has `AUTH_REQUIRED` set, then the -specified `Address::Contract` will need to be explicitly authorized before it -can receive a balance. This logic lines up with how trustlines interact with the -`AUTH_REQUIRED` issuer flag, allowing asset issuers to have the same control in -Soroban as they do in Stellar classic. +### Balance Authorization Required +In the `Address::Contract` case, if the issuer has `AUTH_REQUIRED_FLAG` set, then the +specified `Address::Contract` will need to be explicitly authorized with +`set_auth` before it can receive a balance. This logic lines up with how +trustlines interact with the `AUTH_REQUIRED_FLAG` issuer flag, allowing asset issuers +to have the same control in Soroban as they do in Stellar classic. Read more +about `AUTH_REQUIRED_FLAG` [here]. + +[here]:https://developers.stellar.org/docs/issuing-assets/control-asset-access#authorization-required-0x1 ## Authorization semantics