Skip to content

Commit

Permalink
external escape hatch controller
Browse files Browse the repository at this point in the history
  • Loading branch information
nuevoalex committed Jul 10, 2018
1 parent dd0f623 commit 6484b1d
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 0 deletions.
1 change: 1 addition & 0 deletions source/contracts/IController.sol
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@ contract IController {
function onlyInEmergency() public view returns(bool);
function getAugur() public view returns (IAugur);
function getTimestamp() public view returns (uint256);
function emergencyStop() public returns (bool);
}
23 changes: 23 additions & 0 deletions source/contracts/external/EscapeHatchController.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
pragma solidity 0.4.20;

import 'IController.sol';
import 'libraries/Ownable.sol';


contract EscapeHatchController is Ownable {
IController public controller;

function setController(IController _controller) public onlyOwner returns (bool) {
controller = _controller;
return true;
}

function emergencyStop() public onlyOwner returns (bool) {
controller.emergencyStop();
return true;
}

function onTransferOwnership(address, address) internal returns (bool) {
return true;
}
}
23 changes: 23 additions & 0 deletions tests/test_escape_hatch_controller.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
from ethereum.tools import tester
from ethereum.tools.tester import TransactionFailed
from utils import captureFilteredLogs, bytesToHexString, AssertLog, TokenDelta
from pytest import raises, fixture

def test_escape_hatch_controller(contractsFixture, universe, controller):
escapeHatchController = contractsFixture.upload('external/EscapeHatchController.sol')
assert escapeHatchController.setController(controller.address)
assert escapeHatchController.controller() == controller.address
assert escapeHatchController.getOwner() == bytesToHexString(tester.a0)

# transfer ownership of controller to the escape hatch controller
assert controller.transferOwnership(escapeHatchController.address)
assert controller.owner() == escapeHatchController.address

# Pull escape hatch
assert escapeHatchController.emergencyStop()
assert controller.stopped()


@fixture
def controller(contractsFixture, kitchenSinkSnapshot):
return contractsFixture.contracts['Controller']

0 comments on commit 6484b1d

Please sign in to comment.