This repository has been archived by the owner on Dec 13, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
60 changed files
with
3,564 additions
and
2,581 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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 @@ | ||
pragma solidity ^0.4.25; | ||
pragma experimental "ABIEncoderV2"; | ||
|
||
import "./mixins/MixinAppRegistryCore.sol"; | ||
import "./mixins/MixinCancelChallenge.sol"; | ||
import "./mixins/MixinSetResolution.sol"; | ||
import "./mixins/MixinSetState.sol"; | ||
import "./mixins/MixinSetStateWithAction.sol"; | ||
|
||
|
||
/// @dev Base contract implmenting all logic needed for full-featured App registry | ||
contract AppRegistry is | ||
MixinAppRegistryCore, | ||
MixinSetState, | ||
MixinSetStateWithAction, | ||
MixinCancelChallenge, | ||
MixinSetResolution | ||
{ | ||
constructor () | ||
public | ||
{} | ||
} |
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,32 @@ | ||
pragma solidity 0.4.25; | ||
pragma experimental "ABIEncoderV2"; | ||
|
||
import "./libs/Transfer.sol"; | ||
import "./libs/LibCondition.sol"; | ||
|
||
import "./ContractRegistry.sol"; | ||
import "./NonceRegistry.sol"; | ||
|
||
|
||
/// @title ConditionalTransaction - A conditional transfer contract | ||
/// @author Liam Horne - <[email protected]> | ||
/// @author Mitchell Van Der Hoeff - <[email protected]> | ||
/// @notice Supports a complex transfer of funds contingent on some condition. | ||
contract ConditionalTransaction is LibCondition { | ||
|
||
using Transfer for Transfer.Transaction; | ||
|
||
function executeSimpleConditionalTransaction( | ||
Condition condition, | ||
Transfer.Transaction memory txn | ||
) | ||
public | ||
{ | ||
require( | ||
isSatisfied(condition), | ||
"Condition was not satisfied for conditional transaction" | ||
); | ||
txn.execute(); | ||
} | ||
|
||
} |
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 |
---|---|---|
|
@@ -3,11 +3,11 @@ pragma solidity 0.4.25; | |
import "openzeppelin-eth/contracts/utils/Address.sol"; | ||
|
||
|
||
/// @title Registry - A global Ethereum deterministic address translator | ||
/// @title ContractRegistry - A global Ethereum deterministic address translator | ||
/// @author Liam Horne - <[email protected]> | ||
/// @notice Supports deployment of contract initcode with the ability to deterministically reference the address before the actual contract is deployed regardless of msg.sender or transaction nonce | ||
/// @dev Will be obsolete for most use cases when CREATE2 is added to the EVM https://github.com/ethereum/EIPs/pull/1014 | ||
contract Registry { | ||
contract ContractRegistry { | ||
|
||
using Address for address; | ||
|
||
|
@@ -62,7 +62,7 @@ contract Registry { | |
/// @param ptr A counterfactual address | ||
/// @param data The data being sent in the call to the counterfactual contract | ||
function proxyCall(address registry, bytes32 ptr, bytes data) public { | ||
address to = Registry(registry).resolver(ptr); | ||
address to = ContractRegistry(registry).resolver(ptr); | ||
require(to != address(0), "Resolved to a 0x0 address"); | ||
require(to.isContract(), "Tried to call function on a non-contract"); | ||
require(to.call(data), "Registry.proxyCall failed."); | ||
|
File renamed without changes.
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,55 +1,49 @@ | ||
pragma solidity 0.4.25; | ||
pragma experimental "ABIEncoderV2"; | ||
|
||
import "../lib/Transfer.sol"; | ||
import "../Conditional.sol"; | ||
import "../Registry.sol"; | ||
import "../NonceRegistry.sol"; | ||
import "../AppInstance.sol"; | ||
import "./libs/Transfer.sol"; | ||
import "./libs/LibCondition.sol"; | ||
|
||
import "./ContractRegistry.sol"; | ||
import "./NonceRegistry.sol"; | ||
import "./AppRegistry.sol"; | ||
|
||
|
||
/// @title ConditionalTransaction - A conditional transfer contract | ||
/// @author Liam Horne - <[email protected]> | ||
/// @author Mitchell Van Der Hoeff - <[email protected]> | ||
/// @notice Supports a complex transfer of funds contingent on some condition. | ||
contract ConditionalTransaction is Conditional { | ||
contract StateChannelTransaction is LibCondition { | ||
|
||
using Transfer for Transfer.Transaction; | ||
|
||
function executeSimpleConditionalTransaction( | ||
Condition condition, | ||
Transfer.Transaction memory txn | ||
) | ||
public | ||
{ | ||
require( | ||
Conditional.isSatisfied(condition), | ||
"Condition was not satisfied for conditional transaction" | ||
); | ||
txn.execute(); | ||
} | ||
|
||
/// @notice Execute a fund transfer for a state channel app in a finalized state | ||
/// @param uninstallKey The key in the nonce registry | ||
/// @param appCfAddress Counterfactual address of the app contract | ||
/// @param terms The pre-agreed upon terms of the funds transfer | ||
function executeAppConditionalTransaction( | ||
address registry, | ||
address nonceRegistry, | ||
address appRegistryAddress, | ||
address nonceRegistryAddress, | ||
bytes32 uninstallKey, | ||
bytes32 appCfAddress, | ||
Transfer.Terms terms | ||
) | ||
public | ||
{ | ||
NonceRegistry nonceRegistry = NonceRegistry(nonceRegistryAddress); | ||
AppRegistry appRegistry = AppRegistry(appRegistryAddress); | ||
|
||
require( | ||
!NonceRegistry(nonceRegistry).isFinalized(uninstallKey, 1), | ||
!nonceRegistry.isFinalized(uninstallKey, 1), | ||
"App has been uninstalled" | ||
); | ||
|
||
address appAddr = Registry(registry).resolver(appCfAddress); | ||
AppInstance app = AppInstance(appAddr); | ||
Transfer.Transaction memory txn = app.getResolution(); | ||
// require( | ||
// appRegistry.isFinalized(appCfAddress), | ||
// "App is not in an OFF state yet" | ||
// ); | ||
|
||
Transfer.Transaction memory txn = appRegistry.getResolution(appCfAddress); | ||
|
||
require( | ||
Transfer.meetsTerms(txn, terms), | ||
|
@@ -59,4 +53,5 @@ contract ConditionalTransaction is Conditional { | |
txn.execute(); | ||
} | ||
|
||
|
||
} |
126 changes: 0 additions & 126 deletions
126
packages/contracts/contracts/appDefinitions/CommitRevealApp.sol
This file was deleted.
Oops, something went wrong.
98 changes: 0 additions & 98 deletions
98
packages/contracts/contracts/appDefinitions/CountingApp.sol
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.