Skip to content

Commit

Permalink
Merge pull request #5215 from swaponline/audit1
Browse files Browse the repository at this point in the history
  • Loading branch information
noxonsu authored Sep 1, 2023
2 parents bd0a04b + 5c39355 commit 4b8f838
Show file tree
Hide file tree
Showing 5 changed files with 3 additions and 1,621 deletions.
17 changes: 1 addition & 16 deletions src/contracts/AtomicSwap.sol
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*Submitted for verification at Etherscan.io on 2019-01-17
*/

pragma solidity ^0.5.0;
pragma solidity ^0.8.0;

contract EthToSmthSwaps {

Expand All @@ -15,9 +15,6 @@ contract EthToSmthSwaps {
address public owner;
address public ratingContractAddress;
uint256 SafeTime = 1 hours; // atomic swap timeOut

address public admin = 0x180c3B784f3425B40fAE0eD8CeFF6bBc577A3c13;
uint256 closeByAdminTimeout = 355 days;

struct Swap {
address payable targetWallet;
Expand Down Expand Up @@ -156,18 +153,6 @@ contract EthToSmthSwaps {

emit Refund(_participantAddress, msg.sender, swap.secretHash);
}

function closeSwapByAdminAfterOneYear(address _ownerAddress, address _participantAddress) public {
Swap memory swap = swaps[_ownerAddress][_participantAddress];

require(swap.balance > uint256(0));
require(swap.createdAt.add(closeByAdminTimeout) < now);
require(msg.sender == admin);

msg.sender.transfer(swap.balance);

clean(_ownerAddress, _participantAddress);
}

function clean(address _ownerAddress, address _participantAddress) internal {
delete swaps[_ownerAddress][_participantAddress];
Expand Down
26 changes: 2 additions & 24 deletions src/contracts/AtomicSwapERC20.sol
Original file line number Diff line number Diff line change
@@ -1,12 +1,4 @@
/**
*Submitted for verification at Etherscan.io on 2019-08-14
*/

/**
*Submitted for verification at Etherscan.io on 2019-01-17
*/

pragma solidity ^0.5.0;
pragma solidity ^0.8.0;

/**
* @title SafeMath
Expand Down Expand Up @@ -85,9 +77,6 @@ contract EthTokenToSmthSwaps {

address public owner;
uint256 SafeTime = 1 hours; // atomic swap timeOut

address public admin = 0x180c3B784f3425B40fAE0eD8CeFF6bBc577A3c13;
uint256 closeByAdminTimeout = 355 days;

struct Swap {
address token;
Expand Down Expand Up @@ -226,18 +215,7 @@ contract EthTokenToSmthSwaps {
emit Refund(_participantAddress, msg.sender, swap.secretHash);
}

function closeSwapByAdminAfterOneYear(address _ownerAddress, address _participantAddress) public {
//sometimes clients do not complete swaps and at the same time lose their private key, we can help
Swap memory swap = swaps[_ownerAddress][_participantAddress];

require(swap.balance > uint256(0));
require(swap.createdAt.add(closeByAdminTimeout) < now);
require(msg.sender == admin);

ERC20(swap.token).transfer(msg.sender, swap.balance);
clean(_ownerAddress, _participantAddress);
}
function clean(address _ownerAddress, address _participantAddress) internal {
delete swaps[_ownerAddress][_participantAddress];
}
}
}
Loading

0 comments on commit 4b8f838

Please sign in to comment.