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

Lorentz.Contracts.UpgradeableCounter

Description

UpgradeableCounter demonstrates the implementation of a simple contract that has upgradeable storage, interface, and implementation.

In the first version it stores a Natural and allows to add some value to it or multiply the current value by a certain natural number.

The second version changes the type of the stored value to Integer, and instead of providing Mul Natural and Add Natural endpoints, it just allows to increment or decrement the current value.

While the contract does not have any advanced functionality, it provides a birds-eye view on all the aspects of the upgradeable contracts concept and serves as an example on how to apply this concept.

Synopsis

Documentation

data Parameter (ver :: VersionKind) Source #

Parameter of upgradeable contract. It contains, among others:

  1. Entrypoint for running one of upgradeable entrypoints.
  2. Entrypoint for running one of permanent entrypoints, suitable e.g. for implementing interfaces. 3a. Entrypoint for upgrade in a single call. 3b. Entrypoints for entrypoint-wise upgrade.

Instances

Instances details
(Show (VerParam ver), Show (VerPermanent ver)) => Show (Parameter ver) Source # 
Instance details

Defined in Lorentz.Contracts.Upgradeable.Common.Contract

Methods

showsPrec :: Int -> Parameter ver -> ShowS #

show :: Parameter ver -> String #

showList :: [Parameter ver] -> ShowS #

Generic (Parameter ver) Source # 
Instance details

Defined in Lorentz.Contracts.Upgradeable.Common.Contract

Associated Types

type Rep (Parameter ver) :: Type -> Type #

Methods

from :: Parameter ver -> Rep (Parameter ver) x #

to :: Rep (Parameter ver) x -> Parameter ver #

(interface ~ VerInterface ver, UnpackUParam Buildable interface, Buildable (VerPermanent ver)) => Buildable (Parameter ver) Source # 
Instance details

Defined in Lorentz.Contracts.Upgradeable.Common.Contract

Methods

build :: Parameter ver -> Builder #

PermConstraint ver => ParameterHasEntrypoints (Parameter ver) Source # 
Instance details

Defined in Lorentz.Contracts.Upgradeable.Common.Contract

Associated Types

type ParameterEntrypointsDerivation (Parameter ver) #

IsoValue (VerPermanent ver) => IsoValue (Parameter ver) Source # 
Instance details

Defined in Lorentz.Contracts.Upgradeable.Common.Contract

Associated Types

type ToT (Parameter ver) :: T #

Methods

toVal :: Parameter ver -> Value (ToT (Parameter ver)) #

fromVal :: Value (ToT (Parameter ver)) -> Parameter ver #

NiceVersion ver => TypeHasDoc (Parameter ver) Source # 
Instance details

Defined in Lorentz.Contracts.Upgradeable.Common.Contract

type Rep (Parameter ver) Source # 
Instance details

Defined in Lorentz.Contracts.Upgradeable.Common.Contract

type Rep (Parameter ver) = D1 ('MetaData "Parameter" "Lorentz.Contracts.Upgradeable.Common.Contract" "morley-upgradeable-0.3-inplace" 'False) (((C1 ('MetaCons "Run" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (VerParam ver))) :+: C1 ('MetaCons "RunPerm" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (VerPermanent ver)))) :+: (C1 ('MetaCons "Upgrade" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (OneShotUpgradeParameters ver))) :+: (C1 ('MetaCons "GetVersion" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (View () Version))) :+: C1 ('MetaCons "SetAdministrator" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Address))))) :+: ((C1 ('MetaCons "EpwBeginUpgrade" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 ("current" :! Version, "new" :! Version))) :+: C1 ('MetaCons "EpwApplyMigration" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (MigrationScriptFrom (VerUStoreTemplate ver))))) :+: (C1 ('MetaCons "EpwSetCode" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 SomeUContractRouter)) :+: (C1 ('MetaCons "EpwSetPermCode" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (SomePermanentImpl (VerPermanent ver)))) :+: C1 ('MetaCons "EpwFinishUpgrade" 'PrefixI 'False) (U1 :: Type -> Type)))))
type ParameterEntrypointsDerivation (Parameter ver) Source # 
Instance details

Defined in Lorentz.Contracts.Upgradeable.Common.Contract

type ToT (Parameter ver) Source # 
Instance details

Defined in Lorentz.Contracts.Upgradeable.Common.Contract

type ToT (Parameter ver) = GValueType (Rep (Parameter ver))
type TypeDocFieldDescriptions (Parameter ver) Source # 
Instance details

Defined in Lorentz.Contracts.Upgradeable.Common.Contract

data Storage (ver :: VersionKind) Source #

Instances

Instances details
Generic (Storage ver) Source # 
Instance details

Defined in Lorentz.Contracts.Upgradeable.Common.Contract

Associated Types

type Rep (Storage ver) :: Type -> Type #

Methods

from :: Storage ver -> Rep (Storage ver) x #

to :: Rep (Storage ver) x -> Storage ver #

HasAnnotation (VerPermanent ver) => HasAnnotation (Storage ver) Source # 
Instance details

Defined in Lorentz.Contracts.Upgradeable.Common.Contract

WellTypedIsoValue (VerPermanent ver) => IsoValue (Storage ver) Source # 
Instance details

Defined in Lorentz.Contracts.Upgradeable.Common.Contract

Associated Types

type ToT (Storage ver) :: T #

Methods

toVal :: Storage ver -> Value (ToT (Storage ver)) #

fromVal :: Value (ToT (Storage ver)) -> Storage ver #

NiceVersion ver => TypeHasDoc (Storage ver) Source # 
Instance details

Defined in Lorentz.Contracts.Upgradeable.Common.Contract

Associated Types

type TypeDocFieldDescriptions (Storage ver) :: FieldDescriptions #

type Rep (Storage ver) Source # 
Instance details

Defined in Lorentz.Contracts.Upgradeable.Common.Contract

type Rep (Storage ver)
type ToT (Storage ver) Source # 
Instance details

Defined in Lorentz.Contracts.Upgradeable.Common.Contract

type ToT (Storage ver) = GValueType (Rep (Storage ver))
type TypeDocFieldDescriptions (Storage ver) Source # 
Instance details

Defined in Lorentz.Contracts.Upgradeable.Common.Contract