All files / src/codegen userContractGen.ts

100% Statements 5/5
100% Branches 0/0
100% Functions 2/2
100% Lines 5/5

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21    2x   2x       16x 16x 16x                    
import { ContractSchema } from "./contractSchema";
import { Generator } from "./generator";
import { cleanAndCapitalizeFirstLetter } from "./utils";
 
export class UserContractGen implements Generator {
    constructor() {}
 
    gen(schema: ContractSchema): string {
        let contractName = cleanAndCapitalizeFirstLetter(schema.name);
        let generatedContractName = contractName + "Generated";
        return `` +
        `// SPDX-License-Identifier: UNLICENSED\n` +
        `pragma solidity ^0.8.23;\n` +
        `\n` +
        `import "./${generatedContractName}.sol";\n` +
        `\n` +
        `contract ${contractName} is ${generatedContractName} {\n` +
        `  constructor(address _manager, address _owner) ${generatedContractName}(_manager, _owner) {}\n` +
        `}\n`;
    }
}