Skip to content

feat: add callback docs#2604

Open
PhilippGackstatter wants to merge 1 commit intonextfrom
pgackst-callback-docs
Open

feat: add callback docs#2604
PhilippGackstatter wants to merge 1 commit intonextfrom
pgackst-callback-docs

Conversation

@PhilippGackstatter
Copy link
Contributor

Adds docs for callbacks.

part of #2432

@PhilippGackstatter PhilippGackstatter added no changelog This PR does not require an entry in the `CHANGELOG.md` file pr-from-maintainers PRs that come from internal contributors or integration partners. They should be given priority labels Mar 16, 2026
Base automatically changed from pgackst-note-callback to next March 16, 2026 12:04
Two assets issued by the same faucet with _different_ callback flags are considered completely different assets. It is recommended that faucets issue all of their assets with the same callback flag.
:::

**Faucet callback procedures.** A faucet registers callbacks by storing the procedure root (hash) of a callback procedure in a well-known storage slot. Two callbacks are supported:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is it worth mentioning how they are stored? I'm not familiar with the details (just catching up with these last few PRs) and it feels like it would be helpful, but maybe it's an implementation detail that's not meant for the common reader

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The docs already mention that the callback's procedure root is stored in a storage slot, so I guess by "how they are stored" you'd like to understand where the procedure itself lives? If so, yes that may be good to include (it is simply a public procedure in the account code).

Comment on lines +77 to +79
:::tip
Two assets issued by the same faucet with _different_ callback flags are considered completely different assets. It is recommended that faucets issue all of their assets with the same callback flag.
:::
Copy link
Collaborator

Choose a reason for hiding this comment

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

So a single faucet account can, at most, create two different types of assets during its lifetime, no? If so, I wonder if this is worth mentioning or if it's already well implied

Copy link
Contributor

@bobbinth bobbinth left a comment

Choose a reason for hiding this comment

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

Looks good! Thank you!


### Callbacks

Asset callbacks allow a faucet to execute custom logic whenever one of its assets is added to an account vault or to an output note. This gives faucet issuers a mechanism to enforce policies on their assets. For example, maintaining a block list of accounts that are not allowed to receive the asset or globally pausing transfers of assets.
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: "faucet issuers" sounds a bit odd to me. Maybe "asset issuers" would be better?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

no changelog This PR does not require an entry in the `CHANGELOG.md` file pr-from-maintainers PRs that come from internal contributors or integration partners. They should be given priority

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants