Skip to content
This repository was archived by the owner on Dec 30, 2024. It is now read-only.

Commit

Permalink
cancelValult returns true when canceled
Browse files Browse the repository at this point in the history
  • Loading branch information
jbaylina committed Apr 27, 2017
1 parent 8d9fbb6 commit 3f069db
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 12 deletions.
7 changes: 4 additions & 3 deletions contracts/VaultController.sol
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ contract VaultController is Owned {

uint constant MAX_GENERATIONS = 10;
uint constant MAX_CHILDS = 100;
uint constant GAS_LIMIT = 500000;

/// @dev The `Recipient` is an address that is allowed to receive `baseToken`
/// from this controller's Vault after `timeLockExpiration` has passed
Expand Down Expand Up @@ -296,11 +297,11 @@ contract VaultController is Owned {
/// children, emptying them to the `parentVault`
function cancelVault() onlyOwnerOrParent initialized returns (bool _finished) {

if (canceled) return; //If it is already canceled, just return.
if (canceled) return true; //If it is already canceled, just return.

cancelAllChildVaults();

if (gas() < 200000) return false;
if (gas() < GAS_LIMIT) return false;

uint vaultBalance = primaryVault.getBalance();

Expand Down Expand Up @@ -328,7 +329,7 @@ contract VaultController is Owned {
/// @notice `onlyOwner` Automates that cancellation of all childVaults
function cancelAllChildVaults() internal onlyOwnerOrParent initialized {
uint i;
for (i=0; (i<childVaultControllers.length) && (gas() >=200000); i++) {
for (i=0; (i<childVaultControllers.length) && (gas() >= GAS_LIMIT); i++) {
cancelChildVault(i);
}
}
Expand Down
Loading

0 comments on commit 3f069db

Please sign in to comment.