mirror of
https://github.com/vacp2p/swap-contracts-module.git
synced 2025-02-27 10:20:38 +00:00
Upgrade Swap contracts to Solidity 0.7
now -> block.timestamp
This commit is contained in:
parent
364f67971c
commit
de4589c0b6
@ -1,4 +1,4 @@
|
||||
pragma solidity =0.6.12;
|
||||
pragma solidity ^0.7.0;
|
||||
import "@openzeppelin/contracts/math/SafeMath.sol";
|
||||
import "@openzeppelin/contracts/math/Math.sol";
|
||||
import "@openzeppelin/contracts/cryptography/ECDSA.sol";
|
||||
@ -235,7 +235,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);
|
||||
}
|
||||
@ -246,7 +246,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);
|
||||
|
@ -1,4 +1,4 @@
|
||||
pragma solidity =0.6.12;
|
||||
pragma solidity ^0.7.0;
|
||||
import "./ERC20SimpleSwap.sol";
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user