-
Notifications
You must be signed in to change notification settings - Fork 100
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #26 from nexusdev/0.2-dev
0.2 dev
- Loading branch information
Showing
21 changed files
with
153 additions
and
49 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 |
---|---|---|
@@ -1,5 +1,4 @@ | ||
build | ||
|
||
*.sw* | ||
*.DS_Store | ||
admin-gui/node_modules | ||
admin-gui/bower_components | ||
build/__* |
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,2 +1,20 @@ | ||
// Filename alias. | ||
import 'actor/base_actor.sol'; | ||
// A base contract mostly used by governance contracts in `gov`. | ||
// For now, this just means the multisig contract, but it could | ||
// be used for stake-vote or futarchy. | ||
contract DSBaseActor { | ||
// return result of `call` keyword | ||
function tryExec( address target, bytes calldata, uint value) | ||
internal | ||
returns (bool call_ret) | ||
{ | ||
return target.call.value(value)(calldata); | ||
} | ||
function exec( address target, bytes calldata, uint value) | ||
internal | ||
{ | ||
if(!tryExec(target, calldata, value)) { | ||
throw; | ||
} | ||
} | ||
} | ||
|
This file was deleted.
Oops, something went wrong.
2 changes: 1 addition & 1 deletion
2
contracts/actor/base_actor_test.sol → contracts/actor/base_test.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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
import 'actor/base_actor.sol'; | ||
import 'actor/base.sol'; | ||
import 'dapple/test.sol'; | ||
import 'dapple/debug.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,11 @@ | ||
import 'dapple/test.sol'; | ||
import 'auth/enum.sol'; | ||
|
||
contract AuthEnumValuesTest is Test, DSAuthModesEnum { | ||
function setUp() {} | ||
// TODO how to test they are still the same ABI type? | ||
function testValues() { | ||
assertEq( 0, uint(DSAuthModes.Owner) ); | ||
assertEq( 1, uint(DSAuthModes.Authority) ); | ||
} | ||
} |
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,5 @@ | ||
import 'data/approval_db.sol'; | ||
import 'data/balance_db.sol'; | ||
|
||
import 'data/map.sol'; | ||
import 'data/nullmap.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
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
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
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 |
---|---|---|
@@ -0,0 +1,73 @@ | ||
// Some tests to verify behavior of fallbacks and rsult of calling addresses with unexpected types | ||
// TODO demonstrate that garbage is not always calldata (except when calling no-code addresses) | ||
import 'dapple/test.sol'; | ||
|
||
contract ThrowingFallback { | ||
function() { | ||
throw; | ||
} | ||
} | ||
|
||
contract UndefinedFunction { | ||
function undefinedFunction() returns (bytes32); | ||
function undefinedFunction2() returns (bytes32); | ||
} | ||
|
||
contract TypedFallback { | ||
function() returns (bytes32) { | ||
return 0x42; | ||
// same as "return bytes32(0x0);" | ||
} | ||
} | ||
|
||
contract UntypedFallback { | ||
function() { | ||
// same as "return bytes32(0x0);" | ||
} | ||
} | ||
|
||
|
||
contract UndefinedFallback { | ||
function iHaveCode() returns (bytes32) { | ||
return "aaaaa"; | ||
} | ||
} | ||
|
||
|
||
contract FallbackTest is Test { | ||
ThrowingFallback throwing; | ||
TypedFallback typed; | ||
UntypedFallback untyped; | ||
UndefinedFallback undefined; | ||
address noCode; | ||
function setUp() { | ||
throwing = new ThrowingFallback(); | ||
typed = new TypedFallback(); | ||
untyped = new UntypedFallback(); | ||
undefined = new UndefinedFallback(); | ||
noCode = address(0x42); | ||
} | ||
function testFailThrowingFallback() { | ||
UndefinedFunction(throwing).undefinedFunction(); | ||
} | ||
function testTypedFallbackReturnsFalse() { | ||
var ret = UndefinedFunction(typed).undefinedFunction(); | ||
assertEq32(ret, 0x42); | ||
} | ||
function testUntypedFallbackReturnsGarbage() { | ||
var ret = UndefinedFunction(undefined).undefinedFunction(); | ||
assertTrue( ret != bytes32(0), "ret is 0 by coincidence" ); | ||
log_named_bytes32("garbage", ret); | ||
} | ||
function testUndefinedFallbackReturnsGarbage() { | ||
var ret = UndefinedFunction(undefined).undefinedFunction(); | ||
assertTrue( ret != bytes32(0), "ret is 0 by coincidence" ); | ||
log_named_bytes32("garbage", ret); | ||
} | ||
function testNoCodeReturnsGarbage() { | ||
var ret = UndefinedFunction(noCode).undefinedFunction(); | ||
assertTrue( ret != bytes32(0), "ret is 0 by coincidence" ); | ||
log_named_bytes32("garbage", ret); | ||
} | ||
|
||
} |
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
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
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