Refactor buidler config

pull/2403/head
Francisco Giordano 4 years ago
parent fcdf8f4618
commit 1e78adc28c
  1. 15
      buidler.config.js
  2. 10
      buidler/env-contract.js

@ -1,15 +1,12 @@
const fs = require('fs');
const path = require('path');
usePlugin('solidity-coverage'); usePlugin('solidity-coverage');
usePlugin('@nomiclabs/buidler-truffle5'); usePlugin('@nomiclabs/buidler-truffle5');
extendEnvironment(env => { for (const f of fs.readdirSync(path.join(__dirname, 'buidler'))) {
const { contract } = env; require(path.join(__dirname, 'buidler', f));
env.contract = function (name, body) { }
// remove the default account from the accounts list used in tests, in order
// to protect tests against accidentally passing due to the contract
// deployer being used subsequently as function caller
contract(name, accounts => body(accounts.slice(1)));
};
});
module.exports = { module.exports = {
networks: { networks: {

@ -0,0 +1,10 @@
extendEnvironment(env => {
const { contract } = env;
env.contract = function (name, body) {
// remove the default account from the accounts list used in tests, in order
// to protect tests against accidentally passing due to the contract
// deployer being used subsequently as function caller
contract(name, accounts => body(accounts.slice(1)));
};
});
Loading…
Cancel
Save