Francisco Giordano 4 жил өмнө
parent
commit
a8af062285

+ 6 - 9
buidler.config.js

@@ -1,15 +1,12 @@
+const fs = require('fs');
+const path = require('path');
+
 usePlugin('solidity-coverage');
 usePlugin('@nomiclabs/buidler-truffle5');
 
-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)));
-  };
-});
+for (const f of fs.readdirSync(path.join(__dirname, 'buidler'))) {
+  require(path.join(__dirname, 'buidler', f));
+}
 
 module.exports = {
   networks: {

+ 10 - 0
buidler/env-contract.js

@@ -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)));
+  };
+});