diff --git a/contracts/contracts/LotteryAgent.sol b/contracts/contracts/LotteryAgent.sol new file mode 100644 index 00000000..b7ec5c56 --- /dev/null +++ b/contracts/contracts/LotteryAgent.sol @@ -0,0 +1,327 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.19; + +import "@openzeppelin/contracts/access/Ownable.sol"; +import "./RandomnessGenerator.sol"; + +contract LotteryAgent is Ownable { + // Struct to represent a lottery ticket + + struct Ticket { + address player; + bool[] chosenNumbers; + bool claimed; + bool winner; + uint256 id; // unique idx in draw + } + + // Struct to represent a lottery draw + struct Draw { + uint[] randomnessIDs; + bool[] winningNumbers; // the representation of bitset. example: uint [2, 3, 5] == bool [0, 0, 1, 1, 0, 1] + uint totalWinnings; + uint winnersCount; + uint ticketRevenue; + uint stackersPoolDistributionRatio; + Ticket[] tickets; + bool prepareFinalizeCalled; + } + + + function getDraw(uint256 idx) public view returns (Draw memory) { + require(idx <= drawHistory.length, "Draw index out of bounds"); + if (idx == drawHistory.length) { + return curDraw; + } else { + return drawHistory[idx]; + } + } + + function getDrawShortInfo(uint256 idx) external view returns (uint256 totalWinnings, uint256[] memory winningNumbers, uint256 winnersCount, uint256 ticketCount) { + Draw memory draw = getDraw(idx); + + uint256[] memory winningIndices = new uint256[](draw.winningNumbers.length); + uint256 count = 0; + + for (uint256 i = 0; i < draw.winningNumbers.length; i++) { + if (draw.winningNumbers[i]) { + winningIndices[count] = i; + count++; + } + } + + uint256[] memory result = new uint256[](count); + for (uint256 j = 0; j < count; j++) { + result[j] = winningIndices[j]; + } + + totalWinnings = draw.totalWinnings; + winningNumbers = result; + winnersCount = draw.winnersCount; + + return (totalWinnings, winningNumbers, winnersCount, draw.tickets.length); + } + + function depositSupply() external payable { + curDraw.totalWinnings += msg.value; + } + + receive() external payable { + curDraw.totalWinnings += msg.value; + } + + function activeBalance() public view returns (uint256) { + return address(this).balance; + } + + function withdrawSupply(uint256 amount, address receiver) external onlyOwner { + require(amount <= activeBalance(), "House: insufficient non-withdrawal balance"); + payable(receiver).transfer(amount); + } + + mapping (uint => mapping (address => uint[])) ticketIdsByUserByDrawId; + + uint constant public NUMBER_TO_CHOOSE = 10; + uint constant public NUMBERS_COUNT = 20; + + RandomnessGenerator public randomnessGenerator; + + // Lottery parameters + uint public ticketPrice = 1 * 10 ** 18; // 1 Ether by default (adjustable) + uint public drawFrequency = 1 days; // Default to one draw per day + uint public drawBeginTime; + uint public stackersPoolDistributionRatio = 50; // 50% to prize pool, 50% to staking pool + + uint public ticketCounter = 0; + Draw public curDraw; + + Draw[] public drawHistory; + + event TicketPurchased(address indexed player, uint ticketId, uint[] chosenNumbers); + event DrawFinalized(uint indexed drawId, bool[] winningNumbers); + event PrizeClaimed(address indexed player, uint prizeAmount); + + constructor(address _owner, address _randomnessGenerator) Ownable(_owner) { + randomnessGenerator = RandomnessGenerator(_randomnessGenerator); + drawBeginTime = block.timestamp; + curDraw.stackersPoolDistributionRatio = stackersPoolDistributionRatio; + } + + function validateTicket(uint[] memory _chosenNumbers) internal pure { + require(_chosenNumbers.length == NUMBER_TO_CHOOSE, "You must pick 10 numbers"); + + bool[] memory numberPresence = new bool[](NUMBERS_COUNT); + for (uint i = 0; i < _chosenNumbers.length; i++) { + uint number = _chosenNumbers[i]; + require(number < NUMBERS_COUNT, "Number out of range"); + require(numberPresence[number] == false, "Duplicate number found"); + numberPresence[number] = true; + } + } + + function toSet(uint[] memory _chosenNumbers) internal pure returns (bool[] memory) { + bool[] memory set = new bool[](NUMBERS_COUNT); + for (uint i = 0; i < _chosenNumbers.length; i++) { + uint number = _chosenNumbers[i]; + set[number] = true; + } + return set; + } + + function purchaseTicket(uint[] calldata _chosenNumbers) external payable { + require(curDraw.prepareFinalizeCalled == false, "Can't purchase tickets to draw, which was prepared to finish"); + validateTicket(_chosenNumbers); + require(msg.value == ticketPrice, "Incorrect Ether value sent. Ticket costs different prize"); + + uint ticketId = curDraw.tickets.length; + + curDraw.tickets.push( + Ticket({ + player: msg.sender, + chosenNumbers: toSet(_chosenNumbers), + claimed: false, + winner : false, + id: curDraw.tickets.length + }) + ); + + ticketIdsByUserByDrawId[drawHistory.length][msg.sender].push(curDraw.tickets.length - 1); + + uint stackersFee = ticketPrice * curDraw.stackersPoolDistributionRatio / 100; + // TODO: SEND TO STACKERS + uint ticketRevenue = ticketPrice - stackersFee; + curDraw.ticketRevenue += ticketRevenue; + + emit TicketPurchased(msg.sender, ticketId, _chosenNumbers); + } + + // Function to check if all randomness has been posted + function allRandomnessPostedForCurDraw() public view returns (bool) { + for (uint i = 0; i < curDraw.randomnessIDs.length; i++) { + if (randomnessGenerator.getRandomness(curDraw.randomnessIDs[i]) == 0) { + return false; + } + } + return true; + } + + function prepareFinalizeDraw() external { + require(block.timestamp >= drawBeginTime + drawFrequency, "It's not time for the draw yet"); + require(curDraw.prepareFinalizeCalled == false, "prepareFinalizeCalled was already called"); + + curDraw.prepareFinalizeCalled = true; + + for (uint i = 0; i < NUMBER_TO_CHOOSE; i++) { + curDraw.randomnessIDs.push(randomnessGenerator.requestRandomness()); + } + } + + // New function to generate winning numbers + function generateWinningNumbers(uint[] memory randomNumbers) internal pure returns (bool[] memory) { + uint[] memory lotteryDrum = new uint[](NUMBERS_COUNT); + + // Initialize the array with numbers from 0 to NUMBERS_COUNT-1 + for (uint i = 0; i < lotteryDrum.length; i++) { + lotteryDrum[i] = i; + } + + bool[] memory winningNumbers = new bool[](NUMBERS_COUNT); + for (uint i = 0; i < winningNumbers.length; i++) { + winningNumbers[i] = false; + } + + uint numbersLeft = lotteryDrum.length; + // Remove elements from lotteryDrum + for (uint i = 0; i < randomNumbers.length; i++) { + uint winningNumberIdx = randomNumbers[i] % numbersLeft; + winningNumbers[lotteryDrum[winningNumberIdx]] = true; + lotteryDrum[winningNumberIdx] = lotteryDrum[numbersLeft - 1]; + numbersLeft--; // Simulate pop operation + } + + return winningNumbers; + } + + function finalizeDraw() external { + require(curDraw.prepareFinalizeCalled == true, "prepareFinalizeCalled wasn't called, call it first"); + require(block.timestamp >= drawBeginTime + drawFrequency, "It's not time for the draw yet"); + + // Check if all randomness has been posted + require(allRandomnessPostedForCurDraw(), "Not all randomness has been fulfilled"); + + uint[] memory randomnessIDs = curDraw.randomnessIDs; + uint[] memory randomNumbers = new uint[](randomnessIDs.length); + for (uint i = 0; i < randomnessIDs.length; i++) { + randomNumbers[i] = randomnessGenerator.getRandomness(randomnessIDs[i]); + } + + // Generate the winning numbers using the new function + bool[] memory winningNumbers = generateWinningNumbers(randomNumbers); + + curDraw.winningNumbers = winningNumbers; + + // Check for winners + for (uint i = 0; i < curDraw.tickets.length; i++) { + if (checkIfWinner(curDraw.tickets[i].chosenNumbers, curDraw.winningNumbers)) { + curDraw.winnersCount++; + curDraw.tickets[i].winner = true; + } + } + + emit DrawFinalized(drawHistory.length, winningNumbers); + drawHistory.push(curDraw); + + uint prevDrawWinnersCount = curDraw.winnersCount; + uint prevDrawTotalWinnings = curDraw.totalWinnings; + uint prevDrawTicketRevenue = curDraw.ticketRevenue; + + // Handle the next draw's winnings + resetCurDraw(); + curDraw.totalWinnings += prevDrawTicketRevenue; + if (prevDrawWinnersCount == 0) { + curDraw.totalWinnings += prevDrawTotalWinnings; + } + + curDraw.stackersPoolDistributionRatio = stackersPoolDistributionRatio; + drawBeginTime = block.timestamp; + } + + function resetCurDraw() internal { + delete curDraw.randomnessIDs; + delete curDraw.winningNumbers; + delete curDraw.tickets; + + curDraw.totalWinnings = 0; + curDraw.winnersCount = 0; + curDraw.ticketRevenue = 0; + curDraw.stackersPoolDistributionRatio = 0; + curDraw.prepareFinalizeCalled = false; + } + + function claimPrize(uint drawId, uint ticketId) external { + Ticket storage ticket = drawHistory[drawId].tickets[ticketId]; + require(ticket.player == msg.sender, "You are not the owner of this ticket"); + require(!ticket.claimed, "Prize already claimed"); + require(ticket.winner, "The ticket is not winning one!"); + + uint prizeAmount = drawHistory[drawId].totalWinnings / drawHistory[drawId].winnersCount; + payable(msg.sender).transfer(prizeAmount); + ticket.claimed = true; + emit PrizeClaimed(msg.sender, prizeAmount); + } + + function checkIfWinner(bool[] memory chosenNumbers, bool[] memory winningNumbers) internal pure returns (bool) { + if (chosenNumbers.length != winningNumbers.length) { + return false; + } + + for (uint i = 0; i < chosenNumbers.length; i++) { + if (chosenNumbers[i] != winningNumbers[i]) { + return false; + } + } + + return true; + } + + // Admin functions to adjust contract parameters + function setTicketPrice(uint newTicketPrice) external onlyOwner { // TODO: change it to onlyGov + ticketPrice = newTicketPrice; + } + + function setDrawFrequency(uint newFrequency) external onlyOwner { + drawFrequency = newFrequency; + } + + function setStackersPoolDistributionRatio(uint newRatio) external onlyOwner { + stackersPoolDistributionRatio = newRatio; + } + + function setNewRngAddress(address addr) external onlyOwner { + randomnessGenerator = RandomnessGenerator(addr); + } + + // Public function for users to see their ticket IDs + function getUserTickets(uint drawId, address user) external view returns (Ticket[] memory) { + Ticket[] memory drawTickets = getDraw(drawId).tickets; + + uint[] memory ticketIds = ticketIdsByUserByDrawId[drawId][user]; + Ticket[] memory res = new Ticket[](ticketIds.length); + for (uint i = 0; i < ticketIds.length; ++i) { + res[i] = drawTickets[ticketIds[i]]; + } + return res; + } + + function getCurDrawTotalWinnings() public view returns (uint256) { + return curDraw.totalWinnings; + } + + function getCurDrawRemainingTime() public view returns (uint256) { + return drawBeginTime + drawFrequency; + } + + function getDrawCount() external view returns (uint256) { + return drawHistory.length + 1; + } +} diff --git a/contracts/hardhat.config.ts b/contracts/hardhat.config.ts index f3453ece..497c6026 100644 --- a/contracts/hardhat.config.ts +++ b/contracts/hardhat.config.ts @@ -1,21 +1,14 @@ -import { HardhatUserConfig } from "hardhat/config"; -import "@nomicfoundation/hardhat-toolbox"; -const config: HardhatUserConfig = { - solidity: "0.8.28", +require("@nomicfoundation/hardhat-toolbox"); + +module.exports = { + solidity: '0.8.20', networks: { - localhost: { - url: "http://127.0.0.1:8545", - accounts:{ - mnemonic: "depend version wrestle document episode celery nuclear main penalty hundred trap scale candy donate search glory build valve round athlete become beauty indicate hamster", - } + rollapp: { + url: 'https://json-rpc.ra-2.rollapp.network', + accounts: { + mnemonic: 'chalk excess welcome pool sea session pencil health region lamp library today', + }, }, -/* - hardhat: { - chainId: 1337, - } -*/ }, }; - -export default config; \ No newline at end of file diff --git a/contracts/ignition/coinflip/deploy.js b/contracts/ignition/coinflip/deploy.js index 0c562ed9..2f7f45b3 100644 --- a/contracts/ignition/coinflip/deploy.js +++ b/contracts/ignition/coinflip/deploy.js @@ -7,17 +7,17 @@ async function main() { const deployOptions = { maxFeePerGas: ethers.parseUnits('30', 'gwei'), // Adjust as needed - maxPriorityFeePerGas: ethers.parseUnits('2', 'gwei'), // Adjust as needed + maxPriorityFeePerGas: ethers.parseUnits('20', 'gwei'), // Adjust as needed }; try { // Address of already deployed RandomnessGenerator contract - const randomnessGeneratorAddress = "0xf3911f024f42Ee885bD79c7fc4858909D3312cc1"; // Replace with actual address + const randomnessGeneratorAddress = "0x45b625A16B1304f67488b5D9c2FBB8AA4d649CA5"; // Replace with actual address // Deploy CoinFlip contract - const CoinFlip = await ethers.getContractFactory("CoinFlip", deployer); + const CoinFlip = await ethers.getContractFactory("LotteryAgent", deployer); const writerAddress = deployer.address; // assuming deployer is the writer for testing - const coinFlip = await CoinFlip.deploy(writerAddress, randomnessGeneratorAddress, deployOptions); + const coinFlip = await CoinFlip.deploy(writerAddress, randomnessGeneratorAddress); await coinFlip.waitForDeployment(); console.log("CoinFlip deployed at:", coinFlip.target); diff --git a/contracts/ignition/coinflip/execute.js b/contracts/ignition/coinflip/execute.js index 5e8f60fb..cfa5d3cd 100644 --- a/contracts/ignition/coinflip/execute.js +++ b/contracts/ignition/coinflip/execute.js @@ -1,27 +1,67 @@ const { ethers } = require("hardhat"); -async function main() { - const contractAddress = "0xB8c4Ec444AD59a8f7Cc2c3e3F78bb0c367d2cE1d"; - const coinFlip = await ethers.getContractAt("CoinFlip", contractAddress); + +async function main() { + const contractAddress = "0xAEb1cc59bD804DD3ADA20C405e61B4E05e908874"; + [deployer] = await ethers.getSigners(); + const coinFlip = await ethers.getContractAt("LotteryAgent", contractAddress); // Fetch the current gas price dynamically const { maxFeePerGas, maxPriorityFeePerGas } = await ethers.provider.getFeeData(); - const deployOptions = { - maxFeePerGas: ethers.parseUnits('300000', 'gwei'), - maxPriorityFeePerGas: ethers.parseUnits('200000', 'gwei'), - value: ethers.parseEther("100000000.0") - }; + + // const deployOptions1 = { + // value: ethers.parseEther("1.0") + // }; + // var chosenNumbers = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]; + // + // try { + // for (let i = 0; i < 10; i++) { + // if (i === 9) { + // chosenNumbers = [1, 11, 12, 13, 14, 15, 16, 17, 18, 19]; + // } + // console.log(`Purchasing ticket number ${i + 1}`); + // const tx = await coinFlip.purchaseTicket(chosenNumbers, deployOptions1); + // console.log(`Transaction ${i + 1} hash:`, tx.hash); + // await tx.wait(); + // } + // console.log("Purchased 10 tickets successfully."); + // } catch (error) { + // console.error("An error occurred during ticket purchases:", error); + // } + // + // const deployOptions2 = { + // value: ethers.parseEther("50.0") + // }; + // const tx3 = await coinFlip.depositSupply(deployOptions2); + // // await tx3.wait() + // await coinFlip.setDrawFrequency(0) + // await coinFlip.prepareFinalizeDraw() + // const randomnessGeneratorAddress = "0x45b625A16B1304f67488b5D9c2FBB8AA4d649CA5"; + // const randomnessGenerator = await ethers.getContractAt("RandomnessGenerator", randomnessGeneratorAddress); + // const randId = await randomnessGenerator.randomnessId() + // for (let i = Number(randId) - 10; i <= randId; i++) { + // try { + // const tx = await randomnessGenerator.postRandomness(i, 1); + // await tx.wait() + // } catch (err) { + // // console.log(err) + // } + // } + try { - const tx = await coinFlip.depositSupply(deployOptions) - await tx.wait() - // const tx = await coinFlip.startGame(0, deployOptions) - // await tx.wait() - // const tx1 = await coinFlip.completeGame() - // await tx1.wait() - // console.log(await coinFlip.getPlayerLastGameResult()) + // + // console.log(await coinFlip.curDraw()) + + // await coinFlip.depositSupply(deployOptions) + // console.log(await coinFlip.activeBalance()) + + await coinFlip.setDrawFrequency(1000) +// 6000 = 100 = 60 + 40 = 3600 + 2400 + // await coinFlip.finalizeDraw(); + // console.log(await coinFlip.getDrawShortInfo(0)) } catch (error) { console.error("Error:", error.message); } diff --git a/contracts/ignition/randomnessgenerator/execute.js b/contracts/ignition/randomnessgenerator/execute.js index 7bcf9540..654dee9a 100644 --- a/contracts/ignition/randomnessgenerator/execute.js +++ b/contracts/ignition/randomnessgenerator/execute.js @@ -1,7 +1,7 @@ const { ethers } = require("hardhat"); async function main() { - const randomnessGeneratorAddress = "0x22A1E4163fbD0dc09C717B81AEEa83A68AD41451"; + const randomnessGeneratorAddress = "0x45b625A16B1304f67488b5D9c2FBB8AA4d649CA5"; const randomnessGenerator = await ethers.getContractAt("RandomnessGenerator", randomnessGeneratorAddress); @@ -20,13 +20,13 @@ async function main() { try { // Example: Request Randomness - const tx1 = await randomnessGenerator.requestRandomness(deployOptions); - console.log("Randomness request sent. ID:", tx1.hash.toString()); + // const tx1 = await randomnessGenerator.requestRandomness(deployOptions); + // console.log("Randomness request sent. ID:", tx1.hash.toString()); // await tx1.wait(); - // const tx2 = await randomnessGenerator.getRandomness(1) - // console.log(tx2.toString()) - // const tx3 = await randomnessGenerator.postRandomness(10, 10) + console.log(await randomnessGenerator.getRandomness(10)) + + const tx3 = await randomnessGenerator.postRandomness(1, 10) // const updatedEvents = await randomnessGenerator.pollEvents(0); // console.log("Updated Events:", updatedEvents); diff --git a/contracts/package-lock.json b/contracts/package-lock.json index 300232e9..2b2e8865 100644 --- a/contracts/package-lock.json +++ b/contracts/package-lock.json @@ -17,7 +17,7 @@ }, "devDependencies": { "@nomicfoundation/hardhat-toolbox": "^5.0.0", - "hardhat": "^2.22.17" + "hardhat": "^2.22.18" } }, "node_modules/@adraffy/ens-normalize": { @@ -992,82 +992,90 @@ } }, "node_modules/@nomicfoundation/edr": { - "version": "0.6.5", - "resolved": "https://registry.npmjs.org/@nomicfoundation/edr/-/edr-0.6.5.tgz", - "integrity": "sha512-tAqMslLP+/2b2sZP4qe9AuGxG3OkQ5gGgHE4isUuq6dUVjwCRPFhAOhpdFl+OjY5P3yEv3hmq9HjUGRa2VNjng==", + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/@nomicfoundation/edr/-/edr-0.7.0.tgz", + "integrity": "sha512-+Zyu7TE47TGNcPhOfWLPA/zISs32WDMXrhSWdWYyPHDVn/Uux5TVuOeScKb0BR/R8EJ+leR8COUF/EGxvDOVKg==", "dev": true, + "license": "MIT", "dependencies": { - "@nomicfoundation/edr-darwin-arm64": "0.6.5", - "@nomicfoundation/edr-darwin-x64": "0.6.5", - "@nomicfoundation/edr-linux-arm64-gnu": "0.6.5", - "@nomicfoundation/edr-linux-arm64-musl": "0.6.5", - "@nomicfoundation/edr-linux-x64-gnu": "0.6.5", - "@nomicfoundation/edr-linux-x64-musl": "0.6.5", - "@nomicfoundation/edr-win32-x64-msvc": "0.6.5" + "@nomicfoundation/edr-darwin-arm64": "0.7.0", + "@nomicfoundation/edr-darwin-x64": "0.7.0", + "@nomicfoundation/edr-linux-arm64-gnu": "0.7.0", + "@nomicfoundation/edr-linux-arm64-musl": "0.7.0", + "@nomicfoundation/edr-linux-x64-gnu": "0.7.0", + "@nomicfoundation/edr-linux-x64-musl": "0.7.0", + "@nomicfoundation/edr-win32-x64-msvc": "0.7.0" }, "engines": { "node": ">= 18" } }, "node_modules/@nomicfoundation/edr-darwin-arm64": { - "version": "0.6.5", - "resolved": "https://registry.npmjs.org/@nomicfoundation/edr-darwin-arm64/-/edr-darwin-arm64-0.6.5.tgz", - "integrity": "sha512-A9zCCbbNxBpLgjS1kEJSpqxIvGGAX4cYbpDYCU2f3jVqOwaZ/NU761y1SvuCRVpOwhoCXqByN9b7HPpHi0L4hw==", + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/@nomicfoundation/edr-darwin-arm64/-/edr-darwin-arm64-0.7.0.tgz", + "integrity": "sha512-vAH20oh4GaSB/iQFTRcoO8jLc0CLd9XuLY9I7vtcqZWAiM4U1J4Y8cu67PWmtxbvUQOqXR7S6FtAr8/AlWm14g==", "dev": true, + "license": "MIT", "engines": { "node": ">= 18" } }, "node_modules/@nomicfoundation/edr-darwin-x64": { - "version": "0.6.5", - "resolved": "https://registry.npmjs.org/@nomicfoundation/edr-darwin-x64/-/edr-darwin-x64-0.6.5.tgz", - "integrity": "sha512-x3zBY/v3R0modR5CzlL6qMfFMdgwd6oHrWpTkuuXnPFOX8SU31qq87/230f4szM+ukGK8Hi+mNq7Ro2VF4Fj+w==", + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/@nomicfoundation/edr-darwin-x64/-/edr-darwin-x64-0.7.0.tgz", + "integrity": "sha512-WHDdIrPvLlgXQr2eKypBM5xOZAwdxhDAEQIvEMQL8tEEm2qYW2bliUlssBPrs8E3bdivFbe1HizImslMAfU3+g==", "dev": true, + "license": "MIT", "engines": { "node": ">= 18" } }, "node_modules/@nomicfoundation/edr-linux-arm64-gnu": { - "version": "0.6.5", - "resolved": "https://registry.npmjs.org/@nomicfoundation/edr-linux-arm64-gnu/-/edr-linux-arm64-gnu-0.6.5.tgz", - "integrity": "sha512-HGpB8f1h8ogqPHTyUpyPRKZxUk2lu061g97dOQ/W4CxevI0s/qiw5DB3U3smLvSnBHKOzYS1jkxlMeGN01ky7A==", + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/@nomicfoundation/edr-linux-arm64-gnu/-/edr-linux-arm64-gnu-0.7.0.tgz", + "integrity": "sha512-WXpJB54ukz1no7gxCPXVEw9pgl/9UZ/WO3l1ctyv/T7vOygjqA4SUd6kppTs6MNXAuTiisPtvJ/fmvHiMBLrsw==", "dev": true, + "license": "MIT", "engines": { "node": ">= 18" } }, "node_modules/@nomicfoundation/edr-linux-arm64-musl": { - "version": "0.6.5", - "resolved": "https://registry.npmjs.org/@nomicfoundation/edr-linux-arm64-musl/-/edr-linux-arm64-musl-0.6.5.tgz", - "integrity": "sha512-ESvJM5Y9XC03fZg9KaQg3Hl+mbx7dsSkTIAndoJS7X2SyakpL9KZpOSYrDk135o8s9P9lYJdPOyiq+Sh+XoCbQ==", + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/@nomicfoundation/edr-linux-arm64-musl/-/edr-linux-arm64-musl-0.7.0.tgz", + "integrity": "sha512-1iZYOcEgc+zJI7JQrlAFziuy9sBz1WgnIx3HIIu0J7lBRZ/AXeHHgATb+4InqxtEx9O3W8A0s7f11SyFqJL4Aw==", "dev": true, + "license": "MIT", "engines": { "node": ">= 18" } }, "node_modules/@nomicfoundation/edr-linux-x64-gnu": { - "version": "0.6.5", - "resolved": "https://registry.npmjs.org/@nomicfoundation/edr-linux-x64-gnu/-/edr-linux-x64-gnu-0.6.5.tgz", - "integrity": "sha512-HCM1usyAR1Ew6RYf5AkMYGvHBy64cPA5NMbaeY72r0mpKaH3txiMyydcHibByOGdQ8iFLWpyUdpl1egotw+Tgg==", + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/@nomicfoundation/edr-linux-x64-gnu/-/edr-linux-x64-gnu-0.7.0.tgz", + "integrity": "sha512-wSjC94WcR5MM8sg9w3OsAmT6+bbmChJw6uJKoXR3qscps/jdhjzJWzfgT0XGRq3XMUfimyafW2RWOyfX3ouhrQ==", "dev": true, + "license": "MIT", "engines": { "node": ">= 18" } }, "node_modules/@nomicfoundation/edr-linux-x64-musl": { - "version": "0.6.5", - "resolved": "https://registry.npmjs.org/@nomicfoundation/edr-linux-x64-musl/-/edr-linux-x64-musl-0.6.5.tgz", - "integrity": "sha512-nB2uFRyczhAvWUH7NjCsIO6rHnQrof3xcCe6Mpmnzfl2PYcGyxN7iO4ZMmRcQS7R1Y670VH6+8ZBiRn8k43m7A==", + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/@nomicfoundation/edr-linux-x64-musl/-/edr-linux-x64-musl-0.7.0.tgz", + "integrity": "sha512-Us22+AZ7wkG1mZwxqE4S4ZcuwkEA5VrUiBOJSvKHGOgy6vFvB/Euh5Lkp4GovwjrtiXuvyGO2UmtkzymZKDxZw==", "dev": true, + "license": "MIT", "engines": { "node": ">= 18" } }, "node_modules/@nomicfoundation/edr-win32-x64-msvc": { - "version": "0.6.5", - "resolved": "https://registry.npmjs.org/@nomicfoundation/edr-win32-x64-msvc/-/edr-win32-x64-msvc-0.6.5.tgz", - "integrity": "sha512-B9QD/4DSSCFtWicO8A3BrsnitO1FPv7axB62wq5Q+qeJ50yJlTmyeGY3cw62gWItdvy2mh3fRM6L1LpnHiB77A==", + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/@nomicfoundation/edr-win32-x64-msvc/-/edr-win32-x64-msvc-0.7.0.tgz", + "integrity": "sha512-HAry0heTsWkzReVtjHwoIq3BgFCvXpVhJ5qPmTnegZGsr/KxqvMmHyDMifzKao4bycU8yrpTSyOiAJt27RWjzQ==", "dev": true, + "license": "MIT", "engines": { "node": ">= 18" } @@ -4092,14 +4100,15 @@ } }, "node_modules/hardhat": { - "version": "2.22.17", - "resolved": "https://registry.npmjs.org/hardhat/-/hardhat-2.22.17.tgz", - "integrity": "sha512-tDlI475ccz4d/dajnADUTRc1OJ3H8fpP9sWhXhBPpYsQOg8JHq5xrDimo53UhWPl7KJmAeDCm1bFG74xvpGRpg==", + "version": "2.22.18", + "resolved": "https://registry.npmjs.org/hardhat/-/hardhat-2.22.18.tgz", + "integrity": "sha512-2+kUz39gvMo56s75cfLBhiFedkQf+gXdrwCcz4R/5wW0oBdwiyfj2q9BIkMoaA0WIGYYMU2I1Cc4ucTunhfjzw==", "dev": true, + "license": "MIT", "dependencies": { "@ethersproject/abi": "^5.1.2", "@metamask/eth-sig-util": "^4.0.0", - "@nomicfoundation/edr": "^0.6.5", + "@nomicfoundation/edr": "^0.7.0", "@nomicfoundation/ethereumjs-common": "4.0.4", "@nomicfoundation/ethereumjs-tx": "5.0.4", "@nomicfoundation/ethereumjs-util": "9.0.4", diff --git a/contracts/package.json b/contracts/package.json index 2cb647e5..854609b1 100644 --- a/contracts/package.json +++ b/contracts/package.json @@ -11,7 +11,7 @@ "license": "ISC", "devDependencies": { "@nomicfoundation/hardhat-toolbox": "^5.0.0", - "hardhat": "^2.22.17" + "hardhat": "^2.22.18" }, "dependencies": { "@openzeppelin/contracts": "^5.2.0",