<|start_filename|>contracts/node_modules/iso-random-stream/package.json<|end_filename|>
{
  "_from": "iso-random-stream@^2.0.0",
  "_id": "iso-random-stream@2.0.0",
  "_inBundle": false,
  "_integrity": "sha512-lGuIu104KfBV9ubYTSaE3GeAr6I69iggXxBHbTBc5u/XKlwlWl0LCytnkIZissaKqvxablwRD9B3ktVnmIUnEg==",
  "_location": "/iso-random-stream",
  "_phantomChildren": {},
  "_requested": {
    "type": "range",
    "registry": true,
    "raw": "iso-random-stream@^2.0.0",
    "name": "iso-random-stream",
    "escapedName": "iso-random-stream",
    "rawSpec": "^2.0.0",
    "saveSpec": null,
    "fetchSpec": "^2.0.0"
  },
  "_requiredBy": [
    "/libp2p-crypto"
  ],
  "_resolved": "https://registry.npmjs.org/iso-random-stream/-/iso-random-stream-2.0.0.tgz",
  "_shasum": "3f0118166d5443148bbc134345fb100002ad0f1d",
  "_spec": "iso-random-stream@^2.0.0",
  "_where": "/home/geoffrey/app/EtherScore/contracts/node_modules/libp2p-crypto",
  "author": {
    "name": "<NAME>",
    "email": "<EMAIL>",
    "url": "hugodias.me"
  },
  "browser": {
    "./src/random.js": "./src/random.browser.js"
  },
  "bugs": {
    "url": "https://github.com/hugomrdias/iso-random-stream/issues"
  },
  "bundleDependencies": false,
  "dependencies": {
    "events": "^3.3.0",
    "readable-stream": "^3.4.0"
  },
  "deprecated": false,
  "description": "Random bytes stream for node and browser",
  "devDependencies": {
    "@types/readable-stream": "^2.3.9",
    "@types/tape": "^4.13.0",
    "c8": "^7.7.0",
    "hd-scripts": "^0.1.1",
    "nyc": "^15.0.1",
    "playwright-test": "^3.0.0",
    "sirv-cli": "^1.0.11",
    "tap-spec": "^5.0.0",
    "tape": "^5.2.2"
  },
  "engines": {
    "node": ">=10"
  },
  "eslintConfig": {
    "extends": "./node_modules/hd-scripts/eslint/index.js"
  },
  "eslintIgnore": [
    "dist"
  ],
  "files": [
    "dist/src",
    "src"
  ],
  "homepage": "https://github.com/hugomrdias/iso-random-stream#readme",
  "keywords": [
    "stream",
    "random",
    "bytes",
    "isomorphic",
    "node",
    "browser"
  ],
  "license": "MIT",
  "lint-staged": {
    "*.{js,ts,md,yml,json}": "prettier --write",
    "*.js": "eslint --fix"
  },
  "main": "src/index.js",
  "name": "iso-random-stream",
  "prettier": "hd-scripts/prettier.config.js",
  "repository": {
    "type": "git",
    "url": "git+https://github.com/hugomrdias/iso-random-stream.git"
  },
  "scripts": {
    "check": "yarn lint && yarn test && yarn test:browser",
    "cov": "yarn test && yarn test:browser && nyc report --reporter=html && sirv coverage",
    "lint": "eslint **/*.js && prettier --check **/*.{js,yml,json} --ignore-path .gitignore && tsc",
    "prepare": "tsc",
    "test": "c8 -r json --report-dir .nyc_output --clean tape test.js",
    "test:browser": "playwright-test test.js --runner tape --cov"
  },
  "simple-git-hooks": {
    "pre-commit": "npx lint-staged"
  },
  "types": "dist/src/index.d.ts",
  "version": "2.0.0"
}


<|start_filename|>contracts/migrations/2_deploy.js<|end_filename|>
// migrations/2_deploy.js
const BadgeDefinitionFactory = artifacts.require("BadgeDefinitionFactory");
const BadgeTokenFactory = artifacts.require("BadgeTokenFactory");
// const BadgeQueryOracle = artifacts.require("BadgeQueryOracle");

module.exports = async function (deployer) {
  await deployer.deploy(BadgeDefinitionFactory);
  await deployer.deploy(BadgeTokenFactory, BadgeDefinitionFactory.address);
  // await deployer.deploy(BadgeQueryOracle);
};

<|start_filename|>contracts/node_modules/solidity-docgen/dist/memoize.test.js<|end_filename|>
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const ava_1 = __importDefault(require("ava"));
const memoize_1 = require("./memoize");
ava_1.default('no arguments', t => {
    const fn = memoize_1.memoized(() => 4);
    t.is(fn(), 4);
});
ava_1.default('one argument', t => {
    const fn = memoize_1.memoized(x => x);
    t.is(fn(4), 4);
    t.is(fn(5), 5);
});
ava_1.default('two arguments', t => {
    const fn = memoize_1.memoized((x, y) => x + y);
    t.is(fn(4, 4), 8);
    t.is(fn(4, 5), 9);
    t.is(fn(4, 4), 8);
});
ava_1.default('class method', t => {
    class Klass {
        constructor(value) {
            this.value = value;
            this.calls = 0;
        }
        foo() {
            this.calls += 1;
            return this.value;
        }
    }
    Klass.prototype.foo = memoize_1.memoized(Klass.prototype.foo);
    const inst1 = new Klass(4);
    t.is(inst1.foo(), 4);
    t.is(inst1.foo(), 4);
    t.is(inst1.calls, 1);
    const inst2 = new Klass(5);
    t.is(inst2.foo(), 5);
    t.is(inst1.foo(), 4);
});
//# sourceMappingURL=memoize.test.js.map

<|start_filename|>contracts/node_modules/solidity-docgen/dist/handlebars.js<|end_filename|>
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.slug = exports.compile = exports.registerHelpers = void 0;
const handlebars_1 = __importDefault(require("handlebars"));
const H = handlebars_1.default.create();
H.registerHelper('slug', slug);
H.registerHelper({
    eq: function (v1, v2) {
        return v1 === v2;
    },
    ne: function (v1, v2) {
        return v1 !== v2;
    },
    lt: function (v1, v2) {
        return v1 < v2;
    },
    gt: function (v1, v2) {
        return v1 > v2;
    },
    lte: function (v1, v2) {
        return v1 <= v2;
    },
    gte: function (v1, v2) {
        return v1 >= v2;
    },
    and: function () {
        return [...arguments].slice(0, -1).every(Boolean);
    },
    or: function () {
        return [...arguments].slice(0, -1).some(Boolean);
    }
});
function registerHelpers(helpers) {
    H.registerHelper(helpers);
}
exports.registerHelpers = registerHelpers;
;
function compile(template) {
    const compiledTemplate = H.compile(template, { noEscape: true });
    return context => compiledTemplate(context, {
        allowProtoPropertiesByDefault: true,
        allowProtoMethodsByDefault: true,
    });
}
exports.compile = compile;
function slug(str) {
    return str.replace(/\W/g, '-');
}
exports.slug = slug;
//# sourceMappingURL=handlebars.js.map

<|start_filename|>contracts/node_modules/solidity-docgen/dist/page.js<|end_filename|>
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
    Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
    o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
    if (mod && mod.__esModule) return mod;
    var result = {};
    if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
    __setModuleDefault(result, mod);
    return result;
};
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.ContractPage = exports.ReadmePage = exports.DefaultPage = exports.Page = void 0;
const path_1 = __importDefault(require("path"));
const handlebars = __importStar(require("./handlebars"));
const lodash_1 = require("lodash");
class Page {
    constructor(sitemap) {
        this.sitemap = sitemap;
    }
    render(preludeTemplate) {
        const links = this.sitemap.links(this);
        const prelude = preludeTemplate({ links });
        return addPrelude(this.contents, prelude);
    }
}
exports.Page = Page;
class DefaultPage extends Page {
    constructor(sitemap, ext, contracts) {
        super(sitemap);
        this.ext = ext;
        this.contracts = contracts;
    }
    get contents() {
        return this.contracts.map(c => c.toString()).join('\n\n');
    }
    get path() {
        return path_1.default.format({
            name: 'index',
            ext: '.' + this.ext,
        });
    }
}
exports.DefaultPage = DefaultPage;
class ReadmePage extends Page {
    constructor(sitemap, readme, contracts) {
        super(sitemap);
        this.readme = readme;
        this.contracts = contracts;
        lodash_1.defaults(this, lodash_1.keyBy(this.contracts, c => c.name));
    }
    get contents() {
        return this.template(this);
    }
    get template() {
        return handlebars.compile(this.readme.contents);
    }
    get location() {
        return path_1.default.dirname(this.readme.path);
    }
    get path() {
        const { dir, ext } = path_1.default.parse(this.readme.path);
        return path_1.default.normalize(path_1.default.format({
            dir: path_1.default.dirname(dir),
            name: path_1.default.basename(dir) || 'index',
            ext,
        }));
    }
}
exports.ReadmePage = ReadmePage;
class ContractPage extends Page {
    constructor(sitemap, contract, ext) {
        super(sitemap);
        this.contract = contract;
        this.ext = ext;
    }
    get contents() {
        return this.contract.toString();
    }
    get contracts() {
        return [this.contract];
    }
    get path() {
        const dir = path_1.default.dirname(this.contract.file.path);
        return path_1.default.format({ dir, name: this.contract.name, ext: '.' + this.ext });
    }
}
exports.ContractPage = ContractPage;
function addPrelude(contents, prelude) {
    const preludeRegex = /^(---\n([^]*?\n)?---\n)?/;
    return contents.replace(preludeRegex, (_, frontmatter) => frontmatter ? frontmatter + prelude : prelude);
}
//# sourceMappingURL=page.js.map

<|start_filename|>frontend/src/store/index.js<|end_filename|>
import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)

export default new Vuex.Store({
  state: {
    address: ''
  },
  mutations: {
    updateAddress (state, address) {
      state.address = address
    }
  },
  actions: {
  },
  modules: {
  }
})


<|start_filename|>contracts/node_modules/solidity-docgen/dist/sitemap.test.js<|end_filename|>
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const ava_1 = __importDefault(require("ava"));
const path_1 = __importDefault(require("path"));
const sitemap_1 = require("./sitemap");
const source_1 = require("./source");
const solc_output_builder_1 = require("./solc-output-builder");
const emptyReadme = (dir = '') => ({
    path: path_1.default.join(dir, 'README.md'),
    contents: '',
});
const dummyFilter = {
    matcher: () => true,
    files: () => { throw new Error('Unsupported'); },
};
ava_1.default('single readme', t => {
    const source = buildSoliditySource();
    const sitemap = sitemap_1.Sitemap.generate(source, dummyFilter, [emptyReadme()], 'md', 'readmes');
    t.is(sitemap.pages.length, 1);
});
ava_1.default('single readme no contracts', t => {
    const source = buildSoliditySource(b => b
        .file('Foo.sol'));
    const sitemap = sitemap_1.Sitemap.generate(source, dummyFilter, [emptyReadme()], 'md', 'readmes');
    const { pages: [page] } = sitemap;
    t.is(page.contracts.length, 0);
});
ava_1.default('single readme multiple contracts', t => {
    const source = buildSoliditySource(b => b
        .file('Foo.sol')
        .contract('Foo')
        .contract('Bar'));
    const sitemap = sitemap_1.Sitemap.generate(source, dummyFilter, [emptyReadme()], 'md', 'readmes');
    const { pages: [page] } = sitemap;
    t.is(page.contracts.length, 2);
    t.assert(page.contracts.some(c => c.name === 'Foo'));
    t.assert(page.contracts.some(c => c.name === 'Bar'));
});
ava_1.default('single source with file multiple contracts', t => {
    const source = buildSoliditySource(b => b
        .file('test.sol')
        .contract('Foo')
        .contract('Bar'));
    const sitemap = sitemap_1.Sitemap.generate(source, dummyFilter, [], 'md', 'contracts');
    const { pages } = sitemap;
    t.is(pages.length, 2);
    t.assert(pages.some(p => p.path === './Foo.md'));
    t.assert(pages.some(p => p.path === './Bar.md'));
});
ava_1.default('filter subdirectory', t => {
    const source = buildSoliditySource(b => b
        .file('Foo.sol')
        .contract('Foo')
        .file('sub/Bar.sol')
        .contract('Bar'));
    const sitemap = sitemap_1.Sitemap.generate(source, dummyFilter, [emptyReadme('sub')], 'md', 'readmes');
    const { pages: [page] } = sitemap;
    t.is(page.contracts.length, 1);
    t.is(page.contracts[0].name, 'Bar');
});
ava_1.default('filter nested subdirectories', t => {
    const source = buildSoliditySource(b => b
        .file('sub/Bar.sol')
        .contract('Bar')
        .file('sub/sub2/Foo.sol')
        .contract('Foo'));
    const sitemap = sitemap_1.Sitemap.generate(source, dummyFilter, [emptyReadme('sub')], 'md', 'readmes');
    const { pages: [page] } = sitemap;
    t.is(page.contracts.length, 2);
    t.assert(page.contracts.some(c => c.name === 'Bar'));
    t.assert(page.contracts.some(c => c.name === 'Foo'));
});
ava_1.default('links', t => {
    const source = buildSoliditySource(b => b
        .file('sub1/Bar.sol')
        .contract('Bar')
        .file('sub2/Foo.sol')
        .contract('Foo'));
    const sitemap = sitemap_1.Sitemap.generate(source, dummyFilter, [emptyReadme('sub1'), emptyReadme('sub2')], 'md', 'readmes');
    const links = sitemap.links(sitemap.pages[0]);
    t.is(links.length, 2);
    const bar = links[0];
    t.is(bar.target.name, 'Bar');
    t.is(bar.path, 'sub1.md');
    t.is(bar.relativePath, '');
    const foo = links[1];
    t.is(foo.target.name, 'Foo');
    t.is(foo.path, 'sub2.md');
    t.is(foo.relativePath, 'sub2.md');
});
function buildSoliditySource(builder) {
    const solcOutput = new solc_output_builder_1.SolcOutputBuilder();
    if (builder)
        builder(solcOutput);
    return new source_1.Source('', solcOutput, c => c.name);
}
//# sourceMappingURL=sitemap.test.js.map

<|start_filename|>nginx/Dockerfile<|end_filename|>
FROM nginx:1.19.10-alpine

RUN rm /etc/nginx/conf.d/default.conf
RUN mkdir /etc/nginx/templates
COPY dev.conf.template /etc/nginx/templates


<|start_filename|>contracts/node_modules/solidity-docgen/dist/solc.js<|end_filename|>
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
    Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
    o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
    if (mod && mod.__esModule) return mod;
    var result = {};
    if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
    __setModuleDefault(result, mod);
    return result;
};
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.SolcAdapter = exports.compile = exports.outputSelection = void 0;
const lodash_1 = require("lodash");
const fs_1 = __importDefault(require("fs"));
const semver_1 = __importDefault(require("semver"));
exports.outputSelection = {
    '*': {
        '': [
            'ast',
        ],
    },
};
async function compile(filter, solcModule = require.resolve('solc'), solcSettings = { optimizer: { enabled: true, runs: 200 } }) {
    const solc = await SolcAdapter.require(solcModule);
    const files = await filter.glob('*.sol');
    const sources = lodash_1.fromPairs(await Promise.all(files.map(async (file) => [
        file,
        { content: await fs_1.default.promises.readFile(file, 'utf8') },
    ])));
    const solcInput = {
        language: "Solidity",
        sources: sources,
        settings: { ...solcSettings, outputSelection: exports.outputSelection },
    };
    const solcOutput = solc.compile(solcInput);
    const { errors: allErrors } = solcOutput;
    if (allErrors && allErrors.some(e => e.severity === 'error')) {
        const errors = allErrors.filter(e => e.severity === 'error');
        const firstError = errors[0].formattedMessage;
        const moreErrors = errors.length === 1 ? '' : ` (And ${errors.length - 1} other errors...)`;
        throw new Error(`Solidity was unable to compile. ${firstError}${moreErrors}`);
    }
    return solcOutput;
}
exports.compile = compile;
class SolcAdapter {
    constructor(solc) {
        this.solc = solc;
    }
    static async require(solcModule) {
        const solc = await Promise.resolve().then(() => __importStar(require(solcModule)));
        return new SolcAdapter(solc);
    }
    compile(input) {
        const inputJSON = JSON.stringify(input);
        const solcOutputString = semver_1.default.satisfies(this.solc.version(), '>=0.6')
            ? this.solc.compile(inputJSON, { import: importCallback })
            : this.solc.compileStandardWrapper(inputJSON, importCallback);
        const solcOutput = JSON.parse(solcOutputString);
        if (semver_1.default.satisfies(this.solc.version(), '^0.4')) {
            for (const source of Object.values(solcOutput.sources)) {
                for (const fileNode of source.ast.nodes) {
                    if (fileNode.nodeType === 'ContractDefinition') {
                        for (const contractNode of fileNode.nodes) {
                            if (contractNode.nodeType === 'FunctionDefinition') {
                                if (contractNode.isConstructor) {
                                    contractNode.kind = 'constructor';
                                }
                                else if (contractNode.name === '') {
                                    contractNode.kind = 'fallback';
                                }
                                else {
                                    contractNode.kind = 'function';
                                }
                            }
                        }
                    }
                }
            }
            ;
        }
        const reader = new ASTReader(input, solcOutput);
        const adaptDocumentation = (node) => {
            var _a;
            if (typeof node.documentation === 'string') {
                // fix solc buggy parsing of doc comments
                // reverse engineered from solc behavior...
                node.documentation = cleanUpDocstringFromSolc(node.documentation);
            }
            else if (((_a = node.documentation) === null || _a === void 0 ? void 0 : _a.text) !== undefined) {
                const source = reader.read(node.documentation);
                if (source !== undefined) {
                    node.documentation = cleanUpDocstringFromSource(source);
                }
                else {
                    node.documentation = cleanUpDocstringFromSolc(node.documentation.text);
                }
            }
        };
        for (const source of Object.values(solcOutput.sources)) {
            for (const fileNode of source.ast.nodes) {
                adaptDocumentation(fileNode);
                if (fileNode.nodeType === 'ContractDefinition') {
                    for (const contractNode of fileNode.nodes) {
                        adaptDocumentation(contractNode);
                    }
                }
            }
        }
        return solcOutput;
    }
}
exports.SolcAdapter = SolcAdapter;
function importCallback(path) {
    try {
        const resolved = require.resolve(path, { paths: ['.'] });
        return {
            contents: fs_1.default.readFileSync(resolved, 'utf8'),
        };
    }
    catch (e) {
        return {
            error: e.message,
        };
    }
}
class ASTReader {
    constructor(input, output) {
        this.input = input;
        this.output = output;
    }
    read(node) {
        var _a;
        const { source, start, length } = this.decodeSrc(node.src);
        return (_a = this.input.sources[source]) === null || _a === void 0 ? void 0 : _a.content.slice(start, start + length);
    }
    decodeSrc(src) {
        const [start, length, sourceId] = src.split(':').map(s => parseInt(s));
        const source = Object.keys(this.output.sources).find(s => this.output.sources[s].id === sourceId);
        if (source === undefined) {
            throw new Error(`No source with id ${sourceId}`);
        }
        return { source, start, length };
    }
}
function cleanUpDocstringFromSolc(text) {
    // fix solc buggy parsing of doc comments
    // reverse engineered from solc behavior
    return text
        .replace(/\n\n?^[ \t]*(?:\*|\/\/\/)/mg, '\n\n')
        .replace(/^[ \t]?/mg, '');
}
function cleanUpDocstringFromSource(text) {
    return text
        .replace(/^\/\*\*(.*)\*\/$/s, '$1')
        .trim()
        .replace(/^[ \t]*(\*|\/\/\/)[ \t]?/mg, '');
}
//# sourceMappingURL=solc.js.map

<|start_filename|>backend/Dockerfile<|end_filename|>
FROM tiangolo/uvicorn-gunicorn:python3.8-alpine3.10
RUN apk add --update build-base git
COPY requirements.txt ./requirements.txt
RUN pip install -r requirements.txt
RUN git clone https://github.com/eouti/covalent_py
RUN cd covalent_py/ && python setup.py build && python setup.py install
COPY ./app /app

<|start_filename|>frontend/src/router/index.js<|end_filename|>
import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from '../views/Home.vue'
import Badges from '../views/Badges.vue'
import Community from '../views/Community.vue'
import BadgeFactory from '../views/BadgeFactory.vue'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    name: 'Home',
    component: Home
  },
  {
    path: '/badges',
    name: 'Badges',
    component: Badges
  },
  {
    path: '/community',
    name: 'Community',
    component: Community
  },
  {
    path: '/badge-factory',
    name: 'Badge Factory',
    component: BadgeFactory
  }
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router


<|start_filename|>contracts/scripts/badgedefinition_example.js<|end_filename|>
// scripts/badgedefinition_example.js
module.exports = async function main(callback) {
    try {
      // Retrieve accounts from the local node
      const accounts = await web3.eth.getAccounts();
      console.log(accounts)
      let creator_address = accounts[0];
      let receiver_address = accounts[1];
      let token_number = Math.ceil(Math.random() * 10000);
      let token_number2 = Math.ceil(Math.random() * 10000);
      console.log("The 1st BadgeDefinition will be called definition#" + token_number + " (will be claimed)");
      console.log("The 2nd BadgeDefinition will be called definition#" + token_number2 + " (will be droped)");

      // Set up a Truffle contract, representing our deployed BadgeDefinitionFactory instance
      const BadgeDefinitionFactory = artifacts.require("BadgeDefinitionFactory");
      const badgeDefinitionFactory = await BadgeDefinitionFactory.deployed();

      // Call the createBadgeDefinition function of the deployed BadgeDefinitionFactory contract
      // (badge 1 - BadgeToken NOT transferrable)
      await badgeDefinitionFactory.createBadgeDefinition("definition#" + token_number, "this is the definition#" + token_number, ["a tag", "another tag"], "i.redd.it/rq36kl1xjxr01.png", false);

      await badgeDefinitionFactory.getPastEvents( 'Transfer', { fromBlock: 'latest', toBlock: 'latest' } )
      .then(function(events){
          badgeId = events[0]["returnValues"]["tokenId"];
      });
      console.log("createBadgeDefinition: The new BadgeDefinitionId for badge definition#" + token_number, "is", badgeId.toString());

      // (badge 2 - BadgeToken transferrable)
      await badgeDefinitionFactory.createBadgeDefinition("definition#" + token_number2, "this is the definition#" + token_number2, ["a tag", "another tag"], "i.redd.it/rq36kl1xjxr01.png", true);
      
      await badgeDefinitionFactory.getPastEvents( 'Transfer', { fromBlock: 'latest', toBlock: 'latest' } )
      .then(function(events){
          badgeId2 = events[0]["returnValues"]["tokenId"];
      });
      console.log("createBadgeDefinition: The new BadgeDefinitionId for badge definition#" + token_number2, "is", badgeId2.toString());

      // Call the addBadgeAttributionCondition function of the deployed BadgeDefinitionFactory contract
      let query = "{ swaps(orderBy: timestamp, where: { to: " + creator_address + " }) { id transaction { id timestamp } pair { token0 { symbol } token1 { symbol } } to sender } }";
      let operator = ">=";
      let condition = "50";

      // (badge 1 - 2 conditions)
      await badgeDefinitionFactory.addBadgeAttributionCondition(badgeId, "condition1 of definition#" + token_number, "thegraph", "uniswap", query, operator, condition);
      await badgeDefinitionFactory.addBadgeAttributionCondition(badgeId, "condition2 of definition#" + token_number, "thegraph", "uniswap", query, operator, condition);

      // (badge 2 - 1 condition)
      await badgeDefinitionFactory.addBadgeAttributionCondition(badgeId2, "condition1 of definition#" + token_number2, "thegraph", "uniswap", query, operator, condition);

      // Call the publishBadgeDefinition function of the deployed BadgeDefinitionFactory contract
      // (badge 1)
      await badgeDefinitionFactory.publishBadgeDefinition(badgeId);

      // (badge 2)
      await badgeDefinitionFactory.publishBadgeDefinition(badgeId2);

      // Call the getBadgeDefinitionAttributionCondition function of the deployed BadgeDefinitionFactory contract
      // (badge 1)
      value = await badgeDefinitionFactory.getBadgeDefinitionAttributionCondition(badgeId);
      console.log("getBadgeDefinitionAttributionCondition: The BadgeDefinitionId", badgeId, "has got", value[0].toString(), "condition(s)");
      console.log(value[1]);

      // Call the isBadgeTransferable function of the deployed BadgeDefinitionFactory contract
      // (badge 1)
      value = await badgeDefinitionFactory.isBadgeTransferable(badgeId);
      console.log("isBadgeTransferable: Are the badges produced using the BadgeDefinitionId", badgeId, "transferrable?", value.toString());

      // (badge 2)
      value = await badgeDefinitionFactory.isBadgeTransferable(badgeId2);
      console.log("isBadgeTransferable: Are the badges produced using the BadgeDefinitionId", badgeId2, "transferrable?", value.toString());

      // ERC721 functions
      //function balanceOf(address owner) public view returns (uint256)
      // (creator_address)
      value = await badgeDefinitionFactory.balanceOf(creator_address);
      console.log("balanceOf: The account", creator_address, "has got", value.toString(), "badge(s)");

      // (receiver_address)
      value = await badgeDefinitionFactory.balanceOf(receiver_address);
      console.log("balanceOf: The account", receiver_address, "has got", value.toString(), "badge(s)");

      //function ownerOf(uint256 tokenId) public view returns (address)
      // (badge 1)
      value = await badgeDefinitionFactory.ownerOf(badgeId);
      console.log("ownerOf: The owner of the badge", badgeId.toString(), "is the account", value.toString());

      // (badge 2)
      value = await badgeDefinitionFactory.ownerOf(badgeId2);
      console.log("ownerOf: The owner of the badge", badgeId2.toString(), "is the account", value.toString());

      //function name() public view returns (string memory) 
      value = await badgeDefinitionFactory.name();
      console.log("name: The name of the contract is", value);

      //function symbol() public view returns (string memory)
      value = await badgeDefinitionFactory.symbol();
      console.log("symbol: The symbol of the badges of the contract is", value);

      //function tokenURI(uint256 tokenId) public view returns (string memory)
      value = await badgeDefinitionFactory.tokenURI(badgeId);
      console.log("tokenURI: The URI associated with the badge", badgeId.toString(), "is", value.toString());

      //function approve(address to, uint256 tokenId) public
      await badgeDefinitionFactory.approve(receiver_address, badgeId);
      console.log("approve: There is an attempt for the account", receiver_address, "to be approved to claim the badge", badgeId.toString());

      //function getApproved(uint256 tokenId) public view returns (address)
      value = await badgeDefinitionFactory.getApproved(badgeId);
      console.log("getApproved: The account", value.toString(), "has been approved to claim the badge", badgeId.toString());

      //function setApprovalForAll(address operator, bool approved) public

      //function isApprovedForAll(address owner, address operator) public view virtual override returns (bool)

      //function transferFrom(address from, address to, uint256 tokenId) public virtual override
      // (badge 1)
      await badgeDefinitionFactory.transferFrom(creator_address, receiver_address, badgeId, {from: receiver_address});
      console.log("transferFrom: The badge", badgeId.toString(), "has been claimed by the account", receiver_address);

      // (badge 2)
      await badgeDefinitionFactory.transferFrom(creator_address, receiver_address, badgeId2);
      console.log("transferFrom: The badge", badgeId2.toString(), "has been drop by the account", creator_address, "to the account", receiver_address);

      //CHECK
      //function balanceOf(address owner) public view returns (uint256)
      // (creator_address)
      total1 = await badgeDefinitionFactory.balanceOf(creator_address);
      console.log("balanceOf: The account", creator_address, "has got", total1.toString(), "badge(s)");

      // (receiver_address)
      total2 = await badgeDefinitionFactory.balanceOf(receiver_address);
      console.log("balanceOf: The account", receiver_address, "has got", total2.toString(), "badge(s)");

      //CHECK
      //function ownerOf(uint256 tokenId) public view returns (address)
      // (badge 1)
      value = await badgeDefinitionFactory.ownerOf(badgeId);
      console.log("ownerOf: The owner of the badge", badgeId.toString(), "is the account", value.toString());

      // (badge 2)
      value = await badgeDefinitionFactory.ownerOf(badgeId2);
      console.log("ownerOf: The owner of the badge", badgeId2.toString(), "is the account", value.toString());

      //function safeTransferFrom(address from, address to, uint256 tokenId) public virtual override

      //function safeTransferFrom(address from, address to, uint256 tokenId, bytes memory _data) public virtual override

      // ERC721Enumerable functions
      //function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165, ERC721) returns (bool)
      //ERC721
      value = await badgeDefinitionFactory.supportsInterface('0x80ac58cd');
      console.log("supportsInterface: Does the contract support IERC721?", value.toString());

      //function tokenOfOwnerByIndex(address owner, uint256 index) public view virtual override returns (uint256)
      // (badge 1)
      for(i = 0; i < total1; i++){
        value = await badgeDefinitionFactory.tokenOfOwnerByIndex(creator_address, i);
        console.log("tokenOfOwnerByIndex: The badge own by", creator_address, "at the index", i.toString(), "is", value.toString())
      } 

      // (badge 2)
      for(i = 0; i < total2; i++){
        value = await badgeDefinitionFactory.tokenOfOwnerByIndex(receiver_address, i);
        console.log("tokenOfOwnerByIndex: The badge own by", receiver_address, "at the index", i.toString(), "is", value.toString())
      } 

      //function totalSupply() public view virtual override returns (uint256)
      amount = await badgeDefinitionFactory.totalSupply();
      console.log("totalSupply: The total amount of badges is", amount.toString());

      //function tokenByIndex(uint256 index) public view virtual override returns (uint256)
      for(i = 0; i < amount; i++){
        value = await badgeDefinitionFactory.tokenByIndex(i);
        console.log("tokenByIndex: The badge at the index", i.toString(), "is", value.toString());
      }

      callback(0);
    } catch (error) {
      console.error(error);
      callback(1);
    }
  }

<|start_filename|>contracts/scripts/badgetoken_example.js<|end_filename|>
// scripts/index2.js
// var bigInt = require("big-integer");

module.exports = async function main(callback) {
  try {
    // Retrieve accounts from the local node
    const accounts = await web3.eth.getAccounts();
    console.log(accounts)
    let owner_address = accounts[8];
    let owner2_address = accounts[9];
    let badgeId = 0;
    let badgeId2 = 1;
    let token_number = Math.ceil(Math.random() * 10000);
    let token_number2 = Math.ceil(Math.random() * 10000);
    console.log("The 1st BadgeToken will be called token#" + token_number + "(will be user-bind)");
    console.log("The 2nd BadgeToken will be called token#" + token_number2 + "(will be transferrable)");

    // Set up a Truffle contract, representing our deployed BadgeTokenFactory instance
    const BadgeTokenFactory = artifacts.require("BadgeTokenFactory");
    const badgeTokenFactory = await BadgeTokenFactory.deployed();

    // Call the requestBadgeTokenMinting function of the deployed BadgeTokenFactory contract
    // (badge 1 - BadgeToken NOT transferrable)
    await badgeTokenFactory.requestBadgeTokenMinting(badgeId, {from: owner_address});
    console.log("requestBadgeTokenMinting: The user", owner_address, "ask to mint a token with BadgeDefinitionId", badgeId);
    await badgeTokenFactory.getPastEvents( 'QueryRequest', { fromBlock: 'latest', toBlock: 'latest' } )
    .then(function(events){
        // lastBlock = events;
        // requestID1_1 = web3.utils.hexToAscii(events[0]["returnValues"]["_requestID"]);
        // requestID1_2 = web3.utils.hexToAscii(events[1]["returnValues"]["_requestID"]);
        requestID1_1 = events[0]["returnValues"]["_requestID"];
        requestID1_2 = events[1]["returnValues"]["_requestID"];
    });

    // console.log("requestBadgeTokenMinting: last block is", lastBlock);
    console.log("requestBadgeTokenMinting: The query with ID", requestID1_1, "has been requested to be run");
    console.log("requestBadgeTokenMinting: The query with ID", requestID1_2, "has been requested to be run");
  
    // (badge 2 - BadgeToken transferrable)
    await badgeTokenFactory.requestBadgeTokenMinting(badgeId2, {from: owner2_address});
    console.log("requestBadgeTokenMinting: The user", owner2_address, "ask to mint a token with BadgeDefinitionId", badgeId2);
    
    await badgeTokenFactory.getPastEvents( 'QueryRequest', { fromBlock: 'latest', toBlock: 'latest' } )
    .then(function(events){
        // requestID2_1 = web3.utils.hexToAscii(events[0]["returnValues"]["_requestID"]);
        requestID2_1 = events[0]["returnValues"]["_requestID"];
    });
    console.log("requestBadgeTokenMinting: The query with ID", requestID2_1, "has been requested to be run");

    // Call the updateBadgeTokenMinting function of the deployed BadgeTokenFactory contract
    // (badge 1 - BadgeToken NOT transferrable)
    await badgeTokenFactory.updateBadgeTokenMinting(requestID1_1, "51", {from: owner_address});
    // let random = web3.utils.randomHex(32);
    // console.log("lol:", random);
    // await badgeTokenFactory.updateBadgeTokenMinting(random, "51", {from: owner_address});

    await badgeTokenFactory.getPastEvents( 'QueryResultReceived', { fromBlock: 'latest', toBlock: 'latest' } )
    .then(function(events){
        // lastBlock = events;
        // console.log("updateBadgeTokenMinting: last block is", lastBlock);
        queryResult1_1 = events[0]["returnValues"]["_queryResult"];
    }); 
    console.log("updateBadgeTokenMinting: The new result of the query", requestID1_1, "is", queryResult1_1);

    await badgeTokenFactory.updateBadgeTokenMinting(requestID1_2, "52", {from: owner_address});

    await badgeTokenFactory.getPastEvents( 'QueryResultReceived', { fromBlock: 'latest', toBlock: 'latest' } )
    .then(function(events){
        queryResult1_2 = events[0]["returnValues"]["_queryResult"];
    }); 
    console.log("updateBadgeTokenMinting: The new result of the query", requestID1_2, "is", queryResult1_2);

    // (badge 2 - BadgeToken transferrable)
    await badgeTokenFactory.updateBadgeTokenMinting(requestID2_1, "55", {from: owner2_address});
    
    await badgeTokenFactory.getPastEvents( 'QueryResultReceived', { fromBlock: 'latest', toBlock: 'latest' } )
    .then(function(events){
        queryResult2_1 = events[0]["returnValues"]["_queryResult"];
    });
    console.log("updateBadgeTokenMinting: The new result of the query", requestID2_1, "is", queryResult2_1);

    // Call the mintBadgeToken function of the deployed BadgeTokenFactory contract
    // (badge 1 - BadgeToken NOT transferrable)
    await badgeTokenFactory.mintBadgeToken(badgeId, {from: owner_address});

    await badgeTokenFactory.getPastEvents( 'Transfer', { fromBlock: 'latest', toBlock: 'latest' } )
    .then(function(events){
        tokenId = events[0]["returnValues"]["tokenId"];
    }); 
    console.log("mintBadgeToken: The new BadgeTokenId for badge token#" + token_number, "is", tokenId.toString());

    // (badge 2 - BadgeToken transferrable)
    await badgeTokenFactory.mintBadgeToken(badgeId2, {from: owner2_address});
    
    await badgeTokenFactory.getPastEvents( 'Transfer', { fromBlock: 'latest', toBlock: 'latest' } )
    .then(function(events){
        tokenId2 = events[0]["returnValues"]["tokenId"];
    });
    console.log("mintBadgeToken: The new BadgeTokenId for badge token#" + token_number2, "is", tokenId2.toString());

    // Call the doesOwnBadgeFromGivenDefinition function of the deployed BadgeTokenFactory contract
    // (owner_address)
    value = await badgeTokenFactory.doesOwnBadgeFromGivenDefinition(owner_address, badgeId);
    console.log("doesOwnBadgeFromGivenDefinition: Does the user", owner_address,"has a BadgeToken produced using BadgeDefinitionId", badgeId, "?", value.toString());
    value = await badgeTokenFactory.doesOwnBadgeFromGivenDefinition(owner_address, badgeId2);
    console.log("doesOwnBadgeFromGivenDefinition: Does the user", owner_address,"has a BadgeToken produced using BadgeDefinitionId", badgeId2, "?", value.toString());

    // (owner2_address)
    value = await badgeTokenFactory.doesOwnBadgeFromGivenDefinition(owner2_address, badgeId);
    console.log("doesOwnBadgeFromGivenDefinition: Does the user", owner2_address,"has a BadgeToken produced using BadgeDefinitionId", badgeId, "?", value.toString());
    value = await badgeTokenFactory.doesOwnBadgeFromGivenDefinition(owner2_address, badgeId2);
    console.log("doesOwnBadgeFromGivenDefinition: Does the user", owner2_address,"has a BadgeToken produced using BadgeDefinitionId", badgeId2, "?", value.toString());

    // ERC721 functions
    //function balanceOf(address owner) public view returns (uint256)
    // (owner_address)
    value = await badgeTokenFactory.balanceOf(owner_address);
    console.log("balanceOf: The account", owner_address, "has got", value.toString(), "badge(s)");

    // (owner2_address)
    value = await badgeTokenFactory.balanceOf(owner2_address);
    console.log("balanceOf: The account", owner2_address, "has got", value.toString(), "badge(s)");

    //function ownerOf(uint256 tokenId) public view returns (address)
    // (badge 1)
    value = await badgeTokenFactory.ownerOf(tokenId);
    console.log("ownerOf: The owner of the badge", tokenId.toString(), "is the account", value.toString());

    // (badge 2)
    value = await badgeTokenFactory.ownerOf(tokenId2);
    console.log("ownerOf: The owner of the badge", tokenId2.toString(), "is the account", value.toString());

    //function name() public view returns (string memory) 
    value = await badgeTokenFactory.name();
    console.log("name: The name of the contract is", value);

    //function symbol() public view returns (string memory)
    value = await badgeTokenFactory.symbol();
    console.log("symbol: The symbol of the badges of the contract is", value);

    //function tokenURI(uint256 tokenId) public view returns (string memory)
    value = await badgeTokenFactory.tokenURI(tokenId);
    console.log("tokenURI: The URI associated with the badge", tokenId.toString(), "is", value.toString());

    //function approve(address to, uint256 tokenId) public

    //function getApproved(uint256 tokenId) public view returns (address)
 
    //function setApprovalForAll(address operator, bool approved) public

    //function isApprovedForAll(address owner, address operator) public view virtual override returns (bool)

    //function transferFrom(address from, address to, uint256 tokenId) public virtual override
    // (badge 1)

    // (badge 2)
    await badgeTokenFactory.transferFrom(owner2_address, owner_address, tokenId2, {from: owner2_address});
    console.log("transferFrom: The badge", tokenId2.toString(), "has been transferred by the account", owner2_address, "to the account", owner_address);

    //CHECK
    //function balanceOf(address owner) public view returns (uint256)
    // (owner_address)
    total1 = await badgeTokenFactory.balanceOf(owner_address);
    console.log("balanceOf: The account", owner_address, "has got", total1.toString(), "badge(s)");

    // (owner2_address)
    total2 = await badgeTokenFactory.balanceOf(owner2_address);
    console.log("balanceOf: The account", owner2_address, "has got", total2.toString(), "badge(s)");

    //function ownerOf(uint256 tokenId) public view returns (address)
    // (badge 1)
    value = await badgeTokenFactory.ownerOf(tokenId);
    console.log("ownerOf: The owner of the badge", tokenId.toString(), "is the account", value.toString());

    // (badge 2)
    value = await badgeTokenFactory.ownerOf(tokenId2);
    console.log("ownerOf: The owner of the badge", tokenId2.toString(), "is the account", value.toString());

    //function safeTransferFrom(address from, address to, uint256 tokenId) public virtual override

    //function safeTransferFrom(address from, address to, uint256 tokenId, bytes memory _data) public virtual override

    // ERC721Enumerable functions
    //function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165, ERC721) returns (bool)
    //ERC721
    value = await badgeTokenFactory.supportsInterface('0x80ac58cd');
    console.log("supportsInterface: Does the contract support IERC721?", value.toString());

    //function tokenOfOwnerByIndex(address owner, uint256 index) public view virtual override returns (uint256)
    // (badge 1)
    for(i = 0; i < total1; i++){
      value = await badgeTokenFactory.tokenOfOwnerByIndex(owner_address, i);
      console.log("tokenOfOwnerByIndex: The badge own by", owner_address, "at the index", i.toString(), "is", value.toString())
    } 

    // (badge 2)
    for(i = 0; i < total2; i++){
      value = await badgeTokenFactory.tokenOfOwnerByIndex(owner2_address, i);
      console.log("tokenOfOwnerByIndex: The badge own by", owner2_address, "at the index", i.toString(), "is", value.toString())
    } 

    //function totalSupply() public view virtual override returns (uint256)
    amount = await badgeTokenFactory.totalSupply();
    console.log("totalSupply: The total amount of badges is", amount.toString());

    //function tokenByIndex(uint256 index) public view virtual override returns (uint256)
    for(i = 0; i < amount; i++){
      value = await badgeTokenFactory.tokenByIndex(i);
      console.log("tokenByIndex: The badge at the index", i.toString(), "is", value.toString());
    }

    callback(0);
  } catch (error) {
    console.error(error);
    callback(1);
  }
}

<|start_filename|>contracts/node_modules/solidity-docgen/dist/solc.test.js<|end_filename|>
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const ava_1 = __importDefault(require("ava"));
const solc_1 = require("./solc");
const solc_fork_1 = require("./solc-fork");
async function smokeTest(t, solcModule, version) {
    const input = {
        language: 'Solidity',
        sources: {
            test: {
                content: `// SPDX-License-Identifier: MIT\npragma solidity ^${version}; contract Foo { }`,
            },
        },
        settings: {
            outputSelection: solc_1.outputSelection,
        },
    };
    const output = await solc_fork_1.solcCompile(solcModule, input);
    t.is('object', typeof output);
    t.is(undefined, output.errors);
}
ava_1.default('smoke test 0.8', async (t) => {
    await smokeTest(t, 'solc-0-8', '0.8');
});
ava_1.default('smoke test 0.7', async (t) => {
    await smokeTest(t, 'solc-0-7', '0.7');
});
ava_1.default('smoke test 0.6', async (t) => {
    await smokeTest(t, 'solc', '0.6');
});
ava_1.default('smoke test 0.5', async (t) => {
    await smokeTest(t, 'solc-0-5', '0.5');
});
ava_1.default('smoke test 0.4', async (t) => {
    await smokeTest(t, 'solc-0-4', '0.4');
});
//# sourceMappingURL=solc.test.js.map

<|start_filename|>contracts/node_modules/solidity-docgen/dist/source.test.js<|end_filename|>
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const ava_1 = __importDefault(require("ava"));
const solc_output_builder_1 = require("./solc-output-builder");
const source_1 = require("./source");
const solc_1 = require("./solc");
const solc_fork_1 = require("./solc-fork");
function buildSource(solcOutput) {
    return new source_1.Source('', solcOutput, c => c.name);
}
ava_1.default('no files', t => {
    const solcOutput = new solc_output_builder_1.SolcOutputBuilder();
    const source = buildSource(solcOutput);
    t.is(source.files.length, 0);
    t.is(source.contracts.length, 0);
});
ava_1.default('one empty file', t => {
    const solcOutput = new solc_output_builder_1.SolcOutputBuilder()
        .file('Foo.sol');
    const source = buildSource(solcOutput);
    t.is(source.files.length, 1);
});
ava_1.default('one contract', t => {
    const solcOutput = new solc_output_builder_1.SolcOutputBuilder()
        .file('Foo.sol')
        .contract('Foo');
    const source = buildSource(solcOutput);
    t.is(source.contracts.length, 1);
});
ava_1.default('one own function', t => {
    const solcOutput = new solc_output_builder_1.SolcOutputBuilder()
        .file('Foo.sol')
        .contract('Foo')
        .function('test');
    const source = buildSource(solcOutput);
    const foo = source.contracts[0];
    t.is(foo.functions.length, 1);
});
ava_1.default('one inherited function', t => {
    const solcOutput = new solc_output_builder_1.SolcOutputBuilder()
        .file('Foo.sol')
        .contract('Foo')
        .function('test')
        .contract('Bar', 'Foo');
    const source = buildSource(solcOutput);
    const bar = source.contracts[1];
    t.is(bar.functions.length, 1);
});
ava_1.default('one multiply inherited function', t => {
    const solcOutput = new solc_output_builder_1.SolcOutputBuilder()
        .file('Foo.sol')
        .contract('Foo')
        .function('test')
        .contract('FooFlavor')
        .function('test')
        .contract('Bar', 'Foo', 'FooFlavor');
    const source = buildSource(solcOutput);
    const bar = source.contracts[2];
    t.is(bar.name, 'Bar');
    t.is(bar.functions.length, 1);
});
ava_1.default('two inherited functions with name overloading', t => {
    const solcOutput = new solc_output_builder_1.SolcOutputBuilder()
        .file('Foo.sol')
        .contract('Foo')
        .function('test', 'uint256')
        .function('test', 'string')
        .contract('FooFlavor', 'Foo');
    const source = buildSource(solcOutput);
    const foof = source.contracts[1];
    t.is(foof.functions.length, 2);
});
ava_1.default('grouped inherited items', t => {
    const solcOutput = new solc_output_builder_1.SolcOutputBuilder()
        .file('Foo.sol')
        .contract('Foo')
        .function('foo-test')
        .contract('Bar')
        .function('bar-test')
        .contract('Child', 'Foo', 'Bar');
    const source = buildSource(solcOutput);
    const child = source.contracts[2];
    t.is(child.name, 'Child');
    const items = child.inheritedItems;
    t.is(items.length, 3);
    t.is(items[1].contract.name, 'Foo');
    t.is(items[1].functions[0].name, 'foo-test');
});
ava_1.default('two inherited constructors', t => {
    const solcOutput = new solc_output_builder_1.SolcOutputBuilder()
        .file('Foo.sol')
        .contract('Foo')
        .function('constructor', 'uint256')
        .contract('FooFlavor', 'Foo')
        .function('constructor', 'string');
    const source = buildSource(solcOutput);
    const foof = source.contracts[1];
    t.is(foof.name, 'FooFlavor');
    t.is(foof.functions.length, 1);
});
ava_1.default('a state variable', t => {
    const solcOutput = new solc_output_builder_1.SolcOutputBuilder()
        .file('Foo.sol')
        .contract('Foo')
        .variable('x', 'uint256');
    const source = buildSource(solcOutput);
    const foo = source.contracts[0];
    t.is(foo.variables.length, 1);
    const variable = foo.variables[0];
    t.is(variable.name, 'x');
    t.is(variable.type, 'uint256');
});
ava_1.default('an inherited state variable', t => {
    const solcOutput = new solc_output_builder_1.SolcOutputBuilder()
        .file('Foo.sol')
        .contract('Foo')
        .variable('x', 'uint256')
        .contract('Bar', 'Foo')
        .variable('y', 'uint256');
    const source = buildSource(solcOutput);
    const foo = source.contracts[1];
    t.is(foo.name, 'Bar');
    t.is(foo.variables.length, 2);
    const variable = foo.variables[1];
    t.is(variable.name, 'x');
    t.is(variable.type, 'uint256');
});
ava_1.default('contracts in scope from imported files', t => {
    const solcOutput = new solc_output_builder_1.SolcOutputBuilder()
        .file('Foo.sol')
        .contract('Foo')
        .file('Bar.sol')
        .import('Foo.sol')
        .contract('Bar');
    const source = buildSource(solcOutput);
    const bar = source.file('Bar.sol');
    const scope = bar.contractsInScope;
    t.like(scope, {
        Foo: { name: 'Foo' },
        Bar: { name: 'Bar' },
    });
});
ava_1.default('contracts in scope from imported files with alias', t => {
    const solcOutput = new solc_output_builder_1.SolcOutputBuilder()
        .file('Foo.sol')
        .contract('Foo')
        .file('Bar.sol')
        .import('Foo.sol', [['Foo', 'FooRenamed']])
        .contract('Bar');
    const source = buildSource(solcOutput);
    const bar = source.file('Bar.sol');
    const scope = bar.contractsInScope;
    t.like(scope, {
        FooRenamed: { name: 'Foo' },
        Bar: { name: 'Bar' },
    });
});
ava_1.default('contracts in scope from imported files transitively', t => {
    const solcOutput = new solc_output_builder_1.SolcOutputBuilder()
        .file('Foo.sol')
        .contract('Foo')
        .file('Bar.sol')
        .import('Foo.sol')
        .contract('Bar')
        .file('Baz.sol')
        .import('Bar.sol')
        .contract('Baz');
    const source = buildSource(solcOutput);
    const baz = source.file('Baz.sol');
    const scope = baz.contractsInScope;
    t.like(scope, {
        Foo: { name: 'Foo' },
        Bar: { name: 'Bar' },
        Baz: { name: 'Baz' },
    });
});
ava_1.default('using real compiler output (0.6)', async (t) => {
    const sourceText = `// SPDX-License-Identifier: MIT
    pragma solidity ^0.6;
    contract Foo {
      uint public x;
      /**
       * @dev docs
       */
      function fun(uint a) public pure returns (uint r) { return a; }
      event Ev(uint a);
      modifier mod(uint a) { _; }
      receive() external payable {}
    }
  `;
    const solcOutput = await solc_fork_1.solcCompile('solc', {
        language: 'Solidity',
        sources: {
            test: {
                content: sourceText,
            },
        },
        settings: {
            outputSelection: solc_1.outputSelection,
        },
    });
    t.is('object', typeof solcOutput);
    t.is(undefined, solcOutput.errors);
    const getName = (x) => x.name;
    const source = buildSource(solcOutput);
    t.deepEqual(['Foo'], source.contracts.map(getName));
    const foo = source.contracts[0];
    t.deepEqual(['x'], foo.variables.map(getName));
    t.deepEqual(['fun', 'receive'], foo.functions.map(getName));
    t.deepEqual(['mod'], foo.modifiers.map(getName));
    t.deepEqual(['Ev'], foo.events.map(getName));
    const fun = foo.functions[0];
    t.is('public', fun.visibility);
    t.deepEqual(['uint256 a'], Array.from(fun.args, a => a.toString()));
    t.deepEqual(['uint256 r'], Array.from(fun.outputs, a => a.toString()));
    t.is('docs', fun.natspec.devdoc);
    const mod = foo.functions[0];
    t.deepEqual(['uint256 a'], Array.from(mod.args, a => a.toString()));
});
//# sourceMappingURL=source.test.js.map

<|start_filename|>frontend/src/plugins/vuetify.js<|end_filename|>
import Vue from 'vue';
import Vuetify from 'vuetify/lib/framework';

import colors from 'vuetify/lib/util/colors'

Vue.use(Vuetify);

export default new Vuetify({
    theme: {
        themes: {
          light: {
            primary: colors.grey.darken3,
            secondary: colors.grey.darken1,
            accent: colors.shades.black,
            error: colors.red.accent3,
            background: colors.indigo.lighten5,
          },
          dark: {
            primary: colors.blue.lighten3, 
            background: colors.indigo.base,
          },
        },
      },
    })


<|start_filename|>contracts/scripts/badgequeryoracle_example.js<|end_filename|>
// scripts/index2.js
module.exports = async function main(callback) {
  try {
    // Retrieve accounts from the local node
    const accounts = await web3.eth.getAccounts();
    console.log(accounts)

    // Set up a Truffle contract, representing our deployed BadgeTokenFactory instance
    const BadgeQueryOracle = artifacts.require("BadgeQueryOracle");
    const badgeQueryOracle = await BadgeQueryOracle.deployed();

    //function owner() public view virtual returns (address)
    value = await badgeQueryOracle.owner();
    console.log("owner: The owner of the BadgeQueryOracle is the account", value.toString());

    value = await badgeQueryOracle.runQuery();
    console.log("lol?", value.toString());

    callback(0);
  } catch (error) {
    console.error(error);
    callback(1);
  }
}

<|start_filename|>contracts/node_modules/solidity-docgen/dist/cli.test.js<|end_filename|>
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const ava_1 = __importDefault(require("ava"));
const fs_1 = __importDefault(require("promisified/fs"));
const child_process_1 = __importDefault(require("child_process"));
const events_1 = __importDefault(require("events"));
for (const f of fs_1.default.readdirSync('fixtures')) {
    testFixture(f);
}
function testFixture(num) {
    ava_1.default(`fixture ${num}`, async (t) => {
        await cleanFixtureOutput(num);
        const templates = await fs_1.default.access(`fixtures/${num}/templates`, fs_1.default.constants.F_OK)
            .then(() => ['--templates', `fixtures/${num}/templates`], () => []);
        const helpers = await fs_1.default.access(`fixtures/${num}/helpers.js`, fs_1.default.constants.F_OK)
            .then(() => ['--helpers', `fixtures/${num}/helpers.js`], () => []);
        const solc = await fs_1.default.access(`fixtures/${num}/solc`, fs_1.default.constants.F_OK)
            .then(async () => ['--solc-module', (await fs_1.default.readFile(`fixtures/${num}/solc`, 'utf8')).trim()], () => []);
        const child = child_process_1.default.fork(require.resolve('./cli'), [
            '--input', `fixtures/${num}/input`,
            '--output', `fixtures/${num}/output`,
            ...templates,
            ...helpers,
            ...solc,
            '--output-structure', 'single',
        ]);
        await events_1.default.once(child, 'exit');
        const output = await fs_1.default.readFile(`fixtures/${num}/output/index.md`, 'utf8');
        t.snapshot(output);
    });
}
async function cleanFixtureOutput(num) {
    const outputPath = `fixtures/${num}/output`;
    try {
        await fs_1.default.access(outputPath);
    }
    catch (e) {
        return;
    }
    for (const e of await fs_1.default.readdir(`fixtures/${num}/output`)) {
        await fs_1.default.unlink(`fixtures/${num}/output/${e}`);
    }
    await fs_1.default.rmdir(`fixtures/${num}/output`);
}
//# sourceMappingURL=cli.test.js.map

<|start_filename|>contracts/node_modules/pure-rand/lib/esm/generator/XorShift.js<|end_filename|>
var XorShift128Plus = (function () {
    function XorShift128Plus(s01, s00, s11, s10) {
        this.s01 = s01;
        this.s00 = s00;
        this.s11 = s11;
        this.s10 = s10;
    }
    XorShift128Plus.prototype.min = function () {
        return -0x80000000;
    };
    XorShift128Plus.prototype.max = function () {
        return 0x7fffffff;
    };
    XorShift128Plus.prototype.next = function () {
        var nextRng = new XorShift128Plus(this.s01, this.s00, this.s11, this.s10);
        var out = nextRng.unsafeNext();
        return [out, nextRng];
    };
    XorShift128Plus.prototype.unsafeNext = function () {
        var a0 = this.s00 ^ (this.s00 << 23);
        var a1 = this.s01 ^ ((this.s01 << 23) | (this.s00 >>> 9));
        var b0 = a0 ^ this.s10 ^ ((a0 >>> 18) | (a1 << 14)) ^ ((this.s10 >>> 5) | (this.s11 << 27));
        var b1 = a1 ^ this.s11 ^ (a1 >>> 18) ^ (this.s11 >>> 5);
        var out = (this.s00 + this.s10) | 0;
        this.s01 = this.s11;
        this.s00 = this.s10;
        this.s11 = b1;
        this.s10 = b0;
        return out;
    };
    XorShift128Plus.prototype.jump = function () {
        var rngRunner = new XorShift128Plus(this.s01, this.s00, this.s11, this.s10);
        var ns01 = 0;
        var ns00 = 0;
        var ns11 = 0;
        var ns10 = 0;
        var jump = [0x635d2dff, 0x8a5cd789, 0x5c472f96, 0x121fd215];
        for (var i = 0; i !== 4; ++i) {
            for (var mask = 1; mask; mask <<= 1) {
                if (jump[i] & mask) {
                    ns01 ^= rngRunner.s01;
                    ns00 ^= rngRunner.s00;
                    ns11 ^= rngRunner.s11;
                    ns10 ^= rngRunner.s10;
                }
                rngRunner.unsafeNext();
            }
        }
        rngRunner.s01 = ns01;
        rngRunner.s00 = ns00;
        rngRunner.s11 = ns11;
        rngRunner.s10 = ns10;
        return rngRunner;
    };
    return XorShift128Plus;
}());
export var xorshift128plus = function (seed) {
    return new XorShift128Plus(-1, ~seed, seed | 0, 0);
};


<|start_filename|>contracts/node_modules/solidity-docgen/dist/docgen.js<|end_filename|>
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
    Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
    o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
    if (mod && mod.__esModule) return mod;
    var result = {};
    if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
    __setModuleDefault(result, mod);
    return result;
};
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.docgen = void 0;
const path_1 = __importDefault(require("path"));
const fs_1 = require("fs");
const handlebars = __importStar(require("./handlebars"));
const solc_1 = require("./solc");
const source_1 = require("./source");
const sitemap_1 = require("./sitemap");
const filter_1 = require("./filter");
async function docgen(options) {
    const filter = new filter_1.Filter(options.input, options.exclude);
    const solcOutput = await solc_1.compile(filter, options['solc-module'], options['solc-settings']);
    if (options.helpers) {
        handlebars.registerHelpers(await Promise.resolve().then(() => __importStar(require(options.helpers))));
    }
    const templates = await getTemplates(options.templates);
    const readmes = await getReadmes(filter);
    const source = new source_1.Source(options.input, solcOutput, templates.contract);
    const sitemap = sitemap_1.Sitemap.generate(source, filter, readmes, options.extension, options['output-structure']);
    for (const page of sitemap.pages) {
        const dest = path_1.default.join(options.output, page.path);
        await fs_1.promises.mkdir(path_1.default.dirname(dest), { recursive: true });
        await fs_1.promises.writeFile(dest, page.render(templates.prelude));
    }
}
exports.docgen = docgen;
async function getReadmes(filter) {
    const readmes = await filter.glob('README.*');
    return await Promise.all(readmes.map(async (readmePath) => ({
        path: path_1.default.relative(filter.root, readmePath),
        contents: await fs_1.promises.readFile(readmePath, 'utf8'),
    })));
}
async function getTemplates(directory) {
    if (directory === undefined) {
        directory = path_1.default.join(__dirname, '../templates');
    }
    const contract = await readTemplate(path_1.default.join(directory, 'contract.hbs'));
    const prelude = await readTemplate(path_1.default.join(directory, 'prelude.hbs'), true);
    return { contract, prelude };
}
async function readTemplate(path, allowMissing = false) {
    try {
        const template = await fs_1.promises.readFile(path, 'utf8');
        return handlebars.compile(template);
    }
    catch (e) {
        if (e.code === 'ENOENT' && allowMissing) {
            // default to empty template
            return () => '';
        }
        else {
            throw e;
        }
    }
}
//# sourceMappingURL=docgen.js.map

<|start_filename|>contracts/node_modules/solidity-docgen/dist/memoize.js<|end_filename|>
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.memoized = exports.memoize = void 0;
function memoize(target, propertyKey, descriptor) {
    if (descriptor.value instanceof Function) {
        const func = descriptor.value;
        // Did not find a way to avoid this cast to any.
        // See https://github.com/microsoft/TypeScript/issues/34540.
        descriptor.value = memoized(func);
    }
    else if (descriptor.get instanceof Function) {
        const func = descriptor.get;
        descriptor.get = memoized(func);
    }
    return descriptor;
}
exports.memoize = memoize;
function memoized(fn) {
    const thisCache = new WeakMap();
    const defaultCache = new Map();
    function getCache(that) {
        if (typeof that === 'object') {
            return getOrSet(thisCache, that, () => new Map());
        }
        else {
            return defaultCache;
        }
    }
    return function (...args) {
        const cache = getCache(this);
        const key = JSON.stringify(args);
        return getOrSet(cache, key, () => fn.apply(this, args));
    };
}
exports.memoized = memoized;
function getOrSet(map, key, gen) {
    if (map.has(key)) {
        return map.get(key); // Non-null assertion because we check map.has(key) before.
    }
    else {
        const val = gen();
        map.set(key, val);
        return val;
    }
}
//# sourceMappingURL=memoize.js.map

<|start_filename|>contracts/node_modules/solidity-docgen/dist/solc-output-builder.js<|end_filename|>
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.SolcOutputBuilder = void 0;
// fake solc output builder for tests
class SolcOutputBuilder {
    constructor() {
        this.errors = [];
        this.sources = {};
        this._nextId = 0;
        this._contractIds = {};
    }
    file(fileName) {
        this._currentFile = fileName;
        this.sources[fileName] = {
            ast: {
                nodeType: 'SourceUnit',
                nodes: [],
                id: this._getNextId(),
            },
        };
        return this;
    }
    import(importedFileName, aliases = []) {
        var _a;
        const importedSourceUnit = (_a = this.sources[importedFileName]) === null || _a === void 0 ? void 0 : _a.ast;
        if (importedSourceUnit === undefined)
            throw new Error('Imported file does not exist');
        const fileName = this._currentFile;
        if (fileName === undefined)
            throw new Error('No file defined');
        const astNode = {
            nodeType: 'ImportDirective',
            id: this._getNextId(),
            sourceUnit: importedSourceUnit.id,
            symbolAliases: aliases.map(([name, local]) => ({ foreign: { name }, local })),
        };
        this.sources[fileName].ast.nodes.push(astNode);
        return this;
    }
    contract(contractName, ...baseContracts) {
        const fileName = this._currentFile;
        if (fileName === undefined)
            throw new Error('No file defined');
        const id = this._getContractId(contractName);
        const astNode = {
            nodeType: 'ContractDefinition',
            name: contractName,
            documentation: null,
            id,
            linearizedBaseContracts: [id].concat(
            // this isn't really linearizing, but it'll do
            baseContracts.map(name => this._getContractId(name))),
            nodes: [],
        };
        this._currentContract = { astNode };
        this.sources[fileName].ast.nodes.push(astNode);
        return this;
    }
    _getContractId(contractName) {
        if (contractName in this._contractIds) {
            return this._contractIds[contractName];
        }
        else {
            const id = this._getNextId();
            this._contractIds[contractName] = id;
            return id;
        }
    }
    _getNextId() {
        const id = this._nextId;
        this._nextId += 1;
        return id;
    }
    function(functionName, ...argTypes) {
        const contract = this._currentContract;
        if (contract === undefined)
            throw new Error('No contract defined');
        const kind = functionName === 'fallback' || functionName === 'constructor'
            ? functionName
            : 'function';
        const astNode = {
            nodeType: 'FunctionDefinition',
            kind,
            visibility: 'public',
            name: functionName,
            documentation: null,
            parameters: {
                parameters: argTypes.map(t => ({
                    name: '',
                    typeName: {
                        nodeType: 'ElementaryTypeName',
                        typeDescriptions: {
                            typeString: t,
                        },
                    },
                })),
            },
            returnParameters: {
                parameters: [],
            },
        };
        contract.astNode.nodes.push(astNode);
        return this;
    }
    variable(variableName, typeString) {
        const contract = this._currentContract;
        if (contract === undefined)
            throw new Error('No contract defined');
        const astNode = {
            nodeType: 'VariableDeclaration',
            visibility: 'public',
            name: variableName,
            constant: false,
            typeName: {
                nodeType: 'ElementaryTypeName',
                typeDescriptions: {
                    typeString,
                },
            },
        };
        contract.astNode.nodes.push(astNode);
        return this;
    }
}
exports.SolcOutputBuilder = SolcOutputBuilder;
//# sourceMappingURL=solc-output-builder.js.map

<|start_filename|>contracts/node_modules/solidity-docgen/dist/sitemap.js<|end_filename|>
"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.Sitemap = exports.sitemapKinds = void 0;
const path_1 = __importDefault(require("path"));
const minimatch_1 = __importDefault(require("minimatch"));
const lodash_1 = require("lodash");
const page_1 = require("./page");
const memoize_1 = require("./memoize");
exports.sitemapKinds = ['contracts', 'readmes', 'single'];
class Sitemap {
    static generate(source, filter, readmes, ext, kind) {
        switch (kind) {
            case 'contracts':
                return new ContractSitemap(source, filter, ext);
            case 'readmes':
                return new ReadmeSitemap(source, filter, readmes);
            case 'single':
                return new DefaultSitemap(source, filter, ext);
        }
    }
    get contracts() {
        return this.source.contracts.filter(c => this.filter.matcher(c.file.path));
    }
    links(origin) {
        function* generate(sitemap) {
            for (const { path, contracts } of sitemap.pages) {
                const relativePath = relative(origin.path, path);
                for (const c of contracts) {
                    for (const target of c.linkable) {
                        yield { target, path, relativePath };
                    }
                }
            }
        }
        return Array.from(generate(this));
    }
}
__decorate([
    memoize_1.memoize
], Sitemap.prototype, "contracts", null);
exports.Sitemap = Sitemap;
class DefaultSitemap extends Sitemap {
    constructor(source, filter, ext) {
        super();
        this.source = source;
        this.filter = filter;
        this.ext = ext;
    }
    get pages() {
        return [new page_1.DefaultPage(this, this.ext, this.contracts)];
    }
}
class ReadmeSitemap extends Sitemap {
    constructor(source, filter, readmes) {
        super();
        this.source = source;
        this.filter = filter;
        this.readmes = readmes;
    }
    get pages() {
        const contracts = groupBy(this.contracts, c => this.locate(c));
        return this.readmes.map(r => new page_1.ReadmePage(this, r, contracts[path_1.default.dirname(r.path)] || []));
    }
    locate(contract) {
        const matches = this.locations.filter(l => isContainedIn(l, contract.file.path));
        return lodash_1.maxBy(matches, l => l.length);
    }
    get locations() {
        return this.readmes.map(r => path_1.default.dirname(r.path));
    }
}
class ContractSitemap extends Sitemap {
    constructor(source, filter, ext) {
        super();
        this.source = source;
        this.filter = filter;
        this.ext = ext;
    }
    get pages() {
        return this.contracts.map(c => new page_1.ContractPage(this, c, this.ext));
    }
}
function isContainedIn(location, file) {
    return minimatch_1.default(file, path_1.default.join(location, '**/*'));
}
function relative(origin, target) {
    if (path_1.default.normalize(origin) === path_1.default.normalize(target)) {
        return '';
    }
    else {
        return path_1.default.relative(path_1.default.dirname(origin), target);
    }
}
function groupBy(collection, key) {
    const res = {};
    for (const elem of collection) {
        const k = key(elem);
        if (k !== undefined) {
            (res[k] || (res[k] = [])).push(elem);
        }
    }
    return res;
}
//# sourceMappingURL=sitemap.js.map

<|start_filename|>contracts/node_modules/solidity-docgen/dist/filter.js<|end_filename|>
"use strict";
// globby and its fast-glob dependency don't support backward slashes in paths,
// so we "posixify" all paths in the Filter constructor and use the
// POSIX-specific path module to ensure everything stays forward-slashed
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.Filter = void 0;
const path_1 = require("path");
const globby_1 = __importDefault(require("globby"));
const micromatch_1 = __importDefault(require("micromatch"));
const memoize_1 = require("./memoize");
class Filter {
    constructor(root, excludePaths = []) {
        this.root = posixifyPath(root);
        this.excludePaths = excludePaths.map(posixifyPath);
    }
    get matcher() {
        return micromatch_1.default.matcher('**/*.sol', {
            ignore: this.excludePaths.map(e => path_1.posix.join(path_1.posix.relative(this.root, e), '**/*')),
        });
    }
    async glob(pattern) {
        return await globby_1.default(path_1.posix.join(this.root, '**', pattern), {
            ignore: this.excludePaths.map(e => path_1.posix.join(e, '**/*')),
        });
    }
}
__decorate([
    memoize_1.memoize
], Filter.prototype, "matcher", null);
exports.Filter = Filter;
function posixifyPath(p) {
    return p.replace(path_1.sep, path_1.posix.sep);
}
//# sourceMappingURL=filter.js.map

<|start_filename|>contracts/node_modules/solidity-docgen/dist/source.js<|end_filename|>
"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.SourceContract = exports.Source = void 0;
const lodash_1 = require("lodash");
const path_1 = __importDefault(require("path"));
const memoize_1 = require("./memoize");
const handlebars_1 = require("./handlebars");
class Source {
    constructor(contractsDir, solcOutput, contractTemplate) {
        this.contractsDir = contractsDir;
        this.solcOutput = solcOutput;
        this.contractTemplate = contractTemplate;
    }
    get contracts() {
        return lodash_1.flatten(this.files.map(file => file.contracts));
    }
    get files() {
        return Object.keys(this.solcOutput.sources)
            .map(fileName => this.file(fileName));
    }
    file(fileName) {
        return new SourceFile(this, this.solcOutput.sources[fileName].ast, path_1.default.relative(this.contractsDir, fileName));
    }
    fileById(id) {
        const file = this.files.find(f => f.astId === id);
        if (file === undefined) {
            throw new Error(`File with id ${id} not found`);
        }
        return file;
    }
    contractById(id) {
        const contract = this.contracts.find(c => c.astId === id);
        if (contract === undefined) {
            throw new Error(`Contract with id ${id} not found`);
        }
        return contract;
    }
}
__decorate([
    memoize_1.memoize
], Source.prototype, "file", null);
exports.Source = Source;
class SourceFile {
    constructor(source, ast, path) {
        this.source = source;
        this.ast = ast;
        this.path = path;
    }
    get contracts() {
        const astNodes = this.ast.nodes.filter(isContractDefinition);
        return astNodes.map(node => new SourceContract(this.source, this, node));
    }
    get contractsInScope() {
        var _a;
        const scope = {};
        for (const c of this.contracts) {
            scope[c.name] = c;
        }
        const imports = this.ast.nodes.filter(isImportDirective);
        for (const i of imports) {
            const importedFile = this.source.fileById(i.sourceUnit);
            if (i.symbolAliases.length === 0) {
                Object.assign(scope, importedFile.contractsInScope);
            }
            else {
                for (const a of i.symbolAliases) {
                    scope[(_a = a.local) !== null && _a !== void 0 ? _a : a.foreign.name] = importedFile.contractsInScope[a.foreign.name];
                }
            }
        }
        ;
        return scope;
    }
    get astId() {
        return this.ast.id;
    }
}
__decorate([
    memoize_1.memoize
], SourceFile.prototype, "contracts", null);
__decorate([
    memoize_1.memoize
], SourceFile.prototype, "contractsInScope", null);
class SourceContract {
    constructor(source, file, astNode) {
        this.source = source;
        this.file = file;
        this.astNode = astNode;
    }
    toString() {
        return this.source.contractTemplate(this);
    }
    get name() {
        return this.astNode.name;
    }
    get fullName() {
        return this.name;
    }
    get anchor() {
        return this.name;
    }
    get linkable() {
        return [this, ...this.ownModifiers, ...this.ownVariables, ...this.ownFunctions, ...this.ownEvents];
    }
    get inheritance() {
        return this.astNode.linearizedBaseContracts.map(id => this.source.contractById(id));
    }
    get variables() {
        return lodash_1.flatten(this.inheritance.map(c => c.ownVariables));
    }
    get ownVariables() {
        return this.astNode.nodes
            .filter(isVariableDeclaration)
            .filter(n => n.visibility !== 'private')
            .map(n => new SourceStateVariable(this, n));
    }
    get functions() {
        return lodash_1.uniqBy(lodash_1.flatten(this.inheritance.map(c => c.ownFunctions)), f => f.name === 'constructor' ? 'constructor' : f.signature);
    }
    get ownFunctions() {
        return this.astNode.nodes
            .filter(isFunctionDefinition)
            .filter(n => n.visibility !== 'private')
            .map(n => new SourceFunction(this, n))
            .filter(f => !f.isTrivialConstructor);
    }
    get privateFunctions() {
        return this.astNode.nodes
            .filter(isFunctionDefinition)
            .filter(n => n.visibility === 'private')
            .map(n => new SourceFunction(this, n));
    }
    get inheritedItems() {
        const variables = lodash_1.groupBy(this.variables, f => f.contract.astId);
        const functions = lodash_1.groupBy(this.functions, f => f.contract.astId);
        const events = lodash_1.groupBy(this.events, f => f.contract.astId);
        const modifiers = lodash_1.groupBy(this.modifiers, f => f.contract.astId);
        return this.inheritance.map(contract => ({
            contract,
            variables: variables[contract.astId],
            functions: functions[contract.astId],
            events: events[contract.astId],
            modifiers: modifiers[contract.astId],
        }));
    }
    get events() {
        return lodash_1.uniqBy(lodash_1.flatten(this.inheritance.map(c => c.ownEvents)), f => f.signature);
    }
    get ownEvents() {
        return this.astNode.nodes
            .filter(isEventDefinition)
            .map(n => new SourceEvent(this, n));
    }
    get modifiers() {
        return lodash_1.uniqBy(lodash_1.flatten(this.inheritance.map(c => c.ownModifiers)), f => f.signature);
    }
    get ownModifiers() {
        return this.astNode.nodes
            .filter(isModifierDefinition)
            .map(n => new SourceModifier(this, n));
    }
    get natspec() {
        if (this.astNode.documentation === null || this.astNode.documentation === undefined) {
            return {};
        }
        return parseNatSpec(this.astNode.documentation, this);
    }
    get astId() {
        return this.astNode.id;
    }
}
__decorate([
    memoize_1.memoize
], SourceContract.prototype, "ownVariables", null);
__decorate([
    memoize_1.memoize
], SourceContract.prototype, "ownFunctions", null);
__decorate([
    memoize_1.memoize
], SourceContract.prototype, "privateFunctions", null);
__decorate([
    memoize_1.memoize
], SourceContract.prototype, "ownEvents", null);
__decorate([
    memoize_1.memoize
], SourceContract.prototype, "ownModifiers", null);
__decorate([
    memoize_1.memoize
], SourceContract.prototype, "natspec", null);
exports.SourceContract = SourceContract;
class SourceContractItem {
    constructor(contract) {
        this.contract = contract;
    }
    get name() {
        return this.astNode.name;
    }
    get fullName() {
        return `${this.contract.name}.${this.name}`;
    }
    get anchor() {
        return `${this.contract.name}-${handlebars_1.slug(this.signature)}`;
    }
    get args() {
        return SourceTypedVariableArray.fromParameterList(this.astNode.parameters);
    }
    get signature() {
        return `${this.name}(${this.args.map(a => a.type).join(',')})`;
    }
    get natspec() {
        if (this.astNode.documentation === null || this.astNode.documentation === undefined) {
            return {};
        }
        return parseNatSpec(this.astNode.documentation, this);
    }
}
__decorate([
    memoize_1.memoize
], SourceContractItem.prototype, "args", null);
__decorate([
    memoize_1.memoize
], SourceContractItem.prototype, "natspec", null);
class SourceStateVariable {
    constructor(contract, astNode) {
        this.contract = contract;
        this.astNode = astNode;
    }
    get name() {
        return this.astNode.name;
    }
    get fullName() {
        return `${this.contract.name}.${this.name}`;
    }
    get anchor() {
        return `${this.contract.name}-${this.name}-${handlebars_1.slug(this.type)}`;
    }
    get type() {
        return this.astNode.typeName.typeDescriptions.typeString;
    }
    get signature() {
        return `${this.type} ${this.name}`;
    }
    get natspec() {
        warnStateVariableNatspec();
        return {};
    }
}
class SourceFunction extends SourceContractItem {
    constructor(contract, astNode) {
        super(contract);
        this.astNode = astNode;
    }
    get name() {
        const { name, kind } = this.astNode;
        const isRegularFunction = kind === 'function';
        return isRegularFunction ? name : kind;
    }
    get outputs() {
        return SourceTypedVariableArray.fromParameterList(this.astNode.returnParameters);
    }
    get visibility() {
        return this.astNode.visibility;
    }
    get isTrivialConstructor() {
        return (this.astNode.kind === "constructor" &&
            this.visibility === "public" &&
            this.args.length === 0 &&
            Object.keys(this.natspec).length === 0);
    }
}
__decorate([
    memoize_1.memoize
], SourceFunction.prototype, "outputs", null);
class SourceEvent extends SourceContractItem {
    constructor(contract, astNode) {
        super(contract);
        this.astNode = astNode;
    }
}
class SourceModifier extends SourceContractItem {
    constructor(contract, astNode) {
        super(contract);
        this.astNode = astNode;
    }
}
class SourceTypedVariable {
    constructor(typeNode, name) {
        this.typeNode = typeNode;
        this.name = name;
    }
    get type() {
        return this.typeNode.typeDescriptions.typeString;
    }
    // TODO: deprecate
    get typeName() {
        return this.type;
    }
    toString() {
        if (this.name) {
            return [this.type, this.name].join(' ');
        }
        else {
            return this.type;
        }
    }
}
class PrettyArray extends Array {
    toString() {
        return this.map(e => e.toString()).join(', ');
    }
}
class SourceTypedVariableArray extends PrettyArray {
    static fromParameterList(parameters) {
        return SourceTypedVariableArray.from(parameters.parameters.map(p => new SourceTypedVariable(p.typeName, p.name || undefined)));
    }
    get types() {
        return this.map(v => v.type);
    }
    get names() {
        return this.map(v => (v.name === undefined) ? '_' : v.name);
    }
}
function parseNatSpec(doc, context) {
    var _a, _b, _c, _d, _e, _f;
    var _g;
    const res = {};
    const tagMatches = execall(/^(?:@(\w+|custom:[a-z][a-z-]*) )?((?:(?!^@(?:\w+|custom:[a-z][a-z-]*) )[^])*)/m, doc);
    let inheritFrom;
    for (const [, tag, content] of tagMatches) {
        if (tag === 'dev') {
            (_a = res.devdoc) !== null && _a !== void 0 ? _a : (res.devdoc = '');
            res.devdoc += content;
        }
        if (tag === 'notice' || tag === undefined) {
            (_b = res.userdoc) !== null && _b !== void 0 ? _b : (res.userdoc = '');
            res.userdoc += content;
        }
        if (tag === 'title') {
            res.title = content;
        }
        if (tag === 'param') {
            const paramMatches = content.match(/(\w+) ([^]*)/);
            if (paramMatches) {
                const [, param, description] = paramMatches;
                (_c = res.params) !== null && _c !== void 0 ? _c : (res.params = []);
                res.params.push({ param, description });
            }
        }
        if (tag === 'return') {
            const paramMatches = content.match(/(\w+) ([^]*)/);
            if (paramMatches) {
                const [, param, description] = paramMatches;
                (_d = res.returns) !== null && _d !== void 0 ? _d : (res.returns = []);
                res.returns.push({ param, description });
            }
        }
        if (tag === 'inheritdoc') {
            if (!(context instanceof SourceFunction)) {
                throw new Error('@inheritdoc only supported in functions');
            }
            const parentContract = context.contract.file.contractsInScope[content.trim()];
            inheritFrom = parentContract.functions.find(f => f.name === context.name);
        }
        if (tag === null || tag === void 0 ? void 0 : tag.startsWith('custom:')) {
            const key = tag.replace(/^custom:/, '');
            (_e = res.custom) !== null && _e !== void 0 ? _e : (res.custom = {});
            (_f = (_g = res.custom)[key]) !== null && _f !== void 0 ? _f : (_g[key] = '');
            res.custom[key] += content;
        }
    }
    if (inheritFrom) {
        lodash_1.defaults(res, inheritFrom.natspec);
    }
    return res;
}
function* execall(re, text) {
    re = new RegExp(re, re.flags + (re.sticky ? '' : 'y'));
    while (true) {
        const match = re.exec(text);
        // we break out of the loop if the empty string is matched because no
        // progress will be made and it will loop infinitely
        if (match && match[0] !== '') {
            yield match;
        }
        else {
            break;
        }
    }
}
function isVariableDeclaration(node) {
    return node.nodeType === 'VariableDeclaration';
}
function isFunctionDefinition(node) {
    return node.nodeType === 'FunctionDefinition';
}
function isEventDefinition(node) {
    return node.nodeType === 'EventDefinition';
}
function isModifierDefinition(node) {
    return node.nodeType === 'ModifierDefinition';
}
function isContractDefinition(node) {
    return node.nodeType === 'ContractDefinition';
}
function isImportDirective(node) {
    return node.nodeType === 'ImportDirective';
}
function oneTimeLogger(msg) {
    let warned = false;
    return function () {
        if (!warned) {
            console.warn(msg);
            warned = true;
        }
    };
}
const warnStateVariableNatspec = oneTimeLogger('Warning: NatSpec is currently not available for state variables.');
//# sourceMappingURL=source.js.map

<|start_filename|>frontend/Dockerfile<|end_filename|>
FROM node:12.2.0-alpine 
WORKDIR /app
EXPOSE 8080
COPY package.json ./
RUN npm install
CMD [ "npm", "run", "serve" ]


<|start_filename|>contracts/node_modules/solidity-docgen/dist/handlebars.test.js<|end_filename|>
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const ava_1 = __importDefault(require("ava"));
const handlebars_1 = require("./handlebars");
ava_1.default('registerHelpers', t => {
    const helper = 'q5MXwZ7rd9Bp'; // random name to avoid interference due to global state
    handlebars_1.registerHelpers({
        [helper]: (str) => str.toUpperCase(),
    });
    const render = handlebars_1.compile(`{{${helper} "test"}}`);
    t.is(render({}), 'TEST');
});
//# sourceMappingURL=handlebars.test.js.map

<|start_filename|>contracts/node_modules/solidity-docgen/dist/solc-fork.js<|end_filename|>
"use strict";
// Test helper that runs SolcAdapter.compile in a separate process to avoid blocking.
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.solcCompile = void 0;
const child_process_1 = __importDefault(require("child_process"));
const events_1 = __importDefault(require("events"));
const assert_1 = __importDefault(require("assert"));
const util_1 = __importDefault(require("util"));
const solc_1 = require("./solc");
async function solcCompile(solcModule, input) {
    const child = child_process_1.default.fork(__filename);
    child.send({ solcModule, input });
    const [{ error, output }] = await events_1.default.once(child, 'message');
    assert_1.default.ifError(error);
    return output;
}
exports.solcCompile = solcCompile;
// When forked:
if (process.send !== undefined) {
    process.once('message', async ({ solcModule, input }) => {
        try {
            const adapter = await solc_1.SolcAdapter.require(solcModule);
            const output = adapter.compile(input);
            process.send({ output });
        }
        catch (error) {
            process.send({ error: util_1.default.inspect(error) });
        }
    });
}
//# sourceMappingURL=solc-fork.js.map

<|start_filename|>contracts/node_modules/solidity-docgen/dist/cli.js<|end_filename|>
#!/usr/bin/env node
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.Docgen = void 0;
const command_1 = require("@oclif/command");
const path_1 = __importDefault(require("path"));
const json5_1 = __importDefault(require("json5"));
const docgen_1 = require("./docgen");
const sitemap_1 = require("./sitemap");
class Docgen extends command_1.Command {
    async run() {
        const { flags } = this.parse(Docgen);
        await docgen_1.docgen(flags);
    }
}
exports.Docgen = Docgen;
Docgen.flags = {
    version: command_1.flags.version(),
    help: command_1.flags.help(),
    input: command_1.flags.string({
        char: 'i',
        default: 'contracts',
        description: 'directory where contracts will be taken from',
    }),
    output: command_1.flags.string({
        char: 'o',
        default: 'docs',
        description: 'directory where generated docs will be written',
    }),
    exclude: command_1.flags.build({
        parse: s => s.split(','),
    })({
        char: 'e',
        description: 'exclude directories that match the pattern (separated by commas)',
    }),
    templates: command_1.flags.string({
        char: 't',
        parse: s => path_1.default.resolve(s),
        description: 'directory with template files',
    }),
    extension: command_1.flags.string({
        char: 'x',
        default: 'md',
        description: 'file extension for generated pages, not necessary when using READMEs',
    }),
    helpers: command_1.flags.string({
        char: 'H',
        parse: s => path_1.default.resolve(s),
        description: 'path to a file whose exports will be registered as handlebars helpers',
    }),
    'solc-module': command_1.flags.string({
        parse: s => require.resolve(s, { paths: ['.'] }),
        description: 'path to an alternative solc module',
    }),
    'solc-settings': command_1.flags.build({
        parse: s => {
            const settings = json5_1.default.parse(s);
            if (typeof settings !== 'object' || settings === null) {
                throw new Error('--solc-settings must be an object');
            }
            return settings;
        },
    })({
        description: 'compiler settings for solc module',
    }),
    'output-structure': command_1.flags.enum({
        char: 's',
        options: Array.from(sitemap_1.sitemapKinds),
        default: 'contracts',
        description: 'how to structure contracts across output files',
    }),
};
if (require.main === module) {
    Docgen.run().then(undefined, require('@oclif/errors/handle'));
}
//# sourceMappingURL=cli.js.map

<|start_filename|>contracts/scripts/deployBadgesFromJson.js<|end_filename|>
// scripts/index2.js
// var bigInt = require("big-integer");

module.exports = async function main(callback) {
  try {
    // Retrieve accounts from the local node
    const accounts = await web3.eth.getAccounts();
    console.log(accounts)
    let badgeId = 0

    // Set up a Truffle contract, representing our deployed BadgeTokenFactory instance
    const BadgeDefinitionFactory = artifacts.require("BadgeDefinitionFactory");
    const badgeDefinitionFactory = await BadgeDefinitionFactory.deployed();

    const jsonFile = require('./badges.json');
    for (var badgeIndex in jsonFile['badges']) {
      var badge = jsonFile['badges'][badgeIndex]
      await badgeDefinitionFactory.createBadgeDefinition(badge.name, badge.description, badge.tags, "i.redd.it/rq36kl1xjxr01.png", false);
      console.log(badge.id, badge.name, badge.description)
      await badgeDefinitionFactory.getPastEvents( 'Transfer', { fromBlock: 'latest', toBlock: 'latest' } )
      .then(function(events){
          badgeId = events[0]["returnValues"]["tokenId"];
      });
      console.log("createBadgeDefinition: The new BadgeDefinitionId for badge definition#" + badge.id, "is", badgeId.toString());

      for (var conditionIndex in badge.conditions){
        var condition = badge.conditions[conditionIndex]
        await badgeDefinitionFactory.addBadgeAttributionCondition(badgeId, condition.description, condition.indexer, condition.protocol, "fakeQuery", condition.operator, condition.target.toString());
        console.log("*" + condition.protocol, condition.indexer, condition.description , condition.operator, condition.target)
      }
      await badgeDefinitionFactory.publishBadgeDefinition(badgeId);
      value = await badgeDefinitionFactory.getBadgeDefinitionAttributionCondition(badgeId);
      console.log("getBadgeDefinitionAttributionCondition: The BadgeDefinitionId", badgeId, "has got", value[0].toString(), "condition(s)");
      console.log(value[1]);
    }

    callback(0);
  } catch (error) {
    console.error(error);
    callback(1);
  }
}