Skip to content

Commit

Permalink
#3 added readable param description to voting
Browse files Browse the repository at this point in the history
  • Loading branch information
ryzhak committed Oct 25, 2018
1 parent ee10cf3 commit 9d59072
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ export class ReadableMethodParamPipe implements PipeTransform {
case "updateDaoParamsGeneric(bytes32[])":
// param name
if(index == 0) {
const readableParamName = this.devZenDaoService.getParamNameByHash(paramHex);
return `Param: ${readableParamName}`;
const paramInfo = this.devZenDaoService.getParamInfoByHash(paramHex);
return `Param: ${paramInfo.desc}`;
} else {
// param value
const paramValueInWei = this.web3Service.hexToNumberString(paramHex);
Expand Down
51 changes: 42 additions & 9 deletions src/app/shared/services/devzendao/devzendao.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -501,17 +501,50 @@ export class DevzendaoService {
/**
* Returns parameter name by hash
*/
getParamNameByHash(hash) {
getParamInfoByHash(hash) {
let name = null;
if(hash == this.PARAM_MINT_TOKENS_PER_WEEK_AMOUNT) return "mintTokensPerWeekAmount";
if(hash == this.PARAM_MINT_REPUTATION_TOKENS_PER_WEEK_AMOUNT) return "mintReputationTokensPerWeekAmount";
if(hash == this.PARAM_ONE_AD_SLOT_PRICE) return "oneAdSlotPrice";
if(hash == this.PARAM_ONE_TOKEN_PRICE_IN_WEI) return "oneTokenPriceInWei";
if(hash == this.PARAM_BECOME_GUEST_STAKE) return "becomeGuestStake";
if(hash == this.PARAM_REP_TOKENS_REWARD_HOST) return "repTokensRewardHost";
if(hash == this.PARAM_REP_TOKENS_REWARD_GUEST) return "repTokensRewardGuest";
if(hash == this.PARAM_REP_TOKENS_REWARD_TEAM_MEMBERS) return "repTokensRewardTeamMembers";
let desc = null;

if(hash == this.PARAM_MINT_TOKENS_PER_WEEK_AMOUNT) {
name = "mintTokensPerWeekAmount";
desc = "Amount of DZT created each week";
}
if(hash == this.PARAM_MINT_REPUTATION_TOKENS_PER_WEEK_AMOUNT) {
name = "mintReputationTokensPerWeekAmount";
desc = "Amount of DZTREP created each week";
}
if(hash == this.PARAM_ONE_AD_SLOT_PRICE) {
name = "oneAdSlotPrice";
desc = "Price for 1 ad slot in ETH";
}
if(hash == this.PARAM_ONE_TOKEN_PRICE_IN_WEI) {
name = "oneTokenPriceInWei";
desc = "Price for 1 DZT in ETH";
}
if(hash == this.PARAM_BECOME_GUEST_STAKE) {
name = "becomeGuestStake";
desc = "Guest stake in DZT";
}
if(hash == this.PARAM_REP_TOKENS_REWARD_HOST) {
name = "repTokensRewardHost";
desc = "Host reward for episode in DZTREP";
}
if(hash == this.PARAM_REP_TOKENS_REWARD_GUEST) {
name = "repTokensRewardGuest";
desc = "Guest reward for episode in DZTREP";
}
if(hash == this.PARAM_REP_TOKENS_REWARD_TEAM_MEMBERS) {
name = "repTokensRewardTeamMembers";
desc = "Reward of all team members for episode in DZTREP";
}

if(!name) throw Error(`param name not found for hash ${hash}`);
if(!desc) throw Error(`param desc not found for hash ${hash}`);

return {
name: name,
desc: desc
};
}

/**
Expand Down

0 comments on commit 9d59072

Please sign in to comment.