Skip to content

Commit

Permalink
feat (72h event): block claim button before specific time
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolastmaia committed Dec 20, 2024
1 parent b41a857 commit c4fa21f
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions src/localServer/workers/utilities/web3Util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1015,6 +1015,23 @@ const listenProfileVer = async () => {
selectLeaderboard(epoch)
}

function isSpecificTime() {
const targetDate = new Date("2024-12-20T00:00:00-08:00"); // PST is UTC-8
const currentDate = new Date();

const targetDatePST = new Date(
targetDate.toLocaleString("en-US", { timeZone: "America/Los_Angeles" })
);

// Convert current date to PST
const currentDatePST = new Date(
currentDate.toLocaleString("en-US", { timeZone: "America/Los_Angeles" })
);

return targetDatePST.getTime() <= currentDatePST.getTime();
}


const getClaimedCntpReward = async () => {
const provider = new ethers.JsonRpcProvider(conet_rpc);

Expand All @@ -1033,6 +1050,8 @@ const getClaimedCntpReward = async () => {
}

const getProfileAvailableCntpReward = async (cmd) => {
if (!isSpecificTime()) return;

const walletAddress = cmd.data[0];

if (!CoNET_Data || !walletAddress) {
Expand Down Expand Up @@ -1060,6 +1079,8 @@ const getProfileAvailableCntpReward = async (cmd) => {
}

const claimChristmasReward = async (cmd: any) => {
if (!isSpecificTime()) return;

const walletAddressTmp = cmd.data[0];
const walletAddress = ethers.getAddress(walletAddressTmp);

Expand Down

0 comments on commit c4fa21f

Please sign in to comment.