Skip to content

Commit

Permalink
fix(tokens): add correct settings after custom token created
Browse files Browse the repository at this point in the history
  • Loading branch information
arsenijesavic committed Sep 6, 2023
1 parent 182a504 commit 61a6ff6
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 22 deletions.
46 changes: 29 additions & 17 deletions src/components/dao/settings-tokens.vue
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ export default {
const [treasuryDigits, treasurySymbol] = this.daoSettings.settings_pegToken_a.split(' ')
const [utilityDigits, utilitySymbol] = this.daoSettings.settings_rewardToken_a.split(' ')
const [voiceDigits, voiceSymbol] = this.daoSettings.settings_voiceToken_a.split(' ')
const [utilityAmount] = this.daoSettings?.settings_rewardTokenMaxSupply_a?.split(' ')
this.tokens = {
// ...this.tokens,
Expand All @@ -113,7 +114,7 @@ export default {
utilitySymbol,
utilityDigits: utilityDigits.split('.')[1].length, // 1.0, 1.00, 1.000, // 1.0, 1.00, 1.000
utilityTokenMultiplier: this.daoSettings.settings_utilityTokenMultiplier_i,
utilityAmount: this.daoSettings.settings_rewardTokenMaxSupply_a, // i.e 100000 or -1 for infinite supply
utilityAmount: parseInt(utilityAmount) === -1 ? '∞' : utilityAmount, // i.e 100000 or -1 for infinite supply
// // utilityValue: '1', // The equivalent value of 1 token in USD
// // Voice token
Expand Down Expand Up @@ -145,18 +146,18 @@ export default {
}
},
immediate: true
},
'tokens.treasuryCurrency': {
handler: function (value) {
if (value) {
this.tokens.treasuryName = value?.name
this.tokens.treasurySymbol = value?.code
}
},
immediate: true
}
// 'tokens.treasuryCurrency': {
// handler: function (value) {
// if (value) {
// this.tokens.treasuryName = value?.name
// this.tokens.treasurySymbol = value?.code
// }
// },
// immediate: true
// }
}
}
Expand All @@ -180,11 +181,16 @@ export default {
.col-12.col-md-6
label.h-label {{ $t('configuration.settings-tokens.tresury.form.name.label') }}
q-input.q-my-xs(
:debounce="200"
:disable="selectedDao.hasCustomToken"
:filled="selectedDao.hasCustomToken"
:placeholder="$t('configuration.settings-tokens.utility.form.name.placeholder')"
:rules="[rules.required]"
color="accent"
dense
disable
filled
lazy-rules
outlined
ref="treasuryName"
rounded
v-model='tokens.treasuryName'
)
Expand All @@ -193,13 +199,19 @@ export default {
.col-12.col-md-6
label.h-label {{ $t('configuration.settings-tokens.tresury.form.symbol.label') }}
q-input.q-my-xs(
:rules="[rules.required]"
:debounce="200"
:disable="selectedDao.hasCustomToken"
:filled="selectedDao.hasCustomToken"
:placeholder="$t('configuration.settings-tokens.utility.form.symbol.placeholder')"
:rules="[rules.required, rules.isTokenAvailable]"
dense
disable
filled
lazy-rules
mask="AAAAAAAA"
maxlength="7"
outlined
ref="treasurySymbol"
rounded
v-model='tokens.treasurySymbol'
v-model="tokens.treasurySymbol"
)
q-tooltip(:content-style="{ 'font-size': '1em' }" anchor="top middle" self="bottom middle" v-if="!selectedDao.hasCustomToken") {{ $t('common.onlyDaoAdmins') }}
Expand Down
6 changes: 3 additions & 3 deletions src/pages/proposals/create/StepPayout.vue
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ export default {
},
computed: {
...mapGetters('dao', ['daoSettings']),
...mapGetters('dao', ['daoSettings', 'selectedDao']),
nextDisabled () {
const proposalType = this.$store.state.proposals.draft.category.key
Expand Down Expand Up @@ -407,15 +407,15 @@ widget(:class="{ 'disable-step': currentStepName !== 'step-payout' && $q.screen.
.row(v-if="isAssignment")
label.text-bold {{ toggle ? $t('pages.proposals.create.steppayout.compensationForOnePeriod') : $t('pages.proposals.create.steppayout.compensationForOneCycle') }}
.q-col-gutter-xs.q-mt-sm(:class="{ 'q-mt-xxl':$q.screen.lt.md || $q.screen.md, 'row':$q.screen.gt.md }")
.col-4(:class="{ 'q-mt-md':$q.screen.lt.md || $q.screen.md }" v-if="fields.reward")
.col-4(:class="{ 'q-mt-md':$q.screen.lt.md || $q.screen.md }" v-if="fields.reward && selectedDao.hasCustomToken")
label.h-label(v-if="$store.state.dao.settings.rewardToken !== 'HYPHA'") {{ `${fields.reward.label} (${$store.state.dao.settings.rewardToken})` }}
label.h-label(v-else) {{ `${fields.reward.label}` }}
.row.full-width.items-center.q-mt-xs
token-logo.q-mr-xs(size="40px" type="utility" :daoLogo="daoSettings.logo")
q-input.rounded-border.col(dense :readonly="!custom" outlined v-model="utilityToken" rounded v-if="isAssignment && !isFounderRole")
q-input.rounded-border.col(dense :readonly="!custom" outlined v-model="reward" rounded v-else)
.col-4(:class="{ 'q-mt-md':$q.screen.lt.md || $q.screen.md }" v-if="fields.peg")
label.h-label(v-if="$store.state.dao.settings.pegToken !== 'HUSD'") {{ `${fields.peg.label} (${$store.state.dao.settings.pegToken})` }}
label.h-label(v-if="$store.state.dao.settings.pegToken !== 'HUSD'") {{ `${fields.peg.label} ${$store.state.dao.settings.pegToken ? `(${$store.state.dao.settings.pegToken})`:''}`}}
label.h-label(v-else) {{ `${fields.peg.label}` }}
.row.full-width.items-center.q-mt-xs
token-logo.q-mr-xs(size="40px" type="cash" :daoLogo="daoSettings.logo")
Expand Down
4 changes: 2 additions & 2 deletions src/store/dao/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -1033,8 +1033,8 @@ export const createTokens = async function ({ state, rootState }, data) {
// voice token
[
{ label: 'content_group_label', value: ['string', 'voice_details'] },
{ label: 'voice_token_decay_period', value: ['int64', 604800] },
{ label: 'voice_token_decay_per_period_x10M', value: ['int64', 100000] },
{ label: 'voice_token_decay_period', value: ['int64', data?.voiceDecayPeriod] },
{ label: 'voice_token_decay_per_period_x10M', value: ['int64', data?.voiceDecayPercent] },
{ label: 'voice_token_multiplier', value: ['int64', data?.voiceTokenMultiplier] }
]
]
Expand Down

0 comments on commit 61a6ff6

Please sign in to comment.