11// SPDX-License-Identifier: MIT
22pragma solidity >= 0.7.6 < 0.9.0 ;
33
4+ import {ContractRegistry} from "@flarenetwork/flare-periphery-contracts/coston2/ContractRegistry.sol " ;
45import {RandomNumberV2Interface} from "@flarenetwork/flare-periphery-contracts/coston2/RandomNumberV2Interface.sol " ;
56
67/**
@@ -12,8 +13,6 @@ import {RandomNumberV2Interface} from "@flarenetwork/flare-periphery-contracts/c
1213 * @notice A lottery contract that utilizes a secure random number for determining winners.
1314 */
1415contract LotteryWithRandomNumber {
15- RandomNumberV2Interface internal randomNumberGenerator;
16-
1716 address [] public participants;
1817 uint256 public lotteryId;
1918 uint256 public lotteryEndTimestamp;
@@ -26,14 +25,6 @@ contract LotteryWithRandomNumber {
2625 uint256 timestamp
2726 );
2827
29- /**
30- * @notice Initializes the contract with the address of the random number generator.
31- * @param _randomNumberGenerator The address of the RandomNumberV2Interface contract.
32- */
33- constructor (address _randomNumberGenerator ) {
34- randomNumberGenerator = RandomNumberV2Interface (_randomNumberGenerator);
35- }
36-
3728 /**
3829 * @notice Enter the lottery.
3930 * Participants can enter the lottery before it ends.
@@ -69,6 +60,8 @@ contract LotteryWithRandomNumber {
6960 require (participants.length > 0 , "No participants in the lottery " );
7061
7162 // Get the current random number and its properties
63+ RandomNumberV2Interface randomNumberGenerator = ContractRegistry
64+ .getRandomNumberV2 ();
7265 (
7366 uint256 randomNumber ,
7467 bool isSecureRandom ,
0 commit comments