Skip to content

Commit 6be590c

Browse files
authored
chore: lint contracts package with graph custom config (#958)
Signed-off-by: Tomás Migone <[email protected]>
1 parent 09284ef commit 6be590c

File tree

142 files changed

+1049
-2272
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

142 files changed

+1049
-2272
lines changed

.github/workflows/ci.yml .github/workflows/ci-contracts.yml

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: CI
1+
name: CI - packages/contracts
22

33
env:
44
CI: true
@@ -23,7 +23,9 @@ jobs:
2323
- name: Set up environment
2424
uses: ./.github/actions/setup
2525
- name: Run tests
26-
run: yarn test:coverage
26+
run: |
27+
pushd packages/contracts
28+
yarn test:coverage
2729
- name: Upload coverage report
2830
uses: codecov/codecov-action@v3
2931
with:

.github/workflows/ci-token-dist.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: CI
1+
name: CI - packages/token-distribution
22

33
env:
44
CI: true

.github/workflows/e2e.yml .github/workflows/e2e-contracts.yml

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: E2E
1+
name: E2E - packages/contracts
22

33
env:
44
CI: true
@@ -41,4 +41,5 @@ jobs:
4141
sed -i'' -e 's/^\(.*dev.period.*\)/# \1/' docker-compose.yaml
4242
./test-node.bash --init --batchposters 0 --redundantsequencers 0 --detach
4343
popd
44+
pushd packages/contracts
4445
L1_NETWORK=localnitrol1 L2_NETWORK=localnitrol2 yarn test:e2e

packages/contracts/.eslintignore

-7
This file was deleted.

packages/contracts/.eslintrc

-19
This file was deleted.

packages/contracts/.prettierignore

-4
This file was deleted.

packages/contracts/.prettierrc.json

-35
This file was deleted.

packages/contracts/contracts/arbitrum/IBridge.sol

+1-6
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,7 @@ interface IBridge {
3535
bytes32 messageDataHash
3636
);
3737

38-
event BridgeCallTriggered(
39-
address indexed outbox,
40-
address indexed destAddr,
41-
uint256 amount,
42-
bytes data
43-
);
38+
event BridgeCallTriggered(address indexed outbox, address indexed destAddr, uint256 amount, bytes data);
4439

4540
event InboxToggle(address indexed inbox, bool enabled);
4641

packages/contracts/contracts/arbitrum/IOutbox.sol

+1-2
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,7 @@ interface IOutbox {
5151

5252
function l2ToL1OutputId() external view returns (bytes32);
5353

54-
function processOutgoingMessages(bytes calldata sendsData, uint256[] calldata sendLengths)
55-
external;
54+
function processOutgoingMessages(bytes calldata sendsData, uint256[] calldata sendLengths) external;
5655

5756
function outboxEntryExists(uint256 batchNum) external view returns (bool);
5857
}

packages/contracts/contracts/bancor/BancorFormula.sol

+12-42
Original file line numberDiff line numberDiff line change
@@ -324,9 +324,7 @@ contract BancorFormula {
324324
uint256 _amount
325325
) public view returns (uint256) {
326326
// validate input
327-
require(
328-
_supply > 0 && _reserveBalance > 0 && _totalRatio > 1 && _totalRatio <= MAX_RATIO * 2
329-
);
327+
require(_supply > 0 && _reserveBalance > 0 && _totalRatio > 1 && _totalRatio <= MAX_RATIO * 2);
330328

331329
// special case for 0 amount
332330
if (_amount == 0) return 0;
@@ -364,11 +362,7 @@ contract BancorFormula {
364362
) public view returns (uint256) {
365363
// validate input
366364
require(
367-
_supply > 0 &&
368-
_reserveBalance > 0 &&
369-
_totalRatio > 1 &&
370-
_totalRatio <= MAX_RATIO * 2 &&
371-
_amount <= _supply
365+
_supply > 0 && _reserveBalance > 0 && _totalRatio > 1 && _totalRatio <= MAX_RATIO * 2 && _amount <= _supply
372366
);
373367

374368
// special case for 0 amount
@@ -407,12 +401,7 @@ contract BancorFormula {
407401
* This functions assumes that "_expN < 2 ^ 256 / log(MAX_NUM - 1)", otherwise the multiplication should be replaced with a "safeMul".
408402
* Since we rely on unsigned-integer arithmetic and "base < 1" ==> "log(base) < 0", this function does not support "_baseN < _baseD".
409403
*/
410-
function power(
411-
uint256 _baseN,
412-
uint256 _baseD,
413-
uint32 _expN,
414-
uint32 _expD
415-
) internal view returns (uint256, uint8) {
404+
function power(uint256 _baseN, uint256 _baseD, uint32 _expN, uint32 _expD) internal view returns (uint256, uint8) {
416405
require(_baseN < MAX_NUM);
417406

418407
uint256 baseLog;
@@ -428,10 +417,7 @@ contract BancorFormula {
428417
return (optimalExp(baseLogTimesExp), MAX_PRECISION);
429418
} else {
430419
uint8 precision = findPositionInMaxExpArray(baseLogTimesExp);
431-
return (
432-
generalExp(baseLogTimesExp >> (MAX_PRECISION - precision), precision),
433-
precision
434-
);
420+
return (generalExp(baseLogTimesExp >> (MAX_PRECISION - precision), precision), precision);
435421
}
436422
}
437423

@@ -642,37 +628,21 @@ contract BancorFormula {
642628

643629
z = y = x - FIXED_1;
644630
w = (y * y) / FIXED_1;
645-
res +=
646-
(z * (0x100000000000000000000000000000000 - y)) /
647-
0x100000000000000000000000000000000;
631+
res += (z * (0x100000000000000000000000000000000 - y)) / 0x100000000000000000000000000000000;
648632
z = (z * w) / FIXED_1; // add y^01 / 01 - y^02 / 02
649-
res +=
650-
(z * (0x0aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa - y)) /
651-
0x200000000000000000000000000000000;
633+
res += (z * (0x0aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa - y)) / 0x200000000000000000000000000000000;
652634
z = (z * w) / FIXED_1; // add y^03 / 03 - y^04 / 04
653-
res +=
654-
(z * (0x099999999999999999999999999999999 - y)) /
655-
0x300000000000000000000000000000000;
635+
res += (z * (0x099999999999999999999999999999999 - y)) / 0x300000000000000000000000000000000;
656636
z = (z * w) / FIXED_1; // add y^05 / 05 - y^06 / 06
657-
res +=
658-
(z * (0x092492492492492492492492492492492 - y)) /
659-
0x400000000000000000000000000000000;
637+
res += (z * (0x092492492492492492492492492492492 - y)) / 0x400000000000000000000000000000000;
660638
z = (z * w) / FIXED_1; // add y^07 / 07 - y^08 / 08
661-
res +=
662-
(z * (0x08e38e38e38e38e38e38e38e38e38e38e - y)) /
663-
0x500000000000000000000000000000000;
639+
res += (z * (0x08e38e38e38e38e38e38e38e38e38e38e - y)) / 0x500000000000000000000000000000000;
664640
z = (z * w) / FIXED_1; // add y^09 / 09 - y^10 / 10
665-
res +=
666-
(z * (0x08ba2e8ba2e8ba2e8ba2e8ba2e8ba2e8b - y)) /
667-
0x600000000000000000000000000000000;
641+
res += (z * (0x08ba2e8ba2e8ba2e8ba2e8ba2e8ba2e8b - y)) / 0x600000000000000000000000000000000;
668642
z = (z * w) / FIXED_1; // add y^11 / 11 - y^12 / 12
669-
res +=
670-
(z * (0x089d89d89d89d89d89d89d89d89d89d89 - y)) /
671-
0x700000000000000000000000000000000;
643+
res += (z * (0x089d89d89d89d89d89d89d89d89d89d89 - y)) / 0x700000000000000000000000000000000;
672644
z = (z * w) / FIXED_1; // add y^13 / 13 - y^14 / 14
673-
res +=
674-
(z * (0x088888888888888888888888888888888 - y)) /
675-
0x800000000000000000000000000000000; // add y^15 / 15 - y^16 / 16
645+
res += (z * (0x088888888888888888888888888888888 - y)) / 0x800000000000000000000000000000000; // add y^15 / 15 - y^16 / 16
676646

677647
return res;
678648
}

0 commit comments

Comments
 (0)