From b1fe50b7d4469bc8f19a36e1d6896b3082d907d7 Mon Sep 17 00:00:00 2001 From: Danil Kovtonyuk Date: Mon, 9 May 2022 02:45:55 +1000 Subject: [PATCH] feat: propose by delegator --- components/governance/ProposalsList.vue | 4 ++-- store/governance/gov.js | 7 +++++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/components/governance/ProposalsList.vue b/components/governance/ProposalsList.vue index 1cadbbb..d3ccd92 100644 --- a/components/governance/ProposalsList.vue +++ b/components/governance/ProposalsList.vue @@ -59,7 +59,7 @@ export default { } }, computed: { - ...mapState('governance/gov', ['lockedBalance', 'proposals']), + ...mapState('governance/gov', ['votingPower', 'proposals']), ...mapGetters('governance/gov', ['isFetchingProposals', 'constants', 'isFetchingBalances']), ...mapGetters('token', ['toDecimals']), filteredProposals() { @@ -74,7 +74,7 @@ export default { }, hasProposalThreshold() { const PROPOSAL_THRESHOLD = toBN(this.constants.PROPOSAL_THRESHOLD) - return toBN(this.lockedBalance).gte(PROPOSAL_THRESHOLD) + return toBN(this.votingPower || 0).gte(PROPOSAL_THRESHOLD) }, proposalThreshold() { return this.toDecimals(this.constants.PROPOSAL_THRESHOLD, 18) diff --git a/store/governance/gov.js b/store/governance/gov.js index 1237f50..5382cb4 100644 --- a/store/governance/gov.js +++ b/store/governance/gov.js @@ -165,10 +165,13 @@ const actions = { const govInstance = getters.govContract({ netId }) const json = JSON.stringify({ title, description }) - const data = await govInstance.methods.propose(proposalAddress, json).encodeABI() + + const [delegator] = state.delegators + + const data = await govInstance.methods.proposeByDelegate(delegator, proposalAddress, json).encodeABI() const gas = await govInstance.methods - .propose(proposalAddress, json) + .proposeByDelegate(delegator, proposalAddress, json) .estimateGas({ from: ethAccount, value: 0 }) const callParams = {