Docs Técnicas
Publish And Call Through AtlasDB
TREA contracts run through ledger transactions.
O conteúdo abaixo vem das fontes técnicas do repositório e é prerenderizado no site para leitura direta por pessoas, crawlers e agentes.
TREA contracts run through ledger transactions.
Lifecycle
- Publish a source artifact.
- Instantiate a contract from that artifact.
- Optionally accept a specific version as an actor.
- Update lifecycle to an executable state.
- Call entrypoints.
Publish
json
{
"type": "PublishContractArtifact",
"publish": {
"artifact_id": "counter:v1",
"family_id": "counter",
"version_id": "v1",
"source": "contract Counter:\n storage:\n value: u64 = 0\n...",
"memo": "counter v1"
}
}Instantiate
json
{
"type": "InstantiateContract",
"instantiate": {
"contract_id": "counter-demo",
"artifact_id": "counter:v1",
"admin": "nbex_admin"
}
}Activate
json
{
"type": "UpdateContractLifecycle",
"update": {
"contract_id": "counter-demo",
"lifecycle_state": "active",
"reason": "ready"
}
}Call
json
{
"type": "ContractCall",
"call": {
"contract_id": "counter-demo",
"entrypoint": "set",
"asset": "BRL",
"args": [
{ "kind": "Integer", "value": "10" }
]
}
}Inline source in ContractCall is rejected. Publish and instantiate first.