Remix
Deploy Consumer Contract Example
Open
Remixand clone the following repo: https://github.com/ARPA-Network/Randcast-User-Contract

Open one of the examples (We will use the roll dice example here):
contracts/user/examples/RollDiceExample.solClick
Compile.Click
Deploy & run transactionson the left sidebar, connect wallet and selectInjected Provideras environment. You'll see the connected account if it's all set up.

Pass in the
Adapteraddress, clickDeploy, and approve the transaction in your wallet (Metamask). Note: Next time you openRemix, you can enable the deployed contract by compiling, passing the contract address then clickingAt Address.After the contract deployment has completed, you will see the
ROLLDICEEXAMPLEin the belowDeployed Contractssection.Copy the address of deployed consumer contract and bind it to your subscription via the subscription portal.

Request Randomness to Roll Dice
Make sure you have created an active subscription with enough funds and the consumer contract has been added to the subscription. (see Subscription Management Portal - Consumers)
Click
ROLLDICEEXAMPLEto expand the available functions.

Specify "bunch" (the number of dice you want to roll) and then click
rollDice.
Note: A Gas estimation failed notification will pop up when the ETH balance in your wallet is too low to send the transaction, or if the consumer contract is not bound to any subscription.

Call
lengthOfDiceResults()to see whether the output is the same as thebunchvalue you passed. CalldiceResultswith the index up to thebunchto check the output of each dice cast.
Congratulations on successfully requesting randomness from Randcast! Randcast provides a set of tools to help you write your custom consumer contract and manage your subscription. Please continue reading to learn more.
Last updated