feat: propose by delegator

This commit is contained in:
Danil Kovtonyuk 2022-05-09 02:45:55 +10:00
parent a1c3acb1fc
commit b1fe50b7d4
No known key found for this signature in database
GPG Key ID: E72A919BF08C3746
2 changed files with 7 additions and 4 deletions

View File

@ -59,7 +59,7 @@ export default {
} }
}, },
computed: { computed: {
...mapState('governance/gov', ['lockedBalance', 'proposals']), ...mapState('governance/gov', ['votingPower', 'proposals']),
...mapGetters('governance/gov', ['isFetchingProposals', 'constants', 'isFetchingBalances']), ...mapGetters('governance/gov', ['isFetchingProposals', 'constants', 'isFetchingBalances']),
...mapGetters('token', ['toDecimals']), ...mapGetters('token', ['toDecimals']),
filteredProposals() { filteredProposals() {
@ -74,7 +74,7 @@ export default {
}, },
hasProposalThreshold() { hasProposalThreshold() {
const PROPOSAL_THRESHOLD = toBN(this.constants.PROPOSAL_THRESHOLD) const PROPOSAL_THRESHOLD = toBN(this.constants.PROPOSAL_THRESHOLD)
return toBN(this.lockedBalance).gte(PROPOSAL_THRESHOLD) return toBN(this.votingPower || 0).gte(PROPOSAL_THRESHOLD)
}, },
proposalThreshold() { proposalThreshold() {
return this.toDecimals(this.constants.PROPOSAL_THRESHOLD, 18) return this.toDecimals(this.constants.PROPOSAL_THRESHOLD, 18)

View File

@ -165,10 +165,13 @@ const actions = {
const govInstance = getters.govContract({ netId }) const govInstance = getters.govContract({ netId })
const json = JSON.stringify({ title, description }) 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 const gas = await govInstance.methods
.propose(proposalAddress, json) .proposeByDelegate(delegator, proposalAddress, json)
.estimateGas({ from: ethAccount, value: 0 }) .estimateGas({ from: ethAccount, value: 0 })
const callParams = { const callParams = {