Skip to content

Commit

Permalink
Fix sendToken functionality for sending ETH
Browse files Browse the repository at this point in the history
  • Loading branch information
fenris85 committed Aug 2, 2023
1 parent 3ca95f9 commit 79e145e
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions packages/dma-contracts/contracts/actions/common/SendToken.sol
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,17 @@ contract SendToken is Executable, UseStore {
function execute(bytes calldata data, uint8[] memory paramsMap) external payable override {
SendTokenData memory send = parseInputs(data);
send.amount = store().readUint(bytes32(send.amount), paramsMap[2], address(this));

if (msg.value > 0) {
payable(send.to).transfer(msg.value);
} else {

if (send.asset != ETH) {
if (send.amount == type(uint256).max) {
send.amount = IERC20(send.asset).balanceOf(address(this));
}
IERC20(send.asset).safeTransfer(send.to, send.amount);
} else {
if (send.amount == type(uint256).max) {
send.amount = address(this).balance;
}
payable(send.to).transfer(send.amount);
}
}

Expand Down

0 comments on commit 79e145e

Please sign in to comment.