Skip to content

Commit

Permalink
Merge branch 'develop' into feat/settings-plans-billing
Browse files Browse the repository at this point in the history
  • Loading branch information
arsenijesavic committed Sep 11, 2023
2 parents d56d923 + 15789e8 commit ce200f0
Show file tree
Hide file tree
Showing 32 changed files with 3,815 additions and 2,446 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/deploy-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@ jobs:
CAPTCHA_HOST: ${{ vars.CAPTCHA_HOST }}
CAPTCHA_NETWORK: ${{ vars.CAPTCHA_NETWORK }}
LOGIN_CONTRACT: ${{ vars.LOGIN_CONTRACT }}
JOIN_CONTRACT: ${{ vars.JOIN_CONTRACT }}
JOIN_URI: 'https://join.hypha.earth/'


- name: S3 sync
uses: jakejarvis/s3-sync-action@master
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/deploy-eos-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,9 @@ jobs:
CAPTCHA_NETWORK: ${{ vars.CAPTCHA_NETWORK }}
LOGIN_CONTRACT: ${{ vars.LOGIN_CONTRACT }}

JOIN_CONTRACT: ${{ vars.JOIN_CONTRACT }}
JOIN_URI: 'https://join.hypha.earth/'

- name: Deploy to S3 bucket
run: aws s3 sync ./dist/spa s3://${{ vars.AWS_S3_BUCKET}} --delete
- name: Invalidate CloudFront
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/deploy-eos-prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,9 @@ jobs:
CAPTCHA_NETWORK: ${{ vars.CAPTCHA_NETWORK }}
LOGIN_CONTRACT: ${{ vars.LOGIN_CONTRACT }}

JOIN_CONTRACT: ${{ vars.JOIN_CONTRACT }}
JOIN_URI: 'https://join.hypha.earth/'

- name: Deploy to S3 bucket
run: aws s3 sync ./dist/spa s3://${{ vars.AWS_S3_BUCKET}} --delete
- name: Invalidate CloudFront
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/deploy-prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@ jobs:
CAPTCHA_NETWORK: ${{ vars.CAPTCHA_NETWORK }}
LOGIN_CONTRACT: ${{ vars.LOGIN_CONTRACT }}

JOIN_CONTRACT: ${{ vars.JOIN_CONTRACT }}
JOIN_URI: 'https://join.hypha.earth/'

- name: S3 sync
uses: jakejarvis/s3-sync-action@master
with:
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/deploy-staging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ jobs:
CAPTCHA_HOST: ${{ vars.CAPTCHA_HOST }}
CAPTCHA_NETWORK: ${{ vars.CAPTCHA_NETWORK }}
LOGIN_CONTRACT: ${{ vars.LOGIN_CONTRACT }}
JOIN_CONTRACT: ${{ vars.JOIN_CONTRACT }}
JOIN_URI: 'https://join.hypha.earth/'

- name: S3 sync
uses: jakejarvis/s3-sync-action@master
Expand Down
4 changes: 3 additions & 1 deletion quasar.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,9 @@ module.exports = function (ctx) {
CAPTCHA_PUBLIC_KEY: process.env.CAPTCHA_PUBLIC_KEY,
CAPTCHA_HOST: process.env.CAPTCHA_HOST,
CAPTCHA_NETWORK: process.env.CAPTCHA_NETWORK || 'telosTestnet',
LOGIN_CONTRACT: process.env.LOGIN_CONTRACT
LOGIN_CONTRACT: process.env.LOGIN_CONTRACT,
JOIN_CONTRACT: process.env.JOIN_CONTRACT,
JOIN_URI: process.env.JOIN_URI
},

scopeHoisting: true,
Expand Down
11 changes: 6 additions & 5 deletions src/boot/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@ export default async ({ Vue, store }) => {
const contracts = {
dao: process.env.DAO_CONTRACT,
decide: process.env.DECIDE_CONTRACT,
hyphaToken: process.env.SUPPLY_CONTRACT,
hvoiceToken: process.env.HVOICE_TOKEN_CONTRACT,
hypha: process.env.HYPHA_CONTRACT,
seedsToken: process.env.SEEDS_TOKEN_CONTRACT,
seedsEscrow: process.env.SEEDS_ESCROW_CONTRACT,
tlostoSeeds: process.env.TLOSTO_SEEDS,
hyphaToken: process.env.SUPPLY_CONTRACT,
join: process.env.JOIN_CONTRACT,
kv: process.env.KV_CONTRACT,
hvoiceToken: process.env.HVOICE_TOKEN_CONTRACT
seedsEscrow: process.env.SEEDS_ESCROW_CONTRACT,
seedsToken: process.env.SEEDS_TOKEN_CONTRACT,
tlostoSeeds: process.env.TLOSTO_SEEDS
}

Vue.prototype.$config = {
Expand Down
101 changes: 57 additions & 44 deletions src/components/dao/settings-tokens.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,17 @@
import { mapActions, mapGetters } from 'vuex'
import { validation } from '~/mixins/validation'
import currency from 'src/data/currency.json'
import map from '~/utils/map'
const mapCurrency = (currency) => (_) => ({
label: `${currency[_]?.symbol} - ${currency[_]?.name}`,
value: currency[_].code,
...currency[_]
})
const MIN_DECAY = 0
const MAX_DECAY = 10000000
export default {
name: 'settings-token',
mixins: [validation],
Expand All @@ -32,7 +36,6 @@ export default {
data () {
return {
tokens: {
// Treasury token (aka peg_token = treasuryDigits treasurySymbol)
treasuryName: null,
Expand All @@ -51,7 +54,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 @@ -81,7 +83,10 @@ export default {
try {
const isValid = await this.validate(this.tokens)
if (isValid) {
await this.createTokens({ ...this.tokens })
await this.createTokens({
...this.tokens,
voiceDecayPercent: map(this.tokens.voiceDecayPercent, 0, 100, MIN_DECAY, MAX_DECAY)
})
}
} catch (e) {
const message = e.message || e.cause.message
Expand All @@ -95,34 +100,29 @@ 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,
voiceSymbol,
voiceDigits: voiceDigits.split('.')[1].length,
voiceTokenMultiplier: this.daoSettings.settings_voiceTokenMultiplier_i,
voiceDecayPeriod: this.daoSettings.settings_voiceTokenDecayPeriod_i,
voiceDecayPercent: this.daoSettings.settings_voiceTokenDecayPerPeriodX10M_i
voiceDecayPercent: map(this.daoSettings.settings_voiceTokenDecayPerPeriodX10M_i, MIN_DECAY, MAX_DECAY, 0, 100)
}
}
Expand All @@ -145,18 +145,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 +180,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 +198,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 Expand Up @@ -241,7 +252,7 @@ export default {
.col-12
label.h-label {{ $t('configuration.settings-tokens.tresury.form.digits.label') }}
input-slider(
:disable="selectedDao.hasCustomToken"
:disable="selectedDao.hasCustomToken || !isAdmin"
:max="3"
:maxLabel="$t('configuration.settings-tokens.tresury.form.digits.morePrecise')"
:min="1"
Expand All @@ -262,8 +273,8 @@ export default {
label.h-label {{ $t('configuration.settings-tokens.utility.form.name.label') }}
q-input.q-my-xs(
:debounce="200"
:disable="selectedDao.hasCustomToken"
:filled="selectedDao.hasCustomToken"
:disable="selectedDao.hasCustomToken || !isAdmin"
:filled="selectedDao.hasCustomToken || !isAdmin"
:placeholder="$t('configuration.settings-tokens.utility.form.name.placeholder')"
:rules="[rules.required]"
color="accent"
Expand All @@ -280,8 +291,8 @@ export default {
label.h-label {{ $t('configuration.settings-tokens.utility.form.symbol.label') }}
q-input.q-my-xs(
:debounce="200"
:disable="selectedDao.hasCustomToken"
:filled="selectedDao.hasCustomToken"
:disable="selectedDao.hasCustomToken || !isAdmin"
:filled="selectedDao.hasCustomToken || !isAdmin"
:placeholder="$t('configuration.settings-tokens.utility.form.symbol.placeholder')"
:rules="[rules.required, rules.isTokenAvailable]"
dense
Expand All @@ -299,8 +310,8 @@ export default {
label.h-label {{ $t('configuration.settings-tokens.utility.form.value.label') }}
q-input.q-my-xs(
:debounce="200"
:disable="selectedDao.hasCustomToken"
:filled="selectedDao.hasCustomToken"
:disable="selectedDao.hasCustomToken || !isAdmin"
:filled="selectedDao.hasCustomToken || !isAdmin"
:placeholder="$t('configuration.settings-tokens.utility.form.value.placeholder')"
:rules="[rules.requiredIf(tokens.utilityAmount > 0)]"
color="accent"
Expand All @@ -317,8 +328,8 @@ export default {
label.h-label {{ $t('configuration.settings-tokens.utility.form.multiplier.label') }}
q-input.q-my-xs(
:debounce="200"
:disable="selectedDao.hasCustomToken"
:filled="selectedDao.hasCustomToken"
:disable="selectedDao.hasCustomToken || !isAdmin"
:filled="selectedDao.hasCustomToken || !isAdmin"
:rules="[rules.required]"
color="accent"
dense
Expand All @@ -334,7 +345,7 @@ export default {
.col-12
label.h-label {{ $t('configuration.settings-tokens.utility.form.digits.label') }}
input-slider(
:disable="selectedDao.hasCustomToken"
:disable="selectedDao.hasCustomToken || !isAdmin"
:max="3"
:maxLabel="$t('configuration.settings-tokens.tresury.form.digits.morePrecise')"
:min="1"
Expand Down Expand Up @@ -384,17 +395,19 @@ export default {
.row.q-col-gutter-md
.col-12.col-md-8(:class="{'q-mt-sm': !$q.screen.gt.md}")
label.h-label {{ $t('configuration.settings-tokens.voice.form.decayPeriod.label') }}
custom-period-input.q-my-xs(:disable="selectedDao.hasCustomToken" v-model='tokens.voiceDecayPeriod')
custom-period-input.q-my-xs(:disable="selectedDao.hasCustomToken || !isAdmin" v-model='tokens.voiceDecayPeriod')
q-tooltip(:content-style="{ 'font-size': '1em' }" anchor="top middle" self="bottom middle" v-if="!selectedDao.hasCustomToken") {{ $t('common.onlyDaoAdmins') }}
.col-12.col-md-4(:class="{'q-mt-sm': !$q.screen.gt.md}")
label.h-label {{ $t('configuration.settings-tokens.voice.form.decayPercent.label') }}
q-input.q-my-xs(
:debounce="200"
:disable="selectedDao.hasCustomToken"
:filled="selectedDao.hasCustomToken"
:disable="selectedDao.hasCustomToken || !isAdmin"
:filled="selectedDao.hasCustomToken || !isAdmin"
:max="100"
:min="0"
:placeholder="$t('configuration.settings-tokens.voice.form.decayPercent.placeholder')"
:rules="[rules.required]"
:rules="[rules.required, rules.greaterThan(0), rules.lessOrEqualThan(100)]"
color="accent"
dense
lazy-rules
Expand All @@ -411,8 +424,8 @@ export default {
label.h-label {{ $t('configuration.settings-tokens.voice.form.multiplier.label') }}
q-input.q-my-xs(
:debounce="200"
:disable="selectedDao.hasCustomToken"
:filled="selectedDao.hasCustomToken"
:disable="selectedDao.hasCustomToken || !isAdmin"
:filled="selectedDao.hasCustomToken || !isAdmin"
:rules="[rules.required]"
color="accent"
dense
Expand All @@ -428,7 +441,7 @@ export default {
.col-12
label.h-label {{ $t('configuration.settings-tokens.voice.form.digits.label') }}
input-slider(
:disable="selectedDao.hasCustomToken"
:disable="selectedDao.hasCustomToken || !isAdmin"
:max="3"
:maxLabel="$t('configuration.settings-tokens.tresury.form.digits.morePrecise')"
:min="1"
Expand Down
Loading

0 comments on commit ce200f0

Please sign in to comment.