Skip to main content

alloc_commodity_ref

Function alloc_commodity_ref 

Source
pub async fn alloc_commodity_ref<T>(
    caller: &mut Caller<'_, T>,
    numer: i64,
    denom: i64,
    commodity_id: Uuid,
) -> Result<Rooted<StructRef>>
where T: Send,
Expand description

Allocates an ATOMIC $commodity value by re-entering the guest’s exported commodity_new with the four i64 components (numer, denom, commodity_hi, commodity_lo). Since ADR-0028 E0 the $commodity struct carries a 5th (ref null $unit_term) field; the host must NOT construct that ref-bearing struct itself, so it delegates to the guest helper (which sets the term to null = atomic) — the same re-entry pattern as alloc_pair_chain / the entity allocators. Async because it calls back into the wasm instance.