morley-upgradeable-0.3: Upgradeability infrastructure based on Morley.
Safe HaskellNone
LanguageHaskell2010

Lorentz.Contracts.Upgradeable.Common.Interface

Description

Type-safe interface for constructing contract upgrades.

Use this module as follows: 1. Construct EpwUpgradeParameters; 2. Use one of the respective functions to convert it to an actual upgrade, one-shot or entrypoint-wise, for tests or production.

Synopsis

Documentation

data EpwUpgradeParameters (t :: Type -> Type) (curVer :: VersionKind) (newVer :: VersionKind) Source #

Type-safe upgrade construction.

Constructors

forall code codePerm.(Traversable t, KnownContractVersion curVer, KnownContractVersion newVer, RequireSamePermanents (VerPermanent curVer) (VerPermanent newVer), RecognizeUpgPiece (UContractRouterUpdate curVer newVer) code, RecognizeUpgPiece (PermanentImplUpdate curVer newVer) codePerm) => EpwUpgradeParameters 

Fields

fvUpgrade :: forall ver t. (KnownContractVersion ver, Traversable t) => t (MigrationScript (VerUStoreTemplate ver) (VerUStoreTemplate ver)) -> EpwUpgradeParameters t ver ver Source #

Make up a "fixed version" upgrade. As argument you supply result of migrationToScriptI or migrationToScripts and entrypoint-wise migration will be used inside.

Use this method in case you need to authoritatively perform arbitrary modifications of contract storage.

makeOneShotUpgradeParameters :: forall curVer newVer. EpwUpgradeParameters Identity curVer newVer -> OneShotUpgradeParameters curVer Source #

Construct OneShotUpgradeParameters.

Naturally, you can construct this kind of upgrade only if your migration has exactly one stage; for batched migrations use makeEpwUpgrade.

makeOneShotUpgrade :: forall oldVer newVer. EpwUpgradeParameters Identity oldVer newVer -> Parameter oldVer Source #

Construct a call which should be performed in order to perform migration.

makeEpwUpgrade :: forall curVer newVer t. EpwUpgradeParameters t curVer newVer -> [Parameter curVer] Source #

Construct calls which should be performed in order to perform full entrypoint-wise migration.

data UpgradeWay (t :: Type -> Type) where Source #

Way of performing an upgrade.

Constructors

UpgOneShot :: UpgradeWay Identity

Perform upgrade in a single transaction. This, naturally, cannot be used with batched migrations.

UpgEntrypointWise :: UpgradeWay t

Perform upgrade calling one entrypoint per transaction.

Instances

Instances details
Show (UpgradeWay t) Source # 
Instance details

Defined in Lorentz.Contracts.Upgradeable.Common.Interface

type SimpleUpgradeWay = UpgradeWay Identity Source #

UpgradeWay which can be used with simple (non-batched) migrations.

integrationalTestUpgrade :: PermConstraint curVer => EpwUpgradeParameters t curVer newVer -> UpgradeWay t -> UTAddress curVer -> IntegrationalScenarioM (UTAddress newVer) Source #

Perform a contract upgrade in an integrational test scenario.