Refactor buidler config
This commit is contained in:
@ -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: {
|
||||||
|
|||||||
10
buidler/env-contract.js
Normal file
10
buidler/env-contract.js
Normal file
@ -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)));
|
||||||
|
};
|
||||||
|
});
|
||||||
Reference in New Issue
Block a user