diff --git a/builders/pallets-precompiles/pallets/.pages b/builders/pallets-precompiles/pallets/.pages index 11fa46f44..26201ef29 100644 --- a/builders/pallets-precompiles/pallets/.pages +++ b/builders/pallets-precompiles/pallets/.pages @@ -3,6 +3,7 @@ nav: - index.md - 'Democracy': 'democracy.md' - 'Parachain Staking': 'staking.md' + - 'Preimage': 'preimage.md' - 'Proxy': 'proxy.md' - 'Randomness': 'randomness.md' - 'Utility': 'utility.md' diff --git a/builders/pallets-precompiles/pallets/democracy.md b/builders/pallets-precompiles/pallets/democracy.md index 197781ee5..bf9efd299 100644 --- a/builders/pallets-precompiles/pallets/democracy.md +++ b/builders/pallets-precompiles/pallets/democracy.md @@ -16,18 +16,22 @@ Some of the functionality of the democracy pallet is also available through a de This guide will provide an overview of the extrinsics, storage methods, and getters for the pallet constants available in the democracy pallet on Moonbeam. -## Democracy Pallet Interface {: #parachain-staking-pallet-interface } +## Democracy Pallet Interface {: #democracy-pallet-interface } ### Extrinsics {: #extrinsics } The democracy pallet provides the following extrinsics (functions): - **delegate**(to, conviction, balance) - delegates the voting power, with some given conviction, of the sending account to a given account. The balance delegated is locked for as long as it's delegated, and thereafter for the time appropriate for the conviction's lock period. The sending account must be delegating already or have no voting activity. Emits a `Delegated` event -- **enactProposal**(proposalHash, index) - enacts a proposal from a referendum given the proposal hash and the index of the referendum -- **noteImminentPreimage**(encodedProposal) - registers a preimage for an upcoming proposal in the dispatch queue given the encoded preimage of a proposal. Emits a `PreimageNoted` event -- **notePreimage**(encodedProposal) - registers a preimage for an upcoming proposal given the encoded preimage of a proposal. This odesn't require the proposal to be in the dispatch queue but does require a deposit that is returned once enacted. Emits a `PreimageNoted` event -- **propose**(proposalHash, value) - submits a proposal given the preimage hash and the deposit amount, which must be at least the minimum deposit. Emits a `Proposed` event -- **reapPreimage**(proposalHash, proposalLenUpperBound) - removes an expired proposal preimage and collects the deposit. This will only work after the number of blocks in the voting period have passed and if it's the same account that created the preimage is making the call. If it's a different account, then the call must be made after the number of blocks in the enactment period. Emits a `PreimageReaped` event +- **enactProposal**(proposalHash, index) - *deprecated as of runtime 2000* - enacts a proposal from a referendum given the proposal hash and the index of the referendum +- **noteImminentPreimage**(encodedProposal) - *deprecated as of runtime 2000* - registers a preimage for an upcoming proposal in the dispatch queue given the encoded preimage of a proposal. Emits a `PreimageNoted` event +- **notePreimage**(encodedProposal) - *deprecated as of runtime 2000* - registers a preimage for an upcoming proposal given the encoded preimage of a proposal. This odesn't require the proposal to be in the dispatch queue but does require a deposit that is returned once enacted. Emits a `PreimageNoted` event. **This extrinsic is now accessible through the [preimage pallet](/builders/pallets-precompiles/pallets/preimage/#extrinsics){target=_blank}** +- **propose**(proposal, value) - submits a proposal given the proposal and the deposit amount, which must be at least the minimum deposit. Emits a `Proposed` event. The proposal can be one of three types: + - `Legacy` - requires a Blake2-256 preimage hash with no preimage length. This type can no longer be created and temporarily exists to support transitioning from legacy state + - `Inline` - requires a bounded `Call`. Its encoding must be at most 128 bytes + - `Lookup` - requires a Blake2-256 preimage hash along with the length of the preimage + +- **reapPreimage**(proposalHash, proposalLenUpperBound) - *deprecated as of runtime 2000* - removes an expired proposal preimage and collects the deposit. This will only work after the number of blocks in the voting period have passed and if it's the same account that created the preimage is making the call. If it's a different account, then the call must be made after the number of blocks in the enactment period. Emits a `PreimageReaped` event - **removeOtherVote**(target, index) - removes a vote for a referendum given the account of the vote to be removed for and the index of the referendum. If the account passed in is the signer, then the functionality is the same as the `removeVote` function; otherwise the vote must have expired because the voter lost the referendum or the conviction period is over - **removeVote**(index) - removes a vote for a referendum given the index of the referendum. The vote can only be removed if the referendum was cancelled, is ongoing, it ended and the vote was in opposition to the result, if there was no conviction to the account's vote, or if the account made a split vote - **second**(proposal, secondsUpperBound) - seconds a proposal signaling agreement with the proposal given the index of the proposal and an upper bound on the current number of seconds on the proposal @@ -39,9 +43,9 @@ Some of the extrinsics in the democracy pallet are subject to votes of the *Tech - **cancelProposal**(propIndex) - removes a proposal given the index of the proposal to cancel. Cancellations are in the hands of the *Root* account or if *3/5th of the Technical Committee* vote to cancel the proposal - **emergencyCancel**(refIndex) - schedules an emergency cancellation of a referendum given the index of the referendum to cancel. Emergency cancellations are in the hands of the *Root* account or if *3/5th of the Council* vote to cancel the referendum -- **externalPropose**(proposalHash) - schedules a referendum to be brought to a vote once it is legal to schedule an external referendum given a proposal hash. If at least *1/2 of the Council* vote in approval the referendum will be tabled next -- **externalProposeDefault**(proposalHash) - schedules a negative-turnout-bias referendum to be brought to a vote next once it is legal to schedule an external referendum given the preimage hash of a proposal. If at least *3/5th of the Council* vote in approval the referendum will be tabled next -- **exernalProposeMajority**(proposalHash) - schedules a majority-carries referendum to be brought to a vote next once it is legal to schedule an external referendum given the preimage hash of a proposal. If at least *3/5th of the Council* vote in approval the referendum will be tabled next +- **externalPropose**(proposal) - schedules a referendum to be brought to a vote once it is legal to schedule an external referendum given a proposal hash. If at least *1/2 of the Council* vote in approval the referendum will be tabled next. Please refer to the three types of proposals, in the **propose** extrinsic description above +- **externalProposeDefault**(proposal) - schedules a negative-turnout-bias referendum to be brought to a vote next once it is legal to schedule an external referendum given the preimage hash of a proposal. If at least *3/5th of the Council* vote in approval the referendum will be tabled next. Please refer to the three types of proposals, in the **propose** extrinsic description above +- **exernalProposeMajority**(proposal) - schedules a majority-carries referendum to be brought to a vote next once it is legal to schedule an external referendum given the preimage hash of a proposal. If at least *3/5th of the Council* vote in approval the referendum will be tabled next. Please refer to the three types of proposals, in the **propose** extrinsic description above - **fastTrack**(proposalHash, votingPeriod, delay) - schedules a currently externally-proposed majority-carries referendum to be brought to a vote immediately given the proposal hash, the period allowed for voting on the proposal, and the number of blocks after an approval and it is enacted. If there is no externally-proposed referendum currently, or if there is one but it is not a majority-carries referendum then it fails. If at least *1/2 of the Technical Committee* vote in approval the referendum will be tabled immediately - **noteImminentPreimageOperational**(encodedProposal) - registers a preimage for an upcoming proposal in the dispatch queue given the encoded preimage of a proposal. Emits a `PreimageNoted` event. Must be called by a member of the *Council* - **notePreimageOperational**(encodedProposal) - registers a preimage for an upcoming proposal given the encoded preimage of a proposal. This odesn't require the proposal to be in the dispatch queue but does require a deposit that is returned once enacted. Emits a `PreimageNoted` event. Must be called by a member of the *Council* @@ -50,7 +54,7 @@ Some of the extrinsics in the democracy pallet are subject to votes of the *Tech There are also some extrinsics in the democracy pallet that can only be dispatched by the *root* account: - **blacklist**(proposalHash, maybeRefIndex) - permanently places a proposal given a proposal hash into the blacklist which prevents it from ever being proposed again. If called on a queued public or external proposal, then this will result in it being removed. If the `maybeRefIndex` supplied is an active referendum that corresponds to the proposal hash, the proposal will be cancelled -- **cancelQueued**(which) - cancels a proposal queued for enactment given the index of the referendum to cancel +- **cancelQueued**(which) - *deprecated as of runtime 2000* - cancels a proposal queued for enactment given the index of the referendum to cancel - **cancelReferendum**(refIndex) - removes a referendum given the index of the referendum to cancel - **clearPublicProposals**() - clears all public proposals @@ -65,12 +69,11 @@ The democracy pallet includes the following read-only storage methods to obtain - **lowestUnbaked**() - returns the lowest referendum index that corresponds to an unbaked referendum - **nextExternal**() - returns the next referendum to be brought to a vote for whenever it would be valid to vote on an external proposal - **palletVersion**() - returns the current pallet version -- **preimages**(H256) - returns the map of proposal preimage hashes of all preimages or for a given preimage hash along with who registered it (`provider`), their deposit, and the block number at which it was deposited (`since`) +- **preimages**(H256) - *deprecated as of runtime 2000* - **this storage item is now accessible through the [preimage pallet](/builders/pallets-precompiles/pallets/preimage/#storage-methods){target=_blank}** - **publicPropCount**() - returns the number of public proposals that have been made so far - **publicProps**() - returns a record of the public proposals - **referendumCount**() - returns the number of referenda started so far - **referendumInfoOf**() - returns information for a referendum given the referendum's index -- **storageVersion**() - returns the storage version of the pallet - **votingOf**(AccountId20) - returns a record of all of the votes for a particular voter given the address of the voter ### Pallet Constants {: #constants } @@ -83,8 +86,10 @@ The democracy pallet includes the following read-only functions to obtain pallet - **instantAllowed**() - returns a boolean indicating whether an emergency origin is even allowed to happen - **launchPeriod**() - returns how often (in blocks) new public referenda are launched - **maxProposals**() - returns the maximum number of public proposals that can exist at any time +- **maxBlacklisted**() - returns the maximum number of items which can be blacklisted +- **maxDeposits**() - returns the maximum number of deposits a public proposal may have at any time - **maxVotes**() - returns the maximum number of votes for an account - **minimumDeposit**() - returns the minimum amount to be used as a deposit for a public referendum proposal -- **preimageByteDeposit**() - returns the amount of balance that must be deposited per byte of preimage stored +- **preimageByteDeposit**() - *deprecated as of runtime 2000* - returns the amount of balance that must be deposited per byte of preimage stored - **voteLockingPeriod**() - returns the minimum period of vote locking - **votingPeriod**() - returns how often (in blocks) to check for new votes \ No newline at end of file diff --git a/builders/pallets-precompiles/pallets/preimage.md b/builders/pallets-precompiles/pallets/preimage.md new file mode 100644 index 000000000..80b560a5c --- /dev/null +++ b/builders/pallets-precompiles/pallets/preimage.md @@ -0,0 +1,36 @@ +--- +title: Preimage Pallet +description: Learn about the available extrinsics and storage methods for the preimage pallet on Moonbeam, which are used to store and manage on-chain preimages. +keywords: democracy, substrate, pallet, moonbeam, polkadot, preimage +--- + +# The Preimage Pallet + +![Preimage Moonbeam Banner](/images/builders/pallets-precompiles/pallets/preimage-banner.png) + +## Introduction {: #introduction } + +The preimage pallet allows for the users and the runtime to store the preimage of a hash on chain. This can be used by other pallets for storing and managing large byte-blobs. For example, token holders can submit a democracy proposal through the democracy pallet using a preimage hash. + +Some of the functionality of the preimage pallet is also available through the democracy precompile. The precompile is a Solidity interface that enables you to perform governance functions using the Ethereum API. Please refer to the [Democracy Precompile](/builders/pallets-precompiles/precompiles/democracy){target=_blank} guide for more information. Please note that there will be a new preimage precompile with the release of runtime 2100, but in the meantime, the corresponding preimage methods are available through the democracy precompile. + +This guide will provide an overview of the extrinsics, storage methods, and getters for the pallet constants available in the preimage pallet on Moonbeam. + +## Preimage Pallet Interface {: #preimage-pallet-interface } + +### Extrinsics {: #extrinsics } + +The preimage pallet provides the following extrinsics (functions): + +- **notePreimage**(encodedProposal) - registers a preimage for an upcoming proposal given the encoded preimage of a proposal. If the preimage was previously requested, no fees or deposits are taken for providing the preimage. Otherwise, a deposit is taken proportional to the size of the preimage. Emits a `Noted` event +- **requestPreimage**(bytes) - requests a preimage to be uploaded to the chain without paying any fees or deposits. If the preimage request has already been provided on-chain by a user, their related deposit is unreserved, and they no longer control the preimage. Emits a `Requested` event +- **unnotePreimage**(hash) - clears an unrequested preimage from the runtime storage given the hash of the preimage to be removed. Emits a `Cleared` event +- **unrequestPreimage**(hash) - clears a previously made request for a preimage. Emits a `Cleared` event + +### Storage Methods {: #storage-methods } + +The preimage pallet includes the following read-only storage methods to obtain chain state data: + +- **palletVersion**() - returns the current pallet version +- **preimageFor**((H256, u32)) - returns a list of the proposal hashes of all preimages along with their associated data. If given a proposal hash and the length of the associated data, a specific preimage is returned +- **statusFor**(H256) - returns the request status of all preimages or for a given preimage hash diff --git a/builders/pallets-precompiles/precompiles/democracy.md b/builders/pallets-precompiles/precompiles/democracy.md index 56384a76e..b5953cd72 100644 --- a/builders/pallets-precompiles/precompiles/democracy.md +++ b/builders/pallets-precompiles/precompiles/democracy.md @@ -42,6 +42,15 @@ The interface includes the following functions: - **publicPropCount**() — read-only function that returns the total number of public proposals past and present. Uses the [`publicPropCount`](/builders/pallets-precompiles/pallets/democracy/#:~:text=publicPropCount()){target=_blank} method of the democracy pallet - **depositOf**(*uint256* propIndex) — read-only function that returns the total number of tokens locked behind the proposal. Uses the [`depositOf`](/builders/pallets-precompiles/pallets/democracy/#:~:text=depositOf(u32)){target=_blank} method of the democracy pallet - **lowestUnbaked**() — read-only function that returns the referendum with the lowest index that is currently being voted on. For clarity, a baked referendum is one that has been closed (and if passed, scheduled for enactment). An unbaked referendum is therefore one in which voting is ongoing. Uses the [`lowestUnbaked`](/builders/pallets-precompiles/pallets/democracy/#:~:text=lowestUnbaked()){target=_blank} method of the democracy pallet + - **ongoingReferendumInfo**(*uint256* refIndex) — read-only function that returns the details of the specified ongoing referendum in the form of a tuple that includes the following: + - Block in which the referendum ended (*uint256*) + - The proposal hash (*bytes32*) + - [The biasing mechanism](https://wiki.polkadot.network/docs/learn-governance#super-majority-approve){target=_blank} where 0 is `SuperMajorityApprove`, 1 is `SuperMajorityAgainst`, 2 is `SimpleMajority` (*uint256*) + - The enactment delay period (*uint256*) + - The total aye vote, including conviction (*uint256*) + - The total nay note, including conviction (*uint256*) + - The total turnout, not including conviction (*uint256*) +- **finishedReferendumInfo**(*uint256* refIndex) — read-only function that returns a boolean indicating whether a referendum passed and the block at which it finished - **propose**(*bytes32* proposalHash, *uint256* value) — submit a proposal by providing a hash and the number of tokens to lock. Uses the [`propose`](/builders/pallets-precompiles/pallets/democracy/#:~:text=propose(proposalHash, value)){target=_blank} method of the democracy pallet - **second**(*uint256* propIndex, *uint256* secondsUpperBound) — second a proposal by providing the proposal index and a number greater than or equal to the number of existing seconds for this proposal (necessary to calculate the weight of the call). An amount is not needed because seconds require the same amount the original proposer locked. Uses the [`second`](/builders/pallets-precompiles/pallets/democracy/#:~:text=second(proposal, secondsUpperBound)){target=_blank} method of the democracy pallet - **standardVote**(*uint256* refIndex, *bool* aye, *uint256* voteAmount, *uint256* conviction) — vote in a referendum by providing the proposal index, the vote direction (`true` is a vote to enact the proposal, `false` is a vote to keep the status quo), the number of tokens to lock, and the conviction. Conviction is an integer from `0` to `6` where `0` is no lock time and `6` is the maximum lock time. Uses the [`vote`](/builders/pallets-precompiles/pallets/democracy/#:~:text=vote(refIndex, vote)){target=_blank} method of the democracy pallet @@ -50,21 +59,16 @@ The interface includes the following functions: - **unDelegate**() — a method called by the delegator to undelegate voting power. Tokens are eligible to be unlocked once the conviction period specified by the original delegation has elapsed. Uses the [`undelegate`](/builders/pallets-precompiles/pallets/democracy/#:~:text=undelegate()){target=_blank} method of the democracy pallet - **unlock**(*address* target) — unlock tokens that have an expired lock. You MUST call **removeVote** for each proposal with tokens locked you seek to unlock prior to calling **unlock**, otherwise tokens will remain locked. This function may be called by any account. Uses the [`unlock`](/builders/pallets-precompiles/pallets/democracy/#:~:text=unlock(target)){target=_blank} method of the democracy pallet - **notePreimage**(*bytes* encodedProposal) — Registers a preimage for an upcoming proposal. This doesn't require the proposal to be in the dispatch queue but does require a deposit which is returned once enacted. Uses the [`notePreimage`](/builders/pallets-precompiles/pallets/democracy/#:~:text=notePreimage(encodedProposal)){target=_blank} method of the democracy pallet - - **noteImminentPreimage**(*bytes* encodedProposal) — Register the preimage for an upcoming proposal. This requires the proposal to be in the dispatch queue. No deposit is needed. When this call is successful, i.e. the preimage has not been uploaded before and matches some imminent proposal, no fee is paid. Uses the [`noteImminentPreimage`](/builders/pallets-precompiles/pallets/democracy/#:~:text=noteImminentPreimage(encodedProposal)){target=_blank} method of the democracy pallet + - **noteImminentPreimage**(*bytes* encodedProposal) — Register the preimage for an upcoming proposal. This requires the proposal to be in the dispatch queue. No deposit is needed. When this call is successful, i.e. the preimage has not been uploaded before and matches some imminent proposal, no fee is paid -The interface also includes the following functions which are not currently supported but may be supported in the future: +The interface also includes the following events: - - **ongoingReferendumInfo**(*uint256* refIndex) — read-only function that returns the details of the specified ongoing referendum in the form of a tuple that includes the following: - - Block in which the referendum ended (*uint256*) - - The proposal hash (*bytes32*) - - [The biasing mechanism](https://wiki.polkadot.network/docs/learn-governance#super-majority-approve){target=_blank} where 0 is SuperMajorityApprove, 1 is SuperMajorityAgainst, 2 is SimpleMajority (*uint256*) - - The enactment delay period (*uint256*) - - The total aye vote, including conviction (*uint256*) - - The total nay note, including conviction (*uint256*) - - The total turnout, not including conviction (*uint256*) +- **Proposed**(*uint32 indexed* proposalIndex, *uint256* deposit) - emitted when a motion has been proposed +- **Seconded**(*uint32 indexed* proposalIndex, *address* seconder) - emitted when an account has seconded a proposal +- **StandardVote**(*uint32 indexed* referendumIndex, *address* voter, *bool* aye, *uint256* voteAmount, *uint8* conviction) - emitted when an account has made a standard vote +- **Delegated**(*address indexed* who, *address* target) - emitted when an account has delegated some voting power to another account +- **Undelegated**(*address indexed* who) - emitted when an account has undelegated some of their voting power from another account - - **finishedReferendumInfo**(*uint256* refIndex) — read-only function that returns a boolean indicating whether a referendum passed and the block at which it finished - ## Interact with the Solidity Interface {: #interact-with-the-solidity-interface } ### Checking Prerequisites {: #checking-prerequisites } @@ -101,35 +105,35 @@ The below example is demonstrated on Moonbase Alpha, however, similar steps can ### Submit a Proposal {: #submit-a-proposal } -You can submit a proposal via the [democracy precompile](https://github.com/PureStake/moonbeam/blob/master/precompiles/pallet-democracy/DemocracyInterface.sol){target=_blank} if you have the hash of the proposal. You can also submit the preimage if you have the encoded proposal. To get the proposal hash and the encoded proposal, navigate to the **Democracy** tab of [Polkadot.js Apps](https://polkadot.js.org/apps/?rpc=wss%3A%2F%2Fmoonbeam-alpha.api.onfinality.io%2Fpublic-ws#/democracy){target=_blank}, click on **+ Submit preimage**, and take the following steps: +You can submit a proposal via the `propose` function of the [democracy precompile](https://github.com/PureStake/moonbeam/blob/master/precompiles/pallet-democracy/DemocracyInterface.sol){target=_blank} as long as you have the preimage hash of the proposal. But before a proposal can be submitted, you'll first need to submit the preimage by passing in the encoded proposal data to the `notePreimage` function, which now belongs to the [preimage pallet](/builders/pallets-precompiles/pallets/preimage){target=_blank}. + +In this section, you'll get the preimage hash and the encoded proposal data for a proposal. To get the preimage hash, you can: + + 1. Navigate to the [**Governance** tab of Polkadot.js Apps](https://polkadot.js.org/apps/?rpc=wss%3A%2F%2Fmoonbeam-alpha.api.onfinality.io%2Fpublic-ws#/democracy){target=_blank} + 2. Select **Preimages** from the dropdown + 3. From the **Preimages** page, click on **+ Add preimage** + +![Add a new preimage](/images/builders/pallets-precompiles/precompiles/democracy/democracy-4.png) + +Then take the following steps: 1. Select an account (any account is fine because you're not submitting any transaction here) 2. Choose the pallet you want to interact with and the dispatchable function (or action) to propose. The action you choose will determine the fields that need to fill in the following steps. In this example, it is the **system** pallet and the **remark** function 3. Enter the text of the remark, ensuring it is unique. Duplicate proposals such as "Hello World!" will not be accepted - 4. Copy the preimage hash. This represents the proposal. You will use this hash when submitting the proposal via the democracy precompile + 4. Copy the preimage hash, which represents the proposal, and save it as it will be used in the following steps to submit the proposal via the democracy precompile 5. Click the **Submit preimage** button but don't sign or confirm the transaction on the next page -![Get the proposal hash](/images/builders/pallets-precompiles/precompiles/democracy/democracy-4.png) +![Get the proposal hash](/images/builders/pallets-precompiles/precompiles/democracy/democracy-5.png) On the next screen, take the following steps: 1. Press the triangle icon to reveal the encoded proposal in bytes 2. Copy the encoded proposal - you'll need this when calling the **notePreimage** function in a later step -![Get the encoded proposal](/images/builders/pallets-precompiles/precompiles/democracy/democracy-5.png) +![Get the encoded proposal](/images/builders/pallets-precompiles/precompiles/democracy/democracy-6.png) !!! note - You should NOT sign and submit the transaction here. You will submit this information via the **notePreimage** function in a later step. - -Next you can call the `propose` function of the Solidity interface by taking the following steps: - -1. Expand the democracy precompile contract to see the available functions -2. Find the **propose** function and press the button to expand the section -3. Enter the hash of the proposal -4. Enter the value in Wei of the tokens to bond. The minimum bond is {{ networks.moonbeam.democracy.min_deposit }} GLMR, {{ networks.moonriver.democracy.min_deposit }} MOVR, or {{ networks.moonbase.democracy.min_deposit }} DEV. For this example 4 DEV or `4000000000000000000` was entered -5. Press **transact** and confirm the transaction in MetaMask - -![Call the propose function](/images/builders/pallets-precompiles/precompiles/democracy/democracy-6.png) + You should NOT sign and submit the transaction here. You will submit this information via the **notePreimage** function in the next step. Now you can take the encoded proposal that you got from [Polkadot.js Apps](https://polkadot.js.org/apps/?rpc=wss%3A%2F%2Fmoonbeam-alpha.api.onfinality.io%2Fpublic-ws#/democracy){target=_blank} and submit it via the `notePreimage` function of the democracy precompile. Despite its name, the preimage is not required to be submitted before the proposal. However, submitting the preimage is required before a proposal can be enacted. To submit the preimage via the `notePreimage` function, take the following steps: @@ -140,6 +144,16 @@ Now you can take the encoded proposal that you got from [Polkadot.js Apps](https ![Submit the preimage](/images/builders/pallets-precompiles/precompiles/democracy/democracy-7.png) +Next you can call the `propose` function of the Solidity interface by taking the following steps: + +1. Expand the democracy precompile contract to see the available functions +2. Find the **propose** function and press the button to expand the section +3. Enter the hash of the proposal +4. Enter the value in Wei of the tokens to bond. The minimum bond is {{ networks.moonbeam.democracy.min_deposit }} GLMR, {{ networks.moonriver.democracy.min_deposit }} MOVR, or {{ networks.moonbase.democracy.min_deposit }} DEV. For this example 4 DEV or `4000000000000000000` was entered +5. Press **transact** and confirm the transaction in MetaMask + +![Call the propose function](/images/builders/pallets-precompiles/precompiles/democracy/democracy-8.png) + After your transaction has been confirmed you can return to the **Democracy** section of [Polkadot.js Apps](https://polkadot.js.org/apps/?rpc=wss%3A%2F%2Fmoonbeam-alpha.api.onfinality.io%2Fpublic-ws#/democracy){target=_blank} to see your proposal listed in the proposal queue. ### Second a Proposal {: #second-a-proposal } @@ -154,7 +168,7 @@ First, you'll need to gather some information about the proposal you wish to sec 4. Take note of the proposal number - this is the first parameter you'll need 5. Take note of the number of existing seconds. If there are none, this space will be empty -![Get the proposal information](/images/builders/pallets-precompiles/precompiles/democracy/democracy-8.png) +![Get the proposal information](/images/builders/pallets-precompiles/precompiles/democracy/democracy-9.png) Now, you're ready to return to Remix to second the proposal via the democracy precompile. To do so, take the following steps: @@ -166,7 +180,7 @@ Now, you're ready to return to Remix to second the proposal via the democracy pr And that's it! To review your seconded proposal, you can revisit [Polkadot.js Apps](https://polkadot.js.org/apps/?rpc=wss%3A%2F%2Fmoonbeam-alpha.api.onfinality.io%2Fpublic-ws#/democracy){target=_blank} and look for your account in the list of seconds. -![Second via the precompile](/images/builders/pallets-precompiles/precompiles/democracy/democracy-9.png) +![Second via the precompile](/images/builders/pallets-precompiles/precompiles/democracy/democracy-10.png) !!! note Proposal index numbers are not the same as referendum index numbers. When a proposal moves to referendum status, it will be assigned a new referendum index number. @@ -182,7 +196,7 @@ First, you'll need to get the index of the referendum you wish to vote on. Remem 3. Look for the **Referenda** section and click on the triangle icon to see more details about a referendum. If there is no triangle icon, this means that only a proposal hash, and no preimage has been submitted for the proposal 4. Take note of the referendum index -![Get the referendum index](/images/builders/pallets-precompiles/precompiles/democracy/democracy-10.png) +![Get the referendum index](/images/builders/pallets-precompiles/precompiles/democracy/democracy-11.png) Now, you're ready to return to Remix to vote on the referendum via the democracy precompile. To do so, take the following steps: @@ -194,6 +208,6 @@ Now, you're ready to return to Remix to vote on the referendum via the democracy 6. Enter a conviction between 0-6 inclusive that represents the desired lock period for the tokens committed to the vote, where 0 represents no lock period and 6 represents the maximum lock period. For more information on lock periods, see [voting on a proposal](/tokens/governance/voting/){target=_blank} 7. Press **transact** and confirm the transaction in MetaMask -![Call the vote function](/images/builders/pallets-precompiles/precompiles/democracy/democracy-11.png) +![Call the vote function](/images/builders/pallets-precompiles/precompiles/democracy/democracy-12.png) And that's it! You've completed your introduction to the democracy precompile. There are a few more functions that are documented in [`DemocracyInterface.sol`](https://github.com/PureStake/moonbeam/blob/master/precompiles/pallet-democracy/DemocracyInterface.sol){target=_blank} — feel free to reach out on [Discord](https://discord.gg/moonbeam){target=_blank} if you have any questions about those functions or any other aspect of the democracy precompile. diff --git a/images/builders/pallets-precompiles/pallets/preimage-banner.png b/images/builders/pallets-precompiles/pallets/preimage-banner.png new file mode 100644 index 000000000..669d9fa16 Binary files /dev/null and b/images/builders/pallets-precompiles/pallets/preimage-banner.png differ diff --git a/images/builders/pallets-precompiles/precompiles/democracy/democracy-10.png b/images/builders/pallets-precompiles/precompiles/democracy/democracy-10.png index f8aefc3a1..65167805c 100644 Binary files a/images/builders/pallets-precompiles/precompiles/democracy/democracy-10.png and b/images/builders/pallets-precompiles/precompiles/democracy/democracy-10.png differ diff --git a/images/builders/pallets-precompiles/precompiles/democracy/democracy-11.png b/images/builders/pallets-precompiles/precompiles/democracy/democracy-11.png index 5df007679..508006045 100644 Binary files a/images/builders/pallets-precompiles/precompiles/democracy/democracy-11.png and b/images/builders/pallets-precompiles/precompiles/democracy/democracy-11.png differ diff --git a/images/builders/pallets-precompiles/precompiles/democracy/democracy-12.png b/images/builders/pallets-precompiles/precompiles/democracy/democracy-12.png new file mode 100644 index 000000000..1d93a55b1 Binary files /dev/null and b/images/builders/pallets-precompiles/precompiles/democracy/democracy-12.png differ diff --git a/images/builders/pallets-precompiles/precompiles/democracy/democracy-3.png b/images/builders/pallets-precompiles/precompiles/democracy/democracy-3.png index b63356260..8beac740c 100644 Binary files a/images/builders/pallets-precompiles/precompiles/democracy/democracy-3.png and b/images/builders/pallets-precompiles/precompiles/democracy/democracy-3.png differ diff --git a/images/builders/pallets-precompiles/precompiles/democracy/democracy-4.png b/images/builders/pallets-precompiles/precompiles/democracy/democracy-4.png index e21625da3..b438a17f6 100644 Binary files a/images/builders/pallets-precompiles/precompiles/democracy/democracy-4.png and b/images/builders/pallets-precompiles/precompiles/democracy/democracy-4.png differ diff --git a/images/builders/pallets-precompiles/precompiles/democracy/democracy-5.png b/images/builders/pallets-precompiles/precompiles/democracy/democracy-5.png index 324c895d6..97b924a67 100644 Binary files a/images/builders/pallets-precompiles/precompiles/democracy/democracy-5.png and b/images/builders/pallets-precompiles/precompiles/democracy/democracy-5.png differ diff --git a/images/builders/pallets-precompiles/precompiles/democracy/democracy-6.png b/images/builders/pallets-precompiles/precompiles/democracy/democracy-6.png index 7a673c5d5..a5adc6b6b 100644 Binary files a/images/builders/pallets-precompiles/precompiles/democracy/democracy-6.png and b/images/builders/pallets-precompiles/precompiles/democracy/democracy-6.png differ diff --git a/images/builders/pallets-precompiles/precompiles/democracy/democracy-7.png b/images/builders/pallets-precompiles/precompiles/democracy/democracy-7.png index a3fe236b9..bf909b4d3 100644 Binary files a/images/builders/pallets-precompiles/precompiles/democracy/democracy-7.png and b/images/builders/pallets-precompiles/precompiles/democracy/democracy-7.png differ diff --git a/images/builders/pallets-precompiles/precompiles/democracy/democracy-8.png b/images/builders/pallets-precompiles/precompiles/democracy/democracy-8.png index 7aa19f00f..600ae2211 100644 Binary files a/images/builders/pallets-precompiles/precompiles/democracy/democracy-8.png and b/images/builders/pallets-precompiles/precompiles/democracy/democracy-8.png differ diff --git a/images/builders/pallets-precompiles/precompiles/democracy/democracy-9.png b/images/builders/pallets-precompiles/precompiles/democracy/democracy-9.png index 34a186d8b..a81712f47 100644 Binary files a/images/builders/pallets-precompiles/precompiles/democracy/democracy-9.png and b/images/builders/pallets-precompiles/precompiles/democracy/democracy-9.png differ diff --git a/images/index-pages/builders/pallets-precompiles/pallets/preimage.png b/images/index-pages/builders/pallets-precompiles/pallets/preimage.png new file mode 100644 index 000000000..9b88bcd58 Binary files /dev/null and b/images/index-pages/builders/pallets-precompiles/pallets/preimage.png differ diff --git a/images/tokens/governance/proposals/for-cn/proposals-1.png b/images/tokens/governance/proposals/for-cn/proposals-1.png new file mode 100644 index 000000000..2e4e3f61d Binary files /dev/null and b/images/tokens/governance/proposals/for-cn/proposals-1.png differ diff --git a/images/tokens/governance/proposals/for-cn/proposals-2.png b/images/tokens/governance/proposals/for-cn/proposals-2.png new file mode 100644 index 000000000..9bef3aae8 Binary files /dev/null and b/images/tokens/governance/proposals/for-cn/proposals-2.png differ diff --git a/images/tokens/governance/proposals/for-cn/proposals-3.png b/images/tokens/governance/proposals/for-cn/proposals-3.png new file mode 100644 index 000000000..700be934d Binary files /dev/null and b/images/tokens/governance/proposals/for-cn/proposals-3.png differ diff --git a/images/tokens/governance/proposals/for-cn/proposals-4.png b/images/tokens/governance/proposals/for-cn/proposals-4.png new file mode 100644 index 000000000..58b9deb44 Binary files /dev/null and b/images/tokens/governance/proposals/for-cn/proposals-4.png differ diff --git a/images/tokens/governance/proposals/for-cn/proposals-5.png b/images/tokens/governance/proposals/for-cn/proposals-5.png new file mode 100644 index 000000000..623a8f348 Binary files /dev/null and b/images/tokens/governance/proposals/for-cn/proposals-5.png differ diff --git a/images/tokens/governance/proposals/for-cn/proposals-6.png b/images/tokens/governance/proposals/for-cn/proposals-6.png new file mode 100644 index 000000000..6c196dde8 Binary files /dev/null and b/images/tokens/governance/proposals/for-cn/proposals-6.png differ diff --git a/images/tokens/governance/proposals/for-cn/proposals-7.png b/images/tokens/governance/proposals/for-cn/proposals-7.png new file mode 100644 index 000000000..b4cfb0a68 Binary files /dev/null and b/images/tokens/governance/proposals/for-cn/proposals-7.png differ diff --git a/images/tokens/governance/proposals/for-cn/proposals-8.png b/images/tokens/governance/proposals/for-cn/proposals-8.png new file mode 100644 index 000000000..29963ed2e Binary files /dev/null and b/images/tokens/governance/proposals/for-cn/proposals-8.png differ diff --git a/images/tokens/governance/proposals/proposals-9.png b/images/tokens/governance/proposals/for-cn/proposals-9.png similarity index 100% rename from images/tokens/governance/proposals/proposals-9.png rename to images/tokens/governance/proposals/for-cn/proposals-9.png diff --git a/images/tokens/governance/proposals/proposals-1.png b/images/tokens/governance/proposals/proposals-1.png index 2e4e3f61d..878d2b7b6 100644 Binary files a/images/tokens/governance/proposals/proposals-1.png and b/images/tokens/governance/proposals/proposals-1.png differ diff --git a/images/tokens/governance/proposals/proposals-2.png b/images/tokens/governance/proposals/proposals-2.png index 9bef3aae8..62a58080e 100644 Binary files a/images/tokens/governance/proposals/proposals-2.png and b/images/tokens/governance/proposals/proposals-2.png differ diff --git a/images/tokens/governance/proposals/proposals-3.png b/images/tokens/governance/proposals/proposals-3.png index 700be934d..8bd10cd02 100644 Binary files a/images/tokens/governance/proposals/proposals-3.png and b/images/tokens/governance/proposals/proposals-3.png differ diff --git a/images/tokens/governance/proposals/proposals-4.png b/images/tokens/governance/proposals/proposals-4.png index 58b9deb44..e0afe1e05 100644 Binary files a/images/tokens/governance/proposals/proposals-4.png and b/images/tokens/governance/proposals/proposals-4.png differ diff --git a/images/tokens/governance/proposals/proposals-5.png b/images/tokens/governance/proposals/proposals-5.png index 623a8f348..c81268025 100644 Binary files a/images/tokens/governance/proposals/proposals-5.png and b/images/tokens/governance/proposals/proposals-5.png differ diff --git a/images/tokens/governance/proposals/proposals-6.png b/images/tokens/governance/proposals/proposals-6.png index 6c196dde8..12958f948 100644 Binary files a/images/tokens/governance/proposals/proposals-6.png and b/images/tokens/governance/proposals/proposals-6.png differ diff --git a/images/tokens/governance/proposals/proposals-7.png b/images/tokens/governance/proposals/proposals-7.png index b4cfb0a68..858ab6a3b 100644 Binary files a/images/tokens/governance/proposals/proposals-7.png and b/images/tokens/governance/proposals/proposals-7.png differ diff --git a/images/tokens/governance/proposals/proposals-8.png b/images/tokens/governance/proposals/proposals-8.png index 29963ed2e..4b4477100 100644 Binary files a/images/tokens/governance/proposals/proposals-8.png and b/images/tokens/governance/proposals/proposals-8.png differ diff --git a/images/tokens/governance/voting/vote-1.png b/images/tokens/governance/voting/vote-1.png new file mode 100644 index 000000000..2e4e3f61d Binary files /dev/null and b/images/tokens/governance/voting/vote-1.png differ diff --git a/tokens/governance/proposals.md b/tokens/governance/proposals.md index 12568a846..c0a816873 100644 --- a/tokens/governance/proposals.md +++ b/tokens/governance/proposals.md @@ -65,7 +65,7 @@ This guide will show you how to submit a proposal on Moonbase Alpha. It can be a This section goes over the process of creating a proposal, from a preimage until it reaches public referenda. Instead of making a generic example, this guide will actually create a real proposal that will serve as a base for this guide and others. -To make a proposal in the network, you need to use the Polkadot.js Apps interface. To do so, you need to import an Ethereum-style account first (H160 address), which you can do following the [Creating or Importing an H160 Account](/tokens/connect/polkadotjs/#creating-or-importing-an-h160-account){target=_blank} guide. For this example, three accounts were imported and named with super original names: Alice, Bob, and Charley. +To make a proposal in the network, you need to use the Polkadot.js Apps interface. To do so, you need to import an Ethereum-style account first (H160 address), which you can do following the [Creating or Importing an H160 Account](/tokens/connect/polkadotjs/#creating-or-importing-an-h160-account){target=_blank} guide. For this example, three accounts were imported and named with super original names: Alice, Bob, and Charlie. ![Accounts in Polkadot.js](/images/tokens/governance/proposals/proposals-1.png) @@ -75,9 +75,7 @@ This proposal is to make permanent on-chain the remark "This is a unique string. The first step is to submit a preimage of the proposal. This is because the storage cost of large preimages can be pretty hefty, as the preimage contains all the information regarding the proposal itself. With this configuration, one account with more funds can submit a preimage and another account can submit the proposal. -Everything related to governance lives under the **Democracy** tab. Once there, click on the **Submit preimage** button. - -![Submit Preimage](/images/tokens/governance/proposals/proposals-2.png) +Everything related to governance lives under the **Governance** tab, including preimages. So, from the **Governance** dropdown, you can select **Preimages**. Once there, click on the **Add preimage** button. Here, you need to provide the following information: @@ -92,11 +90,11 @@ Here, you need to provide the following information: !!! note Make sure you copy the preimage hash, as it is necessary to submit the proposal. -Note that the storage cost of the preimage is displayed at the bottom left corner of this window. After the transaction is submitted, you will see some confirmations on the top right corner of the Polkadot.js Apps interface, but nothing will have changed in the main democracy screen. However, don't worry. If the transaction is confirmed, the preimage has been submitted. +Note that the storage cost of the preimage is displayed at the bottom left corner of this window. After the transaction is submitted, you will see some confirmations on the top right corner of the Polkadot.js Apps interface and the preimage will be added to the list of **preimages**. ### Submitting a Proposal {: #submitting-a-proposal } -Once you have committed the preimage (check the previous section), the roadmap's next major milestone is to submit the proposal related to it. To do so, in the main democracy screen, click on **Submit proposal**. +Once you have committed the preimage (check the previous section), the roadmap's next major milestone is to submit the proposal related to it. To do so, select **Democracy** from the **Governance** dropdown, and click on **Submit proposal**. ![Submit proposal](/images/tokens/governance/proposals/proposals-4.png) @@ -114,8 +112,6 @@ Here, you need to provide the following information: After the transaction is submitted, you will see some confirmations on the top right corner of the Polkadot.js Apps interface. You should also see the proposal listed in the **Proposals** section, displaying the proposer and the amounts of tokens locked, and it is now ready to be seconded! -![Proposal listed](/images/tokens/governance/proposals/proposals-6.png) - ### Seconding a Proposal {: #seconding-a-proposal } To second a proposal means that you agree with it and want to back it up with your tokens to help it reach public referenda. The amount of tokens to be locked is equal to the proposer's original deposit - no more, no less. @@ -123,22 +119,22 @@ To second a proposal means that you agree with it and want to back it up with yo !!! note A single account can second a proposal multiple times. This is by design, as an account could just send tokens to different addresses and use them to second the proposal. What counts is the number of tokens backing up a proposal, not the number of vouches it has received. -This section outlines the steps to second the proposal made in the previous section. To do so, click the **Second** button that is located to the right of the respective proposal. +This section outlines the steps to second the proposal made in the previous section. To do so, click the **Endorse** button that is located to the right of the respective proposal. -![Proposal listed to Second](/images/tokens/governance/proposals/proposals-7.png) +![Proposal listed to Second](/images/tokens/governance/proposals/proposals-6.png) Here, you need to provide the following information: - 1. Select the account you want to second the proposal with (in this case, Charley) + 1. Select the account you want to second the proposal with (in this case, Charlie) 2. Verify the number of tokens required to second the proposal - 3. Click the **Second** button and sign the transaction + 3. Click the **Endorse** button and sign the transaction -![Fill in Second Information](/images/tokens/governance/proposals/proposals-8.png) +![Fill in Endorse Information](/images/tokens/governance/proposals/proposals-7.png) !!! note Tokens might be locked for an indeterminate amount of time because it is unknown when a proposal may become a referendum (if ever) After the transaction is submitted, you will see some confirmations on the top right corner of the Polkadot.js Apps interface. You should also see the proposal listed in the **Proposals** section, displaying the proposer and the amounts of tokens locked and listing the users that have seconded this proposal! -![Proposal Seconded](/images/tokens/governance/proposals/proposals-9.png) +![Proposal Endorsed](/images/tokens/governance/proposals/proposals-8.png) diff --git a/tokens/governance/voting.md b/tokens/governance/voting.md index 7401e6d98..b4562c90f 100644 --- a/tokens/governance/voting.md +++ b/tokens/governance/voting.md @@ -70,7 +70,7 @@ This section goes over the process of voting on a referendum. The guide assumes To vote on a proposal in the network, you need to use the Polkadot.js Apps interface. To do so, you need to import an Ethereum-style account first (H160 address), which you can do by following the [Creating or Importing an H160 Account](/tokens/connect/polkadotjs/#creating-or-importing-an-h160-account){target=_blank} guide. For this example, three accounts were imported and named with super original names: Alice, Bob, and Charley. -![Accounts in Polkadot.js](/images/tokens/governance/proposals/proposals-1.png) +![Accounts in Polkadot.js](/images/tokens/governance/voting/vote-1.png) The proposal being voted will embed the remark "This is a unique string." on chain permanently.