Naming is hard
This commit is contained in:
parent
7967dc26f2
commit
ad034d7712
@ -118,7 +118,7 @@ contract Contribution is AragonApp {
|
||||
// Custom functions
|
||||
//
|
||||
|
||||
function totalCount(bool confirmedOnly) public view returns (uint256 count) {
|
||||
function totalKreditsEarned(bool confirmedOnly) public view returns (uint256 count) {
|
||||
for (uint32 i = 1; i <= contributionsCount; i++) {
|
||||
ContributionData memory c = contributions[i];
|
||||
if (block.number >= c.confirmedAtBlock || !confirmedOnly) {
|
||||
@ -127,7 +127,7 @@ contract Contribution is AragonApp {
|
||||
}
|
||||
}
|
||||
|
||||
function contributorTotalCount(uint32 contributorId, bool confirmedOnly) public view returns (uint256 count) {
|
||||
function totalKreditsEarnedByContributor(uint32 contributorId, bool confirmedOnly) public view returns (uint256 count) {
|
||||
uint256 tokenBalance = ownedContributions[contributorId].length;
|
||||
for (uint256 i = 0; i < tokenBalance; i++) {
|
||||
uint32 cId = ownedContributions[contributorId][i];
|
||||
|
@ -7,7 +7,7 @@ interface ITokenBalance {
|
||||
function balanceOf(address contributorAccount) public view returns (uint256);
|
||||
}
|
||||
interface IContributionBalance {
|
||||
function contributorTotalCount(uint32 contributorId, bool confirmedOnly) public view returns (uint256 count);
|
||||
function totalKreditsEarnedByContributor(uint32 contributorId, bool confirmedOnly) public view returns (uint256 count);
|
||||
function balanceOf(address owner) public view returns (uint256);
|
||||
}
|
||||
|
||||
@ -128,7 +128,7 @@ contract Contributor is AragonApp {
|
||||
return contributors[id];
|
||||
}
|
||||
|
||||
function getContributorById(uint32 _id) public view returns (uint32 id, address account, bytes32 hashDigest, uint8 hashFunction, uint8 hashSize, bool isCore, uint256 balance, uint256 contributionBalance, uint256 contributionsCount, bool exists ) {
|
||||
function getContributorById(uint32 _id) public view returns (uint32 id, address account, bytes32 hashDigest, uint8 hashFunction, uint8 hashSize, bool isCore, uint256 balance, uint256 totalKreditsEarned, uint256 contributionsCount, bool exists ) {
|
||||
id = _id;
|
||||
Contributor storage c = contributors[_id];
|
||||
account = c.account;
|
||||
@ -139,7 +139,7 @@ contract Contributor is AragonApp {
|
||||
address token = getTokenContract();
|
||||
balance = ITokenBalance(token).balanceOf(c.account);
|
||||
address contribution = getContributionContract();
|
||||
contributionBalance = IContributionBalance(contribution).contributorTotalCount(_id, true);
|
||||
totalKreditsEarned = IContributionBalance(contribution).totalKreditsEarnedByContributor(_id, true);
|
||||
contributionsCount = IContributionBalance(contribution).balanceOf(c.account);
|
||||
exists = c.exists;
|
||||
}
|
||||
|
@ -17,7 +17,7 @@ module.exports = async function(callback) {
|
||||
|
||||
|
||||
const table = new Table({
|
||||
head: ['ID', 'Account', 'Name', 'Core?', 'Balance', 'IPFS']
|
||||
head: ['ID', 'Account', 'Name', 'Core?', 'Balance', 'Kredits earned', 'Contributions count', 'IPFS']
|
||||
})
|
||||
|
||||
let contributors = await kredits.Contributor.all()
|
||||
@ -29,6 +29,8 @@ module.exports = async function(callback) {
|
||||
`${c.name}`,
|
||||
c.isCore,
|
||||
ethers.utils.formatEther(c.balance),
|
||||
c.totalKreditsEarned.toString(),
|
||||
c.contributionsCount.toString(),
|
||||
c.ipfsHash
|
||||
])
|
||||
})
|
||||
|
Loading…
x
Reference in New Issue
Block a user