Developers Forum for XinFin XDC Network

Discussion on: [WIP]Account not managed by node

Collapse
ncode profile image
ncode Author
// scripts/create-box.js 
 const { 
     ethers, 
     upgrades, 
     deployments, 
     getNamedAccounts, 
     network, 
 } = require("hardhat"); 
 const prompt = require("prompt-sync")({ sigint: true }); 
 require("dotenv").config(); 
 const { MNEMONIC, MNEMONIC1 } = process.env; 
 console.log(MNEMONIC); 
 console.log(MNEMONIC1); 
 async function main() { 
     const [custodianContractOwner] = await ethers.getSigners() 

     const WXDCOZ = await ethers.getContractAt("WXDCOZ", "0x7fD4689BB23598422d3f4686518fEC367eA94F79"); 
     const EscrowManager = await ethers.getContract("EscrowManager", custodianContractOwner); 

     console.log("EscrowManager address: ", EscrowManager.address); 
     const investors = []; 
     for (let i = 0; i < 19; i++) { 
         investors.push( 
             await ethers.Wallet.fromMnemonic( 
                 MNEMONIC, 
                 `m/44'/60'/0'/0/${i}` 
             ) 
         ); 
     } 
     for (let i = 0; i < 19; i++) { 
         investors.push( 
             await ethers.Wallet.fromMnemonic( 
                 MNEMONIC1, 
                 `m/44'/60'/0'/0/${i}` 
             ) 
         ); 
     } 
     let WXDCOZSUB; 
     let tx; 
     // run a loop and transfer 1.1 xdc to each subscriber from the custodianContractOwner 

     for (let i = 0; i < investors.length; i++) { 

   
         console.log("----------------------🔎 Checking investor: ", i, " - ", investors[i].address, "----------------------"); 
         const signer = await ethers.provider.getSigner(investors[i].address); 
         WXDCOZSUB = await ethers.getContractAt("WXDCOZ", WXDCOZ.address, signer); 
         
         // Check if the investor has more then 1 WXDCOZ 
         let WXDCOZBalance = await WXDCOZ.balanceOf(investors[i].address); 
         if (WXDCOZBalance < 1 * 10 ** 18) { 
             // Deposit 1.0 XDC to the WXDCOZ contract 
             tx = await WXDCOZSUB.deposit({ 
                 value: ethers.utils.parseEther("1"), 
                 gasLimit: 1000000, 
             }); 
             await tx.wait(); 
             console.log("🚀 Deposited 1.0 XDC to WXDCOZ contract: ", investors[i].address, "tx hash: ", tx.hash); 
         } else { 
             console.log("✅ Investor: ", investors[i].address, "has more then 1 WXDCOZ"); 
         } 

         // Check if the investor has given approval to the EscrowManager contract 
         

      

     } 
 } 
 main();
Enter fullscreen mode Exit fullscreen mode

@ruslan_wing above is the script which I am using to load test , it's working fine for other accounts however a few accounts like the on mentioned in the original post throws error , even tho the account are active since a year on the xdc network. and since it's working for the other accounts, I am positive that I am connected to correct network

Collapse
rupps_blocksscan profile image
Rupali Mestry

Hello,

We would apppriciate if you could us share details step so that developer can reproduce issue and provide solution it.