Docs Técnicas
Versioned Contract Flow
TREA contract execution is artifact-based.
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 contract execution is artifact-based.
This flow separates executable code selection from persisted contract state.
Publish V1
json
{
"type": "PublishContractArtifact",
"publish": {
"artifact_id": "loan:v1",
"family_id": "loan",
"version_id": "v1",
"source": "contract WalletLoan: ..."
}
}Instantiate Contract
json
{
"type": "InstantiateContract",
"instantiate": {
"contract_id": "loan-001",
"artifact_id": "loan:v1",
"admin": "nbex_admin"
}
}The instance now has:
- a default artifact;
- persisted storage;
- lifecycle state;
- optional admin and accepted version bindings.
Publish V2
json
{
"type": "PublishContractArtifact",
"publish": {
"artifact_id": "loan:v2",
"family_id": "loan",
"version_id": "v2",
"source": "contract WalletLoan: ..."
}
}Accept V2
json
{
"type": "AcceptContractVersion",
"accept": {
"contract_id": "loan-001",
"artifact_id": "loan:v2",
"role": "borrower"
}
}Resolution Rule
Calls resolve as:
- caller's accepted artifact for the contract family, if present;
- otherwise the instance default artifact.
Storage layout compatibility is checked before accepting a version.
Step-By-Step Behavior
PublishContractArtifactstores immutable source and canonical artifact metadata.InstantiateContractcreates a contract instance bound to the published family.- A later
PublishContractArtifactcan add a new artifact version to the same family. AcceptContractVersionrecords an actor-specific execution choice.ContractCallresolves executable code from accepted version first, then falls back to the instance default artifact.
Important Boundary
The accepted version changes which artifact a caller executes.
It does not create a new contract instance and does not create a separate storage namespace.
The same contract instance storage remains in place while executable artifact selection changes by actor.