doc: rewrite contracts.adoc with modern Starknet patterns#9757
Draft
eytan-starkware wants to merge 1 commit intomainfrom
Draft
doc: rewrite contracts.adoc with modern Starknet patterns#9757eytan-starkware wants to merge 1 commit intomainfrom
eytan-starkware wants to merge 1 commit intomainfrom
Conversation
This was referenced Mar 19, 2026
4ba776d to
aa14e08
Compare
aa14e08 to
05947b2
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Summary
Updates the Cairo contracts documentation to use the modern
#[starknet::interface]and#[abi(embed_v0)]pattern instead of the deprecated#[external(v0)]attribute. ReplacesLegacyMapwithMapand updates storage access syntax fromx::read()toself.x.read().Type of change
Please check one:
Why is this change needed?
The documentation was showing deprecated patterns that are no longer recommended for new Cairo contracts. The
#[external(v0)]attribute andLegacyMapare deprecated in favor of the interface trait pattern andMaptype. This was misleading developers who would follow outdated examples.What was the behavior or documentation before?
#[external(v0)]attribute on individual functionsLegacyMapfor storage mappingsx::read()andx::write()syntaxWhat is the behavior or documentation after?
#[starknet::interface]trait definitions with#[abi(embed_v0)]implementationsMap<K, V>for storage mappingsself.x.read()andself.x.write()syntax#[external(v0)]still being supported but deprecatedRelated issue or discussion (if any)
Additional context
This change ensures developers learn the current best practices for Cairo contract development rather than deprecated patterns. The examples now demonstrate the complete modern contract structure including interfaces, implementations, and proper storage handling.