Skip to content

Commit

Permalink
upgrade to solidity 0.7.6 (#123)
Browse files Browse the repository at this point in the history
  • Loading branch information
ralph-pichler authored Mar 26, 2021
1 parent d515641 commit 0f0ef46
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 10 deletions.
6 changes: 3 additions & 3 deletions contracts/ERC20SimpleSwap.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: BSD-3-Clause
pragma solidity =0.6.12;
pragma solidity =0.7.6;
import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/math/Math.sol";
import "@openzeppelin/contracts/cryptography/ECDSA.sol";
Expand Down Expand Up @@ -241,7 +241,7 @@ contract ERC20SimpleSwap {
require(decreaseAmount <= hardDeposit.amount, "SimpleSwap: hard deposit not sufficient");
// if hardDeposit.timeout was never set, apply defaultHardDepositTimeout
uint timeout = hardDeposit.timeout == 0 ? defaultHardDepositTimeout : hardDeposit.timeout;
hardDeposit.canBeDecreasedAt = now + timeout;
hardDeposit.canBeDecreasedAt = block.timestamp + timeout;
hardDeposit.decreaseAmount = decreaseAmount;
emit HardDepositDecreasePrepared(beneficiary, decreaseAmount);
}
Expand All @@ -252,7 +252,7 @@ contract ERC20SimpleSwap {
*/
function decreaseHardDeposit(address beneficiary) public {
HardDeposit storage hardDeposit = hardDeposits[beneficiary];
require(now >= hardDeposit.canBeDecreasedAt && hardDeposit.canBeDecreasedAt != 0, "SimpleSwap: deposit not yet timed out");
require(block.timestamp >= hardDeposit.canBeDecreasedAt && hardDeposit.canBeDecreasedAt != 0, "SimpleSwap: deposit not yet timed out");
/* this throws if decreaseAmount > amount */
//TODO: if there is a cash-out in between prepareDecreaseHardDeposit and decreaseHardDeposit, decreaseHardDeposit will throw and reducing hard-deposits is impossible.
hardDeposit.amount = hardDeposit.amount.sub(hardDeposit.decreaseAmount);
Expand Down
4 changes: 2 additions & 2 deletions contracts/SimpleSwapFactory.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: BSD-3-Clause
pragma solidity =0.6.12;
pragma solidity =0.7.6;
import "./ERC20SimpleSwap.sol";
import "@openzeppelin/contracts/proxy/Clones.sol";

Expand All @@ -21,7 +21,7 @@ contract SimpleSwapFactory {
/* address of the code contract from which all chequebooks are cloned */
address public master;

constructor(address _ERC20Address) public {
constructor(address _ERC20Address) {
ERC20Address = _ERC20Address;
ERC20SimpleSwap _master = new ERC20SimpleSwap();
// set the issuer of the master contract to prevent misuse
Expand Down
4 changes: 2 additions & 2 deletions contracts/TestToken.sol
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
// SPDX-License-Identifier: BSD-3-Clause
pragma solidity ^0.6.12;
pragma solidity =0.7.6;

import "@openzeppelin/contracts/presets/ERC20PresetMinterPauser.sol";

contract TestToken is ERC20PresetMinterPauser {

constructor() ERC20PresetMinterPauser("Test", "TST") public {
constructor() ERC20PresetMinterPauser("Test", "TST") {
}

}
2 changes: 1 addition & 1 deletion hardhat.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const accounts = { mnemonic };

// Config for hardhat.
module.exports = {
solidity: { version: '0.6.12' },
solidity: { version: '0.7.6' },
networks: {
hardhat: {
accounts,
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"url": "https://github.com/ethersphere/swap-swear-and-swindle.git"
},
"dependencies": {
"@openzeppelin/contracts": "^3.4.1"
"@openzeppelin/contracts": "^3.4.1-solc-0.7-2"
},
"devDependencies": {
"@nomiclabs/hardhat-truffle5": "^2.0.0",
Expand Down
2 changes: 1 addition & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@
find-up "^4.1.0"
fs-extra "^8.1.0"

"@openzeppelin/contracts@^3.4.1":
"@openzeppelin/contracts@^3.4.1-solc-0.7-2":
version "3.4.1"
resolved "https://registry.yarnpkg.com/@openzeppelin/contracts/-/contracts-3.4.1.tgz#03c891fec7f93be0ae44ed74e57a122a38732ce7"
integrity sha512-cUriqMauq1ylzP2TxePNdPqkwI7Le3Annh4K9rrpvKfSBB/bdW+Iu1ihBaTIABTAAJ85LmKL5SSPPL9ry8d1gQ==
Expand Down

0 comments on commit 0f0ef46

Please # to comment.