From 18464cb3811c94553dab7bcbe223359d344fbce8 Mon Sep 17 00:00:00 2001 From: decanus Date: Mon, 23 Apr 2018 12:26:34 +0200 Subject: [PATCH 01/10] updated version, changed constructors. Will need revert reasons --- contracts/Exchange.sol | 4 ++-- contracts/ExchangeInterface.sol | 2 +- contracts/Libraries/OrderLibrary.sol | 2 +- contracts/Libraries/SafeMath.sol | 2 +- contracts/Libraries/SignatureValidator.sol | 2 +- contracts/Ownership/Ownable.sol | 2 +- contracts/Tokens/ERC20.sol | 2 +- contracts/Tokens/ERC777.sol | 2 +- contracts/Vault/Vault.sol | 2 +- contracts/Vault/VaultInterface.sol | 2 +- 10 files changed, 11 insertions(+), 11 deletions(-) diff --git a/contracts/Exchange.sol b/contracts/Exchange.sol index ee833c5..766d283 100644 --- a/contracts/Exchange.sol +++ b/contracts/Exchange.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.4.21; +pragma solidity ^0.4.23; import "./ExchangeInterface.sol"; import "./Libraries/SafeMath.sol"; @@ -26,7 +26,7 @@ contract Exchange is Ownable, ExchangeInterface { mapping (bytes32 => uint) private fills; mapping (bytes32 => bool) private cancelled; - function Exchange(uint _takerFee, address _feeAccount, VaultInterface _vault) public { + constructor(uint _takerFee, address _feeAccount, VaultInterface _vault) public { require(address(_vault) != 0x0); setFees(_takerFee); setFeeAccount(_feeAccount); diff --git a/contracts/ExchangeInterface.sol b/contracts/ExchangeInterface.sol index 703d1ca..99fb072 100644 --- a/contracts/ExchangeInterface.sol +++ b/contracts/ExchangeInterface.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.4.21; +pragma solidity ^0.4.23; import "./Vault/VaultInterface.sol"; diff --git a/contracts/Libraries/OrderLibrary.sol b/contracts/Libraries/OrderLibrary.sol index 4650a9c..9b583f5 100644 --- a/contracts/Libraries/OrderLibrary.sol +++ b/contracts/Libraries/OrderLibrary.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.4.21; +pragma solidity ^0.4.23; library OrderLibrary { diff --git a/contracts/Libraries/SafeMath.sol b/contracts/Libraries/SafeMath.sol index 9f46269..8dcd439 100644 --- a/contracts/Libraries/SafeMath.sol +++ b/contracts/Libraries/SafeMath.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.4.21; +pragma solidity ^0.4.23; library SafeMath { diff --git a/contracts/Libraries/SignatureValidator.sol b/contracts/Libraries/SignatureValidator.sol index 774edd9..0182db3 100644 --- a/contracts/Libraries/SignatureValidator.sol +++ b/contracts/Libraries/SignatureValidator.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.4.18; +pragma solidity ^0.4.23; library SignatureValidator { diff --git a/contracts/Ownership/Ownable.sol b/contracts/Ownership/Ownable.sol index 38df788..79c76d0 100644 --- a/contracts/Ownership/Ownable.sol +++ b/contracts/Ownership/Ownable.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.4.21; +pragma solidity ^0.4.23; contract Ownable { diff --git a/contracts/Tokens/ERC20.sol b/contracts/Tokens/ERC20.sol index 4d31858..26edf70 100644 --- a/contracts/Tokens/ERC20.sol +++ b/contracts/Tokens/ERC20.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.4.21; +pragma solidity ^0.4.23; interface ERC20 { diff --git a/contracts/Tokens/ERC777.sol b/contracts/Tokens/ERC777.sol index d72e585..2df3c7f 100644 --- a/contracts/Tokens/ERC777.sol +++ b/contracts/Tokens/ERC777.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.4.21; +pragma solidity ^0.4.23; interface ERC777 { function name() public constant returns (string); diff --git a/contracts/Vault/Vault.sol b/contracts/Vault/Vault.sol index 6042550..a0bacf8 100644 --- a/contracts/Vault/Vault.sol +++ b/contracts/Vault/Vault.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.4.21; +pragma solidity ^0.4.23; import "./VaultInterface.sol"; import "../Libraries/SafeMath.sol"; diff --git a/contracts/Vault/VaultInterface.sol b/contracts/Vault/VaultInterface.sol index 529f1c1..dcb1777 100644 --- a/contracts/Vault/VaultInterface.sol +++ b/contracts/Vault/VaultInterface.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.4.21; +pragma solidity ^0.4.23; interface VaultInterface { From 9283bef783f7452cdc3eaff76830112665bc3015 Mon Sep 17 00:00:00 2001 From: decanus Date: Thu, 26 Apr 2018 19:18:38 +0200 Subject: [PATCH 02/10] minor --- contracts/Ownership/Ownable.sol | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contracts/Ownership/Ownable.sol b/contracts/Ownership/Ownable.sol index 79c76d0..2bfadba 100644 --- a/contracts/Ownership/Ownable.sol +++ b/contracts/Ownership/Ownable.sol @@ -9,7 +9,7 @@ contract Ownable { _; } - function Ownable() public { + constructor() public { owner = msg.sender; } From 9ecf11a0d9c580433bb21595e6f456c389b6c89d Mon Sep 17 00:00:00 2001 From: decanus Date: Fri, 27 Apr 2018 00:16:58 +0200 Subject: [PATCH 03/10] added error constants --- contracts/Vault/Vault.sol | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/contracts/Vault/Vault.sol b/contracts/Vault/Vault.sol index 8e8ca32..4753721 100644 --- a/contracts/Vault/Vault.sol +++ b/contracts/Vault/Vault.sol @@ -11,6 +11,11 @@ contract Vault is Ownable, VaultInterface { using SafeMath for *; + string constant public NOT_SPENDER_ERROR = "NOT_SPENDER_ERROR"; + string constant public NOT_APPROVED_ERROR = "NOT_APPROVED_ERROR"; + string constant public ERC20_TRANSFER_FAILED = "ERC20_TRANSFER_FAILED"; + string constant public INSUFFICIENT_BALANCE_ERROR = "INSUFFICIENT_BALANCE_ERROR"; + address constant public ETH = 0x0; mapping (address => bool) public isERC777; @@ -24,12 +29,12 @@ contract Vault is Ownable, VaultInterface { address private latest; modifier onlySpender { - require(spenders[msg.sender]); + require(spenders[msg.sender], NOT_SPENDER_ERROR); _; } modifier onlyApproved(address user) { - require(approved[user][msg.sender]); + require(approved[user][msg.sender], NOT_APPROVED_ERROR); _; } @@ -48,7 +53,7 @@ contract Vault is Ownable, VaultInterface { if (token == ETH) { value = msg.value; } else { - require(ERC20(token).transferFrom(msg.sender, address(this), value)); + require(ERC20(token).transferFrom(msg.sender, address(this), value), ERC20_TRANSFER_FAILED); } depositFor(msg.sender, token, value); @@ -58,7 +63,7 @@ contract Vault is Ownable, VaultInterface { /// @param token Address of the token to withdraw. /// @param amount Amount of tokens to withdraw. function withdraw(address token, uint amount) external { - require(balanceOf(token, msg.sender) >= amount); + require(balanceOf(token, msg.sender) >= amount, INSUFFICIENT_BALANCE_ERROR); balances[token][msg.sender] = balances[token][msg.sender].sub(amount); accounted[token] = accounted[token].sub(amount); @@ -204,6 +209,6 @@ contract Vault is Ownable, VaultInterface { return; } - require(ERC20(token).transfer(user, amount)); + require(ERC20(token).transfer(user, amount), ERC20_TRANSFER_FAILED); } } From b36dff8eb02ec8c2b24719c4c250d30958e4467f Mon Sep 17 00:00:00 2001 From: decanus Date: Fri, 27 Apr 2018 00:17:23 +0200 Subject: [PATCH 04/10] constructor --- contracts/Vault/Vault.sol | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contracts/Vault/Vault.sol b/contracts/Vault/Vault.sol index 4753721..bdb6e10 100644 --- a/contracts/Vault/Vault.sol +++ b/contracts/Vault/Vault.sol @@ -38,7 +38,7 @@ contract Vault is Ownable, VaultInterface { _; } - function Vault(ERC820 registry) public { + constructor(ERC820 registry) public { // required by ERC777 standard. registry.setInterfaceImplementer(address(this), keccak256("ERC777TokensRecipient"), address(this)); } From 4630dc5069fd6cf810f8d9f0c9474aa2d1a1b3d0 Mon Sep 17 00:00:00 2001 From: Dean Eigenmann Date: Thu, 3 May 2018 00:09:16 +0200 Subject: [PATCH 05/10] Update CHANGELOG.md --- CHANGELOG.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index ca41a84..c210eef 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,11 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). +## [unreleased] + +### Changed + - Solidity version 0.4.23 + ## [2.1.0] - 2018-04-26 ### Changed From 550b8f5a051dcf6e0b61dee2ea4aae20810e56ce Mon Sep 17 00:00:00 2001 From: decanus Date: Wed, 9 May 2018 11:16:27 +0200 Subject: [PATCH 06/10] double space --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 955940d..059b675 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,7 +9,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ### Changed - Solidity version 0.4.23 - - Using new [Signature Validator](https://github.com/DexyProject/SignatureValidator) package. + - Using new [Signature Validator](https://github.com/DexyProject/SignatureValidator) package. ## [2.1.0] - 2018-04-26 From 2e1afb54887016dcefcb0623eecd4baa652c3f0f Mon Sep 17 00:00:00 2001 From: Dean Eigenmann Date: Mon, 2 Jul 2018 12:25:29 +0200 Subject: [PATCH 07/10] Update HookSubscriber.sol --- contracts/HookSubscriber.sol | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contracts/HookSubscriber.sol b/contracts/HookSubscriber.sol index 53a9444..6a3bf91 100644 --- a/contracts/HookSubscriber.sol +++ b/contracts/HookSubscriber.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.4.21; +pragma solidity ^0.4.23; interface HookSubscriber { From e7e64d3d424b211e761acef9665813b8978cb6af Mon Sep 17 00:00:00 2001 From: Dean Eigenmann Date: Mon, 2 Jul 2018 12:31:35 +0200 Subject: [PATCH 08/10] Update ExchangeLibrary.sol --- contracts/Libraries/ExchangeLibrary.sol | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contracts/Libraries/ExchangeLibrary.sol b/contracts/Libraries/ExchangeLibrary.sol index 54a79ea..a24c4db 100644 --- a/contracts/Libraries/ExchangeLibrary.sol +++ b/contracts/Libraries/ExchangeLibrary.sol @@ -4,7 +4,7 @@ import "./OrderLibrary.sol"; import "./SafeMath.sol"; import "./../Vault/VaultInterface.sol"; import "./../HookSubscriber.sol"; -import "@DexyProject/signature-validator/contracts/SignatureValidator.sol"; +import "@dexyproject/signature-validator/contracts/SignatureValidator.sol"; library ExchangeLibrary { From abdf93038b62b218cc286ed29f11297086c1d25a Mon Sep 17 00:00:00 2001 From: Dean Eigenmann Date: Mon, 2 Jul 2018 12:33:00 +0200 Subject: [PATCH 09/10] Update package.json --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index e69d5f8..3dec2b0 100644 --- a/package.json +++ b/package.json @@ -31,7 +31,7 @@ "web3-utils": "^1.0.0-beta.34", "web3": "^1.0.0-beta.34", "eip820": "^0.0.20", - "@dexyproject/signature-validator": "^1.0.0" + "@DexyProject/signature-validator": "^1.0.0" }, "keywords": [ "solidity", From fd3f0f2dd3b0a40aaccaff88bd204cb1331f7057 Mon Sep 17 00:00:00 2001 From: Dean Eigenmann Date: Mon, 2 Jul 2018 12:35:57 +0200 Subject: [PATCH 10/10] Update package.json --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 3dec2b0..e69d5f8 100644 --- a/package.json +++ b/package.json @@ -31,7 +31,7 @@ "web3-utils": "^1.0.0-beta.34", "web3": "^1.0.0-beta.34", "eip820": "^0.0.20", - "@DexyProject/signature-validator": "^1.0.0" + "@dexyproject/signature-validator": "^1.0.0" }, "keywords": [ "solidity",