Skip to content

Commit

Permalink
carbon vortex - minor fix
Browse files Browse the repository at this point in the history
  • Loading branch information
ivanzhelyazkov committed Jul 18, 2024
1 parent 401eca5 commit e88ab7d
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions contracts/vortex/CarbonVortex.sol
Original file line number Diff line number Diff line change
Expand Up @@ -679,10 +679,6 @@ contract CarbonVortex is ICarbonVortex, Upgradeable, ReentrancyGuardUpgradeable,
if (sourceAmount == 0) {
revert InvalidTrade();
}
// revert if unnecessary native token is received
if (_finalTargetToken != NATIVE_TOKEN && msg.value > 0) {
revert UnnecessaryNativeTokenReceived();
}

// check enough final target token (if final target token is native) has been sent for the trade
if (_finalTargetToken == NATIVE_TOKEN) {
Expand All @@ -691,6 +687,10 @@ contract CarbonVortex is ICarbonVortex, Upgradeable, ReentrancyGuardUpgradeable,
}
payable(_transferAddress).sendValue(sourceAmount);
} else {
// revert if unnecessary native token is received
if (msg.value > 0) {
revert UnnecessaryNativeTokenReceived();
}
// transfer the tokens from the user to the _transferAddress
_finalTargetToken.safeTransferFrom(msg.sender, _transferAddress, sourceAmount);
}
Expand Down

0 comments on commit e88ab7d

Please sign in to comment.