diff --git a/.eslintignore b/.eslintignore deleted file mode 100644 index 60b95f0..0000000 --- a/.eslintignore +++ /dev/null @@ -1,4 +0,0 @@ -node_modules -.idea -.arcanist-extensions -public \ No newline at end of file diff --git a/.eslintrc.json b/.eslintrc.json deleted file mode 100644 index 98d5387..0000000 --- a/.eslintrc.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "env": { - "es6": true, - "node": true, - "mocha": true - }, - "globals": { - "artifacts": true, - "contract": true, - "web3": true, - "assert": true - }, - "extends": "eslint:recommended", - "parserOptions": { - "sourceType": "module", - "ecmaVersion": 2017 - }, - "rules": { - "indent": ["error", 2, {"SwitchCase": 1, "MemberExpression": "off"}], - "linebreak-style": ["error", "unix"], - "semi": ["error", "always"], - "eqeqeq": ["warn", "always"], - "curly": "error", - "no-extra-boolean-cast": "off", - "no-unused-vars": "warn", - "object-curly-spacing": ["error", "always", {"objectsInObjects": true, "arraysInObjects": true}], - "array-bracket-spacing": ["error", "never"], - "require-yield": "off", - "func-call-spacing": ["error", "never"], - "quotes": ["error", "single"], - "key-spacing": ["error", { "beforeColon": false, "afterColon": true, "mode": "strict" }], - "quote-props": ["error", "as-needed"], - "no-console": "off", - "no-empty": "warn", - "no-var": "error", - "prefer-const": "error" - } -} diff --git a/.prettierrc b/.prettierrc index ac8367d..eada8c0 100644 --- a/.prettierrc +++ b/.prettierrc @@ -3,7 +3,7 @@ "useTabs": false, "printWidth": 80, "tabWidth": 2, - "singleQuote": false, + "singleQuote": true, "trailingComma": "none", "jsxBracketSameLine": false, "semi": true, diff --git a/app/javascripts/app.js b/app/javascripts/app.js index dbaf3f7..08937cb 100644 --- a/app/javascripts/app.js +++ b/app/javascripts/app.js @@ -3,7 +3,7 @@ var account; var balance; function setStatus(message) { - var status = document.getElementById("status"); + var status = document.getElementById('status'); status.innerHTML = message; } @@ -13,39 +13,39 @@ function refreshBalance() { meta.getBalance .call(account, { from: account }) .then(function (value) { - var balance_element = document.getElementById("balance"); + var balance_element = document.getElementById('balance'); balance_element.innerHTML = value.valueOf(); }) .catch(function (e) { console.log(e); - setStatus("Error getting balance; see log."); + setStatus('Error getting balance; see log.'); }); } function sendCoin() { var meta = MetaCoin.deployed(); - var amount = parseInt(document.getElementById("amount").value); - var receiver = document.getElementById("receiver").value; + var amount = parseInt(document.getElementById('amount').value); + var receiver = document.getElementById('receiver').value; - setStatus("Initiating transaction... (please wait)"); + setStatus('Initiating transaction... (please wait)'); meta .sendCoin(receiver, amount, { from: account }) .then(function () { - setStatus("Transaction complete!"); + setStatus('Transaction complete!'); refreshBalance(); }) .catch(function (e) { console.log(e); - setStatus("Error sending coin; see log."); + setStatus('Error sending coin; see log.'); }); } window.onload = function () { web3.eth.getAccounts(function (err, accs) { if (err != null) { - alert("There was an error fetching your accounts."); + alert('There was an error fetching your accounts.'); return; } diff --git a/contracts/Batcher.sol b/contracts/Batcher.sol index ad0c6c4..c101a96 100644 --- a/contracts/Batcher.sol +++ b/contracts/Batcher.sol @@ -1,4 +1,5 @@ pragma solidity 0.7.5; + // SPDX-License-Identifier: Apache-2.0 /** @@ -17,94 +18,114 @@ pragma solidity 0.7.5; */ contract Batcher { - event BatchTransfer(address sender, address recipient, uint256 value); - event OwnerChange(address prevOwner, address newOwner); - event TransferGasLimitChange(uint256 prevTransferGasLimit, uint256 newTransferGasLimit); + event BatchTransfer(address sender, address recipient, uint256 value); + event OwnerChange(address prevOwner, address newOwner); + event TransferGasLimitChange( + uint256 prevTransferGasLimit, + uint256 newTransferGasLimit + ); - address public owner; - uint256 public lockCounter; - uint256 public transferGasLimit; + address public owner; + uint256 public lockCounter; + uint256 public transferGasLimit; - constructor() { - lockCounter = 1; - owner = msg.sender; - emit OwnerChange(address(0), owner); - transferGasLimit = 20000; - emit TransferGasLimitChange(0, transferGasLimit); - } + constructor() { + lockCounter = 1; + owner = msg.sender; + emit OwnerChange(address(0), owner); + transferGasLimit = 20000; + emit TransferGasLimitChange(0, transferGasLimit); + } - modifier lockCall() { - lockCounter++; - uint256 localCounter = lockCounter; - _; - require(localCounter == lockCounter, "Reentrancy attempt detected"); - } + modifier lockCall() { + lockCounter++; + uint256 localCounter = lockCounter; + _; + require(localCounter == lockCounter, 'Reentrancy attempt detected'); + } - modifier onlyOwner() { - require(msg.sender == owner, "Not owner"); - _; - } + modifier onlyOwner() { + require(msg.sender == owner, 'Not owner'); + _; + } - /** - * Transfer funds in a batch to each of recipients - * @param recipients The list of recipients to send to - * @param values The list of values to send to recipients. - * The recipient with index i in recipients array will be sent values[i]. - * Thus, recipients and values must be the same length - */ - function batch(address[] calldata recipients, uint256[] calldata values) external payable lockCall { - require(recipients.length != 0, "Must send to at least one person"); - require(recipients.length == values.length, "Unequal recipients and values"); - require(recipients.length < 256, "Too many recipients"); + /** + * Transfer funds in a batch to each of recipients + * @param recipients The list of recipients to send to + * @param values The list of values to send to recipients. + * The recipient with index i in recipients array will be sent values[i]. + * Thus, recipients and values must be the same length + */ + function batch(address[] calldata recipients, uint256[] calldata values) + external + payable + lockCall + { + require(recipients.length != 0, 'Must send to at least one person'); + require( + recipients.length == values.length, + 'Unequal recipients and values' + ); + require(recipients.length < 256, 'Too many recipients'); - // Try to send all given amounts to all given recipients - // Revert everything if any transfer fails - for (uint8 i = 0; i < recipients.length; i++) { - require(recipients[i] != address(0), "Invalid recipient address"); - (bool success,) = recipients[i].call{value: values[i], gas: transferGasLimit}(""); - require(success, "Send failed"); - emit BatchTransfer(msg.sender, recipients[i], values[i]); - } + // Try to send all given amounts to all given recipients + // Revert everything if any transfer fails + for (uint8 i = 0; i < recipients.length; i++) { + require(recipients[i] != address(0), 'Invalid recipient address'); + (bool success, ) = recipients[i].call{ + value: values[i], + gas: transferGasLimit + }(''); + require(success, 'Send failed'); + emit BatchTransfer(msg.sender, recipients[i], values[i]); } + } - /** - * Recovery function for the contract owner to recover any ERC20 tokens or ETH that may get lost in the control of this contract. - * @param to The recipient to send to - * @param value The ETH value to send with the call - * @param data The data to send along with the call - */ - function recover(address to, uint256 value, bytes calldata data) external onlyOwner returns (bytes memory) { - (bool success, bytes memory returnData) = to.call{value: value}(data); - return returnData; - } + /** + * Recovery function for the contract owner to recover any ERC20 tokens or ETH that may get lost in the control of this contract. + * @param to The recipient to send to + * @param value The ETH value to send with the call + * @param data The data to send along with the call + */ + function recover( + address to, + uint256 value, + bytes calldata data + ) external onlyOwner returns (bytes memory) { + (bool success, bytes memory returnData) = to.call{ value: value }(data); + return returnData; + } - /** - * Transfers ownership of the contract ot the new owner - * @param newOwner The address to transfer ownership of the contract to - */ - function transferOwnership(address newOwner) external onlyOwner { - require(newOwner != address(0), "Invalid new owner"); - emit OwnerChange(owner, newOwner); - owner = newOwner; - } + /** + * Transfers ownership of the contract ot the new owner + * @param newOwner The address to transfer ownership of the contract to + */ + function transferOwnership(address newOwner) external onlyOwner { + require(newOwner != address(0), 'Invalid new owner'); + emit OwnerChange(owner, newOwner); + owner = newOwner; + } - /** - * Change the gas limit that is sent along with batched transfers. - * This is intended to protect against any EVM level changes that would require - * a new amount of gas for an internal send to complete. - * @param newTransferGasLimit The new gas limit to send along with batched transfers - */ - function changeTransferGasLimit(uint256 newTransferGasLimit) external onlyOwner { - require(newTransferGasLimit >= 2300, "Transfer gas limit too low"); - emit TransferGasLimitChange(transferGasLimit, newTransferGasLimit); - transferGasLimit = newTransferGasLimit; - } + /** + * Change the gas limit that is sent along with batched transfers. + * This is intended to protect against any EVM level changes that would require + * a new amount of gas for an internal send to complete. + * @param newTransferGasLimit The new gas limit to send along with batched transfers + */ + function changeTransferGasLimit(uint256 newTransferGasLimit) + external + onlyOwner + { + require(newTransferGasLimit >= 2300, 'Transfer gas limit too low'); + emit TransferGasLimitChange(transferGasLimit, newTransferGasLimit); + transferGasLimit = newTransferGasLimit; + } - fallback() external payable { - revert("Invalid fallback"); - } + fallback() external payable { + revert('Invalid fallback'); + } - receive() external payable { - revert("Invalid receive"); - } + receive() external payable { + revert('Invalid receive'); + } } diff --git a/contracts/Forwarder.sol b/contracts/Forwarder.sol index a4c107f..1a59237 100644 --- a/contracts/Forwarder.sol +++ b/contracts/Forwarder.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: Apache-2.0 pragma solidity 0.7.5; -import "@uniswap/lib/contracts/libraries/TransferHelper.sol"; -import "./ERC20Interface.sol"; +import '@uniswap/lib/contracts/libraries/TransferHelper.sol'; +import './ERC20Interface.sol'; /** * Contract that will forward any incoming Ether to the creator of the contract @@ -23,10 +23,10 @@ contract Forwarder { return; } - (bool success, ) = parentAddress.call{ value: value }(""); - require(success, "Flush failed"); - // NOTE: since we are forwarding on initialization, - // we don't have the context of the original sender. + (bool success, ) = parentAddress.call{ value: value }(''); + require(success, 'Flush failed'); + // NOTE: since we are forwarding on initialization, + // we don't have the context of the original sender. // We still emit an event about the forwarding but set // the sender to the forwarder itself emit ForwarderDeposited(address(this), value, msg.data); @@ -36,7 +36,7 @@ contract Forwarder { * Modifier that will execute internal code block only if the sender is the parent address */ modifier onlyParent { - require(msg.sender == parentAddress, "Only Parent"); + require(msg.sender == parentAddress, 'Only Parent'); _; } @@ -44,7 +44,7 @@ contract Forwarder { * Modifier that will execute internal code block only if the contract has not been initialized yet */ modifier onlyUninitialized { - require(parentAddress == address(0x0), "Already initialized"); + require(parentAddress == address(0x0), 'Already initialized'); _; } @@ -74,7 +74,11 @@ contract Forwarder { return; } - TransferHelper.safeTransfer(tokenContractAddress, parentAddress, forwarderBalance); + TransferHelper.safeTransfer( + tokenContractAddress, + parentAddress, + forwarderBalance + ); } /** @@ -87,8 +91,8 @@ contract Forwarder { return; } - (bool success, ) = parentAddress.call{ value: value }(""); - require(success, "Flush failed"); + (bool success, ) = parentAddress.call{ value: value }(''); + require(success, 'Flush failed'); emit ForwarderDeposited(msg.sender, value, msg.data); } } diff --git a/contracts/ForwarderFactory.sol b/contracts/ForwarderFactory.sol index 1b3ed59..2ad4a97 100644 --- a/contracts/ForwarderFactory.sol +++ b/contracts/ForwarderFactory.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: Apache-2.0 pragma solidity 0.7.5; -import "./Forwarder.sol"; -import "./CloneFactory.sol"; +import './Forwarder.sol'; +import './CloneFactory.sol'; contract ForwarderFactory is CloneFactory { address public implementationAddress; diff --git a/contracts/WalletFactory.sol b/contracts/WalletFactory.sol index c8b0a4f..51f89d7 100644 --- a/contracts/WalletFactory.sol +++ b/contracts/WalletFactory.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: Apache-2.0 pragma solidity 0.7.5; -import "./WalletSimple.sol"; -import "./CloneFactory.sol"; +import './WalletSimple.sol'; +import './CloneFactory.sol'; contract WalletFactory is CloneFactory { address public implementationAddress; diff --git a/contracts/WalletSimple.sol b/contracts/WalletSimple.sol index d778736..8d8c0f6 100644 --- a/contracts/WalletSimple.sol +++ b/contracts/WalletSimple.sol @@ -1,8 +1,8 @@ // SPDX-License-Identifier: Apache-2.0 pragma solidity 0.7.5; -import "@uniswap/lib/contracts/libraries/TransferHelper.sol"; -import "./Forwarder.sol"; -import "./ERC20Interface.sol"; +import '@uniswap/lib/contracts/libraries/TransferHelper.sol'; +import './Forwarder.sol'; +import './ERC20Interface.sol'; /** * @@ -70,10 +70,10 @@ contract WalletSimple { * @param allowedSigners An array of signers on the wallet */ function init(address[] calldata allowedSigners) external onlyUninitialized { - require(allowedSigners.length == 3, "Invalid number of signers"); + require(allowedSigners.length == 3, 'Invalid number of signers'); for (uint8 i = 0; i < allowedSigners.length; i++) { - require(allowedSigners[i] != address(0), "Invalid signer"); + require(allowedSigners[i] != address(0), 'Invalid signer'); signers[allowedSigners[i]] = true; } initialized = true; @@ -88,7 +88,7 @@ contract WalletSimple { * not pick up on state variables */ function getNetworkId() internal virtual pure returns (string memory) { - return "ETHER"; + return 'ETHER'; } /** @@ -100,7 +100,7 @@ contract WalletSimple { * not pick up on state variables */ function getTokenNetworkId() internal virtual pure returns (string memory) { - return "ERC20"; + return 'ERC20'; } /** @@ -112,7 +112,7 @@ contract WalletSimple { * not pick up on state variables */ function getBatchNetworkId() internal virtual pure returns (string memory) { - return "ETHER-Batch"; + return 'ETHER-Batch'; } /** @@ -128,7 +128,7 @@ contract WalletSimple { * Modifier that will execute internal code block only if the sender is an authorized signer on this wallet */ modifier onlySigner { - require(isSigner(msg.sender), "Non-signer in onlySigner method"); + require(isSigner(msg.sender), 'Non-signer in onlySigner method'); _; } @@ -136,7 +136,7 @@ contract WalletSimple { * Modifier that will execute internal code block only if the contract has not been initialized yet */ modifier onlyUninitialized { - require(!initialized, "Contract already initialized"); + require(!initialized, 'Contract already initialized'); _; } @@ -201,7 +201,7 @@ contract WalletSimple { // Success, send the transaction (bool success, ) = toAddress.call{ value: value }(data); - require(success, "Call execution failed"); + require(success, 'Call execution failed'); emit Transacted( msg.sender, @@ -231,12 +231,12 @@ contract WalletSimple { uint256 sequenceId, bytes calldata signature ) external onlySigner { - require(recipients.length != 0, "Not enough recipients"); + require(recipients.length != 0, 'Not enough recipients'); require( recipients.length == values.length, - "Unequal recipients and values" + 'Unequal recipients and values' ); - require(recipients.length < 256, "Too many recipients, max 255"); + require(recipients.length < 256, 'Too many recipients, max 255'); // Verify the other signer bytes32 operationHash = keccak256( @@ -251,7 +251,7 @@ contract WalletSimple { // the first parameter (toAddress) is used to ensure transactions in safe mode only go to a signer // if in safe mode, we should use normal sendMultiSig to recover, so this check will always fail if in safe mode - require(!safeMode, "Batch in safe mode"); + require(!safeMode, 'Batch in safe mode'); address otherSigner = verifyMultiSig( address(0x0), operationHash, @@ -276,10 +276,10 @@ contract WalletSimple { uint256[] calldata values ) internal { for (uint256 i = 0; i < recipients.length; i++) { - require(address(this).balance >= values[i], "Insufficient funds"); + require(address(this).balance >= values[i], 'Insufficient funds'); - (bool success, ) = recipients[i].call{ value: values[i] }(""); - require(success, "Call failed"); + (bool success, ) = recipients[i].call{ value: values[i] }(''); + require(success, 'Call failed'); emit BatchTransfer(msg.sender, recipients[i], values[i]); } @@ -316,13 +316,7 @@ contract WalletSimple { ) ); - verifyMultiSig( - toAddress, - operationHash, - signature, - expireTime, - sequenceId - ); + verifyMultiSig(toAddress, operationHash, signature, expireTime, sequenceId); TransferHelper.safeTransfer(tokenContractAddress, toAddress, value); } @@ -361,17 +355,17 @@ contract WalletSimple { address otherSigner = recoverAddressFromSignature(operationHash, signature); // Verify if we are in safe mode. In safe mode, the wallet can only send to signers - require(!safeMode || isSigner(toAddress), "External transfer in safe mode"); + require(!safeMode || isSigner(toAddress), 'External transfer in safe mode'); // Verify that the transaction has not expired - require(expireTime >= block.timestamp, "Transaction expired"); + require(expireTime >= block.timestamp, 'Transaction expired'); // Try to insert the sequence ID. Will revert if the sequence id was invalid tryUpdateSequenceId(sequenceId); - require(isSigner(otherSigner), "Invalid signer"); + require(isSigner(otherSigner), 'Invalid signer'); - require(otherSigner != msg.sender, "Signers cannot be equal"); + require(otherSigner != msg.sender, 'Signers cannot be equal'); return otherSigner; } @@ -394,7 +388,7 @@ contract WalletSimple { bytes32 operationHash, bytes memory signature ) private pure returns (address) { - require(signature.length == 65, "Invalid signature - wrong length"); + require(signature.length == 65, 'Invalid signature - wrong length'); // We need to unpack the signature, which is given as an array of 65 bytes (like eth.sign) bytes32 r; @@ -414,7 +408,11 @@ contract WalletSimple { // protect against signature malleability // S value must be in the lower half orader // reference: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/051d340171a93a3d401aaaea46b4b62fa81e5d7c/contracts/cryptography/ECDSA.sol#L53 - require(uint256(s) <= 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0, "ECDSA: invalid signature 's' value"); + require( + uint256(s) <= + 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0, + "ECDSA: invalid signature 's' value" + ); // note that this returns 0 if the signature is invalid // Since 0x0 can never be a signer, when the recovered signer address @@ -428,13 +426,13 @@ contract WalletSimple { * @param sequenceId The new sequenceId to use */ function tryUpdateSequenceId(uint256 sequenceId) private onlySigner { - require(sequenceId > lastSequenceId, "sequenceId is too low"); + require(sequenceId > lastSequenceId, 'sequenceId is too low'); // Block sequence IDs which are much higher than the current // This prevents people blocking the contract by using very large sequence IDs quickly require( sequenceId <= lastSequenceId + MAX_SEQUENCE_ID_INCREASE, - "sequenceId is too high" + 'sequenceId is too high' ); lastSequenceId = sequenceId; diff --git a/test/batcher.js b/test/batcher.js index 5e3543e..7ff8841 100644 --- a/test/batcher.js +++ b/test/batcher.js @@ -8,7 +8,7 @@ const FixedSupplyToken = artifacts.require('./FixedSupplyToken.sol'); const Tether = artifacts.require('./TetherToken.sol'); const BatcherTransferEvent = - '0xc42fa155158786a1dd6ccc3a785f35845467353c3cc700e0e31a79f90e22227d'; + '0xc42fa155158786a1dd6ccc3a785f35845467353c3cc700e0e31a79f90e22227d'; const { getBalance, abi: ethAbi } = web3.eth; const { toBN } = web3.utils; @@ -52,11 +52,11 @@ const assertVMException = async (promise, expectedExceptionMsg) => { assert.strictEqual( err.reason || '', expectedExceptionMsg, - 'Didn\'t receive expected VM exception' + "Didn't receive expected VM exception" ); } if (badSucceed) { - assert.fail('Didn\'t throw any exception'); + assert.fail("Didn't throw any exception"); } }; @@ -126,7 +126,7 @@ contract('Batcher', (accounts) => { const value = toBN('0x' + data.slice(130)).toString(); if ( recipients[i] !== reentryInstance.address && - recipients[i] !== failInstance.address + recipients[i] !== failInstance.address ) { assert( recipients.find((elem) => recipientAddress === elem.toLowerCase()), @@ -205,14 +205,14 @@ contract('Batcher', (accounts) => { startBalance, endBalance, 0, - 'Address that shouldn\'t have received funds did' + "Address that shouldn't have received funds did" ); } else { assertBalanceDiff( startBalance, endBalance, value, - 'Valid account didn\'t receive funds' + "Valid account didn't receive funds" ); } } @@ -281,7 +281,7 @@ contract('Batcher', (accounts) => { const params = { recipients: accounts.slice(1, 4), values: createRandIntArr(3), - extraValue: 50, + extraValue: 50 }; await runTestBatcherDriver(params); }); @@ -312,7 +312,7 @@ contract('Batcher', (accounts) => { accounts[4] ], values: createRandIntArr(6), - extraValue: 100, + extraValue: 100 }; await runTestBatcherDriver(params); }); @@ -348,7 +348,6 @@ contract('Batcher', (accounts) => { }); describe('Failed transactions', () => { - it('Correctly fails whole transaction with one reentrant contract', async () => { const params = { recipients: [reentryInstance.address, accounts[1], accounts[2]], @@ -426,7 +425,6 @@ contract('Batcher', (accounts) => { await runTestBatcherDriver(params); }); - it('Fails with empty recipients and values', async () => { const params = { recipients: [], @@ -628,12 +626,12 @@ contract('Batcher', (accounts) => { assert.strictEqual( prevOwner, oldBatcherOwner, - 'Log emitted for ownership change doesn\'t reflect old owner' + "Log emitted for ownership change doesn't reflect old owner" ); assert.strictEqual( newOwner, newBatcherOwner, - 'Log emitted for ownership change doesn\'t reflect new owner' + "Log emitted for ownership change doesn't reflect new owner" ); }; @@ -651,7 +649,7 @@ contract('Batcher', (accounts) => { assert.strictEqual( newTransferGasLimit.toNumber(), newGasLimit, - 'Log emitted for transfer gas limit change doesn\'t reflect new limit' + "Log emitted for transfer gas limit change doesn't reflect new limit" ); }; @@ -733,7 +731,6 @@ contract('Batcher', (accounts) => { ); }; - const getTokenTransferData = (address, value) => { return ethAbi.encodeFunctionCall( { @@ -756,7 +753,12 @@ contract('Batcher', (accounts) => { const getUSDTTokenTransferData = (address, value) => { const methodId = '0xa9059cbb'; - return methodId + ethAbi.encodeParameters(['address','uint'],[address, value]).substring(2); + return ( + methodId + + ethAbi + .encodeParameters(['address', 'uint'], [address, value]) + .substring(2) + ); }; beforeEach(async () => { @@ -771,10 +773,16 @@ contract('Batcher', (accounts) => { await checkBalance(batcherInstance.address, 5); }); - it('Correctly recover USDT tokens' , async () => { - const tetherTokenContract = await Tether.new('1000000', 'USDT', 'USDT', 6, { - from: batcherOwner - }); + it('Correctly recover USDT tokens', async () => { + const tetherTokenContract = await Tether.new( + '1000000', + 'USDT', + 'USDT', + 6, + { + from: batcherOwner + } + ); await tetherTokenContract.transfer(batcherInstance.address, 100, { from: batcherOwner @@ -789,8 +797,12 @@ contract('Batcher', (accounts) => { { from: batcherOwner } ); - const batcherBalance = await tetherTokenContract.balanceOf.call(batcherInstance.address); - const senderBalance = await tetherTokenContract.balanceOf.call(batcherOwner); + const batcherBalance = await tetherTokenContract.balanceOf.call( + batcherInstance.address + ); + const senderBalance = await tetherTokenContract.balanceOf.call( + batcherOwner + ); assert.strictEqual( batcherBalance.toString(), @@ -815,7 +827,7 @@ contract('Batcher', (accounts) => { await checkBalance(tokenContractOwner, totalSupply); }); - it('Doesn\'t allow an address other than the owner to transfer tokens', async () => { + it("Doesn't allow an address other than the owner to transfer tokens", async () => { const tokenTransferData = getTokenTransferData(accounts[1], 5); await assertVMException( batcherInstance.recover(tokenContract.address, 0, tokenTransferData, { @@ -836,7 +848,7 @@ contract('Batcher', (accounts) => { assert.strictEqual( ethAbi.decodeParameter('bool', res), false, - 'Token transfer shouldn\'t have been successful' + "Token transfer shouldn't have been successful" ); await checkBalance(tokenContractOwner, totalSupply - 5); }); diff --git a/test/walletsimple.js b/test/walletsimple.js index 9ebebb8..91d48b6 100644 --- a/test/walletsimple.js +++ b/test/walletsimple.js @@ -1575,7 +1575,7 @@ coins.forEach( await expectFailSendMultiSigBatch(params, 'Call failed'); }); - it('Doesn\'t fail if one contract uses a lot of gas but doesn\'t run out', async function () { + it("Doesn't fail if one contract uses a lot of gas but doesn't run out", async function () { sequenceId = 1001; const params = { msgSenderAddress: accounts[0], diff --git a/truffle.js b/truffle.js index 02ff14a..b7ceeb6 100644 --- a/truffle.js +++ b/truffle.js @@ -1,9 +1,9 @@ module.exports = { networks: { development: { - host: "localhost", + host: 'localhost', port: 8545, - network_id: "*", // Match any network id + network_id: '*', // Match any network id // https://github.com/trufflesuite/truffle/issues/271#issuecomment-341651827 gas: 2900000, websockets: true @@ -11,7 +11,7 @@ module.exports = { }, compilers: { solc: { - version: "0.7.5" + version: '0.7.5' } } };