module Michelson.Runtime.Dummy
( dummyNow
, dummyLevel
, dummyMaxSteps
, dummyContractEnv
, dummyOrigination
) where
import Michelson.Interpret (ContractEnv(..), RemainingSteps)
import Michelson.Runtime.GState (genesisAddress)
import Michelson.Typed (ParameterScope, StorageScope)
import qualified Michelson.Typed as T
import Michelson.Typed.Origination (OriginationOperation(..))
import Tezos.Core (Timestamp(..), dummyChainId, unsafeMkMutez)
dummyNow :: Timestamp
dummyNow :: Timestamp
dummyNow = POSIXTime -> Timestamp
Timestamp 100
dummyLevel :: Natural
dummyLevel :: Natural
dummyLevel = 0
dummyMaxSteps :: RemainingSteps
dummyMaxSteps :: RemainingSteps
dummyMaxSteps = 100500
dummyContractEnv :: ContractEnv
dummyContractEnv :: ContractEnv
dummyContractEnv = $WContractEnv :: Timestamp
-> RemainingSteps
-> Mutez
-> TcOriginatedContracts
-> Address
-> Address
-> Address
-> Mutez
-> ChainId
-> Maybe OperationHash
-> GlobalCounter
-> Natural
-> ContractEnv
ContractEnv
{ ceNow :: Timestamp
ceNow = Timestamp
dummyNow
, ceMaxSteps :: RemainingSteps
ceMaxSteps = RemainingSteps
dummyMaxSteps
, ceBalance :: Mutez
ceBalance = HasCallStack => Word64 -> Mutez
Word64 -> Mutez
unsafeMkMutez 100
, ceContracts :: TcOriginatedContracts
ceContracts = TcOriginatedContracts
forall a. Monoid a => a
mempty
, ceSelf :: Address
ceSelf = Address
genesisAddress
, ceSource :: Address
ceSource = Address
genesisAddress
, ceSender :: Address
ceSender = Address
genesisAddress
, ceAmount :: Mutez
ceAmount = HasCallStack => Word64 -> Mutez
Word64 -> Mutez
unsafeMkMutez 100
, ceChainId :: ChainId
ceChainId = ChainId
dummyChainId
, ceOperationHash :: Maybe OperationHash
ceOperationHash = Maybe OperationHash
forall a. Maybe a
Nothing
, ceGlobalCounter :: GlobalCounter
ceGlobalCounter = 0
, ceLevel :: Natural
ceLevel = Natural
dummyLevel
}
dummyOrigination
:: (ParameterScope cp, StorageScope st)
=> T.Value st
-> T.Contract cp st
-> OriginationOperation
dummyOrigination :: Value st -> Contract cp st -> OriginationOperation
dummyOrigination storage :: Value st
storage contract :: Contract cp st
contract = $WOriginationOperation :: forall (cp :: T) (st :: T).
(StorageScope st, ParameterScope cp) =>
Address
-> Maybe KeyHash
-> Mutez
-> Value st
-> Contract cp st
-> OriginationOperation
OriginationOperation
{ ooOriginator :: Address
ooOriginator = Address
genesisAddress
, ooDelegate :: Maybe KeyHash
ooDelegate = Maybe KeyHash
forall a. Maybe a
Nothing
, ooBalance :: Mutez
ooBalance = HasCallStack => Word64 -> Mutez
Word64 -> Mutez
unsafeMkMutez 100
, ooStorage :: Value st
ooStorage = Value st
storage
, ooContract :: Contract cp st
ooContract = Contract cp st
contract
}