Change the directory and install all the dependencies, using this command:
cdgoogle-doodle&&yarnaddpuppeteercheerio
Open the google-doodle directory on your code editor. We will be using a Class template for creating this task, so replace the entire code in the coreLogic.js file with the template below:
constpuppeteer=require("puppeteer");constcheerio=require("cheerio");const { namespaceWrapper } =require("./namespaceWrapper");classCoreLogic {asynctask() {}asyncfetchSubmission() {}asyncsubmitTask(roundNumber) {}asyncvalidateNode(submission_value) {}asyncauditTask(roundNumber) {console.log("auditTask called with round", roundNumber);console.log(awaitnamespaceWrapper.getSlot(),"current slot while calling auditTask" );awaitnamespaceWrapper.validateAndVoteOnNodes(this.validateNode, roundNumber ); }asyncgenerateDistributionList(round) {}asyncsubmitDistributionList(round) {console.log("SubmitDistributionList called");constdistributionList=awaitthis.generateDistributionList(round);constdecider=awaitnamespaceWrapper.uploadDistributionList( distributionList, round );console.log("DECIDER", decider);if (decider) {constresponse=awaitnamespaceWrapper.distributionListSubmissionOnChain( round );console.log("RESPONSE FROM DISTRIBUTION LIST", response); } }validateDistribution=async (distributionListSubmitter, round) => {};asyncauditDistribution(roundNumber) {console.log("auditDistribution called with round", roundNumber);awaitnamespaceWrapper.validateAndVoteOnDistributionList(this.validateDistribution,75 ); }}constcoreLogic=newCoreLogic();module.exports= { coreLogic,};
Next up, we writing the logic of the google-doodle task.