NotPaid to Pledged refactor
This commit is contained in:
parent
41154e89d2
commit
aaa3be9305
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -52,7 +52,7 @@ contract LiquidPledgingBase {
|
|||
uint constant MAX_INTERCAMPAIGN_LEVEL = 20;
|
||||
|
||||
enum PledgeAdminType { Giver, Delegate, Campaign }
|
||||
enum PaymentState { NotPaid, Paying, Paid } // TODO name change NotPaid
|
||||
enum PaymentState { Pledged, Paying, Paid } // TODO name change Pledged
|
||||
|
||||
/// @dev This struct defines the details of each the PledgeAdmin, these
|
||||
/// PledgeAdmins can own pledges and act as delegates
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -52,7 +52,7 @@ contract LiquidPledgingBase {
|
|||
uint constant MAX_INTERCAMPAIGN_LEVEL = 20;
|
||||
|
||||
enum PledgeAdminType { Giver, Delegate, Campaign }
|
||||
enum PaymentState { NotPaid, Paying, Paid } // TODO name change NotPaid
|
||||
enum PaymentState { Pledged, Paying, Paid } // TODO name change Pledged
|
||||
|
||||
/// @dev This struct defines the details of each the PledgeAdmin, these
|
||||
/// PledgeAdmins can own pledges and act as delegates
|
||||
|
@ -447,7 +447,7 @@ function donate(uint64 idGiver, uint64 idReceiver) payable {
|
|||
0,
|
||||
0,
|
||||
0,
|
||||
PaymentState.NotPaid);
|
||||
PaymentState.Pledged);
|
||||
|
||||
|
||||
Pledge storage nTo = findPledge(idPledge);
|
||||
|
@ -475,7 +475,7 @@ function donate(uint64 idGiver, uint64 idReceiver) payable {
|
|||
PledgeAdmin storage sender = findAdmin(idSender);
|
||||
|
||||
checkAdminOwner(sender);
|
||||
require(n.paymentState == PaymentState.NotPaid);
|
||||
require(n.paymentState == PaymentState.Pledged);
|
||||
|
||||
// If the sender is the owner
|
||||
if (n.owner == idSender) {
|
||||
|
@ -553,7 +553,7 @@ function donate(uint64 idGiver, uint64 idReceiver) payable {
|
|||
|
||||
Pledge storage n = findPledge(idPledge);
|
||||
|
||||
require(n.paymentState == PaymentState.NotPaid);
|
||||
require(n.paymentState == PaymentState.Pledged);
|
||||
|
||||
PledgeAdmin storage owner = findAdmin(n.owner);
|
||||
|
||||
|
@ -611,7 +611,7 @@ function donate(uint64 idGiver, uint64 idReceiver) payable {
|
|||
0,
|
||||
0,
|
||||
n.oldPledge,
|
||||
PaymentState.NotPaid
|
||||
PaymentState.Pledged
|
||||
);
|
||||
|
||||
oldPledge = normalizePledge(oldPledge);
|
||||
|
@ -709,14 +709,14 @@ function donate(uint64 idGiver, uint64 idReceiver) payable {
|
|||
0,
|
||||
0,
|
||||
n.oldPledge,
|
||||
PaymentState.NotPaid);
|
||||
PaymentState.Pledged);
|
||||
uint64 toPledge = findPledge(
|
||||
idReceiver,
|
||||
new uint64[](0),
|
||||
0,
|
||||
0,
|
||||
oldPledge,
|
||||
PaymentState.NotPaid);
|
||||
PaymentState.Pledged);
|
||||
doTransfer(idPledge, toPledge, amount);
|
||||
}
|
||||
|
||||
|
@ -727,7 +727,7 @@ function donate(uint64 idGiver, uint64 idReceiver) payable {
|
|||
0,
|
||||
0,
|
||||
0,
|
||||
PaymentState.NotPaid);
|
||||
PaymentState.Pledged);
|
||||
doTransfer(idPledge, toPledge, amount);
|
||||
}
|
||||
|
||||
|
@ -749,7 +749,7 @@ function donate(uint64 idGiver, uint64 idReceiver) payable {
|
|||
0,
|
||||
0,
|
||||
n.oldPledge,
|
||||
PaymentState.NotPaid);
|
||||
PaymentState.Pledged);
|
||||
doTransfer(idPledge, toPledge, amount);
|
||||
}
|
||||
|
||||
|
@ -766,7 +766,7 @@ function donate(uint64 idGiver, uint64 idReceiver) payable {
|
|||
0,
|
||||
0,
|
||||
n.oldPledge,
|
||||
PaymentState.NotPaid);
|
||||
PaymentState.Pledged);
|
||||
doTransfer(idPledge, toPledge, amount);
|
||||
}
|
||||
|
||||
|
@ -782,7 +782,7 @@ function donate(uint64 idGiver, uint64 idReceiver) payable {
|
|||
idReceiver,
|
||||
uint64(getTime() + maxCommitTime(n)),
|
||||
n.oldPledge,
|
||||
PaymentState.NotPaid);
|
||||
PaymentState.Pledged);
|
||||
doTransfer(idPledge, toPledge, amount);
|
||||
}
|
||||
|
||||
|
@ -812,7 +812,7 @@ function donate(uint64 idGiver, uint64 idReceiver) payable {
|
|||
Pledge storage n = findPledge(idPledge);
|
||||
|
||||
// Check to make sure this pledge hasnt already been used or is in the process of being used
|
||||
if (n.paymentState != PaymentState.NotPaid) return idPledge;
|
||||
if (n.paymentState != PaymentState.Pledged) return idPledge;
|
||||
|
||||
// First send to a campaign if it's proposed and commited
|
||||
if ((n.proposedCampaign > 0) && ( getTime() > n.commitTime)) {
|
||||
|
@ -822,14 +822,14 @@ function donate(uint64 idGiver, uint64 idReceiver) payable {
|
|||
0,
|
||||
0,
|
||||
n.oldPledge,
|
||||
PaymentState.NotPaid);
|
||||
PaymentState.Pledged);
|
||||
uint64 toPledge = findPledge(
|
||||
n.proposedCampaign,
|
||||
new uint64[](0),
|
||||
0,
|
||||
0,
|
||||
oldPledge,
|
||||
PaymentState.NotPaid);
|
||||
PaymentState.Pledged);
|
||||
doTransfer(idPledge, toPledge, n.amount);
|
||||
idPledge = toPledge;
|
||||
n = findPledge(idPledge);
|
||||
|
|
|
@ -52,7 +52,7 @@ contract LiquidPledgingBase {
|
|||
uint constant MAX_INTERCAMPAIGN_LEVEL = 20;
|
||||
|
||||
enum PledgeAdminType { Giver, Delegate, Campaign }
|
||||
enum PaymentState { NotPaid, Paying, Paid } // TODO name change NotPaid
|
||||
enum PaymentState { Pledged, Paying, Paid } // TODO name change Pledged
|
||||
|
||||
/// @dev This struct defines the details of each the PledgeAdmin, these
|
||||
/// PledgeAdmins can own pledges and act as delegates
|
||||
|
@ -447,7 +447,7 @@ function donate(uint64 idGiver, uint64 idReceiver) payable {
|
|||
0,
|
||||
0,
|
||||
0,
|
||||
PaymentState.NotPaid);
|
||||
PaymentState.Pledged);
|
||||
|
||||
|
||||
Pledge storage nTo = findPledge(idPledge);
|
||||
|
@ -475,7 +475,7 @@ function donate(uint64 idGiver, uint64 idReceiver) payable {
|
|||
PledgeAdmin storage sender = findAdmin(idSender);
|
||||
|
||||
checkAdminOwner(sender);
|
||||
require(n.paymentState == PaymentState.NotPaid);
|
||||
require(n.paymentState == PaymentState.Pledged);
|
||||
|
||||
// If the sender is the owner
|
||||
if (n.owner == idSender) {
|
||||
|
@ -553,7 +553,7 @@ function donate(uint64 idGiver, uint64 idReceiver) payable {
|
|||
|
||||
Pledge storage n = findPledge(idPledge);
|
||||
|
||||
require(n.paymentState == PaymentState.NotPaid);
|
||||
require(n.paymentState == PaymentState.Pledged);
|
||||
|
||||
PledgeAdmin storage owner = findAdmin(n.owner);
|
||||
|
||||
|
@ -611,7 +611,7 @@ function donate(uint64 idGiver, uint64 idReceiver) payable {
|
|||
0,
|
||||
0,
|
||||
n.oldPledge,
|
||||
PaymentState.NotPaid
|
||||
PaymentState.Pledged
|
||||
);
|
||||
|
||||
oldPledge = normalizePledge(oldPledge);
|
||||
|
@ -709,14 +709,14 @@ function donate(uint64 idGiver, uint64 idReceiver) payable {
|
|||
0,
|
||||
0,
|
||||
n.oldPledge,
|
||||
PaymentState.NotPaid);
|
||||
PaymentState.Pledged);
|
||||
uint64 toPledge = findPledge(
|
||||
idReceiver,
|
||||
new uint64[](0),
|
||||
0,
|
||||
0,
|
||||
oldPledge,
|
||||
PaymentState.NotPaid);
|
||||
PaymentState.Pledged);
|
||||
doTransfer(idPledge, toPledge, amount);
|
||||
}
|
||||
|
||||
|
@ -727,7 +727,7 @@ function donate(uint64 idGiver, uint64 idReceiver) payable {
|
|||
0,
|
||||
0,
|
||||
0,
|
||||
PaymentState.NotPaid);
|
||||
PaymentState.Pledged);
|
||||
doTransfer(idPledge, toPledge, amount);
|
||||
}
|
||||
|
||||
|
@ -749,7 +749,7 @@ function donate(uint64 idGiver, uint64 idReceiver) payable {
|
|||
0,
|
||||
0,
|
||||
n.oldPledge,
|
||||
PaymentState.NotPaid);
|
||||
PaymentState.Pledged);
|
||||
doTransfer(idPledge, toPledge, amount);
|
||||
}
|
||||
|
||||
|
@ -766,7 +766,7 @@ function donate(uint64 idGiver, uint64 idReceiver) payable {
|
|||
0,
|
||||
0,
|
||||
n.oldPledge,
|
||||
PaymentState.NotPaid);
|
||||
PaymentState.Pledged);
|
||||
doTransfer(idPledge, toPledge, amount);
|
||||
}
|
||||
|
||||
|
@ -782,7 +782,7 @@ function donate(uint64 idGiver, uint64 idReceiver) payable {
|
|||
idReceiver,
|
||||
uint64(getTime() + maxCommitTime(n)),
|
||||
n.oldPledge,
|
||||
PaymentState.NotPaid);
|
||||
PaymentState.Pledged);
|
||||
doTransfer(idPledge, toPledge, amount);
|
||||
}
|
||||
|
||||
|
@ -812,7 +812,7 @@ function donate(uint64 idGiver, uint64 idReceiver) payable {
|
|||
Pledge storage n = findPledge(idPledge);
|
||||
|
||||
// Check to make sure this pledge hasnt already been used or is in the process of being used
|
||||
if (n.paymentState != PaymentState.NotPaid) return idPledge;
|
||||
if (n.paymentState != PaymentState.Pledged) return idPledge;
|
||||
|
||||
// First send to a campaign if it's proposed and commited
|
||||
if ((n.proposedCampaign > 0) && ( getTime() > n.commitTime)) {
|
||||
|
@ -822,14 +822,14 @@ function donate(uint64 idGiver, uint64 idReceiver) payable {
|
|||
0,
|
||||
0,
|
||||
n.oldPledge,
|
||||
PaymentState.NotPaid);
|
||||
PaymentState.Pledged);
|
||||
uint64 toPledge = findPledge(
|
||||
n.proposedCampaign,
|
||||
new uint64[](0),
|
||||
0,
|
||||
0,
|
||||
oldPledge,
|
||||
PaymentState.NotPaid);
|
||||
PaymentState.Pledged);
|
||||
doTransfer(idPledge, toPledge, n.amount);
|
||||
idPledge = toPledge;
|
||||
n = findPledge(idPledge);
|
||||
|
|
|
@ -44,7 +44,7 @@ function donate(uint64 idGiver, uint64 idReceiver) payable {
|
|||
0,
|
||||
0,
|
||||
0,
|
||||
PaymentState.NotPaid);
|
||||
PaymentState.Pledged);
|
||||
|
||||
|
||||
Pledge storage nTo = findPledge(idPledge);
|
||||
|
@ -72,7 +72,7 @@ function donate(uint64 idGiver, uint64 idReceiver) payable {
|
|||
PledgeAdmin storage sender = findAdmin(idSender);
|
||||
|
||||
checkAdminOwner(sender);
|
||||
require(n.paymentState == PaymentState.NotPaid);
|
||||
require(n.paymentState == PaymentState.Pledged);
|
||||
|
||||
// If the sender is the owner
|
||||
if (n.owner == idSender) {
|
||||
|
@ -150,7 +150,7 @@ function donate(uint64 idGiver, uint64 idReceiver) payable {
|
|||
|
||||
Pledge storage n = findPledge(idPledge);
|
||||
|
||||
require(n.paymentState == PaymentState.NotPaid);
|
||||
require(n.paymentState == PaymentState.Pledged);
|
||||
|
||||
PledgeAdmin storage owner = findAdmin(n.owner);
|
||||
|
||||
|
@ -208,7 +208,7 @@ function donate(uint64 idGiver, uint64 idReceiver) payable {
|
|||
0,
|
||||
0,
|
||||
n.oldPledge,
|
||||
PaymentState.NotPaid
|
||||
PaymentState.Pledged
|
||||
);
|
||||
|
||||
oldPledge = normalizePledge(oldPledge);
|
||||
|
@ -306,14 +306,14 @@ function donate(uint64 idGiver, uint64 idReceiver) payable {
|
|||
0,
|
||||
0,
|
||||
n.oldPledge,
|
||||
PaymentState.NotPaid);
|
||||
PaymentState.Pledged);
|
||||
uint64 toPledge = findPledge(
|
||||
idReceiver,
|
||||
new uint64[](0),
|
||||
0,
|
||||
0,
|
||||
oldPledge,
|
||||
PaymentState.NotPaid);
|
||||
PaymentState.Pledged);
|
||||
doTransfer(idPledge, toPledge, amount);
|
||||
}
|
||||
|
||||
|
@ -324,7 +324,7 @@ function donate(uint64 idGiver, uint64 idReceiver) payable {
|
|||
0,
|
||||
0,
|
||||
0,
|
||||
PaymentState.NotPaid);
|
||||
PaymentState.Pledged);
|
||||
doTransfer(idPledge, toPledge, amount);
|
||||
}
|
||||
|
||||
|
@ -346,7 +346,7 @@ function donate(uint64 idGiver, uint64 idReceiver) payable {
|
|||
0,
|
||||
0,
|
||||
n.oldPledge,
|
||||
PaymentState.NotPaid);
|
||||
PaymentState.Pledged);
|
||||
doTransfer(idPledge, toPledge, amount);
|
||||
}
|
||||
|
||||
|
@ -363,7 +363,7 @@ function donate(uint64 idGiver, uint64 idReceiver) payable {
|
|||
0,
|
||||
0,
|
||||
n.oldPledge,
|
||||
PaymentState.NotPaid);
|
||||
PaymentState.Pledged);
|
||||
doTransfer(idPledge, toPledge, amount);
|
||||
}
|
||||
|
||||
|
@ -379,7 +379,7 @@ function donate(uint64 idGiver, uint64 idReceiver) payable {
|
|||
idReceiver,
|
||||
uint64(getTime() + maxCommitTime(n)),
|
||||
n.oldPledge,
|
||||
PaymentState.NotPaid);
|
||||
PaymentState.Pledged);
|
||||
doTransfer(idPledge, toPledge, amount);
|
||||
}
|
||||
|
||||
|
@ -409,7 +409,7 @@ function donate(uint64 idGiver, uint64 idReceiver) payable {
|
|||
Pledge storage n = findPledge(idPledge);
|
||||
|
||||
// Check to make sure this pledge hasnt already been used or is in the process of being used
|
||||
if (n.paymentState != PaymentState.NotPaid) return idPledge;
|
||||
if (n.paymentState != PaymentState.Pledged) return idPledge;
|
||||
|
||||
// First send to a campaign if it's proposed and commited
|
||||
if ((n.proposedCampaign > 0) && ( getTime() > n.commitTime)) {
|
||||
|
@ -419,14 +419,14 @@ function donate(uint64 idGiver, uint64 idReceiver) payable {
|
|||
0,
|
||||
0,
|
||||
n.oldPledge,
|
||||
PaymentState.NotPaid);
|
||||
PaymentState.Pledged);
|
||||
uint64 toPledge = findPledge(
|
||||
n.proposedCampaign,
|
||||
new uint64[](0),
|
||||
0,
|
||||
0,
|
||||
oldPledge,
|
||||
PaymentState.NotPaid);
|
||||
PaymentState.Pledged);
|
||||
doTransfer(idPledge, toPledge, n.amount);
|
||||
idPledge = toPledge;
|
||||
n = findPledge(idPledge);
|
||||
|
|
|
@ -16,7 +16,7 @@ contract LiquidPledgingBase {
|
|||
uint constant MAX_INTERCAMPAIGN_LEVEL = 20;
|
||||
|
||||
enum PledgeAdminType { Giver, Delegate, Campaign }
|
||||
enum PaymentState { NotPaid, Paying, Paid } // TODO name change NotPaid
|
||||
enum PaymentState { Pledged, Paying, Paid } // TODO name change Pledged
|
||||
|
||||
/// @dev This struct defines the details of each the PledgeAdmin, these
|
||||
/// PledgeAdmins can own pledges and act as delegates
|
||||
|
|
|
@ -28,7 +28,7 @@ module.exports = (test) => {
|
|||
pledge.oldPledge = res.oldPledge;
|
||||
}
|
||||
if (res.paymentState === '0') {
|
||||
pledge.paymentState = 'NotPaid';
|
||||
pledge.paymentState = 'Pledged';
|
||||
} else if (res.paymentState === '1') {
|
||||
pledge.paymentState = 'Paying';
|
||||
} else if (res.paymentState === '2') {
|
||||
|
|
Loading…
Reference in New Issue