@nomiclabs/buidler
Version:
Buidler is an extensible developer tool that helps smart contract developers increase productivity by reliably bringing together the tools they want.
44 lines (39 loc) • 991 B
text/typescript
import { SolcInput, SolcOptimizerConfig } from "../../../types";
import { DependencyGraph } from "../dependencyGraph";
export function getInputFromDependencyGraph(
graph: DependencyGraph,
optimizerConfig: SolcOptimizerConfig,
evmVersion?: string
): SolcInput {
const sources: { [globalName: string]: { content: string } } = {};
for (const file of graph.getResolvedFiles()) {
sources[file.globalName] = {
content: file.content,
};
}
const input: SolcInput = {
language: "Solidity",
sources,
settings: {
metadata: {
useLiteralContent: true,
},
optimizer: optimizerConfig,
outputSelection: {
"*": {
"*": [
"abi",
"evm.bytecode",
"evm.deployedBytecode",
"evm.methodIdentifiers",
],
"": ["id", "ast"],
},
},
},
};
if (evmVersion !== undefined) {
input.settings.evmVersion = evmVersion;
}
return input;
}