diff --git a/src/query/main-dho.gql b/src/query/main-dho.gql index 7e150ba97..31c19d705 100644 --- a/src/query/main-dho.gql +++ b/src/query/main-dho.gql @@ -7,6 +7,7 @@ query dho { settings_governanceTokenContract_n settings_voiceToken_a settings_logo_s + contract } } -} \ No newline at end of file +} diff --git a/src/store/dao/actions.js b/src/store/dao/actions.js index 1210f19a1..55c09ccd1 100644 --- a/src/store/dao/actions.js +++ b/src/store/dao/actions.js @@ -275,8 +275,10 @@ export const downgradeDAOPlan = async function (context, daoId) { } export const isTokenAvailable = async function (context, token) { + const dho = this.getters['dao/dho'] + const pegContract = dho.settings[0].settings_pegTokenContract_n const { rows } = await this.$api.getTableRows({ - code: this.$config.contracts.husdToken, + code: pegContract, scope: token, table: 'stat', limit: 500, diff --git a/src/store/payments/actions.js b/src/store/payments/actions.js index 5e452c44b..3fc162451 100644 --- a/src/store/payments/actions.js +++ b/src/store/payments/actions.js @@ -92,24 +92,29 @@ export const fetchRedemptions = async function ({ commit, state }, { account }) } export const redeemToken = async function ({ rootState }, { quantity, memo }) { + const selectedDao = this.getters['dao/selectedDao'] + if (!selectedDao.docId) return + const dho = this.getters['dao/dho'] + const pegContract = dho.settings[0].settings_pegTokenContract_n + const mainContract = dho.settings[0].contract const actions = [ { - account: this.$config.contracts.husdToken, + account: pegContract, name: 'transfer', data: { from: rootState.accounts.account, - to: this.$config.contracts.treasury, + to: mainContract, quantity, - memo + memo: 'redeem' } }, { - account: this.$config.contracts.treasury, + account: mainContract, name: 'redeem', data: { - redeemer: rootState.accounts.account, - amount: quantity, - notes: [] + dao_id: selectedDao.docId, + requestor: rootState.accounts.account, + amount: quantity } } ] @@ -140,9 +145,11 @@ export const redeemAddress = async function ({ rootState }) { } export const buySeeds = async function ({ rootState }, quantity) { + const dho = this.getters['dao/dho'] + const pegContract = dho.settings[0].settings_pegTokenCon const actions = [ { - account: this.$config.contracts.husdToken, + account: pegContract, name: 'transfer', data: { from: rootState.accounts.account, @@ -156,15 +163,17 @@ export const buySeeds = async function ({ rootState }, quantity) { } export const buyHypha = async function ({ rootState }, quantity) { + const dho = this.getters['dao/dho'] + const pegContract = dho.settings[0].settings_pegTokenCon const actions = [ { - account: this.$config.contracts.husdToken, + account: pegContract, name: 'transfer', data: { from: rootState.accounts.account, to: this.$config.contracts.dao, quantity, - memo: 'DHO Buy Hypha' + memo: 'buy' } } ]