Skip to content

Commit

Permalink
fix: Update peg contract (#1825)
Browse files Browse the repository at this point in the history
* fix: update peg contract
* fix: Add requestor param
  • Loading branch information
pugakn authored Nov 15, 2022
1 parent 32422a8 commit cab51b1
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 12 deletions.
3 changes: 2 additions & 1 deletion src/query/main-dho.gql
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ query dho {
settings_governanceTokenContract_n
settings_voiceToken_a
settings_logo_s
contract
}
}
}
}
4 changes: 3 additions & 1 deletion src/store/dao/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
29 changes: 19 additions & 10 deletions src/store/payments/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
]
Expand Down Expand Up @@ -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,
Expand All @@ -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'
}
}
]
Expand Down

0 comments on commit cab51b1

Please sign in to comment.