Merge branch 'master' into quazia-comments

This commit is contained in:
perissology 2017-12-02 20:04:36 -08:00
commit 2629a4c5bc
2 changed files with 26 additions and 23 deletions

View File

@ -12,8 +12,8 @@ import "./Owned.sol";
/// @dev `LiquidPledging` is a basic interface to allow the `LPVault` contract /// @dev `LiquidPledging` is a basic interface to allow the `LPVault` contract
/// to confirm and cancel payments in the `LiquidPledging` contract. /// to confirm and cancel payments in the `LiquidPledging` contract.
contract LiquidPledging { contract LiquidPledging {
function confirmPayment(uint64 idNote, uint amount); function confirmPayment(uint64 idNote, uint amount) public;
function cancelPayment(uint64 idNote, uint amount); function cancelPayment(uint64 idNote, uint amount) public;
} }
@ -42,18 +42,18 @@ contract LPVault is Owned {
// @dev An array that contains all the payments for this LPVault // @dev An array that contains all the payments for this LPVault
Payment[] public payments; Payment[] public payments;
// @dev `liquidPledging` is the only address that can call a function with /// @dev `liquidPledging` is the only address that can call a function with
/// this modifier /// this modifier
modifier onlyLiquidPledging() { modifier onlyLiquidPledging() {
require(msg.sender == address(liquidPledging)); require(msg.sender == address(liquidPledging));
_; _;
} }
/// @dev USED FOR TESTING??? /// @dev USED FOR TESTING???
function VaultMock() { function VaultMock() public pure {
} }
function () payable { function () public payable {
} }
@ -61,7 +61,7 @@ contract LPVault is Owned {
/// instance to this LPvault. Keep in mind this isn't a single pledge but /// instance to this LPvault. Keep in mind this isn't a single pledge but
/// instead an entire liquid pledging contract. /// instead an entire liquid pledging contract.
/// @param _newLiquidPledging A full liquid pledging contract /// @param _newLiquidPledging A full liquid pledging contract
function setLiquidPledging(address _newLiquidPledging) onlyOwner { function setLiquidPledging(address _newLiquidPledging) public onlyOwner {
require(address(liquidPledging) == 0x0); require(address(liquidPledging) == 0x0);
liquidPledging = LiquidPledging(_newLiquidPledging); liquidPledging = LiquidPledging(_newLiquidPledging);
} }
@ -69,7 +69,7 @@ contract LPVault is Owned {
/// @notice `setAutopay` is used to toggle whether the LPvault will /// @notice `setAutopay` is used to toggle whether the LPvault will
/// automatically confirm a payment after the payment has been authorized. /// automatically confirm a payment after the payment has been authorized.
/// @param _automatic If true payments will confirm automatically /// @param _automatic If true payments will confirm automatically
function setAutopay(bool _automatic) onlyOwner { function setAutopay(bool _automatic) public onlyOwner {
autoPay = _automatic; autoPay = _automatic;
} }
@ -84,7 +84,7 @@ contract LPVault is Owned {
function authorizePayment( function authorizePayment(
bytes32 _ref, bytes32 _ref,
address _dest, address _dest,
uint _amount ) onlyLiquidPledging returns (uint) { uint _amount ) public onlyLiquidPledging returns (uint) {
uint idPayment = payments.length; uint idPayment = payments.length;
payments.length ++; payments.length ++;
payments[idPayment].state = PaymentStatus.Pending; payments[idPayment].state = PaymentStatus.Pending;
@ -94,7 +94,9 @@ contract LPVault is Owned {
AuthorizePayment(idPayment, _ref, _dest, _amount); AuthorizePayment(idPayment, _ref, _dest, _amount);
if (autoPay) doConfirmPayment(idPayment); if (autoPay) {
doConfirmPayment(idPayment);
}
return idPayment; return idPayment;
} }
@ -105,7 +107,7 @@ contract LPVault is Owned {
/// this is generally used when `autopay` is `false` after a payment has /// this is generally used when `autopay` is `false` after a payment has
/// has been authorized. /// has been authorized.
/// @param _idPayment Array lookup for the payment. /// @param _idPayment Array lookup for the payment.
function confirmPayment(uint _idPayment) onlyOwner { function confirmPayment(uint _idPayment) public onlyOwner {
doConfirmPayment(_idPayment); doConfirmPayment(_idPayment);
} }
@ -129,7 +131,7 @@ contract LPVault is Owned {
/// @notice `cancelPayment` is used when `autopay` is `false` in order /// @notice `cancelPayment` is used when `autopay` is `false` in order
/// to allow the owner to cancel a payment instead of confirming it. /// to allow the owner to cancel a payment instead of confirming it.
/// @param _idPayment Array lookup for the payment. /// @param _idPayment Array lookup for the payment.
function cancelPayment(uint _idPayment) onlyOwner { function cancelPayment(uint _idPayment) public onlyOwner {
doCancelPayment(_idPayment); doCancelPayment(_idPayment);
} }
@ -152,8 +154,8 @@ contract LPVault is Owned {
/// @notice `multiConfirm` allows for more efficient confirmation of /// @notice `multiConfirm` allows for more efficient confirmation of
/// multiple payments. /// multiple payments.
/// @param _idPayments An array of multiple payment ids /// @param _idPayments An array of multiple payment ids
function multiConfirm(uint[] _idPayments) onlyOwner { function multiConfirm(uint[] _idPayments) public onlyOwner {
for (uint i=0; i < _idPayments.length; i++) { for (uint i = 0; i < _idPayments.length; i++) {
doConfirmPayment(_idPayments[i]); doConfirmPayment(_idPayments[i]);
} }
} }
@ -161,8 +163,8 @@ contract LPVault is Owned {
/// @notice `multiCancel` allows for more efficient cancellation of /// @notice `multiCancel` allows for more efficient cancellation of
/// multiple payments. /// multiple payments.
/// @param _idPayments An array of multiple payment ids /// @param _idPayments An array of multiple payment ids
function multiCancel(uint[] _idPayments) onlyOwner { function multiCancel(uint[] _idPayments) public onlyOwner {
for (uint i=0; i < _idPayments.length; i++) { for (uint i = 0; i < _idPayments.length; i++) {
doCancelPayment(_idPayments[i]); doCancelPayment(_idPayments[i]);
} }
} }
@ -170,7 +172,7 @@ contract LPVault is Owned {
/// @notice `nPayments` Basic getter to return the number of payments /// @notice `nPayments` Basic getter to return the number of payments
/// currently held in the system. Since payments are not removed from /// currently held in the system. Since payments are not removed from
/// the array this represents all payments over all time. /// the array this represents all payments over all time.
function nPayments() constant returns (uint) { function nPayments() constant public returns (uint) {
return payments.length; return payments.length;
} }

View File

@ -14,9 +14,10 @@ contract Owned {
address public owner; address public owner;
/// @notice The Constructor assigns the account deploying the contract to be /// @notice The Constructor assigns the account deploying the contract to be
/// the `owner` /// the `owner`
function Owned() { function Owned() public {
owner = msg.sender; owner = msg.sender;
} }
@ -28,12 +29,12 @@ contract Owned {
/// @param _newOwner The address of the new owner. A simple contract with /// @param _newOwner The address of the new owner. A simple contract with
/// the ability to accept ownership but the inability to do anything else /// the ability to accept ownership but the inability to do anything else
/// can be used to create an unowned contract to achieve decentralization /// can be used to create an unowned contract to achieve decentralization
function changeOwner(address _newOwner) onlyOwner { function changeOwner(address _newOwner) public onlyOwner {
newOwner = _newOwner; newOwner = _newOwner;
} }
/// @notice `newOwner` can accept ownership over this contract /// @notice `newOwner` can accept ownership over this contract
function acceptOwnership() { function acceptOwnership() public {
require(msg.sender == newOwner); require(msg.sender == newOwner);
owner = newOwner; owner = newOwner;
} }