aboutsummaryrefslogtreecommitdiffstats
path: root/packages/contracts/src/2.0.0/test
diff options
context:
space:
mode:
Diffstat (limited to 'packages/contracts/src/2.0.0/test')
-rw-r--r--packages/contracts/src/2.0.0/test/DummyERC20Token/DummyERC20Token.sol2
-rw-r--r--packages/contracts/src/2.0.0/test/DummyERC721Receiver/DummyERC721Receiver.sol2
-rw-r--r--packages/contracts/src/2.0.0/test/DummyERC721Token/DummyERC721Token.sol3
-rw-r--r--packages/contracts/src/2.0.0/test/ExchangeWrapper/ExchangeWrapper.sol62
-rw-r--r--packages/contracts/src/2.0.0/test/Mintable/Mintable.sol2
-rw-r--r--packages/contracts/src/2.0.0/test/TestAssetProxyDispatcher/TestAssetProxyDispatcher.sol2
-rw-r--r--packages/contracts/src/2.0.0/test/TestAssetProxyOwner/TestAssetProxyOwner.sol8
-rw-r--r--packages/contracts/src/2.0.0/test/TestLibBytes/TestLibBytes.sol2
-rw-r--r--packages/contracts/src/2.0.0/test/TestLibs/TestLibs.sol2
-rw-r--r--packages/contracts/src/2.0.0/test/TestSignatureValidator/TestSignatureValidator.sol2
-rw-r--r--packages/contracts/src/2.0.0/test/TestValidator/TestValidator.sol6
-rw-r--r--packages/contracts/src/2.0.0/test/TestWallet/TestWallet.sol8
-rw-r--r--packages/contracts/src/2.0.0/test/Whitelist/Whitelist.sol64
13 files changed, 83 insertions, 82 deletions
diff --git a/packages/contracts/src/2.0.0/test/DummyERC20Token/DummyERC20Token.sol b/packages/contracts/src/2.0.0/test/DummyERC20Token/DummyERC20Token.sol
index 7a2702449..44b0777b8 100644
--- a/packages/contracts/src/2.0.0/test/DummyERC20Token/DummyERC20Token.sol
+++ b/packages/contracts/src/2.0.0/test/DummyERC20Token/DummyERC20Token.sol
@@ -16,7 +16,7 @@
*/
-pragma solidity ^0.4.24;
+pragma solidity 0.4.24;
pragma experimental ABIEncoderV2;
import "../Mintable/Mintable.sol";
diff --git a/packages/contracts/src/2.0.0/test/DummyERC721Receiver/DummyERC721Receiver.sol b/packages/contracts/src/2.0.0/test/DummyERC721Receiver/DummyERC721Receiver.sol
index b027ac960..5dce74a14 100644
--- a/packages/contracts/src/2.0.0/test/DummyERC721Receiver/DummyERC721Receiver.sol
+++ b/packages/contracts/src/2.0.0/test/DummyERC721Receiver/DummyERC721Receiver.sol
@@ -23,7 +23,7 @@ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
-pragma solidity ^0.4.24;
+pragma solidity 0.4.24;
import "../../tokens/ERC721Token/IERC721Receiver.sol";
diff --git a/packages/contracts/src/2.0.0/test/DummyERC721Token/DummyERC721Token.sol b/packages/contracts/src/2.0.0/test/DummyERC721Token/DummyERC721Token.sol
index de76f10c5..ba647fea4 100644
--- a/packages/contracts/src/2.0.0/test/DummyERC721Token/DummyERC721Token.sol
+++ b/packages/contracts/src/2.0.0/test/DummyERC721Token/DummyERC721Token.sol
@@ -16,13 +16,14 @@
*/
-pragma solidity ^0.4.24;
+pragma solidity 0.4.24;
pragma experimental ABIEncoderV2;
import "../../tokens/ERC721Token/ERC721Token.sol";
import "../../utils/Ownable/Ownable.sol";
+// solhint-disable no-empty-blocks
contract DummyERC721Token is
Ownable,
ERC721Token
diff --git a/packages/contracts/src/2.0.0/test/ExchangeWrapper/ExchangeWrapper.sol b/packages/contracts/src/2.0.0/test/ExchangeWrapper/ExchangeWrapper.sol
index f20e2a944..2fa0e3c5e 100644
--- a/packages/contracts/src/2.0.0/test/ExchangeWrapper/ExchangeWrapper.sol
+++ b/packages/contracts/src/2.0.0/test/ExchangeWrapper/ExchangeWrapper.sol
@@ -16,7 +16,7 @@
*/
-pragma solidity ^0.4.24;
+pragma solidity 0.4.24;
pragma experimental ABIEncoderV2;
import "../../protocol/Exchange/interfaces/IExchange.sol";
@@ -27,7 +27,7 @@ contract ExchangeWrapper {
// Exchange contract.
// solhint-disable-next-line var-name-mixedcase
- IExchange EXCHANGE;
+ IExchange internal EXCHANGE;
constructor (address _exchange)
public
@@ -35,6 +35,35 @@ contract ExchangeWrapper {
EXCHANGE = IExchange(_exchange);
}
+ /// @dev Cancels all orders created by sender with a salt less than or equal to the targetOrderEpoch
+ /// and senderAddress equal to this contract.
+ /// @param targetOrderEpoch Orders created with a salt less or equal to this value will be cancelled.
+ /// @param salt Arbitrary value to gaurantee uniqueness of 0x transaction hash.
+ /// @param makerSignature Proof that maker wishes to call this function with given params.
+ function cancelOrdersUpTo(
+ uint256 targetOrderEpoch,
+ uint256 salt,
+ bytes makerSignature
+ )
+ external
+ {
+ address makerAddress = msg.sender;
+
+ // Encode arguments into byte array.
+ bytes memory data = abi.encodeWithSelector(
+ EXCHANGE.cancelOrdersUpTo.selector,
+ targetOrderEpoch
+ );
+
+ // Call `cancelOrdersUpTo` via `executeTransaction`.
+ EXCHANGE.executeTransaction(
+ salt,
+ makerAddress,
+ data,
+ makerSignature
+ );
+ }
+
/// @dev Fills an order using `msg.sender` as the taker.
/// @param order Order struct containing order specifications.
/// @param takerAssetFillAmount Desired amount of takerAsset to sell.
@@ -68,33 +97,4 @@ contract ExchangeWrapper {
takerSignature
);
}
-
- /// @dev Cancels all orders created by sender with a salt less than or equal to the targetOrderEpoch
- /// and senderAddress equal to this contract.
- /// @param targetOrderEpoch Orders created with a salt less or equal to this value will be cancelled.
- /// @param salt Arbitrary value to gaurantee uniqueness of 0x transaction hash.
- /// @param makerSignature Proof that maker wishes to call this function with given params.
- function cancelOrdersUpTo(
- uint256 targetOrderEpoch,
- uint256 salt,
- bytes makerSignature
- )
- external
- {
- address makerAddress = msg.sender;
-
- // Encode arguments into byte array.
- bytes memory data = abi.encodeWithSelector(
- EXCHANGE.cancelOrdersUpTo.selector,
- targetOrderEpoch
- );
-
- // Call `cancelOrdersUpTo` via `executeTransaction`.
- EXCHANGE.executeTransaction(
- salt,
- makerAddress,
- data,
- makerSignature
- );
- }
}
diff --git a/packages/contracts/src/2.0.0/test/Mintable/Mintable.sol b/packages/contracts/src/2.0.0/test/Mintable/Mintable.sol
index bccb74ce8..747ac7a86 100644
--- a/packages/contracts/src/2.0.0/test/Mintable/Mintable.sol
+++ b/packages/contracts/src/2.0.0/test/Mintable/Mintable.sol
@@ -16,7 +16,7 @@
*/
-pragma solidity ^0.4.24;
+pragma solidity 0.4.24;
pragma experimental ABIEncoderV2;
import "../../tokens/UnlimitedAllowanceToken/UnlimitedAllowanceToken.sol";
diff --git a/packages/contracts/src/2.0.0/test/TestAssetProxyDispatcher/TestAssetProxyDispatcher.sol b/packages/contracts/src/2.0.0/test/TestAssetProxyDispatcher/TestAssetProxyDispatcher.sol
index be7fea7d3..76f1c6290 100644
--- a/packages/contracts/src/2.0.0/test/TestAssetProxyDispatcher/TestAssetProxyDispatcher.sol
+++ b/packages/contracts/src/2.0.0/test/TestAssetProxyDispatcher/TestAssetProxyDispatcher.sol
@@ -16,7 +16,7 @@
*/
-pragma solidity ^0.4.24;
+pragma solidity 0.4.24;
pragma experimental ABIEncoderV2;
import "../../protocol/Exchange/MixinAssetProxyDispatcher.sol";
diff --git a/packages/contracts/src/2.0.0/test/TestAssetProxyOwner/TestAssetProxyOwner.sol b/packages/contracts/src/2.0.0/test/TestAssetProxyOwner/TestAssetProxyOwner.sol
index ddcc62f35..d6b6b29f2 100644
--- a/packages/contracts/src/2.0.0/test/TestAssetProxyOwner/TestAssetProxyOwner.sol
+++ b/packages/contracts/src/2.0.0/test/TestAssetProxyOwner/TestAssetProxyOwner.sol
@@ -16,14 +16,16 @@
*/
-pragma solidity ^0.4.24;
+pragma solidity 0.4.24;
import "../../protocol/AssetProxyOwner/AssetProxyOwner.sol";
+// solhint-disable no-empty-blocks
contract TestAssetProxyOwner is
AssetProxyOwner
{
+
constructor(
address[] memory _owners,
address[] memory _assetProxyContracts,
@@ -32,11 +34,11 @@ contract TestAssetProxyOwner is
)
public
AssetProxyOwner(_owners, _assetProxyContracts, _required, _secondsTimeLocked)
- {
- }
+ {}
function testValidRemoveAuthorizedAddressAtIndexTx(uint256 id)
public
+ view
validRemoveAuthorizedAddressAtIndexTx(id)
returns (bool)
{
diff --git a/packages/contracts/src/2.0.0/test/TestLibBytes/TestLibBytes.sol b/packages/contracts/src/2.0.0/test/TestLibBytes/TestLibBytes.sol
index f52f635e1..8b9c00590 100644
--- a/packages/contracts/src/2.0.0/test/TestLibBytes/TestLibBytes.sol
+++ b/packages/contracts/src/2.0.0/test/TestLibBytes/TestLibBytes.sol
@@ -16,7 +16,7 @@
*/
-pragma solidity ^0.4.24;
+pragma solidity 0.4.24;
pragma experimental ABIEncoderV2;
import "../../utils/LibBytes/LibBytes.sol";
diff --git a/packages/contracts/src/2.0.0/test/TestLibs/TestLibs.sol b/packages/contracts/src/2.0.0/test/TestLibs/TestLibs.sol
index df8eb55ce..40e2c84dc 100644
--- a/packages/contracts/src/2.0.0/test/TestLibs/TestLibs.sol
+++ b/packages/contracts/src/2.0.0/test/TestLibs/TestLibs.sol
@@ -16,7 +16,7 @@
*/
-pragma solidity ^0.4.24;
+pragma solidity 0.4.24;
pragma experimental ABIEncoderV2;
import "../../protocol/Exchange/libs/LibMath.sol";
diff --git a/packages/contracts/src/2.0.0/test/TestSignatureValidator/TestSignatureValidator.sol b/packages/contracts/src/2.0.0/test/TestSignatureValidator/TestSignatureValidator.sol
index 591ae3378..235c77d17 100644
--- a/packages/contracts/src/2.0.0/test/TestSignatureValidator/TestSignatureValidator.sol
+++ b/packages/contracts/src/2.0.0/test/TestSignatureValidator/TestSignatureValidator.sol
@@ -16,7 +16,7 @@
*/
-pragma solidity ^0.4.24;
+pragma solidity 0.4.24;
pragma experimental ABIEncoderV2;
import "../../protocol/Exchange/MixinSignatureValidator.sol";
diff --git a/packages/contracts/src/2.0.0/test/TestValidator/TestValidator.sol b/packages/contracts/src/2.0.0/test/TestValidator/TestValidator.sol
index 5076dedc9..6278aede0 100644
--- a/packages/contracts/src/2.0.0/test/TestValidator/TestValidator.sol
+++ b/packages/contracts/src/2.0.0/test/TestValidator/TestValidator.sol
@@ -16,7 +16,7 @@
*/
-pragma solidity ^0.4.24;
+pragma solidity 0.4.24;
import "../../protocol/Exchange/interfaces/IValidator.sol";
@@ -27,7 +27,7 @@ contract TestValidator is
// The single valid signer for this wallet.
// solhint-disable-next-line var-name-mixedcase
- address VALID_SIGNER;
+ address internal VALID_SIGNER;
/// @dev constructs a new `TestValidator` with a single valid signer.
/// @param validSigner The sole, valid signer.
@@ -40,6 +40,7 @@ contract TestValidator is
/// @param signerAddress Address that should have signed the given hash.
/// @param signature Proof of signing.
/// @return Validity of signature.
+ // solhint-disable no-unused-vars
function isValidSignature(
bytes32 hash,
address signerAddress,
@@ -51,4 +52,5 @@ contract TestValidator is
{
return (signerAddress == VALID_SIGNER);
}
+ // solhint-enable no-unused-vars
}
diff --git a/packages/contracts/src/2.0.0/test/TestWallet/TestWallet.sol b/packages/contracts/src/2.0.0/test/TestWallet/TestWallet.sol
index 07dfac588..0415823e3 100644
--- a/packages/contracts/src/2.0.0/test/TestWallet/TestWallet.sol
+++ b/packages/contracts/src/2.0.0/test/TestWallet/TestWallet.sol
@@ -16,7 +16,7 @@
*/
-pragma solidity ^0.4.24;
+pragma solidity 0.4.24;
import "../../protocol/Exchange/interfaces/IWallet.sol";
import "../../utils/LibBytes/LibBytes.sol";
@@ -27,11 +27,9 @@ contract TestWallet is
{
using LibBytes for bytes;
- string constant LENGTH_65_REQUIRED = "LENGTH_65_REQUIRED";
-
// The owner of this wallet.
// solhint-disable-next-line var-name-mixedcase
- address WALLET_OWNER;
+ address internal WALLET_OWNER;
/// @dev constructs a new `TestWallet` with a single owner.
/// @param walletOwner The owner of this wallet.
@@ -54,7 +52,7 @@ contract TestWallet is
{
require(
eip712Signature.length == 65,
- LENGTH_65_REQUIRED
+ "LENGTH_65_REQUIRED"
);
uint8 v = uint8(eip712Signature[0]);
diff --git a/packages/contracts/src/2.0.0/test/Whitelist/Whitelist.sol b/packages/contracts/src/2.0.0/test/Whitelist/Whitelist.sol
index 07bd7d531..60cac26ea 100644
--- a/packages/contracts/src/2.0.0/test/Whitelist/Whitelist.sol
+++ b/packages/contracts/src/2.0.0/test/Whitelist/Whitelist.sol
@@ -16,7 +16,7 @@
*/
-pragma solidity ^0.4.24;
+pragma solidity 0.4.24;
pragma experimental ABIEncoderV2;
import "../../protocol/Exchange/interfaces/IExchange.sol";
@@ -27,28 +27,22 @@ import "../../utils/Ownable/Ownable.sol";
contract Whitelist is
Ownable
{
- // Revert reasons
- string constant MAKER_NOT_WHITELISTED = "MAKER_NOT_WHITELISTED"; // Maker address not whitelisted.
- string constant TAKER_NOT_WHITELISTED = "TAKER_NOT_WHITELISTED"; // Taker address not whitelisted.
- string constant INVALID_SENDER = "INVALID_SENDER"; // Sender must equal transaction origin.
// Mapping of address => whitelist status.
mapping (address => bool) public isWhitelisted;
// Exchange contract.
- // solhint-disable-next-line var-name-mixedcase
- IExchange EXCHANGE;
+ // solhint-disable var-name-mixedcase
+ IExchange internal EXCHANGE;
+ bytes internal TX_ORIGIN_SIGNATURE;
+ // solhint-enable var-name-mixedcase
- byte constant VALIDATOR_SIGNATURE_BYTE = "\x06";
- // solhint-disable-next-line var-name-mixedcase
- bytes TX_ORIGIN_SIGNATURE;
+ byte constant internal VALIDATOR_SIGNATURE_BYTE = "\x06";
constructor (address _exchange)
public
{
- // solhint-disable-next-line var-name-mixedcase
EXCHANGE = IExchange(_exchange);
- // solhint-disable-next-line var-name-mixedcase
TX_ORIGIN_SIGNATURE = abi.encodePacked(address(this), VALIDATOR_SIGNATURE_BYTE);
}
@@ -65,6 +59,27 @@ contract Whitelist is
isWhitelisted[target] = isApproved;
}
+ /// @dev Verifies signer is same as signer of current Ethereum transaction.
+ /// NOTE: This function can currently be used to validate signatures coming from outside of this contract.
+ /// Extra safety checks can be added for a production contract.
+ /// @param signerAddress Address that should have signed the given hash.
+ /// @param signature Proof of signing.
+ /// @return Validity of order signature.
+ // solhint-disable no-unused-vars
+ function isValidSignature(
+ bytes32 hash,
+ address signerAddress,
+ bytes signature
+ )
+ external
+ view
+ returns (bool isValid)
+ {
+ // solhint-disable-next-line avoid-tx-origin
+ return signerAddress == tx.origin;
+ }
+ // solhint-enable no-unused-vars
+
/// @dev Fills an order using `msg.sender` as the taker.
/// The transaction will revert if both the maker and taker are not whitelisted.
/// Orders should specify this contract as the `senderAddress` in order to gaurantee
@@ -85,20 +100,21 @@ contract Whitelist is
// This contract must be the entry point for the transaction.
require(
+ // solhint-disable-next-line avoid-tx-origin
takerAddress == tx.origin,
- INVALID_SENDER
+ "INVALID_SENDER"
);
// Check if maker is on the whitelist.
require(
isWhitelisted[order.makerAddress],
- MAKER_NOT_WHITELISTED
+ "MAKER_NOT_WHITELISTED"
);
// Check if taker is on the whitelist.
require(
isWhitelisted[takerAddress],
- TAKER_NOT_WHITELISTED
+ "TAKER_NOT_WHITELISTED"
);
// Encode arguments into byte array.
@@ -117,22 +133,4 @@ contract Whitelist is
TX_ORIGIN_SIGNATURE
);
}
-
- /// @dev Verifies signer is same as signer of current Ethereum transaction.
- /// NOTE: This function can currently be used to validate signatures coming from outside of this contract.
- /// Extra safety checks can be added for a production contract.
- /// @param signerAddress Address that should have signed the given hash.
- /// @param signature Proof of signing.
- /// @return Validity of order signature.
- function isValidSignature(
- bytes32 hash,
- address signerAddress,
- bytes signature
- )
- external
- view
- returns (bool isValid)
- {
- return signerAddress == tx.origin;
- }
}