Skip to content

Commit

Permalink
Merge branch 'master' into redemption-fee
Browse files Browse the repository at this point in the history
  • Loading branch information
alsco77 committed Jul 14, 2020
2 parents 58709ca + e6357a7 commit 7354e26
Show file tree
Hide file tree
Showing 11 changed files with 1,212 additions and 1,019 deletions.
10 changes: 2 additions & 8 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,7 @@ orbs:
jobs:
build:
docker:
- image: circleci/node:10.15.3
# The secondary container is an instance of the second listed image which is run in a common network
# where ports exposed on the primary container are available on localhost.
- image: trufflesuite/ganache-cli
command: ganache-cli -p 7545 --gasLimit 9000000
- image: circleci/node:10.15.3
resource_class: medium+
steps:
- checkout
Expand All @@ -34,11 +30,9 @@ jobs:
- run:
name: Produce Coverage Report
command: yarn coverage
# - coveralls/upload
- coveralls/upload
- store_artifacts:
path: ./coverage
- store_artifacts:
path: ./.coverage.json
- save_cache:
key: dependency-cache-{{ checksum "package.json" }}
paths:
Expand Down
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,10 @@ typings/
# next.js build output
.next

# truffle
# truffle / buidler
cache/
build/
artifacts/
contracts-output/

# TSC
Expand All @@ -48,6 +50,7 @@ package-lock.json
.vscode/

# solcover
.coverage_cache/
.coverage_artifacts/
.coverage_contracts/
coverage.json
Expand Down
3 changes: 2 additions & 1 deletion .solcover.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ module.exports = {
'Migrations.sol',
'interfaces',
'z_mocks',
'shared/InitializableReentrancyGuard.sol'
'shared/InitializableReentrancyGuard.sol',
'integrations'
]
};
24 changes: 24 additions & 0 deletions buidler.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { usePlugin } from "@nomiclabs/buidler/config";

require("ts-node/register");
require("tsconfig-paths/register");

usePlugin("solidity-coverage");
usePlugin("@nomiclabs/buidler-truffle5");
usePlugin("buidler-gas-reporter");

export default {
networks: {
buidlerevm: { allowUnlimitedContractSize: true },
localhost: { url: "http://localhost:8545" },
coverage: {
url: "http://localhost:7546",
},
},
solc: { version: "0.5.16" },
paths: { artifacts: "./build/contracts" },
gasReporter: {
currency: "USD",
gasPrice: 30,
},
};
31 changes: 17 additions & 14 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,22 +11,24 @@
"lint": "yarn run lint-ts; yarn run lint-sol",
"lint-ts": "yarn eslint ./test --ext .ts,.js --fix --quiet",
"lint-sol": "solium -d contracts/ --fix ",
"coverage": "node --max_old_space_size=6144 node_modules/truffle/build/cli.bundled.js run coverage --network coverage --solcoverjs './.solcover.js'",
"coverage": "node --max_old_space_size=6144 node_modules/.bin/buidler coverage --network coverage --solcoverjs ./.solcover.js --testfiles 'test/**/Test*.ts' --show-stack-traces",
"script": "yarn truffle exec ./scripts/main.js",
"test": "yarn run test-prep; truffle test;",
"test:fork": "yarn run test-prep; truffle test --network fork;",
"test": "yarn run test-prep; yarn buidler test;",
"test:fork": "yarn run test-prep; yarn buidler test --network fork;",
"test-prep": "yarn run compile; yarn run generate-typings;",
"test-lite": " truffle test",
"compile": "truffle compile --all",
"test-lite": " yarn buidler test",
"compile": "yarn buidler compile --force",
"generate-typings": "rimraf ./types/generated && typechain --target 'truffle-v5' --outDir types/generated './build/contracts/*.json'",
"prettify": "prettier --write test/*.ts test/**/*.ts types/generated/*.ts types/*.ts artifacts/*.ts",
"flatten": "sol-merger \"./contracts/**/*.sol\" ./_flat"
},
"repository": {
"type": "git",
"url": "git+https://github.com/mstable/mstable-contracts.git"
"repository": {
"type": "git",
"url": "git+https://github.com/mstable/mstable-contracts.git"
},
"devDependencies": {
"@nomiclabs/buidler-truffle5": "^1.3.4",
"@nomiclabs/buidler-web3": "^1.3.4",
"@openzeppelin/contracts": "2.5.0",
"@openzeppelin/test-helpers": "git+https://git@github.com/alsco77/openzeppelin-test-helpers.git",
"@openzeppelin/upgrades": "2.7.2",
Expand All @@ -40,6 +42,7 @@
"@typescript-eslint/eslint-plugin": "^2.21.0",
"@typescript-eslint/eslint-plugin-tslint": "^2.21.0",
"@typescript-eslint/parser": "^2.21.0",
"buidler-gas-reporter": "0.1.4-beta.4",
"chai": "^4.2.0",
"chai-bn": "^0.2.0",
"chalk": "^3.0.0",
Expand All @@ -50,29 +53,29 @@
"eslint-plugin-import": "^2.20.1",
"eslint-plugin-jsx-a11y": "^6.2.3",
"eslint-plugin-react": "^7.18.3",
"eth-gas-reporter": "^0.2.14",
"ethlint": "^1.2.5",
"humanize-duration": "^3.21.0",
"mocha": "^7.0.1",
"parse-duration": "^0.1.2",
"prettier": "^1.18.2",
"solc": "0.5.16",
"solidity-coverage": "^0.7.1",
"solidity-coverage": "^0.7.9",
"truffle": "5.1.22",
"truffle-plugin-verify": "^0.3.10",
"truffle-typings": "^1.0.8",
"ts-node": "^8.4.1",
"tsconfig-paths": "^3.9.0",
"typechain": "^2.0.0",
"types-ethereumjs-util": "^0.0.8",
"typescript": "^3.6.3",
"web3": "^1.2.6",
"web3-utils": "1.2.6"
},
"dependencies": {
"sol-merger": "^3.0.1"
"@nomiclabs/buidler": "^1.3.8",
"sol-merger": "^3.0.1",
"ts-node": "^8.4.1",
"tsconfig-paths": "^3.9.0"
},
"_moduleAliases": {
"@utils": "transpiled/test-utils"
}
}
}
4 changes: 2 additions & 2 deletions test/masset/TestBasketManager.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1419,7 +1419,7 @@ contract("BasketManager", async (accounts) => {
const movedBassetIntegratorAfter = await mockBasketManager.getBassetIntegrator(
movedBasset,
);
await expectRevert(mockBasketManager.integrations(3), "invalid opcode");
await expectRevert.assertion(mockBasketManager.integrations(3));

expect(unmovedBassetIntegratorBefore).eq(unmovedBassetIntegratorAfter);
expect(movedBassetIntegratorBefore).eq(movedBassetIntegratorAfter);
Expand Down Expand Up @@ -1460,7 +1460,7 @@ contract("BasketManager", async (accounts) => {
const unmovedBassetIntegratorAfter = await mockBasketManager.getBassetIntegrator(
unMovedBasset,
);
await expectRevert(mockBasketManager.integrations(3), "invalid opcode");
await expectRevert.assertion(mockBasketManager.integrations(3));

expect(unmovedBassetIntegratorBefore).eq(unmovedBassetIntegratorAfter);
expect(unmovedBassetBefore.maxWeight).eq(unmovedBassetAfter.maxWeight);
Expand Down
2 changes: 1 addition & 1 deletion test/masset/TestMassetRedemption.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -887,7 +887,7 @@ contract("Masset - Redeem", async (accounts) => {
{ from: sa.default },
);
// Do the redemption
for (let i = 0; i < onChainBassets.length; i += 1) {
for (let i = 0; i < 5; i += 1) {
await assertBasicRedemption(
massetDetails,
new BN(1),
Expand Down
3 changes: 1 addition & 2 deletions test/savings/TestSavingsManager.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,6 @@ contract("SavingsManager", async (accounts) => {
before(async () => {
savingsManager = await createNewSavingsManager();
});

it("should collect the interest first time", async () => {
// Refresh the collection timer
await savingsManager.collectAndDistributeInterest(mUSD.address);
Expand Down Expand Up @@ -363,7 +362,7 @@ contract("SavingsManager", async (accounts) => {
assertBNClose(
interectCollectedEvent.args[3],
expectedAPY,
simpleToExactAmount(1, 14), // allow for a 0.01% deviation in the percentage
simpleToExactAmount(2, 14), // allow for a 0.02% deviation in the percentage
);

const balanceAfter = await mUSD.balanceOf(savingsContract.address);
Expand Down
10 changes: 2 additions & 8 deletions test/shared/TestCommonHelpers.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,14 +59,8 @@ contract("CommonHelpers", async (accounts) => {
});

it("should fail if passed dud addresses", async () => {
await expectRevert(
commonHelpers.getDecimals(ZERO_ADDRESS),
"Returned error: VM Exception while processing transaction: revert",
);
await expectRevert(
commonHelpers.getDecimals(sa.default),
"Returned error: VM Exception while processing transaction: revert",
);
await expectRevert.unspecified(commonHelpers.getDecimals(ZERO_ADDRESS));
await expectRevert.unspecified(commonHelpers.getDecimals(sa.default));
});
it("should fail if the token has lt 4 or gt 18 decimals", async () => {
await expectRevert(
Expand Down
3 changes: 2 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
"./test-utils/*.ts",
"./test-utils/**/*.ts",
"./migrations/**/*.ts",
"./migrations/*.js"
"./migrations/*.js",
"./buidler.config.ts"
]
}

0 comments on commit 7354e26

Please sign in to comment.