-
Notifications
You must be signed in to change notification settings - Fork 71
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Release Stabilisation Bugfixing 10 (#3641)
* 🪅 add word break (#3326) * add word break * add word-wrap for title Co-authored-by: Pasha Hliebov <p.hliebov@bsg.world> * 🥩 Fix Candidates Card "Staked" copy (#3338) * Fix: #2795 * Fix: Test Fix * 🔌 Refactor the api to easily switch between `ProxyApi` and `ApiRx` (#3385) Refactor `@/api` * ⏲️ Fix election/council remaining period timer (#3444) * Fix election/council remaining period clock * Fix tests * Fix one more test * 👮 Show moderated posts (#3420) * feat: Show moderated posts * fix: Moderated post stories args * fix: useForumThreadPosts error * ⚖️ Fix available staking balances (#3408) * New function to calc available balance for staking account * Apply of the new function * Small UI tweaks * Fix for same keys in bounty actors list * Update the SelectAccount balances * Update the getStakingBalance logic * Speed up `useMyBalances` * Fix the validation * Updating logic and corresponding UI * Always validate `balances.total` for staking * Validate AnnounceCandidacy including binding fees * Validate staking amounts including binding fee * Fix the ApplyForRoleModal tests Co-authored-by: WRadoslaw <r.wyszynski00@gmail.com> * 🗳️ Add a `node-mocks council:elect` for testing node (#3410) Add a `node-mocks council:elect` for testing node * 📄 Signal description copy change (#3193) * Update for staking amount validate * Fiexed:issue 3091 * update for issue 2770 * Reverse #2601 and #2770 fixes Co-authored-by: Theophile Sandoz <theophile.sandoz@gmail.com> * 🧵 Fixed datetime is not displayed for Forum thread (#3574) * Fixed datetime is not displayed for Forum thread * changed graphql for forumthreadinitialpost * removed unnecessary fields * changed quorum bar with council's size (#3595) * changed quorum bar with council's size fixed concilsize to denominator fixed used abstain for quorum & thresold added remain and abstain bar * added abstain slider in storybook Co-authored-by: Palllke2015 <palllke2015@gmail.com> Co-authored-by: Pasha Hliebov <p.hliebov@bsg.world> Co-authored-by: Akinsuyi Joshua <akinsuyi.joshua84@gmail.com> Co-authored-by: gyroflaw <83718263+gyroflaw@users.noreply.github.com> Co-authored-by: WRadoslaw <r.wyszynski00@gmail.com> Co-authored-by: Ken-tech-max <81464477+Ken-tech-max@users.noreply.github.com> Co-authored-by: Software Developer | Web, Blockchain & Desktop <69617937+mkbeefcake@users.noreply.github.com>
- Loading branch information
1 parent
e2fa256
commit 0214ffa
Showing
177 changed files
with
986 additions
and
448 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,56 +1,59 @@ | ||
import { ApiPromise } from '@polkadot/api' | ||
|
||
import { lockLookup } from '../../../../src/accounts/model/lockTypes' | ||
import { flatMapP, mapP } from '../../../../src/common/utils' | ||
import memberData from '../../../../src/mocks/data/raw/members.json' | ||
import { accountsMap } from '../../data/addresses' | ||
import { signAndSend, withApi } from '../../lib/api' | ||
import { createMembersCommand } from '../members/create' | ||
|
||
const announceCandidacies = async () => { | ||
await createMembersCommand() | ||
|
||
withApi(async (api) => { | ||
const candidateCount = api.consts.council.councilSize.toNumber() + 1 | ||
const announceStake = api.consts.council.minCandidateStake | ||
const members = memberData.slice(0, candidateCount) | ||
|
||
// Fund the empty accounts | ||
const requiredBalance = announceStake.add(api.consts.referendum.minimumStake).muln(1.5) // 1.5 extra margin for potential transaction fees | ||
const memberToFund = members.filter(({ boundAccounts }) => !boundAccounts?.length) | ||
const fundingTx = await flatMapP(memberToFund, async ({ controllerAccount: address }) => { | ||
const { data } = await api.query.system.account(address) | ||
return data.free.lt(requiredBalance) ? [api.tx.balances.transfer(address, requiredBalance)] : [] | ||
}) | ||
|
||
if (fundingTx.length > 0) { | ||
await signAndSend(api.tx.utility.batch(fundingTx), accountsMap.alice) | ||
} | ||
export const announceCandidaciesCommand = async (api: ApiPromise) => { | ||
const candidateCount = api.consts.council.councilSize.toNumber() + 1 | ||
const announceStake = api.consts.council.minCandidateStake | ||
const members = memberData.slice(0, candidateCount) | ||
|
||
// Fund the empty accounts | ||
const requiredBalance = announceStake.add(api.consts.referendum.minimumStake).muln(1.5) // 1.5 extra margin for potential transaction fees | ||
const memberToFund = members.filter(({ boundAccounts }) => !boundAccounts?.length) | ||
const fundingTx = await flatMapP(memberToFund, async ({ controllerAccount: address }) => { | ||
const { data } = await api.query.system.account(address) | ||
return data.free.lt(requiredBalance) ? [api.tx.balances.transfer(address, requiredBalance)] : [] | ||
}) | ||
|
||
// Announce candidacies | ||
await mapP(members, async ({ id, controllerAccount: address }) => { | ||
const stakingAccountInfoSize = await api.query.members.stakingAccountIdMemberStatus.size(address) | ||
|
||
if (stakingAccountInfoSize.isEmpty) { | ||
// Bind staking account | ||
await signAndSend(api.tx.members.addStakingAccountCandidate(id), address) | ||
// Confirm staking account | ||
await signAndSend(api.tx.members.confirmStakingAccount(id, address), address) | ||
} else { | ||
const locks = await api.query.balances.locks(address) | ||
|
||
if (locks.some(({ id }) => lockLookup(id) === 'Council Candidate')) { | ||
// Release stakes | ||
await signAndSend(api.tx.council.releaseCandidacyStake(id), address) | ||
} | ||
if (fundingTx.length > 0) { | ||
await signAndSend(api.tx.utility.batch(fundingTx), accountsMap.alice) | ||
} | ||
|
||
// Announce candidacies | ||
await mapP(members, async ({ id, controllerAccount: address }) => { | ||
const stakingAccountInfoSize = await api.query.members.stakingAccountIdMemberStatus.size(address) | ||
|
||
if (stakingAccountInfoSize.isEmpty) { | ||
// Bind staking account | ||
await signAndSend(api.tx.members.addStakingAccountCandidate(id), address) | ||
// Confirm staking account | ||
await signAndSend(api.tx.members.confirmStakingAccount(id, address), address) | ||
} else { | ||
const locks = await api.query.balances.locks(address) | ||
|
||
if (locks.some(({ id }) => lockLookup(id) === 'Council Candidate')) { | ||
// Release stakes | ||
await signAndSend(api.tx.council.releaseCandidacyStake(id), address) | ||
} | ||
} | ||
|
||
// Announce candidacy | ||
await signAndSend(api.tx.council.announceCandidacy(id, address, address, announceStake), address) | ||
}) | ||
// Announce candidacy | ||
await signAndSend(api.tx.council.announceCandidacy(id, address, address, announceStake), address) | ||
}) | ||
} | ||
|
||
const handler = async () => { | ||
await createMembersCommand() | ||
await withApi(announceCandidaciesCommand) | ||
} | ||
|
||
export const announceCandidaciesModule = { | ||
command: 'council:announce', | ||
describe: 'Announce council candidates', | ||
handler: announceCandidacies, | ||
handler: handler, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { nextCouncilStageCommand } from '../../../helpers/nextCouncilStage' | ||
import { withApi } from '../../lib/api' | ||
import { createMembersCommand } from '../members/create' | ||
|
||
import { announceCandidaciesCommand } from './announce' | ||
import { revealVotesCommand } from './reveal' | ||
import { castVotesCommand } from './vote' | ||
|
||
export const electCouncilModule = { | ||
command: 'council:elect', | ||
describe: 'Elect a full council', | ||
handler: async () => { | ||
await createMembersCommand() | ||
await withApi(async (api) => { | ||
await announceCandidaciesCommand(api) | ||
await nextCouncilStageCommand(api) | ||
await castVotesCommand(api) | ||
await nextCouncilStageCommand(api) | ||
await revealVotesCommand(api) | ||
}) | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,18 @@ | ||
import { ApiPromise } from '@polkadot/api' | ||
|
||
import { mapP } from '../../../../src/common/utils' | ||
import { signAndSend, withApi } from '../../lib/api' | ||
|
||
import { votes } from './vote' | ||
|
||
const revealVotes = () => | ||
withApi(async (api) => { | ||
await mapP(votes(api), ({ accountId, optionsId, salt }) => | ||
signAndSend(api.tx.referendum.revealVote(salt, optionsId), accountId) | ||
) | ||
}) | ||
export const revealVotesCommand = async (api: ApiPromise) => { | ||
await mapP(votes(api), ({ accountId, optionsId, salt }) => | ||
signAndSend(api.tx.referendum.revealVote(salt, optionsId), accountId) | ||
) | ||
} | ||
|
||
export const revealVotesModule = { | ||
command: 'council:reveal', | ||
describe: 'Reveal votes', | ||
handler: revealVotes, | ||
handler: () => withApi(revealVotesCommand), | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
.../ui/src/accounts/components/AccountItem/components/lockItems/CouncilCandidateLockItem.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
0214ffa
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
dao – ./
dao-joystream.vercel.app
dao.joystream.org
dao-git-main-joystream.vercel.app