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

Cancelling the root vault causes founds to be lost #38

Open
adria0 opened this issue Apr 28, 2017 · 0 comments
Open

Cancelling the root vault causes founds to be lost #38

adria0 opened this issue Apr 28, 2017 · 0 comments

Comments

@adria0
Copy link

adria0 commented Apr 28, 2017

Since in root vault the parentVault is 0, cancelVault() will generate an primaryVault.authorizePayment and balance will be sent to 0 address

    function cancelVault() onlyOwnerOrParent returns (bool _finished) {

        // If ! initialized, just mark it as cancelled and return
        if (address(primaryVault) == 0) {
            canceled = true;
        }

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

        cancelAllChildVaults();

        if (msg.gas < GAS_LIMIT) return false;

        uint vaultBalance = primaryVault.getBalance();

        canceled = true;
        highestAcceptableBalance = 0;
        lowestAcceptableBalance = 0;
        owner = parentVaultController;
        if (vaultBalance > 0) {
            primaryVault.authorizePayment(
              "CANCEL CHILD VAULT",
              bytes32(msg.sender),
              address(parentVault),
              vaultBalance,
              0
            );
            VaultCanceled(msg.sender);
        }

        // Be sure that there is nothing remaining in the vault
        if (primaryVault.getBalance() > 0) throw;

        return true;
    }
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant