Skip to content
This repository was archived by the owner on Jan 18, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ version: 2
jobs:
checkout_and_compile:
docker:
- image: circleci/node:9.6.1
- image: circleci/node:10.11.0
working_directory: ~/set-protocol-strategies
steps:
- checkout
Expand All @@ -27,7 +27,7 @@ jobs:
- ~/set-protocol-strategies
test:
docker:
- image: circleci/node:9.6.1
- image: circleci/node:10.11.0
working_directory: ~/set-protocol-strategies
parallelism: 2
steps:
Expand All @@ -53,7 +53,7 @@ jobs:

coverage:
docker:
- image: circleci/node:9.6.1
- image: circleci/node:10.11.0
working_directory: ~/set-protocol-strategies
steps:
- setup_remote_docker:
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
"precommit": "lint-staged",
"prepare-test": "yarn setup && yarn transpile",
"profile-gas": "yarn prepare-test && truffle test `find transpiled/test/profile -name '*.spec.js'`",
"postinstall": "bash scripts/fix-web3-eth-abi.sh",
"setup": "yarn clean && yarn deploy-development && yarn generate-typings",
"test": "yarn prepare-test && yarn truffle-test-contracts",
"test-nocompile": "yarn transpile && yarn truffle-test-contracts",
Expand Down Expand Up @@ -73,7 +74,7 @@
"ethereumjs-abi": "^0.6.4",
"ethereumjs-util": "^5.1.2",
"ethjs-abi": "^0.2.1",
"ganache-cli": "^6.1.2",
"ganache-cli": "^6.3.0",
"import-sort-cli": "^4.2.0",
"import-sort-parser-babylon": "^4.2.0",
"import-sort-style-eslint": "^4.2.0",
Expand Down
8 changes: 8 additions & 0 deletions scripts/fix-web3-eth-abi.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
if [[ "$OSTYPE" == "darwin"* ]]; then
# Mac OSX
[ -f "node_modules/web3-eth-abi/src/index.js" ] && sed -i '' 's/(nonIndexedData)/(nonIndexedData \&\& nonIndexedData !== "0x")/' node_modules/web3-eth-abi/src/index.js
[ -f "node_modules/web3-eth-contract/src/index.js" ] && sed -i '' 's/abi.decodeParameters(outputs, returnValues)/(returnValues \&\& returnValues !== "0x") ? abi.decodeParameters(outputs, returnValues) : []/' node_modules/web3-eth-contract/src/index.js
else
[ -f "node_modules/web3-eth-abi/src/index.js" ] && sed -i 's/(nonIndexedData)/(nonIndexedData \&\& nonIndexedData !== "0x")/' node_modules/web3-eth-abi/src/index.js
[ -f "node_modules/web3-eth-contract/src/index.js" ] && sed -i 's/abi.decodeParameters(outputs, returnValues)/(returnValues \&\& returnValues !== "0x") ? abi.decodeParameters(outputs, returnValues) : []/' node_modules/web3-eth-contract/src/index.js
fi
5 changes: 4 additions & 1 deletion test/contracts/managers/assetPairManager.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ import {
} from '@utils/constants';

import { expectRevertError } from '@utils/tokenAssertions';
import { getWeb3 } from '@utils/web3Helper';
import { getWeb3, blankTxn } from '@utils/web3Helper';

import { ERC20Helper } from '@utils/helpers/erc20Helper';
import { ManagerHelper } from '@utils/helpers/managerHelper';
Expand Down Expand Up @@ -473,6 +473,7 @@ contract('AssetPairManager', accounts => {
);

await blockchain.increaseTimeAsync(timeJump);
await blankTxn(deployerAccount);

subjectCaller = deployerAccount;
});
Expand Down Expand Up @@ -973,6 +974,7 @@ contract('AssetPairManager', accounts => {
);

await blockchain.increaseTimeAsync(timeJump);
await blankTxn(deployerAccount);

subjectCaller = deployerAccount;
});
Expand Down Expand Up @@ -1190,6 +1192,7 @@ contract('AssetPairManager', accounts => {

async function subject(): Promise<boolean> {
await blockchain.increaseTimeAsync(subjectTimeFastForward);
await blankTxn(subjectCaller);
return setManager.canConfirmPropose.callAsync(
{ from: subjectCaller, gas: DEFAULT_GAS}
);
Expand Down
11 changes: 10 additions & 1 deletion utils/web3Helper.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const Web3 = require('web3'); // import web3 v1.0 constructor
const BigNumber = require('bignumber.js');
import { DEFAULT_GAS } from './constants';
import { DEFAULT_GAS, NULL_ADDRESS } from './constants';

// use globally injected web3 to find the currentProvider and wrap with web3 v1.0
export const getWeb3 = () => {
Expand All @@ -26,4 +26,13 @@ export const getGasUsageInEth = async txHash => {

export const txnFrom = (from: string) => {
return { from, gas: DEFAULT_GAS };
};

export const blankTxn = async (from: string) => {
const web3 = getWeb3();
await web3.eth.sendTransaction({
from,
to: NULL_ADDRESS,
value: '1',
});
};
Loading