- https://medium.com/blockchannel/counterfactual-for-dummies-part-1-8ff164f78540
- https://programtheblockchain.com/posts/2018/02/23/writing-a-simple-payment-channel
About the tests:
$ npm i
$ ganache-cli -m "nose phone clip fee agent crop decorate spell album february oppose anxiety"
$ npm run test
If you're using ^v5.0.0 (including beta releases), you can bring your own compiler by adding this in your truffle config file (in this example it's set to 0.4.25):
module.exports = {
...
compilers: {
solc: {
version: "0.4.25",
},
},
...
};
You can query the list of available compiler versions by running this:
truffle compile --list
SimplePaymentChannel.sol:120:49: TypeError: Data location must be "storage" or "memory" for parameter in function, but none was given.
function isValidSignature(uint256 _balance, bytes _signedMessage)
^------------------^
This is due to some breaking changes in Solidity version 0.5. Namely that an address has to be marked as payable - otherwise it won't have the transfer function. More info here: https://solidity.readthedocs.io/en/v0.5.0/050-breaking-changes.html#explicitness-requirements
So just change you function parameters from address _payeeAddr to address payable _payeeAddr and it will work just fine.
- https:// ethereum.stackexchange.com/questions/66629/truffle-does-nothing-and-shows-no-output-when-running-tests
Important: breaking change for versions >= 0.5.0
solidity-coverage requires compilation with solc >= 0.4.21. We're prefixing our own instrumentation events with the emit keyword to reduce warnings volume when running the tool.