comment transferOwnershipToProject
This commit is contained in:
parent
5cebf72fb3
commit
3a8e906ee9
|
@ -32,6 +32,7 @@ contract LiquidPledging is LiquidPledgingBase {
|
||||||
/// LiquidPledgingBase contract
|
/// LiquidPledgingBase contract
|
||||||
/// @dev This constructor also calls the constructor
|
/// @dev This constructor also calls the constructor
|
||||||
/// for `LiquidPledgingBase`
|
/// for `LiquidPledgingBase`
|
||||||
|
/// @param _vault The vault where ETH backing this pledge is stored
|
||||||
function LiquidPledging(address _vault) LiquidPledgingBase(_vault) {
|
function LiquidPledging(address _vault) LiquidPledgingBase(_vault) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -282,7 +283,7 @@ contract LiquidPledging is LiquidPledgingBase {
|
||||||
|
|
||||||
/// @notice Method called to cancel specfic pledge.
|
/// @notice Method called to cancel specfic pledge.
|
||||||
/// @param idPledge Id of the pledge that should be canceled.
|
/// @param idPledge Id of the pledge that should be canceled.
|
||||||
/// @param amount Quantity of Ether that wants to be rolled back.
|
/// @param amount Quantity of Ether that wants to be rolled back.
|
||||||
function cancelPledge(uint64 idPledge, uint amount) {
|
function cancelPledge(uint64 idPledge, uint amount) {
|
||||||
idPledge = normalizePledge(idPledge);
|
idPledge = normalizePledge(idPledge);
|
||||||
|
|
||||||
|
@ -384,8 +385,12 @@ contract LiquidPledging is LiquidPledgingBase {
|
||||||
// Private methods
|
// Private methods
|
||||||
///////
|
///////
|
||||||
|
|
||||||
// this function is obvious, but it can also be called to undelegate
|
/// @notice `transferOwnershipToProject` allows for the transfer of
|
||||||
// everyone by setting yourself as the idReceiver
|
/// ownership to the project, but it can also be called to undelegate
|
||||||
|
/// everyone by setting one's own id for the idReceiver
|
||||||
|
/// @param idPledge Id of the pledge to be transfered.
|
||||||
|
/// @param amount Quantity of value that's being transfered
|
||||||
|
/// @param idReceiver The new owner of the project (or self to undelegate)
|
||||||
function transferOwnershipToProject(
|
function transferOwnershipToProject(
|
||||||
uint64 idPledge,
|
uint64 idPledge,
|
||||||
uint amount,
|
uint amount,
|
||||||
|
@ -393,6 +398,8 @@ contract LiquidPledging is LiquidPledgingBase {
|
||||||
) internal {
|
) internal {
|
||||||
Pledge storage n = findPledge(idPledge);
|
Pledge storage n = findPledge(idPledge);
|
||||||
|
|
||||||
|
// Ensure that the pledge is not already at max pledge depth
|
||||||
|
// and the project has not been cancelled
|
||||||
require(getPledgeLevel(n) < MAX_INTERPROJECT_LEVEL);
|
require(getPledgeLevel(n) < MAX_INTERPROJECT_LEVEL);
|
||||||
require(!isProjectCanceled(idReceiver));
|
require(!isProjectCanceled(idReceiver));
|
||||||
|
|
||||||
|
@ -402,14 +409,16 @@ contract LiquidPledging is LiquidPledgingBase {
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
n.oldPledge,
|
n.oldPledge,
|
||||||
PaymentState.Pledged);
|
PaymentState.Pledged
|
||||||
|
);
|
||||||
uint64 toPledge = findOrCreatePledge(
|
uint64 toPledge = findOrCreatePledge(
|
||||||
idReceiver,
|
idReceiver, // Set the new owner
|
||||||
new uint64[](0),
|
new uint64[](0), // clear the delegation chain
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
oldPledge,
|
oldPledge,
|
||||||
PaymentState.Pledged);
|
PaymentState.Pledged
|
||||||
|
);
|
||||||
doTransfer(idPledge, toPledge, amount);
|
doTransfer(idPledge, toPledge, amount);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -64,7 +64,7 @@ contract LiquidPledgingBase {
|
||||||
//////
|
//////
|
||||||
|
|
||||||
/// @notice The Constructor creates the `LiquidPledgingBase` on the blockchain
|
/// @notice The Constructor creates the `LiquidPledgingBase` on the blockchain
|
||||||
/// @param _vault Where the ETH is stored that the pledges represent
|
/// @param _vault The vault where ETH backing this pledge is stored
|
||||||
function LiquidPledgingBase(address _vault) {
|
function LiquidPledgingBase(address _vault) {
|
||||||
admins.length = 1; // we reserve the 0 admin
|
admins.length = 1; // we reserve the 0 admin
|
||||||
pledges.length = 1; // we reserve the 0 pledge
|
pledges.length = 1; // we reserve the 0 pledge
|
||||||
|
|
Loading…
Reference in New Issue