Skip to content

Commit 1c0a71a

Browse files
author
yakuhito
committed
change patable(...).send to call
1 parent 6e063fa commit 1c0a71a

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

contracts/yakuSwap.sol

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,8 @@ contract yakuSwap is Ownable {
6262
require(swap.secretHash == sha256(abi.encodePacked(_secret)));
6363

6464
swap.status = SwapStatus.Completed;
65-
if(!payable(swap.toAddress).send(swap.amount)) {
65+
(bool success,) = swap.toAddress.call{value: swap.amount}("");
66+
if(!success) {
6667
swap.status = SwapStatus.Created;
6768
}
6869
}
@@ -74,15 +75,17 @@ contract yakuSwap is Ownable {
7475
require(block.number >= swap.startBlock + swap.maxBlockHeight);
7576

7677
swap.status = SwapStatus.Cancelled;
77-
if(!payable(swap.fromAddress).send(swap.amount)) {
78+
(bool success,) = swap.fromAddress.call{value: swap.amount}("");
79+
if(!success) {
7880
swap.status = SwapStatus.Created;
7981
}
8082
}
8183

8284
function getFees() public onlyOwner {
8385
uint oldTotalFees = totalFees;
8486
totalFees = 0;
85-
if(!payable(owner()).send(totalFees)) {
87+
(bool success,) = owner().call{value: totalFees}("");
88+
if(!success) {
8689
totalFees = oldTotalFees;
8790
}
8891
}

0 commit comments

Comments
 (0)