|
|
@ -16,13 +16,16 @@ function regexIndexOf (inputString: string, regex: RegExp, startpos = 0) { |
|
|
|
|
|
|
|
|
|
|
|
export function writeTestAccountsContract (accounts: string[]) { |
|
|
|
export function writeTestAccountsContract (accounts: string[]) { |
|
|
|
const testAccountContract = require('../sol/tests_accounts.sol') // eslint-disable-line
|
|
|
|
const testAccountContract = require('../sol/tests_accounts.sol') // eslint-disable-line
|
|
|
|
let body = `address[${accounts.length}] memory accounts;` |
|
|
|
let body = '' |
|
|
|
if (!accounts.length) body += ';' |
|
|
|
if (accounts.length) { |
|
|
|
else { |
|
|
|
body = `address[${accounts.length}] memory accounts;` |
|
|
|
accounts.map((address, index) => { |
|
|
|
accounts.map((address, index) => { |
|
|
|
body += `\n\t\taccounts[${index}] = ${address};\n` |
|
|
|
body += `\n\t\taccounts[${index}] = ${address};\n` |
|
|
|
}) |
|
|
|
}) |
|
|
|
} |
|
|
|
body = `return accounts[index];` + body |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
body = `return address(0);` |
|
|
|
|
|
|
|
}
|
|
|
|
return testAccountContract.replace('>accounts<', body) |
|
|
|
return testAccountContract.replace('>accounts<', body) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|