LiquidPledging milestone contracts
npm install lpp-milestones> Contracts for LiquidPledging milestone plugins
Welcome to the code for the milestone plugins for liquid pledging. These contracts set the rules for milestones on the Giveth dapp.
- Table of contents
- Milestone Contracts
- BridgedMilestone
- Recipient
- Available Actions:
- Changing the recipient
- Manager
- Available Actions:
- Reviewer (optional)
- Constraints imposed if set:
- Available Actions:
- Changing the reviewer
- Funding/Withdraw
- LPMilestone
- Recipient
- Withdraw/Disbursement
- Development
- Install
- Requirements
- Package
- Run demo
- Help
This milestone is intended to work with the bridged version of LiquidPledging. Upon withdraw/disbursement of funds, they will be sent directly to the giveth-bridge contract to be bridge to the home network. After the HomeBridge payment timeout has passed, the funds will transferred to the recipient.
#### Recipient
This entity which will receive the milestone donations. This can be unset (address(0)) upon deploy. If recipient == address(0), then the manager can follow Changing the recipient to set the recipient.
##### Available Actions:
* withdraw the funds
* if reviewer != address(0):
* request a review of the milestone
##### Changing the recipient
You must call changeRecipient(address newRecipient) in order to change the recipient.
The following rules apply:
* If recipient == address(0), only the manager can set the recipient
* If recipient != address(0), only the current recipient can change the recipient
NOTE: This is done is a single call, instead of a more fail-proof 2 step propose/accept process. If a mistake is made when setting/changing the recipient, the milestone will need to be canceled and re-created.
#### Manager
This entity is responsible for "managing" the milestone.
##### Available Actions:
* canceling the milestone
* disbursing the funds to the recipient
* if recipient == address(0):
* set the recipient
* if reviewer != address(0):
* request a review of the milestone
NOTE: This can be the recipient, the Giveth campaign manager, etc.
#### Reviewer (optional)
##### Constraints imposed if set:
* milestone can only be withdrawn if state = MilestoneState.COMPLETED
* milestone flow is as follows:
1. manger or recipient requests a review by calling requestReview()
2. reviewer can either accept (approveCompleted()) or reject (rejectCompleted()) the milestone as complete
1. If the milestone is rejected, go back to step 1
3. manager or recipient can disburse/withdraw the funds by calling withdraw(uint64 idPledge, uint amount) or mWithdraw(uint[] pledgesAmounts). The funds will always be sent to the recipient
##### Available Actions:
* canceling the milestone
* accept the milestone as completed
##### Changing the reviewer
In order to change the address, the current reviewer needs to call changeReviewer(address newReviewer).
NOTE: This is done is a single call, instead of a more fail-proof 2 step propose/accept process. If a mistake is made when changing the reviewer, the milestone will need to be canceled and re-created.
#### Funding/Withdraw
Upon initialization, the milestone can decide to limit donations to a single token (acceptedToken = token_address), the native currency (acceptedToken = address(0)), or any token (acceptedToken = address(-1)).
Donations can only be withdrawn if a recipient has been set.
Depending on the behavior of the LiquidPledging app, withdraw may be a 2-step process. When calling withdraw(uint64 idPledge, uint amount, address token) or mWithdraw(uint[] pledgesAmounts, address[] tokens) an attempt will be made to disburse the payment to the recipient. If there is a delay between withdrawing from LiquidPledging and the funds being sent, then a 2nd call to disburse(address token) or mDisburse(address[] tokens) will need to be made to send the funds to the recipient.
NOTE: This milestone can continue to receive funds indefinetly.
This milestone is intended to raise funds for an exsting LiquidPledging admin. Any raised funds can only be transferred transfered directly to the LiquidPledging admin.
All behavior is the same as the BridgedMilestone except as noted below.
#### Recipient
This is the adminId of the LiquidPledging admin who will receive the funds from this milestone. Only the manager will be able to execute the actions mentioned in BridgedMilestone - Available Actions.
#### Withdraw/Disbursement
As noted above, the funds will never leave the LiquidPledging contract.
NOTE: If the recipient is canceled this milestone will not be withdrawable and any withdrawn pledges may be under the control of this milestone again. This milestone must be canceled to roll-back any remaining pledges to the previous owner.
git clone https://github.com/GITHUB_USERNAME/lpp-milestones.git
`
6. Change directories to lpp-milestones:
`
cd lpp-milestones
`$3
Make sure you have NodeJS (v8.4.0 or higher) and npm (5.4.1 or higher) installed.$3
The lpp-milestones contracts are published as an npm package for developer convenience. To include it as a dependency in your package.json run this from your apps root dirctory.
`
npm install lpp-milestones --save
``