-
Notifications
You must be signed in to change notification settings - Fork 0
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
Ricardo Silva
committed
Feb 6, 2018
1 parent
8b200dc
commit d86be09
Showing
8 changed files
with
227 additions
and
64 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,3 @@ | ||
{ | ||
"presets": ["es2015", "stage-2", "stage-3"] | ||
} |
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,18 +1,28 @@ | ||
{ | ||
"name": "ethercontract", | ||
"version": "1.0.0", | ||
"name": "cf-contracts", | ||
"version": "0.0.1", | ||
"description": "", | ||
"main": "truffle-config.js", | ||
"directories": { | ||
"test": "test" | ||
}, | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
"pipeline": "truffle develop --log & truffle deploy --reset --network trufflenetwork && truffle test --network trufflenetwork" | ||
}, | ||
"author": "", | ||
"license": "ISC", | ||
"devDependencies": { | ||
"babel-polyfill": "^6.23.0", | ||
"babel-preset-es2015": "^6.24.1", | ||
"babel-preset-stage-2": "^6.18.0", | ||
"babel-preset-stage-3": "^6.17.0", | ||
"babel-register": "^6.23.0", | ||
"chai": "^4.1.2", | ||
"concurrently": "^3.5.1", | ||
"truffle": "^4.0.6" | ||
}, | ||
"dependencies": { | ||
"package.json": "^2.0.1", | ||
"zeppelin-solidity": "^1.5.0" | ||
"zeppelin-solidity": "^1.6.0" | ||
} | ||
} | ||
} |
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,35 @@ | ||
pragma solidity ^0.4.18; | ||
|
||
import "truffle/Assert.sol"; | ||
import "truffle/DeployedAddresses.sol"; | ||
|
||
contract TestExample { | ||
|
||
SomeContract internal someContract; | ||
|
||
function TestExample() public { | ||
someContract = new SomeContract(); | ||
} | ||
|
||
function testZero() public { | ||
Assert.isTrue(execute("method()", 0), "Should not allow zero amount"); | ||
} | ||
|
||
function testNonZero() public { | ||
Assert.isTrue(execute("method()", 100), "Should allow non-zero amount"); | ||
} | ||
|
||
function execute(string signature, uint256 value) internal returns (bool) { | ||
bytes4 sig = bytes4(keccak256(signature)); | ||
return someContract.call.value(value)(sig); | ||
} | ||
} | ||
|
||
contract SomeContract { | ||
|
||
function method() public { | ||
ExampleEvent(msg.sender, msg.value); | ||
} | ||
|
||
event ExampleEvent(address indexed add, uint256 amount); | ||
} |
Oops, something went wrong.