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

refine and clarify some points in the custom SAC admin guide #1245

Merged
merged 2 commits into from
Feb 3, 2025

Conversation

ElliotFriend
Copy link
Contributor

Addresses the comments from the initial publishing of this page:

  • incorrectly describing a custom SAC admin as a "security precaution" (link to comment)
  • unclear and overly wordy description of which admin needs to authorize when (link to comment)
  • using an example that would result in a "permissionless operation" (link to comment)

Refs: #1234

@stellar-jenkins
Copy link


:::warning

The following "minter" contract calls the `require_auth()` function for itself. This means you would need to include some `__check_auth` logic in the contract, which is demonstrated in the [custom account example contract](../../smart-contracts/example-contracts/custom-account.mdx). We'll omit those details here, for the sake of simplicity and brevity.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is way too nuanced and really not related to the topic. This makes the example incomplete without check_auth, and it doesn't really demonstrate something close to reality (I don't expect token contracts to also be custom accounts).

I can think of the following simple example that's not completely permissionless, but also demonstrates something interesting: consider a claim_airdrop function (or something along these lines), that mints some small fixed amount to a given address. It would take the receiver address, call require_auth for it in order to make sure it's a real address, then make sure the address hasn't claimed before (using storage), then mint some amount of token to it. This shouldn't add more than a couple lines of code to the example (there is no need to even use some UDTs for the keys, just add the addresses directly to the storage for brevity).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is perfect! i'll use that instead. thanks!

@ElliotFriend ElliotFriend requested a review from dmkozh January 31, 2025 19:07
@stellar-jenkins
Copy link

@briwylde08 briwylde08 merged commit 9361ad6 into main Feb 3, 2025
2 checks passed
@briwylde08 briwylde08 deleted the custom-sac-admin-fixes branch February 3, 2025 17:43
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.

4 participants