Rename contributor to recipient
And remove addedBy entry.
This commit is contained in:
parent
7dba0e4501
commit
eadca6904a
@ -8,8 +8,7 @@ contract Reimbursement is AragonApp {
|
|||||||
bytes32 public constant VETO_REIMBURSEMENT_ROLE = keccak256("VETO_REIMBURSEMENT_ROLE");
|
bytes32 public constant VETO_REIMBURSEMENT_ROLE = keccak256("VETO_REIMBURSEMENT_ROLE");
|
||||||
|
|
||||||
struct ReimbursementData {
|
struct ReimbursementData {
|
||||||
address recordedBy;
|
uint32 recipientId;
|
||||||
uint32 contributorId;
|
|
||||||
uint256 amount;
|
uint256 amount;
|
||||||
address token;
|
address token;
|
||||||
bytes32 hashDigest;
|
bytes32 hashDigest;
|
||||||
@ -44,13 +43,12 @@ contract Reimbursement is AragonApp {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function get(uint32 reimbursementId) public view returns (uint32 id, address recordedBy, uint32 contributorId, uint256 amount, address token, bytes32 hashDigest, uint8 hashFunction, uint8 hashSize, uint256 confirmedAtBlock, bool exists, bool vetoed) {
|
function get(uint32 reimbursementId) public view returns (uint32 id, uint32 recipientId, uint256 amount, address token, bytes32 hashDigest, uint8 hashFunction, uint8 hashSize, uint256 confirmedAtBlock, bool exists, bool vetoed) {
|
||||||
id = reimbursementId;
|
id = reimbursementId;
|
||||||
ReimbursementData storage r = reimbursements[id];
|
ReimbursementData storage r = reimbursements[id];
|
||||||
return (
|
return (
|
||||||
id,
|
id,
|
||||||
r.recordedBy,
|
r.recipientId,
|
||||||
r.contributorId,
|
|
||||||
r.amount,
|
r.amount,
|
||||||
r.token,
|
r.token,
|
||||||
r.hashDigest,
|
r.hashDigest,
|
||||||
@ -62,14 +60,13 @@ contract Reimbursement is AragonApp {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function add(uint256 amount, address token, uint32 contributorId, bytes32 hashDigest, uint8 hashFunction, uint8 hashSize) public isInitialized auth(ADD_REIMBURSEMENT_ROLE) {
|
function add(uint256 amount, address token, uint32 recipientId, bytes32 hashDigest, uint8 hashFunction, uint8 hashSize) public isInitialized auth(ADD_REIMBURSEMENT_ROLE) {
|
||||||
uint32 reimbursementId = reimbursementsCount + 1;
|
uint32 reimbursementId = reimbursementsCount + 1;
|
||||||
ReimbursementData storage r = reimbursements[reimbursementId];
|
ReimbursementData storage r = reimbursements[reimbursementId];
|
||||||
r.recordedBy = msg.sender;
|
|
||||||
r.exists = true;
|
r.exists = true;
|
||||||
r.amount = amount;
|
r.amount = amount;
|
||||||
r.token = token;
|
r.token = token;
|
||||||
r.contributorId = contributorId;
|
r.recipientId = recipientId;
|
||||||
r.hashDigest = hashDigest;
|
r.hashDigest = hashDigest;
|
||||||
r.hashFunction = hashFunction;
|
r.hashFunction = hashFunction;
|
||||||
r.hashSize = hashSize;
|
r.hashSize = hashSize;
|
||||||
|
@ -23,7 +23,7 @@ class Reimbursement extends Record {
|
|||||||
async add (attrs, callOptions = {}) {
|
async add (attrs, callOptions = {}) {
|
||||||
const amount = parseInt(attrs.amount);
|
const amount = parseInt(attrs.amount);
|
||||||
const token = attrs.token;
|
const token = attrs.token;
|
||||||
const contributorId = attrs.contributorId;
|
const recipientId = attrs.recipientId;
|
||||||
const expenses = attrs.expenses.map( e => new ExpenseSerializer(e) );
|
const expenses = attrs.expenses.map( e => new ExpenseSerializer(e) );
|
||||||
let errorMessage;
|
let errorMessage;
|
||||||
|
|
||||||
@ -33,8 +33,8 @@ class Reimbursement extends Record {
|
|||||||
if (!token || token === '') {
|
if (!token || token === '') {
|
||||||
errorMessage = 'Invalid data: token must be a token address.';
|
errorMessage = 'Invalid data: token must be a token address.';
|
||||||
}
|
}
|
||||||
if (!contributorId || contributorId === '') {
|
if (!recipientId || recipientId === '') {
|
||||||
errorMessage = 'Invalid data: contributorId is required.';
|
errorMessage = 'Invalid data: recipientId is required.';
|
||||||
}
|
}
|
||||||
if (expenses.length === 0) {
|
if (expenses.length === 0) {
|
||||||
errorMessage = 'Invalid data: at least one expense item is required.';
|
errorMessage = 'Invalid data: at least one expense item is required.';
|
||||||
@ -50,7 +50,7 @@ class Reimbursement extends Record {
|
|||||||
const reimbursement = [
|
const reimbursement = [
|
||||||
amount,
|
amount,
|
||||||
token,
|
token,
|
||||||
parseInt(contributorId),
|
parseInt(recipientId),
|
||||||
ipfsHashAttr.hashDigest,
|
ipfsHashAttr.hashDigest,
|
||||||
ipfsHashAttr.hashFunction,
|
ipfsHashAttr.hashFunction,
|
||||||
ipfsHashAttr.hashSize,
|
ipfsHashAttr.hashSize,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user