Initial Commit
This commit is contained in:
149
scripts/createStakes.js
Normal file
149
scripts/createStakes.js
Normal file
@@ -0,0 +1,149 @@
|
||||
const { ethers } = require("hardhat");
|
||||
const fs = require("fs");
|
||||
const path = require("path");
|
||||
|
||||
async function main() {
|
||||
// Load deployed addresses
|
||||
const deployedAddressesPath = path.join(__dirname, "deployedAddresses.json");
|
||||
const deployedAddresses = JSON.parse(fs.readFileSync(deployedAddressesPath, "utf8"));
|
||||
|
||||
// Extract the proxy address
|
||||
const proxyAddress = deployedAddresses.proxyAddress; // Adjust the key if named differently
|
||||
|
||||
// Get the Contract ABI and connect to the proxy
|
||||
// Replace 'PacaFinanceWithBoostAndSchedule' with your contract name if different
|
||||
const PacaContract = await ethers.getContractFactory("PacaFinanceWithBoostAndSchedule");
|
||||
const proxy = await PacaContract.attach(proxyAddress);
|
||||
|
||||
// Address to impersonate
|
||||
const impersonateAddress = "0xbf12D3b827a230F7390EbCc9b83b289FdC98ba81";
|
||||
|
||||
// Impersonate account
|
||||
await network.provider.request({
|
||||
method: "hardhat_impersonateAccount",
|
||||
params: [impersonateAddress]
|
||||
});
|
||||
|
||||
// Get impersonated signer
|
||||
const impersonatedSigner = await ethers.getSigner(impersonateAddress);
|
||||
|
||||
// Prepare stake inputs
|
||||
const stakeInputs = [
|
||||
{
|
||||
user: "0x1234567890123456789012345678901234567890", // Replace with a test address
|
||||
amount: ethers.parseEther("100"), // 100 tokens
|
||||
unlockTime: Math.floor(Date.now() / 1000) + 86400 * 30, // 30 days from now
|
||||
dailyRewardRate: 5, // Reward rate
|
||||
},
|
||||
{
|
||||
user: "0x1234567890123456789012345678901234567890", // Same user for multiple stakes
|
||||
amount: ethers.parseEther("200"), // 200 tokens
|
||||
unlockTime: Math.floor(Date.now() / 1000) + 86400 * 60, // 60 days from now
|
||||
dailyRewardRate: 10, // Reward rate
|
||||
},
|
||||
{
|
||||
user: "0x1234567890123456789012345678901234567890", // Same user for multiple stakes
|
||||
amount: ethers.parseEther("200"), // 200 tokens
|
||||
unlockTime: Math.floor(Date.now() / 1000) + 86400 * 60, // 60 days from now
|
||||
dailyRewardRate: 10, // Reward rate
|
||||
},
|
||||
{
|
||||
user: "0x1234567890123456789012345678901234567890", // Same user for multiple stakes
|
||||
amount: ethers.parseEther("200"), // 200 tokens
|
||||
unlockTime: Math.floor(Date.now() / 1000) + 86400 * 60, // 60 days from now
|
||||
dailyRewardRate: 10, // Reward rate
|
||||
},
|
||||
{
|
||||
user: "0x1234567890123456789012345678901234567890", // Same user for multiple stakes
|
||||
amount: ethers.parseEther("200"), // 200 tokens
|
||||
unlockTime: Math.floor(Date.now() / 1000) + 86400 * 60, // 60 days from now
|
||||
dailyRewardRate: 10, // Reward rate
|
||||
},
|
||||
|
||||
{
|
||||
user: "0x1234567890123456789012345678901234567890", // Same user for multiple stakes
|
||||
amount: ethers.parseEther("200"), // 200 tokens
|
||||
unlockTime: Math.floor(Date.now() / 1000) + 86400 * 60, // 60 days from now
|
||||
dailyRewardRate: 10, // Reward rate
|
||||
},
|
||||
{
|
||||
user: "0x1234567890123456789012345678901234567890", // Same user for multiple stakes
|
||||
amount: ethers.parseEther("200"), // 200 tokens
|
||||
unlockTime: Math.floor(Date.now() / 1000) + 86400 * 60, // 60 days from now
|
||||
dailyRewardRate: 10, // Reward rate
|
||||
},
|
||||
{
|
||||
user: "0x1234567890123456789012345678901234567890", // Same user for multiple stakes
|
||||
amount: ethers.parseEther("200"), // 200 tokens
|
||||
unlockTime: Math.floor(Date.now() / 1000) + 86400 * 60, // 60 days from now
|
||||
dailyRewardRate: 10, // Reward rate
|
||||
},
|
||||
|
||||
{
|
||||
user: "0x1234567890123456789012345678901234567890", // Same user for multiple stakes
|
||||
amount: ethers.parseEther("200"), // 200 tokens
|
||||
unlockTime: Math.floor(Date.now() / 1000) + 86400 * 60, // 60 days from now
|
||||
dailyRewardRate: 10, // Reward rate
|
||||
},
|
||||
{
|
||||
user: "0x1234567890123456789012345678901234567890", // Same user for multiple stakes
|
||||
amount: ethers.parseEther("200"), // 200 tokens
|
||||
unlockTime: Math.floor(Date.now() / 1000) + 86400 * 60, // 60 days from now
|
||||
dailyRewardRate: 10, // Reward rate
|
||||
},
|
||||
{
|
||||
user: "0x1234567890123456789012345678901234567890", // Same user for multiple stakes
|
||||
amount: ethers.parseEther("200"), // 200 tokens
|
||||
unlockTime: Math.floor(Date.now() / 1000) + 86400 * 60, // 60 days from now
|
||||
dailyRewardRate: 10, // Reward rate
|
||||
},
|
||||
|
||||
{
|
||||
user: "0x1234567890123456789012345678901234567890", // Same user for multiple stakes
|
||||
amount: ethers.parseEther("200"), // 200 tokens
|
||||
unlockTime: Math.floor(Date.now() / 1000) + 86400 * 60, // 60 days from now
|
||||
dailyRewardRate: 10, // Reward rate
|
||||
},
|
||||
{
|
||||
user: "0x1234567890123456789012345678901234567890", // Same user for multiple stakes
|
||||
amount: ethers.parseEther("200"), // 200 tokens
|
||||
unlockTime: Math.floor(Date.now() / 1000) + 86400 * 60, // 60 days from now
|
||||
dailyRewardRate: 10, // Reward rate
|
||||
},
|
||||
{
|
||||
user: "0x1234567890123456789012345678901234567890", // Same user for multiple stakes
|
||||
amount: ethers.parseEther("200"), // 200 tokens
|
||||
unlockTime: Math.floor(Date.now() / 1000) + 86400 * 60, // 60 days from now
|
||||
dailyRewardRate: 10, // Reward rate
|
||||
},
|
||||
{
|
||||
user: "0x1234567890123456789012345678901234567890", // Same user for multiple stakes
|
||||
amount: ethers.parseEther("200"), // 200 tokens
|
||||
unlockTime: Math.floor(Date.now() / 1000) + 86400 * 60, // 60 days from now
|
||||
dailyRewardRate: 10, // Reward rate
|
||||
},
|
||||
{
|
||||
user: "0x1234567890123456789012345678901234567890", // Same user for multiple stakes
|
||||
amount: ethers.parseEther("200"), // 200 tokens
|
||||
unlockTime: Math.floor(Date.now() / 1000) + 86400 * 60, // 60 days from now
|
||||
dailyRewardRate: 10, // Reward rate
|
||||
},
|
||||
|
||||
];
|
||||
|
||||
// Call the createStakes function
|
||||
// console.log("Sending transaction to create stakes from impersonated address...");
|
||||
// const tx = await proxy.connect(impersonatedSigner).createStakes(stakeInputs);
|
||||
// await tx.wait();
|
||||
|
||||
// console.log("Stakes created successfully!");
|
||||
const tx = await proxy.connect(impersonatedSigner).getStakes("0xfe5FD43b5DD5E9dA362901C5B24EF7aEdC3914B0");
|
||||
// await tx.wait();
|
||||
console.log(tx);
|
||||
|
||||
}
|
||||
|
||||
main().catch((error) => {
|
||||
console.error(error);
|
||||
process.exitCode = 1;
|
||||
});
|
||||
Reference in New Issue
Block a user