Skip to content

Commit

Permalink
fixed library errors
Browse files Browse the repository at this point in the history
  • Loading branch information
MihRazvan committed Sep 23, 2024
1 parent 71a75d1 commit 233d814
Show file tree
Hide file tree
Showing 4 changed files with 303 additions and 49 deletions.
11 changes: 6 additions & 5 deletions packages/foundry/contracts/Lottery.sol
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ pragma solidity ^0.8.19;
import {PriceConverter} from "./PriceConverter.sol";
import {AggregatorV3Interface} from "@chainlink/contracts/v0.8/shared/interfaces/AggregatorV3Interface.sol";
import {VRFConsumerBaseV2Plus} from "@chainlink/contracts/v0.8/vrf/dev/VRFConsumerBaseV2Plus.sol";
import {VRFV2PlusClient} from "@chainlink/contracts/v0.8/dev/vrf/libraries/VRFV2PlusClient.sol";
import {VRFV2PlusClient} from "@chainlink/contracts/v0.8/vrf/dev/libraries/VRFV2PlusClient.sol";

contract Lottery is VRFConsumerBaseV2Plus {
using PriceConverter for uint256;
Expand Down Expand Up @@ -108,8 +108,9 @@ contract Lottery is VRFConsumerBaseV2Plus {
returns (uint256 requestId)
{
// Will revert if subscription is not set and funded.
requestId = s_vrfCoordinator.requestRandomWords(
VRFV2PlusClient.RandomWordsRequest({

VRFV2PlusClient.RandomWordsRequest memory request = VRFV2PlusClient
.RandomWordsRequest({
keyHash: keyHash,
subId: s_subscriptionId,
requestConfirmations: requestConfirmations,
Expand All @@ -118,8 +119,8 @@ contract Lottery is VRFConsumerBaseV2Plus {
extraArgs: VRFV2PlusClient._argsToBytes(
VRFV2PlusClient.ExtraArgsV1({nativePayment: false})
)
})
);
});
requestId = s_vrfCoordinator.requestRandomWords(request);
s_requests[requestId] = RequestStatus({
randomWords: new uint256[](0),
exists: true,
Expand Down
1 change: 0 additions & 1 deletion packages/foundry/contracts/PriceConverter.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
pragma solidity ^0.8.19;

import {AggregatorV3Interface} from "@chainlink/contracts/v0.8/shared/interfaces/AggregatorV3Interface.sol";
import {MockV3Aggregator} from "@chainlink/contracts/v0.8/tests/MockV3Aggregator.sol";

library PriceConverter {
function getPrice(
Expand Down
2 changes: 1 addition & 1 deletion packages/nextjs/app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ const Home: NextPage = () => {
<p className="text-center text-lg">
Edit your smart contract{" "}
<code className="italic bg-base-300 text-base font-bold max-w-full break-words break-all inline-block">
YourContract.sol
Lottery.sol
</code>{" "}
in{" "}
<code className="italic bg-base-300 text-base font-bold max-w-full break-words break-all inline-block">
Expand Down
Loading

0 comments on commit 233d814

Please sign in to comment.