diff --git a/packages/dma-contracts/contracts/actions/common/SendToken.sol b/packages/dma-contracts/contracts/actions/common/SendToken.sol index 498367cb4..18ea632fb 100644 --- a/packages/dma-contracts/contracts/actions/common/SendToken.sol +++ b/packages/dma-contracts/contracts/actions/common/SendToken.sol @@ -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); } }