Voltar para Documentação

Docs Técnicas

Syntax Reference

``python @describe("optional contract description") contract Name: ``

O conteúdo abaixo vem das fontes técnicas do repositório e é prerenderizado no site para leitura direta por pessoas, crawlers e agentes.

Contract

python
@describe("optional contract description")
contract Name:

@describe is optional at contract level and must appear immediately before contract Name:.

Comments

python
# line comment
self.value = 1  # trailing comment

Storage

python
storage:
    field: Type = default

View

python
@describe("optional wallet description")
@view
def name(args...) -> Type:
    return expr

Transaction

python
@describe("optional wallet description")
@tx
def name(args...):
    statement

Constructor

python
@describe("optional wallet description")
@construct
def initialize(args...):
    statement

@construct functions must not return values. A contract may declare at most one. @init remains a compatibility alias for older source files.

Function descriptions may reference parameters with {param} placeholders.

Let Binding

python
let name = expr
let name: Type = expr

Assignment

python
self.field = expr
self.field[index] = expr

Loop

python
for i in range(N):
    statement

for item in self.vector:
    statement