mirror of
https://github.com/luxfi/uma.git
synced 2026-07-26 21:09:10 +00:00
feat(core): updated solidity version to 0.8.x (#2924)
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -13,7 +13,6 @@ coverage
|
||||
coverage.json
|
||||
out.log
|
||||
.GckmsOverride.js
|
||||
docs
|
||||
modules
|
||||
public
|
||||
ui
|
||||
|
||||
@@ -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
|
||||
+1
-1
@@ -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"
|
||||
},
|
||||
|
||||
@@ -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")
|
||||
|
||||
@@ -197,7 +197,7 @@ function getTruffleConfig(truffleContextDir = "./") {
|
||||
},
|
||||
compilers: {
|
||||
solc: {
|
||||
version: "0.6.12",
|
||||
version: "0.8.4",
|
||||
settings: {
|
||||
optimizer: {
|
||||
enabled: true,
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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";
|
||||
|
||||
|
||||
@@ -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";
|
||||
|
||||
@@ -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";
|
||||
|
||||
|
||||
@@ -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";
|
||||
|
||||
@@ -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++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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";
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
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);
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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";
|
||||
|
||||
|
||||
@@ -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";
|
||||
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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";
|
||||
|
||||
|
||||
@@ -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";
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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";
|
||||
|
||||
|
||||
@@ -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 <mike@makerdao.com>
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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";
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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";
|
||||
|
||||
|
||||
@@ -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";
|
||||
|
||||
|
||||
@@ -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";
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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";
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
// 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;
|
||||
}
|
||||
|
||||
+5
-2
@@ -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;
|
||||
|
||||
/**
|
||||
|
||||
+3
-2
@@ -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 {
|
||||
|
||||
+3
-2
@@ -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";
|
||||
|
||||
|
||||
+3
-2
@@ -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";
|
||||
|
||||
|
||||
+3
-2
@@ -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";
|
||||
|
||||
|
||||
+5
-2
@@ -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;
|
||||
|
||||
/**
|
||||
|
||||
@@ -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;
|
||||
|
||||
+2
-3
@@ -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.
|
||||
{
|
||||
|
||||
+4
-4
@@ -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
|
||||
|
||||
+2
-2
@@ -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";
|
||||
|
||||
|
||||
@@ -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,
|
||||
|
||||
+5
-5
@@ -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));
|
||||
|
||||
|
||||
@@ -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() {
|
||||
|
||||
+2
-2
@@ -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";
|
||||
|
||||
|
||||
@@ -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.
|
||||
{
|
||||
|
||||
+3
-3
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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";
|
||||
|
||||
|
||||
+5
-5
@@ -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,
|
||||
|
||||
+4
-5
@@ -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,
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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";
|
||||
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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));
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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";
|
||||
|
||||
@@ -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";
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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";
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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));
|
||||
|
||||
@@ -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";
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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");
|
||||
|
||||
@@ -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";
|
||||
|
||||
/**
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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";
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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";
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user