pub fn ctr_get_send(
    controller_id: ContractId,
    sender: Option<Principal>,
    receiver: Option<Principal>,
    amount: u256
) -> u8
Expand description

Checks if the transfer from (optional) sender to the (optional) receiver is allowed.

§Parameters

  • controller_id: Target controller contract id.
  • sender: Optional sender address.
  • receiver: Optional receiver address.
  • amount: Amount to transfer.

§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
CTRL_PRINCIPAL_1='principal "enelt-vu2ic-5z4vq-mt7jb-4lxpn-75hu7-2rm6l-akmq5-tlzog-st72l-cae"'
CTRL_PRINCIPAL_2='principal "dimdt-vwpm3-tkwgu-c2nkv-txykr-atn2x-xras5-6xidt-wtti3-i4xr6-vqe"'
TOKENS_TO_TRANSFER=123

dfx canister call coreledger_backend ctr_get_send "($CONTROLLER_ID, opt $CTRL_PRINCIPAL_1, opt $CTRL_PRINCIPAL_2, $TOKENS_TO_TRANSFER)"

§Sample response

(0 : nat8)