| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
EVM.Types
Synopsis
- data Word512 = Word512 !Word256 !Word256
- data Int512 = Int512 !Int256 !Word256
- data Buffer
- newtype W256 = W256 Word256
- data Word = C Whiff W256
- w256 :: W256 -> Word
- newtype ByteStringS = ByteStringS ByteString
- data SymWord = S Whiff (SWord 256)
- var :: String -> SWord 256 -> SymWord
- iteWhiff :: Whiff -> SBool -> SWord 256 -> SWord 256 -> SymWord
- data Whiff
- = Todo String [Whiff]
- | And Whiff Whiff
- | Or Whiff Whiff
- | Eq Whiff Whiff
- | LT Whiff Whiff
- | GT Whiff Whiff
- | SLT Whiff Whiff
- | SGT Whiff Whiff
- | IsZero Whiff
- | ITE Whiff Whiff Whiff
- | SHL Whiff Whiff
- | SHR Whiff Whiff
- | SAR Whiff Whiff
- | Add Whiff Whiff
- | Sub Whiff Whiff
- | Mul Whiff Whiff
- | Div Whiff Whiff
- | Mod Whiff Whiff
- | Exp Whiff Whiff
- | Neg Whiff
- | FromKeccak Buffer
- | FromBytes Buffer
- | FromStorage Whiff (SArray (WordN 256) (WordN 256))
- | Literal W256
- | Var String (SWord 256)
- newtype Addr = Addr {}
- newtype SAddr = SAddr {
- saddressWord160 :: SWord 160
- type family FromSizzle (t :: Type) :: Type where ...
- class FromSizzleBV a where
- fromSizzle :: a -> FromSizzle a
- maybeLitWord :: SymWord -> Maybe Word
- type family ToSizzle (t :: Type) :: Type where ...
- class ToSizzleBV a where
- w256lit :: W256 -> SymWord
- litBytes :: ByteString -> [SWord 8]
- toChecksumAddress :: String -> String
- strip0x :: ByteString -> ByteString
- hexByteString :: String -> ByteString -> ByteString
- hexText :: Text -> ByteString
- readN :: Integral a => String -> a
- readNull :: Read a => a -> String -> a
- wordField :: Object -> Text -> Parser W256
- addrField :: Object -> Text -> Parser Addr
- addrFieldMaybe :: Object -> Text -> Parser (Maybe Addr)
- dataField :: Object -> Text -> Parser ByteString
- toWord512 :: W256 -> Word512
- fromWord512 :: Word512 -> W256
- num :: (Integral a, Num b) => a -> b
- padLeft :: Int -> ByteString -> ByteString
- padRight :: Int -> ByteString -> ByteString
- padRight' :: Int -> String -> String
- truncpad :: Int -> [SWord 8] -> [SWord 8]
- padLeft' :: Num a => Int -> [a] -> [a]
- word256 :: ByteString -> Word256
- word :: ByteString -> W256
- byteAt :: (Bits a, Bits b, Integral a, Num b) => a -> Int -> b
- fromBE :: Integral a => ByteString -> a
- asBE :: Integral a => a -> ByteString
- word256Bytes :: W256 -> ByteString
- word160Bytes :: Addr -> ByteString
- newtype Nibble = Nibble Word8
- hi :: Word8 -> Nibble
- lo :: Word8 -> Nibble
- toByte :: Nibble -> Nibble -> Word8
- unpackNibbles :: ByteString -> [Nibble]
- packNibbles :: [Nibble] -> ByteString
- keccakBytes :: ByteString -> ByteString
- word32 :: [Word8] -> Word32
- keccak :: ByteString -> W256
- abiKeccak :: ByteString -> Word32
- concatMapM :: Monad m => (a -> m [b]) -> [a] -> m [b]
- regexMatches :: Text -> Text -> Bool
Documentation
Instances
Instances
Constructors
| ConcreteBuffer ByteString | |
| SymbolicBuffer [SWord 8] |
Instances
| Show Buffer Source # | Operations over buffers (concrete or symbolic) A buffer is a list of bytes. For concrete execution, this is simply |
| Semigroup Buffer Source # | |
| Monoid Buffer Source # | |
| EqSymbolic Buffer Source # | |
Defined in EVM.Types Methods (.==) :: Buffer -> Buffer -> SBool # (./=) :: Buffer -> Buffer -> SBool # (.===) :: Buffer -> Buffer -> SBool # (./==) :: Buffer -> Buffer -> SBool # distinct :: [Buffer] -> SBool # distinctExcept :: [Buffer] -> [Buffer] -> SBool # allEqual :: [Buffer] -> SBool # | |
| SDisplay Buffer Source # | |
Instances
Instances
| Bounded Word Source # | |
| Enum Word Source # | |
| Eq Word Source # | |
| Integral Word Source # | |
| Num Word Source # | |
| Ord Word Source # | |
| Read Word Source # | |
| Real Word Source # | |
Defined in EVM.Types Methods toRational :: Word -> Rational # | |
| Show Word Source # | |
| ToJSON Word Source # | |
| Bits Word Source # | |
Defined in EVM.Types Methods (.&.) :: Word -> Word -> Word # (.|.) :: Word -> Word -> Word # complement :: Word -> Word # shift :: Word -> Int -> Word # rotate :: Word -> Int -> Word # setBit :: Word -> Int -> Word # clearBit :: Word -> Int -> Word # complementBit :: Word -> Int -> Word # testBit :: Word -> Int -> Bool # bitSizeMaybe :: Word -> Maybe Int # shiftL :: Word -> Int -> Word # unsafeShiftL :: Word -> Int -> Word # shiftR :: Word -> Int -> Word # unsafeShiftR :: Word -> Int -> Word # rotateL :: Word -> Int -> Word # | |
| FiniteBits Word Source # | |
Defined in EVM.Types Methods finiteBitSize :: Word -> Int # countLeadingZeros :: Word -> Int # countTrailingZeros :: Word -> Int # | |
| SDisplay Word Source # | |
newtype ByteStringS Source #
Constructors
| ByteStringS ByteString |
Instances
| Eq ByteStringS Source # | |
Defined in EVM.Types | |
| Show ByteStringS Source # | |
Defined in EVM.Types Methods showsPrec :: Int -> ByteStringS -> ShowS # show :: ByteStringS -> String # showList :: [ByteStringS] -> ShowS # | |
| ToJSON ByteStringS Source # | |
Defined in EVM.Types Methods toJSON :: ByteStringS -> Value # toEncoding :: ByteStringS -> Encoding # toJSONList :: [ByteStringS] -> Value # toEncodingList :: [ByteStringS] -> Encoding # | |
Symbolic words of 256 bits, possibly annotated with additional "insightful" information
Instances
iteWhiff :: Whiff -> SBool -> SWord 256 -> SWord 256 -> SymWord Source #
Instead of supporting a Mergeable instance directly, we use one which carries the Whiff around:
This type can give insight into the provenance of a term which is useful, both for the aesthetic purpose of printing terms in a richer way, but also do optimizations on the AST instead of letting the SMT solver do all the heavy lifting.
Constructors
| Todo String [Whiff] | |
| And Whiff Whiff | |
| Or Whiff Whiff | |
| Eq Whiff Whiff | |
| LT Whiff Whiff | |
| GT Whiff Whiff | |
| SLT Whiff Whiff | |
| SGT Whiff Whiff | |
| IsZero Whiff | |
| ITE Whiff Whiff Whiff | |
| SHL Whiff Whiff | |
| SHR Whiff Whiff | |
| SAR Whiff Whiff | |
| Add Whiff Whiff | |
| Sub Whiff Whiff | |
| Mul Whiff Whiff | |
| Div Whiff Whiff | |
| Mod Whiff Whiff | |
| Exp Whiff Whiff | |
| Neg Whiff | |
| FromKeccak Buffer | |
| FromBytes Buffer | |
| FromStorage Whiff (SArray (WordN 256) (WordN 256)) | |
| Literal W256 | |
| Var String (SWord 256) |
Constructors
| Addr | |
Fields | |
Instances
Constructors
| SAddr | |
Fields
| |
type family FromSizzle (t :: Type) :: Type where ... Source #
Capture the correspondence between sized and fixed-sized BVs
(This is blatant copypasta of FromSized from sbv, which just
happens to be defined up to 64 bits)
Equations
| FromSizzle (WordN 256) = W256 | |
| FromSizzle (WordN 160) = Addr |
class FromSizzleBV a where Source #
Conversion from a sized BV to a fixed-sized bit-vector.
Minimal complete definition
Nothing
Methods
fromSizzle :: a -> FromSizzle a Source #
Convert a sized bit-vector to the corresponding fixed-sized bit-vector,
for instance 'SWord 16' to SWord16. See also toSized.
default fromSizzle :: (Num (FromSizzle a), Integral a) => a -> FromSizzle a Source #
Instances
| FromSizzleBV (WordN 160) Source # | |
Defined in EVM.Types Methods fromSizzle :: WordN 160 -> FromSizzle (WordN 160) Source # | |
| FromSizzleBV (WordN 256) Source # | |
Defined in EVM.Types Methods fromSizzle :: WordN 256 -> FromSizzle (WordN 256) Source # | |
class ToSizzleBV a where Source #
Conversion from a fixed-sized BV to a sized bit-vector.
Minimal complete definition
Nothing
litBytes :: ByteString -> [SWord 8] Source #
toChecksumAddress :: String -> String Source #
strip0x :: ByteString -> ByteString Source #
hexByteString :: String -> ByteString -> ByteString Source #
hexText :: Text -> ByteString Source #
fromWord512 :: Word512 -> W256 Source #
padLeft :: Int -> ByteString -> ByteString Source #
padRight :: Int -> ByteString -> ByteString Source #
word256 :: ByteString -> Word256 Source #
word :: ByteString -> W256 Source #
fromBE :: Integral a => ByteString -> a Source #
asBE :: Integral a => a -> ByteString Source #
word256Bytes :: W256 -> ByteString Source #
word160Bytes :: Addr -> ByteString Source #
Instances
unpackNibbles :: ByteString -> [Nibble] Source #
packNibbles :: [Nibble] -> ByteString Source #
keccakBytes :: ByteString -> ByteString Source #
keccak :: ByteString -> W256 Source #
abiKeccak :: ByteString -> Word32 Source #
concatMapM :: Monad m => (a -> m [b]) -> [a] -> m [b] Source #