Skip to content
This repository has been archived by the owner on Mar 13, 2023. It is now read-only.

feat: migrate crab issuing to use pallet! #568

Merged
merged 9 commits into from
Mar 30, 2021

Conversation

songtianyi
Copy link
Contributor

@songtianyi songtianyi commented Mar 26, 2021

Part of #561.

Converts the crab backing pallet to the new pallet attribute macro introduced in #6877.

Upgrade guidelines used.

⚠️ Breaking Change ⚠️
From checking upgrade guidelines

storages now use PalletInfo for module_prefix instead of the one given to decl_storage: use of this pallet in construct_runtime! needs careful updating of the name in order to not break storage or to upgrade storage (moreover for instantiable pallet). If pallet is published, make sure to warn about this breaking change.

Common notes

  • their Trait is renamed Config
  • all storages are now generic over T
  • module prefix used by storages is now the PalletInfo::name given by construct_runtime.
  • no longer RawEvent.

The metadata for CrabIssuing before migration

  {
          name: CrabIssuing,
          storage: {
            prefix: DarwiniaCrabIssuing,
            items: [
              {
                name: TotalMappedRing,
                modifier: Default,
                type: {
                  Plain: MappedRing
                },
                fallback: 0x00000000000000000000000000000000,
                documentation: []
              }
            ]
          },
          calls: [],
          events: [
            {
              name: DummyEvent,
              args: [
                AccountId,
                RingBalance,
                MappedRing
              ],
              documentation: [
                 Dummy Event. [who, swapped *CRING*, burned Mapped *RING*]
              ]
            }
          ],
          constants: [
            {
              name: ModuleId,
              type: ModuleId,
              value: da/crais,
              documentation: []
            }
          ],
          errors: [],
          index: 33
        },

The metadata for CrabIssuing after migration

 {
          name: DarwiniaCrabIssuing,
          storage: {
            prefix: DarwiniaCrabIssuing,
            items: [
              {
                name: TotalMappedRing,
                modifier: Optional,
                type: {
                  Plain: MappedRing
                },
                fallback: 0x00,
                documentation: []
              }
            ]
          },
          calls: [],
          events: [
            {
              name: DummyEvent,
              args: [
                AccountId,
                RingBalance,
                MappedRing
              ],
              documentation: [
                 Dummy Event. [who, swapped *CRING*, burned Mapped *RING*]
              ]
            }
          ],
          constants: [
            {
              name: ModuleId,
              type: ModuleId,
              value: da/crais,
              documentation: []
            }
          ],
          errors: [],
          index: 33
        },

@songtianyi songtianyi changed the title feat: migrate crab issuing to use pallet! procedural macro feat: migrate crab issuing to use pallet! Mar 26, 2021
@AurevoirXavier AurevoirXavier added Migration Added BK-Storage [Break] This changes storage; next release should be major. P-Low [Priority] Low labels Mar 29, 2021
@AurevoirXavier AurevoirXavier merged commit defd022 into master Mar 30, 2021
@AurevoirXavier AurevoirXavier deleted the songtianyi-migrate-crab-issuing branch March 30, 2021 15:46
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
BK-Storage [Break] This changes storage; next release should be major. P-Low [Priority] Low
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants