creation functions returns id
This commit is contained in:
parent
45c76edb13
commit
254b6b27f8
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -93,7 +93,10 @@ contract LiquidPledgingBase {
|
||||||
// Managers functions
|
// Managers functions
|
||||||
//////
|
//////
|
||||||
|
|
||||||
function addDonor(string name, uint64 commitTime, ILiquidPledgingPlugin plugin) {//Todo return idManager
|
function addDonor(string name, uint64 commitTime, ILiquidPledgingPlugin plugin) returns (uint64 idDonor) {//Todo return idManager
|
||||||
|
|
||||||
|
idDonor = uint64(managers.length);
|
||||||
|
|
||||||
managers.push(NoteManager(
|
managers.push(NoteManager(
|
||||||
NoteManagerType.Donor,
|
NoteManagerType.Donor,
|
||||||
msg.sender,
|
msg.sender,
|
||||||
|
@ -103,7 +106,7 @@ contract LiquidPledgingBase {
|
||||||
false,
|
false,
|
||||||
plugin));
|
plugin));
|
||||||
|
|
||||||
DonorAdded(uint64(managers.length-1));
|
DonorAdded(idDonor);
|
||||||
}
|
}
|
||||||
|
|
||||||
event DonorAdded(uint64 indexed idDonor);
|
event DonorAdded(uint64 indexed idDonor);
|
||||||
|
@ -127,7 +130,10 @@ contract LiquidPledgingBase {
|
||||||
|
|
||||||
event DonorUpdated(uint64 indexed idDonor);
|
event DonorUpdated(uint64 indexed idDonor);
|
||||||
|
|
||||||
function addDelegate(string name, uint64 commitTime, ILiquidPledgingPlugin plugin) { //TODO return index number
|
function addDelegate(string name, uint64 commitTime, ILiquidPledgingPlugin plugin) returns (uint64 idDelegate) { //TODO return index number
|
||||||
|
|
||||||
|
idDelegate = uint64(managers.length);
|
||||||
|
|
||||||
managers.push(NoteManager(
|
managers.push(NoteManager(
|
||||||
NoteManagerType.Delegate,
|
NoteManagerType.Delegate,
|
||||||
msg.sender,
|
msg.sender,
|
||||||
|
@ -137,7 +143,7 @@ contract LiquidPledgingBase {
|
||||||
false,
|
false,
|
||||||
plugin));
|
plugin));
|
||||||
|
|
||||||
DeegateAdded(uint64(managers.length-1));
|
DeegateAdded(idDelegate);
|
||||||
}
|
}
|
||||||
|
|
||||||
event DeegateAdded(uint64 indexed idDelegate);
|
event DeegateAdded(uint64 indexed idDelegate);
|
||||||
|
@ -160,13 +166,16 @@ contract LiquidPledgingBase {
|
||||||
|
|
||||||
event DelegateUpdated(uint64 indexed idDelegate);
|
event DelegateUpdated(uint64 indexed idDelegate);
|
||||||
|
|
||||||
function addProject(string name, address projectManager, uint64 parentProject, uint64 commitTime, ILiquidPledgingPlugin plugin) {
|
function addProject(string name, address projectManager, uint64 parentProject, uint64 commitTime, ILiquidPledgingPlugin plugin) returns (uint64 idProject) {
|
||||||
if (parentProject != 0) {
|
if (parentProject != 0) {
|
||||||
NoteManager storage pm = findManager(parentProject);
|
NoteManager storage pm = findManager(parentProject);
|
||||||
require(pm.managerType == NoteManagerType.Project);
|
require(pm.managerType == NoteManagerType.Project);
|
||||||
require(pm.addr == msg.sender);
|
require(pm.addr == msg.sender);
|
||||||
require(getProjectLevel(pm) < MAX_SUBPROJECT_LEVEL);
|
require(getProjectLevel(pm) < MAX_SUBPROJECT_LEVEL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
idProject = uint64(managers.length);
|
||||||
|
|
||||||
managers.push(NoteManager(
|
managers.push(NoteManager(
|
||||||
NoteManagerType.Project,
|
NoteManagerType.Project,
|
||||||
projectManager,
|
projectManager,
|
||||||
|
@ -176,7 +185,8 @@ contract LiquidPledgingBase {
|
||||||
false,
|
false,
|
||||||
plugin));
|
plugin));
|
||||||
|
|
||||||
ProjectAdded(uint64(managers.length-1));
|
|
||||||
|
ProjectAdded(idProject);
|
||||||
}
|
}
|
||||||
|
|
||||||
event ProjectAdded(uint64 indexed idProject);
|
event ProjectAdded(uint64 indexed idProject);
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -93,7 +93,10 @@ contract LiquidPledgingBase {
|
||||||
// Managers functions
|
// Managers functions
|
||||||
//////
|
//////
|
||||||
|
|
||||||
function addDonor(string name, uint64 commitTime, ILiquidPledgingPlugin plugin) {//Todo return idManager
|
function addDonor(string name, uint64 commitTime, ILiquidPledgingPlugin plugin) returns (uint64 idDonor) {//Todo return idManager
|
||||||
|
|
||||||
|
idDonor = uint64(managers.length);
|
||||||
|
|
||||||
managers.push(NoteManager(
|
managers.push(NoteManager(
|
||||||
NoteManagerType.Donor,
|
NoteManagerType.Donor,
|
||||||
msg.sender,
|
msg.sender,
|
||||||
|
@ -103,7 +106,7 @@ contract LiquidPledgingBase {
|
||||||
false,
|
false,
|
||||||
plugin));
|
plugin));
|
||||||
|
|
||||||
DonorAdded(uint64(managers.length-1));
|
DonorAdded(idDonor);
|
||||||
}
|
}
|
||||||
|
|
||||||
event DonorAdded(uint64 indexed idDonor);
|
event DonorAdded(uint64 indexed idDonor);
|
||||||
|
@ -127,7 +130,10 @@ contract LiquidPledgingBase {
|
||||||
|
|
||||||
event DonorUpdated(uint64 indexed idDonor);
|
event DonorUpdated(uint64 indexed idDonor);
|
||||||
|
|
||||||
function addDelegate(string name, uint64 commitTime, ILiquidPledgingPlugin plugin) { //TODO return index number
|
function addDelegate(string name, uint64 commitTime, ILiquidPledgingPlugin plugin) returns (uint64 idDelegate) { //TODO return index number
|
||||||
|
|
||||||
|
idDelegate = uint64(managers.length);
|
||||||
|
|
||||||
managers.push(NoteManager(
|
managers.push(NoteManager(
|
||||||
NoteManagerType.Delegate,
|
NoteManagerType.Delegate,
|
||||||
msg.sender,
|
msg.sender,
|
||||||
|
@ -137,7 +143,7 @@ contract LiquidPledgingBase {
|
||||||
false,
|
false,
|
||||||
plugin));
|
plugin));
|
||||||
|
|
||||||
DeegateAdded(uint64(managers.length-1));
|
DeegateAdded(idDelegate);
|
||||||
}
|
}
|
||||||
|
|
||||||
event DeegateAdded(uint64 indexed idDelegate);
|
event DeegateAdded(uint64 indexed idDelegate);
|
||||||
|
@ -160,13 +166,16 @@ contract LiquidPledgingBase {
|
||||||
|
|
||||||
event DelegateUpdated(uint64 indexed idDelegate);
|
event DelegateUpdated(uint64 indexed idDelegate);
|
||||||
|
|
||||||
function addProject(string name, address projectManager, uint64 parentProject, uint64 commitTime, ILiquidPledgingPlugin plugin) {
|
function addProject(string name, address projectManager, uint64 parentProject, uint64 commitTime, ILiquidPledgingPlugin plugin) returns (uint64 idProject) {
|
||||||
if (parentProject != 0) {
|
if (parentProject != 0) {
|
||||||
NoteManager storage pm = findManager(parentProject);
|
NoteManager storage pm = findManager(parentProject);
|
||||||
require(pm.managerType == NoteManagerType.Project);
|
require(pm.managerType == NoteManagerType.Project);
|
||||||
require(pm.addr == msg.sender);
|
require(pm.addr == msg.sender);
|
||||||
require(getProjectLevel(pm) < MAX_SUBPROJECT_LEVEL);
|
require(getProjectLevel(pm) < MAX_SUBPROJECT_LEVEL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
idProject = uint64(managers.length);
|
||||||
|
|
||||||
managers.push(NoteManager(
|
managers.push(NoteManager(
|
||||||
NoteManagerType.Project,
|
NoteManagerType.Project,
|
||||||
projectManager,
|
projectManager,
|
||||||
|
@ -176,7 +185,8 @@ contract LiquidPledgingBase {
|
||||||
false,
|
false,
|
||||||
plugin));
|
plugin));
|
||||||
|
|
||||||
ProjectAdded(uint64(managers.length-1));
|
|
||||||
|
ProjectAdded(idProject);
|
||||||
}
|
}
|
||||||
|
|
||||||
event ProjectAdded(uint64 indexed idProject);
|
event ProjectAdded(uint64 indexed idProject);
|
||||||
|
|
|
@ -93,7 +93,10 @@ contract LiquidPledgingBase {
|
||||||
// Managers functions
|
// Managers functions
|
||||||
//////
|
//////
|
||||||
|
|
||||||
function addDonor(string name, uint64 commitTime, ILiquidPledgingPlugin plugin) {//Todo return idManager
|
function addDonor(string name, uint64 commitTime, ILiquidPledgingPlugin plugin) returns (uint64 idDonor) {//Todo return idManager
|
||||||
|
|
||||||
|
idDonor = uint64(managers.length);
|
||||||
|
|
||||||
managers.push(NoteManager(
|
managers.push(NoteManager(
|
||||||
NoteManagerType.Donor,
|
NoteManagerType.Donor,
|
||||||
msg.sender,
|
msg.sender,
|
||||||
|
@ -103,7 +106,7 @@ contract LiquidPledgingBase {
|
||||||
false,
|
false,
|
||||||
plugin));
|
plugin));
|
||||||
|
|
||||||
DonorAdded(uint64(managers.length-1));
|
DonorAdded(idDonor);
|
||||||
}
|
}
|
||||||
|
|
||||||
event DonorAdded(uint64 indexed idDonor);
|
event DonorAdded(uint64 indexed idDonor);
|
||||||
|
@ -127,7 +130,10 @@ contract LiquidPledgingBase {
|
||||||
|
|
||||||
event DonorUpdated(uint64 indexed idDonor);
|
event DonorUpdated(uint64 indexed idDonor);
|
||||||
|
|
||||||
function addDelegate(string name, uint64 commitTime, ILiquidPledgingPlugin plugin) { //TODO return index number
|
function addDelegate(string name, uint64 commitTime, ILiquidPledgingPlugin plugin) returns (uint64 idDelegate) { //TODO return index number
|
||||||
|
|
||||||
|
idDelegate = uint64(managers.length);
|
||||||
|
|
||||||
managers.push(NoteManager(
|
managers.push(NoteManager(
|
||||||
NoteManagerType.Delegate,
|
NoteManagerType.Delegate,
|
||||||
msg.sender,
|
msg.sender,
|
||||||
|
@ -137,7 +143,7 @@ contract LiquidPledgingBase {
|
||||||
false,
|
false,
|
||||||
plugin));
|
plugin));
|
||||||
|
|
||||||
DeegateAdded(uint64(managers.length-1));
|
DeegateAdded(idDelegate);
|
||||||
}
|
}
|
||||||
|
|
||||||
event DeegateAdded(uint64 indexed idDelegate);
|
event DeegateAdded(uint64 indexed idDelegate);
|
||||||
|
@ -160,13 +166,16 @@ contract LiquidPledgingBase {
|
||||||
|
|
||||||
event DelegateUpdated(uint64 indexed idDelegate);
|
event DelegateUpdated(uint64 indexed idDelegate);
|
||||||
|
|
||||||
function addProject(string name, address projectManager, uint64 parentProject, uint64 commitTime, ILiquidPledgingPlugin plugin) {
|
function addProject(string name, address projectManager, uint64 parentProject, uint64 commitTime, ILiquidPledgingPlugin plugin) returns (uint64 idProject) {
|
||||||
if (parentProject != 0) {
|
if (parentProject != 0) {
|
||||||
NoteManager storage pm = findManager(parentProject);
|
NoteManager storage pm = findManager(parentProject);
|
||||||
require(pm.managerType == NoteManagerType.Project);
|
require(pm.managerType == NoteManagerType.Project);
|
||||||
require(pm.addr == msg.sender);
|
require(pm.addr == msg.sender);
|
||||||
require(getProjectLevel(pm) < MAX_SUBPROJECT_LEVEL);
|
require(getProjectLevel(pm) < MAX_SUBPROJECT_LEVEL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
idProject = uint64(managers.length);
|
||||||
|
|
||||||
managers.push(NoteManager(
|
managers.push(NoteManager(
|
||||||
NoteManagerType.Project,
|
NoteManagerType.Project,
|
||||||
projectManager,
|
projectManager,
|
||||||
|
@ -176,7 +185,8 @@ contract LiquidPledgingBase {
|
||||||
false,
|
false,
|
||||||
plugin));
|
plugin));
|
||||||
|
|
||||||
ProjectAdded(uint64(managers.length-1));
|
|
||||||
|
ProjectAdded(idProject);
|
||||||
}
|
}
|
||||||
|
|
||||||
event ProjectAdded(uint64 indexed idProject);
|
event ProjectAdded(uint64 indexed idProject);
|
||||||
|
|
|
@ -70,7 +70,10 @@ contract LiquidPledgingBase {
|
||||||
// Managers functions
|
// Managers functions
|
||||||
//////
|
//////
|
||||||
|
|
||||||
function addDonor(string name, uint64 commitTime, ILiquidPledgingPlugin plugin) {//Todo return idManager
|
function addDonor(string name, uint64 commitTime, ILiquidPledgingPlugin plugin) returns (uint64 idDonor) {//Todo return idManager
|
||||||
|
|
||||||
|
idDonor = uint64(managers.length);
|
||||||
|
|
||||||
managers.push(NoteManager(
|
managers.push(NoteManager(
|
||||||
NoteManagerType.Donor,
|
NoteManagerType.Donor,
|
||||||
msg.sender,
|
msg.sender,
|
||||||
|
@ -80,7 +83,7 @@ contract LiquidPledgingBase {
|
||||||
false,
|
false,
|
||||||
plugin));
|
plugin));
|
||||||
|
|
||||||
DonorAdded(uint64(managers.length-1));
|
DonorAdded(idDonor);
|
||||||
}
|
}
|
||||||
|
|
||||||
event DonorAdded(uint64 indexed idDonor);
|
event DonorAdded(uint64 indexed idDonor);
|
||||||
|
@ -104,7 +107,10 @@ contract LiquidPledgingBase {
|
||||||
|
|
||||||
event DonorUpdated(uint64 indexed idDonor);
|
event DonorUpdated(uint64 indexed idDonor);
|
||||||
|
|
||||||
function addDelegate(string name, uint64 commitTime, ILiquidPledgingPlugin plugin) { //TODO return index number
|
function addDelegate(string name, uint64 commitTime, ILiquidPledgingPlugin plugin) returns (uint64 idDelegate) { //TODO return index number
|
||||||
|
|
||||||
|
idDelegate = uint64(managers.length);
|
||||||
|
|
||||||
managers.push(NoteManager(
|
managers.push(NoteManager(
|
||||||
NoteManagerType.Delegate,
|
NoteManagerType.Delegate,
|
||||||
msg.sender,
|
msg.sender,
|
||||||
|
@ -114,7 +120,7 @@ contract LiquidPledgingBase {
|
||||||
false,
|
false,
|
||||||
plugin));
|
plugin));
|
||||||
|
|
||||||
DeegateAdded(uint64(managers.length-1));
|
DeegateAdded(idDelegate);
|
||||||
}
|
}
|
||||||
|
|
||||||
event DeegateAdded(uint64 indexed idDelegate);
|
event DeegateAdded(uint64 indexed idDelegate);
|
||||||
|
@ -137,13 +143,16 @@ contract LiquidPledgingBase {
|
||||||
|
|
||||||
event DelegateUpdated(uint64 indexed idDelegate);
|
event DelegateUpdated(uint64 indexed idDelegate);
|
||||||
|
|
||||||
function addProject(string name, address projectManager, uint64 parentProject, uint64 commitTime, ILiquidPledgingPlugin plugin) {
|
function addProject(string name, address projectManager, uint64 parentProject, uint64 commitTime, ILiquidPledgingPlugin plugin) returns (uint64 idProject) {
|
||||||
if (parentProject != 0) {
|
if (parentProject != 0) {
|
||||||
NoteManager storage pm = findManager(parentProject);
|
NoteManager storage pm = findManager(parentProject);
|
||||||
require(pm.managerType == NoteManagerType.Project);
|
require(pm.managerType == NoteManagerType.Project);
|
||||||
require(pm.addr == msg.sender);
|
require(pm.addr == msg.sender);
|
||||||
require(getProjectLevel(pm) < MAX_SUBPROJECT_LEVEL);
|
require(getProjectLevel(pm) < MAX_SUBPROJECT_LEVEL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
idProject = uint64(managers.length);
|
||||||
|
|
||||||
managers.push(NoteManager(
|
managers.push(NoteManager(
|
||||||
NoteManagerType.Project,
|
NoteManagerType.Project,
|
||||||
projectManager,
|
projectManager,
|
||||||
|
@ -153,7 +162,8 @@ contract LiquidPledgingBase {
|
||||||
false,
|
false,
|
||||||
plugin));
|
plugin));
|
||||||
|
|
||||||
ProjectAdded(uint64(managers.length-1));
|
|
||||||
|
ProjectAdded(idProject);
|
||||||
}
|
}
|
||||||
|
|
||||||
event ProjectAdded(uint64 indexed idProject);
|
event ProjectAdded(uint64 indexed idProject);
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "liquidpledging",
|
"name": "liquidpledging",
|
||||||
"version": "0.0.4",
|
"version": "0.0.5",
|
||||||
"description": "Liquid Pledging Smart Contract",
|
"description": "Liquid Pledging Smart Contract",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"directories": {
|
"directories": {
|
||||||
|
|
Loading…
Reference in New Issue