Skip to content

Commit

Permalink
Add sunriseArb hardhat task
Browse files Browse the repository at this point in the history
  • Loading branch information
pizzaman1337 committed Sep 16, 2024
1 parent 5fffd26 commit d8105fd
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions protocol/hardhat.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ require("hardhat-tracer");
require("@openzeppelin/hardhat-upgrades");
require("dotenv").config();
require("@nomiclabs/hardhat-etherscan");
const { time } = require("@nomicfoundation/hardhat-network-helpers");

const { upgradeWithNewFacets } = require("./scripts/diamond");
const {
Expand Down Expand Up @@ -92,6 +93,35 @@ task("sunrise2", async function () {
await season.sunrise();
});

task("sunriseArb", async function () {
const lastTimestamp = (await ethers.provider.getBlock("latest")).timestamp;
const hourTimestamp = parseInt(lastTimestamp / 3600 + 1) * 3600;
await network.provider.send("evm_setNextBlockTimestamp", [hourTimestamp]);

season = await ethers.getContractAt("SeasonFacet", "0xD1A0060ba708BC4BCD3DA6C37EFa8deDF015FB70");
await season.sunrise();

seasonGetters = await ethers.getContractAt(
"SeasonGettersFacet",
"0xD1A0060ba708BC4BCD3DA6C37EFa8deDF015FB70"
);
const unixTime = await time.latest();
const currentTime = new Date(unixTime * 1000).toLocaleString();

console.log(
"sunrise complete!\ncurrent season:",
await seasonGetters.season(),
"\ncurrent blockchain time:",
unixTime,
"\nhuman readable time:",
currentTime,
"\ncurrent block:",
(await ethers.provider.getBlock("latest")).number,
"\ndeltaB:",
(await seasonGetters.totalDeltaB()).toString()
);
});

task("getTime", async function () {
beanstalk = await ethers.getContractAt("SeasonFacet", BEANSTALK);
console.log("Current time: ", await this.seasonGetter.time());
Expand Down

0 comments on commit d8105fd

Please sign in to comment.