Safe Haskell | None |
---|---|
Language | Haskell2010 |
EVM.Solidity
Synopsis
- solidity :: Text -> Text -> IO (Maybe ByteString)
- solcRuntime :: Text -> Text -> IO (Maybe ByteString)
- solidity' :: Text -> IO (Text, Text)
- data JumpType
- data SolcContract = SolcContract {
- _runtimeCodehash :: W256
- _creationCodehash :: W256
- _runtimeCode :: ByteString
- _creationCode :: ByteString
- _contractName :: Text
- _constructorInputs :: [(Text, AbiType)]
- _abiMap :: Map Word32 Method
- _eventMap :: Map W256 Event
- _storageLayout :: Maybe (Map Text StorageItem)
- _runtimeSrcmap :: Seq SrcMap
- _creationSrcmap :: Seq SrcMap
- data StorageItem = StorageItem {}
- data SourceCache = SourceCache {
- _sourceFiles :: Map Int (Text, ByteString)
- _sourceLines :: Map Int (Vector ByteString)
- _sourceAsts :: Map Text Value
- data SrcMap = SM {}
- data CodeType
- data Method = Method {
- _methodOutput :: [(Text, AbiType)]
- _methodInputs :: [(Text, AbiType)]
- _methodName :: Text
- _methodSignature :: Text
- data SlotType
- methodName :: Lens' Method Text
- methodSignature :: Lens' Method Text
- methodInputs :: Lens' Method [(Text, AbiType)]
- methodOutput :: Lens' Method [(Text, AbiType)]
- abiMap :: Lens' SolcContract (Map Word32 Method)
- eventMap :: Lens' SolcContract (Map W256 Event)
- storageLayout :: Lens' SolcContract (Maybe (Map Text StorageItem))
- contractName :: Lens' SolcContract Text
- constructorInputs :: Lens' SolcContract [(Text, AbiType)]
- creationCode :: Lens' SolcContract ByteString
- functionAbi :: Text -> IO Method
- makeSrcMaps :: Text -> Maybe (Seq SrcMap)
- readSolc :: FilePath -> IO (Maybe (Map Text SolcContract, SourceCache))
- readJSON :: Text -> Maybe (Map Text SolcContract, Map Text Value, [(Text, Maybe ByteString)])
- readStdJSON :: Text -> Maybe (Map Text SolcContract, Map Text Value, [(Text, Maybe ByteString)])
- readCombinedJSON :: Text -> Maybe (Map Text SolcContract, Map Text Value, [(Text, Maybe ByteString)])
- runtimeCode :: Lens' SolcContract ByteString
- runtimeCodehash :: Lens' SolcContract W256
- creationCodehash :: Lens' SolcContract W256
- runtimeSrcmap :: Lens' SolcContract (Seq SrcMap)
- creationSrcmap :: Lens' SolcContract (Seq SrcMap)
- sourceFiles :: Lens' SourceCache (Map Int (Text, ByteString))
- sourceLines :: Lens' SourceCache (Map Int (Vector ByteString))
- sourceAsts :: Lens' SourceCache (Map Text Value)
- stripBytecodeMetadata :: ByteString -> ByteString
- stripBytecodeMetadataSym :: [SWord 8] -> [SWord 8]
- 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
Documentation
solcRuntime :: Text -> Text -> IO (Maybe ByteString) Source #
Constructors
JumpInto | |
JumpFrom | |
JumpRegular |
data SolcContract Source #
Constructors
SolcContract | |
Fields
|
Instances
data StorageItem Source #
Instances
Eq StorageItem Source # | |
Defined in EVM.Solidity | |
Show StorageItem Source # | |
Defined in EVM.Solidity Methods showsPrec :: Int -> StorageItem -> ShowS # show :: StorageItem -> String # showList :: [StorageItem] -> ShowS # |
data SourceCache Source #
Constructors
SourceCache | |
Fields
|
Instances
Constructors
SM | |
Fields
|
Instances
Eq SrcMap Source # | |
Ord SrcMap Source # | |
Show SrcMap Source # | |
Generic SrcMap Source # | |
type Rep SrcMap Source # | |
Defined in EVM.Solidity type Rep SrcMap = D1 ('MetaData "SrcMap" "EVM.Solidity" "hevm-0.46.0-inplace" 'False) (C1 ('MetaCons "SM" 'PrefixI 'True) ((S1 ('MetaSel ('Just "srcMapOffset") 'SourceUnpack 'NoSourceStrictness 'DecidedStrict) (Rec0 Int) :*: S1 ('MetaSel ('Just "srcMapLength") 'SourceUnpack 'NoSourceStrictness 'DecidedStrict) (Rec0 Int)) :*: (S1 ('MetaSel ('Just "srcMapFile") 'SourceUnpack 'NoSourceStrictness 'DecidedStrict) (Rec0 Int) :*: (S1 ('MetaSel ('Just "srcMapJump") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 JumpType) :*: S1 ('MetaSel ('Just "srcMapModifierDepth") 'SourceUnpack 'NoSourceStrictness 'DecidedStrict) (Rec0 Int))))) |
Constructors
Method | |
Fields
|
Instances
Eq Method Source # | |
Ord Method Source # | |
Show Method Source # | |
Generic Method Source # | |
type Rep Method Source # | |
Defined in EVM.Solidity type Rep Method = D1 ('MetaData "Method" "EVM.Solidity" "hevm-0.46.0-inplace" 'False) (C1 ('MetaCons "Method" 'PrefixI 'True) ((S1 ('MetaSel ('Just "_methodOutput") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 [(Text, AbiType)]) :*: S1 ('MetaSel ('Just "_methodInputs") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 [(Text, AbiType)])) :*: (S1 ('MetaSel ('Just "_methodName") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Text) :*: S1 ('MetaSel ('Just "_methodSignature") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Text)))) |
Constructors
StorageMapping (NonEmpty AbiType) AbiType | |
StorageValue AbiType |
storageLayout :: Lens' SolcContract (Maybe (Map Text StorageItem)) Source #
constructorInputs :: Lens' SolcContract [(Text, AbiType)] Source #
readSolc :: FilePath -> IO (Maybe (Map Text SolcContract, SourceCache)) Source #
readJSON :: Text -> Maybe (Map Text SolcContract, Map Text Value, [(Text, Maybe ByteString)]) Source #
readStdJSON :: Text -> Maybe (Map Text SolcContract, Map Text Value, [(Text, Maybe ByteString)]) Source #
readCombinedJSON :: Text -> Maybe (Map Text SolcContract, Map Text Value, [(Text, Maybe ByteString)]) Source #
sourceFiles :: Lens' SourceCache (Map Int (Text, ByteString)) Source #
sourceLines :: Lens' SourceCache (Map Int (Vector ByteString)) Source #
sourceAsts :: Lens' SourceCache (Map Text Value) Source #
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.
stripBytecodeMetadataSym :: [SWord 8] -> [SWord 8] Source #