Safe Haskell | None |
---|---|
Language | Haskell2010 |
Basic types for the test framework.
Synopsis
- data ContractHandle (cp :: Type) (st :: Type) (vd :: Type) = (NiceParameter cp, NiceStorage st, NiceViewsDescriptor vd) => ContractHandle {
- chContractName :: Text
- chAddress :: Address
- chNiceParameterEvi :: forall param st vd. ContractHandle param st vd -> Dict (ParameterScope $ ToT st)
- chNiceStorageEvi :: forall param st vd. ContractHandle param st vd -> Dict (StorageScope $ ToT st)
- class ToAddress addr => ToStorageType st addr where
- pickNiceStorage :: addr -> Dict (NiceStorage st)
- type NiceParameter a = (ProperParameterBetterErrors (ToT a), KnownValue a)
- type NiceParameterFull cp = (Typeable cp, ParameterDeclaresEntrypoints cp)
- type NiceStorage a = (ProperStorageBetterErrors (ToT a), KnownValue a)
- type NicePackedValue a = (ProperPackedValBetterErrors (ToT a), KnownValue a)
- type NiceUnpackedValue a = (ProperUnpackedValBetterErrors (ToT a), KnownValue a)
- class ToAddress a
- toAddress :: ToAddress a => a -> Address
Documentation
data ContractHandle (cp :: Type) (st :: Type) (vd :: Type) Source #
Handle to a contract.
This is what you get when originating a contract and that allows further operations with the contract within the test framework.
Note that this is part of the testing framework and exists solely in Haskell
world, so it has no IsoValue
and related instances and cannot be used in
Lorentz code.
(NiceParameter cp, NiceStorage st, NiceViewsDescriptor vd) => ContractHandle | |
|
Instances
chNiceParameterEvi :: forall param st vd. ContractHandle param st vd -> Dict (ParameterScope $ ToT st) Source #
Extract the evidence in typed Michelson that the parameter type is valid for such scope.
chNiceStorageEvi :: forall param st vd. ContractHandle param st vd -> Dict (StorageScope $ ToT st) Source #
Extract the evidence in typed Michelson that the storage type is valid for such scope.
class ToAddress addr => ToStorageType st addr where Source #
Declares that addr
points to an entity with a storage.
addr
may fix storage type or may not - in the latter case the caller
has to specify the storage type explicitly via type annotation.
pickNiceStorage :: addr -> Dict (NiceStorage st) Source #
Pick proof of that storage type is valid.
Instances
NiceStorage st => ToStorageType st Address Source # | |
Defined in Test.Cleveland.Lorentz.Types pickNiceStorage :: Address -> Dict (NiceStorage st) Source # | |
st ~ st' => ToStorageType st' (ContractHandle cp st vd) Source # | |
Defined in Test.Cleveland.Lorentz.Types pickNiceStorage :: ContractHandle cp st vd -> Dict (NiceStorage st') Source # |
type NiceParameter a = (ProperParameterBetterErrors (ToT a), KnownValue a) #
type NiceParameterFull cp = (Typeable cp, ParameterDeclaresEntrypoints cp) #
type NiceStorage a = (ProperStorageBetterErrors (ToT a), KnownValue a) #
type NicePackedValue a = (ProperPackedValBetterErrors (ToT a), KnownValue a) #
type NiceUnpackedValue a = (ProperUnpackedValBetterErrors (ToT a), KnownValue a) #
Instances
ToAddress Address | |
Defined in Lorentz.Address | |
ToAddress EpAddress | |
Defined in Lorentz.Address | |
ToAddress (FutureContract cp) | |
Defined in Lorentz.Address | |
ToAddress (ContractRef cp) | |
Defined in Lorentz.Address | |
ToAddress (TAddress cp vd) | |
Defined in Lorentz.Address | |
ToAddress (ContractHandle cp st vd) Source # | |
Defined in Test.Cleveland.Lorentz.Types toAddress :: ContractHandle cp st vd -> Address # |
Notes
A note on TAddress
instance for ToStorageType
TAddress
isn't intended to be a part of the Cleveland API.
In the absolute majority of cases, if one is interested in both parameter
and storage, then they should use ContractHandle
, as the storage type
needs to be known either way. If one isn't interested in storage, they
presumably wouldn't call functions to get storage. Hence, this instance
wouldn't be particularly useful. Legacy code using TAddress
instead of
ContractHandle
should be preferably updated, if possible. If nothing
else, toAddress
can be used as a stopgap measure.