Skip to content

Commit

Permalink
fix(tokens): tokens multipliers
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex-IS authored Sep 18, 2023
2 parents 466f16f + 5f3a45f commit 1f84a52
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 4 deletions.
14 changes: 13 additions & 1 deletion src/components/common/payout-amounts.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import { defineComponent } from 'vue'
import { PropType } from 'vue/types/v3-component-props'
import TokenValue from './token-value.vue'
import { TOKEN_TYPES } from '~/const'
type TokenProps = Omit<
InstanceType<typeof TokenValue>['$props'],
Expand Down Expand Up @@ -44,6 +45,17 @@ export default defineComponent({
} else {
return true
}
},
settingsMultiplier(label) {
switch (label) {
case TOKEN_TYPES.CASH_TOKEN:
return this.$store.state.dao.settings.settings_treasuryTokenMultiplier_i
case TOKEN_TYPES.VOICE_TOKEN:
return this.$store.state.dao.settings.settings_voiceTokenMultiplier_i
case TOKEN_TYPES.UTILITY_TOKEN:
return this.$store.state.dao.settings.settings_utilityTokenMultiplier_i
}
}
}
})
Expand All @@ -53,5 +65,5 @@ export default defineComponent({
.full-width(:class="{row: $q.platform.is.desktop}")
template(v-for="token in tokens")
.col(v-if="token.value" :class="{'col-12': stacked, 'q-mb-md': $q.platform.is.mobile}")
token-value(v-if="settingsHasToken(token.symbol)" :daoLogo="daoLogo" :multiplier="multiplier" v-bind="token")
token-value(v-if="settingsHasToken(token.symbol)" :daoLogo="daoLogo" :multiplier="settingsMultiplier(token.label)" v-bind="token")
</template>
6 changes: 6 additions & 0 deletions src/const.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,5 +91,11 @@ export const PERIOD_NUMBERS = Object.freeze({

export const DEFAULT_TIER = 'Custom Reward'

export const TOKEN_TYPES = Object.freeze({
CASH_TOKEN: 'Cash Token',
UTILITY_TOKEN: 'Utility Token',
VOICE_TOKEN: 'Voice Token'
})

export const MIN_TOKEN_MULTIPLIER = 0
export const MAX_TOKEN_MULTIPLIER = 1
6 changes: 3 additions & 3 deletions src/pages/proposals/create/StepPayout.vue
Original file line number Diff line number Diff line change
Expand Up @@ -265,13 +265,13 @@ export default {
return (this.cycleDurationSec / this.daoSettings.periodDurationSec).toFixed(2)
},
cashToken () {
return !this.toggle ? this.getFormatedTokenAmount(this.peg, Number.MAX_VALUE) : this.getFormatedTokenAmount((this.peg / this.periodsOnCycle).toFixed(2), Number.MAX_VALUE)
return !this.toggle ? this.getFormatedTokenAmount(this.peg * (this.$store.state.dao.settings.settings_treasuryTokenMultiplier_i ? this.$store.state.dao.settings.settings_treasuryTokenMultiplier_i : 1), Number.MAX_VALUE) : this.getFormatedTokenAmount((this.peg * (this.$store.state.dao.settings.settings_treasuryTokenMultiplier_i ? this.$store.state.dao.settings.settings_treasuryTokenMultiplier_i : 1) / this.periodsOnCycle).toFixed(2), Number.MAX_VALUE)
},
utilityToken () {
return !this.toggle ? this.getFormatedTokenAmount(this.reward, Number.MAX_VALUE) : this.getFormatedTokenAmount((this.reward / this.periodsOnCycle).toFixed(2), Number.MAX_VALUE)
return !this.toggle ? this.getFormatedTokenAmount(this.reward * (this.$store.state.dao.settings.settings_utilityTokenMultiplier_i ? this.$store.state.dao.settings.settings_utilityTokenMultiplier_i : 1), Number.MAX_VALUE) : this.getFormatedTokenAmount((this.reward * (this.$store.state.dao.settings.settings_utilityTokenMultiplier_i ? this.$store.state.dao.settings.settings_utilityTokenMultiplier_i : 1) / this.periodsOnCycle).toFixed(2), Number.MAX_VALUE)
},
voiceToken () {
return !this.toggle ? this.getFormatedTokenAmount(this.voice, Number.MAX_VALUE) : this.getFormatedTokenAmount((this.voice / this.periodsOnCycle).toFixed(2), Number.MAX_VALUE)
return !this.toggle ? this.getFormatedTokenAmount(this.voice * (this.$store.state.dao.settings.settings_voiceTokenMultiplier_i ? this.$store.state.dao.settings.settings_voiceTokenMultiplier_i : 1), Number.MAX_VALUE) : this.getFormatedTokenAmount((this.voice * (this.$store.state.dao.settings.settings_voiceTokenMultiplier_i ? this.$store.state.dao.settings.settings_voiceTokenMultiplier_i : 1) / this.periodsOnCycle).toFixed(2), Number.MAX_VALUE)
},
isAssignment () {
const proposalType = this.$store.state.proposals.draft.category.key
Expand Down

0 comments on commit 1f84a52

Please sign in to comment.