CRYPTO NEWS

Time dependent contract test in hardhat

I am trying to test a contract in which every 4 minutes the price of token is changing. But I am not able to test the contract as I am unable to manipulate the time.The test without time manipulations are running fine but I have no idea about the time manipulation in hardhat. please help. Here is the code.

const { expect } = require("chai"); const { ethers } = require("hardhat"); const {helpers}= require ("@nomicfoundation/hardhat-network-helpers"); console.log(mine)  describe("Token contract", function () {     it("Deployment should assign the total supply of tokens to itself", async function () {         const [owner] = await ethers.getSigners();          const Token = await ethers.getContractFactory("Token");          const token = await Token.deploy();          const contractBalance = await token.balanceOf(token.address);         expect(await token.totalSupply()).to.equal(contractBalance);     });      it("buyer can buy the token", async function () {         const [owner, buyer] = await ethers.getSigners();         const Crowdsale = await ethers.getContractFactory("Crowdsale");         const crowdsale = await Crowdsale.deploy();          const Token = await ethers.getContractFactory("Token");         const token = await Token.deploy();          await crowdsale.setTokenAddress(token.address);         await token.approveContract(crowdsale.address);         await crowdsale.setStart();          await crowdsale.connect(buyer).buyToken({ value: ethers.utils.parseEther("1") })         expect(await token.balanceOf(buyer.address)).to.equal("1000000000000000000000")     })      it("Prices should change accoording to time", async function () {         const [owner, buyer] = await ethers.getSigners();         const Crowdsale = await ethers.getContractFactory("Crowdsale");         const crowdsale = await Crowdsale.deploy();          const Token = await ethers.getContractFactory("Token");         const token = await Token.deploy();          await crowdsale.setTokenAddress(token.address);         await token.approveContract(crowdsale.address);         await crowdsale.setStart();                  await helpers.time.increase(240);          await crowdsale.connect(buyer).buyToken({ value: ethers.utils.parseEther("1") })         expect(await token.balanceOf(buyer.address)).to.equal("1000000000000000000000")          await helpers.time.increase(240);         await crowdsale.connect(buyer).buyToken({ value: ethers.utils.parseEther("1") })         expect(await token.balanceOf(buyer.address)).to.equal("500000000000000000000")          await helpers.time.increase(240);         await crowdsale.connect(buyer).buyToken({ value: ethers.utils.parseEther("1") })         expect(await token.balanceOf(buyer.address)).to.equal("200000000000000000000")        })   }); 

Here is the error.enter image description here

W3E to host world’s first web3 esports tournament this November in Istanbul

Web3 gaming company W3E will be hosting the world’s first Web3 e-sports tournament on Nov. 17 as a part of  Istanbul Blockchain Week. The event will occur in Istanbul between November 14 and 17. The W3E global e-sports tournament will take place on the last day of the whole event. The ESA e-sports arena will::Listen

Web3 gaming company W3E will be hosting the world’s first Web3 e-sports tournament on Nov. 17 as a part of  Istanbul Blockchain Week. The event will occur in Istanbul between November 14 and 17.

The W3E global e-sports tournament will take place on the last day of the whole event. The ESA e-sports arena will be placed at the center of the event venue. W3E will also be inviting top gamers from Europe and Turkey to form teams and participate in a live white knuckle tournament.

Istanbul Blockchain Week’s founder and CEO Erhan Korhaliller commented on the W3E tournament and said:

“I am incredibly excited to be leading the team putting on the first ever live Web3 Esports tournament, alongside the first Web3 games expo […] It is a privilege to have our contestants play EV.io, and I couldn’t be more proud to welcome the world to what will be a history-making event in this space.”

Leading game of the event

EV.io is selected as the event’s league partner and the lead game for the tournament. The Solana-based first-person shooting game is free-to-play and play-to-earn and is one of the most popular games on the Solana blockchain.

EV.io consists of a set of futuristic arenas, has a fast-paced style, and offers a variety of different combat styles via a wide range of weapons to choose from. The game was designed to run smoothly even with the lowest system specs so that it can be accessible and enjoyable to all players.

Players can play EV.io for free and earn in-game tokens, which can then be converted to Solana (SOL) and fiat currencies. The game will also produce W3E-branded skins and weapons for players who participate in the tournament. The players will be allowed to keep these skins and weapons after the event ends, regardless of their ranking in the game.

The post W3E to host world’s first web3 esports tournament this November in Istanbul appeared first on CryptoSlate.

Time dependent contract test in hardhat

Shopping cart
There are no products in the cart!
Continue shopping
0