If I understand your doubt correctly, I believe you are referring to something like the following for deposits:
// Contract's own treasury of native tokens.
export ledger treasury: QualifiedCoinInfo;
export circuit depositFunds(coinInfo: CoinInfo): [] {
assert(coinInfo.color == nativeToken(), "Only native tokens can be deposited");
receive(disclose(coinInfo));
const me = right<ZswapCoinPublicKey, ContractAddress>(kernel.self());
treasury.writeCoin(disclose(coinInfo), me);
return [];
}
Then to send coin from the ledger’s QualifiedCoinInfo you should be able to do something like this:
const sender = left<ZswapCoinPublicKey, ContractAddress>(ownPublicKey());
const sendResult = send(treasury, sender, disclose(amount));
assert(sendResult.sent.value == amount, "Failed to send withdrawal payment");
if (sendResult.change.is_some) {
const me = right<ZswapCoinPublicKey, ContractAddress>(kernel.self());
treasury.writeCoin(sendResult.change.value, me);
} else {
treasury.resetToDefault();
}
Although, bear in mind what it’s being discussed in this issue related to circuits like the above: Cannot receive coins from a contract · Issue #63 · midnightntwrk/community-hub · GitHub.