A DApp or Web3 game developer can also interact with the Adapter contract directly. While you can do this in many ways, such as via Remix, Etherscan, or programmatically, we recommend using Cast from the Foundry framework.
Prerequisites
Smart Contract development experience in Solidity
Experience with Foundry Solidity development toolkit
exportADAPTER_CONTRACT=0xbd57b868bb3374faa88722d2ee7ba3023c744e05# mainnet adapter contractexportRPC_URL=# Mainnet Alchemy / Infura RPC URL HereexportUSER_PUBLIC_KEY=# Eth User You are using to deploy consumer / user contractexportUSER_PRIVATE_KEY=# Corresponding Private Key
Create a Subscription
In this step, a subscription is created on the ADAPTER_CONTRACT using the createSubscription method. Save this subscription ID as it will be used later on. The cast send command broadcasts a transaction to the Ethereum network.
In this step, the created consumer contract is added to the adapter contract and linked to your existing subscription via the adapter's addConsumer method.
Request Randomness
We can now request randomness via the user contract with the method getRandomNumber.
Check the Last Randomness
Finally, retrieve the last random number generated with the getLastRandomness method.
After completing the entire process, you should have a user contract capable of requesting randomness from the Randcast adapter contract.