aboutsummaryrefslogtreecommitdiffstats
path: root/packages/contracts/src/2.0.0
diff options
context:
space:
mode:
authorAmir Bandeali <abandeali1@gmail.com>2018-08-10 04:17:25 +0800
committerAmir Bandeali <abandeali1@gmail.com>2018-08-10 05:07:27 +0800
commit1b5c5e7a3ba17ca72ea700cd2a1884130e13fc98 (patch)
tree9c7a18ff6016343f0371d3700badd944d62bc343 /packages/contracts/src/2.0.0
parentb9d8d2d5e3e7aa5f14ae2fd2019460890497bb7e (diff)
downloaddexon-sol-tools-1b5c5e7a3ba17ca72ea700cd2a1884130e13fc98.tar
dexon-sol-tools-1b5c5e7a3ba17ca72ea700cd2a1884130e13fc98.tar.gz
dexon-sol-tools-1b5c5e7a3ba17ca72ea700cd2a1884130e13fc98.tar.bz2
dexon-sol-tools-1b5c5e7a3ba17ca72ea700cd2a1884130e13fc98.tar.lz
dexon-sol-tools-1b5c5e7a3ba17ca72ea700cd2a1884130e13fc98.tar.xz
dexon-sol-tools-1b5c5e7a3ba17ca72ea700cd2a1884130e13fc98.tar.zst
dexon-sol-tools-1b5c5e7a3ba17ca72ea700cd2a1884130e13fc98.zip
Change withdrawERC20 => withdrawAsset, reuse transfer logic
Diffstat (limited to 'packages/contracts/src/2.0.0')
-rw-r--r--packages/contracts/src/2.0.0/forwarder/MixinAssets.sol17
-rw-r--r--packages/contracts/src/2.0.0/forwarder/MixinForwarderCore.sol4
-rw-r--r--packages/contracts/src/2.0.0/forwarder/interfaces/IAssets.sol10
-rw-r--r--packages/contracts/src/2.0.0/forwarder/mixins/MAssets.sol2
4 files changed, 15 insertions, 18 deletions
diff --git a/packages/contracts/src/2.0.0/forwarder/MixinAssets.sol b/packages/contracts/src/2.0.0/forwarder/MixinAssets.sol
index 5cf5f831b..e06f9a8e3 100644
--- a/packages/contracts/src/2.0.0/forwarder/MixinAssets.sol
+++ b/packages/contracts/src/2.0.0/forwarder/MixinAssets.sol
@@ -36,28 +36,25 @@ contract MixinAssets is
bytes4 constant internal ERC20_TRANSFER_SELECTOR = bytes4(keccak256("transfer(address,uint256)"));
- /// @dev Withdraws ERC20 tokens from this contract. The contract requires a ZRX balance in order to
+ /// @dev Withdraws assets from this contract. The contract requires a ZRX balance in order to
/// function optimally, and this function allows the ZRX to be withdrawn by owner. It may also be
- /// used to withdraw tokens that were accidentally sent to this contract.
- /// @param token Address of ERC20 token to withdraw.
+ /// used to withdraw assets that were accidentally sent to this contract.
+ /// @param assetData Byte array encoded for the respective asset proxy.
/// @param amount Amount of ERC20 token to withdraw.
- function withdrawERC20(
- address token,
+ function withdrawAsset(
+ bytes assetData,
uint256 amount
)
external
onlyOwner
{
- require(
- IERC20Token(token).transfer(msg.sender, amount),
- "WITHDRAWAL_FAILED"
- );
+ transferAssetToSender(assetData, amount);
}
/// @dev Transfers given amount of asset to sender.
/// @param assetData Byte array encoded for the respective asset proxy.
/// @param amount Amount of asset to transfer to sender.
- function transferPurchasedAssetToSender(
+ function transferAssetToSender(
bytes memory assetData,
uint256 amount
)
diff --git a/packages/contracts/src/2.0.0/forwarder/MixinForwarderCore.sol b/packages/contracts/src/2.0.0/forwarder/MixinForwarderCore.sol
index 0d313ea91..93cbf79be 100644
--- a/packages/contracts/src/2.0.0/forwarder/MixinForwarderCore.sol
+++ b/packages/contracts/src/2.0.0/forwarder/MixinForwarderCore.sol
@@ -135,7 +135,7 @@ contract MixinForwarderCore is
);
// Transfer purchased assets to msg.sender.
- transferPurchasedAssetToSender(orders[0].makerAssetData, makerAssetAmountPurchased);
+ transferAssetToSender(orders[0].makerAssetData, makerAssetAmountPurchased);
}
/// @dev Attempt to purchase makerAssetFillAmount of makerAsset by selling ETH provided with transaction.
@@ -208,6 +208,6 @@ contract MixinForwarderCore is
);
// Transfer purchased assets to msg.sender.
- transferPurchasedAssetToSender(orders[0].makerAssetData, makerAssetAmountPurchased);
+ transferAssetToSender(orders[0].makerAssetData, makerAssetAmountPurchased);
}
}
diff --git a/packages/contracts/src/2.0.0/forwarder/interfaces/IAssets.sol b/packages/contracts/src/2.0.0/forwarder/interfaces/IAssets.sol
index 9b0d995eb..1e034c003 100644
--- a/packages/contracts/src/2.0.0/forwarder/interfaces/IAssets.sol
+++ b/packages/contracts/src/2.0.0/forwarder/interfaces/IAssets.sol
@@ -21,13 +21,13 @@ pragma solidity 0.4.24;
contract IAssets {
- /// @dev Withdraws ERC20 tokens from this contract. The contract requires a ZRX balance in order to
+ /// @dev Withdraws assets from this contract. The contract requires a ZRX balance in order to
/// function optimally, and this function allows the ZRX to be withdrawn by owner. It may also be
- /// used to withdraw tokens that were accidentally sent to this contract.
- /// @param token Address of ERC20 token to withdraw.
+ /// used to withdraw assets that were accidentally sent to this contract.
+ /// @param assetData Byte array encoded for the respective asset proxy.
/// @param amount Amount of ERC20 token to withdraw.
- function withdrawERC20(
- address token,
+ function withdrawAsset(
+ bytes assetData,
uint256 amount
)
external;
diff --git a/packages/contracts/src/2.0.0/forwarder/mixins/MAssets.sol b/packages/contracts/src/2.0.0/forwarder/mixins/MAssets.sol
index 340ee0bcb..83636432a 100644
--- a/packages/contracts/src/2.0.0/forwarder/mixins/MAssets.sol
+++ b/packages/contracts/src/2.0.0/forwarder/mixins/MAssets.sol
@@ -28,7 +28,7 @@ contract MAssets is
/// @dev Transfers given amount of asset to sender.
/// @param assetData Byte array encoded for the respective asset proxy.
/// @param amount Amount of asset to transfer to sender.
- function transferPurchasedAssetToSender(
+ function transferAssetToSender(
bytes memory assetData,
uint256 amount
)