diff options
Diffstat (limited to 'contracts/chequebook/contract/chequebook.sol')
-rw-r--r-- | contracts/chequebook/contract/chequebook.sol | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/contracts/chequebook/contract/chequebook.sol b/contracts/chequebook/contract/chequebook.sol index 8d6e85d11..c386cceed 100644 --- a/contracts/chequebook/contract/chequebook.sol +++ b/contracts/chequebook/contract/chequebook.sol @@ -1,6 +1,6 @@ pragma solidity ^0.4.18; -import "https://github.com/ethereum/solidity/std/mortal.sol"; +import "./mortal.sol"; /// @title Chequebook for Ethereum micropayments /// @author Daniel A. Nagy <daniel@ethereum.org> @@ -11,6 +11,9 @@ contract chequebook is mortal { /// @notice Overdraft event event Overdraft(address deadbeat); + // Allow sending ether to the chequebook. + function() public payable { } + /// @notice Cash cheque /// /// @param beneficiary beneficiary address @@ -19,8 +22,7 @@ contract chequebook is mortal { /// @param sig_r signature parameter r /// @param sig_s signature parameter s /// The digital signature is calculated on the concatenated triplet of contract address, beneficiary address and cumulative amount - function cash(address beneficiary, uint256 amount, - uint8 sig_v, bytes32 sig_r, bytes32 sig_s) { + function cash(address beneficiary, uint256 amount, uint8 sig_v, bytes32 sig_r, bytes32 sig_s) public { // Check if the cheque is old. // Only cheques that are more recent than the last cashed one are considered. require(amount > sent[beneficiary]); @@ -31,7 +33,7 @@ contract chequebook is mortal { // and the cumulative amount on the last cashed cheque to beneficiary. uint256 diff = amount - sent[beneficiary]; if (diff <= this.balance) { - // update the cumulative amount before sending + // update the cumulative amount before sending sent[beneficiary] = amount; beneficiary.transfer(diff); } else { |