Skip to content

Instantly share code, notes, and snippets.

@critesjosh
Last active April 15, 2022 17:41
Show Gist options
  • Select an option

  • Save critesjosh/6249eaa78597cefe6bd89aeb6c74f5e6 to your computer and use it in GitHub Desktop.

Select an option

Save critesjosh/6249eaa78597cefe6bd89aeb6c74f5e6 to your computer and use it in GitHub Desktop.
Example solidity contract that uses the randomness contract
import "celo-monorepo/packages/protocol/identity/interfaces/IRandom.sol";
import "celo-monorepo/packages/protocol/common/interfaces/IRegistry.sol";
contract Example {
function test() external view returns (bytes32 randomness) {
randomness = IRandom(
IRegistry(0x000000000000000000000000000000000000ce10)
.getAddressFor(keccak256(abi.encodePacked("Random")))
).random();
}
}
import "celo-monorepo/packages/protocol/common/UsingRegistryV2.sol";
contract Example is UsingRegistryV2 {
function test() external view returns (bytes32 randomness) {
randomness = getRandom().random();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment