pub fn ctr_get_consume_supply(
    controller_id: ContractId,
    receiver: Principal,
    supply_id: SupplyId,
    amount: u256
) -> u8
Expand description

Checks if the address is allowed to consume the supply.

§Parameters

  • contract_id: Target controller contract id.
  • receiver: The receiver address.
  • supply_id: Id of the supply.
  • amount: Amount to consume.

§Result

0 - not allowed. 1 - allowed. 2 - incorrect input.

§Sample request

CONTROLLER_ID=706_061_983_514_303_969_782_027_186_938_462_951_048_586_994_629
RECEIVER='principal "dimdt-vwpm3-tkwgu-c2nkv-txykr-atn2x-xras5-6xidt-wtti3-i4xr6-vqe"'
SUPPLY_ID=8_251_471_539_482_211_562_355_238_650_337_652_682_089_590_676_002_818_286_951_709_100_188_048_031_744
AMOUNT=1000

dfx canister call coreledger_backend ctr_get_consume_supply "($CONTROLLER_ID, $RECEIVER, $SUPPLY_ID, $AMOUNT)"

§Sample response

(0 : nat8)