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): tokens multipliers #2439

Merged
merged 4 commits into from
Sep 18, 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
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
Loading