Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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 join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant