Skip to content
This repository was archived by the owner on Sep 20, 2019. It is now read-only.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
## [unreleased]

### Changed
- Using new [Signature Validator](https://github.com/DexyProject/SignatureValidator) package.
- Solidity version 0.4.23
- Using new [Signature Validator](https://github.com/DexyProject/SignatureValidator) package.

## [2.1.0] - 2018-04-26

Expand Down
4 changes: 2 additions & 2 deletions contracts/Exchange.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pragma solidity ^0.4.21;
pragma solidity ^0.4.23;

import "./ExchangeInterface.sol";
import "./Libraries/OrderLibrary.sol";
Expand All @@ -17,7 +17,7 @@ contract Exchange is Ownable, ExchangeInterface {

ExchangeLibrary.Exchange public exchange;

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);
Expand Down
2 changes: 1 addition & 1 deletion contracts/ExchangeInterface.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pragma solidity ^0.4.21;
pragma solidity ^0.4.23;

import "./Vault/VaultInterface.sol";

Expand Down
2 changes: 1 addition & 1 deletion contracts/HookSubscriber.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pragma solidity ^0.4.21;
pragma solidity ^0.4.23;

interface HookSubscriber {

Expand Down
2 changes: 1 addition & 1 deletion contracts/Libraries/ExchangeLibrary.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ pragma solidity ^0.4.23;

import "./OrderLibrary.sol";
import "./SafeMath.sol";
import "@dexyproject/signature-validator/contracts/SignatureValidator.sol";
import "./../Vault/VaultInterface.sol";
import "./../HookSubscriber.sol";
import "@dexyproject/signature-validator/contracts/SignatureValidator.sol";

library ExchangeLibrary {

Expand Down
2 changes: 1 addition & 1 deletion contracts/Libraries/OrderLibrary.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pragma solidity ^0.4.21;
pragma solidity ^0.4.23;

library OrderLibrary {

Expand Down
2 changes: 1 addition & 1 deletion contracts/Libraries/SafeMath.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pragma solidity ^0.4.21;
pragma solidity ^0.4.23;

library SafeMath {

Expand Down
4 changes: 2 additions & 2 deletions contracts/Ownership/Ownable.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pragma solidity ^0.4.21;
pragma solidity ^0.4.23;

contract Ownable {

Expand All @@ -9,7 +9,7 @@ contract Ownable {
_;
}

function Ownable() public {
constructor() public {
owner = msg.sender;
}

Expand Down
2 changes: 1 addition & 1 deletion contracts/Tokens/ERC20.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pragma solidity ^0.4.21;
pragma solidity ^0.4.23;

interface ERC20 {

Expand Down
2 changes: 1 addition & 1 deletion contracts/Tokens/ERC777.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pragma solidity ^0.4.21;
pragma solidity ^0.4.23;

interface ERC777 {
function name() public constant returns (string);
Expand Down
19 changes: 12 additions & 7 deletions contracts/Vault/Vault.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pragma solidity ^0.4.21;
pragma solidity ^0.4.23;

import "./VaultInterface.sol";
import "../Interfaces/ERC820.sol";
Expand All @@ -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;
Expand All @@ -24,16 +29,16 @@ 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);
_;
}

function Vault(ERC820 registry) public {
constructor(ERC820 registry) public {
// required by ERC777 standard.
registry.setInterfaceImplementer(address(this), keccak256("ERC777TokensRecipient"), address(this));
}
Expand All @@ -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);
Expand All @@ -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);
Expand Down Expand Up @@ -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);
}
}
2 changes: 1 addition & 1 deletion contracts/Vault/VaultInterface.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pragma solidity ^0.4.21;
pragma solidity ^0.4.23;

interface VaultInterface {

Expand Down