Voltar para Documentação

Docs Técnicas

Asset Primitives

The asset primitives are lower-level than the product demos. They are the building blocks used when a contract needs ledger-aware value, ownership, or custody without inheriting a full product lifecycle.

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

The asset primitives are lower-level than the product demos. They are the building blocks used when a contract needs ledger-aware value, ownership, or custody without inheriting a full product lifecycle.

FungibleAsset

std.asset.FungibleAsset[Symbol] is the canonical fungible asset built on native Balance[Symbol] positions and ledger effects.

It supports:

  • mint(to, amount) by the admin;
  • transfer(to, amount) by the holder;
  • approve(spender, amount) and transfer_from(from, to, amount);
  • burn(amount) by the holder.

Unlike a raw Map[Address, u128], balances are typed financial positions. Mint, transfer, and burn also call the ledger context, so the contract's state and the ledger effect move together.

UniqueAsset

std.asset.UniqueAsset is a certificate-style ownership registry. It is close to the mental model of NFT ownership, but intentionally describes semantic certificates rather than promising ERC-721 compatibility.

The core surface is:

python
@tx
def issue(cert_id, to, meta_uri)

@tx
def transfer_certificate(cert_id, to)

@tx
def revoke(cert_id)

@view
def holder_of(cert_id) -> Address

Use it for unique claims, licenses, permissions, or asset-title references where each id has exactly one current holder.

CustodyVault

std.asset.CustodyVault[Asset] proves that a custodian has deposited value into a vault account and lets an admin withdraw it under product rules.

It tracks:

  • reserve: Balance[Asset];
  • total_deposited;
  • total_withdrawn;
  • proof_of_reserve().

The reserve invariant requires deposits to cover withdrawals. This is useful when a higher-level product, such as RWA custody or collateral management, needs an auditable reserve primitive.

DelegationPolicy

std.asset.DelegationPolicy[Asset] separates the holder from the delegate. Owners deposit into custody, grant a bounded mandate to a delegate, and that mandate decrements on each delegated transfer.

This avoids open-ended approval patterns:

text
owner deposits -> owner grants limit -> delegate spends up to remaining limit

The delegate cannot spend beyond the remaining mandate, and withdrawal remains available to the owner for their own custody balance.

When To Use These Directly

Use these primitives directly when the product is still being composed. Once the business flow has a name, lifecycle, and receipt model, prefer a product contract such as RwaVault, SpendingVault, BenefitsCardVault, or ConsortiumAgreement.