Make sure you have node , npm and yarn installed before going forward.
Copy git clone https://github.com/koii-network/task-template.git google-doodle
Copy cd google-doodle && yarn add puppeteer cheerio
Copy const puppeteer = require("puppeteer");
const cheerio = require("cheerio");
const { namespaceWrapper } = require("./namespaceWrapper");
class CoreLogic {
async task() {}
async fetchSubmission() {}
async submitTask(roundNumber) {}
async validateNode(submission_value) {}
async auditTask(roundNumber) {
console.log("auditTask called with round", roundNumber);
console.log(
await namespaceWrapper.getSlot(),
"current slot while calling auditTask"
);
await namespaceWrapper.validateAndVoteOnNodes(
this.validateNode,
roundNumber
);
}
async generateDistributionList(round) {}
async submitDistributionList(round) {
console.log("SubmitDistributionList called");
const distributionList = await this.generateDistributionList(round);
const decider = await namespaceWrapper.uploadDistributionList(
distributionList,
round
);
console.log("DECIDER", decider);
if (decider) {
const response = await namespaceWrapper.distributionListSubmissionOnChain(
round
);
console.log("RESPONSE FROM DISTRIBUTION LIST", response);
}
}
validateDistribution = async (distributionListSubmitter, round) => {};
async auditDistribution(roundNumber) {
console.log("auditDistribution called with round", roundNumber);
await namespaceWrapper.validateAndVoteOnDistributionList(
this.validateDistribution,
75
);
}
}
const coreLogic = new CoreLogic();
module.exports = {
coreLogic,
};
Next up, we writing the logic of the google-doodle task.