<p>Here's an example:</p>
<pre><code>import Data.Default (def)
import qualified Data.Map as Map
import qualified Ledger.Ada as Ada
import qualified Ledger.Value as Value
import Wallet.Emulator.Wallet (Wallet(..))
import Plutus.Trace.Emulator (EmulatorTrace, EmulatorConfig(..), runEmulatorTraceIO', 
                              activateContractWallet)

main :: IO ()
main = do
  let dist = Map.fromList [ (Wallet 1, Ada.lovelaceValueOf 100_000_000
                                    &lt;&gt; Value.singleton &quot;ffff&quot; &quot;mytoken&quot; 10)
                          , (Wallet 2, Ada.lovelaceValueOf 25_000_000)
                          ]
      emCfg = EmulatorConfig (Left dist) def def
  runEmulatorTraceIO' def emCfg myTrace
</code></pre>
<p>In summary, <code>Wallet 1</code> starts of with 100 ADA, and 10 tokens with currency symbol <code>ffff</code> and token name <code>mytoken</code>. <code>Wallet 2</code> simply starts with 25 ADA.</p>
<p>The <a href="https://github.com/input-output-hk/plutus/blob/master/plutus-use-cases/src/Plutus/Contracts/Auction.hs" rel="nofollow noreferrer">Auction</a> use-case example demonstrates that.</p>

CC BY-SA 4.0
2021-08-30T20:16:22.023Z
Thanks, but I didn't find as such in the example you pointed to.
Kwaggy
CC BY-SA 4.0
2021-08-30T22:18:40.783Z
Is there a way to show the final fine-grained distribution of `Value` amongst all the wallets (i.e., all the various currencies)?
Kwaggy
CC BY-SA 4.0
2021-08-30T22:34:52.360Z
If you mean the distribution of `Value` for all the wallets at the end of emulation, then the answer is that you don't need to do anything more than the example above. The function `runEmulatorTraceIO` prints the distribution for all wallets in the terminal at the end of emulation.
kolam
CC BY-SA 4.0
2021-08-30T18:28:09.273Z
2021-08-30T18:28:09.273Z
kolam
<p>12/2022, plutus-apps v1.0.0 update on the accepted answer.</p>
<p><code>Wallet 1</code> is not working anymore. You can use <code>knownWallet 1</code>.</p>
<p>Or you can <code>import Plutus.Contract.Test (w1, w2)</code> and then use <code>w1</code> , <code>w2</code> as your simulated wallets.</p>
<p>Also <code>EmulatorConfig</code> has <a href="https://playground.plutus.iohkdev.io/doc/haddock/plutus-contract/html/Plutus-Trace-Emulator.html#t:EmulatorConfig" rel="nofollow noreferrer">2 components</a>, not 3. So it is:</p>
<p><code>emCfg = EmulatorConfig (Left dist) def</code></p>
<p>BTW I get <a href="https://cardano.stackexchange.com/questions/9652/custom-currency-error-cannot-build-the-initial-state-tag-tocardanopolicyid">error when setting initial state</a> with custom currencies.</p>

CC BY-SA 4.0
2022-12-21T03:05:18.837Z
2022-12-21T04:09:04.100Z
2022-12-21T04:09:04.100Z
Adam
<p>the easier way I found:</p>
<pre><code>dist = Map.fromList [ (wallet 1, Ada.lovelaceValueOf 1_000_000_000 ) -- treasury
                        , (wallet 2, Ada.lovelaceValueOf 1_000_000_000  
                            &lt;&gt; Value.singleton yacadaNFTSymbol  (U.giveReferralNFTName )  15) -- referral
</code></pre>
<p>in : <a href="https://github.com/cmorgado/yacada_learning" rel="nofollow noreferrer">https://github.com/cmorgado/yacada_learning</a></p>

CC BY-SA 4.0
2022-12-21T09:07:11.760Z
2022-12-21T09:07:11.760Z
Cristovao Morgado
<p>How exactly can I fund the emulator wallets with custom currencies?
Please show an emulator example doing so.</p>

<plutus><plutus-pioneer-program><simulator>
Funding emulator wallets with custom currencies
# Funding emulator wallets with custom currencies

(Asked by: username_0 on 2021-08-30)

How exactly can I fund the emulator wallets with custom currencies?
Please show an emulator example doing so.

**Tags:** plutus, plutus-pioneer-program, simulator

---

## 3 answers

### Answer by username_1 on 2021-08-30. Score: 3 | Accepted answer

Here's an example:
import Data.Default (def)
import qualified Data.Map as Map
import qualified Ledger.Ada as Ada
import qualified Ledger.Value as Value
import Wallet.Emulator.Wallet (Wallet(..))
import Plutus.Trace.Emulator (EmulatorTrace, EmulatorConfig(..), runEmulatorTraceIO', 
                              activateContractWallet)

main :: IO ()
main = do
  let dist = Map.fromList [ (Wallet 1, Ada.lovelaceValueOf 100_000_000
                                    <> Value.singleton "ffff" "mytoken" 10)
                          , (Wallet 2, Ada.lovelaceValueOf 25_000_000)
                          ]
      emCfg = EmulatorConfig (Left dist) def def
  runEmulatorTraceIO' def emCfg myTrace

In summary, Wallet 1 starts of with 100 ADA, and 10 tokens with currency symbol ffff and token name mytoken. Wallet 2 simply starts with 25 ADA.
The Auction use-case example demonstrates that.

> **Comments:**
> **username_0**: Thanks, but I didn't find as such in the example you pointed to.  
> **username_0**: Is there a way to show the final fine-grained distribution of `Value` amongst all the wallets (i.e., all the various currencies)?  
> **username_1**: If you mean the distribution of `Value` for all the wallets at the end of emulation, then the answer is that you don't need to do anything more than the example above. The function `runEmulatorTraceIO` prints the distribution for all wallets in the terminal at the end of emulation.  

---

### Answer by username_2 on 2022-12-21. Score: 0

12/2022, plutus-apps v1.0.0 update on the accepted answer.

`Wallet 1` is not working anymore. You can use `knownWallet 1`.

Or you can `import Plutus.Contract.Test (w1, w2)` and then use `w1` , `w2` as your simulated wallets.

Also `EmulatorConfig` has [2 components](https://playground.plutus.iohkdev.io/doc/haddock/plutus-contract/html/Plutus-Trace-Emulator.html#t:EmulatorConfig), not 3. So it is:

`emCfg = EmulatorConfig (Left dist) def`

BTW I get [error when setting initial state](https://cardano.stackexchange.com/questions/9652/custom-currency-error-cannot-build-the-initial-state-tag-tocardanopolicyid) with custom currencies.


---

### Answer by username_3 on 2022-12-21. Score: 0

the easier way I found:
dist = Map.fromList [ (wallet 1, Ada.lovelaceValueOf 1_000_000_000 ) -- treasury
                        , (wallet 2, Ada.lovelaceValueOf 1_000_000_000  
                            <> Value.singleton yacadaNFTSymbol  (U.giveReferralNFTName )  15) -- referral

in : https://github.com/cmorgado/yacada_learning


---

