29 lines
1.0 KiB
JavaScript
29 lines
1.0 KiB
JavaScript
const { ethers, JsonRpcProvider } = require('ethers');
|
|
|
|
// Define the Tenderly provider with your Tenderly fork RPC URL
|
|
// const provider = new ethers.providers.JsonRpcProvider("https://rpc.tenderly.co/fork/c3c1b1c6-3139-4682-80ef-992caf6c59d8");
|
|
const provider = new JsonRpcProvider('https://virtual.binance.rpc.tenderly.co/bd4ca4c1-0512-47bf-9674-6f509e9ad7fc');
|
|
|
|
// Define the number of seconds to advance the time
|
|
const timeInSeconds = 24 * 60 * 60 * 120; // 24 hours in seconds
|
|
|
|
async function advanceTime() {
|
|
try {
|
|
// Convert the time into a hex-encoded value
|
|
const params = [ethers.toQuantity(timeInSeconds)];
|
|
|
|
// Send the `evm_increaseTime` RPC call to the Tenderly fork
|
|
await provider.send("evm_increaseTime", params);
|
|
|
|
// Send the `evm_mine` RPC call to mine the next block
|
|
await provider.send("evm_mine", []);
|
|
|
|
console.log(`Time advanced by ${timeInSeconds} seconds (24 hours).`);
|
|
} catch (error) {
|
|
console.error("Failed to advance time:", error);
|
|
}
|
|
}
|
|
|
|
// Call the function to advance time
|
|
// advanceTime();
|