Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(tokens): add correct settings after custom token created #2422

Merged
merged 2 commits into from
Sep 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 29 additions & 24 deletions src/components/dao/settings-tokens.vue
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ export default {
utilityDigits: 2, // 1.0, 1.00, 1.000
utilityTokenMultiplier: 1,
utilityAmount: null, // i.e 100000 or -1 for infinite supply
// utilityValue: '1', // The equivalent value of 1 token in USD

// Voice token (aka voice_token = voiceDigits voiceSymbol)
voiceName: 'Voice Token',
Expand Down Expand Up @@ -95,26 +94,21 @@ 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,
treasuryName: this.daoSettings.settings_pegTokenName_s || treasurySymbol,
treasurySymbol,
treasuryDigits: treasuryDigits.split('.')[1].length, // 1.0, 1.00, 1.000
treasuryTokenMultiplier: this.daoSettings.settings_treasuryTokenMultiplier_i,
// treasuryCurrency: {
// label: `${currency.USD?.symbol} - ${currency.USD?.name}`,
// value: currency.USD.code,
// ...currency.USD
// },

// // Utility token
utilityName: this.daoSettings.settings_rewardTokenName_s || utilitySymbol,
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
// // utilityValue: '1', // The equivalent value of 1 token in USD
utilityAmount: parseInt(utilityAmount) === -1 ? '∞' : utilityAmount, // i.e 100000 or -1 for infinite supply

// // Voice token
voiceName: voiceSymbol,
Expand Down Expand Up @@ -145,18 +139,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': {
Alex-IS marked this conversation as resolved.
Show resolved Hide resolved
// handler: function (value) {
// if (value) {
// this.tokens.treasuryName = value?.name
// this.tokens.treasurySymbol = value?.code
// }
// },
// immediate: true
// }

}

}
Expand All @@ -180,11 +174,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 +192,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
Loading