Skip to content
This repository was archived by the owner on Jan 18, 2023. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 1 addition & 35 deletions contracts/core/Vault.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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 ============ */

/*
Expand All @@ -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(
Expand Down Expand Up @@ -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);
Expand All @@ -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);
Expand Down
30 changes: 0 additions & 30 deletions test/core/vault.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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 () => {
Expand Down Expand Up @@ -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 () => {
Expand Down