2017-09-13 12:41:08 +00:00
|
|
|
pragma solidity ^0.4.11;
|
|
|
|
|
2017-10-24 04:09:56 +00:00
|
|
|
/*
|
|
|
|
Copyright 2017, Jordi Baylina
|
|
|
|
Contributor: Adrià Massanet <adria@codecontext.io>
|
|
|
|
|
|
|
|
This program is free software: you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/// @dev `ILiquidPledgingPlugin` is the basic interface for any
|
|
|
|
/// liquid pledging plugin
|
2017-09-13 12:41:08 +00:00
|
|
|
contract ILiquidPledgingPlugin {
|
2017-10-24 04:09:56 +00:00
|
|
|
|
2017-10-03 11:37:45 +00:00
|
|
|
/// @notice Plugins are used (much like web hooks) to initiate an action
|
2017-09-29 09:06:11 +00:00
|
|
|
/// upon any donation, delegation, or transfer; this is an optional feature
|
2017-10-24 04:09:56 +00:00
|
|
|
/// and allows for extreme customization of the contract. This function
|
|
|
|
/// implements any action that should be initiated before a transfer.
|
|
|
|
/// @param pledgeManager The admin or current manager of the pledge
|
|
|
|
/// @param pledgeFrom This is the Id from which value will be transfered.
|
|
|
|
/// @param pledgeTo This is the Id that value will be transfered to.
|
2017-10-03 11:37:45 +00:00
|
|
|
/// @param context The situation that is triggering the plugin:
|
|
|
|
/// 0 -> Plugin for the owner transferring pledge to another party
|
2017-09-29 09:06:11 +00:00
|
|
|
/// 1 -> Plugin for the first delegate transferring pledge to another party
|
|
|
|
/// 2 -> Plugin for the second delegate transferring pledge to another party
|
2017-09-13 12:41:08 +00:00
|
|
|
/// ...
|
2017-10-04 23:27:23 +00:00
|
|
|
/// 255 -> Plugin for the intendedProject transferring pledge to another party
|
2017-09-13 12:41:08 +00:00
|
|
|
///
|
2017-09-29 09:06:11 +00:00
|
|
|
/// 256 -> Plugin for the owner receiving pledge to another party
|
|
|
|
/// 257 -> Plugin for the first delegate receiving pledge to another party
|
|
|
|
/// 258 -> Plugin for the second delegate receiving pledge to another party
|
2017-09-13 12:41:08 +00:00
|
|
|
/// ...
|
2017-10-04 23:27:23 +00:00
|
|
|
/// 511 -> Plugin for the intendedProject receiving pledge to another party
|
2017-11-01 21:03:03 +00:00
|
|
|
/// @param amount The amount of value that will be transfered.
|
2017-09-29 09:06:11 +00:00
|
|
|
function beforeTransfer(
|
2017-10-04 10:55:46 +00:00
|
|
|
uint64 pledgeManager,
|
|
|
|
uint64 pledgeFrom,
|
|
|
|
uint64 pledgeTo,
|
2017-09-29 09:06:11 +00:00
|
|
|
uint64 context,
|
2017-11-01 21:03:03 +00:00
|
|
|
uint amount ) returns (uint maxAllowed);
|
2017-10-24 04:09:56 +00:00
|
|
|
|
|
|
|
/// @notice Plugins are used (much like web hooks) to initiate an action
|
|
|
|
/// upon any donation, delegation, or transfer; this is an optional feature
|
|
|
|
/// and allows for extreme customization of the contract. This function
|
|
|
|
/// implements any action that should be initiated after a transfer.
|
|
|
|
/// @param pledgeManager The admin or current manager of the pledge
|
|
|
|
/// @param pledgeFrom This is the Id from which value will be transfered.
|
|
|
|
/// @param pledgeTo This is the Id that value will be transfered to.
|
|
|
|
/// @param context The situation that is triggering the plugin:
|
|
|
|
/// 0 -> Plugin for the owner transferring pledge to another party
|
|
|
|
/// 1 -> Plugin for the first delegate transferring pledge to another party
|
|
|
|
/// 2 -> Plugin for the second delegate transferring pledge to another party
|
|
|
|
/// ...
|
|
|
|
/// 255 -> Plugin for the intendedProject transferring pledge to another party
|
|
|
|
///
|
|
|
|
/// 256 -> Plugin for the owner receiving pledge to another party
|
|
|
|
/// 257 -> Plugin for the first delegate receiving pledge to another party
|
|
|
|
/// 258 -> Plugin for the second delegate receiving pledge to another party
|
|
|
|
/// ...
|
|
|
|
/// 511 -> Plugin for the intendedProject receiving pledge to another party
|
2017-11-01 21:03:03 +00:00
|
|
|
/// @param amount The amount of value that will be transfered.
|
2017-09-29 09:06:11 +00:00
|
|
|
function afterTransfer(
|
2017-10-04 10:55:46 +00:00
|
|
|
uint64 pledgeManager,
|
|
|
|
uint64 pledgeFrom,
|
|
|
|
uint64 pledgeTo,
|
2017-09-29 09:06:11 +00:00
|
|
|
uint64 context,
|
2017-10-24 04:09:56 +00:00
|
|
|
uint amount
|
|
|
|
);
|
2017-09-13 12:41:08 +00:00
|
|
|
}
|