Add getContributorById
Similiar to directly accessing the contributors mapping this method also returns the balance of the contributor.
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
pragma solidity ^0.4.18;
|
||||
|
||||
// import basic ERC20 details to be able to call balanceOf
|
||||
import 'zeppelin-solidity/contracts/token/ERC20/ERC20Basic.sol';
|
||||
import './upgradeable/Upgradeable.sol';
|
||||
|
||||
contract Contributors is Upgradeable {
|
||||
@@ -105,4 +107,17 @@ contract Contributors is Upgradeable {
|
||||
uint id = contributorIds[_address];
|
||||
return contributors[id];
|
||||
}
|
||||
|
||||
function getContributorById(uint _id) view returns (address account, bytes32 profileHash, uint8 hashFunction, uint8 hashSize, bool isCore, bool exists, uint balance ) {
|
||||
Contributor c = contributors[_id];
|
||||
account = c.account;
|
||||
profileHash = c.profileHash;
|
||||
hashFunction = c.hashFunction;
|
||||
hashSize = c.hashSize;
|
||||
isCore = c.isCore;
|
||||
exists = c.exists;
|
||||
|
||||
ERC20Basic token = ERC20Basic(registry.getProxyFor('Token'));
|
||||
balance = token.balanceOf(account);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user