Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
.setAction(async ({}, { web3, run }) => {
console.log(`Starting...`);
// Define internal tasks.
internalTask(TASK_START_NEW_DAO, newDao);
internalTask(TASK_START_NEW_APP_PROXY, newAppProxy);
internalTask(TASK_START_UPDATE_PROXY_IMPLEMENTATION, updateProxyImplementation);
internalTask(TASK_START_WATCH_CONTRACTS, watchContracts)
// Compile contracts.
await run('compile')
// Retrieve active accounts.
const accounts = await web3.eth.getAccounts();
const root = accounts[0];
const dao = await run(TASK_START_NEW_DAO, { root });
console.log(`New DAO created at: ${dao.address}`);
const proxy = await run(TASK_START_NEW_APP_PROXY, { root, dao });
console.log(`New app proxy created at: ${proxy.address}`);
.setAction(async ({}, { web3, run }) => {
console.log(`Starting...`);
// Define internal tasks.
internalTask(TASK_START_NEW_DAO, newDao);
internalTask(TASK_START_NEW_APP_PROXY, newAppProxy);
internalTask(TASK_START_UPDATE_PROXY_IMPLEMENTATION, updateProxyImplementation);
internalTask(TASK_START_WATCH_CONTRACTS, watchContracts)
// Compile contracts.
await run('compile')
// Retrieve active accounts.
const accounts = await web3.eth.getAccounts();
const root = accounts[0];
const dao = await run(TASK_START_NEW_DAO, { root });
console.log(`New DAO created at: ${dao.address}`);
const proxy = await run(TASK_START_NEW_APP_PROXY, { root, dao });
console.log(`New app proxy created at: ${proxy.address}`);
TASK_COMPILE,
} from '../task-names';
import {
createDao,
deployImplementation,
createProxy,
updateProxy,
createRepo,
updateRepo,
setPermissions,
getMainContractName,
getMainContractPath
} from './utils/backend';
internalTask(TASK_START_WATCH_CONTRACTS, watchContracts);
const APP_ID = '0xDEADBEEFDEADBEEFDEADBEEFDEADBEEFDEADBEEFDEADBEEFDEADBEEFDEADBEEF';
/**
* Main, composite, task.
*/
task(TASK_START, 'Starts Aragon app development').setAction(
async ({}, { web3, run, artifacts }: BuidlerRuntimeEnvironment) => {
console.log(`Starting...`);
await run(TASK_COMPILE);
// Retrieve active accounts.
const accounts: string[] = await web3.eth.getAccounts();
const root = accounts[0];
.setAction(async ({}, { web3, run }) => {
console.log(`Starting...`);
// Define internal tasks.
internalTask(TASK_START_NEW_DAO, newDao);
internalTask(TASK_START_NEW_APP_PROXY, newAppProxy);
internalTask(TASK_START_UPDATE_PROXY_IMPLEMENTATION, updateProxyImplementation);
internalTask(TASK_START_WATCH_CONTRACTS, watchContracts)
// Compile contracts.
await run('compile')
// Retrieve active accounts.
const accounts = await web3.eth.getAccounts();
const root = accounts[0];
const dao = await run(TASK_START_NEW_DAO, { root });
console.log(`New DAO created at: ${dao.address}`);
const proxy = await run(TASK_START_NEW_APP_PROXY, { root, dao });
console.log(`New app proxy created at: ${proxy.address}`);
await run(TASK_START_WATCH_CONTRACTS, { root, dao })
accounts = await pweb3.eth.getAccounts();
}
}
);
internalTask(
TASK_COMPILE_GET_SOURCE_PATHS,
async (_, { config }, runSuper) => {
const sources = await runSuper();
const testSources = await glob(join(config.paths.tests, "**", "*.sol"));
return [...sources, ...testSources];
}
);
let wasWarningShown = false;
internalTask(RUN_TRUFFLE_FIXTURE_TASK, async (_, env) => {
const paths = env.config.paths;
const hasFixture = await hasTruffleFixture(paths);
if (!wasWarningShown) {
if ((await hasMigrations(paths)) && !hasFixture) {
console.warn(
"Your project has Truffle migrations, which have to be turn into a fixture to run your tests with Buidler"
);
wasWarningShown = true;
}
}
if (hasFixture) {
const fixture = await getTruffleFixtureFunction(paths);
await fixture(env);
definition(accounts!);
});
};
});
internalTask(
TASK_TEST_SETUP_TEST_ENVIRONMENT,
async (_, { web3, network }) => {
if (network.name !== BUIDLEREVM_NETWORK_NAME) {
accounts = await web3.eth.getAccounts();
}
}
);
internalTask(
TASK_COMPILE_GET_SOURCE_PATHS,
async (_, { config }, runSuper) => {
const sources = await runSuper();
const testSources = await glob(join(config.paths.tests, "**", "*.sol"));
return [...sources, ...testSources];
}
);
let wasWarningShown = false;
internalTask(RUN_TRUFFLE_FIXTURE_TASK, async (_, env) => {
const paths = env.config.paths;
const hasFixture = await hasTruffleFixture(paths);
if (!wasWarningShown) {
if ((await hasMigrations(paths)) && !hasFixture) {
console.warn(
import { TASK_COMPILE_GET_SOURCE_PATHS } from "@nomiclabs/buidler/builtin-tasks/task-names";
import { internalTask } from "@nomiclabs/buidler/config";
import { getAutoexternalConfig } from "./config";
import { generateTestableContracts } from "./contracts";
internalTask(TASK_COMPILE_GET_SOURCE_PATHS, async (_, { config }, runSuper) => {
const filePaths: string[] = await runSuper();
const autoexternalConfig = getAutoexternalConfig(config);
const [
testableContractPaths,
failedSourceFiles
] = await generateTestableContracts(
config.paths,
autoexternalConfig,
filePaths
);
for (const sourceFile of failedSourceFiles) {
console.warn(
`A parsing error was encountered. No contract will be generated for ${
throw new BuidlerPluginError(
`To run your tests that use Truffle's "contract()" function with the network "${env.network.name}", you need to use Buidler's CLI`
);
}
describe(`Contract: ${description}`, () => {
before("Running truffle fixture if available", async function() {
await env.run(RUN_TRUFFLE_FIXTURE_TASK);
});
definition(accounts!);
});
};
});
internalTask(
TASK_TEST_SETUP_TEST_ENVIRONMENT,
async (_, { web3, network }) => {
if (network.name !== BUIDLEREVM_NETWORK_NAME) {
accounts = await web3.eth.getAccounts();
}
}
);
internalTask(
TASK_COMPILE_GET_SOURCE_PATHS,
async (_, { config }, runSuper) => {
const sources = await runSuper();
const testSources = await glob(join(config.paths.tests, "**", "*.sol"));
return [...sources, ...testSources];
}
);
);
await fsExtra.ensureDir(path.dirname(processedFilePath));
const processedCode = await solpp.processCode(content, opts);
await fsExtra.writeFile(processedFilePath, processedCode, "utf-8");
processedPaths.push(processedFilePath);
}
return processedPaths;
}
);
internalTask(
TASK_COMPILE_GET_SOURCE_PATHS,
async (_, { config, run }, runSuper) => {
const filePaths: string[] = await runSuper();
const files = await readFiles(filePaths);
const opts = getConfig(config);
return run("buidler-solpp:run-solpp", { files, opts });
}
);
}
export default function() {
internalTask(
"buidler-solpp:run-solpp",
async (
{ files, opts }: { files: string[][]; opts: SolppConfig },
{ config }: { config: ResolvedBuidlerConfig }
) => {
const processedPaths: string[] = [];
const solpp = await import("solpp");
for (const [filePath, content] of files) {
const processedFilePath = path.join(
config.paths.cache,
PROCESSED_CACHE_DIRNAME,
path.relative(config.paths.sources, filePath)
);
await fsExtra.ensureDir(path.dirname(processedFilePath));