Safe Haskell | Safe-Inferred |
---|---|
Language | GHC2021 |
Synopsis
- solidity :: MonadUnliftIO m => Text -> Text -> m (Maybe ByteString)
- solcRuntime :: MonadUnliftIO m => Text -> Text -> m (Maybe ByteString)
- yul :: Text -> Text -> IO (Maybe ByteString)
- yulRuntime :: Text -> Text -> IO (Maybe ByteString)
- data JumpType
- data SolcContract = SolcContract {
- runtimeCodehash :: W256
- creationCodehash :: W256
- runtimeCode :: ByteString
- creationCode :: ByteString
- contractName :: Text
- constructorInputs :: [(Text, AbiType)]
- abiMap :: Map FunctionSelector Method
- eventMap :: Map W256 Event
- errorMap :: Map W256 SolError
- immutableReferences :: Map W256 [Reference]
- storageLayout :: Maybe (Map Text StorageItem)
- runtimeSrcmap :: Seq SrcMap
- creationSrcmap :: Seq SrcMap
- newtype Contracts = Contracts (Map Text SolcContract)
- data ProjectType
- data BuildOutput = BuildOutput {}
- data StorageItem = StorageItem {}
- data SourceCache = SourceCache {}
- data SrcMap = SM {}
- data CodeType
- data Method = Method {
- output :: [(Text, AbiType)]
- inputs :: [(Text, AbiType)]
- name :: Text
- methodSignature :: Text
- mutability :: Mutability
- data SlotType
- data Reference = Reference {}
- data Mutability
- = Pure
- | View
- | NonPayable
- | Payable
- readBuildOutput :: FilePath -> ProjectType -> IO (Either String BuildOutput)
- functionAbi :: Text -> IO Method
- makeSrcMaps :: Text -> Maybe (Seq SrcMap)
- readSolc :: ProjectType -> FilePath -> FilePath -> IO (Either String BuildOutput)
- readJSON :: ProjectType -> Text -> Text -> Maybe (Contracts, Asts, Sources)
- readStdJSON :: Text -> Maybe (Contracts, Asts, Sources)
- stripBytecodeMetadata :: ByteString -> ByteString
- stripBytecodeMetadataSym :: [Expr Byte] -> [Expr Byte]
- signature :: AsValue s => s -> Text
- solc :: Language -> Text -> IO Text
- data Language
- stdjson :: Language -> Text -> Text
- parseMethodInput :: AsValue s => s -> (Text, AbiType)
- lineSubrange :: Vector ByteString -> (Int, Int) -> Int -> Maybe (Int, Int)
- astIdMap :: Foldable f => f Value -> Map Int Value
- astSrcMap :: Map Int Value -> SrcMap -> Maybe Value
- containsLinkerHole :: Text -> Bool
- makeSourceCache :: FilePath -> Sources -> Asts -> IO SourceCache
Documentation
solidity :: MonadUnliftIO m => Text -> Text -> m (Maybe ByteString) Source #
solcRuntime :: MonadUnliftIO m => Text -> Text -> m (Maybe ByteString) Source #
yulRuntime :: Text -> Text -> IO (Maybe ByteString) Source #
data SolcContract Source #
SolcContract | |
|
Instances
A mapping from contract identifiers (filepath:name) to a SolcContract object
data ProjectType Source #
The various project types understood by hevm
Instances
Read ProjectType Source # | |
Defined in EVM.Solidity readsPrec :: Int -> ReadS ProjectType # readList :: ReadS [ProjectType] # readPrec :: ReadPrec ProjectType # readListPrec :: ReadPrec [ProjectType] # | |
Show ProjectType Source # | |
Defined in EVM.Solidity showsPrec :: Int -> ProjectType -> ShowS # show :: ProjectType -> String # showList :: [ProjectType] -> ShowS # | |
Eq ProjectType Source # | |
Defined in EVM.Solidity (==) :: ProjectType -> ProjectType -> Bool # (/=) :: ProjectType -> ProjectType -> Bool # | |
ParseField ProjectType Source # | |
Defined in EVM.Solidity |
data BuildOutput Source #
Instances
Monoid BuildOutput Source # | |
Defined in EVM.Solidity mempty :: BuildOutput # mappend :: BuildOutput -> BuildOutput -> BuildOutput # mconcat :: [BuildOutput] -> BuildOutput # | |
Semigroup BuildOutput Source # | |
Defined in EVM.Solidity (<>) :: BuildOutput -> BuildOutput -> BuildOutput # sconcat :: NonEmpty BuildOutput -> BuildOutput # stimes :: Integral b => b -> BuildOutput -> BuildOutput # | |
Show BuildOutput Source # | |
Defined in EVM.Solidity showsPrec :: Int -> BuildOutput -> ShowS # show :: BuildOutput -> String # showList :: [BuildOutput] -> ShowS # | |
Eq BuildOutput Source # | |
Defined in EVM.Solidity (==) :: BuildOutput -> BuildOutput -> Bool # (/=) :: BuildOutput -> BuildOutput -> Bool # |
data StorageItem Source #
Instances
Show StorageItem Source # | |
Defined in EVM.Solidity showsPrec :: Int -> StorageItem -> ShowS # show :: StorageItem -> String # showList :: [StorageItem] -> ShowS # | |
Eq StorageItem Source # | |
Defined in EVM.Solidity (==) :: StorageItem -> StorageItem -> Bool # (/=) :: StorageItem -> StorageItem -> Bool # |
data SourceCache Source #
Instances
Instances
Generic SrcMap Source # | |
Show SrcMap Source # | |
Eq SrcMap Source # | |
Ord SrcMap Source # | |
type Rep SrcMap Source # | |
Defined in EVM.Solidity type Rep SrcMap = D1 ('MetaData "SrcMap" "EVM.Solidity" "hevm-0.53.0-inplace" 'False) (C1 ('MetaCons "SM" 'PrefixI 'True) ((S1 ('MetaSel ('Just "offset") 'SourceUnpack 'SourceStrict 'DecidedStrict) (Rec0 Int) :*: S1 ('MetaSel ('Just "length") 'SourceUnpack 'SourceStrict 'DecidedStrict) (Rec0 Int)) :*: (S1 ('MetaSel ('Just "file") 'SourceUnpack 'SourceStrict 'DecidedStrict) (Rec0 Int) :*: (S1 ('MetaSel ('Just "jump") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 JumpType) :*: S1 ('MetaSel ('Just "modifierDepth") 'SourceUnpack 'SourceStrict 'DecidedStrict) (Rec0 Int))))) |
Method | |
|
Instances
Generic Method Source # | |
Show Method Source # | |
Eq Method Source # | |
Ord Method Source # | |
type Rep Method Source # | |
Defined in EVM.Solidity type Rep Method = D1 ('MetaData "Method" "EVM.Solidity" "hevm-0.53.0-inplace" 'False) (C1 ('MetaCons "Method" 'PrefixI 'True) ((S1 ('MetaSel ('Just "output") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [(Text, AbiType)]) :*: S1 ('MetaSel ('Just "inputs") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [(Text, AbiType)])) :*: (S1 ('MetaSel ('Just "name") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text) :*: (S1 ('MetaSel ('Just "methodSignature") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text) :*: S1 ('MetaSel ('Just "mutability") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Mutability))))) |
data Mutability Source #
Pure | specified to not read blockchain state |
View | specified to not modify the blockchain state |
NonPayable | function does not accept Ether - the default |
Payable | function accepts Ether |
Instances
readBuildOutput :: FilePath -> ProjectType -> IO (Either String BuildOutput) Source #
Reads all solc output json files found under the provided filepath and returns them merged into a BuildOutput
readSolc :: ProjectType -> FilePath -> FilePath -> IO (Either String BuildOutput) Source #
readStdJSON :: Text -> Maybe (Contracts, Asts, Sources) Source #
Parses the standard json output from solc
stripBytecodeMetadata :: ByteString -> ByteString Source #
When doing CREATE and passing constructor arguments, Solidity loads the argument data via the creation bytecode, since there is no "calldata" for CREATE.
This interferes with our ability to look up the current contract by codehash, so we must somehow strip away this extra suffix. Luckily we can detect the end of the actual bytecode by looking for the "metadata hash". (Not 100% correct, but works in practice.)
Actually, we strip away the entire BZZR suffix too, because as long as the codehash matches otherwise, we don't care if there is some difference there.
astIdMap :: Foldable f => f Value -> Map Int Value Source #
Every node in the AST has an ID, and other nodes reference those IDs. This function recurses through the tree looking for objects with the "id" key and makes a big map from ID to value.
containsLinkerHole :: Text -> Bool Source #
makeSourceCache :: FilePath -> Sources -> Asts -> IO SourceCache Source #