user2537: I am trying to build a transaction that mints a number of tokens and distributes them to different wallets. Like here:
vote :: forall w s. Poll -> Contract w s Text ()
vote poll = do
  ...
  let lookups = mintingPolicy (receiptPolicyI $ ReceiptPolicy "")
                <> mintingPolicy (votePolicyI $ VotePolicy "")
  let tx = (mustMintValue $ assetClassValue voteAC -10)
            <> (mustMintValue $ assetClassValue receiptAC 10)
            <> (mustPayToPubKey wallet1 (assetClassValue receiptAC 5))
            <> (mustPayToPubKey wallet2 (assetClassValue receiptAC 5))
  ledgerTx <- submitTxConstraintsWith @Polling lookups tx

In this example 10 votes are burned and 10 receipts are minted. The 10 receipts shall be paid to 2 wallets.
Now when I test this, an error is thrown. It complains that there are insufficient funds in the wallet that submits the transaction. It says that 10 assets of type receiptAC are missing.
Now, of course these assets are missing in the wallet because I want to mint them in the same transaction that also distributes them.
How can I achieve this ? Maybe I am using mustPayToPubKey wrong and should indicate the distribution differently.

user2537: Here comes the answer: The example code above is a simplified extract of the real code I was running. In the latter, I wasn't setting the value to be minted to the constant 10 but using a function to derive it from a data structure. And here was the problem. It evaluated to 0 because of a small mistake. So I was not minting any receipt-tokens. I had not seen it because another, very similar use case was running without problems.
So the good message is, there is absolutely no issue in Plutus. Minting and distributing tokens to arbitrary output-utxos in a single transaction is absolutely feasible.
Thanks, Mitchell, for the rapid support.

2537: <p>I am trying to build a transaction that mints a number of tokens and distributes them to different wallets. Like here:</p>
<pre><code>vote :: forall w s. Poll -&gt; Contract w s Text ()
vote poll = do
  ...
  let lookups = mintingPolicy (receiptPolicyI $ ReceiptPolicy &quot;&quot;)
                &lt;&gt; mintingPolicy (votePolicyI $ VotePolicy &quot;&quot;)
  let tx = (mustMintValue $ assetClassValue voteAC -10)
            &lt;&gt; (mustMintValue $ assetClassValue receiptAC 10)
            &lt;&gt; (mustPayToPubKey wallet1 (assetClassValue receiptAC 5))
            &lt;&gt; (mustPayToPubKey wallet2 (assetClassValue receiptAC 5))
  ledgerTx &lt;- submitTxConstraintsWith @Polling lookups tx
</code></pre>
<p>In this example 10 votes are burned and 10 receipts are minted. The 10 receipts shall be paid to 2 wallets.</p>
<p>Now when I test this, an error is thrown. It complains that there are insufficient funds in the wallet that submits the transaction. It says that 10 assets of type receiptAC are missing.</p>
<p>Now, of course these assets are missing in the wallet because I want to mint them in the same transaction that also distributes them.</p>
<p>How can I achieve this ? Maybe I am using <code>mustPayToPubKey</code> wrong and should indicate the distribution differently.</p>
 2537: <p>Here comes the answer: The example code above is a simplified extract of the real code I was running. In the latter, I wasn't setting the value to be minted to the constant 10 but using a function to derive it from a data structure. And here was the problem. It evaluated to 0 because of a small mistake. So I was not minting any receipt-tokens. I had not seen it because another, very similar use case was running without problems.</p>
<p>So the good message is, there is absolutely no issue in Plutus. Minting and distributing tokens to arbitrary output-utxos in a single transaction is absolutely feasible.</p>
<p>Thanks, Mitchell, for the rapid support.</p>
