|
| 1 | +# MSA Pallet |
| 2 | + |
| 3 | +The MSA Pallet provides functionality for handling Message Source Accounts. |
| 4 | + |
| 5 | +## Summary |
| 6 | + |
| 7 | +The Message Source Account (MSA) is the primary user account system on Frequency for Messages and Stateful Storage. |
| 8 | +All users on Frequency must have an MSA in order to: |
| 9 | + |
| 10 | +1. Acquire a User Handle |
| 11 | +2. Delegate tasks to Providers (defining specific tasks for specific providers) |
| 12 | +3. Become a Provider so they may do Provider level tasks on their own behalf |
| 13 | +4. Have Message or Stateful Storage data |
| 14 | + |
| 15 | +### MSA Id and Keys |
| 16 | + |
| 17 | +Once a user creates an MSA, they are assigned an MSA Id, a unique number the time of creation with one or more keys attached for control. |
| 18 | +(A control key may only be attached to ONE MSA at any single point in time.) |
| 19 | + |
| 20 | +### Actions |
| 21 | + |
| 22 | +The MSA pallet provides for: |
| 23 | + |
| 24 | +- Creating, reading, updating, and deleting operations for MSAs. |
| 25 | +- Managing delegation relationships for MSAs. |
| 26 | +- Managing keys associated with MSAs. |
| 27 | + |
| 28 | +## Interactions |
| 29 | + |
| 30 | +### Extrinsics |
| 31 | + |
| 32 | +| Name/Description | Caller | Payment | Key Events | Runtime Added | |
| 33 | +| --------------------------------------------------------------------------------------------- | ------------------------------------------ | ------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------- | |
| 34 | +| `add_public_key_to_msa`<br />Add MSA control key | MSA Control Key or Provider with Signature | Capacity or Tokens | [`PublicKeyAdded`](https://frequency-chain.github.io/frequency/pallet_msa/pallet/enum.Event.html#variant.PublicKeyAdded) | 1 | |
| 35 | +| `create`<br />Create new MSA | Token Account | Tokens | [`MsaCreated`](https://frequency-chain.github.io/frequency/pallet_msa/pallet/enum.Event.html#variant.MsaCreated) | 1 | |
| 36 | +| `create_provider`<br />Convert an MSA into a Provider | Testnet: Provider or Mainnet: Governance | Tokens | [`ProviderCreated`](https://frequency-chain.github.io/frequency/pallet_msa/pallet/enum.Event.html#variant.ProviderCreated) | 1 | |
| 37 | +| `create_provider_via_governance`<br />Convert an MSA into a Provider | Frequency Council | Tokens | [`ProviderCreated`](https://frequency-chain.github.io/frequency/pallet_msa/pallet/enum.Event.html#variant.ProviderCreated) | 12 | |
| 38 | +| `create_sponsored_account_with_delegation`<br />Create new MSA via Provider with a Delegation | Provider | Capacity or Tokens | [`MsaCreated`](https://frequency-chain.github.io/frequency/pallet_msa/pallet/enum.Event.html#variant.MsaCreated), [`DelegationGranted`](https://frequency-chain.github.io/frequency/pallet_msa/pallet/enum.Event.html#variant.DelegationGranted) | 1 | |
| 39 | +| `delete_msa_public_key`<br />Remove MSA control key | Delegator | Free | [`PublicKeyDeleted`](https://frequency-chain.github.io/frequency/pallet_msa/pallet/enum.Event.html#variant.PublicKeyDeleted) | 1 | |
| 40 | +| `grant_delegation`<br />Create or alter a delegation | Provider with Signature | Capacity | [`DelegationGranted`](https://frequency-chain.github.io/frequency/pallet_msa/pallet/enum.Event.html#variant.DelegationGranted) | 1 | |
| 41 | +| `propose_to_be_provider`<br />Request the council to convert an MSA to a Provider | Token Account | Tokens | [`Proposed`](https://paritytech.github.io/polkadot-sdk/master/pallet_collective/pallet/enum.Event.html#variant.Proposed) | 12 | |
| 42 | +| `retire_msa`<br />Remove all keys and mark the MSA as retired | Delegator | Free | [`PublicKeyDeleted`](https://frequency-chain.github.io/frequency/pallet_msa/pallet/enum.Event.html#variant.PublicKeyDeleted), [`MsaRetired`](https://frequency-chain.github.io/frequency/pallet_msa/pallet/enum.Event.html#variant.MsaRetired) | 18 | |
| 43 | +| `revoke_delegation_by_delegator`<br />Remove delegation | Delegator | Free | [`DelegationRevoked`](https://frequency-chain.github.io/frequency/pallet_msa/pallet/enum.Event.html#variant.DelegationRevoked) | 1 | |
| 44 | +| `revoke_delegation_by_provider`<br />Remove delegation | Provider | Free | [`DelegationRevoked`](https://frequency-chain.github.io/frequency/pallet_msa/pallet/enum.Event.html#variant.DelegationRevoked) | 1 | |
| 45 | + |
| 46 | +See [Rust Docs](https://frequency-chain.github.io/frequency/pallet_msa/pallet/struct.Pallet.html) for more details. |
| 47 | + |
| 48 | +### State Queries |
| 49 | + |
| 50 | +| Name | Description | Query | Runtime Added | |
| 51 | +| --------------------------------- | ----------------------------------------------------------------------------------------------------------------- | ---------------------------------- | ------------- | |
| 52 | +| Get MSA Id | Returns the MSA Id connected to the given control key | `publicKeyToMsaId` | 1 | |
| 53 | +| Get Current Maximum MSA Id | Returns the maximum MSA Id in existence | `currentMsaIdentifierMaximum` | 1 | |
| 54 | +| Get Current Delegator to Provider | Returns the current relationship between the specified Delegator and specified Provider at the given block number | `delegatorAndProviderToDelegation` | 1 | |
| 55 | +| Get Public Key Count for MSA Id | Returns the number of public keys for the given MSA Id | `publicKeyCountforMsaId` | 1 | |
| 56 | + |
| 57 | +See the [Rust Docs](https://frequency-chain.github.io/frequency/pallet_msa/pallet/storage_types/index.html) for additional state queries and details. |
| 58 | + |
| 59 | +### RPCs |
| 60 | + |
| 61 | +Note: May be restricted based on node settings and configuration. |
| 62 | + |
| 63 | +| Name | Description | Call | Node Version | |
| 64 | +| ---------------------------- | -------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------ | |
| 65 | +| Check Delegations | Test a list of MSAs to see if they have delegated to the provider MSA | [`checkDelegations`](https://frequency-chain.github.io/frequency/pallet_msa_rpc/trait.MsaApiServer.html#tymethod.check_delegations) | v1.0.0+ | |
| 66 | +| Delegation Schema Grants | Fetch the list of Schema Ids that a delegator has granted to a provider | [`grantedSchemaIdsByMsaId`](https://frequency-chain.github.io/frequency/pallet_msa_rpc/trait.MsaApiServer.html#tymethod.get_granted_schemas_by_msa_id) | v1.0.0+ | |
| 67 | +| Get Control Keys by MSA Id\* | Fetch the list of current control keys for an MSA from the off-chain index | [`getKeysByMsaId`](https://frequency-chain.github.io/frequency/pallet_msa_rpc/trait.MsaApiServer.html#tymethod.get_keys_by_msa_id) | v1.10.0+ | |
| 68 | + |
| 69 | +\* Must be enabled with off-chain indexing |
| 70 | + |
| 71 | +See [Rust Docs](https://frequency-chain.github.io/frequency/pallet_msa_rpc/trait.MsaApiServer.html) for more details. |
0 commit comments