From 5db0d7178cd6a3c807db4586eeb22a16229e9213 Mon Sep 17 00:00:00 2001 From: Chris Maree Date: Wed, 5 May 2021 11:50:17 +0200 Subject: [PATCH] feat(core): updated solidity version to 0.8.x (#2924) --- .circleci/config.yml | 21 --- .dockerignore | 1 - ci/docgen.sh | 6 - package.json | 2 +- packages/common/src/HardhatConfig.js | 2 +- packages/common/src/TruffleConfig.js | 2 +- packages/core/contracts/Migrations.sol | 4 +- .../action-wrappers/LiquidationWithdrawer.sol | 5 +- .../action-wrappers/TokenRedeemer.sol | 5 +- .../action-wrappers/TokenSender.sol | 4 +- .../ReserveCurrencyLiquidator.sol | 7 +- .../uniswap-broker/UniswapBroker.sol | 147 ++++++++++++++-- .../core/contracts/chainbridge/Bridge.sol | 17 +- .../contracts/chainbridge/GenericHandler.sol | 7 +- .../core/contracts/chainbridge/IBridge.sol | 3 +- .../contracts/chainbridge/IDepositExecute.sol | 3 +- .../contracts/chainbridge/IERCHandler.sol | 3 +- .../contracts/chainbridge/IGenericHandler.sol | 3 +- .../implementation/AddressWhitelist.sol | 2 +- .../common/implementation/DSProxyFactory.sol | 6 +- .../common/implementation/ExpandedERC20.sol | 12 +- .../common/implementation/FixedPoint.sol | 6 +- .../common/implementation/Lockable.sol | 4 +- .../common/implementation/MultiRole.sol | 2 +- .../common/implementation/Testable.sol | 6 +- .../common/implementation/TestnetERC20.sol | 17 +- .../contracts/common/implementation/Timer.sol | 6 +- .../common/implementation/Withdrawable.sol | 6 +- .../contracts/common/interfaces/Balancer.sol | 2 +- .../common/interfaces/ExpandedIERC20.sol | 2 +- .../common/interfaces/IERC20Standard.sol | 2 +- .../contracts/common/interfaces/Multicall.sol | 3 +- .../common/interfaces/TransactionBatcher.sol | 4 +- .../contracts/common/interfaces/UniswapV2.sol | 2 +- .../contracts/common/interfaces/UniswapV3.sol | 2 +- .../common/interfaces/VaultInterface.sol | 2 +- .../contracts/common/test/BalancerMock.sol | 2 +- .../core/contracts/common/test/BasicERC20.sol | 4 +- .../contracts/common/test/MultiRoleTest.sol | 2 +- .../contracts/common/test/MulticallMock.sol | 2 +- .../contracts/common/test/PerpetualMock.sol | 6 +- .../common/test/ReentrancyAttack.sol | 2 +- .../common/test/ReentrancyChecker.sol | 2 +- .../contracts/common/test/ReentrancyMock.sol | 4 +- .../common/test/SignedFixedPointTest.sol | 2 +- .../contracts/common/test/TestableTest.sol | 6 +- .../contracts/common/test/UniswapV2Mock.sol | 2 +- .../contracts/common/test/UniswapV3Mock.sol | 2 +- .../common/test/UnsignedFixedPointTest.sol | 2 +- .../core/contracts/common/test/VaultMock.sol | 4 +- .../common/test/WithdrawableTest.sol | 4 +- .../common/EmergencyShutdownable.sol | 8 +- .../financial-templates/common/FeePayer.sol | 8 +- .../common/FundingRateApplier.sol | 10 +- .../common/SyntheticToken.sol | 4 +- .../common/TokenFactory.sol | 2 +- .../financial-templates/common/WETH9.sol | 6 +- .../CoveredCallFinancialProductLibrary.sol | 7 +- .../FinancialProductLibrary.sol | 5 +- .../KpiOptionsFinancialProductLibrary.sol | 5 +- ...rTransformationFinancialProductLibrary.sol | 5 +- ...rTransformationFinancialProductLibrary.sol | 5 +- .../StructuredNoteFinancialProductLibrary.sol | 7 +- .../financial-templates/demo/DepositBox.sol | 15 +- .../ExpiringMultiParty.sol | 5 +- .../ExpiringMultiPartyCreator.sol | 8 +- .../ExpiringMultiPartyLib.sol | 4 +- .../expiring-multiparty/Liquidatable.sol | 10 +- .../PricelessPositionManager.sol | 10 +- .../perpetual-multiparty/ConfigStore.sol | 10 +- .../ConfigStoreInterface.sol | 4 +- .../perpetual-multiparty/Perpetual.sol | 5 +- .../perpetual-multiparty/PerpetualCreator.sol | 6 +- .../perpetual-multiparty/PerpetualLib.sol | 4 +- .../PerpetualLiquidatable.sol | 10 +- .../PerpetualPositionManager.sol | 9 +- .../test/ExpiringMultiPartyMock.sol | 7 +- .../test/FinancialProductLibraryTest.sol | 9 +- .../test/FundingRateApplierTest.sol | 5 +- .../implementation/MerkleDistributor.sol | 9 +- .../oracle/implementation/Constants.sol | 2 +- .../oracle/implementation/ContractCreator.sol | 4 +- .../implementation/DesignatedVoting.sol | 6 +- .../DesignatedVotingFactory.sol | 6 +- .../FinancialContractsAdmin.sol | 2 +- .../oracle/implementation/Finder.sol | 2 +- .../oracle/implementation/Governor.sol | 10 +- .../implementation/IdentifierWhitelist.sol | 2 +- .../implementation/OptimisticOracle.sol | 10 +- .../oracle/implementation/Registry.sol | 8 +- .../implementation/ResultComputation.sol | 2 +- .../contracts/oracle/implementation/Store.sol | 10 +- .../oracle/implementation/TokenMigrator.sol | 6 +- .../oracle/implementation/VoteTiming.sol | 4 +- .../oracle/implementation/Voting.sol | 24 +-- .../oracle/implementation/VotingToken.sol | 24 ++- .../implementation/test/GovernorTest.sol | 6 +- .../implementation/test/MockAdministratee.sol | 4 +- .../test/OptimisticRequesterTest.sol | 4 +- .../test/ResultComputationTest.sol | 4 +- .../implementation/test/VoteTimingTest.sol | 4 +- .../oracle/implementation/test/VotingTest.sol | 5 +- .../interfaces/AdministrateeInterface.sol | 4 +- .../oracle/interfaces/FinderInterface.sol | 2 +- .../IdentifierWhitelistInterface.sol | 4 +- .../interfaces/OptimisticOracleInterface.sol | 4 +- .../interfaces/OracleAncillaryInterface.sol | 2 +- .../oracle/interfaces/OracleInterface.sol | 2 +- .../oracle/interfaces/RegistryInterface.sol | 4 +- .../oracle/interfaces/StoreInterface.sol | 4 +- .../interfaces/VotingAncillaryInterface.sol | 4 +- .../oracle/interfaces/VotingInterface.sol | 4 +- .../core/contracts/oracle/test/MockOracle.sol | 6 +- .../oracle/test/MockOracleAncillary.sol | 6 +- .../test/VotingAncillaryInterfaceTest.sol | 4 +- .../oracle/test/VotingInterfaceTest.sol | 4 +- .../core/contracts/umips/Umip3Upgrader.sol | 4 +- .../core/contracts/umips/VotingUpgrader.sol | 4 +- packages/core/package.json | 5 +- .../merkle-distributor/MerkleDistributor.js | 21 ++- .../serverless-orchestration/package.json | 3 +- .../test/ServerlessHub.js | 11 +- .../test/ServerlessSpoke.js | 11 +- playbook.yml | 13 -- scripts/build_docs_site.sh | 130 -------------- scripts/deploy_docs.sh | 39 ----- yarn.lock | 161 +++--------------- 127 files changed, 507 insertions(+), 674 deletions(-) delete mode 100755 ci/docgen.sh delete mode 100644 playbook.yml delete mode 100755 scripts/build_docs_site.sh delete mode 100755 scripts/deploy_docs.sh diff --git a/.circleci/config.yml b/.circleci/config.yml index 2cf7260061..8b314f3500 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -48,24 +48,6 @@ jobs: - run: name: Lint command: ./ci/lint.sh - docs: - docker: - - image: circleci/node:lts - working_directory: ~/protocol - steps: - - restore_cache: - key: protocol-{{ .Environment.CIRCLE_SHA1 }} - - run: - name: Install Pandoc - command: wget https://github.com/jgm/pandoc/releases/download/2.7.3/pandoc-2.7.3-linux.tar.gz - - run: - name: Untar Pandoc - command: sudo tar xvzf pandoc-2.7.3-linux.tar.gz --strip-components 1 -C /usr/local - - run: - name: Generate Docs - command: ./scripts/build_docs_site.sh - - store_artifacts: - path: build/site test: executor: continuation/default steps: @@ -158,9 +140,6 @@ workflows: context: api_keys requires: - build - - docs: - requires: - - checkout_and_install - dapp_build: requires: - build diff --git a/.dockerignore b/.dockerignore index d5c8935156..2bff7dfe77 100644 --- a/.dockerignore +++ b/.dockerignore @@ -13,7 +13,6 @@ coverage coverage.json out.log .GckmsOverride.js -docs modules public ui diff --git a/ci/docgen.sh b/ci/docgen.sh deleted file mode 100755 index cd1e92bebf..0000000000 --- a/ci/docgen.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/usr/bin/env bash - -# Note: because we've forked the solidity-docgen library, providing the path alias doesn't have an effect. However, -# once external libraries are supported in v2 and we deprecate our fork, this will allow the docgen to find the -# openzeppelin directory. See https://github.com/OpenZeppelin/solidity-docgen/issues/24 for progress on that front. -yarn run solidity-docgen -i ./packages/core/contracts -t documentation -x adoc -e packages/core/contracts/oracle/test diff --git a/package.json b/package.json index b0caa5f695..cdebfd498e 100644 --- a/package.json +++ b/package.json @@ -51,7 +51,7 @@ "prettier-plugin-solidity": "^1.0.0-beta.1", "pretty-quick": "^2.0.1", "secp256k1": "^3.7.1", - "solidity-docgen": "^0.5.3", + "solc-0.8": "npm:solc@^0.8.4", "truffle": "^5.2.3", "web3": "^1.3.4" }, diff --git a/packages/common/src/HardhatConfig.js b/packages/common/src/HardhatConfig.js index dc27171acd..d01c86a195 100644 --- a/packages/common/src/HardhatConfig.js +++ b/packages/common/src/HardhatConfig.js @@ -22,7 +22,7 @@ function getHardhatConfig(configOverrides) { require("@nomiclabs/hardhat-web3"); // Solc version defined here so etherscan-verification has access to it - const solcVersion = "0.6.12"; + const solcVersion = "0.8.4"; task("test") .addFlag("debug", "Compile without optimizer") diff --git a/packages/common/src/TruffleConfig.js b/packages/common/src/TruffleConfig.js index 9c9dc1fbfb..d0b7b25412 100644 --- a/packages/common/src/TruffleConfig.js +++ b/packages/common/src/TruffleConfig.js @@ -197,7 +197,7 @@ function getTruffleConfig(truffleContextDir = "./") { }, compilers: { solc: { - version: "0.6.12", + version: "0.8.4", settings: { optimizer: { enabled: true, diff --git a/packages/core/contracts/Migrations.sol b/packages/core/contracts/Migrations.sol index 24652fb99e..0ee808d1b6 100644 --- a/packages/core/contracts/Migrations.sol +++ b/packages/core/contracts/Migrations.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: AGPL-3.0-only -pragma solidity ^0.6.0; +pragma solidity ^0.8.0; /** * @title Used internally by Truffle migrations. @@ -9,7 +9,7 @@ contract Migrations { address public owner; uint256 public last_completed_migration; - constructor() public { + constructor() { owner = msg.sender; } diff --git a/packages/core/contracts/bot-helpers/action-wrappers/LiquidationWithdrawer.sol b/packages/core/contracts/bot-helpers/action-wrappers/LiquidationWithdrawer.sol index e2ad758ca5..7fb4afcd20 100644 --- a/packages/core/contracts/bot-helpers/action-wrappers/LiquidationWithdrawer.sol +++ b/packages/core/contracts/bot-helpers/action-wrappers/LiquidationWithdrawer.sol @@ -1,5 +1,6 @@ -pragma solidity ^0.6.0; -pragma experimental ABIEncoderV2; +// SPDX-License-Identifier: AGPL-3.0-only +pragma solidity ^0.8.0; +pragma abicoder v2; import "../../common/implementation/FixedPoint.sol"; diff --git a/packages/core/contracts/bot-helpers/action-wrappers/TokenRedeemer.sol b/packages/core/contracts/bot-helpers/action-wrappers/TokenRedeemer.sol index 64ee90fabc..fcbd88dee3 100644 --- a/packages/core/contracts/bot-helpers/action-wrappers/TokenRedeemer.sol +++ b/packages/core/contracts/bot-helpers/action-wrappers/TokenRedeemer.sol @@ -1,5 +1,6 @@ -pragma solidity ^0.6.0; -pragma experimental ABIEncoderV2; +// SPDX-License-Identifier: AGPL-3.0-only +pragma solidity ^0.8.0; +pragma abicoder v2; import "../../common/implementation/FixedPoint.sol"; import "@uniswap/lib/contracts/libraries/TransferHelper.sol"; diff --git a/packages/core/contracts/bot-helpers/action-wrappers/TokenSender.sol b/packages/core/contracts/bot-helpers/action-wrappers/TokenSender.sol index a1514c8cc5..e939431428 100644 --- a/packages/core/contracts/bot-helpers/action-wrappers/TokenSender.sol +++ b/packages/core/contracts/bot-helpers/action-wrappers/TokenSender.sol @@ -1,6 +1,6 @@ // SPDX-License-Identifier: AGPL-3.0-only -pragma solidity ^0.6.0; -pragma experimental ABIEncoderV2; +pragma solidity ^0.8.0; +pragma abicoder v2; import "../../common/implementation/ExpandedERC20.sol"; diff --git a/packages/core/contracts/bot-helpers/atomic-liquidator/ReserveCurrencyLiquidator.sol b/packages/core/contracts/bot-helpers/atomic-liquidator/ReserveCurrencyLiquidator.sol index 378df06539..c56b2203f5 100644 --- a/packages/core/contracts/bot-helpers/atomic-liquidator/ReserveCurrencyLiquidator.sol +++ b/packages/core/contracts/bot-helpers/atomic-liquidator/ReserveCurrencyLiquidator.sol @@ -1,7 +1,8 @@ -pragma solidity ^0.6.0; -pragma experimental ABIEncoderV2; +// SPDX-License-Identifier: AGPL-3.0-only +pragma solidity ^0.8.0; +pragma abicoder v2; -import "@openzeppelin/contracts/math/SafeMath.sol"; +import "@openzeppelin/contracts/utils/math/SafeMath.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@uniswap/lib/contracts/libraries/TransferHelper.sol"; diff --git a/packages/core/contracts/bot-helpers/uniswap-broker/UniswapBroker.sol b/packages/core/contracts/bot-helpers/uniswap-broker/UniswapBroker.sol index b9a51153a0..dae71696c5 100644 --- a/packages/core/contracts/bot-helpers/uniswap-broker/UniswapBroker.sol +++ b/packages/core/contracts/bot-helpers/uniswap-broker/UniswapBroker.sol @@ -1,11 +1,11 @@ -pragma solidity ^0.6.0; +// SPDX-License-Identifier: AGPL-3.0-only +pragma solidity ^0.8.0; -import "@openzeppelin/contracts/math/SafeMath.sol"; +import "@openzeppelin/contracts/utils/math/SafeMath.sol"; import "@uniswap/v2-core/contracts/interfaces/IUniswapV2Pair.sol"; import "@uniswap/lib/contracts/libraries/Babylonian.sol"; import "@uniswap/lib/contracts/libraries/TransferHelper.sol"; -import "@uniswap/lib/contracts/libraries/FullMath.sol"; import "@uniswap/v2-periphery/contracts/interfaces/IUniswapV2Router01.sol"; /** @@ -128,10 +128,7 @@ contract UniswapBroker { // The methods below are taken from https://github.com/Uniswap/uniswap-v2-periphery/blob/master/contracts/libraries/UniswapV2Library.sol // We could import this library into this contract but this library is dependent Uniswap's SafeMath, which is bound - // to solidity 6.6.6. Hardhat can easily deal with two different sets of solidity versions within one project so - // unit tests would continue to work fine. However, this would break truffle support in the repo as truffle cant - // handel having two different solidity versions. As a work around, the specific methods needed in the UniswapBroker - // are simply moved here to maintain truffle support. + // to solidity 6.6.6. UMA uses 0.8.0 and so a modified version is needed to accomidate this solidity version. function getReserves( address factory, address tokenA, @@ -156,16 +153,138 @@ contract UniswapBroker { ) internal pure returns (address pair) { (address token0, address token1) = sortTokens(tokenA, tokenB); pair = address( - uint256( - keccak256( - abi.encodePacked( - hex"ff", - factory, - keccak256(abi.encodePacked(token0, token1)), - hex"96e8ac4277198ff8b6f785478aa9a39f403cb768dd02cbee326c3e7da348845f" // init code hash + uint160( + uint256( + keccak256( + abi.encodePacked( + hex"ff", + factory, + keccak256(abi.encodePacked(token0, token1)), + hex"96e8ac4277198ff8b6f785478aa9a39f403cb768dd02cbee326c3e7da348845f" // init code hash + ) ) ) ) ); } } + +// The library below is taken from @uniswap/lib/contracts/libraries/FullMath.sol. It has been modified to work with solidity 0.8 +library FullMath { + /// @notice Calculates floor(a×b÷denominator) with full precision. Throws if result overflows a uint256 or denominator == 0 + /// @param a The multiplicand + /// @param b The multiplier + /// @param denominator The divisor + /// @return result The 256-bit result + /// @dev Credit to Remco Bloemen under MIT license https://xn--2-umb.com/21/muldiv + function mulDiv( + uint256 a, + uint256 b, + uint256 denominator + ) internal pure returns (uint256 result) { + // 512-bit multiply [prod1 prod0] = a * b + // Compute the product mod 2**256 and mod 2**256 - 1 + // then use the Chinese Remainder Theorem to reconstruct + // the 512 bit result. The result is stored in two 256 + // variables such that product = prod1 * 2**256 + prod0 + uint256 prod0; // Least significant 256 bits of the product + uint256 prod1; // Most significant 256 bits of the product + assembly { + let mm := mulmod(a, b, not(0)) + prod0 := mul(a, b) + prod1 := sub(sub(mm, prod0), lt(mm, prod0)) + } + + // Handle non-overflow cases, 256 by 256 division + if (prod1 == 0) { + require(denominator > 0); + assembly { + result := div(prod0, denominator) + } + return result; + } + + // Make sure the result is less than 2**256. + // Also prevents denominator == 0 + require(denominator > prod1); + + /////////////////////////////////////////////// + // 512 by 256 division. + /////////////////////////////////////////////// + + // Make division exact by subtracting the remainder from [prod1 prod0] + // Compute remainder using mulmod + uint256 remainder; + assembly { + remainder := mulmod(a, b, denominator) + } + // Subtract 256 bit number from 512 bit number + assembly { + prod1 := sub(prod1, gt(remainder, prod0)) + prod0 := sub(prod0, remainder) + } + + // Factor powers of two out of denominator + // Compute largest power of two divisor of denominator. + // Always >= 1. + uint256 twos = denominator & (~denominator + 1); + // Divide denominator by power of two + assembly { + denominator := div(denominator, twos) + } + + // Divide [prod1 prod0] by the factors of two + assembly { + prod0 := div(prod0, twos) + } + // Shift in bits from prod1 into prod0. For this we need + // to flip `twos` such that it is 2**256 / twos. + // If twos is zero, then it becomes one + assembly { + twos := add(div(sub(0, twos), twos), 1) + } + prod0 |= prod1 * twos; + + // Invert denominator mod 2**256 + // Now that denominator is an odd number, it has an inverse + // modulo 2**256 such that denominator * inv = 1 mod 2**256. + // Compute the inverse by starting with a seed that is correct + // correct for four bits. That is, denominator * inv = 1 mod 2**4 + uint256 inv = (3 * denominator) ^ 2; + // Now use Newton-Raphson iteration to improve the precision. + // Thanks to Hensel's lifting lemma, this also works in modular + // arithmetic, doubling the correct bits in each step. + inv *= 2 - denominator * inv; // inverse mod 2**8 + inv *= 2 - denominator * inv; // inverse mod 2**16 + inv *= 2 - denominator * inv; // inverse mod 2**32 + inv *= 2 - denominator * inv; // inverse mod 2**64 + inv *= 2 - denominator * inv; // inverse mod 2**128 + inv *= 2 - denominator * inv; // inverse mod 2**256 + + // Because the division is now exact we can divide by multiplying + // with the modular inverse of denominator. This will give us the + // correct result modulo 2**256. Since the precoditions guarantee + // that the outcome is less than 2**256, this is the final result. + // We don't need to compute the high bits of the result and prod1 + // is no longer required. + result = prod0 * inv; + return result; + } + + /// @notice Calculates ceil(a×b÷denominator) with full precision. Throws if result overflows a uint256 or denominator == 0 + /// @param a The multiplicand + /// @param b The multiplier + /// @param denominator The divisor + /// @return result The 256-bit result + function mulDivRoundingUp( + uint256 a, + uint256 b, + uint256 denominator + ) internal pure returns (uint256 result) { + result = mulDiv(a, b, denominator); + if (mulmod(a, b, denominator) > 0) { + require(result < type(uint256).max); + result++; + } + } +} diff --git a/packages/core/contracts/chainbridge/Bridge.sol b/packages/core/contracts/chainbridge/Bridge.sol index a233ae4cb8..75c1637297 100644 --- a/packages/core/contracts/chainbridge/Bridge.sol +++ b/packages/core/contracts/chainbridge/Bridge.sol @@ -1,9 +1,10 @@ -pragma solidity ^0.6.0; -pragma experimental ABIEncoderV2; +// SPDX-License-Identifier: AGPL-3.0-only +pragma solidity ^0.8.0; +pragma abicoder v2; import "@openzeppelin/contracts/access/AccessControl.sol"; -import "@openzeppelin/contracts/utils/Pausable.sol"; -import "@openzeppelin/contracts/math/SafeMath.sol"; +import "@openzeppelin/contracts/security/Pausable.sol"; +import "@openzeppelin/contracts/utils/math/SafeMath.sol"; import "./IDepositExecute.sol"; import "./IBridge.sol"; import "./IERCHandler.sol"; @@ -83,18 +84,18 @@ contract Bridge is Pausable, AccessControl { _; } - function _onlyAdminOrRelayer() private { + function _onlyAdminOrRelayer() private view { require( hasRole(DEFAULT_ADMIN_ROLE, msg.sender) || hasRole(RELAYER_ROLE, msg.sender), "sender is not relayer or admin" ); } - function _onlyAdmin() private { + function _onlyAdmin() private view { require(hasRole(DEFAULT_ADMIN_ROLE, msg.sender), "sender doesn't have admin role"); } - function _onlyRelayers() private { + function _onlyRelayers() private view { require(hasRole(RELAYER_ROLE, msg.sender), "sender doesn't have relayer role"); } @@ -111,7 +112,7 @@ contract Bridge is Pausable, AccessControl { uint256 initialRelayerThreshold, uint256 fee, uint256 expiry - ) public { + ) { _chainID = chainID; _relayerThreshold = initialRelayerThreshold; _fee = fee; diff --git a/packages/core/contracts/chainbridge/GenericHandler.sol b/packages/core/contracts/chainbridge/GenericHandler.sol index 61cb209727..27c5ffb583 100644 --- a/packages/core/contracts/chainbridge/GenericHandler.sol +++ b/packages/core/contracts/chainbridge/GenericHandler.sol @@ -1,5 +1,6 @@ -pragma solidity ^0.6.0; -pragma experimental ABIEncoderV2; +// SPDX-License-Identifier: AGPL-3.0-only +pragma solidity ^0.8.0; +pragma abicoder v2; import "./IGenericHandler.sol"; @@ -68,7 +69,7 @@ contract GenericHandler is IGenericHandler { address[] memory initialContractAddresses, bytes4[] memory initialDepositFunctionSignatures, bytes4[] memory initialExecuteFunctionSignatures - ) public { + ) { require( initialResourceIDs.length == initialContractAddresses.length, "initialResourceIDs and initialContractAddresses len mismatch" diff --git a/packages/core/contracts/chainbridge/IBridge.sol b/packages/core/contracts/chainbridge/IBridge.sol index 032d211e63..55d767f77c 100644 --- a/packages/core/contracts/chainbridge/IBridge.sol +++ b/packages/core/contracts/chainbridge/IBridge.sol @@ -1,4 +1,5 @@ -pragma solidity ^0.6.0; +// SPDX-License-Identifier: AGPL-3.0-only +pragma solidity ^0.8.0; /** @title Interface for Bridge contract. diff --git a/packages/core/contracts/chainbridge/IDepositExecute.sol b/packages/core/contracts/chainbridge/IDepositExecute.sol index a32acd4af4..bc8df3b9c4 100644 --- a/packages/core/contracts/chainbridge/IDepositExecute.sol +++ b/packages/core/contracts/chainbridge/IDepositExecute.sol @@ -1,4 +1,5 @@ -pragma solidity ^0.6.0; +// SPDX-License-Identifier: AGPL-3.0-only +pragma solidity ^0.8.0; /** @title Interface for handler contracts that support deposits and deposit executions. diff --git a/packages/core/contracts/chainbridge/IERCHandler.sol b/packages/core/contracts/chainbridge/IERCHandler.sol index c1889af7fd..b46c742364 100644 --- a/packages/core/contracts/chainbridge/IERCHandler.sol +++ b/packages/core/contracts/chainbridge/IERCHandler.sol @@ -1,4 +1,5 @@ -pragma solidity ^0.6.0; +// SPDX-License-Identifier: AGPL-3.0-only +pragma solidity ^0.8.0; /** @title Interface to be used with handlers that support ERC20s and ERC721s. diff --git a/packages/core/contracts/chainbridge/IGenericHandler.sol b/packages/core/contracts/chainbridge/IGenericHandler.sol index 2f50b57709..b0efba116a 100644 --- a/packages/core/contracts/chainbridge/IGenericHandler.sol +++ b/packages/core/contracts/chainbridge/IGenericHandler.sol @@ -1,4 +1,5 @@ -pragma solidity ^0.6.0; +// SPDX-License-Identifier: AGPL-3.0-only +pragma solidity ^0.8.0; /** @title Interface for handler that handles generic deposits and deposit executions. diff --git a/packages/core/contracts/common/implementation/AddressWhitelist.sol b/packages/core/contracts/common/implementation/AddressWhitelist.sol index 37b9c2b009..61bc015958 100644 --- a/packages/core/contracts/common/implementation/AddressWhitelist.sol +++ b/packages/core/contracts/common/implementation/AddressWhitelist.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: AGPL-3.0-only -pragma solidity ^0.6.0; +pragma solidity ^0.8.0; import "@openzeppelin/contracts/access/Ownable.sol"; import "./Lockable.sol"; diff --git a/packages/core/contracts/common/implementation/DSProxyFactory.sol b/packages/core/contracts/common/implementation/DSProxyFactory.sol index 80ff93b872..8fe5606998 100644 --- a/packages/core/contracts/common/implementation/DSProxyFactory.sol +++ b/packages/core/contracts/common/implementation/DSProxyFactory.sol @@ -23,7 +23,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -pragma solidity ^0.6.0; +pragma solidity ^0.8.0; abstract contract DSAuthority { function canCall( @@ -42,7 +42,7 @@ contract DSAuth is DSAuthEvents { DSAuthority public authority; address public owner; - constructor() public { + constructor() { owner = msg.sender; emit LogSetOwner(msg.sender); } @@ -67,7 +67,7 @@ contract DSAuth is DSAuthEvents { return true; } else if (src == owner) { return true; - } else if (authority == DSAuthority(0)) { + } else if (authority == DSAuthority(address(0))) { return false; } else { return authority.canCall(src, address(this), sig); diff --git a/packages/core/contracts/common/implementation/ExpandedERC20.sol b/packages/core/contracts/common/implementation/ExpandedERC20.sol index 18ce486b0d..764ebf4725 100644 --- a/packages/core/contracts/common/implementation/ExpandedERC20.sol +++ b/packages/core/contracts/common/implementation/ExpandedERC20.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: AGPL-3.0-only -pragma solidity ^0.6.0; +pragma solidity ^0.8.0; import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import "./MultiRole.sol"; @@ -19,6 +19,8 @@ contract ExpandedERC20 is ExpandedIERC20, ERC20, MultiRole { Burner } + uint8 _decimals; + /** * @notice Constructs the ExpandedERC20. * @param _tokenName The name which describes the new token. @@ -29,13 +31,17 @@ contract ExpandedERC20 is ExpandedIERC20, ERC20, MultiRole { string memory _tokenName, string memory _tokenSymbol, uint8 _tokenDecimals - ) public ERC20(_tokenName, _tokenSymbol) { - _setupDecimals(_tokenDecimals); + ) ERC20(_tokenName, _tokenSymbol) { + _decimals = _tokenDecimals; _createExclusiveRole(uint256(Roles.Owner), uint256(Roles.Owner), msg.sender); _createSharedRole(uint256(Roles.Minter), uint256(Roles.Owner), new address[](0)); _createSharedRole(uint256(Roles.Burner), uint256(Roles.Owner), new address[](0)); } + function decimals() public view virtual override(ERC20) returns (uint8) { + return _decimals; + } + /** * @dev Mints `value` tokens to `recipient`, returning true on success. * @param recipient address to mint to. diff --git a/packages/core/contracts/common/implementation/FixedPoint.sol b/packages/core/contracts/common/implementation/FixedPoint.sol index 65e2790041..a8e8495daa 100644 --- a/packages/core/contracts/common/implementation/FixedPoint.sol +++ b/packages/core/contracts/common/implementation/FixedPoint.sol @@ -1,8 +1,8 @@ // SPDX-License-Identifier: AGPL-3.0-only -pragma solidity ^0.6.0; +pragma solidity ^0.8.0; -import "@openzeppelin/contracts/math/SafeMath.sol"; -import "@openzeppelin/contracts/math/SignedSafeMath.sol"; +import "@openzeppelin/contracts/utils/math/SafeMath.sol"; +import "@openzeppelin/contracts/utils/math/SignedSafeMath.sol"; /** * @title Library for fixed point arithmetic on uints diff --git a/packages/core/contracts/common/implementation/Lockable.sol b/packages/core/contracts/common/implementation/Lockable.sol index 7eab9824ca..42e4f61e59 100644 --- a/packages/core/contracts/common/implementation/Lockable.sol +++ b/packages/core/contracts/common/implementation/Lockable.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: AGPL-3.0-only -pragma solidity ^0.6.0; +pragma solidity ^0.8.0; /** * @title A contract that provides modifiers to prevent reentrancy to state-changing and view-only methods. This contract @@ -9,7 +9,7 @@ pragma solidity ^0.6.0; contract Lockable { bool private _notEntered; - constructor() internal { + constructor() { // Storing an initial non-zero value makes deployment a bit more // expensive, but in exchange the refund on every call to nonReentrant // will be lower in amount. Since refunds are capped to a percetange of diff --git a/packages/core/contracts/common/implementation/MultiRole.sol b/packages/core/contracts/common/implementation/MultiRole.sol index c70d57d56b..add7397a9f 100644 --- a/packages/core/contracts/common/implementation/MultiRole.sol +++ b/packages/core/contracts/common/implementation/MultiRole.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: AGPL-3.0-only -pragma solidity ^0.6.0; +pragma solidity ^0.8.0; library Exclusive { struct RoleMembership { diff --git a/packages/core/contracts/common/implementation/Testable.sol b/packages/core/contracts/common/implementation/Testable.sol index f3ade7d25a..cb55debe16 100644 --- a/packages/core/contracts/common/implementation/Testable.sol +++ b/packages/core/contracts/common/implementation/Testable.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: AGPL-3.0-only -pragma solidity ^0.6.0; +pragma solidity ^0.8.0; import "./Timer.sol"; @@ -16,7 +16,7 @@ abstract contract Testable { * @param _timerAddress Contract that stores the current time in a testing environment. * Must be set to 0x0 for production environments that use live time. */ - constructor(address _timerAddress) internal { + constructor(address _timerAddress) { timerAddress = _timerAddress; } @@ -46,7 +46,7 @@ abstract contract Testable { if (timerAddress != address(0x0)) { return Timer(timerAddress).getCurrentTime(); } else { - return now; // solhint-disable-line not-rely-on-time + return block.timestamp; // solhint-disable-line not-rely-on-time } } } diff --git a/packages/core/contracts/common/implementation/TestnetERC20.sol b/packages/core/contracts/common/implementation/TestnetERC20.sol index 87310539c3..e21800a71e 100644 --- a/packages/core/contracts/common/implementation/TestnetERC20.sol +++ b/packages/core/contracts/common/implementation/TestnetERC20.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: AGPL-3.0-only -pragma solidity ^0.6.0; +pragma solidity ^0.8.0; import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; @@ -8,19 +8,26 @@ import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; * @dev This contract can be deployed or the interface can be used to communicate with Compound's ERC20 tokens. Note: * this token should never be used to store real value since it allows permissionless minting. */ + contract TestnetERC20 is ERC20 { + uint8 _decimals; + /** * @notice Constructs the TestnetERC20. * @param _name The name which describes the new token. * @param _symbol The ticker abbreviation of the name. Ideally < 5 chars. - * @param _decimals The number of decimals to define token precision. + * @param _tokenDecimals The number of decimals to define token precision. */ constructor( string memory _name, string memory _symbol, - uint8 _decimals - ) public ERC20(_name, _symbol) { - _setupDecimals(_decimals); + uint8 _tokenDecimals + ) ERC20(_name, _symbol) { + _decimals = _tokenDecimals; + } + + function decimals() public view virtual override(ERC20) returns (uint8) { + return _decimals; } // Sample token information. diff --git a/packages/core/contracts/common/implementation/Timer.sol b/packages/core/contracts/common/implementation/Timer.sol index 3fbdae1305..8967e30caf 100644 --- a/packages/core/contracts/common/implementation/Timer.sol +++ b/packages/core/contracts/common/implementation/Timer.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: AGPL-3.0-only -pragma solidity ^0.6.0; +pragma solidity ^0.8.0; /** * @title Universal store of current contract time for testing environments. @@ -7,8 +7,8 @@ pragma solidity ^0.6.0; contract Timer { uint256 private currentTime; - constructor() public { - currentTime = now; // solhint-disable-line not-rely-on-time + constructor() { + currentTime = block.timestamp; // solhint-disable-line not-rely-on-time } /** diff --git a/packages/core/contracts/common/implementation/Withdrawable.sol b/packages/core/contracts/common/implementation/Withdrawable.sol index 9765c3622c..c0f1d5da4c 100644 --- a/packages/core/contracts/common/implementation/Withdrawable.sol +++ b/packages/core/contracts/common/implementation/Withdrawable.sol @@ -3,11 +3,11 @@ */ // SPDX-License-Identifier: AGPL-3.0-only -pragma solidity ^0.6.0; +pragma solidity ^0.8.0; import "@openzeppelin/contracts/utils/Address.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; -import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol"; +import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import "./MultiRole.sol"; @@ -23,7 +23,7 @@ abstract contract Withdrawable is MultiRole { * @notice Withdraws ETH from the contract. */ function withdraw(uint256 amount) external onlyRoleHolder(roleId) { - Address.sendValue(msg.sender, amount); + Address.sendValue(payable(msg.sender), amount); } /** diff --git a/packages/core/contracts/common/interfaces/Balancer.sol b/packages/core/contracts/common/interfaces/Balancer.sol index 2c42a8a2c5..5b8cdb313d 100644 --- a/packages/core/contracts/common/interfaces/Balancer.sol +++ b/packages/core/contracts/common/interfaces/Balancer.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: AGPL-3.0-only -pragma solidity ^0.6.0; +pragma solidity ^0.8.0; /** * @title Interface for Balancer. diff --git a/packages/core/contracts/common/interfaces/ExpandedIERC20.sol b/packages/core/contracts/common/interfaces/ExpandedIERC20.sol index 373cf30bb9..7dff7a6b80 100644 --- a/packages/core/contracts/common/interfaces/ExpandedIERC20.sol +++ b/packages/core/contracts/common/interfaces/ExpandedIERC20.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: AGPL-3.0-only -pragma solidity ^0.6.0; +pragma solidity ^0.8.0; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; diff --git a/packages/core/contracts/common/interfaces/IERC20Standard.sol b/packages/core/contracts/common/interfaces/IERC20Standard.sol index 90dc676b47..9219f15fab 100644 --- a/packages/core/contracts/common/interfaces/IERC20Standard.sol +++ b/packages/core/contracts/common/interfaces/IERC20Standard.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: AGPL-3.0-only -pragma solidity ^0.6.0; +pragma solidity ^0.8.0; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; diff --git a/packages/core/contracts/common/interfaces/Multicall.sol b/packages/core/contracts/common/interfaces/Multicall.sol index 568d0e6616..fafaa7461e 100644 --- a/packages/core/contracts/common/interfaces/Multicall.sol +++ b/packages/core/contracts/common/interfaces/Multicall.sol @@ -1,5 +1,6 @@ +// SPDX-License-Identifier: AGPL-3.0-only pragma solidity >=0.5.0; -pragma experimental ABIEncoderV2; +pragma abicoder v2; /** * @title interface for MakerDao's Multicall contract. diff --git a/packages/core/contracts/common/interfaces/TransactionBatcher.sol b/packages/core/contracts/common/interfaces/TransactionBatcher.sol index 39bc8b6c96..7d96edbaf6 100644 --- a/packages/core/contracts/common/interfaces/TransactionBatcher.sol +++ b/packages/core/contracts/common/interfaces/TransactionBatcher.sol @@ -1,6 +1,6 @@ // SPDX-License-Identifier: AGPL-3.0-only -pragma solidity ^0.6.0; -pragma experimental ABIEncoderV2; +pragma solidity ^0.8.0; +pragma abicoder v2; // This is an interface to interact with a deployed implementation by https://github.com/kleros/action-callback-bots for // batching on-chain transactions. diff --git a/packages/core/contracts/common/interfaces/UniswapV2.sol b/packages/core/contracts/common/interfaces/UniswapV2.sol index 828ecd94ee..13a0b98c78 100644 --- a/packages/core/contracts/common/interfaces/UniswapV2.sol +++ b/packages/core/contracts/common/interfaces/UniswapV2.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: AGPL-3.0-only -pragma solidity ^0.6.0; +pragma solidity ^0.8.0; /** * @title Interface for Uniswap v2. diff --git a/packages/core/contracts/common/interfaces/UniswapV3.sol b/packages/core/contracts/common/interfaces/UniswapV3.sol index b00cbb2604..2b35d1cbb8 100644 --- a/packages/core/contracts/common/interfaces/UniswapV3.sol +++ b/packages/core/contracts/common/interfaces/UniswapV3.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: AGPL-3.0-only -pragma solidity ^0.6.0; +pragma solidity ^0.8.0; /** * @title Interface for Uniswap v3. diff --git a/packages/core/contracts/common/interfaces/VaultInterface.sol b/packages/core/contracts/common/interfaces/VaultInterface.sol index 4ed76ab0b9..12842577fe 100644 --- a/packages/core/contracts/common/interfaces/VaultInterface.sol +++ b/packages/core/contracts/common/interfaces/VaultInterface.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: AGPL-3.0-only -pragma solidity ^0.6.0; +pragma solidity ^0.8.0; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; diff --git a/packages/core/contracts/common/test/BalancerMock.sol b/packages/core/contracts/common/test/BalancerMock.sol index 9874a953f2..0cf847be78 100644 --- a/packages/core/contracts/common/test/BalancerMock.sol +++ b/packages/core/contracts/common/test/BalancerMock.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: AGPL-3.0-only -pragma solidity ^0.6.0; +pragma solidity ^0.8.0; import "../interfaces/Balancer.sol"; diff --git a/packages/core/contracts/common/test/BasicERC20.sol b/packages/core/contracts/common/test/BasicERC20.sol index 97193ccba7..8244da5280 100644 --- a/packages/core/contracts/common/test/BasicERC20.sol +++ b/packages/core/contracts/common/test/BasicERC20.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: AGPL-3.0-only -pragma solidity ^0.6.0; +pragma solidity ^0.8.0; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; @@ -16,7 +16,7 @@ contract BasicERC20 is IERC20 { uint256 private _totalSupply; - constructor(uint256 _initialAmount) public { + constructor(uint256 _initialAmount) { balances[msg.sender] = _initialAmount; _totalSupply = _initialAmount; } diff --git a/packages/core/contracts/common/test/MultiRoleTest.sol b/packages/core/contracts/common/test/MultiRoleTest.sol index 3767bbd5f8..d3d50d2ec1 100644 --- a/packages/core/contracts/common/test/MultiRoleTest.sol +++ b/packages/core/contracts/common/test/MultiRoleTest.sol @@ -3,7 +3,7 @@ */ // SPDX-License-Identifier: AGPL-3.0-only -pragma solidity ^0.6.0; +pragma solidity ^0.8.0; import "../implementation/MultiRole.sol"; diff --git a/packages/core/contracts/common/test/MulticallMock.sol b/packages/core/contracts/common/test/MulticallMock.sol index 7789cf9789..83fb49e5d9 100644 --- a/packages/core/contracts/common/test/MulticallMock.sol +++ b/packages/core/contracts/common/test/MulticallMock.sol @@ -1,5 +1,5 @@ pragma solidity >=0.5.0; -pragma experimental ABIEncoderV2; +pragma abicoder v2; /// @title Multicall - Aggregate results from multiple read-only function calls /// @author Michael Elliot diff --git a/packages/core/contracts/common/test/PerpetualMock.sol b/packages/core/contracts/common/test/PerpetualMock.sol index 55a5fd0395..4a0beed07f 100644 --- a/packages/core/contracts/common/test/PerpetualMock.sol +++ b/packages/core/contracts/common/test/PerpetualMock.sol @@ -1,6 +1,6 @@ // SPDX-License-Identifier: AGPL-3.0-only -pragma solidity ^0.6.0; -pragma experimental ABIEncoderV2; +pragma solidity ^0.8.0; +pragma abicoder v2; import "../../common/implementation/FixedPoint.sol"; @@ -34,7 +34,7 @@ contract PerpetualMock { event LiquidationCreated(); function getCurrentTime() public view returns (uint256) { - return now; + return block.timestamp; } // Public methods that are useful for tests: diff --git a/packages/core/contracts/common/test/ReentrancyAttack.sol b/packages/core/contracts/common/test/ReentrancyAttack.sol index 1be1bf071b..b6818a6211 100644 --- a/packages/core/contracts/common/test/ReentrancyAttack.sol +++ b/packages/core/contracts/common/test/ReentrancyAttack.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: AGPL-3.0-only -pragma solidity ^0.6.0; +pragma solidity ^0.8.0; // Tests reentrancy guards defined in Lockable.sol. // Copied from https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v3.0.1/contracts/mocks/ReentrancyAttack.sol. diff --git a/packages/core/contracts/common/test/ReentrancyChecker.sol b/packages/core/contracts/common/test/ReentrancyChecker.sol index f33e060a3f..3ca48c79c9 100644 --- a/packages/core/contracts/common/test/ReentrancyChecker.sol +++ b/packages/core/contracts/common/test/ReentrancyChecker.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: AGPL-3.0-only -pragma solidity ^0.6.0; +pragma solidity ^0.8.0; // The Reentrancy Checker causes failures if it is successfully able to re-enter a contract. // How to use: diff --git a/packages/core/contracts/common/test/ReentrancyMock.sol b/packages/core/contracts/common/test/ReentrancyMock.sol index 9de0d572fd..2ece3ee4d7 100644 --- a/packages/core/contracts/common/test/ReentrancyMock.sol +++ b/packages/core/contracts/common/test/ReentrancyMock.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: AGPL-3.0-only -pragma solidity ^0.6.0; +pragma solidity ^0.8.0; import "../implementation/Lockable.sol"; import "./ReentrancyAttack.sol"; @@ -9,7 +9,7 @@ import "./ReentrancyAttack.sol"; contract ReentrancyMock is Lockable { uint256 public counter; - constructor() public { + constructor() { counter = 0; } diff --git a/packages/core/contracts/common/test/SignedFixedPointTest.sol b/packages/core/contracts/common/test/SignedFixedPointTest.sol index 67c3c9596b..e6148c33a3 100644 --- a/packages/core/contracts/common/test/SignedFixedPointTest.sol +++ b/packages/core/contracts/common/test/SignedFixedPointTest.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: AGPL-3.0-only -pragma solidity ^0.6.0; +pragma solidity ^0.8.0; import "../implementation/FixedPoint.sol"; diff --git a/packages/core/contracts/common/test/TestableTest.sol b/packages/core/contracts/common/test/TestableTest.sol index 8c6e0b7b77..09a80d72c2 100644 --- a/packages/core/contracts/common/test/TestableTest.sol +++ b/packages/core/contracts/common/test/TestableTest.sol @@ -1,15 +1,15 @@ // SPDX-License-Identifier: AGPL-3.0-only -pragma solidity ^0.6.0; +pragma solidity ^0.8.0; import "../implementation/Testable.sol"; // TestableTest is derived from the abstract contract Testable for testing purposes. contract TestableTest is Testable { // solhint-disable-next-line no-empty-blocks - constructor(address _timerAddress) public Testable(_timerAddress) {} + constructor(address _timerAddress) Testable(_timerAddress) {} function getTestableTimeAndBlockTime() external view returns (uint256 testableTime, uint256 blockTime) { // solhint-disable-next-line not-rely-on-time - return (getCurrentTime(), now); + return (getCurrentTime(), block.timestamp); } } diff --git a/packages/core/contracts/common/test/UniswapV2Mock.sol b/packages/core/contracts/common/test/UniswapV2Mock.sol index ef5924e17a..d0359c309b 100644 --- a/packages/core/contracts/common/test/UniswapV2Mock.sol +++ b/packages/core/contracts/common/test/UniswapV2Mock.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: AGPL-3.0-only -pragma solidity ^0.6.0; +pragma solidity ^0.8.0; import "../interfaces/UniswapV2.sol"; diff --git a/packages/core/contracts/common/test/UniswapV3Mock.sol b/packages/core/contracts/common/test/UniswapV3Mock.sol index ae4d2f683d..333b98e9bb 100644 --- a/packages/core/contracts/common/test/UniswapV3Mock.sol +++ b/packages/core/contracts/common/test/UniswapV3Mock.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: AGPL-3.0-only -pragma solidity ^0.6.0; +pragma solidity ^0.8.0; import "../interfaces/UniswapV3.sol"; diff --git a/packages/core/contracts/common/test/UnsignedFixedPointTest.sol b/packages/core/contracts/common/test/UnsignedFixedPointTest.sol index 36223a034c..9230cdc819 100644 --- a/packages/core/contracts/common/test/UnsignedFixedPointTest.sol +++ b/packages/core/contracts/common/test/UnsignedFixedPointTest.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: AGPL-3.0-only -pragma solidity ^0.6.0; +pragma solidity ^0.8.0; import "../implementation/FixedPoint.sol"; diff --git a/packages/core/contracts/common/test/VaultMock.sol b/packages/core/contracts/common/test/VaultMock.sol index 41585834bf..ce33b4698e 100644 --- a/packages/core/contracts/common/test/VaultMock.sol +++ b/packages/core/contracts/common/test/VaultMock.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: AGPL-3.0-only -pragma solidity ^0.6.0; +pragma solidity ^0.8.0; import "../interfaces/VaultInterface.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; @@ -11,7 +11,7 @@ contract VaultMock is VaultInterface { IERC20 public override token; uint256 private pricePerFullShare = 0; - constructor(IERC20 _token) public { + constructor(IERC20 _token) { token = _token; } diff --git a/packages/core/contracts/common/test/WithdrawableTest.sol b/packages/core/contracts/common/test/WithdrawableTest.sol index 4e93703acb..135baf48a4 100644 --- a/packages/core/contracts/common/test/WithdrawableTest.sol +++ b/packages/core/contracts/common/test/WithdrawableTest.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: AGPL-3.0-only -pragma solidity ^0.6.0; +pragma solidity ^0.8.0; import "../implementation/Withdrawable.sol"; @@ -8,7 +8,7 @@ contract WithdrawableTest is Withdrawable { enum Roles { Governance, Withdraw } // solhint-disable-next-line no-empty-blocks - constructor() public { + constructor() { _createExclusiveRole(uint256(Roles.Governance), uint256(Roles.Governance), msg.sender); _createWithdrawRole(uint256(Roles.Withdraw), uint256(Roles.Governance), msg.sender); } diff --git a/packages/core/contracts/financial-templates/common/EmergencyShutdownable.sol b/packages/core/contracts/financial-templates/common/EmergencyShutdownable.sol index 1d632e5ae1..186a56121d 100644 --- a/packages/core/contracts/financial-templates/common/EmergencyShutdownable.sol +++ b/packages/core/contracts/financial-templates/common/EmergencyShutdownable.sol @@ -1,8 +1,8 @@ // SPDX-License-Identifier: AGPL-3.0-only -pragma solidity ^0.6.0; -pragma experimental ABIEncoderV2; +pragma solidity ^0.8.0; +pragma abicoder v2; -import "@openzeppelin/contracts/math/SafeMath.sol"; +import "@openzeppelin/contracts/utils/math/SafeMath.sol"; /** * @title EmergencyShutdownable contract. @@ -40,7 +40,7 @@ abstract contract EmergencyShutdownable { * EXTERNAL FUNCTIONS * ****************************************/ - constructor() public { + constructor() { emergencyShutdownTimestamp = 0; } diff --git a/packages/core/contracts/financial-templates/common/FeePayer.sol b/packages/core/contracts/financial-templates/common/FeePayer.sol index 0d9633d183..3fa9bae772 100644 --- a/packages/core/contracts/financial-templates/common/FeePayer.sol +++ b/packages/core/contracts/financial-templates/common/FeePayer.sol @@ -1,9 +1,9 @@ // SPDX-License-Identifier: AGPL-3.0-only -pragma solidity ^0.6.0; -pragma experimental ABIEncoderV2; +pragma solidity ^0.8.0; +pragma abicoder v2; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; -import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol"; +import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import "../../common/implementation/Lockable.sol"; import "../../common/implementation/FixedPoint.sol"; @@ -80,7 +80,7 @@ abstract contract FeePayer is AdministrateeInterface, Testable, Lockable { address _collateralAddress, address _finderAddress, address _timerAddress - ) public Testable(_timerAddress) { + ) Testable(_timerAddress) { collateralCurrency = IERC20(_collateralAddress); finder = FinderInterface(_finderAddress); lastPaymentTime = getCurrentTime(); diff --git a/packages/core/contracts/financial-templates/common/FundingRateApplier.sol b/packages/core/contracts/financial-templates/common/FundingRateApplier.sol index db98767373..5a1815d7d8 100644 --- a/packages/core/contracts/financial-templates/common/FundingRateApplier.sol +++ b/packages/core/contracts/financial-templates/common/FundingRateApplier.sol @@ -1,10 +1,10 @@ // SPDX-License-Identifier: AGPL-3.0-only -pragma solidity ^0.6.0; -pragma experimental ABIEncoderV2; +pragma solidity ^0.8.0; +pragma abicoder v2; -import "@openzeppelin/contracts/utils/SafeCast.sol"; +import "@openzeppelin/contracts/utils/math/SafeCast.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; -import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol"; +import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import "../../common/implementation/Lockable.sol"; import "../../common/implementation/FixedPoint.sol"; @@ -101,7 +101,7 @@ abstract contract FundingRateApplier is EmergencyShutdownable, FeePayer { address _configStoreAddress, FixedPoint.Unsigned memory _tokenScaling, address _timerAddress - ) public FeePayer(_collateralAddress, _finderAddress, _timerAddress) EmergencyShutdownable() { + ) FeePayer(_collateralAddress, _finderAddress, _timerAddress) EmergencyShutdownable() { uint256 currentTime = getCurrentTime(); fundingRate.updateTime = currentTime; fundingRate.applicationTime = currentTime; diff --git a/packages/core/contracts/financial-templates/common/SyntheticToken.sol b/packages/core/contracts/financial-templates/common/SyntheticToken.sol index 9cc7f16b33..35f5b1bf82 100644 --- a/packages/core/contracts/financial-templates/common/SyntheticToken.sol +++ b/packages/core/contracts/financial-templates/common/SyntheticToken.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: AGPL-3.0-only -pragma solidity ^0.6.0; +pragma solidity ^0.8.0; import "../../common/implementation/ExpandedERC20.sol"; import "../../common/implementation/Lockable.sol"; @@ -19,7 +19,7 @@ contract SyntheticToken is ExpandedERC20, Lockable { string memory tokenName, string memory tokenSymbol, uint8 tokenDecimals - ) public ExpandedERC20(tokenName, tokenSymbol, tokenDecimals) nonReentrant() {} + ) ExpandedERC20(tokenName, tokenSymbol, tokenDecimals) nonReentrant() {} /** * @notice Add Minter role to account. diff --git a/packages/core/contracts/financial-templates/common/TokenFactory.sol b/packages/core/contracts/financial-templates/common/TokenFactory.sol index c54b2fc4be..16ca1ffb7a 100644 --- a/packages/core/contracts/financial-templates/common/TokenFactory.sol +++ b/packages/core/contracts/financial-templates/common/TokenFactory.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: AGPL-3.0-only -pragma solidity ^0.6.0; +pragma solidity ^0.8.0; import "./SyntheticToken.sol"; import "../../common/interfaces/ExpandedIERC20.sol"; diff --git a/packages/core/contracts/financial-templates/common/WETH9.sol b/packages/core/contracts/financial-templates/common/WETH9.sol index dd7fecca24..02e0e3a901 100644 --- a/packages/core/contracts/financial-templates/common/WETH9.sol +++ b/packages/core/contracts/financial-templates/common/WETH9.sol @@ -18,7 +18,7 @@ // along with this program. If not, see . // SPDX-License-Identifier: AGPL-3.0-only -pragma solidity ^0.6.0; +pragma solidity ^0.8.0; // Copied from the verified code from Etherscan: // https://etherscan.io/address/0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2#code @@ -55,7 +55,7 @@ contract WETH9 { function withdraw(uint256 wad) public { require(balanceOf[msg.sender] >= wad); balanceOf[msg.sender] -= wad; - msg.sender.transfer(wad); + payable(msg.sender).transfer(wad); emit Withdrawal(msg.sender, wad); } @@ -80,7 +80,7 @@ contract WETH9 { ) public returns (bool) { require(balanceOf[src] >= wad); - if (src != msg.sender && allowance[src][msg.sender] != uint256(-1)) { + if (src != msg.sender && allowance[src][msg.sender] != type(uint256).max) { require(allowance[src][msg.sender] >= wad); allowance[src][msg.sender] -= wad; } diff --git a/packages/core/contracts/financial-templates/common/financial-product-libraries/CoveredCallFinancialProductLibrary.sol b/packages/core/contracts/financial-templates/common/financial-product-libraries/CoveredCallFinancialProductLibrary.sol index 08221f51ed..f50db06c2e 100644 --- a/packages/core/contracts/financial-templates/common/financial-product-libraries/CoveredCallFinancialProductLibrary.sol +++ b/packages/core/contracts/financial-templates/common/financial-product-libraries/CoveredCallFinancialProductLibrary.sol @@ -1,5 +1,6 @@ -pragma solidity ^0.6.0; -pragma experimental ABIEncoderV2; +// SPDX-License-Identifier: AGPL-3.0-only +pragma solidity ^0.8.0; +pragma abicoder v2; import "./FinancialProductLibrary.sol"; import "../../../common/implementation/Lockable.sol"; @@ -15,6 +16,8 @@ import "../../../common/implementation/Lockable.sol"; * If ETHUSD =< $400 at expiry, the call is out of the money, and the contract pays out 0 WETH. */ contract CoveredCallFinancialProductLibrary is FinancialProductLibrary, Lockable { + using FixedPoint for FixedPoint.Unsigned; + mapping(address => FixedPoint.Unsigned) private financialProductStrikes; /** diff --git a/packages/core/contracts/financial-templates/common/financial-product-libraries/FinancialProductLibrary.sol b/packages/core/contracts/financial-templates/common/financial-product-libraries/FinancialProductLibrary.sol index 5e5273306b..f948c5218f 100644 --- a/packages/core/contracts/financial-templates/common/financial-product-libraries/FinancialProductLibrary.sol +++ b/packages/core/contracts/financial-templates/common/financial-product-libraries/FinancialProductLibrary.sol @@ -1,5 +1,6 @@ -pragma solidity ^0.6.0; -pragma experimental ABIEncoderV2; +// SPDX-License-Identifier: AGPL-3.0-only +pragma solidity ^0.8.0; +pragma abicoder v2; import "../../../common/implementation/FixedPoint.sol"; interface ExpiringContractInterface { diff --git a/packages/core/contracts/financial-templates/common/financial-product-libraries/KpiOptionsFinancialProductLibrary.sol b/packages/core/contracts/financial-templates/common/financial-product-libraries/KpiOptionsFinancialProductLibrary.sol index e273e8f19e..180f30e7e3 100644 --- a/packages/core/contracts/financial-templates/common/financial-product-libraries/KpiOptionsFinancialProductLibrary.sol +++ b/packages/core/contracts/financial-templates/common/financial-product-libraries/KpiOptionsFinancialProductLibrary.sol @@ -1,5 +1,6 @@ -pragma solidity ^0.6.0; -pragma experimental ABIEncoderV2; +// SPDX-License-Identifier: AGPL-3.0-only +pragma solidity ^0.8.0; +pragma abicoder v2; import "./FinancialProductLibrary.sol"; import "../../../common/implementation/Lockable.sol"; diff --git a/packages/core/contracts/financial-templates/common/financial-product-libraries/PostExpirationIdentifierTransformationFinancialProductLibrary.sol b/packages/core/contracts/financial-templates/common/financial-product-libraries/PostExpirationIdentifierTransformationFinancialProductLibrary.sol index 6bf37e6c60..10ac764b18 100644 --- a/packages/core/contracts/financial-templates/common/financial-product-libraries/PostExpirationIdentifierTransformationFinancialProductLibrary.sol +++ b/packages/core/contracts/financial-templates/common/financial-product-libraries/PostExpirationIdentifierTransformationFinancialProductLibrary.sol @@ -1,5 +1,6 @@ -pragma solidity ^0.6.0; -pragma experimental ABIEncoderV2; +// SPDX-License-Identifier: AGPL-3.0-only +pragma solidity ^0.8.0; +pragma abicoder v2; import "./FinancialProductLibrary.sol"; import "../../../common/implementation/Lockable.sol"; diff --git a/packages/core/contracts/financial-templates/common/financial-product-libraries/PreExpirationIdentifierTransformationFinancialProductLibrary.sol b/packages/core/contracts/financial-templates/common/financial-product-libraries/PreExpirationIdentifierTransformationFinancialProductLibrary.sol index 77fdd5106e..b9260ac2a8 100644 --- a/packages/core/contracts/financial-templates/common/financial-product-libraries/PreExpirationIdentifierTransformationFinancialProductLibrary.sol +++ b/packages/core/contracts/financial-templates/common/financial-product-libraries/PreExpirationIdentifierTransformationFinancialProductLibrary.sol @@ -1,5 +1,6 @@ -pragma solidity ^0.6.0; -pragma experimental ABIEncoderV2; +// SPDX-License-Identifier: AGPL-3.0-only +pragma solidity ^0.8.0; +pragma abicoder v2; import "./FinancialProductLibrary.sol"; import "../../../common/implementation/Lockable.sol"; diff --git a/packages/core/contracts/financial-templates/common/financial-product-libraries/StructuredNoteFinancialProductLibrary.sol b/packages/core/contracts/financial-templates/common/financial-product-libraries/StructuredNoteFinancialProductLibrary.sol index 5c8a815222..6721b059ba 100644 --- a/packages/core/contracts/financial-templates/common/financial-product-libraries/StructuredNoteFinancialProductLibrary.sol +++ b/packages/core/contracts/financial-templates/common/financial-product-libraries/StructuredNoteFinancialProductLibrary.sol @@ -1,5 +1,6 @@ -pragma solidity ^0.6.0; -pragma experimental ABIEncoderV2; +// SPDX-License-Identifier: AGPL-3.0-only +pragma solidity ^0.8.0; +pragma abicoder v2; import "./FinancialProductLibrary.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "../../../common/implementation/Lockable.sol"; @@ -14,6 +15,8 @@ import "../../../common/implementation/Lockable.sol"; * If ETHUSD >= $400 at expiry, token is redeemed for $400 worth of ETH, as determined by the DVM. */ contract StructuredNoteFinancialProductLibrary is FinancialProductLibrary, Ownable, Lockable { + using FixedPoint for FixedPoint.Unsigned; + mapping(address => FixedPoint.Unsigned) financialProductStrikes; /** diff --git a/packages/core/contracts/financial-templates/demo/DepositBox.sol b/packages/core/contracts/financial-templates/demo/DepositBox.sol index a86eb9989b..a1dff8a01e 100644 --- a/packages/core/contracts/financial-templates/demo/DepositBox.sol +++ b/packages/core/contracts/financial-templates/demo/DepositBox.sol @@ -1,10 +1,10 @@ // SPDX-License-Identifier: AGPL-3.0-only -pragma solidity ^0.6.0; -pragma experimental ABIEncoderV2; +pragma solidity ^0.8.0; +pragma abicoder v2; -import "@openzeppelin/contracts/math/SafeMath.sol"; +import "@openzeppelin/contracts/utils/math/SafeMath.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; -import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol"; +import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import "../common/FeePayer.sol"; @@ -123,12 +123,7 @@ contract DepositBox is FeePayer, ContractCreator { address _finderAddress, bytes32 _priceIdentifier, address _timerAddress - ) - public - ContractCreator(_finderAddress) - FeePayer(_collateralAddress, _finderAddress, _timerAddress) - nonReentrant() - { + ) ContractCreator(_finderAddress) FeePayer(_collateralAddress, _finderAddress, _timerAddress) nonReentrant() { require(_getIdentifierWhitelist().isIdentifierSupported(_priceIdentifier), "Unsupported price identifier"); priceIdentifier = _priceIdentifier; diff --git a/packages/core/contracts/financial-templates/expiring-multiparty/ExpiringMultiParty.sol b/packages/core/contracts/financial-templates/expiring-multiparty/ExpiringMultiParty.sol index 7ae11a685b..3b9d1dadae 100644 --- a/packages/core/contracts/financial-templates/expiring-multiparty/ExpiringMultiParty.sol +++ b/packages/core/contracts/financial-templates/expiring-multiparty/ExpiringMultiParty.sol @@ -1,6 +1,6 @@ // SPDX-License-Identifier: AGPL-3.0-only -pragma solidity ^0.6.0; -pragma experimental ABIEncoderV2; +pragma solidity ^0.8.0; +pragma abicoder v2; import "./Liquidatable.sol"; @@ -15,7 +15,6 @@ contract ExpiringMultiParty is Liquidatable { * are fed directly into the PricelessPositionManager's constructor within the inheritance tree. */ constructor(ConstructorParams memory params) - public Liquidatable(params) // Note: since there is no logic here, there is no need to add a re-entrancy guard. { diff --git a/packages/core/contracts/financial-templates/expiring-multiparty/ExpiringMultiPartyCreator.sol b/packages/core/contracts/financial-templates/expiring-multiparty/ExpiringMultiPartyCreator.sol index d515f45e20..6d3d09b480 100644 --- a/packages/core/contracts/financial-templates/expiring-multiparty/ExpiringMultiPartyCreator.sol +++ b/packages/core/contracts/financial-templates/expiring-multiparty/ExpiringMultiPartyCreator.sol @@ -1,6 +1,6 @@ // SPDX-License-Identifier: AGPL-3.0-only -pragma solidity ^0.6.0; -pragma experimental ABIEncoderV2; +pragma solidity ^0.8.0; +pragma abicoder v2; import "../../common/interfaces/ExpandedIERC20.sol"; import "../../common/interfaces/IERC20Standard.sol"; @@ -59,7 +59,7 @@ contract ExpiringMultiPartyCreator is ContractCreator, Testable, Lockable { address _finderAddress, address _tokenFactoryAddress, address _timerAddress - ) public ContractCreator(_finderAddress) Testable(_timerAddress) nonReentrant() { + ) ContractCreator(_finderAddress) Testable(_timerAddress) nonReentrant() { tokenFactoryAddress = _tokenFactoryAddress; } @@ -109,7 +109,7 @@ contract ExpiringMultiPartyCreator is ContractCreator, Testable, Lockable { // Enforce configuration constraints. require(params.withdrawalLiveness != 0, "Withdrawal liveness cannot be 0"); require(params.liquidationLiveness != 0, "Liquidation liveness cannot be 0"); - require(params.expirationTimestamp > now, "Invalid expiration time"); + require(params.expirationTimestamp > block.timestamp, "Invalid expiration time"); _requireWhitelistedCollateral(params.collateralAddress); // We don't want EMP deployers to be able to intentionally or unintentionally set diff --git a/packages/core/contracts/financial-templates/expiring-multiparty/ExpiringMultiPartyLib.sol b/packages/core/contracts/financial-templates/expiring-multiparty/ExpiringMultiPartyLib.sol index 9525db6df0..4fdd916070 100644 --- a/packages/core/contracts/financial-templates/expiring-multiparty/ExpiringMultiPartyLib.sol +++ b/packages/core/contracts/financial-templates/expiring-multiparty/ExpiringMultiPartyLib.sol @@ -1,6 +1,6 @@ // SPDX-License-Identifier: AGPL-3.0-only -pragma solidity ^0.6.0; -pragma experimental ABIEncoderV2; +pragma solidity ^0.8.0; +pragma abicoder v2; import "./ExpiringMultiParty.sol"; diff --git a/packages/core/contracts/financial-templates/expiring-multiparty/Liquidatable.sol b/packages/core/contracts/financial-templates/expiring-multiparty/Liquidatable.sol index c55ba67f40..bdb52b4341 100644 --- a/packages/core/contracts/financial-templates/expiring-multiparty/Liquidatable.sol +++ b/packages/core/contracts/financial-templates/expiring-multiparty/Liquidatable.sol @@ -1,9 +1,9 @@ // SPDX-License-Identifier: AGPL-3.0-only -pragma solidity ^0.6.0; -pragma experimental ABIEncoderV2; +pragma solidity ^0.8.0; +pragma abicoder v2; -import "@openzeppelin/contracts/math/SafeMath.sol"; -import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol"; +import "@openzeppelin/contracts/utils/math/SafeMath.sol"; +import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import "@openzeppelin/contracts/utils/Address.sol"; import "./PricelessPositionManager.sol"; @@ -26,6 +26,7 @@ contract Liquidatable is PricelessPositionManager { using FixedPoint for FixedPoint.Unsigned; using SafeMath for uint256; using SafeERC20 for IERC20; + using SafeERC20 for ExpandedIERC20; using Address for address; /**************************************** @@ -173,7 +174,6 @@ contract Liquidatable is PricelessPositionManager { * are fed directly into the PricelessPositionManager's constructor within the inheritance tree. */ constructor(ConstructorParams memory params) - public PricelessPositionManager( params.expirationTimestamp, params.withdrawalLiveness, diff --git a/packages/core/contracts/financial-templates/expiring-multiparty/PricelessPositionManager.sol b/packages/core/contracts/financial-templates/expiring-multiparty/PricelessPositionManager.sol index 477dfdd33d..e3da66893e 100644 --- a/packages/core/contracts/financial-templates/expiring-multiparty/PricelessPositionManager.sol +++ b/packages/core/contracts/financial-templates/expiring-multiparty/PricelessPositionManager.sol @@ -1,10 +1,10 @@ // SPDX-License-Identifier: AGPL-3.0-only -pragma solidity ^0.6.0; -pragma experimental ABIEncoderV2; +pragma solidity ^0.8.0; +pragma abicoder v2; -import "@openzeppelin/contracts/math/SafeMath.sol"; +import "@openzeppelin/contracts/utils/math/SafeMath.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; -import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol"; +import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import "@openzeppelin/contracts/utils/Address.sol"; import "../../common/implementation/FixedPoint.sol"; @@ -174,7 +174,7 @@ contract PricelessPositionManager is FeePayer { FixedPoint.Unsigned memory _minSponsorTokens, address _timerAddress, address _financialProductLibraryAddress - ) public FeePayer(_collateralAddress, _finderAddress, _timerAddress) nonReentrant() { + ) FeePayer(_collateralAddress, _finderAddress, _timerAddress) nonReentrant() { require(_expirationTimestamp > getCurrentTime()); require(_getIdentifierWhitelist().isIdentifierSupported(_priceIdentifier)); diff --git a/packages/core/contracts/financial-templates/perpetual-multiparty/ConfigStore.sol b/packages/core/contracts/financial-templates/perpetual-multiparty/ConfigStore.sol index 8cc2717bbb..0812decfb5 100644 --- a/packages/core/contracts/financial-templates/perpetual-multiparty/ConfigStore.sol +++ b/packages/core/contracts/financial-templates/perpetual-multiparty/ConfigStore.sol @@ -1,8 +1,8 @@ // SPDX-License-Identifier: AGPL-3.0-only -pragma solidity ^0.6.0; -pragma experimental ABIEncoderV2; +pragma solidity ^0.8.0; +pragma abicoder v2; -import "@openzeppelin/contracts/math/SafeMath.sol"; +import "@openzeppelin/contracts/utils/math/SafeMath.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "./ConfigStoreInterface.sol"; @@ -69,7 +69,7 @@ contract ConfigStore is ConfigStoreInterface, Testable, Lockable, Ownable { * @param _initialConfig Configuration settings to initialize `currentConfig` with. * @param _timerAddress Address of testable Timer contract. */ - constructor(ConfigSettings memory _initialConfig, address _timerAddress) public Testable(_timerAddress) { + constructor(ConfigSettings memory _initialConfig, address _timerAddress) Testable(_timerAddress) { _validateConfig(_initialConfig); currentConfig = _initialConfig; } @@ -90,7 +90,7 @@ contract ConfigStore is ConfigStoreInterface, Testable, Lockable, Ownable { /** * @notice Propose new configuration settings. New settings go into effect after a liveness period passes. - * @param newConfig Configuration settings to publish after `currentConfig.timelockLiveness` passes from now. + * @param newConfig Configuration settings to publish after `currentConfig.timelockLiveness` passes from block.timestamp. * @dev Callable only by owner. Calling this while there is already a pending proposal will overwrite the pending proposal. */ function proposeNewConfig(ConfigSettings memory newConfig) external onlyOwner() nonReentrant() updateConfig() { diff --git a/packages/core/contracts/financial-templates/perpetual-multiparty/ConfigStoreInterface.sol b/packages/core/contracts/financial-templates/perpetual-multiparty/ConfigStoreInterface.sol index 7283a07e80..a018dc5777 100644 --- a/packages/core/contracts/financial-templates/perpetual-multiparty/ConfigStoreInterface.sol +++ b/packages/core/contracts/financial-templates/perpetual-multiparty/ConfigStoreInterface.sol @@ -1,6 +1,6 @@ // SPDX-License-Identifier: AGPL-3.0-only -pragma solidity ^0.6.0; -pragma experimental ABIEncoderV2; +pragma solidity ^0.8.0; +pragma abicoder v2; import "../../common/implementation/FixedPoint.sol"; diff --git a/packages/core/contracts/financial-templates/perpetual-multiparty/Perpetual.sol b/packages/core/contracts/financial-templates/perpetual-multiparty/Perpetual.sol index aaf3600384..88ba0b0d84 100644 --- a/packages/core/contracts/financial-templates/perpetual-multiparty/Perpetual.sol +++ b/packages/core/contracts/financial-templates/perpetual-multiparty/Perpetual.sol @@ -1,6 +1,6 @@ // SPDX-License-Identifier: AGPL-3.0-only -pragma solidity ^0.6.0; -pragma experimental ABIEncoderV2; +pragma solidity ^0.8.0; +pragma abicoder v2; import "./PerpetualLiquidatable.sol"; @@ -15,7 +15,6 @@ contract Perpetual is PerpetualLiquidatable { * are fed directly into the PositionManager's constructor within the inheritance tree. */ constructor(ConstructorParams memory params) - public PerpetualLiquidatable(params) // Note: since there is no logic here, there is no need to add a re-entrancy guard. { diff --git a/packages/core/contracts/financial-templates/perpetual-multiparty/PerpetualCreator.sol b/packages/core/contracts/financial-templates/perpetual-multiparty/PerpetualCreator.sol index 0e36acf2cc..ffa9babc83 100644 --- a/packages/core/contracts/financial-templates/perpetual-multiparty/PerpetualCreator.sol +++ b/packages/core/contracts/financial-templates/perpetual-multiparty/PerpetualCreator.sol @@ -1,6 +1,6 @@ // SPDX-License-Identifier: AGPL-3.0-only -pragma solidity ^0.6.0; -pragma experimental ABIEncoderV2; +pragma solidity ^0.8.0; +pragma abicoder v2; import "../../common/interfaces/ExpandedIERC20.sol"; import "../../common/interfaces/IERC20Standard.sol"; @@ -62,7 +62,7 @@ contract PerpetualCreator is ContractCreator, Testable, Lockable { address _finderAddress, address _tokenFactoryAddress, address _timerAddress - ) public ContractCreator(_finderAddress) Testable(_timerAddress) nonReentrant() { + ) ContractCreator(_finderAddress) Testable(_timerAddress) nonReentrant() { tokenFactoryAddress = _tokenFactoryAddress; } diff --git a/packages/core/contracts/financial-templates/perpetual-multiparty/PerpetualLib.sol b/packages/core/contracts/financial-templates/perpetual-multiparty/PerpetualLib.sol index 94f62e1afa..1868787314 100644 --- a/packages/core/contracts/financial-templates/perpetual-multiparty/PerpetualLib.sol +++ b/packages/core/contracts/financial-templates/perpetual-multiparty/PerpetualLib.sol @@ -1,6 +1,6 @@ // SPDX-License-Identifier: AGPL-3.0-only -pragma solidity ^0.6.0; -pragma experimental ABIEncoderV2; +pragma solidity ^0.8.0; +pragma abicoder v2; import "./Perpetual.sol"; diff --git a/packages/core/contracts/financial-templates/perpetual-multiparty/PerpetualLiquidatable.sol b/packages/core/contracts/financial-templates/perpetual-multiparty/PerpetualLiquidatable.sol index 58cc9e9c60..442988392c 100644 --- a/packages/core/contracts/financial-templates/perpetual-multiparty/PerpetualLiquidatable.sol +++ b/packages/core/contracts/financial-templates/perpetual-multiparty/PerpetualLiquidatable.sol @@ -1,9 +1,9 @@ // SPDX-License-Identifier: AGPL-3.0-only -pragma solidity ^0.6.0; -pragma experimental ABIEncoderV2; +pragma solidity ^0.8.0; +pragma abicoder v2; -import "@openzeppelin/contracts/math/SafeMath.sol"; -import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol"; +import "@openzeppelin/contracts/utils/math/SafeMath.sol"; +import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import "./PerpetualPositionManager.sol"; @@ -25,6 +25,7 @@ contract PerpetualLiquidatable is PerpetualPositionManager { using FixedPoint for FixedPoint.Unsigned; using SafeMath for uint256; using SafeERC20 for IERC20; + using SafeERC20 for ExpandedIERC20; /**************************************** * LIQUIDATION DATA STRUCTURES * @@ -172,7 +173,6 @@ contract PerpetualLiquidatable is PerpetualPositionManager { * are fed directly into the PositionManager's constructor within the inheritance tree. */ constructor(ConstructorParams memory params) - public PerpetualPositionManager( params.withdrawalLiveness, params.collateralAddress, diff --git a/packages/core/contracts/financial-templates/perpetual-multiparty/PerpetualPositionManager.sol b/packages/core/contracts/financial-templates/perpetual-multiparty/PerpetualPositionManager.sol index c302df730d..960a9caa17 100644 --- a/packages/core/contracts/financial-templates/perpetual-multiparty/PerpetualPositionManager.sol +++ b/packages/core/contracts/financial-templates/perpetual-multiparty/PerpetualPositionManager.sol @@ -1,10 +1,10 @@ // SPDX-License-Identifier: AGPL-3.0-only -pragma solidity ^0.6.0; -pragma experimental ABIEncoderV2; +pragma solidity ^0.8.0; +pragma abicoder v2; -import "@openzeppelin/contracts/math/SafeMath.sol"; +import "@openzeppelin/contracts/utils/math/SafeMath.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; -import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol"; +import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import "../../common/implementation/FixedPoint.sol"; import "../../common/interfaces/ExpandedIERC20.sol"; @@ -138,7 +138,6 @@ contract PerpetualPositionManager is FundingRateApplier { FixedPoint.Unsigned memory _tokenScaling, address _timerAddress ) - public FundingRateApplier( _fundingRateIdentifier, _collateralAddress, diff --git a/packages/core/contracts/financial-templates/test/ExpiringMultiPartyMock.sol b/packages/core/contracts/financial-templates/test/ExpiringMultiPartyMock.sol index 678bdd5a35..fa490adb25 100644 --- a/packages/core/contracts/financial-templates/test/ExpiringMultiPartyMock.sol +++ b/packages/core/contracts/financial-templates/test/ExpiringMultiPartyMock.sol @@ -1,5 +1,6 @@ -pragma solidity ^0.6.0; -pragma experimental ABIEncoderV2; +// SPDX-License-Identifier: AGPL-3.0-only +pragma solidity ^0.8.0; +pragma abicoder v2; import "../../common/implementation/Testable.sol"; import "../../common/implementation/FixedPoint.sol"; @@ -19,7 +20,7 @@ contract ExpiringMultiPartyMock is Testable { FixedPoint.Unsigned memory _collateralRequirement, bytes32 _priceIdentifier, address _timerAddress - ) public Testable(_timerAddress) { + ) Testable(_timerAddress) { expirationTimestamp = _expirationTimestamp; collateralRequirement = _collateralRequirement; financialProductLibrary = FinancialProductLibrary(_financialProductLibraryAddress); diff --git a/packages/core/contracts/financial-templates/test/FinancialProductLibraryTest.sol b/packages/core/contracts/financial-templates/test/FinancialProductLibraryTest.sol index 97a6d038b8..44b06cdc34 100644 --- a/packages/core/contracts/financial-templates/test/FinancialProductLibraryTest.sol +++ b/packages/core/contracts/financial-templates/test/FinancialProductLibraryTest.sol @@ -1,9 +1,12 @@ -pragma solidity ^0.6.0; -pragma experimental ABIEncoderV2; +// SPDX-License-Identifier: AGPL-3.0-only +pragma solidity ^0.8.0; +pragma abicoder v2; import "../common/financial-product-libraries/FinancialProductLibrary.sol"; // Implements a simple FinancialProductLibrary to test price and collateral requirement transoformations. contract FinancialProductLibraryTest is FinancialProductLibrary { + using FixedPoint for FixedPoint.Unsigned; + FixedPoint.Unsigned public priceTransformationScalar; FixedPoint.Unsigned public collateralRequirementTransformationScalar; bytes32 public transformedPriceIdentifier; @@ -13,7 +16,7 @@ contract FinancialProductLibraryTest is FinancialProductLibrary { FixedPoint.Unsigned memory _priceTransformationScalar, FixedPoint.Unsigned memory _collateralRequirementTransformationScalar, bytes32 _transformedPriceIdentifier - ) public { + ) { priceTransformationScalar = _priceTransformationScalar; collateralRequirementTransformationScalar = _collateralRequirementTransformationScalar; transformedPriceIdentifier = _transformedPriceIdentifier; diff --git a/packages/core/contracts/financial-templates/test/FundingRateApplierTest.sol b/packages/core/contracts/financial-templates/test/FundingRateApplierTest.sol index 31d0fc8ade..0510d9566c 100644 --- a/packages/core/contracts/financial-templates/test/FundingRateApplierTest.sol +++ b/packages/core/contracts/financial-templates/test/FundingRateApplierTest.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: AGPL-3.0-only -pragma solidity ^0.6.0; +pragma solidity ^0.8.0; -pragma experimental ABIEncoderV2; +pragma abicoder v2; import "../common/FundingRateApplier.sol"; import "../../common/implementation/FixedPoint.sol"; @@ -16,7 +16,6 @@ contract FundingRateApplierTest is FundingRateApplier { FixedPoint.Unsigned memory _tokenScaling, address _timerAddress ) - public FundingRateApplier( _fundingRateIdentifier, _collateralAddress, diff --git a/packages/core/contracts/merkle-distributor/implementation/MerkleDistributor.sol b/packages/core/contracts/merkle-distributor/implementation/MerkleDistributor.sol index 1e83d3effc..1b55b24eec 100644 --- a/packages/core/contracts/merkle-distributor/implementation/MerkleDistributor.sol +++ b/packages/core/contracts/merkle-distributor/implementation/MerkleDistributor.sol @@ -1,9 +1,10 @@ // SPDX-License-Identifier: AGPL-3.0-only -pragma solidity ^0.6.0; -pragma experimental ABIEncoderV2; +pragma solidity ^0.8.0; +pragma abicoder v2; -import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol"; -import "@openzeppelin/contracts/cryptography/MerkleProof.sol"; +import "@openzeppelin/contracts/utils/math/SafeMath.sol"; +import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; +import "@openzeppelin/contracts/utils/cryptography/MerkleProof.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; diff --git a/packages/core/contracts/oracle/implementation/Constants.sol b/packages/core/contracts/oracle/implementation/Constants.sol index 43f4916ff4..696b2c12fd 100644 --- a/packages/core/contracts/oracle/implementation/Constants.sol +++ b/packages/core/contracts/oracle/implementation/Constants.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: AGPL-3.0-only -pragma solidity ^0.6.0; +pragma solidity ^0.8.0; /** * @title Stores common interface names used throughout the DVM by registration in the Finder. diff --git a/packages/core/contracts/oracle/implementation/ContractCreator.sol b/packages/core/contracts/oracle/implementation/ContractCreator.sol index ecc34b6ed0..17731b2644 100644 --- a/packages/core/contracts/oracle/implementation/ContractCreator.sol +++ b/packages/core/contracts/oracle/implementation/ContractCreator.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: AGPL-3.0-only -pragma solidity ^0.6.0; +pragma solidity ^0.8.0; import "../interfaces/FinderInterface.sol"; import "../../common/implementation/AddressWhitelist.sol"; @@ -12,7 +12,7 @@ import "./Constants.sol"; abstract contract ContractCreator { address internal finderAddress; - constructor(address _finderAddress) public { + constructor(address _finderAddress) { finderAddress = _finderAddress; } diff --git a/packages/core/contracts/oracle/implementation/DesignatedVoting.sol b/packages/core/contracts/oracle/implementation/DesignatedVoting.sol index c5dc40f41a..28d60e85b1 100644 --- a/packages/core/contracts/oracle/implementation/DesignatedVoting.sol +++ b/packages/core/contracts/oracle/implementation/DesignatedVoting.sol @@ -1,6 +1,6 @@ // SPDX-License-Identifier: AGPL-3.0-only -pragma solidity ^0.6.0; -pragma experimental ABIEncoderV2; +pragma solidity ^0.8.0; +pragma abicoder v2; import "../../common/implementation/MultiRole.sol"; import "../../common/implementation/Withdrawable.sol"; @@ -37,7 +37,7 @@ contract DesignatedVoting is Withdrawable { address finderAddress, address ownerAddress, address voterAddress - ) public { + ) { _createExclusiveRole(uint256(Roles.Owner), uint256(Roles.Owner), ownerAddress); _createExclusiveRole(uint256(Roles.Voter), uint256(Roles.Owner), voterAddress); _setWithdrawRole(uint256(Roles.Owner)); diff --git a/packages/core/contracts/oracle/implementation/DesignatedVotingFactory.sol b/packages/core/contracts/oracle/implementation/DesignatedVotingFactory.sol index 3ac73411bc..28e48652eb 100644 --- a/packages/core/contracts/oracle/implementation/DesignatedVotingFactory.sol +++ b/packages/core/contracts/oracle/implementation/DesignatedVotingFactory.sol @@ -1,6 +1,6 @@ // SPDX-License-Identifier: AGPL-3.0-only -pragma solidity ^0.6.0; -pragma experimental ABIEncoderV2; +pragma solidity ^0.8.0; +pragma abicoder v2; import "../../common/implementation/Withdrawable.sol"; import "./DesignatedVoting.sol"; @@ -25,7 +25,7 @@ contract DesignatedVotingFactory is Withdrawable { * @notice Construct the DesignatedVotingFactory contract. * @param finderAddress keeps track of all contracts within the system based on their interfaceName. */ - constructor(address finderAddress) public { + constructor(address finderAddress) { finder = finderAddress; _createWithdrawRole(uint256(Roles.Withdrawer), uint256(Roles.Withdrawer), msg.sender); diff --git a/packages/core/contracts/oracle/implementation/FinancialContractsAdmin.sol b/packages/core/contracts/oracle/implementation/FinancialContractsAdmin.sol index c010b6da80..899526f5a0 100644 --- a/packages/core/contracts/oracle/implementation/FinancialContractsAdmin.sol +++ b/packages/core/contracts/oracle/implementation/FinancialContractsAdmin.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: AGPL-3.0-only -pragma solidity ^0.6.0; +pragma solidity ^0.8.0; import "../interfaces/AdministrateeInterface.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; diff --git a/packages/core/contracts/oracle/implementation/Finder.sol b/packages/core/contracts/oracle/implementation/Finder.sol index 2bc815230c..c71290d31b 100644 --- a/packages/core/contracts/oracle/implementation/Finder.sol +++ b/packages/core/contracts/oracle/implementation/Finder.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: AGPL-3.0-only -pragma solidity ^0.6.0; +pragma solidity ^0.8.0; import "@openzeppelin/contracts/access/Ownable.sol"; import "../interfaces/FinderInterface.sol"; diff --git a/packages/core/contracts/oracle/implementation/Governor.sol b/packages/core/contracts/oracle/implementation/Governor.sol index fdb339cd5e..2ac515e7d2 100644 --- a/packages/core/contracts/oracle/implementation/Governor.sol +++ b/packages/core/contracts/oracle/implementation/Governor.sol @@ -1,6 +1,6 @@ // SPDX-License-Identifier: AGPL-3.0-only -pragma solidity ^0.6.0; -pragma experimental ABIEncoderV2; +pragma solidity ^0.8.0; +pragma abicoder v2; import "../../common/implementation/MultiRole.sol"; import "../../common/implementation/FixedPoint.sol"; @@ -10,7 +10,7 @@ import "../interfaces/IdentifierWhitelistInterface.sol"; import "../interfaces/OracleInterface.sol"; import "./Constants.sol"; -import "@openzeppelin/contracts/math/SafeMath.sol"; +import "@openzeppelin/contracts/utils/math/SafeMath.sol"; import "@openzeppelin/contracts/utils/Address.sol"; /** @@ -64,7 +64,7 @@ contract Governor is MultiRole, Testable { address _finderAddress, uint256 _startingId, address _timerAddress - ) public Testable(_timerAddress) { + ) Testable(_timerAddress) { finder = FinderInterface(_finderAddress); _createExclusiveRole(uint256(Roles.Owner), uint256(Roles.Owner), msg.sender); _createExclusiveRole(uint256(Roles.Proposer), uint256(Roles.Owner), msg.sender); @@ -77,7 +77,7 @@ contract Governor is MultiRole, Testable { // This just sets the initial length of the array to the startingId since modifying length directly has been // disallowed in solidity 0.6. assembly { - sstore(proposals_slot, _startingId) + sstore(proposals.slot, _startingId) } } diff --git a/packages/core/contracts/oracle/implementation/IdentifierWhitelist.sol b/packages/core/contracts/oracle/implementation/IdentifierWhitelist.sol index ae415739a6..a70f771b79 100644 --- a/packages/core/contracts/oracle/implementation/IdentifierWhitelist.sol +++ b/packages/core/contracts/oracle/implementation/IdentifierWhitelist.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: AGPL-3.0-only -pragma solidity ^0.6.0; +pragma solidity ^0.8.0; import "../interfaces/IdentifierWhitelistInterface.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; diff --git a/packages/core/contracts/oracle/implementation/OptimisticOracle.sol b/packages/core/contracts/oracle/implementation/OptimisticOracle.sol index e88ee4c238..4950853f7b 100644 --- a/packages/core/contracts/oracle/implementation/OptimisticOracle.sol +++ b/packages/core/contracts/oracle/implementation/OptimisticOracle.sol @@ -1,10 +1,10 @@ // SPDX-License-Identifier: AGPL-3.0-only -pragma solidity ^0.6.0; -pragma experimental ABIEncoderV2; +pragma solidity ^0.8.0; +pragma abicoder v2; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; -import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol"; -import "@openzeppelin/contracts/math/SafeMath.sol"; +import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; +import "@openzeppelin/contracts/utils/math/SafeMath.sol"; import "@openzeppelin/contracts/utils/Address.sol"; import "../interfaces/StoreInterface.sol"; @@ -134,7 +134,7 @@ contract OptimisticOracle is OptimisticOracleInterface, Testable, Lockable { uint256 _liveness, address _finderAddress, address _timerAddress - ) public Testable(_timerAddress) { + ) Testable(_timerAddress) { finder = FinderInterface(_finderAddress); _validateLiveness(_liveness); defaultLiveness = _liveness; diff --git a/packages/core/contracts/oracle/implementation/Registry.sol b/packages/core/contracts/oracle/implementation/Registry.sol index 506f0c604c..c538497b50 100644 --- a/packages/core/contracts/oracle/implementation/Registry.sol +++ b/packages/core/contracts/oracle/implementation/Registry.sol @@ -1,11 +1,11 @@ // SPDX-License-Identifier: AGPL-3.0-only -pragma solidity ^0.6.0; -pragma experimental ABIEncoderV2; +pragma solidity ^0.8.0; +pragma abicoder v2; import "../../common/implementation/MultiRole.sol"; import "../interfaces/RegistryInterface.sol"; -import "@openzeppelin/contracts/math/SafeMath.sol"; +import "@openzeppelin/contracts/utils/math/SafeMath.sol"; /** * @title Registry for financial contracts and approved financial contract creators. @@ -60,7 +60,7 @@ contract Registry is RegistryInterface, MultiRole { /** * @notice Construct the Registry contract. */ - constructor() public { + constructor() { _createExclusiveRole(uint256(Roles.Owner), uint256(Roles.Owner), msg.sender); // Start with no contract creators registered. _createSharedRole(uint256(Roles.ContractCreator), uint256(Roles.Owner), new address[](0)); diff --git a/packages/core/contracts/oracle/implementation/ResultComputation.sol b/packages/core/contracts/oracle/implementation/ResultComputation.sol index 6883c77d0c..ed92c86fbd 100644 --- a/packages/core/contracts/oracle/implementation/ResultComputation.sol +++ b/packages/core/contracts/oracle/implementation/ResultComputation.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: AGPL-3.0-only -pragma solidity ^0.6.0; +pragma solidity ^0.8.0; import "../../common/implementation/FixedPoint.sol"; diff --git a/packages/core/contracts/oracle/implementation/Store.sol b/packages/core/contracts/oracle/implementation/Store.sol index d6cd25d7a6..a9ffb3db59 100644 --- a/packages/core/contracts/oracle/implementation/Store.sol +++ b/packages/core/contracts/oracle/implementation/Store.sol @@ -1,10 +1,10 @@ // SPDX-License-Identifier: AGPL-3.0-only -pragma solidity ^0.6.0; -pragma experimental ABIEncoderV2; +pragma solidity ^0.8.0; +pragma abicoder v2; -import "@openzeppelin/contracts/math/SafeMath.sol"; +import "@openzeppelin/contracts/utils/math/SafeMath.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; -import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol"; +import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import "../../common/implementation/FixedPoint.sol"; import "../../common/implementation/MultiRole.sol"; import "../../common/implementation/Withdrawable.sol"; @@ -47,7 +47,7 @@ contract Store is StoreInterface, Withdrawable, Testable { FixedPoint.Unsigned memory _fixedOracleFeePerSecondPerPfc, FixedPoint.Unsigned memory _weeklyDelayFeePerSecondPerPfc, address _timerAddress - ) public Testable(_timerAddress) { + ) Testable(_timerAddress) { _createExclusiveRole(uint256(Roles.Owner), uint256(Roles.Owner), msg.sender); _createWithdrawRole(uint256(Roles.Withdrawer), uint256(Roles.Owner), msg.sender); setFixedOracleFeePerSecondPerPfc(_fixedOracleFeePerSecondPerPfc); diff --git a/packages/core/contracts/oracle/implementation/TokenMigrator.sol b/packages/core/contracts/oracle/implementation/TokenMigrator.sol index acbea98f6b..bd2975922b 100644 --- a/packages/core/contracts/oracle/implementation/TokenMigrator.sol +++ b/packages/core/contracts/oracle/implementation/TokenMigrator.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: AGPL-3.0-only -pragma solidity ^0.6.0; +pragma solidity ^0.8.0; -pragma experimental ABIEncoderV2; +pragma abicoder v2; import "../../common/implementation/FixedPoint.sol"; import "../../common/interfaces/ExpandedIERC20.sol"; @@ -37,7 +37,7 @@ contract TokenMigrator { FixedPoint.Unsigned memory _rate, address _oldToken, address _newToken - ) public { + ) { // Prevents division by 0 in migrateTokens(). // Also it doesn’t make sense to have “0 old tokens equate to 1 new token”. require(_rate.isGreaterThan(0), "Rate can't be 0"); diff --git a/packages/core/contracts/oracle/implementation/VoteTiming.sol b/packages/core/contracts/oracle/implementation/VoteTiming.sol index a30a7952c4..149b0754d8 100644 --- a/packages/core/contracts/oracle/implementation/VoteTiming.sol +++ b/packages/core/contracts/oracle/implementation/VoteTiming.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: AGPL-3.0-only -pragma solidity ^0.6.0; +pragma solidity ^0.8.0; -import "@openzeppelin/contracts/math/SafeMath.sol"; +import "@openzeppelin/contracts/utils/math/SafeMath.sol"; import "../interfaces/VotingInterface.sol"; /** diff --git a/packages/core/contracts/oracle/implementation/Voting.sol b/packages/core/contracts/oracle/implementation/Voting.sol index 4ce48c7318..25f6ef2a96 100644 --- a/packages/core/contracts/oracle/implementation/Voting.sol +++ b/packages/core/contracts/oracle/implementation/Voting.sol @@ -1,6 +1,6 @@ // SPDX-License-Identifier: AGPL-3.0-only -pragma solidity ^0.6.0; -pragma experimental ABIEncoderV2; +pragma solidity ^0.8.0; +pragma abicoder v2; import "../../common/implementation/FixedPoint.sol"; import "../../common/implementation/Testable.sol"; @@ -17,8 +17,8 @@ import "./VotingToken.sol"; import "./Constants.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; -import "@openzeppelin/contracts/math/SafeMath.sol"; -import "@openzeppelin/contracts/cryptography/ECDSA.sol"; +import "@openzeppelin/contracts/utils/math/SafeMath.sol"; +import "@openzeppelin/contracts/utils/cryptography/ECDSA.sol"; /** * @title Voting system for Oracle. @@ -215,7 +215,7 @@ contract Voting is address _votingToken, address _finder, address _timerAddress - ) public Testable(_timerAddress) { + ) Testable(_timerAddress) { voteTiming.init(_phaseLength); require(_gatPercentage.isLessThanOrEqual(1), "GAT percentage must be <= 100%"); gatPercentage = _gatPercentage; @@ -277,13 +277,13 @@ contract Voting is // Price requests always go in the next round, so add 1 to the computed current round. uint256 nextRoundId = currentRoundId.add(1); - priceRequests[priceRequestId] = PriceRequest({ - identifier: identifier, - time: time, - lastVotingRound: nextRoundId, - index: pendingPriceRequests.length, - ancillaryData: ancillaryData - }); + PriceRequest storage newPriceRequest = priceRequests[priceRequestId]; + newPriceRequest.identifier = identifier; + newPriceRequest.time = time; + newPriceRequest.lastVotingRound = nextRoundId; + newPriceRequest.index = pendingPriceRequests.length; + newPriceRequest.ancillaryData = ancillaryData; + pendingPriceRequests.push(priceRequestId); emit PriceRequestAdded(nextRoundId, identifier, time); } diff --git a/packages/core/contracts/oracle/implementation/VotingToken.sol b/packages/core/contracts/oracle/implementation/VotingToken.sol index 6e18b142d2..4f116f8851 100644 --- a/packages/core/contracts/oracle/implementation/VotingToken.sol +++ b/packages/core/contracts/oracle/implementation/VotingToken.sol @@ -1,8 +1,8 @@ // SPDX-License-Identifier: AGPL-3.0-only -pragma solidity ^0.6.0; +pragma solidity ^0.8.0; import "../../common/implementation/ExpandedERC20.sol"; -import "@openzeppelin/contracts/token/ERC20/ERC20Snapshot.sol"; +import "@openzeppelin/contracts/token/ERC20/extensions/ERC20Snapshot.sol"; /** * @title Ownership of this token allows a voter to respond to price requests. @@ -12,7 +12,11 @@ contract VotingToken is ExpandedERC20, ERC20Snapshot { /** * @notice Constructs the VotingToken. */ - constructor() public ExpandedERC20("UMA Voting Token v1", "UMA", 18) {} + constructor() ExpandedERC20("UMA Voting Token v1", "UMA", 18) ERC20Snapshot() {} + + function decimals() public view virtual override(ERC20, ExpandedERC20) returns (uint8) { + return super.decimals(); + } /** * @notice Creates a new snapshot ID. @@ -30,15 +34,23 @@ contract VotingToken is ExpandedERC20, ERC20Snapshot { address from, address to, uint256 value - ) internal override(ERC20, ERC20Snapshot) { + ) internal override(ERC20) { super._transfer(from, to, value); } - function _mint(address account, uint256 value) internal override(ERC20, ERC20Snapshot) { + function _mint(address account, uint256 value) internal virtual override(ERC20) { super._mint(account, value); } - function _burn(address account, uint256 value) internal override(ERC20, ERC20Snapshot) { + function _burn(address account, uint256 value) internal virtual override(ERC20) { super._burn(account, value); } + + function _beforeTokenTransfer( + address from, + address to, + uint256 amount + ) internal virtual override(ERC20, ERC20Snapshot) { + super._beforeTokenTransfer(from, to, amount); + } } diff --git a/packages/core/contracts/oracle/implementation/test/GovernorTest.sol b/packages/core/contracts/oracle/implementation/test/GovernorTest.sol index f9bdf78818..7b710b7758 100644 --- a/packages/core/contracts/oracle/implementation/test/GovernorTest.sol +++ b/packages/core/contracts/oracle/implementation/test/GovernorTest.sol @@ -1,13 +1,13 @@ // SPDX-License-Identifier: AGPL-3.0-only -pragma solidity ^0.6.0; +pragma solidity ^0.8.0; -pragma experimental ABIEncoderV2; +pragma abicoder v2; import "../Governor.sol"; // GovernorTest exposes internal methods in the Governor for testing. contract GovernorTest is Governor { - constructor(address _timerAddress) public Governor(address(0), 0, _timerAddress) {} + constructor(address _timerAddress) Governor(address(0), 0, _timerAddress) {} function addPrefix( bytes32 input, diff --git a/packages/core/contracts/oracle/implementation/test/MockAdministratee.sol b/packages/core/contracts/oracle/implementation/test/MockAdministratee.sol index 9136ada7e5..98f883d441 100644 --- a/packages/core/contracts/oracle/implementation/test/MockAdministratee.sol +++ b/packages/core/contracts/oracle/implementation/test/MockAdministratee.sol @@ -1,6 +1,6 @@ // SPDX-License-Identifier: AGPL-3.0-only -pragma solidity ^0.6.0; -pragma experimental ABIEncoderV2; +pragma solidity ^0.8.0; +pragma abicoder v2; import "../../interfaces/AdministrateeInterface.sol"; diff --git a/packages/core/contracts/oracle/implementation/test/OptimisticRequesterTest.sol b/packages/core/contracts/oracle/implementation/test/OptimisticRequesterTest.sol index 319e5dc17f..d1c175377f 100644 --- a/packages/core/contracts/oracle/implementation/test/OptimisticRequesterTest.sol +++ b/packages/core/contracts/oracle/implementation/test/OptimisticRequesterTest.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: AGPL-3.0-only -pragma solidity ^0.6.0; +pragma solidity ^0.8.0; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; @@ -24,7 +24,7 @@ contract OptimisticRequesterTest is OptimisticRequester { // Manually set an expiration timestamp to simulate expiry price requests uint256 public expirationTimestamp; - constructor(OptimisticOracle _optimisticOracle) public { + constructor(OptimisticOracle _optimisticOracle) { optimisticOracle = _optimisticOracle; } diff --git a/packages/core/contracts/oracle/implementation/test/ResultComputationTest.sol b/packages/core/contracts/oracle/implementation/test/ResultComputationTest.sol index 70bc6aad12..4fe257ac3d 100644 --- a/packages/core/contracts/oracle/implementation/test/ResultComputationTest.sol +++ b/packages/core/contracts/oracle/implementation/test/ResultComputationTest.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: AGPL-3.0-only -pragma solidity ^0.6.0; +pragma solidity ^0.8.0; -pragma experimental ABIEncoderV2; +pragma abicoder v2; import "../ResultComputation.sol"; import "../../../common/implementation/FixedPoint.sol"; diff --git a/packages/core/contracts/oracle/implementation/test/VoteTimingTest.sol b/packages/core/contracts/oracle/implementation/test/VoteTimingTest.sol index de02a3037b..afa0d0ca5c 100644 --- a/packages/core/contracts/oracle/implementation/test/VoteTimingTest.sol +++ b/packages/core/contracts/oracle/implementation/test/VoteTimingTest.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: AGPL-3.0-only -pragma solidity ^0.6.0; +pragma solidity ^0.8.0; import "../../interfaces/VotingInterface.sol"; import "../VoteTiming.sol"; @@ -10,7 +10,7 @@ contract VoteTimingTest { VoteTiming.Data public voteTiming; - constructor(uint256 phaseLength) public { + constructor(uint256 phaseLength) { wrapInit(phaseLength); } diff --git a/packages/core/contracts/oracle/implementation/test/VotingTest.sol b/packages/core/contracts/oracle/implementation/test/VotingTest.sol index 03ddf0fd06..4224545cdb 100644 --- a/packages/core/contracts/oracle/implementation/test/VotingTest.sol +++ b/packages/core/contracts/oracle/implementation/test/VotingTest.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: AGPL-3.0-only -pragma solidity ^0.6.0; +pragma solidity ^0.8.0; -pragma experimental ABIEncoderV2; +pragma abicoder v2; import "../Voting.sol"; import "../../../common/implementation/FixedPoint.sol"; @@ -17,7 +17,6 @@ contract VotingTest is Voting { address _finder, address _timerAddress ) - public Voting( _phaseLength, _gatPercentage, diff --git a/packages/core/contracts/oracle/interfaces/AdministrateeInterface.sol b/packages/core/contracts/oracle/interfaces/AdministrateeInterface.sol index b467dfe9f0..3d33b9024a 100644 --- a/packages/core/contracts/oracle/interfaces/AdministrateeInterface.sol +++ b/packages/core/contracts/oracle/interfaces/AdministrateeInterface.sol @@ -1,6 +1,6 @@ // SPDX-License-Identifier: AGPL-3.0-only -pragma solidity ^0.6.0; -pragma experimental ABIEncoderV2; +pragma solidity ^0.8.0; +pragma abicoder v2; import "../../common/implementation/FixedPoint.sol"; diff --git a/packages/core/contracts/oracle/interfaces/FinderInterface.sol b/packages/core/contracts/oracle/interfaces/FinderInterface.sol index 568b3038a2..8f544d4186 100644 --- a/packages/core/contracts/oracle/interfaces/FinderInterface.sol +++ b/packages/core/contracts/oracle/interfaces/FinderInterface.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: AGPL-3.0-only -pragma solidity ^0.6.0; +pragma solidity ^0.8.0; /** * @title Provides addresses of the live contracts implementing certain interfaces. diff --git a/packages/core/contracts/oracle/interfaces/IdentifierWhitelistInterface.sol b/packages/core/contracts/oracle/interfaces/IdentifierWhitelistInterface.sol index d477e07bcb..0bebd9da5a 100644 --- a/packages/core/contracts/oracle/interfaces/IdentifierWhitelistInterface.sol +++ b/packages/core/contracts/oracle/interfaces/IdentifierWhitelistInterface.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: AGPL-3.0-only -pragma solidity ^0.6.0; +pragma solidity ^0.8.0; -pragma experimental ABIEncoderV2; +pragma abicoder v2; /** * @title Interface for whitelists of supported identifiers that the oracle can provide prices for. diff --git a/packages/core/contracts/oracle/interfaces/OptimisticOracleInterface.sol b/packages/core/contracts/oracle/interfaces/OptimisticOracleInterface.sol index a8479cf71d..3cc491a3aa 100644 --- a/packages/core/contracts/oracle/interfaces/OptimisticOracleInterface.sol +++ b/packages/core/contracts/oracle/interfaces/OptimisticOracleInterface.sol @@ -1,6 +1,6 @@ // SPDX-License-Identifier: AGPL-3.0-only -pragma solidity ^0.6.0; -pragma experimental ABIEncoderV2; +pragma solidity ^0.8.0; +pragma abicoder v2; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; diff --git a/packages/core/contracts/oracle/interfaces/OracleAncillaryInterface.sol b/packages/core/contracts/oracle/interfaces/OracleAncillaryInterface.sol index 9380427470..30f1277ff7 100644 --- a/packages/core/contracts/oracle/interfaces/OracleAncillaryInterface.sol +++ b/packages/core/contracts/oracle/interfaces/OracleAncillaryInterface.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: AGPL-3.0-only -pragma solidity ^0.6.0; +pragma solidity ^0.8.0; /** * @title Financial contract facing Oracle interface. diff --git a/packages/core/contracts/oracle/interfaces/OracleInterface.sol b/packages/core/contracts/oracle/interfaces/OracleInterface.sol index 8f4fecba28..84c82a4e95 100644 --- a/packages/core/contracts/oracle/interfaces/OracleInterface.sol +++ b/packages/core/contracts/oracle/interfaces/OracleInterface.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: AGPL-3.0-only -pragma solidity ^0.6.0; +pragma solidity ^0.8.0; /** * @title Financial contract facing Oracle interface. diff --git a/packages/core/contracts/oracle/interfaces/RegistryInterface.sol b/packages/core/contracts/oracle/interfaces/RegistryInterface.sol index 0f2425304b..401e15d440 100644 --- a/packages/core/contracts/oracle/interfaces/RegistryInterface.sol +++ b/packages/core/contracts/oracle/interfaces/RegistryInterface.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: AGPL-3.0-only -pragma solidity ^0.6.0; +pragma solidity ^0.8.0; -pragma experimental ABIEncoderV2; +pragma abicoder v2; /** * @title Interface for a registry of contracts and contract creators. diff --git a/packages/core/contracts/oracle/interfaces/StoreInterface.sol b/packages/core/contracts/oracle/interfaces/StoreInterface.sol index a429e2edf2..74ddc47d9a 100644 --- a/packages/core/contracts/oracle/interfaces/StoreInterface.sol +++ b/packages/core/contracts/oracle/interfaces/StoreInterface.sol @@ -1,6 +1,6 @@ // SPDX-License-Identifier: AGPL-3.0-only -pragma solidity ^0.6.0; -pragma experimental ABIEncoderV2; +pragma solidity ^0.8.0; +pragma abicoder v2; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "../../common/implementation/FixedPoint.sol"; diff --git a/packages/core/contracts/oracle/interfaces/VotingAncillaryInterface.sol b/packages/core/contracts/oracle/interfaces/VotingAncillaryInterface.sol index 1b104bd661..f4d8d40c8c 100644 --- a/packages/core/contracts/oracle/interfaces/VotingAncillaryInterface.sol +++ b/packages/core/contracts/oracle/interfaces/VotingAncillaryInterface.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: AGPL-3.0-only -pragma solidity ^0.6.0; +pragma solidity ^0.8.0; -pragma experimental ABIEncoderV2; +pragma abicoder v2; import "../../common/implementation/FixedPoint.sol"; diff --git a/packages/core/contracts/oracle/interfaces/VotingInterface.sol b/packages/core/contracts/oracle/interfaces/VotingInterface.sol index 333b9ac292..f82c00282e 100644 --- a/packages/core/contracts/oracle/interfaces/VotingInterface.sol +++ b/packages/core/contracts/oracle/interfaces/VotingInterface.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: AGPL-3.0-only -pragma solidity ^0.6.0; +pragma solidity ^0.8.0; -pragma experimental ABIEncoderV2; +pragma abicoder v2; import "../../common/implementation/FixedPoint.sol"; import "./VotingAncillaryInterface.sol"; diff --git a/packages/core/contracts/oracle/test/MockOracle.sol b/packages/core/contracts/oracle/test/MockOracle.sol index 39656abbc8..68dafb2784 100644 --- a/packages/core/contracts/oracle/test/MockOracle.sol +++ b/packages/core/contracts/oracle/test/MockOracle.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: AGPL-3.0-only -pragma solidity ^0.6.0; +pragma solidity ^0.8.0; -pragma experimental ABIEncoderV2; +pragma abicoder v2; import "../../common/implementation/Testable.sol"; import "../interfaces/OracleInterface.sol"; @@ -43,7 +43,7 @@ contract MockOracle is OracleInterface, Testable { mapping(bytes32 => mapping(uint256 => QueryIndex)) private queryIndices; QueryPoint[] private requestedPrices; - constructor(address _finderAddress, address _timerAddress) public Testable(_timerAddress) { + constructor(address _finderAddress, address _timerAddress) Testable(_timerAddress) { finder = FinderInterface(_finderAddress); } diff --git a/packages/core/contracts/oracle/test/MockOracleAncillary.sol b/packages/core/contracts/oracle/test/MockOracleAncillary.sol index 1371083f38..445287b9e2 100644 --- a/packages/core/contracts/oracle/test/MockOracleAncillary.sol +++ b/packages/core/contracts/oracle/test/MockOracleAncillary.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: AGPL-3.0-only -pragma solidity ^0.6.0; +pragma solidity ^0.8.0; -pragma experimental ABIEncoderV2; +pragma abicoder v2; import "../../common/implementation/Testable.sol"; import "../interfaces/OracleAncillaryInterface.sol"; @@ -53,7 +53,7 @@ contract MockOracleAncillary is OracleAncillaryInterface, Testable { int256 price ); - constructor(address _finderAddress, address _timerAddress) public Testable(_timerAddress) { + constructor(address _finderAddress, address _timerAddress) Testable(_timerAddress) { finder = FinderInterface(_finderAddress); } diff --git a/packages/core/contracts/oracle/test/VotingAncillaryInterfaceTest.sol b/packages/core/contracts/oracle/test/VotingAncillaryInterfaceTest.sol index 5354b035ab..01b6bb5425 100644 --- a/packages/core/contracts/oracle/test/VotingAncillaryInterfaceTest.sol +++ b/packages/core/contracts/oracle/test/VotingAncillaryInterfaceTest.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: AGPL-3.0-only -pragma solidity ^0.6.0; +pragma solidity ^0.8.0; -pragma experimental ABIEncoderV2; +pragma abicoder v2; import "../../common/implementation/FixedPoint.sol"; import "../../common/implementation/Testable.sol"; import "../interfaces/OracleAncillaryInterface.sol"; diff --git a/packages/core/contracts/oracle/test/VotingInterfaceTest.sol b/packages/core/contracts/oracle/test/VotingInterfaceTest.sol index 3f13d8aaf0..0a1d450eb4 100644 --- a/packages/core/contracts/oracle/test/VotingInterfaceTest.sol +++ b/packages/core/contracts/oracle/test/VotingInterfaceTest.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: AGPL-3.0-only -pragma solidity ^0.6.0; +pragma solidity ^0.8.0; -pragma experimental ABIEncoderV2; +pragma abicoder v2; import "../../common/implementation/FixedPoint.sol"; import "../../common/implementation/Testable.sol"; import "../interfaces/OracleInterface.sol"; diff --git a/packages/core/contracts/umips/Umip3Upgrader.sol b/packages/core/contracts/umips/Umip3Upgrader.sol index 9d45707220..d202723ed0 100644 --- a/packages/core/contracts/umips/Umip3Upgrader.sol +++ b/packages/core/contracts/umips/Umip3Upgrader.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: AGPL-3.0-only -pragma solidity ^0.6.0; +pragma solidity ^0.8.0; import "../oracle/implementation/Finder.sol"; import "../oracle/implementation/Constants.sol"; @@ -38,7 +38,7 @@ contract Umip3Upgrader { address _financialContractsAdmin, address _registry, address _newGovernor - ) public { + ) { existingGovernor = _existingGovernor; existingVoting = Voting(_existingVoting); finder = Finder(_finder); diff --git a/packages/core/contracts/umips/VotingUpgrader.sol b/packages/core/contracts/umips/VotingUpgrader.sol index 2dc45b42b6..19284cc769 100644 --- a/packages/core/contracts/umips/VotingUpgrader.sol +++ b/packages/core/contracts/umips/VotingUpgrader.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: AGPL-3.0-only -pragma solidity ^0.6.0; +pragma solidity ^0.8.0; import "../oracle/implementation/Finder.sol"; import "../oracle/implementation/Constants.sol"; @@ -45,7 +45,7 @@ contract VotingUpgrader { address _newVoting, address _finder, address _setMigratedAddress - ) public { + ) { governor = _governor; existingVoting = Voting(_existingVoting); newVoting = _newVoting; diff --git a/packages/core/package.json b/packages/core/package.json index 317b2666f2..414433d7ad 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -13,13 +13,14 @@ "@uma/core-2-0-1": "npm:@uma/core@2.0.1", "@uniswap/lib": "4.0.1-alpha", "@uniswap/v2-core": "1.0.0", - "@uniswap/v2-periphery": "1.1.0-beta.0" + "@uniswap/v2-periphery": "1.1.0-beta.0", + "@uniswap/v3-core": "^1.0.0-rc.2" }, "devDependencies": { "@awaitjs/express": "^0.3.0", "@ethersproject/units": "^5.0.3", "@google-cloud/bigquery": "^5.3.0", - "@openzeppelin/contracts": "3.0.0", + "@openzeppelin/contracts": "4.1.0", "@uma/financial-templates-lib": "^2.2.0", "@uma/merkle-distributor": "^1.1.0", "bignumber.js": "^8.0.1", diff --git a/packages/core/test/merkle-distributor/MerkleDistributor.js b/packages/core/test/merkle-distributor/MerkleDistributor.js index 93ddd14840..0d0b9a7307 100644 --- a/packages/core/test/merkle-distributor/MerkleDistributor.js +++ b/packages/core/test/merkle-distributor/MerkleDistributor.js @@ -251,7 +251,7 @@ contract("MerkleDistributor.js", function(accounts) { }, { from: rando } ); - assertApproximate(87259, claimTx.receipt.gasUsed); + assertApproximate(87749, claimTx.receipt.gasUsed); }); it("Can claim on another account's behalf", async function() { const claimerBalanceBefore = await rewardToken.balanceOf(leaf.account); @@ -526,7 +526,7 @@ contract("MerkleDistributor.js", function(accounts) { it("gas", async function() { const txn = await merkleDistributor.claimMulti(batchedClaims); assertApproximate( - 37146, + 37666, Math.floor(txn.receipt.gasUsed / (rewardLeafs.length * Object.keys(SamplePayouts.exampleRecipients).length)) ); }); @@ -606,7 +606,7 @@ contract("MerkleDistributor.js", function(accounts) { amount: leaf.amount, merkleProof: proof }); - assertApproximate(99220, tx.receipt.gasUsed); + assertApproximate(100282, tx.receipt.gasUsed); }); it("gas deeper node", async function() { const leafIndex = 90000; @@ -619,7 +619,7 @@ contract("MerkleDistributor.js", function(accounts) { amount: leaf.amount, merkleProof: proof }); - assertApproximate(99222, tx.receipt.gasUsed); + assertApproximate(100284, tx.receipt.gasUsed); }); it("gas average random distribution", async function() { let total = toBN(0); @@ -638,7 +638,7 @@ contract("MerkleDistributor.js", function(accounts) { count++; } const average = total.divn(count); - assertApproximate(84832, Math.floor(average.toNumber())); + assertApproximate(85894, Math.floor(average.toNumber())); }); // Claiming consecutive leaves should result in average gas savings // because of using single bits in the bitmap to track claims instead @@ -660,7 +660,7 @@ contract("MerkleDistributor.js", function(accounts) { count++; } const average = total.divn(count); - assertApproximate(75069, Math.floor(average.toNumber())); + assertApproximate(76124, Math.floor(average.toNumber())); }); it("no double claims in random distribution", async () => { for (let i = 0; i < 25; i += Math.floor(Math.random() * (NUM_LEAVES / SAMPLE_SIZE))) { @@ -727,7 +727,7 @@ contract("MerkleDistributor.js", function(accounts) { } const sortedClaims = await sortClaimsByAccountAndToken(batchedClaims); const tx = await merkleDistributor.claimMulti(sortedClaims); - assertApproximate(49866, Math.floor(tx.receipt.gasUsed / sortedClaims.length)); + assertApproximate(50837, Math.floor(tx.receipt.gasUsed / sortedClaims.length)); }); it("one tree: gas amortized first 25", async function() { for (let i = 0; i < 25; i++) { @@ -743,7 +743,7 @@ contract("MerkleDistributor.js", function(accounts) { } const sortedClaims = await sortClaimsByAccountAndToken(batchedClaims); const tx = await merkleDistributor.claimMulti(sortedClaims); - assertApproximate(40381, Math.floor(tx.receipt.gasUsed / sortedClaims.length)); + assertApproximate(41392, Math.floor(tx.receipt.gasUsed / sortedClaims.length)); }); it("many trees, many reward tokens, many accounts: gas amortized", async function() { // This is a realistic scenario where the caller is making their claims for various @@ -796,12 +796,12 @@ contract("MerkleDistributor.js", function(accounts) { // Check estimated gas for batch claiming unsorted array of claims: const gasUnsorted = await merkleDistributor.claimMulti.estimateGas(batchedClaims); - assertApproximate(55883, Math.floor(gasUnsorted / batchedClaims.length)); + assertApproximate(56973, Math.floor(gasUnsorted / batchedClaims.length)); // Sort the claims such that windows with the same reward currency end up next to each other. const sortedClaims = await sortClaimsByAccountAndToken(batchedClaims); const tx = await merkleDistributor.claimMulti(sortedClaims); - assertApproximate(53266, Math.floor(tx.receipt.gasUsed / sortedClaims.length)); + assertApproximate(54302, Math.floor(tx.receipt.gasUsed / sortedClaims.length)); }); it("batch cannot include double claims", async function() { for (let i = 0; i < NUM_LEAVES; i += NUM_LEAVES / SAMPLE_SIZE) { @@ -819,7 +819,6 @@ contract("MerkleDistributor.js", function(accounts) { // Making batch claims that include ANY of the already executed claims will fail: for (let i = 0; i < batchedClaims.length; i++) { - console.log(batchedClaims.slice(0, batchedClaims.length - i).length); assert( await didContractThrow(merkleDistributor.claimMulti(batchedClaims.slice(0, batchedClaims.length - i))) ); diff --git a/packages/serverless-orchestration/package.json b/packages/serverless-orchestration/package.json index a3637f0b20..49bd0bd6fc 100644 --- a/packages/serverless-orchestration/package.json +++ b/packages/serverless-orchestration/package.json @@ -12,8 +12,7 @@ "@awaitjs/express": "^0.3.0", "@google-cloud/datastore": "^6.0.0", "@google-cloud/storage": "^2.4.2", - "@openzeppelin/contracts": "3.0.0", - "@uma/core": "npm:@uma/core@1.2.0", + "@uma/core": "^2.2.0", "chai": "^4.2.0", "coveralls": "^3.1.0", "ethereumjs-wallet": "^1.0.0", diff --git a/packages/serverless-orchestration/test/ServerlessHub.js b/packages/serverless-orchestration/test/ServerlessHub.js index 766040c74d..7a8e600bbf 100644 --- a/packages/serverless-orchestration/test/ServerlessHub.js +++ b/packages/serverless-orchestration/test/ServerlessHub.js @@ -17,7 +17,7 @@ const IdentifierWhitelist = artifacts.require("IdentifierWhitelist"); const TokenFactory = artifacts.require("TokenFactory"); const Token = artifacts.require("ExpandedERC20"); const Timer = artifacts.require("Timer"); -const UniswapMock = artifacts.require("UniswapMock"); +const UniswapV2Mock = artifacts.require("UniswapV2Mock"); const SyntheticToken = artifacts.require("SyntheticToken"); // Custom winston transport module to monitor winston log outputs @@ -110,19 +110,18 @@ contract("ServerlessHub.js", function(accounts) { priceFeedIdentifier: padRight(utf8ToHex("ETH/BTC"), 64), liquidationLiveness: "1000", collateralRequirement: { rawValue: toWei("1.2") }, - disputeBondPct: { rawValue: toWei("0.1") }, - sponsorDisputeRewardPct: { rawValue: toWei("0.1") }, - disputerDisputeRewardPct: { rawValue: toWei("0.1") }, + disputeBondPercentage: { rawValue: toWei("0.1") }, + sponsorDisputeRewardPercentage: { rawValue: toWei("0.1") }, + disputerDisputeRewardPercentage: { rawValue: toWei("0.1") }, minSponsorTokens: { rawValue: toWei("1") }, timerAddress: (await Timer.deployed()).address, - excessTokenBeneficiary: ZERO_ADDRESS, financialProductLibraryAddress: ZERO_ADDRESS }; // Deploy a new expiring multi party emp = await ExpiringMultiParty.new(constructorParams); - uniswap = await UniswapMock.new(); + uniswap = await UniswapV2Mock.new(); defaultPricefeedConfig = { type: "test", diff --git a/packages/serverless-orchestration/test/ServerlessSpoke.js b/packages/serverless-orchestration/test/ServerlessSpoke.js index 989fb25410..1d4ca97f46 100644 --- a/packages/serverless-orchestration/test/ServerlessSpoke.js +++ b/packages/serverless-orchestration/test/ServerlessSpoke.js @@ -13,7 +13,7 @@ const IdentifierWhitelist = artifacts.require("IdentifierWhitelist"); const TokenFactory = artifacts.require("TokenFactory"); const Token = artifacts.require("ExpandedERC20"); const Timer = artifacts.require("Timer"); -const UniswapMock = artifacts.require("UniswapMock"); +const UniswapV2Mock = artifacts.require("UniswapV2Mock"); const SyntheticToken = artifacts.require("SyntheticToken"); // Custom winston transport module to monitor winston log outputs @@ -75,19 +75,18 @@ contract("ServerlessSpoke.js", function(accounts) { tokenAddress: syntheticToken.address, liquidationLiveness: "1000", collateralRequirement: { rawValue: toWei("1.2") }, - disputeBondPct: { rawValue: toWei("0.1") }, - sponsorDisputeRewardPct: { rawValue: toWei("0.1") }, - disputerDisputeRewardPct: { rawValue: toWei("0.1") }, + disputeBondPercentage: { rawValue: toWei("0.1") }, + sponsorDisputeRewardPercentage: { rawValue: toWei("0.1") }, + disputerDisputeRewardPercentage: { rawValue: toWei("0.1") }, minSponsorTokens: { rawValue: toWei("1") }, timerAddress: (await Timer.deployed()).address, - excessTokenBeneficiary: ZERO_ADDRESS, financialProductLibraryAddress: ZERO_ADDRESS }; // Deploy a new expiring multi party emp = await ExpiringMultiParty.new(constructorParams); - uniswap = await UniswapMock.new(); + uniswap = await UniswapV2Mock.new(); defaultPricefeedConfig = { type: "test", diff --git a/playbook.yml b/playbook.yml deleted file mode 100644 index 0848c83649..0000000000 --- a/playbook.yml +++ /dev/null @@ -1,13 +0,0 @@ -site: - title: UMA Docs - url: https://docs.umaproject.org - keys: - google_analytics: 'UA-130599982-5' - start_page: uma::index.adoc -content: - sources: - - url: . - branches: HEAD -ui: - bundle: - url: ./documentation/ui/build/uma-docs-ui.zip diff --git a/scripts/build_docs_site.sh b/scripts/build_docs_site.sh deleted file mode 100755 index 7e45ee66ae..0000000000 --- a/scripts/build_docs_site.sh +++ /dev/null @@ -1,130 +0,0 @@ -#!/bin/bash -set -e - -md_to_adoc() { - # Input filename - local infile=$1 - - # Output filename - local outfile=$2 - - # Depth of file in tree. - local depth=$3 - - # Create temporary file for intermediate step. - local tmpfile=$(mktemp) - - # Copy the markdown to a tempfile that can be freely modified. - cp $infile $tmpfile - - # Note: the .bak file is only generated because this is the only BSD/GNU compatible way to do an in place sed. - # Changes markdown headers so they are correctly converted to the right level in asciidoc. - sed -i.bak 's/^#[[:space:]]/= /' $tmpfile - sed -i.bak 's/^##/#/' $tmpfile - - # Changes markdown file interlink extensions to .html so they continue to work when the site is rendered. - sed -i.bak 's/\(\](\.\{0,2\}[^).]*\)\.md\([)#]\)/\1.html\2/g' $tmpfile - - # Changes all dashes to underscores inside the anchors. - sed -i.bak -e ':loop' -e 's/\(\]([^)]*#[^)]*\)-\([^)]*)\)/\1_\2/g' -e 't loop' $tmpfile - - # Adds a leading underscore to same-file anchors. - sed -i.bak 's/\](#/\](#_/g' $tmpfile - - # Adds a leading underscore to outside-file anchors. - sed -i.bak 's/\.html#/.html#_/g' $tmpfile - - # For each level of depth below the module level, we need to remove one "../" from file references. This is because - # subdirectories effectively get flattened into the modules general file list. - for ((n=0;n<$depth;n++)) - do - sed -i.bak 's/(\.\.\//(/' $tmpfile - done - - # Because the antora directory structure is flattened, we need to strip directories deeper than the module level. - # This sed takes links that look like "../module/deeper_dir/file.html" and transforms them to "../module/file.html". - sed -i.bak 's/\(\](\.\.\/[[:alnum:]_-]*\/\)[^.)]*\/\([[:alnum:]_-]*.html\)/\1\2/g' $tmpfile - - # Similar to the last sed except that it handles links that don't start with "../". - # This sed takes links that look like "(./)deeper_dir/file.html" and transforms them to "file.html". - sed -i.bak 's/\]([.]\{0,1\}[^.][^).]*\/\([[:alnum:]_-]*.html\)/](\1/g' $tmpfile - - # If the file is in the ROOT directory, then we need to remove all of the leading "../" from links. - if [[ $infile = *ROOT* ]] - then - sed -i.bak 's/\](\.\.\//](/g' $tmpfile - fi - - # Use pandoc to do the remainder of the conversion and output to the destination. - pandoc --atx-headers --verbose --wrap=none --toc --reference-links -f gfm -s -o $outfile -t asciidoc $tmpfile -} - -START_DIR=$(pwd) - -rm -rf $START_DIR/build/site -rm -rf $START_DIR/modules -rm -rf $START_DIR/documentation/ui -rm -rf $START_DIR/antora.yml - -# Move the script into the documentation directory so the relative paths produced by find only include dirs below documentation/. -cd $START_DIR/documentation -for FNAME in $(find . -name '*.md'); -do - MODULE_DIR=$(echo "$FNAME" | cut -d "/" -f2) - mkdir -p $START_DIR/modules/$MODULE_DIR/pages - BNAME=$(basename "$FNAME" .md) - # Determine the depth. - SLASH_COUNT=$(echo $FNAME | grep -o '/' | wc -l) - DEPTH="$(($SLASH_COUNT-2))" - md_to_adoc $FNAME $START_DIR/modules/$MODULE_DIR/pages/$BNAME.adoc $DEPTH -done - -# Find images and put them into the appropriate image folder. -for FNAME in $(find . \( -name '*.png' -or -name '*.jpeg' -or -name '*.jpg' \)); -do - MODULE_DIR=$(echo "$FNAME" | cut -d "/" -f2) - mkdir -p $START_DIR/modules/$MODULE_DIR/assets/images - cp $FNAME $START_DIR/modules/$MODULE_DIR/assets/images/ -done - -cd $START_DIR - -# Generate contract documentation. -mkdir -p $START_DIR/modules/contracts/pages -$START_DIR/ci/docgen.sh -find $START_DIR/docs -name "*.adoc" -exec cp '{}' $START_DIR/modules/contracts/pages/ \; - -# Initialize antora.yml -cat > $START_DIR/antora.yml << EOF -name: uma -title: UMA -version: master -nav: -EOF - -# This unintuitive command just grabs only the lines that look like: -# * some_dirname -# and turn them into lines that look like: -# - modules/some_dirname/nav.adoc -grep "^* " $START_DIR/documentation/map.txt | cut -c3- | sed 's/\(.*\)/ - modules\/\1\/nav.adoc/' >> $START_DIR/antora.yml - -cd $START_DIR/modules -# We have to exclude ROOT because it's treated differently. -for DIRNAME in $(find . -type d \( -name 'pages' -and ! -path '*/ROOT/*' \)); -do - CONTAINING_DIR=$(dirname "$DIRNAME") - node $START_DIR/scripts/gen-nav.js $START_DIR/documentation/map.txt $DIRNAME > $START_DIR/modules/$CONTAINING_DIR/nav.adoc -done - -touch $START_DIR/modules/ROOT/nav.adoc - -git clone https://github.com/UMAprotocol/docs_ui.git $START_DIR/documentation/ui -cd $START_DIR/documentation/ui -git checkout master -git pull -npm install -npm run bundle - -cd $START_DIR -$(npm bin)/antora playbook.yml - diff --git a/scripts/deploy_docs.sh b/scripts/deploy_docs.sh deleted file mode 100755 index 95034fefb1..0000000000 --- a/scripts/deploy_docs.sh +++ /dev/null @@ -1,39 +0,0 @@ -#!/usr/bin/env bash -set -e - -# Usage: -# ./scripts/deploy_dapp.sh - -# Note: you must have the gcloud CLI tool installed and authenticated before using this script. -# Note: you must also have pandoc installed before running. - -# Get the absolute path of a file. -# Credit: https://stackoverflow.com/a/21188136 -get_abs_filename() { - # $1 : relative filename - echo "$(cd "$(dirname "$1")" && pwd)/$(basename "$1")" -} - -# Grab the absolute path for the provided file. -APP_YAML_PATH=$(get_abs_filename $1) - -# Shift the arguments to provide to gcloud app deploy. -shift - -# Build the docs site. -echo "Building docs site locally." -npx lerna bootstrap -./scripts/build_docs_site.sh - -# Prepare for gcloud deploy. -echo "Moving files." -rm -rf build/docs -mkdir -p build/docs -cp -R build/site build/docs/www -cp $APP_YAML_PATH build/docs/ -cd build/docs - -# Deploy. -echo "Deploying." -gcloud app deploy gae_app.yaml "$@" - diff --git a/yarn.lock b/yarn.lock index e23758f002..1982378a39 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3765,72 +3765,6 @@ node-gyp "^7.1.0" read-package-json-fast "^2.0.1" -"@oclif/command@^1.5.20", "@oclif/command@^1.8.0": - version "1.8.0" - resolved "https://registry.yarnpkg.com/@oclif/command/-/command-1.8.0.tgz#c1a499b10d26e9d1a611190a81005589accbb339" - integrity sha512-5vwpq6kbvwkQwKqAoOU3L72GZ3Ta8RRrewKj9OJRolx28KLJJ8Dg9Rf7obRwt5jQA9bkYd8gqzMTrI7H3xLfaw== - dependencies: - "@oclif/config" "^1.15.1" - "@oclif/errors" "^1.3.3" - "@oclif/parser" "^3.8.3" - "@oclif/plugin-help" "^3" - debug "^4.1.1" - semver "^7.3.2" - -"@oclif/config@^1.15.1", "@oclif/config@^1.17.0": - version "1.17.0" - resolved "https://registry.yarnpkg.com/@oclif/config/-/config-1.17.0.tgz#ba8639118633102a7e481760c50054623d09fcab" - integrity sha512-Lmfuf6ubjQ4ifC/9bz1fSCHc6F6E653oyaRXxg+lgT4+bYf9bk+nqrUpAbrXyABkCqgIBiFr3J4zR/kiFdE1PA== - dependencies: - "@oclif/errors" "^1.3.3" - "@oclif/parser" "^3.8.0" - debug "^4.1.1" - globby "^11.0.1" - is-wsl "^2.1.1" - tslib "^2.0.0" - -"@oclif/errors@^1.2.2", "@oclif/errors@^1.3.3": - version "1.3.4" - resolved "https://registry.yarnpkg.com/@oclif/errors/-/errors-1.3.4.tgz#a96f94536b4e25caa72eff47e8b3ed04f6995f55" - integrity sha512-pJKXyEqwdfRTUdM8n5FIHiQQHg5ETM0Wlso8bF9GodczO40mF5Z3HufnYWJE7z8sGKxOeJCdbAVZbS8Y+d5GCw== - dependencies: - clean-stack "^3.0.0" - fs-extra "^8.1" - indent-string "^4.0.0" - strip-ansi "^6.0.0" - wrap-ansi "^7.0.0" - -"@oclif/linewrap@^1.0.0": - version "1.0.0" - resolved "https://registry.yarnpkg.com/@oclif/linewrap/-/linewrap-1.0.0.tgz#aedcb64b479d4db7be24196384897b5000901d91" - integrity sha512-Ups2dShK52xXa8w6iBWLgcjPJWjais6KPJQq3gQ/88AY6BXoTX+MIGFPrWQO1KLMiQfoTpcLnUwloN4brrVUHw== - -"@oclif/parser@^3.8.0", "@oclif/parser@^3.8.3": - version "3.8.5" - resolved "https://registry.yarnpkg.com/@oclif/parser/-/parser-3.8.5.tgz#c5161766a1efca7343e1f25d769efbefe09f639b" - integrity sha512-yojzeEfmSxjjkAvMRj0KzspXlMjCfBzNRPkWw8ZwOSoNWoJn+OCS/m/S+yfV6BvAM4u2lTzX9Y5rCbrFIgkJLg== - dependencies: - "@oclif/errors" "^1.2.2" - "@oclif/linewrap" "^1.0.0" - chalk "^2.4.2" - tslib "^1.9.3" - -"@oclif/plugin-help@^3", "@oclif/plugin-help@^3.2.0": - version "3.2.2" - resolved "https://registry.yarnpkg.com/@oclif/plugin-help/-/plugin-help-3.2.2.tgz#063ee08cee556573a5198fbdfdaa32796deba0ed" - integrity sha512-SPZ8U8PBYK0n4srFjCLedk0jWU4QlxgEYLCXIBShJgOwPhTTQknkUlsEwaMIevvCU4iCQZhfMX+D8Pz5GZjFgA== - dependencies: - "@oclif/command" "^1.5.20" - "@oclif/config" "^1.15.1" - "@oclif/errors" "^1.2.2" - chalk "^4.1.0" - indent-string "^4.0.0" - lodash.template "^4.4.0" - string-width "^4.2.0" - strip-ansi "^6.0.0" - widest-line "^3.1.0" - wrap-ansi "^4.0.0" - "@octokit/auth-token@^2.4.0": version "2.4.5" resolved "https://registry.yarnpkg.com/@octokit/auth-token/-/auth-token-2.4.5.tgz#568ccfb8cb46f36441fac094ce34f7a875b197f3" @@ -3985,10 +3919,10 @@ hex2dec "^1.0.1" uuid "^8.0.0" -"@openzeppelin/contracts@3.0.0": - version "3.0.0" - resolved "https://registry.yarnpkg.com/@openzeppelin/contracts/-/contracts-3.0.0.tgz#89bc0d32fc9eb257cf6499f2497a1b4a6715f186" - integrity sha512-u7oATjUK6jffDOoIjVQ7vJ2fnFKlfDS1CJzrMpp+YtGQ2fhdSk0kXjZTxk8Pj1SPVZRNES3yo0r144v8BsuRhQ== +"@openzeppelin/contracts@4.1.0": + version "4.1.0" + resolved "https://registry.yarnpkg.com/@openzeppelin/contracts/-/contracts-4.1.0.tgz#baec89a7f5f73e3d8ea582a78f1980134b605375" + integrity sha512-TihZitscnaHNcZgXGj9zDLDyCqjziytB4tMCwXq0XimfWkAjBYyk5/pOsDbbwcavhlc79HhpTEpQcrMnPVa1mw== "@protobufjs/aspromise@^1.1.1", "@protobufjs/aspromise@^1.1.2": version "1.1.2" @@ -5344,7 +5278,7 @@ "@truffle/contract" "^4.2.20" "@uma/common" "^1.0.1" -"@uma/core-1-2-0@npm:@uma/core@1.2.0", "@uma/core@npm:@uma/core@1.2.0": +"@uma/core-1-2-0@npm:@uma/core@1.2.0": version "1.2.0" resolved "https://registry.yarnpkg.com/@uma/core/-/core-1.2.0.tgz#7fce04924d28194090eecdf4087786f7bb56a755" integrity sha512-Etg5ZTDknuGnbgx9U3rZWLCW6aR3INwF/rx5qldtll8WBmWFyGiHTexHrP1fDECXRQ6dn4gzeK4FeDgWhiGvsA== @@ -5566,6 +5500,11 @@ "@uniswap/lib" "1.1.1" "@uniswap/v2-core" "1.0.0" +"@uniswap/v3-core@^1.0.0-rc.2": + version "1.0.0-rc.2" + resolved "https://registry.yarnpkg.com/@uniswap/v3-core/-/v3-core-1.0.0-rc.2.tgz#a1afb3253a7295bec6165ad1d960121e6851a576" + integrity sha512-vsqkqAHPCKsVi0nWwWeX+mHnSTJ8ZUdu1zAVXB9Mj9A+aeBQGV9foRKs9ufDGJq7S1nqmz+7FdjSOcVoeiUqgQ== + "@web3-js/scrypt-shim@^0.1.0": version "0.1.0" resolved "https://registry.yarnpkg.com/@web3-js/scrypt-shim/-/scrypt-shim-0.1.0.tgz#0bf7529ab6788311d3e07586f7d89107c3bea2cc" @@ -8622,13 +8561,6 @@ clean-stack@^2.0.0: resolved "https://registry.yarnpkg.com/clean-stack/-/clean-stack-2.2.0.tgz#ee8472dbb129e727b31e8a10a427dee9dfe4008b" integrity sha512-4diC9HaTE+KRAMWhDhrGOECgWZxoevMc5TlkObMqNSsVU62PYzXZ/SMTjzyGAFF1YusgxGcSWTEXBhp0CPwQ1A== -clean-stack@^3.0.0: - version "3.0.1" - resolved "https://registry.yarnpkg.com/clean-stack/-/clean-stack-3.0.1.tgz#155bf0b2221bf5f4fba89528d24c5953f17fe3a8" - integrity sha512-lR9wNiMRcVQjSB3a7xXGLuz4cr4wJuuXlaAEbRutGowQTmlp7R72/DOgN21e8jdwblMWl9UOJMJXarX94pzKdg== - dependencies: - escape-string-regexp "4.0.0" - cli-columns@^3.1.2: version "3.1.2" resolved "https://registry.yarnpkg.com/cli-columns/-/cli-columns-3.1.2.tgz#6732d972979efc2ae444a1f08e08fa139c96a18e" @@ -12856,7 +12788,7 @@ fs-extra@^4.0.2: jsonfile "^4.0.0" universalify "^0.1.0" -fs-extra@^8.1, fs-extra@^8.1.0, fs-extra@~8.1: +fs-extra@^8.1.0, fs-extra@~8.1: version "8.1.0" resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-8.1.0.tgz#49d43c45a88cd9677668cb7be1b46efdb8d2e1c0" integrity sha512-yhlQgA6mnOJUKOsRUFsgJdQCvkKhcz8tlZG5HBQfReYZy46OwLcY+Zia0mtdHsOo9y/hP+CxMN0TU9QxoOtG4g== @@ -13400,7 +13332,7 @@ globalyzer@^0.1.4: resolved "https://registry.yarnpkg.com/globalyzer/-/globalyzer-0.1.4.tgz#bc8e273afe1ac7c24eea8def5b802340c5cc534f" integrity sha512-LeguVWaxgHN0MNbWC6YljNMzHkrCny9fzjmEUdnF1kQ7wATFD1RHFRqA1qxaX2tgxGENlcxjOflopBwj3YZiXA== -globby@11.0.2, globby@^11.0.0, globby@^11.0.1: +globby@11.0.2, globby@^11.0.1: version "11.0.2" resolved "https://registry.yarnpkg.com/globby/-/globby-11.0.2.tgz#1af538b766a3b540ebfb58a32b2e2d5897321d83" integrity sha512-2ZThXDvvV8fYFRVIxnrMQBipZQDr7MxKAmQK1vujaj9/7eF0efG7BPUKJ7jP7G5SLF37xKDXvO4S/KKLj/Z0og== @@ -15125,11 +15057,6 @@ is-directory@^0.3.1: resolved "https://registry.yarnpkg.com/is-directory/-/is-directory-0.3.1.tgz#61339b6f2475fc772fd9c9d83f5c8575dc154ae1" integrity sha1-YTObbyR1/Hcv2cnYP1yFddwVSuE= -is-docker@^2.0.0: - version "2.1.1" - resolved "https://registry.yarnpkg.com/is-docker/-/is-docker-2.1.1.tgz#4125a88e44e450d384e09047ede71adc2d144156" - integrity sha512-ZOoqiXfEwtGknTiuDEy8pN2CfE3TxMHprvNer1mXiqwkOT77Rw3YVrUQ52EqAOU3QAWDQ+bQdx7HJzrv7LS2Hw== - is-dotfile@^1.0.0: version "1.0.3" resolved "https://registry.yarnpkg.com/is-dotfile/-/is-dotfile-1.0.3.tgz#a6a2f32ffd2dfb04f5ca25ecd0f6b83cf798a1e1" @@ -15541,13 +15468,6 @@ is-wsl@^1.1.0: resolved "https://registry.yarnpkg.com/is-wsl/-/is-wsl-1.1.0.tgz#1f16e4aa22b04d1336b66188a66af3c600c3a66d" integrity sha1-HxbkqiKwTRM2tmGIpmrzxgDDpm0= -is-wsl@^2.1.1: - version "2.2.0" - resolved "https://registry.yarnpkg.com/is-wsl/-/is-wsl-2.2.0.tgz#74a4c76e77ca9fd3f932f290c17ea326cd157271" - integrity sha512-fKzAra0rGJUUBwGBgNkHZuToZcn+TtXHpeCgmkMJMMYx1sQDYaCSyjJBSCa2nH1DGm7s3n1oBnohoVTBaN7Lww== - dependencies: - is-docker "^2.0.0" - is@^3.2.0, is@^3.3.0: version "3.3.0" resolved "https://registry.yarnpkg.com/is/-/is-3.3.0.tgz#61cff6dd3c4193db94a3d62582072b44e5645d79" @@ -16475,7 +16395,7 @@ json5@^1.0.1: dependencies: minimist "^1.2.0" -json5@^2.1.0, json5@^2.1.2, json5@^2.1.3: +json5@^2.1.0, json5@^2.1.2: version "2.2.0" resolved "https://registry.yarnpkg.com/json5/-/json5-2.2.0.tgz#2dfefe720c6ba525d9ebd909950f0515316c89a3" integrity sha512-f+8cldu7X/y7RAJurMEJmdoKXGB/X550w2Nr3tTbezL6RwEE/iMcm+tZnXeoZtKuOq6ft8+CqzEkrIgx1fPoQA== @@ -23952,10 +23872,10 @@ socks@~2.3.2: ip "1.1.5" smart-buffer "^4.1.0" -solc@0.7.3: - version "0.7.3" - resolved "https://registry.yarnpkg.com/solc/-/solc-0.7.3.tgz#04646961bd867a744f63d2b4e3c0701ffdc7d78a" - integrity sha512-GAsWNAjGzIDg7VxzP6mPjdurby3IkGCjQcM8GFYZT6RyaoUZKmMU6Y7YwG+tFGhv7dwZ8rmR4iwFDrrD99JwqA== +"solc-0.8@npm:solc@^0.8.4": + version "0.8.4" + resolved "https://registry.yarnpkg.com/solc/-/solc-0.8.4.tgz#c7e606e5fc07f3fe37414bc3dd868404399ea8bb" + integrity sha512-krEdbucX9yY362l79gXTK2UHhsZ02aQjQOYTzcgTd/waApueo3yWGzjX0CDJ1ByOuW46WuKAyzfbRWdFNr6OYQ== dependencies: command-exists "^1.2.8" commander "3.0.2" @@ -23967,13 +23887,14 @@ solc@0.7.3: semver "^5.5.0" tmp "0.0.33" -solc@^0.6.7: - version "0.6.12" - resolved "https://registry.yarnpkg.com/solc/-/solc-0.6.12.tgz#48ac854e0c729361b22a7483645077f58cba080e" - integrity sha512-Lm0Ql2G9Qc7yPP2Ba+WNmzw2jwsrd3u4PobHYlSOxaut3TtUbj9+5ZrT6f4DUpNPEoBaFUOEg9Op9C0mk7ge9g== +solc@0.7.3: + version "0.7.3" + resolved "https://registry.yarnpkg.com/solc/-/solc-0.7.3.tgz#04646961bd867a744f63d2b4e3c0701ffdc7d78a" + integrity sha512-GAsWNAjGzIDg7VxzP6mPjdurby3IkGCjQcM8GFYZT6RyaoUZKmMU6Y7YwG+tFGhv7dwZ8rmR4iwFDrrD99JwqA== dependencies: command-exists "^1.2.8" commander "3.0.2" + follow-redirects "^1.12.1" fs-extra "^0.30.0" js-sha3 "0.8.0" memorystream "^0.3.1" @@ -24011,24 +23932,6 @@ solidity-coverage@^0.7.13, solidity-coverage@^0.7.2: shelljs "^0.8.3" web3-utils "^1.3.0" -solidity-docgen@^0.5.3: - version "0.5.11" - resolved "https://registry.yarnpkg.com/solidity-docgen/-/solidity-docgen-0.5.11.tgz#96e03d9bd6cbf16b856e07d90f596af19ab7e447" - integrity sha512-yi1FAKd7obY7WwXc1DI9OSA7K55tPfPbz/SYsfEM5vcxl3CEhgMgEvjw6PapwyIpvz9H+ymEFsYwo0F1pHUDCg== - dependencies: - "@oclif/command" "^1.8.0" - "@oclif/config" "^1.17.0" - "@oclif/errors" "^1.3.3" - "@oclif/plugin-help" "^3.2.0" - globby "^11.0.0" - handlebars "^4.7.6" - json5 "^2.1.3" - lodash "^4.17.15" - micromatch "^4.0.2" - minimatch "^3.0.4" - semver "^7.3.2" - solc "^0.6.7" - sort-keys@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/sort-keys/-/sort-keys-2.0.0.tgz#658535584861ec97d730d6cf41822e1f56684128" @@ -24406,7 +24309,7 @@ string-width@^3.0.0, string-width@^3.1.0: is-fullwidth-code-point "^2.0.0" strip-ansi "^5.1.0" -string-width@^4.0.0, string-width@^4.1.0, string-width@^4.2.0: +string-width@^4.1.0, string-width@^4.2.0: version "4.2.2" resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.2.tgz#dafd4f9559a7585cfba529c6a0a4f73488ebd4c5" integrity sha512-XBJbT3N4JhVumXE0eoLU9DCjcaF92KLNqTmFCnG1pf8duUxFGwtP6AD6nkjw9a3IdiRtL3E2w3JDiE/xi3vOeA== @@ -25487,7 +25390,7 @@ tslib@^1.10.0, tslib@^1.14.1, tslib@^1.8.1, tslib@^1.9.0, tslib@^1.9.3: resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.14.1.tgz#cf2d38bdc34a134bcaf1091c41f6619e2f672d00" integrity sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg== -tslib@^2.0.0, tslib@^2.0.3, tslib@~2.1.0: +tslib@^2.0.3, tslib@~2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.1.0.tgz#da60860f1c2ecaa5703ab7d39bc05b6bf988b97a" integrity sha512-hcVC3wYEziELGGmEEXue7D75zbwIIVUMWAVbHItGPx0ziyXxrOMQx4rQEVEV45Ut/1IotuEvwqPopzIOkDMf0A== @@ -27553,13 +27456,6 @@ wide-align@1.1.3, wide-align@^1.1.0: dependencies: string-width "^1.0.2 || 2" -widest-line@^3.1.0: - version "3.1.0" - resolved "https://registry.yarnpkg.com/widest-line/-/widest-line-3.1.0.tgz#8292333bbf66cb45ff0de1603b136b7ae1496eca" - integrity sha512-NsmoXalsWVDMGupxZ5R08ka9flZjjiLvHVAWYOKtiKM8ujtZWr9cRffak+uSE48+Ob8ObalXpwyeUiyDD6QFgg== - dependencies: - string-width "^4.0.0" - window-size@^0.1.4: version "0.1.4" resolved "https://registry.yarnpkg.com/window-size/-/window-size-0.1.4.tgz#f8e1aa1ee5a53ec5bf151ffa09742a6ad7697876" @@ -27789,15 +27685,6 @@ wrap-ansi@^2.0.0: string-width "^1.0.1" strip-ansi "^3.0.1" -wrap-ansi@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-4.0.0.tgz#b3570d7c70156159a2d42be5cc942e957f7b1131" - integrity sha512-uMTsj9rDb0/7kk1PbcbCcwvHUxp60fGDB/NNXpVa0Q+ic/e7y5+BwTxKfQ33VYgDppSwi/FBzpetYzo8s6tfbg== - dependencies: - ansi-styles "^3.2.0" - string-width "^2.1.1" - strip-ansi "^4.0.0" - wrap-ansi@^5.1.0: version "5.1.0" resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-5.1.0.tgz#1fd1f67235d5b6d0fee781056001bfb694c03b09"