diff --git a/.prettierignore b/.prettierignore index 43801ec..fa5fd70 100644 --- a/.prettierignore +++ b/.prettierignore @@ -2,8 +2,4 @@ #artifacts cache assets -coverage - -# Solidity -contracts -#pre-compiles \ No newline at end of file +coverage \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json index d944e77..16d9da8 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,11 +1,8 @@ { "editor.defaultFormatter": "esbenp.prettier-vscode", // Solidity - "solidity.formatter": "none", + "solidity.formatter": "prettier", "solidity.linter": "solhint", "solidity.packageDefaultDependenciesContractsDirectory": "", - "solidity.packageDefaultDependenciesDirectory": "node_modules", - "solidity.solhintRules": { - "quotes": ["error", "double"] - } + "solidity.packageDefaultDependenciesDirectory": "node_modules" } diff --git a/buidler.config.js b/buidler.config.js index c1dfd23..545f7c0 100644 --- a/buidler.config.js +++ b/buidler.config.js @@ -1,9 +1,9 @@ // Buidler -const { task, usePlugin, types } = require("@nomiclabs/buidler/config"); +const {task, usePlugin, types} = require("@nomiclabs/buidler/config"); // Libraries const assert = require("assert"); -const { utils } = require("ethers"); +const {utils} = require("ethers"); const GelatoCoreLib = require("@gelatonetwork/core"); @@ -39,7 +39,7 @@ module.exports = { }, solc: { version: "0.6.12", - optimizer: { enabled: true }, + optimizer: {enabled: true}, }, }; diff --git a/contracts/ConditionCompareUintsFromTwoSources.sol b/contracts/ConditionCompareUintsFromTwoSources.sol index 36baaac..9b149ec 100644 --- a/contracts/ConditionCompareUintsFromTwoSources.sol +++ b/contracts/ConditionCompareUintsFromTwoSources.sol @@ -22,37 +22,40 @@ contract ConditionCompareUintsFromTwoSources is GelatoConditionsStandard { function getConditionData( address _sourceA, address _sourceB, - bytes calldata _sourceAData, + bytes calldata _sourceAData, bytes calldata _sourceBData, uint256 _minSpread - ) - public - pure - virtual - returns (bytes memory) - { - return abi.encode(_sourceA, _sourceB, _sourceAData, _sourceBData, _minSpread); + ) public pure virtual returns (bytes memory) { + return + abi.encode( + _sourceA, + _sourceB, + _sourceAData, + _sourceBData, + _minSpread + ); } /// @notice Gelato Standard Condition function. /// @dev Every Gelato Condition must have this function selector as entry point. /// @param _conditionData The encoded data from getConditionData() - function ok(uint256, bytes calldata _conditionData, uint256) - public - view - virtual - override - returns (string memory) - { - (address _sourceA, - address _sourceB, - bytes memory _sourceAData, - bytes memory _sourceBData, - uint256 _minSpread) = abi.decode( + function ok( + uint256, + bytes calldata _conditionData, + uint256 + ) public view virtual override returns (string memory) { + ( + address _sourceA, + address _sourceB, + bytes memory _sourceAData, + bytes memory _sourceBData, + uint256 _minSpread + ) = abi.decode( _conditionData, - (address,address,bytes,bytes,uint256) + (address, address, bytes, bytes, uint256) ); - return compare(_sourceA, _sourceB, _sourceAData, _sourceBData, _minSpread); + return + compare(_sourceA, _sourceB, _sourceAData, _sourceBData, _minSpread); } /// @notice Compares 2 values from sourceA and sourceB to check if minSpread is there. @@ -69,34 +72,33 @@ contract ConditionCompareUintsFromTwoSources is GelatoConditionsStandard { function compare( address _sourceA, address _sourceB, - bytes memory _sourceAData, + bytes memory _sourceAData, bytes memory _sourceBData, uint256 _minSpread - ) - public - view - virtual - returns (string memory) - { + ) public view virtual returns (string memory) { // Retrieve uint256 from sourceA - (bool success, bytes memory returndata) = _sourceA.staticcall(_sourceAData); + (bool success, bytes memory returndata) = _sourceA.staticcall( + _sourceAData + ); if (!success) { - return returndata.generateErrorString( - "ConditionCompareTwoUints.compare._sourceA:" - ); + return + returndata.generateErrorString( + "ConditionCompareTwoUints.compare._sourceA:" + ); } uint256 a = abi.decode(returndata, (uint256)); // Retrieve uint256 from sourceB (success, returndata) = _sourceB.staticcall(_sourceBData); if (!success) { - return returndata.generateErrorString( - "ConditionCompareTwoUints.compare._sourceB:" - ); + return + returndata.generateErrorString( + "ConditionCompareTwoUints.compare._sourceB:" + ); } uint256 b = abi.decode(returndata, (uint256)); if (a >= b.add(_minSpread)) return OK; return "ANotGreaterOrEqualToBbyMinspread"; } -} \ No newline at end of file +} diff --git a/contracts/GelatoBytes.sol b/contracts/GelatoBytes.sol index 0736778..45034c4 100644 --- a/contracts/GelatoBytes.sol +++ b/contracts/GelatoBytes.sol @@ -26,42 +26,57 @@ library GelatoBytes { (bytes4(_bytes[3]) >> 24); } - function revertWithErrorString(bytes memory _bytes, string memory _tracingInfo) - internal - pure - { + function revertWithErrorString( + bytes memory _bytes, + string memory _tracingInfo + ) internal pure { // 68: 32-location, 32-length, 4-ErrorSelector, UTF-8 err if (_bytes.length % 32 == 4) { bytes4 selector; - assembly { selector := mload(add(0x20, _bytes)) } - if (selector == 0x08c379a0) { // Function selector for Error(string) - assembly { _bytes := add(_bytes, 68) } + assembly { + selector := mload(add(0x20, _bytes)) + } + if (selector == 0x08c379a0) { + // Function selector for Error(string) + assembly { + _bytes := add(_bytes, 68) + } revert(string(abi.encodePacked(_tracingInfo, string(_bytes)))); } else { - revert(string(abi.encodePacked(_tracingInfo, "NoErrorSelector"))); + revert( + string(abi.encodePacked(_tracingInfo, "NoErrorSelector")) + ); } } else { - revert(string(abi.encodePacked(_tracingInfo, "UnexpectedReturndata"))); + revert( + string(abi.encodePacked(_tracingInfo, "UnexpectedReturndata")) + ); } } - function generateErrorString(bytes memory _bytes, string memory _tracingInfo) - internal - pure - returns (string memory) - { + function generateErrorString( + bytes memory _bytes, + string memory _tracingInfo + ) internal pure returns (string memory) { // 68: 32-location, 32-length, 4-ErrorSelector, UTF-8 err if (_bytes.length % 32 == 4) { bytes4 selector; - assembly { selector := mload(add(0x20, _bytes)) } - if (selector == 0x08c379a0) { // Function selector for Error(string) - assembly { _bytes := add(_bytes, 68) } + assembly { + selector := mload(add(0x20, _bytes)) + } + if (selector == 0x08c379a0) { + // Function selector for Error(string) + assembly { + _bytes := add(_bytes, 68) + } return string(abi.encodePacked(_tracingInfo, string(_bytes))); } else { - return string(abi.encodePacked(_tracingInfo, "NoErrorSelector")); + return + string(abi.encodePacked(_tracingInfo, "NoErrorSelector")); } } else { - return string(abi.encodePacked(_tracingInfo, "UnexpectedReturndata")); + return + string(abi.encodePacked(_tracingInfo, "UnexpectedReturndata")); } } -} \ No newline at end of file +} diff --git a/contracts/MockCDAI.sol b/contracts/MockCDAI.sol index fe20bbc..d299f6c 100644 --- a/contracts/MockCDAI.sol +++ b/contracts/MockCDAI.sol @@ -10,11 +10,14 @@ contract MockCDAI { //uint256 public supplyRatePerSecond = 1000000000627937192491029810; // per second==2% annually uint256 public supplyRatePerSecond; - constructor(uint256 _sRPS) public { supplyRatePerSecond = _sRPS; } + + constructor(uint256 _sRPS) public { + supplyRatePerSecond = _sRPS; + } /// @dev Use this during tests to simulate changing CDAI.supplyRatePerBlock conditions /// @param _rate CDAI.supplyRatePerBlock but in seconds and 10**27 precision function setSupplyRatePerSecond(uint256 _rate) external virtual { supplyRatePerSecond = _rate; } -} \ No newline at end of file +} diff --git a/contracts/MockDSR.sol b/contracts/MockDSR.sol index 21bdecf..7900d68 100644 --- a/contracts/MockDSR.sol +++ b/contracts/MockDSR.sol @@ -12,11 +12,14 @@ contract MockDSR { /// uint256 public dsr = 1000000000627937192491029810; // per second==2% annually uint256 public dsr; - constructor(uint256 _dsr) public { dsr = _dsr; } + + constructor(uint256 _dsr) public { + dsr = _dsr; + } /// @dev Use this during tests to simulate changing DSR conditions /// @param _dsr The dsr to set. function setDSR(uint256 _dsr) external virtual { dsr = _dsr; } -} \ No newline at end of file +} diff --git a/package.json b/package.json index e6d05f7..56e167e 100644 --- a/package.json +++ b/package.json @@ -27,17 +27,18 @@ "ethers": "5.0.17", "husky": ">=4", "lint-staged": ">=10", - "prettier": "2.1.2" + "prettier": "2.1.2", + "prettier-plugin-solidity": "1.0.0-alpha.59" }, "dependencies": {}, "husky": { "hooks": { "pre-commit": "yarn compile; lint-staged;", - "pre-push": "git fetch origin && HUSKY_SKIP_HOOKS=1 git rebase origin/master && yarn compile && lint-staged; yarn test" + "pre-push": "git fetch origin && HUSKY_SKIP_HOOKS=1 git rebase origin/master && yarn compile && yarn format && yarn test" } }, "lint-staged": { "*.js": "eslint --cache --fix", - "*.{js,css,md}": "prettier --write" + "*.{js,sol,css,md}": "prettier --write" } } diff --git a/pre-compiles/ConnectGelato_ABI.json b/pre-compiles/ConnectGelato_ABI.json index 43a485e..80aedc1 100644 --- a/pre-compiles/ConnectGelato_ABI.json +++ b/pre-compiles/ConnectGelato_ABI.json @@ -4,18 +4,18 @@ "inputs": [ { "components": [ - { "internalType": "uint256", "name": "id", "type": "uint256" }, - { "internalType": "address", "name": "userProxy", "type": "address" }, + {"internalType": "uint256", "name": "id", "type": "uint256"}, + {"internalType": "address", "name": "userProxy", "type": "address"}, { "components": [ - { "internalType": "address", "name": "addr", "type": "address" }, - { "internalType": "address", "name": "module", "type": "address" } + {"internalType": "address", "name": "addr", "type": "address"}, + {"internalType": "address", "name": "module", "type": "address"} ], "internalType": "struct Provider", "name": "provider", "type": "tuple" }, - { "internalType": "uint256", "name": "index", "type": "uint256" }, + {"internalType": "uint256", "name": "index", "type": "uint256"}, { "components": [ { @@ -25,7 +25,7 @@ "name": "inst", "type": "address" }, - { "internalType": "bytes", "name": "data", "type": "bytes" } + {"internalType": "bytes", "name": "data", "type": "bytes"} ], "internalType": "struct Condition[]", "name": "conditions", @@ -38,7 +38,7 @@ "name": "addr", "type": "address" }, - { "internalType": "bytes", "name": "data", "type": "bytes" }, + {"internalType": "bytes", "name": "data", "type": "bytes"}, { "internalType": "enum Operation", "name": "operation", @@ -84,7 +84,7 @@ "name": "expiryDate", "type": "uint256" }, - { "internalType": "uint256", "name": "cycleId", "type": "uint256" }, + {"internalType": "uint256", "name": "cycleId", "type": "uint256"}, { "internalType": "uint256", "name": "submissionsLeft", @@ -130,8 +130,8 @@ }, { "components": [ - { "internalType": "address", "name": "addr", "type": "address" }, - { "internalType": "bytes", "name": "data", "type": "bytes" }, + {"internalType": "address", "name": "addr", "type": "address"}, + {"internalType": "bytes", "name": "data", "type": "bytes"}, { "internalType": "enum Operation", "name": "operation", @@ -142,8 +142,8 @@ "name": "dataFlow", "type": "uint8" }, - { "internalType": "uint256", "name": "value", "type": "uint256" }, - { "internalType": "bool", "name": "termsOkCheck", "type": "bool" } + {"internalType": "uint256", "name": "value", "type": "uint256"}, + {"internalType": "bool", "name": "termsOkCheck", "type": "bool"} ], "internalType": "struct Action[]", "name": "actions", @@ -200,8 +200,8 @@ }, { "components": [ - { "internalType": "address", "name": "addr", "type": "address" }, - { "internalType": "bytes", "name": "data", "type": "bytes" }, + {"internalType": "address", "name": "addr", "type": "address"}, + {"internalType": "bytes", "name": "data", "type": "bytes"}, { "internalType": "enum Operation", "name": "operation", @@ -212,8 +212,8 @@ "name": "dataFlow", "type": "uint8" }, - { "internalType": "uint256", "name": "value", "type": "uint256" }, - { "internalType": "bool", "name": "termsOkCheck", "type": "bool" } + {"internalType": "uint256", "name": "value", "type": "uint256"}, + {"internalType": "bool", "name": "termsOkCheck", "type": "bool"} ], "internalType": "struct Action[]", "name": "actions", @@ -263,8 +263,8 @@ "inputs": [ { "components": [ - { "internalType": "address", "name": "addr", "type": "address" }, - { "internalType": "address", "name": "module", "type": "address" } + {"internalType": "address", "name": "addr", "type": "address"}, + {"internalType": "address", "name": "module", "type": "address"} ], "indexed": true, "internalType": "struct Provider", @@ -275,8 +275,8 @@ "components": [ { "components": [ - { "internalType": "address", "name": "inst", "type": "address" }, - { "internalType": "bytes", "name": "data", "type": "bytes" } + {"internalType": "address", "name": "inst", "type": "address"}, + {"internalType": "bytes", "name": "data", "type": "bytes"} ], "internalType": "struct Condition[]", "name": "conditions", @@ -284,8 +284,8 @@ }, { "components": [ - { "internalType": "address", "name": "addr", "type": "address" }, - { "internalType": "bytes", "name": "data", "type": "bytes" }, + {"internalType": "address", "name": "addr", "type": "address"}, + {"internalType": "bytes", "name": "data", "type": "bytes"}, { "internalType": "enum Operation", "name": "operation", @@ -296,8 +296,8 @@ "name": "dataFlow", "type": "uint8" }, - { "internalType": "uint256", "name": "value", "type": "uint256" }, - { "internalType": "bool", "name": "termsOkCheck", "type": "bool" } + {"internalType": "uint256", "name": "value", "type": "uint256"}, + {"internalType": "bool", "name": "termsOkCheck", "type": "bool"} ], "internalType": "struct Action[]", "name": "actions", @@ -346,8 +346,8 @@ "inputs": [ { "components": [ - { "internalType": "address", "name": "addr", "type": "address" }, - { "internalType": "address", "name": "module", "type": "address" } + {"internalType": "address", "name": "addr", "type": "address"}, + {"internalType": "address", "name": "module", "type": "address"} ], "indexed": true, "internalType": "struct Provider", @@ -358,8 +358,8 @@ "components": [ { "components": [ - { "internalType": "address", "name": "inst", "type": "address" }, - { "internalType": "bytes", "name": "data", "type": "bytes" } + {"internalType": "address", "name": "inst", "type": "address"}, + {"internalType": "bytes", "name": "data", "type": "bytes"} ], "internalType": "struct Condition[]", "name": "conditions", @@ -367,8 +367,8 @@ }, { "components": [ - { "internalType": "address", "name": "addr", "type": "address" }, - { "internalType": "bytes", "name": "data", "type": "bytes" }, + {"internalType": "address", "name": "addr", "type": "address"}, + {"internalType": "bytes", "name": "data", "type": "bytes"}, { "internalType": "enum Operation", "name": "operation", @@ -379,8 +379,8 @@ "name": "dataFlow", "type": "uint8" }, - { "internalType": "uint256", "name": "value", "type": "uint256" }, - { "internalType": "bool", "name": "termsOkCheck", "type": "bool" } + {"internalType": "uint256", "name": "value", "type": "uint256"}, + {"internalType": "bool", "name": "termsOkCheck", "type": "bool"} ], "internalType": "struct Action[]", "name": "actions", @@ -429,8 +429,8 @@ "inputs": [ { "components": [ - { "internalType": "address", "name": "addr", "type": "address" }, - { "internalType": "address", "name": "module", "type": "address" } + {"internalType": "address", "name": "addr", "type": "address"}, + {"internalType": "address", "name": "module", "type": "address"} ], "indexed": true, "internalType": "struct Provider", @@ -441,8 +441,8 @@ "components": [ { "components": [ - { "internalType": "address", "name": "inst", "type": "address" }, - { "internalType": "bytes", "name": "data", "type": "bytes" } + {"internalType": "address", "name": "inst", "type": "address"}, + {"internalType": "bytes", "name": "data", "type": "bytes"} ], "internalType": "struct Condition[]", "name": "conditions", @@ -450,8 +450,8 @@ }, { "components": [ - { "internalType": "address", "name": "addr", "type": "address" }, - { "internalType": "bytes", "name": "data", "type": "bytes" }, + {"internalType": "address", "name": "addr", "type": "address"}, + {"internalType": "bytes", "name": "data", "type": "bytes"}, { "internalType": "enum Operation", "name": "operation", @@ -462,8 +462,8 @@ "name": "dataFlow", "type": "uint8" }, - { "internalType": "uint256", "name": "value", "type": "uint256" }, - { "internalType": "bool", "name": "termsOkCheck", "type": "bool" } + {"internalType": "uint256", "name": "value", "type": "uint256"}, + {"internalType": "bool", "name": "termsOkCheck", "type": "bool"} ], "internalType": "struct Action[]", "name": "actions", @@ -511,8 +511,8 @@ "inputs": [], "name": "connectorID", "outputs": [ - { "internalType": "uint256", "name": "_type", "type": "uint256" }, - { "internalType": "uint256", "name": "_id", "type": "uint256" } + {"internalType": "uint256", "name": "_type", "type": "uint256"}, + {"internalType": "uint256", "name": "_id", "type": "uint256"} ], "stateMutability": "pure", "type": "function" @@ -521,18 +521,18 @@ "inputs": [ { "components": [ - { "internalType": "uint256", "name": "id", "type": "uint256" }, - { "internalType": "address", "name": "userProxy", "type": "address" }, + {"internalType": "uint256", "name": "id", "type": "uint256"}, + {"internalType": "address", "name": "userProxy", "type": "address"}, { "components": [ - { "internalType": "address", "name": "addr", "type": "address" }, - { "internalType": "address", "name": "module", "type": "address" } + {"internalType": "address", "name": "addr", "type": "address"}, + {"internalType": "address", "name": "module", "type": "address"} ], "internalType": "struct Provider", "name": "provider", "type": "tuple" }, - { "internalType": "uint256", "name": "index", "type": "uint256" }, + {"internalType": "uint256", "name": "index", "type": "uint256"}, { "components": [ { @@ -542,7 +542,7 @@ "name": "inst", "type": "address" }, - { "internalType": "bytes", "name": "data", "type": "bytes" } + {"internalType": "bytes", "name": "data", "type": "bytes"} ], "internalType": "struct Condition[]", "name": "conditions", @@ -555,7 +555,7 @@ "name": "addr", "type": "address" }, - { "internalType": "bytes", "name": "data", "type": "bytes" }, + {"internalType": "bytes", "name": "data", "type": "bytes"}, { "internalType": "enum Operation", "name": "operation", @@ -601,7 +601,7 @@ "name": "expiryDate", "type": "uint256" }, - { "internalType": "uint256", "name": "cycleId", "type": "uint256" }, + {"internalType": "uint256", "name": "cycleId", "type": "uint256"}, { "internalType": "uint256", "name": "submissionsLeft", @@ -620,7 +620,7 @@ }, { "inputs": [ - { "internalType": "address", "name": "_executor", "type": "address" }, + {"internalType": "address", "name": "_executor", "type": "address"}, { "components": [ { @@ -630,8 +630,8 @@ }, { "components": [ - { "internalType": "address", "name": "addr", "type": "address" }, - { "internalType": "bytes", "name": "data", "type": "bytes" }, + {"internalType": "address", "name": "addr", "type": "address"}, + {"internalType": "bytes", "name": "data", "type": "bytes"}, { "internalType": "enum Operation", "name": "operation", @@ -642,8 +642,8 @@ "name": "dataFlow", "type": "uint8" }, - { "internalType": "uint256", "name": "value", "type": "uint256" }, - { "internalType": "bool", "name": "termsOkCheck", "type": "bool" } + {"internalType": "uint256", "name": "value", "type": "uint256"}, + {"internalType": "bool", "name": "termsOkCheck", "type": "bool"} ], "internalType": "struct Action[]", "name": "actions", @@ -659,10 +659,10 @@ "name": "_taskSpecs", "type": "tuple[]" }, - { "internalType": "address[]", "name": "_modules", "type": "address[]" }, - { "internalType": "uint256", "name": "_ethToDeposit", "type": "uint256" }, - { "internalType": "uint256", "name": "_getId", "type": "uint256" }, - { "internalType": "uint256", "name": "_setId", "type": "uint256" } + {"internalType": "address[]", "name": "_modules", "type": "address[]"}, + {"internalType": "uint256", "name": "_ethToDeposit", "type": "uint256"}, + {"internalType": "uint256", "name": "_getId", "type": "uint256"}, + {"internalType": "uint256", "name": "_setId", "type": "uint256"} ], "name": "multiProvide", "outputs": [], @@ -685,8 +685,8 @@ }, { "components": [ - { "internalType": "address", "name": "addr", "type": "address" }, - { "internalType": "bytes", "name": "data", "type": "bytes" }, + {"internalType": "address", "name": "addr", "type": "address"}, + {"internalType": "bytes", "name": "data", "type": "bytes"}, { "internalType": "enum Operation", "name": "operation", @@ -697,8 +697,8 @@ "name": "dataFlow", "type": "uint8" }, - { "internalType": "uint256", "name": "value", "type": "uint256" }, - { "internalType": "bool", "name": "termsOkCheck", "type": "bool" } + {"internalType": "uint256", "name": "value", "type": "uint256"}, + {"internalType": "bool", "name": "termsOkCheck", "type": "bool"} ], "internalType": "struct Action[]", "name": "actions", @@ -714,9 +714,9 @@ "name": "_taskSpecs", "type": "tuple[]" }, - { "internalType": "address[]", "name": "_modules", "type": "address[]" }, - { "internalType": "uint256", "name": "_getId", "type": "uint256" }, - { "internalType": "uint256", "name": "_setId", "type": "uint256" } + {"internalType": "address[]", "name": "_modules", "type": "address[]"}, + {"internalType": "uint256", "name": "_getId", "type": "uint256"}, + {"internalType": "uint256", "name": "_setId", "type": "uint256"} ], "name": "multiUnprovide", "outputs": [], @@ -726,7 +726,7 @@ { "inputs": [], "name": "name", - "outputs": [{ "internalType": "string", "name": "", "type": "string" }], + "outputs": [{"internalType": "string", "name": "", "type": "string"}], "stateMutability": "view", "type": "function" }, @@ -734,8 +734,8 @@ "inputs": [ { "components": [ - { "internalType": "address", "name": "addr", "type": "address" }, - { "internalType": "address", "name": "module", "type": "address" } + {"internalType": "address", "name": "addr", "type": "address"}, + {"internalType": "address", "name": "module", "type": "address"} ], "internalType": "struct Provider", "name": "_provider", @@ -745,8 +745,8 @@ "components": [ { "components": [ - { "internalType": "address", "name": "inst", "type": "address" }, - { "internalType": "bytes", "name": "data", "type": "bytes" } + {"internalType": "address", "name": "inst", "type": "address"}, + {"internalType": "bytes", "name": "data", "type": "bytes"} ], "internalType": "struct Condition[]", "name": "conditions", @@ -754,8 +754,8 @@ }, { "components": [ - { "internalType": "address", "name": "addr", "type": "address" }, - { "internalType": "bytes", "name": "data", "type": "bytes" }, + {"internalType": "address", "name": "addr", "type": "address"}, + {"internalType": "bytes", "name": "data", "type": "bytes"}, { "internalType": "enum Operation", "name": "operation", @@ -766,8 +766,8 @@ "name": "dataFlow", "type": "uint8" }, - { "internalType": "uint256", "name": "value", "type": "uint256" }, - { "internalType": "bool", "name": "termsOkCheck", "type": "bool" } + {"internalType": "uint256", "name": "value", "type": "uint256"}, + {"internalType": "bool", "name": "termsOkCheck", "type": "bool"} ], "internalType": "struct Action[]", "name": "actions", @@ -788,7 +788,7 @@ "name": "_task", "type": "tuple" }, - { "internalType": "uint256", "name": "_expiryDate", "type": "uint256" } + {"internalType": "uint256", "name": "_expiryDate", "type": "uint256"} ], "name": "submitTask", "outputs": [], @@ -799,8 +799,8 @@ "inputs": [ { "components": [ - { "internalType": "address", "name": "addr", "type": "address" }, - { "internalType": "address", "name": "module", "type": "address" } + {"internalType": "address", "name": "addr", "type": "address"}, + {"internalType": "address", "name": "module", "type": "address"} ], "internalType": "struct Provider", "name": "_provider", @@ -810,8 +810,8 @@ "components": [ { "components": [ - { "internalType": "address", "name": "inst", "type": "address" }, - { "internalType": "bytes", "name": "data", "type": "bytes" } + {"internalType": "address", "name": "inst", "type": "address"}, + {"internalType": "bytes", "name": "data", "type": "bytes"} ], "internalType": "struct Condition[]", "name": "conditions", @@ -819,8 +819,8 @@ }, { "components": [ - { "internalType": "address", "name": "addr", "type": "address" }, - { "internalType": "bytes", "name": "data", "type": "bytes" }, + {"internalType": "address", "name": "addr", "type": "address"}, + {"internalType": "bytes", "name": "data", "type": "bytes"}, { "internalType": "enum Operation", "name": "operation", @@ -831,8 +831,8 @@ "name": "dataFlow", "type": "uint8" }, - { "internalType": "uint256", "name": "value", "type": "uint256" }, - { "internalType": "bool", "name": "termsOkCheck", "type": "bool" } + {"internalType": "uint256", "name": "value", "type": "uint256"}, + {"internalType": "bool", "name": "termsOkCheck", "type": "bool"} ], "internalType": "struct Action[]", "name": "actions", @@ -853,7 +853,7 @@ "name": "_tasks", "type": "tuple[]" }, - { "internalType": "uint256", "name": "_expiryDate", "type": "uint256" }, + {"internalType": "uint256", "name": "_expiryDate", "type": "uint256"}, { "internalType": "uint256", "name": "_sumOfRequestedTaskSubmits", @@ -869,8 +869,8 @@ "inputs": [ { "components": [ - { "internalType": "address", "name": "addr", "type": "address" }, - { "internalType": "address", "name": "module", "type": "address" } + {"internalType": "address", "name": "addr", "type": "address"}, + {"internalType": "address", "name": "module", "type": "address"} ], "internalType": "struct Provider", "name": "_provider", @@ -880,8 +880,8 @@ "components": [ { "components": [ - { "internalType": "address", "name": "inst", "type": "address" }, - { "internalType": "bytes", "name": "data", "type": "bytes" } + {"internalType": "address", "name": "inst", "type": "address"}, + {"internalType": "bytes", "name": "data", "type": "bytes"} ], "internalType": "struct Condition[]", "name": "conditions", @@ -889,8 +889,8 @@ }, { "components": [ - { "internalType": "address", "name": "addr", "type": "address" }, - { "internalType": "bytes", "name": "data", "type": "bytes" }, + {"internalType": "address", "name": "addr", "type": "address"}, + {"internalType": "bytes", "name": "data", "type": "bytes"}, { "internalType": "enum Operation", "name": "operation", @@ -901,8 +901,8 @@ "name": "dataFlow", "type": "uint8" }, - { "internalType": "uint256", "name": "value", "type": "uint256" }, - { "internalType": "bool", "name": "termsOkCheck", "type": "bool" } + {"internalType": "uint256", "name": "value", "type": "uint256"}, + {"internalType": "bool", "name": "termsOkCheck", "type": "bool"} ], "internalType": "struct Action[]", "name": "actions", @@ -923,8 +923,8 @@ "name": "_tasks", "type": "tuple[]" }, - { "internalType": "uint256", "name": "_expiryDate", "type": "uint256" }, - { "internalType": "uint256", "name": "_cycles", "type": "uint256" } + {"internalType": "uint256", "name": "_expiryDate", "type": "uint256"}, + {"internalType": "uint256", "name": "_cycles", "type": "uint256"} ], "name": "submitTaskCycle", "outputs": [], diff --git a/pre-compiles/ProviderModuleDSA_ABI.json b/pre-compiles/ProviderModuleDSA_ABI.json index fbd2b8d..3f5ae90 100644 --- a/pre-compiles/ProviderModuleDSA_ABI.json +++ b/pre-compiles/ProviderModuleDSA_ABI.json @@ -6,16 +6,16 @@ "name": "_index", "type": "address" }, - { "internalType": "address", "name": "_gelatoCore", "type": "address" } + {"internalType": "address", "name": "_gelatoCore", "type": "address"} ], "stateMutability": "nonpayable", "type": "constructor" }, { "inputs": [ - { "internalType": "uint256", "name": "", "type": "uint256" }, - { "internalType": "address", "name": "", "type": "address" }, - { "internalType": "address", "name": "", "type": "address" }, + {"internalType": "uint256", "name": "", "type": "uint256"}, + {"internalType": "address", "name": "", "type": "address"}, + {"internalType": "address", "name": "", "type": "address"}, { "components": [ { @@ -25,7 +25,7 @@ "name": "inst", "type": "address" }, - { "internalType": "bytes", "name": "data", "type": "bytes" } + {"internalType": "bytes", "name": "data", "type": "bytes"} ], "internalType": "struct Condition[]", "name": "conditions", @@ -33,8 +33,8 @@ }, { "components": [ - { "internalType": "address", "name": "addr", "type": "address" }, - { "internalType": "bytes", "name": "data", "type": "bytes" }, + {"internalType": "address", "name": "addr", "type": "address"}, + {"internalType": "bytes", "name": "data", "type": "bytes"}, { "internalType": "enum Operation", "name": "operation", @@ -45,8 +45,8 @@ "name": "dataFlow", "type": "uint8" }, - { "internalType": "uint256", "name": "value", "type": "uint256" }, - { "internalType": "bool", "name": "termsOkCheck", "type": "bool" } + {"internalType": "uint256", "name": "value", "type": "uint256"}, + {"internalType": "bool", "name": "termsOkCheck", "type": "bool"} ], "internalType": "struct Action[]", "name": "actions", @@ -67,18 +67,18 @@ "name": "_task", "type": "tuple" }, - { "internalType": "uint256", "name": "", "type": "uint256" } + {"internalType": "uint256", "name": "", "type": "uint256"} ], "name": "execPayload", "outputs": [ - { "internalType": "bytes", "name": "payload", "type": "bytes" }, - { "internalType": "bool", "name": "", "type": "bool" } + {"internalType": "bytes", "name": "payload", "type": "bytes"}, + {"internalType": "bool", "name": "", "type": "bool"} ], "stateMutability": "view", "type": "function" }, { - "inputs": [{ "internalType": "bytes", "name": "", "type": "bytes" }], + "inputs": [{"internalType": "bytes", "name": "", "type": "bytes"}], "name": "execRevertCheck", "outputs": [], "stateMutability": "pure", @@ -87,7 +87,7 @@ { "inputs": [], "name": "gelatoCore", - "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "outputs": [{"internalType": "address", "name": "", "type": "address"}], "stateMutability": "view", "type": "function" }, @@ -106,8 +106,8 @@ }, { "inputs": [ - { "internalType": "address", "name": "_userProxy", "type": "address" }, - { "internalType": "address", "name": "", "type": "address" }, + {"internalType": "address", "name": "_userProxy", "type": "address"}, + {"internalType": "address", "name": "", "type": "address"}, { "components": [ { @@ -117,7 +117,7 @@ "name": "inst", "type": "address" }, - { "internalType": "bytes", "name": "data", "type": "bytes" } + {"internalType": "bytes", "name": "data", "type": "bytes"} ], "internalType": "struct Condition[]", "name": "conditions", @@ -125,8 +125,8 @@ }, { "components": [ - { "internalType": "address", "name": "addr", "type": "address" }, - { "internalType": "bytes", "name": "data", "type": "bytes" }, + {"internalType": "address", "name": "addr", "type": "address"}, + {"internalType": "bytes", "name": "data", "type": "bytes"}, { "internalType": "enum Operation", "name": "operation", @@ -137,8 +137,8 @@ "name": "dataFlow", "type": "uint8" }, - { "internalType": "uint256", "name": "value", "type": "uint256" }, - { "internalType": "bool", "name": "termsOkCheck", "type": "bool" } + {"internalType": "uint256", "name": "value", "type": "uint256"}, + {"internalType": "bool", "name": "termsOkCheck", "type": "bool"} ], "internalType": "struct Action[]", "name": "actions", @@ -161,7 +161,7 @@ } ], "name": "isProvided", - "outputs": [{ "internalType": "string", "name": "", "type": "string" }], + "outputs": [{"internalType": "string", "name": "", "type": "string"}], "stateMutability": "view", "type": "function" } diff --git a/test/0_setup-DSA-Gelato.test.js b/test/0_setup-DSA-Gelato.test.js index 9bcc1dd..3d4c6a5 100644 --- a/test/0_setup-DSA-Gelato.test.js +++ b/test/0_setup-DSA-Gelato.test.js @@ -1,8 +1,8 @@ // running `npx buidler test` automatically makes use of buidler-waffle plugin // => only dependency we need is "chai" -const { expect } = require("chai"); +const {expect} = require("chai"); const bre = require("@nomiclabs/buidler"); -const { ethers } = bre; +const {ethers} = bre; const GelatoCoreLib = require("@gelatonetwork/core"); //const { sleep } = GelatoCoreLib; @@ -194,7 +194,7 @@ describe("DSA setup with Gelato Tests", function () { ); // We withdraw to otherWallet to ignore gasUsed during test - const { 1: otherWallet } = await ethers.getSigners(); + const {1: otherWallet} = await ethers.getSigners(); // Instantiate Gelato ConnectBasic.withdraw Task const withdrawFromDSATask = new GelatoCoreLib.Task({ diff --git a/test/1_mv-DAI-DSR-Compound.test.js b/test/1_mv-DAI-DSR-Compound.test.js index 61f6a70..28d3047 100644 --- a/test/1_mv-DAI-DSR-Compound.test.js +++ b/test/1_mv-DAI-DSR-Compound.test.js @@ -1,8 +1,8 @@ // running `npx buidler test` automatically makes use of buidler-waffle plugin // => only dependency we need is "chai" -const { expect } = require("chai"); +const {expect} = require("chai"); const bre = require("@nomiclabs/buidler"); -const { ethers } = bre; +const {ethers} = bre; const GelatoCoreLib = require("@gelatonetwork/core"); //const { sleep } = GelatoCoreLib; diff --git a/yarn.lock b/yarn.lock index 3430848..9c316d1 100644 --- a/yarn.lock +++ b/yarn.lock @@ -671,6 +671,11 @@ resolved "https://registry.yarnpkg.com/@solidity-parser/parser/-/parser-0.5.2.tgz#4d74670ead39e4f4fdab605a393ba8ea2390a2c4" integrity sha512-uRyvnvVYmgNmTBpWDbBsH/0kPESQhQpEc4KsvMRLVzFJ1o1s0uIv0Y6Y9IB5vI1Dwz2CbS4X/y4Wyw/75cTFnQ== +"@solidity-parser/parser@^0.8.1": + version "0.8.1" + resolved "https://registry.yarnpkg.com/@solidity-parser/parser/-/parser-0.8.1.tgz#1b606578af86b9ad10755409804a6ba83f9ce8a4" + integrity sha512-DF7H6T8I4lo2IZOE2NZwt3631T8j1gjpQLjmvY2xBNK50c4ltslR4XPKwT6RkeSd4+xCAK0GHC/k7sbRDBE4Yw== + "@szmarczak/http-timer@^1.1.2": version "1.1.2" resolved "https://registry.yarnpkg.com/@szmarczak/http-timer/-/http-timer-1.1.2.tgz#b1665e2c461a2cd92f4c1bbf50d5454de0d4b421" @@ -2656,6 +2661,11 @@ diffie-hellman@^5.0.0: miller-rabin "^4.0.0" randombytes "^2.0.0" +dir-to-object@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/dir-to-object/-/dir-to-object-2.0.0.tgz#29723e9bd1c3e58e4f307bd04ff634c0370c8f8a" + integrity sha512-sXs0JKIhymON7T1UZuO2Ud6VTNAx/VTBXIl4+3mjb2RgfOpt+hectX0x04YqPOPdkeOAKoJuKqwqnXXURNPNEA== + doctrine@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/doctrine/-/doctrine-3.0.0.tgz#addebead72a6574db783639dc87a121773973961" @@ -2744,6 +2754,11 @@ emoji-regex@^8.0.0: resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-8.0.0.tgz#e818fd69ce5ccfcb404594f842963bf53164cc37" integrity sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A== +emoji-regex@^9.0.0: + version "9.1.1" + resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-9.1.1.tgz#1d5ffce26d8191e6c3f3a9d27987b1c5bba7d20a" + integrity sha512-AaWyDiNO9rbtMIcGl7tdxMcNu8SOLaDLxmQEFT5JhgKufOJzPPkYmgN2QwqTgw4doWMZZQttC6sUWVQjb+1VdA== + encodeurl@~1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/encodeurl/-/encodeurl-1.0.2.tgz#ad3ff4c86ec2d029322f5a02c3a9a606c95b3f59" @@ -2880,6 +2895,11 @@ escape-string-regexp@1.0.5, escape-string-regexp@^1.0.2, escape-string-regexp@^1 resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4" integrity sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ= +escape-string-regexp@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz#14ba83a5d373e3d311e5afca29cf5bfad965bf34" + integrity sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA== + eslint-config-prettier@6.12.0: version "6.12.0" resolved "https://registry.yarnpkg.com/eslint-config-prettier/-/eslint-config-prettier-6.12.0.tgz#9eb2bccff727db1c52104f0b49e87ea46605a0d2" @@ -2959,6 +2979,13 @@ espree@^7.3.0: acorn-jsx "^5.2.0" eslint-visitor-keys "^1.3.0" +esprima-extract-comments@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/esprima-extract-comments/-/esprima-extract-comments-1.1.0.tgz#0dacab567a5900240de6d344cf18c33617becbc9" + integrity sha512-sBQUnvJwpeE9QnPrxh7dpI/dp67erYG4WXEAreAMoelPRpMR7NWb4YtwRPn9b+H1uLQKl/qS8WYmyaljTpjIsw== + dependencies: + esprima "^4.0.0" + esprima@^4.0.0: version "4.0.1" resolved "https://registry.yarnpkg.com/esprima/-/esprima-4.0.1.tgz#13b04cdb3e6c5d19df91ab6987a8695619b0aa71" @@ -3594,6 +3621,14 @@ extglob@^2.0.4: snapdragon "^0.8.1" to-regex "^3.0.1" +extract-comments@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/extract-comments/-/extract-comments-1.1.0.tgz#b90bca033a056bd69b8ba1c6b6b120fc2ee95c18" + integrity sha512-dzbZV2AdSSVW/4E7Ti5hZdHWbA+Z80RJsJhr5uiL10oyjl/gy7/o+HI1HwK4/WSZhlq4SNKU3oUzXlM13Qx02Q== + dependencies: + esprima-extract-comments "^1.1.0" + parse-code-context "^1.0.0" + extsprintf@1.3.0: version "1.3.0" resolved "https://registry.yarnpkg.com/extsprintf/-/extsprintf-1.3.0.tgz#96918440e3041a7a414f8c52e3c574eb3c3e1e05" @@ -6075,6 +6110,11 @@ parse-asn1@^5.0.0, parse-asn1@^5.1.5: pbkdf2 "^3.0.3" safe-buffer "^5.1.1" +parse-code-context@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/parse-code-context/-/parse-code-context-1.0.0.tgz#718c295c593d0d19a37f898473268cc75e98de1e" + integrity sha512-OZQaqKaQnR21iqhlnPfVisFjBWjhnMl5J9MgbP8xC+EwoVqbXrq78lp+9Zb3ahmLzrIX5Us/qbvBnaS3hkH6OA== + parse-headers@^2.0.0: version "2.0.3" resolved "https://registry.yarnpkg.com/parse-headers/-/parse-headers-2.0.3.tgz#5e8e7512383d140ba02f0c7aa9f49b4399c92515" @@ -6288,7 +6328,21 @@ prepend-http@^2.0.0: resolved "https://registry.yarnpkg.com/prepend-http/-/prepend-http-2.0.0.tgz#e92434bfa5ea8c19f41cdfd401d741a3c819d897" integrity sha1-6SQ0v6XqjBn0HN/UAddBo8gZ2Jc= -prettier@2.1.2: +prettier-plugin-solidity@1.0.0-alpha.59: + version "1.0.0-alpha.59" + resolved "https://registry.yarnpkg.com/prettier-plugin-solidity/-/prettier-plugin-solidity-1.0.0-alpha.59.tgz#b0cf82fb068537d152d0bc417588d08e952a56c6" + integrity sha512-6cE0SWaiYCBoJY4clCfsbWlEEOU4K42Ny6Tg4Jwprgts/q+AVfYnPQ5coRs7zIjYzc4RVspifYPeh+oAg8RpLw== + dependencies: + "@solidity-parser/parser" "^0.8.1" + dir-to-object "^2.0.0" + emoji-regex "^9.0.0" + escape-string-regexp "^4.0.0" + extract-comments "^1.1.0" + prettier "^2.0.5" + semver "^7.3.2" + string-width "^4.2.0" + +prettier@2.1.2, prettier@^2.0.5: version "2.1.2" resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.1.2.tgz#3050700dae2e4c8b67c4c3f666cdb8af405e1ce5" integrity sha512-16c7K+x4qVlJg9rEbXl7HEGmQyZlG4R9AgP+oHKRMsMsuk8s+ATStlf1NpDqyBI1HpVyfjLOeMhH2LvuNvV5Vg== @@ -6875,7 +6929,7 @@ semver@^6.3.0: resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.0.tgz#ee0a64c8af5e8ceea67687b133761e1becbd1d3d" integrity sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw== -semver@^7.2.1: +semver@^7.2.1, semver@^7.3.2: version "7.3.2" resolved "https://registry.yarnpkg.com/semver/-/semver-7.3.2.tgz#604962b052b81ed0786aae84389ffba70ffd3938" integrity sha512-OrOb32TeeambH6UrhtShmF7CRDqhL6/5XpPNp2DuRH6+9QLw/orhp72j87v8Qa1ScDkvrrBNpZcDejAirJmfXQ==