So I have this code which uses a modified version of the [guess game] (https://github.com/agocorona/DAppFlow/blob/main/ContractExample/GuessGame.hs) which parameterizes the validateGuess script with a parameter depending on the user hash, so that each user can make a lock to his own scrip instance
I create two instances and the corresponding wallets make a lock of funds to his own instance:
main = Simulator.runSimulationWith handlers $ do
cid <- Simulator.activateContract (Wallet 1) GuessGame
cid2 <- Simulator.activateContract (Wallet 2) GuessGame
waitNSlots 3
callEndpointOnInstance cid "lock" LockParams{secretWord="world", amount= Ada.adaValueOf 200}
waitNSlots 3
callEndpointOnInstance cid2 "lock" LockParams{secretWord="world", amount= Ada.adaValueOf 200}
waitNSlots 3
Simulator.logString @(Builtin TestContracts) "Balances at the end of the simulation"
b <- Simulator.currentBalances
Simulator.logBalances @(Builtin TestContracts) b
The balances reflect the operations:
[INFO] Balances at the end of the simulation
[INFO] Wallet 1:
[INFO] {, ""}: 99799999990
[INFO] Wallet 2:
[INFO] {, ""}: 99799999990
[INFO] Wallet 3:
[INFO] {, ""}: 100000000000
[INFO] Wallet 4:
.....
.....
[INFO] Script 4c7d92f39ce436db8cf07bb207ca4272b255673ce988d9642403d7b8:
[INFO] {, ""}: 200000000
[INFO] Script 8d558e1a3cda0d447eb4d2d5ffe0837c355dc1c8f2519e205b37c439:
[INFO] {, ""}: 200000000
The scripts have the 200000000 funds allocated and the wallets lost 200000000 + 20 of fees
Now the question is: How I invoke the guess to one of these two instances with a third wallet ?
If I use:
callEndpointOnInstance cid "guess" GuessParams{guessWord="world",userHash=.....}
Then the funds are returned to wallet 1, since it is the wallet with which I initiated the cid contract. How I introduce a third wallet that may guess to each of these two instances?