Rename recipientId to contributorId in Operator

This commit is contained in:
bumi 2018-04-15 19:58:28 +02:00
parent 00a7a4e511
commit d7c8ee46bd

View File

@ -8,7 +8,7 @@ contract Operator is Upgradeable {
struct Proposal {
address creatorAccount;
uint recipientId;
uint contributorId;
uint votesCount;
uint votesNeeded;
uint256 amount;
@ -24,9 +24,9 @@ contract Operator is Upgradeable {
mapping(uint256 => Proposal) public proposals;
uint256 public proposalsCount;
event ProposalCreated(uint256 id, address creatorAccount, uint256 recipientId, uint256 amount);
event ProposalVoted(uint256 id, uint256 contributorId, uint256 totalVotes);
event ProposalExecuted(uint256 id, uint256 recipientId, uint256 amount);
event ProposalCreated(uint256 id, address creatorAccount, uint256 contributorId, uint256 amount);
event ProposalVoted(uint256 id, uint256 voterId, uint256 totalVotes);
event ProposalExecuted(uint256 id, uint256 contributorId, uint256 amount);
modifier coreOnly() {
require(contributorsContract().addressIsCore(msg.sender));
@ -55,15 +55,15 @@ contract Operator is Upgradeable {
return contributorsContract().coreContributorsCount();
}
function addProposal(uint recipientId, uint256 amount, bytes32 ipfsHash, uint8 hashFunction, uint8 hashSize) public {
require(contributorsContract().exists(recipientId));
function addProposal(uint contributorId, uint256 amount, bytes32 ipfsHash, uint8 hashFunction, uint8 hashSize) public {
require(contributorsContract().exists(contributorId));
uint256 proposalId = proposalsCount + 1;
uint256 _votesNeeded = contributorsContract().coreContributorsCount() / 100 * 75;
var p = proposals[proposalId];
p.creatorAccount = msg.sender;
p.recipientId = recipientId;
p.contributorId = contributorId;
p.amount = amount;
p.ipfsHash = ipfsHash;
p.hashFunction = hashFunction;
@ -73,16 +73,16 @@ contract Operator is Upgradeable {
p.exists = true;
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;
Proposal storage p = proposals[id];
return (
id,
p.creatorAccount,
p.recipientId,
p.contributorId,
p.votesCount,
p.votesNeeded,
p.amount,
@ -114,10 +114,10 @@ contract Operator is Upgradeable {
var p = proposals[proposalId];
require(!p.executed);
require(p.votesCount >= p.votesNeeded);
address recipientAddress = contributorsContract().getContributorAddressById(p.recipientId);
address recipientAddress = contributorsContract().getContributorAddressById(p.contributorId);
tokenContract().mintFor(recipientAddress, p.amount, proposalId);
p.executed = true;
ProposalExecuted(proposalId, p.recipientId, p.amount);
ProposalExecuted(proposalId, p.contributorId, p.amount);
}
}