forked from UMAprotocol/protocol
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor eslint and prettier linter implementation (UMAprotocol#1202)
* updated linter implementation Signed-off-by: Christopher Maree <christopher.maree@gmail.com> * Another test Signed-off-by: Christopher Maree <christopher.maree@gmail.com> * test Signed-off-by: Christopher Maree <christopher.maree@gmail.com> * updated .gitignore Signed-off-by: Christopher Maree <christopher.maree@gmail.com> * test Signed-off-by: Christopher Maree <christopher.maree@gmail.com> * update Signed-off-by: Christopher Maree <christopher.maree@gmail.com> * removed file Signed-off-by: Christopher Maree <christopher.maree@gmail.com> * test auto lint Signed-off-by: Christopher Maree <christopher.maree@gmail.com> * update comment Signed-off-by: Christopher Maree <christopher.maree@gmail.com> * final test Signed-off-by: Christopher Maree <christopher.maree@gmail.com> * test pretty-quick Signed-off-by: Christopher Maree <christopher.maree@gmail.com> * lint test Signed-off-by: Christopher Maree <christopher.maree@gmail.com> * fixed contract test Signed-off-by: Christopher Maree <christopher.maree@gmail.com> * lint test Signed-off-by: Christopher Maree <christopher.maree@gmail.com> * test Signed-off-by: Christopher Maree <christopher.maree@gmail.com> * fixed star box Signed-off-by: Christopher Maree <christopher.maree@gmail.com> * reverted file changes Signed-off-by: Christopher Maree <christopher.maree@gmail.com> * updated package.json Signed-off-by: Christopher Maree <christopher.maree@gmail.com> * updated package.json Signed-off-by: Christopher Maree <christopher.maree@gmail.com> * Revert Voting.sol * reverted package version for circleCI Signed-off-by: Christopher Maree <christopher.maree@gmail.com> * locked version Signed-off-by: Christopher Maree <christopher.maree@gmail.com> * Updated price feed Signed-off-by: Christopher Maree <christopher.maree@gmail.com> * updated liquidator bot Signed-off-by: Christopher Maree <christopher.maree@gmail.com> * test commit Signed-off-by: Christopher Maree <christopher.maree@gmail.com> * test no verify Signed-off-by: Christopher Maree <christopher.maree@gmail.com> * test lint-fix Signed-off-by: Christopher Maree <christopher.maree@gmail.com> * test Signed-off-by: Christopher Maree <christopher.maree@gmail.com> * test Signed-off-by: Christopher Maree <christopher.maree@gmail.com>
- Loading branch information
1 parent
50a88a3
commit 97a1602
Showing
16 changed files
with
170 additions
and
136 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
node_modules | ||
coverage | ||
docs | ||
modules | ||
public | ||
ui | ||
sponsor-dapp-v2 | ||
voter-dapp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
node_modules | ||
coverage | ||
docs | ||
modules | ||
public | ||
ui | ||
*/build/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,7 +7,7 @@ | |
{ | ||
"files": "*.sol", | ||
"options": { | ||
"tabWidth": 4, | ||
"tabWidth": 4 | ||
} | ||
} | ||
] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,4 +5,4 @@ PROTOCOL_DIR=$(pwd) | |
|
||
# Lint JS | ||
echo "Linting Solidity and js" | ||
npm run lint_check | ||
npm run lint |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,57 +1,54 @@ | ||
const { delay } = require('../delay'); | ||
const { delay } = require("../delay"); | ||
|
||
const { GasEstimator } = require("../GasEstimator"); | ||
|
||
contract("GasEstimator.js", function() { | ||
|
||
let gasEstimator; | ||
|
||
|
||
describe("Construction with default config", () => { | ||
beforeEach(() => { | ||
gasEstimator = new GasEstimator(); | ||
}) | ||
gasEstimator = new GasEstimator(); | ||
}); | ||
|
||
it("Default parameters are set correctly", () => { | ||
assert(gasEstimator.updateThreshold > 0); | ||
assert(gasEstimator.defaultFastPriceGwei > 0); | ||
assert(gasEstimator.updateThreshold > 0); | ||
assert(gasEstimator.defaultFastPriceGwei > 0); | ||
}); | ||
it("Returns gas prices in wei before initial update", () => { | ||
assert.equal(gasEstimator.defaultFastPriceGwei, gasEstimator.getCurrentFastPrice()/1e9); | ||
assert.equal(gasEstimator.defaultFastPriceGwei, gasEstimator.getCurrentFastPrice() / 1e9); | ||
}); | ||
it("Returns gas prices in wei after update", async () => { | ||
await gasEstimator.update(); | ||
const latestFastGasPrice = gasEstimator.getCurrentFastPrice() / 1e9; | ||
if (latestFastGasPrice === gasEstimator.defaultFastPriceGwei) { | ||
console.log(`API Request to ethgasstation.info failed, using default gas price in Gwei: ${latestFastGasPrice}`); | ||
} | ||
assert(latestFastGasPrice > 0); | ||
await gasEstimator.update(); | ||
const latestFastGasPrice = gasEstimator.getCurrentFastPrice() / 1e9; | ||
if (latestFastGasPrice === gasEstimator.defaultFastPriceGwei) { | ||
console.log(`API Request to ethgasstation.info failed, using default gas price in Gwei: ${latestFastGasPrice}`); | ||
} | ||
assert(latestFastGasPrice > 0); | ||
}); | ||
it("Does not update if called before update threshold", async () => { | ||
await gasEstimator.update(); | ||
const lastUpdateTimestamp = gasEstimator.lastUpdateTimestamp; | ||
await delay(Number(1_000)); | ||
await gasEstimator.update(); | ||
assert.equal(lastUpdateTimestamp, gasEstimator.lastUpdateTimestamp); | ||
await gasEstimator.update(); | ||
const lastUpdateTimestamp = gasEstimator.lastUpdateTimestamp; | ||
await delay(Number(1_000)); | ||
await gasEstimator.update(); | ||
assert.equal(lastUpdateTimestamp, gasEstimator.lastUpdateTimestamp); | ||
}); | ||
}); | ||
|
||
describe("Construction with custom config", () => { | ||
beforeEach(() => { | ||
gasEstimator = new GasEstimator(updateThreshold=1.5, defaultFastPriceGwei=10); | ||
gasEstimator = new GasEstimator((updateThreshold = 1.5), (defaultFastPriceGwei = 10)); | ||
}); | ||
|
||
it("Default parameters are set correctly", () => { | ||
assert.equal(gasEstimator.updateThreshold, 1.5); | ||
assert.equal(gasEstimator.defaultFastPriceGwei, 10); | ||
assert.equal(gasEstimator.updateThreshold, 1.5); | ||
assert.equal(gasEstimator.defaultFastPriceGwei, 10); | ||
}); | ||
it("Updates if called after update threshold", async () => { | ||
await gasEstimator.update(); | ||
const lastUpdateTimestamp = gasEstimator.lastUpdateTimestamp; | ||
await delay(Number(2_000)); | ||
await gasEstimator.update(); | ||
assert.isTrue(lastUpdateTimestamp < gasEstimator.lastUpdateTimestamp); | ||
await gasEstimator.update(); | ||
const lastUpdateTimestamp = gasEstimator.lastUpdateTimestamp; | ||
await delay(Number(1_500)); | ||
await gasEstimator.update(); | ||
assert(lastUpdateTimestamp < gasEstimator.lastUpdateTimestamp); | ||
}); | ||
}); | ||
|
||
}); |
Oops, something went wrong.