Rename recipientId to contributorId in Operator
This commit is contained in:
parent
00a7a4e511
commit
d7c8ee46bd
@ -8,7 +8,7 @@ contract Operator is Upgradeable {
|
|||||||
|
|
||||||
struct Proposal {
|
struct Proposal {
|
||||||
address creatorAccount;
|
address creatorAccount;
|
||||||
uint recipientId;
|
uint contributorId;
|
||||||
uint votesCount;
|
uint votesCount;
|
||||||
uint votesNeeded;
|
uint votesNeeded;
|
||||||
uint256 amount;
|
uint256 amount;
|
||||||
@ -24,9 +24,9 @@ contract Operator is Upgradeable {
|
|||||||
mapping(uint256 => Proposal) public proposals;
|
mapping(uint256 => Proposal) public proposals;
|
||||||
uint256 public proposalsCount;
|
uint256 public proposalsCount;
|
||||||
|
|
||||||
event ProposalCreated(uint256 id, address creatorAccount, uint256 recipientId, uint256 amount);
|
event ProposalCreated(uint256 id, address creatorAccount, uint256 contributorId, uint256 amount);
|
||||||
event ProposalVoted(uint256 id, uint256 contributorId, uint256 totalVotes);
|
event ProposalVoted(uint256 id, uint256 voterId, uint256 totalVotes);
|
||||||
event ProposalExecuted(uint256 id, uint256 recipientId, uint256 amount);
|
event ProposalExecuted(uint256 id, uint256 contributorId, uint256 amount);
|
||||||
|
|
||||||
modifier coreOnly() {
|
modifier coreOnly() {
|
||||||
require(contributorsContract().addressIsCore(msg.sender));
|
require(contributorsContract().addressIsCore(msg.sender));
|
||||||
@ -55,15 +55,15 @@ contract Operator is Upgradeable {
|
|||||||
return contributorsContract().coreContributorsCount();
|
return contributorsContract().coreContributorsCount();
|
||||||
}
|
}
|
||||||
|
|
||||||
function addProposal(uint recipientId, uint256 amount, bytes32 ipfsHash, uint8 hashFunction, uint8 hashSize) public {
|
function addProposal(uint contributorId, uint256 amount, bytes32 ipfsHash, uint8 hashFunction, uint8 hashSize) public {
|
||||||
require(contributorsContract().exists(recipientId));
|
require(contributorsContract().exists(contributorId));
|
||||||
|
|
||||||
uint256 proposalId = proposalsCount + 1;
|
uint256 proposalId = proposalsCount + 1;
|
||||||
uint256 _votesNeeded = contributorsContract().coreContributorsCount() / 100 * 75;
|
uint256 _votesNeeded = contributorsContract().coreContributorsCount() / 100 * 75;
|
||||||
|
|
||||||
var p = proposals[proposalId];
|
var p = proposals[proposalId];
|
||||||
p.creatorAccount = msg.sender;
|
p.creatorAccount = msg.sender;
|
||||||
p.recipientId = recipientId;
|
p.contributorId = contributorId;
|
||||||
p.amount = amount;
|
p.amount = amount;
|
||||||
p.ipfsHash = ipfsHash;
|
p.ipfsHash = ipfsHash;
|
||||||
p.hashFunction = hashFunction;
|
p.hashFunction = hashFunction;
|
||||||
@ -73,16 +73,16 @@ contract Operator is Upgradeable {
|
|||||||
p.exists = true;
|
p.exists = true;
|
||||||
|
|
||||||
proposalsCount++;
|
proposalsCount++;
|
||||||
ProposalCreated(proposalId, msg.sender, p.recipientId, p.amount);
|
ProposalCreated(proposalId, msg.sender, p.contributorId, p.amount);
|
||||||
}
|
}
|
||||||
|
|
||||||
function getProposal(uint proposalId) public view returns (uint256 id, address creatorAccount, uint256 recipientId, uint256 votesCount, uint256 votesNeeded, uint256 amount, bool executed, bytes32 ipfsHash, uint8 hashFunction, uint8 hashSize, uint256[] voterIds, bool exists) {
|
function getProposal(uint proposalId) public view returns (uint256 id, address creatorAccount, uint256 contributorId, uint256 votesCount, uint256 votesNeeded, uint256 amount, bool executed, bytes32 ipfsHash, uint8 hashFunction, uint8 hashSize, uint256[] voterIds, bool exists) {
|
||||||
id = proposalId;
|
id = proposalId;
|
||||||
Proposal storage p = proposals[id];
|
Proposal storage p = proposals[id];
|
||||||
return (
|
return (
|
||||||
id,
|
id,
|
||||||
p.creatorAccount,
|
p.creatorAccount,
|
||||||
p.recipientId,
|
p.contributorId,
|
||||||
p.votesCount,
|
p.votesCount,
|
||||||
p.votesNeeded,
|
p.votesNeeded,
|
||||||
p.amount,
|
p.amount,
|
||||||
@ -114,10 +114,10 @@ contract Operator is Upgradeable {
|
|||||||
var p = proposals[proposalId];
|
var p = proposals[proposalId];
|
||||||
require(!p.executed);
|
require(!p.executed);
|
||||||
require(p.votesCount >= p.votesNeeded);
|
require(p.votesCount >= p.votesNeeded);
|
||||||
address recipientAddress = contributorsContract().getContributorAddressById(p.recipientId);
|
address recipientAddress = contributorsContract().getContributorAddressById(p.contributorId);
|
||||||
tokenContract().mintFor(recipientAddress, p.amount, proposalId);
|
tokenContract().mintFor(recipientAddress, p.amount, proposalId);
|
||||||
p.executed = true;
|
p.executed = true;
|
||||||
ProposalExecuted(proposalId, p.recipientId, p.amount);
|
ProposalExecuted(proposalId, p.contributorId, p.amount);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user