Skip to content

Commit

Permalink
apply editorconfig
Browse files Browse the repository at this point in the history
  • Loading branch information
Pzixel committed Feb 16, 2022
1 parent 33be44d commit 6356d9c
Show file tree
Hide file tree
Showing 16 changed files with 61 additions and 8,853 deletions.
Binary file removed .DS_Store
Binary file not shown.
2 changes: 1 addition & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
node_modules/
coverage/
dist/
dist/
80 changes: 40 additions & 40 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -1,55 +1,55 @@
{
"root": true,
"extends" : [
"eslint:recommended",
"plugin:@typescript-eslint/recommended"
"eslint:recommended",
"plugin:@typescript-eslint/recommended"
],
"parser": "@typescript-eslint/parser",
"plugins": [
"@typescript-eslint"
"@typescript-eslint"
],
"env": {
"browser" : true,
"node" : true,
"mocha" : true,
"jest" : true
"browser" : true,
"node" : true,
"mocha" : true,
"jest" : true
},
"globals" : {
"artifacts": false,
"contract": false,
"assert": false,
"web3": false
"artifacts": false,
"contract": false,
"assert": false,
"web3": false
},
"rules": {
// TS
"@typescript-eslint/no-non-null-assertion": "off",
// TS
"@typescript-eslint/no-non-null-assertion": "off",

// Strict mode
"strict": [2, "global"],
// Strict mode
"strict": [2, "global"],

// Code style
"indent": [2, 4],
"quotes": [2, "single"],
"semi": ["error", "always"],
"space-before-function-paren": ["error", "always"],
"no-use-before-define": 0,
"no-unused-expressions": "off",
"eqeqeq": [2, "smart"],
"dot-notation": [2, {"allowKeywords": true, "allowPattern": ""}],
"no-redeclare": [2, {"builtinGlobals": true}],
"no-trailing-spaces": [2, { "skipBlankLines": true }],
"eol-last": 1,
"comma-spacing": [2, {"before": false, "after": true}],
"camelcase": [2, {"properties": "always"}],
"no-mixed-spaces-and-tabs": [2, "smart-tabs"],
"comma-dangle": [1, "always-multiline"],
"no-dupe-args": 2,
"no-dupe-keys": 2,
"no-debugger": 0,
"object-curly-spacing": [2, "always"],
"max-len": [2, 200, 2],
"generator-star-spacing": ["error", "before"],
"promise/avoid-new": 0,
"promise/always-return": 0
// Code style
"indent": [2, 4],
"quotes": [2, "single"],
"semi": ["error", "always"],
"space-before-function-paren": ["error", "always"],
"no-use-before-define": 0,
"no-unused-expressions": "off",
"eqeqeq": [2, "smart"],
"dot-notation": [2, {"allowKeywords": true, "allowPattern": ""}],
"no-redeclare": [2, {"builtinGlobals": true}],
"no-trailing-spaces": [2, { "skipBlankLines": true }],
"eol-last": 1,
"comma-spacing": [2, {"before": false, "after": true}],
"camelcase": [2, {"properties": "always"}],
"no-mixed-spaces-and-tabs": [2, "smart-tabs"],
"comma-dangle": [1, "always-multiline"],
"no-dupe-args": 2,
"no-dupe-keys": 2,
"no-debugger": 0,
"object-curly-spacing": [2, "always"],
"max-len": [2, 200, 2],
"generator-star-spacing": ["error", "before"],
"promise/avoid-new": 0,
"promise/always-return": 0
}
}
}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ dist
.env
.idea
typechain-types
.DS_Store
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,4 @@ This repository contains frequently used smart contracts, libraries and interfac

### UTILS

...
...
2 changes: 1 addition & 1 deletion contracts/GasChecker.sol
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import "@openzeppelin/contracts/utils/Strings.sol";

contract GasChecker {
using Strings for uint256;

modifier checkGasCost(uint256 expectedGasCost) {
uint256 gas = gasleft();
_;
Expand Down
2 changes: 1 addition & 1 deletion contracts/libraries/RevertReasonParser.sol
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import "./StringUtil.sol";
library RevertReasonParser {
using StringUtil for uint256;
using StringUtil for bytes;

bytes4 constant private _ERROR_SELECTOR = bytes4(keccak256("Error(string)"));
bytes4 constant private _PANIC_SELECTOR = bytes4(keccak256("Panic(uint256)"));

Expand Down
4 changes: 2 additions & 2 deletions contracts/libraries/StringUtil.sol
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,10 @@ library StringUtil {
mstore(toPtr, 0x3078000000000000000000000000000000000000000000000000000000000000) // set 0x as first two bytes
toPtr := add(toPtr, 0x02)

for {
for {
let fromPtr := add(data, 0x20)
let endPtr := add(fromPtr, length)
} lt(fromPtr, endPtr) {
} lt(fromPtr, endPtr) {
fromPtr := add(fromPtr, 0x20)
} {
let rawData := mload(fromPtr)
Expand Down
2 changes: 1 addition & 1 deletion contracts/libraries/UniERC20.sol
Original file line number Diff line number Diff line change
Expand Up @@ -60,4 +60,4 @@ library UniERC20 {
require(abi.decode(result, (bool)), "ERC20 operation did not succeed");
}
}
}
}
2 changes: 1 addition & 1 deletion contracts/mocks/AddressArrayMock.sol
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import "../libraries/AddressArray.sol";

contract AddressArrayMock {
using AddressArray for AddressArray.Data;

AddressArray.Data private _self;

function length() external view returns(uint256) {
Expand Down
2 changes: 1 addition & 1 deletion contracts/mocks/AddressSetMock.sol
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ contract AddressSetMock {
using AddressSet for AddressSet.Data;

AddressSet.Data private _self;

function length() external view returns(uint) {
return AddressSet.length(_self);
}
Expand Down
14 changes: 7 additions & 7 deletions contracts/mocks/DaiLikePermitMock.sol
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC20/extensions/draft-ERC20Permit.sol";

contract DaiLikePermitMock is ERC20Permit {
// bytes32 public constant PERMIT_TYPEHASH = keccak256("Permit(address holder,address spender,uint256 nonce,uint256 expiry,bool allowed)");
// bytes32 public constant PERMIT_TYPEHASH = keccak256("Permit(address holder,address spender,uint256 nonce,uint256 expiry,bool allowed)");
bytes32 public constant PERMIT_TYPEHASH = 0xea2aa0a1be11a07ed86d755c93467f4f82362b452371d1ba94d1715123511acb;

constructor(
string memory name,
string memory symbol,
Expand All @@ -24,11 +24,11 @@ contract DaiLikePermitMock is ERC20Permit {
"\x19\x01",
this.DOMAIN_SEPARATOR(),
keccak256(abi.encode(PERMIT_TYPEHASH,
holder,
spender,
nonce,
expiry,
allowed))
holder,
spender,
nonce,
expiry,
allowed))
));

require(holder != address(0), "Dai/invalid-address-0");
Expand Down
3 changes: 1 addition & 2 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export interface Token extends Truffle.ContractInstance {
balanceOf(
account: string,
txDetails?: Truffle.TransactionDetails
): Promise<BN>;
): Promise<BN>;
}

export async function trackReceivedTokenAndTx<T extends unknown[], U extends Truffle.AnyEvent> (
Expand Down Expand Up @@ -63,4 +63,3 @@ export async function countInstructions (txHash: string, instructions: string[])
return str.split('"' + instr.toUpperCase() + '"').length - 1;
});
}

4 changes: 2 additions & 2 deletions test/Permitable.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ contract('Permitable', function ([wallet1, wallet2]) {
context.erc20PermitMock = await ERC20PermitMock.new('USDC', 'USDC', wallet1, toBN(100));
context.daiLikePermitMock = await DaiLikePermitMock.new('DAI', 'DAI', wallet1, toBN(100));
});

it('should be permitted for IERC20Permit', async function () {
const permit = await getPermit(context.owner, context.wallet.privateKey, context.erc20PermitMock, '1', context.chainId, wallet2, value.toString());
await context.permittableMock.__permit(context.erc20PermitMock.address, permit);
Expand Down Expand Up @@ -76,7 +76,7 @@ contract('Permitable', function ([wallet1, wallet2]) {
'tuple(address,address,uint256,uint256,bool,uint8,bytes32,bytes32)',
[context.holder, wallet1, nonce, defaultDeadline, true, v, r, s],
);

expect(context.permittableMock.__permit(context.daiLikePermitMock.address, payload))
.to.eventually.be.rejectedWith('Permit failed: Error(Dai/invalid-permit)');
});
Expand Down
2 changes: 1 addition & 1 deletion test/contracts/AddressArray.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ contract('AddressArray', async function ([wallet1, wallet2, wallet3]) {
before(async () => {
context = await initContext();
});

beforeEach(async function () {
context.addressArrayMock = await AddressArrayMock.new();
});
Expand Down
Loading

0 comments on commit 6356d9c

Please sign in to comment.