Docs Técnicas
Runtime Context
The runtime context is available as ctx.
The runtime context is available as ctx.
ctx.caller
ctx.block_timestamp
ctx.block_height
ctx.asset
ctx.tx_id
ctx.contract_id
ctx.family_id
ctx.version_id`ctx.caller`
The actor executing the contract call.
Use it for permission checks:
require(ctx.caller == self.borrower, "only_borrower")`ctx.asset`
The asset supplied by the contract call.
Use it when building posting plans:
post(loan.repayment_lines(ctx.asset, self.lender, self.borrower, amount))`ctx.block_timestamp`
Ledger-provided execution timestamp.
Useful for accrual:
let interest = loan.accrue_interest(
self.principal_due,
self.rate_ppm,
self.last_accrual_ts,
ctx.block_timestamp)Identity Fields
These fields provide execution attribution:
ctx.tx_id
ctx.contract_id
ctx.family_id
ctx.version_idContract Vault
ctx.vault()Returns the implicit vault address for the current contract instance. The vault address is deterministic, non-zero, and owned by protocol accounting, so custody contracts do not need a user-supplied vault_account sentinel.
ctx.transfer(self.token_id, ctx.caller, ctx.vault(), amount)KYC Snapshot Queries
KYC helpers are exposed as context intrinsics. They read the deterministic KYC snapshot available during execution; they do not open network connections to a validator.
ctx.kyc_verified(account)
ctx.kyc_level(account)
ctx.kyc_compat(account, schema)
ctx.kyc_verifier(account)
ctx.kyc_expires_at(account)Use them for compliance gates:
require(ctx.kyc_verified(ctx.caller), "kyc_required")
require(ctx.kyc_compat(ctx.caller, "kyb-v1"), "schema_required")Detailed KYC disclosure remains private and wallet-authorized; see KYC And Private Sharing.