Overview
Each round has an associatedRandomData
struct containing a randomness value, a signature, and the previous signature. The contract provides methods for setting random values and retrieving random values for a given round.
Setup
1
Clone the repository
2
Install required tools and dependencies
Usage
1
Build the contract
2
Deploy contract using this UI
Example
To use theRandomOracle
contract in your own project, follow these steps:
1
In your own project, add the
random-wasm-oracle
as a dependency. Open your project’s Cargo.toml and add the following:2
In your project’s smart contract, import the necessary modules and types from the
random-wasm-oracle
crate:3
In your contract’s storage, add a RandomOracleRef field:
4
In your contract’s constructor, add a parameter for the
RandomOracle
contract’s address and initialize the RandomOracleRef
:5
Implement methods to interact with the
RandomOracle
contract, e.g., getting random values for a specific round:6
Build and deploy your contract, providing the
RandomOracle
contract’s address https://shibuya.subscan.io/account/Y9YVxsyH8bza5zyK1AVW4iw1r7twVdoXMoDzWwdwraapvSM
when instantiating your contract.7
Interact with your contract to call the methods that use the
RandomOracle
contract.