From f399f3087449810342d6519d5942f53f89dff3c9 Mon Sep 17 00:00:00 2001 From: Brian Weickmann Date: Sun, 29 Jul 2018 13:40:34 -0700 Subject: [PATCH] Removed modifiers and constants. Removed tests for 0 quantity inputs. --- contracts/core/Vault.sol | 36 +----------------------------------- test/core/vault.spec.ts | 30 ------------------------------ 2 files changed, 1 insertion(+), 65 deletions(-) diff --git a/contracts/core/Vault.sol b/contracts/core/Vault.sol index b5ee7c3f1..5f55d282d 100644 --- a/contracts/core/Vault.sol +++ b/contracts/core/Vault.sol @@ -37,11 +37,6 @@ contract Vault is // Use SafeMath library for all uint256 arithmetic using SafeMath for uint256; - /* ============ Constants ============ */ - - // Error messages - string constant INSUFFICIENT_BALANCE = "User does not have sufficient balance."; - /* ============ State Variables ============ */ // Mapping of token address to map of owner or Set address to balance. @@ -57,28 +52,6 @@ contract Vault is // +--------------+---------------------+--------+ mapping (address => mapping (address => uint256)) public balances; - - /* ============ Modifiers ============ */ - - // Checks to make sure a valid account to withdrawTo is given. - modifier isValidDestination(address _to) { - // Confirm address is not null - require(_to != address(0)); - // Confirm address is not Vault address - require(_to != address(this)); - _; - } - - /* - * Checks to make sure a positive quantity of tokens is being withdrawn - * or decremented/incremented - */ - modifier isNonZero(uint _quantity) { - // Confirm quantity is greater than zero - require(_quantity > 0); - _; - } - /* ============ External Functions ============ */ /* @@ -96,8 +69,6 @@ contract Vault is ) external onlyAuthorized - isNonZero(_quantity) - isValidDestination(_to) { // Retrieve current balance of token for the vault uint existingVaultBalance = ERC20Wrapper.balanceOf( @@ -136,7 +107,6 @@ contract Vault is ) external onlyAuthorized - isNonZero(_quantity) { // Increment balances state variable adding _quantity to user's token amount balances[_token][_owner] = balances[_token][_owner].add(_quantity); @@ -157,13 +127,9 @@ contract Vault is ) external onlyAuthorized - isNonZero(_quantity) { // Require that user has enough unassociated tokens to withdraw tokens or issue Set - require( - balances[_token][_owner] >= _quantity, - INSUFFICIENT_BALANCE - ); + require(balances[_token][_owner] >= _quantity); // Decrement balances state variable subtracting _quantity to user's token amount balances[_token][_owner] = balances[_token][_owner].sub(_quantity); diff --git a/test/core/vault.spec.ts b/test/core/vault.spec.ts index f22dfdeac..36e828973 100644 --- a/test/core/vault.spec.ts +++ b/test/core/vault.spec.ts @@ -137,16 +137,6 @@ contract('Vault', accounts => { }); }); - describe('when the amount to withdraw is zero', async () => { - beforeEach(async () => { - subjectAmountToWithdraw = ZERO; - }); - - it('should revert', async () => { - await expectRevertError(subject()); - }); - }); - describe('when the token has a transfer fee', async () => { let mockTokenWithFee: StandardTokenWithFeeMockContract; @@ -232,16 +222,6 @@ contract('Vault', accounts => { await expectRevertError(subject()); }); }); - - describe('when the incrementAmount is zero', async () => { - beforeEach(async () => { - subjectAmountToIncrement = ZERO; - }); - - it('should revert', async () => { - await expectRevertError(subject()); - }); - }); }); describe('#decrementTokenOwner', async () => { @@ -302,16 +282,6 @@ contract('Vault', accounts => { await expectRevertError(subject()); }); }); - - describe('when the decrementAmount is zero', async () => { - beforeEach(async () => { - subjectAmountToDecrement = ZERO; - }); - - it('should revert', async () => { - await expectRevertError(subject()); - }); - }); }); describe('#getOwnerBalance', async () => {