This repository has been archived by the owner on Apr 15, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 68
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into feature/146382715-metatx-controller
- Loading branch information
Showing
11 changed files
with
201 additions
and
143 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
node_modules | ||
contracts/misc/Migrations.sol |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
{ | ||
"custom-rules-filename": null, | ||
"rules": { | ||
"imports-on-top": true, | ||
"variable-declarations": true, | ||
"array-declarations": true, | ||
"operator-whitespace": true, | ||
"lbrace": false, | ||
"mixedcase": true, | ||
"camelcase": true, | ||
"uppercase": true, | ||
"no-with": true, | ||
"no-empty-blocks": true, | ||
"no-unused-vars": true, | ||
"double-quotes": true, | ||
"blank-lines": true, | ||
"indentation": false, | ||
"whitespace": true, | ||
"deprecated-suicide": true, | ||
"pragma-on-top": true | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,17 @@ | ||
pragma solidity 0.4.11; | ||
import "./libs/Owned.sol"; | ||
|
||
|
||
contract Proxy is Owned { | ||
event Forwarded (address indexed destination, uint value, bytes data ); | ||
event Received (address indexed sender, uint value); | ||
event Forwarded (address indexed destination, uint value, bytes data); | ||
event Received (address indexed sender, uint value); | ||
|
||
function () payable { Received(msg.sender, msg.value); } | ||
function () payable { Received(msg.sender, msg.value); } | ||
|
||
function forward(address destination, uint value, bytes data) onlyOwner { | ||
if (!destination.call.value(value)(data)) { throw; } | ||
Forwarded(destination, value, data); | ||
} | ||
function forward(address destination, uint value, bytes data) onlyOwner { | ||
if (!destination.call.value(value)(data)) { | ||
throw; | ||
} | ||
Forwarded(destination, value, data); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,82 +1,94 @@ | ||
pragma solidity 0.4.11; | ||
import "./Proxy.sol"; | ||
|
||
|
||
contract RecoverableController { | ||
uint public version; | ||
Proxy public proxy; | ||
|
||
address public userKey; | ||
address public proposedUserKey; | ||
uint public proposedUserKeyPendingUntil; | ||
|
||
address public recoveryKey; | ||
address public proposedRecoveryKey; | ||
uint public proposedRecoveryKeyPendingUntil; | ||
|
||
address public proposedController; | ||
uint public proposedControllerPendingUntil; | ||
|
||
uint public shortTimeLock;// use 900 for 15 minutes | ||
uint public longTimeLock; // use 259200 for 3 days | ||
|
||
event RecoveryEvent(string action, address initiatedBy); | ||
|
||
modifier onlyUserKey() { if (msg.sender == userKey) _; } | ||
modifier onlyRecoveryKey() { if (msg.sender == recoveryKey) _; } | ||
|
||
function RecoverableController(address proxyAddress, address _userKey, uint _longTimeLock, uint _shortTimeLock) { | ||
version = 1; | ||
proxy = Proxy(proxyAddress); | ||
userKey = _userKey; | ||
shortTimeLock = _shortTimeLock; | ||
longTimeLock = _longTimeLock; | ||
recoveryKey = msg.sender; | ||
} | ||
|
||
function forward(address destination, uint value, bytes data) onlyUserKey { | ||
proxy.forward(destination, value, data); | ||
} | ||
//pass 0x0 to cancel | ||
function signRecoveryChange(address _proposedRecoveryKey) onlyUserKey{ | ||
proposedRecoveryKeyPendingUntil = now + longTimeLock; | ||
proposedRecoveryKey = _proposedRecoveryKey; | ||
RecoveryEvent("signRecoveryChange", msg.sender); | ||
} | ||
function changeRecovery() { | ||
if(proposedRecoveryKeyPendingUntil < now && proposedRecoveryKey != 0x0){ | ||
recoveryKey = proposedRecoveryKey; | ||
delete proposedRecoveryKey; | ||
uint public version; | ||
Proxy public proxy; | ||
|
||
address public userKey; | ||
address public proposedUserKey; | ||
uint public proposedUserKeyPendingUntil; | ||
|
||
address public recoveryKey; | ||
address public proposedRecoveryKey; | ||
uint public proposedRecoveryKeyPendingUntil; | ||
|
||
address public proposedController; | ||
uint public proposedControllerPendingUntil; | ||
|
||
uint public shortTimeLock; // use 900 for 15 minutes | ||
uint public longTimeLock; // use 259200 for 3 days | ||
|
||
event RecoveryEvent(string action, address initiatedBy); | ||
|
||
modifier onlyUserKey() { | ||
if (msg.sender == userKey) _; | ||
} | ||
modifier onlyRecoveryKey() { | ||
if (msg.sender == recoveryKey) _; | ||
} | ||
|
||
function RecoverableController(address proxyAddress, address _userKey, uint _longTimeLock, uint _shortTimeLock) { | ||
version = 1; | ||
proxy = Proxy(proxyAddress); | ||
userKey = _userKey; | ||
shortTimeLock = _shortTimeLock; | ||
longTimeLock = _longTimeLock; | ||
recoveryKey = msg.sender; | ||
} | ||
|
||
function forward(address destination, uint value, bytes data) onlyUserKey { | ||
proxy.forward(destination, value, data); | ||
} | ||
} | ||
//pass 0x0 to cancel | ||
function signControllerChange(address _proposedController) onlyUserKey{ | ||
proposedControllerPendingUntil = now + longTimeLock; | ||
proposedController = _proposedController; | ||
RecoveryEvent("signControllerChange", msg.sender); | ||
} | ||
function changeController() { | ||
if(proposedControllerPendingUntil < now && proposedController != 0x0){ | ||
proxy.transfer(proposedController); | ||
suicide(proposedController); | ||
|
||
//pass 0x0 to cancel | ||
function signRecoveryChange(address _proposedRecoveryKey) onlyUserKey { | ||
proposedRecoveryKeyPendingUntil = now + longTimeLock; | ||
proposedRecoveryKey = _proposedRecoveryKey; | ||
RecoveryEvent("signRecoveryChange", msg.sender); | ||
} | ||
|
||
function changeRecovery() { | ||
if (proposedRecoveryKeyPendingUntil < now && proposedRecoveryKey != 0x0) { | ||
recoveryKey = proposedRecoveryKey; | ||
delete proposedRecoveryKey; | ||
} | ||
} | ||
|
||
//pass 0x0 to cancel | ||
function signControllerChange(address _proposedController) onlyUserKey { | ||
proposedControllerPendingUntil = now + longTimeLock; | ||
proposedController = _proposedController; | ||
RecoveryEvent("signControllerChange", msg.sender); | ||
} | ||
|
||
function changeController() { | ||
if (proposedControllerPendingUntil < now && proposedController != 0x0) { | ||
proxy.transfer(proposedController); | ||
selfdestruct(proposedController); | ||
} | ||
} | ||
|
||
//pass 0x0 to cancel | ||
function signUserKeyChange(address _proposedUserKey) onlyUserKey { | ||
proposedUserKeyPendingUntil = now + shortTimeLock; | ||
proposedUserKey = _proposedUserKey; | ||
RecoveryEvent("signUserKeyChange", msg.sender); | ||
} | ||
} | ||
//pass 0x0 to cancel | ||
function signUserKeyChange(address _proposedUserKey) onlyUserKey{ | ||
proposedUserKeyPendingUntil = now + shortTimeLock; | ||
proposedUserKey = _proposedUserKey; | ||
RecoveryEvent("signUserKeyChange", msg.sender); | ||
} | ||
function changeUserKey(){ | ||
if(proposedUserKeyPendingUntil < now && proposedUserKey != 0x0){ | ||
userKey = proposedUserKey; | ||
delete proposedUserKey; | ||
RecoveryEvent("changeUserKey", msg.sender); | ||
|
||
function changeUserKey(){ | ||
if (proposedUserKeyPendingUntil < now && proposedUserKey != 0x0) { | ||
userKey = proposedUserKey; | ||
delete proposedUserKey; | ||
RecoveryEvent("changeUserKey", msg.sender); | ||
} | ||
} | ||
} | ||
|
||
function changeRecoveryFromRecovery(address _recoveryKey) onlyRecoveryKey{ recoveryKey = _recoveryKey; } | ||
function changeUserKeyFromRecovery(address _userKey) onlyRecoveryKey{ | ||
delete proposedUserKey; | ||
userKey = _userKey; | ||
} | ||
function changeRecoveryFromRecovery(address _recoveryKey) onlyRecoveryKey{ recoveryKey = _recoveryKey; } | ||
|
||
function changeUserKeyFromRecovery(address _userKey) onlyRecoveryKey{ | ||
delete proposedUserKey; | ||
userKey = _userKey; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.